Logic has a long history [ logic_history.html ] but it changed more in the 19th and 20th centuries than it did in the previous 2000 years!
My focus in this page is using modern, formal, and symbolic logic in a simple and practical way. I'm not so concerned with the philosophical issues.
Using Logic
Logic can be a useful tool - when combined with normal human creativity.
It is a means to avoid making mistakes. It is a way to clarify
confusion -- it nails the jelly to the tree. Symbolic logic
boils out the "goo and dribble"("Foundation" by Isaac Asimov).
Symbols give a short-hand notation and so a key to
faster thinking. I have used symbolic logic for note taking
for many years.
Within software development it can be used to express domain knowledge (what is known or assumed about the world in which software exists), requirements (the way we wish the world was), and specifications ( how the software must behave to satisfy the requirements). It can also be used to find logic errors in programs ( situations where the program does not fit the specification). Unlike testing logic permits a systematic search for errors can end up showing that a piece of software has no bugs. I've used logic like this ( when I've had the time) since the late 1960s.
Unlike creativity, logic can be taught. I've done this. So have
many others in computer science degrees:
[ logicthetool.html ]
Problems
The key problems of trying to use formal logic real life are:
The notation described here tries to answer the first two problems by having a fairly intuitive ASCII coding of logical concepts plus a way of packaging up logical systems for future Internet reuse. The third problem can be handled by people putting logical systems for the vital trivia of everyday life on the World wide web. They can then be reused via a hypertext link.
Here is an quick introduction to the notation used to express logic in MATHS.
Propositions
Propositions are statements that can only have one of
have two possible meanings - true and false. There are
operators that combine two propositions into a single more
complex ones. The operators are those found in programming
language (and, or, not) plus some more theoretical ones.
x<1 and y>2
not ( x>=1 or y<=2)
The symbol @ represents the type with two values {true, false} and the operators
`not`, `and`, `or`, `iff` `if__then_` `:-`.A proposition can has two possible meanings - true and false - the Booleans
Operations
The simplest operator is not. You write it in front
of a proposition.
It changes true to false and vice versa:
The following table summarizes how the other operators work:
| Formula | Case1 | Case2 | Case3 | Case4 | Syntax | Precedence |
|---|---|---|---|---|---|---|
| P | true | true | false | false | ||
| Q | true | false | true | false | ||
| P and Q | true | false | false | false | infix(serial) | 2nd (after not and (...)) |
| P or Q | true | true | true | false | infix(serial) | 3rd (after and) |
| P iff Q | true | false | false | true | infix(parallel) | 4th |
| if P then Q | true | false | true | true | natural | 5th |
| Q:-P | true | false | true | true | infix | See [ clausal_form ] below. |
`and`, `or`, `iff` `:-`.are infix operators turning two Booleans into a Boolean, and 'if__then__' is a distfix operator . They each take two Booleans (@><@) and return a Boolean (->@) as shown below:
raining and windy
raining or windy
x < y iff y > x
if raining then I_get_wet.
I_get_wet :- raining.
For instance
Note the similarity of clauses to definitions:
Definitions imply the equality of two expressions. Clauses allow partial definition in the listed cases...
Predicates
A predicate is a proposition that has one or more variables or
constants that represent objects other than the values true and false.
For example
Quantifiers
In the following X stands for a name of a type, x is a variable and
W(x) a predicate containing x in a number of places.
It is also OK to write things like this
for all Numbers n,....as short for
for all n:Numbers.However the type of the variable (Number above) must indicated by a name, not a formula to avoid ambiguities.
Logical Notation for TeXies
The following (from Knuth's typesetting program)
can also be used:
| MATHS | \TeX |
|---|---|
| and | \land |
| or | \lor |
| not | \neg |
| if p then q | p \to q |
| iff | \leftrightarrow |
| for all | \forall |
| for some | \exists |
Types
In programming language we have data types. In modern logic we have types.
Most practical programmers
do not know that the idea of type and much of the type systems
that they use were invented to resolve paradoxes in logic
in the late 1800s and early 1900s.
In MATHS variables are always attached to a type and this type determines the values it may have and the operations and functions that can be applied to it. This turns out to be very useful for writing programs. It also allows the economy of overloaded operator and function symbols.
Much of the logic is defined using generic types with symbolic names (usually T). These are very like templates in C++ or generic packages in Ada. An actual type is substituted when the logic is put to use.
We can define the predicate calculus as the logic of objects of a given (generic) type.
Also created an early logic machine -- a kind of piano
for playing syllogisms, if I recall correctly.
Boolean Algebra
. . . . . . . . . ( end of section Notes) <<Contents | End>>
. . . . . . . . . ( end of section Logic) <<Contents | End>>
Notes on MATHS Notation
Special characters are defined in
[ intro_characters.html ]
that also outlines the syntax of expressions and a document.
Proofs follow a natural deduction style that start with assumptions ("Let") and continue to a consequence ("Close Let") and then discard the assumptions and deduce a conclusion. Look here [ Block Structure in logic_25_Proofs ] for more on the structure and rules.
The notation also allows you to create a new network of variables
and constraints, and give them a name. The schema, formal system,
or an elementary piece of documentation starts with "Net" and finishes "End of Net".
For more, see
[ notn_13_Docn_Syntax.html ]
for these ways of defining and reusing pieces of logic and algebra
in your documents.
Notes on the Underlying Logic of MATHS
The notation used here is a formal language with syntax
and a semantics described using traditional formal logic
[ logic_0_Intro.html ]
plus sets, functions, relations, and other mathematical extensions.
For a complete listing of pages by topic see [ home.html ]