3.4 Computability in logic
3.4.2 First-order logic
Formulas Let us develop the formal system found most adequate to describe mathematics. A first-order language uses the following symbols:
• An infinite supply of variables: x, y, z, x1, x2, . . ., to denote elements of the universe
(the set of objects) to which the language refers.
• Some function symbols like f, g, h,+,·, f1, f2, . . . , where each function symbol has a
property called “arity” specifying the number of arguments of the function it will rep- resent. A function of arity 0 is called aconstant. It refers to some fixed element of the universe. Some functions, like +,·are used in infix notation.
• Some predicate symbols like<, >,⊂,⊃, P, Q, R, P1, P2, . . ., also of different arities. A
predicate symbol with arity 0 is also called a propositional symbol. Some predicate symbols, like <, are used with infix notation. The equality “=” is a distinguished predicate symbol.
• Quantifiers: ∀,∃. • Punctuation: (,).
Atermis obtained by taking some constants and variables and applying function symbols to them a finite number of times: e.g. (x+ 2) +y or f(f(x, y), g(c)) are terms (here, 2 is a constant).
Anatomic formula has the formP(t1, . . . , tk) where P is a predicate symbol and ti are
terms: e.g.x+y <(x·x) + 1 is an atomic formula.
Aformulais formed from atomic formulas by applying repeatedly the Boolean operations and the adding of prefixes of the form∀xand∃x: e.g.∀x(x < y)⇒ ∃zg(c, z) orx=x∨y=y
are formulas. In the formula ∃y(∀x(F) ⇒G), the subformula F is called thescope of the
x-quantifier. An occurrence of a variable xin a formula is said to be bound if it is in the scope of an x-quantifier; otherwise the occurrence is said to befree. A formula with no free (occurrences of) variables is said to be asentence; sentences make formulas which under any given “interpretation” of the language, are either true of false.
Let us say that a termtissubstitutablefor variablexin formulaAif no variableyoccurs in t for which some free occurrence ofxin Ais in the scope of some quantifier ofy. If t is substitutable forxin A then we writeA[t/x] for the result of substituting tinto every free occurrence ofxinA: e.g. ifA= (x <3−x) andt= (y2) thenA[t/x] = (y2<3−y2).
From now on, all our formal systems are some language of first-order logic, so they only differ in what function symbols and predicate symbols are present.
There are natural ways to give interpretation to all terms and formulas of a first-order language in such a way that under such an interpretation, all sentences become true or false. This interpretation introduces a set called theuniverseand assigns functions and predicates over this universe to the functions (and constants) and predicates of the language.
Example 3.4.3 Consider the language with the constantsc0, c1and the two-argument func-
tion symbolf. In one interpretation, the universe is the set of natural numbers,c0= 0, c1= 1,
f(a, b) =a+b. In another interpretation, the universe is{0,1},c0= 0,c1= 1,f(a, b) =a·b.
There are certain sentences that are true in both of these interpretations but not in all possible ones: such is∀x∀y f(x, y) =f(y, x).
For a given theory T, an interpretation of its language is called a model of T if the axioms (and thus all theorems) of the theory are true in it. In the above Example 3.4.3, both interpretations are models of the theoryT1defined by the single axiom∀x∀y f(x, y) =f(y, x).
It has been recognized long ago that the proof checking algorithm can be made indepen- dent of the theory: theories are different only in their axioms. This algorithm is exactly what
3.4. COMPUTABILITY IN LOGIC 51 we mean by “pure logical reasoning”; for first order logic, it was first formalized in the book Principia Mathematica by Russell and Whitehead at the beginning of the 20th century. We will outline one such algorithm at the end of the present subsection. G¨odelproved in 1930 that ifBimpliesT in all interpretations of the sentences then there is a proof of the Principia Mathematica type for it. The following theorem is a consequence.
Theorem 3.4.3 G¨odel’s completeness theorem Let P be the set of all pairs (B, T)where B is a finite set of sentences andT is a sentence that is true in all interpretations in which the elements ofB are true. The set P is recursively enumerable.
Tarski proved that the algebraic theory of real numbers (and with it, all Euclidean ge- ometry) is complete. This is in contrast to the theories of natural numbers, among which the minimally adequate ones are incomplete. (In the algebraic theory of real numbers, we cannot speak of an “arbitrary integer”, only of an “arbitrary real number”.) Theorem 3.4.1 implies that there is an algorithm to decide the truth of an arbitrary algebraic sentence on real numbers. The known algorithms for doing this take a very long time, but are improving. Proofs A proof is a sequence F1, . . . , Fn of formulas in which each formula is either an
axiom or is obtained from previous formulas in the sequence using one of the rules given below. In these rules,A, B, C are arbitrary formulas, andxis an arbitrary variable.
There is an infinite number of formulas that we will require to be part of the set of axioms of each theory: these are therefore called logical axioms. These will not all necessarily be sentences: they may contain free variables. To give the axioms, some more notions must be defined.
LetF(X1, . . . , Xn) be a Boolean formula of the variablesX1, . . . , Xn, with the property
that it gives the value 1 for all possible substitutions of 0 or 1 intoX1, . . . , Xn. Letϕ1, . . . , ϕn
be arbitrary formulas. Formulas of the kindF(ϕ1, . . . , ϕn) are calledtautologies.
The logical axioms of our system consist of the following groups: Tautologies: All tautologies are axioms.
Equality axioms: Lett1, . . . , tn,u1, . . . , unbe terms,f a function symbol andPa predicate
symbol, of arityn. Then
(t1=u1∧ · · · ∧tn=un)⇒f(t1, . . . , tn) =f(u1, . . . , un),
(t1=u1∧ · · · ∧tn=un)⇒(P(t1, . . . , tn)⇔P(u1, . . . , un))
The definition of∃: For all formulasAand variablesx, the formula∃x A⇔ ¬∀x¬Ais an axiom.
Specialization: If termt is substitutable for variable xin formulaA then ∀x A ⇒A[t/x] is an axiom.
The system has two rules:
Modus ponens: FromA⇒B andB ⇒C, we can deriveA⇒C.
Generalization: If the variablexdoes not occur free inAthen fromA⇒B we can derive
A⇒ ∀x B.
Remark 3.4.3 The generalization rule says that if we can derive a statementB containing the variablexwithout using any properties ofxin our assumptions then it is true for arbitrary values ofx. It doesnot say thatB ⇒ ∀xB is true.
For the system above, the following stronger form of G¨odel’s completeness theorem holds. Theorem 3.4.4 Suppose thatB is a set of sentences andT is a sentence that is true in all interpretations in which the elements ofBare true. Then there is a proof in the proof system Pof T from the axioms ofB.