<<

MATHEMATICAL Narrowly construed, is the study of deﬁnition and in YIANNIS N. MOSCHOVAKIS mathematical models of fragments of lan- guage, especially the ﬁrst order logic frag- ment. Logic has made critical contributions

I. Propositional Logic, PL . to the foundations of science, especially L II. First Order Logic, FO . through the work of Kurt G¨odel, and it III. G¨odel’ Incompleteness Theorem. also has numerous applications. For the- IV. Computability. ory theoretical V. Recursion and Programming. and , these VI. Alternative . applications are so important, that parts VII. . of these ﬁelds are normally included in the modern, broad conception of the discipline. Glossary I. Propositional Logic, PL Church-Turing Thesis: Claim that ev- ery computable can be computed Each logic L has a which delin- by a Turing machine. eates the grammatically correct linguistic Computability theory: Study of com- expressions of L, a which assigns putable functions on the natural . meaning to the correct expressions, and a Continuum hypothesis: Conjecture structured system of proofs which speciﬁes that there are only two sizes of inﬁnite sets the rules by which some L-expressions can of real numbers. be inferred from others. Database: Finite, typically relational There are other words to describe these structure. things: formal language is sometimes used First order logic: Mathematical model to describe a plain syntax, of the part of language built up from the pro- often identiﬁes a syntax together with an positional connectives and the quantiﬁers. inference system (but without an interpre- Incompleteness phenomenon: G¨odel’s tation), and abstract logic has been used to discovery, that suﬃciently strong axiomatic refer to a syntax together with an interpreta- theories cannot decide all propositions which tion, leaving inference aside. It is, however, they can express. a fundamental feature of logic that it draws : Study of formal deﬁn- clean distinctions and studies the connec- ability in ﬁrst order structures. tions among these three aspects of language. : Counterintuitive . We explain them ﬁrst in the simplest exam- Peano : Axiomatic theory of ple of the “logic of propositions”, which is natural numbers. part of many important logics. Proof theory: Study of inference in for- A. Propositional Syntax mal systems independently of their interpre- tation. The symbols of PL are the connectives Propositional connectives: The lin- ¬ (not) & (and) ∨ (or) guistic constructs “and”, “not”, “or” and “implies”. → (implies, if-then) Quantiﬁers: The linguistic constructs the two parentheses ‘(’, ‘)’, and an inﬁ- “there exists” and “for all”. nite list of (formal) propositional variables Turing machine: Mathematical model P0, P1, P2,... which intuitively stand for of computing device with unbounded mem- declarative propositions, things like ‘John ory. loves Mary’ or ‘3 is a prime ’. It has Unsolvable problem: A problem whose only one category of grammatically correct solution requires a non-existent . expressions, the formulas, which are strings 1 2 YIANNIS N. MOSCHOVAKIS

(ﬁnite ) of symbols deﬁned induc- what the truth value of B, so that ‘if the tively by the following conditions: moon is made of cheese, then 1 + 1 = 5’ is F1. Each Pi is a formula. true (on the plausible assumption that the F2. If A and B are formulas, then so are moon is not made of cheese). This material the expressions implication assumed by Propositional Logic has been attacked as counterintuitive, but it ¬A (A & B) (A ∨ B) (A → B) agrees with mathematical practice and it is For example, if P and Q are propositional the only useful of implication variables, then (P → Q) and (P ∨¬P ) are which accords with the Compositionality formulas, which we read as “if P then Q” Principle. and “either P or not P ”. Using these rules, we can construct for The inductive deﬁnition gives a precise each formula A a truth table which tabulates speciﬁcation of exactly which strings of sym- its truth value under all assignments of truth bols are formulas, and also insures that each values to the variables. For example, the formula is either prime, i.e., just a variable truth table for (Q → P ) consists of the ﬁrst Pi, or it can be constructed in exactly one three columns of Table 2 while the ﬁrst two way from its simpler immediate parts, by one of the connectives. This makes it possible to P Q (Q → P ) (P → (Q → P )) prove properties of formulas and to deﬁne 1 1 1 1 operations on them by structural induction 1 0 1 1 on their deﬁnition. 0 0 1 1 More propositional connectives can be in- 0 1 0 1 troduced as “abbreviations” of formula com- Table 2. binations, e.g., and the last column give the truth table for A ↔ B ≡ ((A → B)&(B → A)) (P → (Q → P )) . A ∨ B ∨ ≡ (A ∨ (B ∨ C)). If n variables occur in a formula A, then the truth table for A has 2n rows and de- B. Propositional Semantics termines an n-ary function vA, with ar- If B stands for some true proposition, guments and values in the two- set then ¬B is false, independently of the {1, 0}. By the Deﬁnitional Completeness “meaning” or internal structure of B. This Theorem, every n-ary bit function is vA for is an instance of a general Compositional- some A, so that the formulas of PL provide ity Principle for PL: The truth value of a deﬁnitions (or “symbolic representations”) formula depends only on the truth values for all bit functions. of its immediate parts. The semantics of A formula A is a semantic consequence PL comprise the rules for computing truth of a set of formulas T (or T -valid) if every values, and they can be summarized in Ta- assignment to the variables which satisﬁes ble 1, where 1 stands for ‘truth’ and 0 for (makes true) all the formulas in T also sat- ‘falsity’. By the ﬁrst of this table, for isﬁes A,. We write

A B ¬A (A & B) (A ∨ B) (A → B) T |= A ⇔ A is T -valid, 1 1 0 1 1 1 and |= A, in the important special case when 1 0 0 0 1 0 T is empty, in which case A is called a tau- 0 1 1 0 1 1 tology. A formula A is satisﬁable if some 0 0 1 0 0 1 assignment satisﬁes it, i.e., if ¬A is not a Table 1. Truth value semantics. tautology. Let example, if A and B are both true, then ¬A A ∼ B ⇔ {A} |= B and {B} |= A is false while (A & B), (A ∨ B) and (A → B) ⇔ |= A ↔ B, are all true. Notice that if A is false, then (A → B) is reckoned to be true no matter and call A and B equivalent if A ∼ B. MATHEMATICAL LOGIC 3

Equivalent formulas deﬁne the same bit the computation of bit functions by appeal- function, and they can be substituted for ing to the formula representations of the cir- each other without changing truth values. cuits which realize them. For example, using Clearly disjunctive normal forms, one sees immedi- ately that (if we do not care about cost), (A → B) ∼ (¬A ∨ B), every n-ary bit function can be computed by so that the implication connective is super- an unbounded fan-in circuit in no more than ﬂuous. In fact, every formula is equivalent 3 time units. There is, in general, a sub- to one in disjunctive normal form, i.e., a dis- stantial trade-oﬀ between the size and time junction A1 ∨···∨ Ak where each Ai is a complexity of the circuits which compute a conjunction of variables or of vari- given bit function. ables (literals). . The Satisﬁability Problem C. Applications to Circuits The assertion that “C(A) and C(B) Each formula A with n variables can be never give the same output on the same realized by a switching circuit C(A) with n inputs” means precisely that “(A ↔¬B) is inputs and one output, so that C(Pi) con- a tautology”, so that to detect that A and B sists of just one input-output edge, C(A&B) do not have this safety property we need to is constructed by joining C(A) and C(B) determine whether the formula ¬(A ↔¬B) with an and-gate, etc. Figure 1 exhibits the is satisﬁable. Because of such natural formulations P 1 s of “error detection” for circuits relative & - ¬ > s - to given speciﬁcations, it is very impor- P ∨ 2 > tant to ﬁnd eﬃcient for deter- P 3 mining whether a given formula is satisﬁ- able. The problem is of non-deterministi- Fig. 1. The circuit for (¬((P1 & P2) ∨ P3). cally time complexity (NP), be- circuit for ((P1 &P2) → P3) using the equiv- cause it can be resolved by guessing (“non- alent formula without implications, so that deterministically”) some assignment and only ¬-, &- and ∨-gates are required. These then verifying that it satisﬁes A in a number are restricted circuits, of fan-in (maximum of steps which is bounded by a polynomial number of edges into a node) 2 and fan-out in the length of A; and it is NP-complete, 1, but the Deﬁnitional Completeness The- i.e., every NP-problem can be “reduced” to orem implies that every n-ary bit function it by a polynomial reduction. This is a ba- can be computed by some formula circuit sic result of S. Cook, who introduced the C(A). complexity class NP, showed that it con- There are basically two useful measures tains a large number of important problems, of circuit complexity, and both of them are and asked if it coincides with the (seem- faithfully mirrored in formulas. The num- ingly) smaller class P of “feasible”, deter- ber of gates of C(A) is exactly the number ministically polynomial time problems. The of connectives in A and measures size com- question whether P = NP is the fundamen- plexity (construction cost), while the depth tal open problem of complexity theory; it of C(A), which measures the time complex- amounts simply to the question whether the ity of computation, is exactly the rank of satisﬁability problem can be solved by a de- A, deﬁned inductively so that rk(Pi) = 1, terministic, polynomial algorithm. rk(A&B) = max(rk(A), rk(B))+1 and sim- ilarly for the other connectives. One can E. Propositional Inference now use natural manipulations of formulas A proof of a formula A from a set of hy- to construct circuits which compute a given potheses T is any ﬁnite bit function with minimum size or time com- plexity, or to establish optimality results for A0,A1,...,An−1,A 4 YIANNIS N. MOSCHOVAKIS which ends with A, and such that each Ai is M gives the two-element set {1, 0} of truth either in T , or a PL-, or follows from values; but there are others, e.g., the set of previously listed formulas by a rule of infer- all ﬁnite and co-ﬁnite of some in- ence. To make this notion precise we need ﬁnite set, the set of all “closed and open” to specify a set of PL- and rules of in- subsets of a topological , etc. ference; and for these to be useful, it should Each formula A with n variables deﬁnes be that they are few and easy to understand, an n-ary function on every Boolean algebra and that the formulas provable from T are B, simply by letting the propositional vari- exactly the T -tautologies. ables range over B and replacing ¬, & and ∨ We need just one, binary inference rule: and → by ′, ∩, ∪ and ⇒ respectively, where A (A → B) x ⇒ y = x′ ∪ y (Modus Ponens) B on B. Now the axioms for a Boolean al- This is sound, i.e., {A, (A → B)} |= B, gebra insure that every propositional axiom so that if A and (A → B) are both T - deﬁnes a function with constant value 1—in tautologies, then so is B. fact the particular choice of axiomatization An axiom is any instance of the following for Boolean algebras (and there are many) is axiom schemes, where A, B and C are arbi- quite irrelevant as long as this fact obtains; trary formulas and we have omitted several and then the Completeness Theorem implies parentheses which pedantry would require: that two formulas A and B deﬁne the same (1) A → (B → A) n-ary on all Boolean algebras ex- (2) (A → B) actly when A ∼ B, i.e., when A and B deﬁne → (A → (B → C)) → (A → C) the same bit function. Boolean algebras have many important (3) A → (B → (A & B))  applications in mathematics (to (4) (A & B) → A (4′) (A & B) → B ′ theory, among other things), and they are (5) A → (A ∨ B) (5 ) B → (A ∨ B) the subject of the classical Stone Represen- (6) (A → C) tation Theorem which identiﬁes them all → (B → C) → ((A ∨ B) → C) (up to ) with subalgebras of powerset algebras. In logic they are mostly (7) (A → B) → (A →¬B) →¬A  used through the “non-standard” Boolean (8) ¬¬A → A   semantics of this subsection, which extend These are all tautologies, and so every for- to richer logics and provide a powerful tool mula provable from T is T -valid. We write for independence (unprovability) results. T ⊢ A ⇔ there is a proof of A from T, II. First Order Logic, FOL and it is not hard now to establish the Soundness and Completeness Theorem Consider the claim: for PL. For all sets T and any A, If everybody has a mother, and T |= A ⇔ T ⊢ A. every mother loves her children, then everybody is loved by F. Boolean Algebras somebody. A Boolean algebra is a set B with at least It is certainly true, it has the “linguistic two, distinct elements 0 and 1, a unary com- form” of many similar (more substantial) plementation operation ′, and binary inﬁ- claims in mathematics, and it appears to mum ∩ and supremum ∪ operations such be true by virtue of its form and not be- that certain properties hold. The standard cause of any special properties of the words example is the set P(M) of all subsets of “mother”, “love”, etc. First Order Logic some non- M, with 0 = ∅, 1 = M makes it possible to express complex asser- and the usual complementation, intersection tions of this type and to show that they are and union operations, which for a singleton true by logic alone. The symbolic expression MATHEMATICAL LOGIC 5 of this one will be quantiﬁcation is only allowed over individ- uals; if we add formula formation rules (∀x)(∃y)M(x, y) n n (∀Pi )A (∃Pi )A h &(∀x)(∀y)[M(x, y) → L(y,x)] we obtain the formulas of second order logic, SOL → (∀x)(∃y)L(y,xi ), . Consider the simple formula give-or-take a few parentheses and (1) (∃v )(¬v = v & P1(v )). which will be required to make the syntax 2 2 1 1 2 completely precise. Its “translation” into English by the reading of the symbols we have introduced is

A. First Order Syntax some object other than v1 P1 The symbols of FOL are the propositional has the property 1 connectives, the parentheses, the quantiﬁers which is exactly how we would translate the result of substituting v3 for v2 in it, ∀ (for all) ∃ (there exists) 1 (∃v3)(¬v3 = v1 & P1(v3)). the comma ‘,’, the symbol ‘=’, an This is because both occurrences of v in (1) inﬁnite list v , v ,... of individual variables 2 0 1 are bound by the quantiﬁer ∃v , just as the which will denote arbitrary objects in some 2 occurrences of x are bound by the dx in domain, and for each n = 0, 1,..., two inﬁ- 1 x2dx and can be replaced by y without nite lists of function and relational symbols 0 changing the meaning of the deﬁnite inte- n n n n f0 , f1 ,..., P0 , P1 ,..., gral. On the other hand, the occurrence of v1 in (1) is free, because it is not within the which will stand for n-ary functions and re- scope of any quantiﬁer, and so the inter- lations on the objects. pretation of v1 clearly aﬀects the meaning There are two categories of grammati- of (1). terms cally correct expressions in FOL, and Using the same simple example, consider formulas, deﬁned recursively by the follow- 1 1 the results of substituting f (v3) and f (v2) ing conditions. 0 0 for v1 in (1), T1. Each variable vi is a term. v v f1 v P1 v T2. If t1,...tn are terms, then (the (∃ 2)(¬ 2 = 0 ( 3) & 1( 2)), string) fn(t ,...,t ) is also a term. When 1 1 i 1 n (∃v2)(¬v2 = f0 (v2) & P1(v2)). n = 0, we write simply f0. i f1 v F1. If t ,...,t are terms, then the ex- The ﬁrst of these says of 0 ( 3) what (1) says 1 n v pressions of 2, but the second says that “something is 1 1 not a ﬁxed of f0 and has property P1”, n t1 = t2 Pi (t1,...,tn) which is quite diﬀerent—evidently because the variable v in f1(v ) is “caught” by the are formulas, the latter written simply P 2 0 2 i quantiﬁer ∃v . The ﬁrst is a free when n = 0. 2 (causing no confusion) while the second is F2. If A and B are formulas, then so are not. We will denote the result of substitut- the expressions ing the term t for the free occurrences of the ¬A (A & B) (A ∨ B) (A → B) variable x in some formula A by F3. If A is a formula, then so are the A{x :≡ t} expressions and we will tacitly assume that all substitu- tions are free. (∀v )A (∃v )A i i Formulas of FOL are too messy to write Notice that by the notational convention in down, and so we often resort to “informal F1, all PL-formulas are also FOL-formulas. ” of them like the example about This logic is called ﬁrst order because mothers loving their children above, recipes, 6 YIANNIS N. MOSCHOVAKIS

extends to FOL in a straightforward man- ı |= t1 = t2 ⇔ ı(t1) = ı(t2) ner and implies the following basic fact: the Pn Pn ı |= i (t1,...,tn) ⇔ (ı( i ))(ı(t1),...,ı(tn)) truth value of A relative to ı depends only on ı |= ¬A ⇔ ı 6|= A the values of ı on the function and relation ı |=(A & B) ⇔ ı |= A and ı |= B symbols which occur in A, and on the values ı |=(A ∨ B) ⇔ ı |= A or ı |= B ı(x) for the individual variables which occur in ı |=(A → B) ⇔ ı 6|= A or ı |= B free A. The Tarski conditions do nothing more ı vi A d , |=(∀ ) ⇔ for all in D than translate formulas into English, in ef- ı{vi := d}|= A fect identifying FOL with a precisely formu- ı |=(∃vi)A ⇔ for some d in D, lated, small but very expressive fragment of ı{vi := d}|= A natural language. Table 3. The Tarski truth conditions. C. Structures really, from which the full, grammatically A vocabulary (or signature) is any ﬁnite correct formula could (in principle) be con- sequence σ = {f1,..., fk, P1,..., Pl} of func- structed. tion and relation symbols, and FOL(σ) is the part of FOL whose formulas involve only B. First Order Semantics the function and relation symbols of σ. The idea is to think of f1,..., fk and P1,..., Pl as Whether (1) is true or false depends on constants, denoting ﬁxed functions and rela- v f1 the object 1, on the function 0 , on the tions on some set D, and to use the formulas P1 property 1, and (most signiﬁcantly) on the of FOL(σ) to study deﬁnability in structures range of objects over which we interpret the existential quantiﬁer—where do we search M =(DM , f1,...,fk,P1,...,Pl) 1 for things which may or may not satisfy P1? of vocabulary σ, where the universe DM To interpret the formulas of FOL we must of M is any non-empty set, and f1,...,fk, be given a domain D and an interpretation P1,...,Pl are functions and relations which ı, a function which assigns an object ı(vi) can be assigned to the vocabulary symbols, in D to each individual variable, an n-ary e.g., such that fi is n-ary if fi is n-ary. n function ı(fi ) on D to each n-ary function An M-assignment is any function α from n n symbol fi , and an n-ary relation ı(Pi ) on the variables to DM , and it extends natu- n D to each Pi . Using these, ﬁrst we extend rally to an interpretation αM by the associ- inductively ı to all terms by ation of fi with fi and Pi with Pi; the stan- n n dard notation for structure satisfaction is ı(fi (t1,...,tn))=(ı(fi ))(ı(t1),...,ı(tn)), M, α |= A ⇔ αM |= A. so that ı(t) is some object in D. To as- sign truth values to formulas, deﬁne ﬁrst, Formulas of FOL(σ) with no free variables for each variable x and d in D, the update are called sentences and (by the Composi- tionality Principle) they are simply true or  = ı{x := d}, false in every σ-structure, without which agrees with ı on all function and rela- to any assignment. They deﬁne properties tion symbols, and also on all individual vari- of structures. We write ables, except that (x) = d. With the help of M |= A ⇔ for any (and hence all) α, this basic operation, we can state in Table 3 M, α |= A (A a sentence), the classical Tarski truth conditions which determine the truth of formulas relative to and if M |= A, we say that M satisﬁes A or a ﬁxed domain D and an interpretation ı. is a model of A. The truth value of a formula A relative to While sentences deﬁne properties of struc- an interpretation ı is 1 if ı |= A and 0 oth- tures, formulas with free variables can be erwise, and the Compositionality Principle used to deﬁne relations on structures. If, for MATHEMATICAL LOGIC 7 example, A has at most one free variable x, important in their study. we set Two structures M1 and M2 are isomor- phic if some one-to-one correspondence be- RA(d) ⇔ M, α{x := d} |= A, tween their universes carries the functions where α is any assignment, since its only and relations of M1 to those of M2. Isomor- relevant value is updated in this deﬁnition. phic structures satisfy the same ﬁrst order In the same way, formulas with n free vari- sentences, but the converse is not true, as ables deﬁne n-ary relations on σ-structures, we will see in II-F. the ﬁrst order deﬁnable relations of M. A n function f : DM → DM is ﬁrst order deﬁn- D. Databases able if its graph In the most general terms, a database is just a ﬁnite structure, typically relational, Gf (x1,...,xn,w) ⇔ w = f(x1,...,xn) i.e., without functions, only relations. “Fi- is ﬁrst order deﬁnable. Some examples: nite” does not mean “small” or “simple”, A directed graph is a structure G = and in the interesting applications databases (D,E), where E is a binary “edge” relation are huge structures of large and complex vo- on the set of “nodes” G, and it is a graph cabularies, with basic relations such as “x is (undirected) if it satisﬁes the sentence an employee born in year n”, “y is the su- pervisor of x”, etc. Properties of structures (∀x)(∀y)[E(x, y) → E(y,x)]. are usually called queries in database the- ory, and one of the main tasks in the ﬁeld Complete graphs (cliques) are characterized is to develop representations for databases by the sentence which support fast algorithms for updating, (∀x)(∀y)E(x, y), entering new information in the and data testing, determining the truth or falsity while “diameter ≤ 2” is deﬁned by of queries. As it happens, both updating and data testing are very eﬃcient for ﬁrst order (∀x)(∀y)[x = y ∨ E(x, y) queries, and so database systems, including ∨ (∃z)[E(x, z) & E(z, y)]]. the industry standard SQL make heavy use of methods from ﬁrst order logic. Finite directed and undirected graphs are Motivated by Database Theory, a good used to model many notions in computer sci- deal of research has been done since the ence, e.g., circuits. 1970s in Finite Model Theory, the mathe- A () with identity is matical and logical study of ﬁnite structures. a structure (S, e, ·) where the identity e is For a rather surprising, basic result, let some speciﬁed member of S, · is a binary

” on S, and the following sen- Probσ[M |= A : |DM | = n] tences are true: = the proportion of σ-structures (∀x)(∀y)[x · (y · z)=(x · y) · z], of size n which satisfyA, (∀x)(x · e = x & e · x = x). where structures are counted “up to isomor-

Here and in the sequel we write t1 · t2 rather phism”. The - Law. For each sentence than the pedantically correct ·(t1,t2). FOL 0 1 A In to , there are of FOL(σ) in a relational vocabulary, either groups, rings, ﬁelds and ordered ﬁelds, vector lim Probσ[M |= A : |DM | = n] = 1, spaces, and any number of other structures n→∞ which are the stuﬀ of “abstract” algebra. or These classes of structures are all charac- lim Probσ[M |= A : |DM | = n] = 0, terized by ﬁrst order axioms, and the use of n→∞ methods from logic is becoming increasingly i.e., either A or ¬A is asymptotically true. 8 YIANNIS N. MOSCHOVAKIS

More advanced work in this area is con- model. cerned primarily with the algorithmic anal- For an impressive application, let (in the ysis of queries on ﬁnite structures, especially vocabulary of arithmetic) in logics richer than FOL. ∆0 ≡ 0, ∆m+1 ≡ (∆m + 1), E. Arithmetic so that the numeral ∆m is about the sim- Most basic is the structure of arithmetic plest term which denotes the number m, add a constant c to the language, and let N =(N, 0, 1, +, ·), where N = {0, 1,...} is the set of (non- T = {A : N |= A} negative) natural numbers and + and · are ∪ {∆0 ≤ c, ∆1 ≤ c, ∆2 ≤ c,...}. the operations of addition and multiplica- Every ﬁnite S of T has a model, tion. The ﬁrst order deﬁnable relations and namely functions on N are called arithmetical, and they obviously include addition, multiplica- NS =(N, 0, 1, +, ·,m), tion and the ordering on N, which is deﬁned where the object m which interprets c is by the formula some number bigger than all the numerals x ≤ y ≡ (∃z)[x + z = y]. which occur in formulas of S. So T has a countable model By a basic Lemma of G¨odel, if a function f N =(N, 0, 1, +, ·,c), is determined from arithmetical functions g T and h by the and then N = (N, 0, 1, +, ·) is a structure f(0, ~x) = g(~x) for the vocabulary of arithmetic which sat- (2) f(y + 1, ~x) = h(f(y, ~x), y, ~x), isﬁes all the ﬁrst order sentences true in the  “standard” structure N but is not isomor- then f is also arithmetical. Thus exponen- phic with N—because it has in it some ob- y tiation x is arithmetical, with g(x) = 1, ject c which is “larger” than all the interpre- h(w,y,x) = w · x, and, with some work, so tations of the numerals ∆0.∆1,.... It fol- is the function p(x) which enumerates the lows that, with all its expressiveness, First prime numbers, Order Logic does not capture the isomor- p(0) = 2, p(1) = 3, p(2) = 5, .... phism type of complex structures such as N. These non-standard models of arithmetic In fact, the scheme of Primitive Recur- were constructed by Skolem in the 30s. sion (2) is the basic method by which func- Later, in the 50s, Abraham Robinson con- tions are introduced in , so structed by the same methods non-standard that, with some work, all fundamental num- models of analysis, and provided ﬁrm foun- ber theoretic relations and functions are dations for the classical Calculus of Leibnitz arithmetical, and all celebrated theorems with its inﬁnitesimals and “inﬁnitely large” and open problems of the theory of num- real numbers. bers are expressed by ﬁrst order sentences Model Theory has advanced immensely of N. These include the The- since the early work of Tarski, Abraham orem, Fermat’s Last (Wiles’) Theorem, and Robinson and Malcev. Especially with the the (still open) question whether there exist contributions of Shelah in the 70s and, more inﬁnitely many twin pairs of prime numbers. recently, Hrushovsky, it has become one of the most mathematically sophisticated F. Model Theory branches of logic, with substantial applica- The mathematical theory of structures tions to algebra and number theory. starts with the following basic result: Compactness and Skolem-L¨owenheim The- G. First Order Inference orem. If every ﬁnite subset of a set of sen- The proof system of First Order Logic is tences T has a model, then T has a countable an extension of that for Propositional Logic, MATHEMATICAL LOGIC 9

Σ1 Σ2

0 0 It also has a special query state q?, and when ∆1 ∆2 ···

it goes into q?, the computation stops and

0 0 Π1 Π2 does not resume until some agent (the oracle) replaces the contents on the 0 and that a non-empty set Q is Σ1 exactly query tape by some string. when it is recursively (or computably) enu- A string function f is computable relative merable, i.e., if to some given g if it can be computed by Q = {f(0), f(1),...} such an oracle machine, provided each time q? is reached, the string u on the query tape ∗ with some recursive f : N → S . Moreover, is replaced by the value g(u). We let these classes increase properly and exhaust the arithmetical sets. A similar hierarchy f ≤T g ⇔ f is computable in g, 1 1 1 and we extend this notion of Turing re- Σk, Πk, ∆k ducibility to sets of natural numbers via for the analytical (second-order deﬁnable) their characteristic functions. sets is constructed by allowing the quantiﬁed It is not hard to show that there ex- variables to range over the unary functions ist Turing-incomparable sets of numbers α : N → N and the matrix to be arithmeti- (Kleene-Post). In fact, there exist Turing- 1 cal, so that all arithmetical sets are in ∆1. incomparable recursively enumerable sets, These hierarchies classify the analytical but this was quite hard to prove and it was sets of natural numbers and strings by the a celebrated open question for some twelve logical complexity of their (simplest) deﬁ- years, known as Post’s Problem. The si- nitions, and they are powerful tools in the multaneous, independent discovery in 1956 theory of deﬁnability. For example, by Friedberg and Muchnik of the priority 0 every axiomatizable theory is Σ1. method which proved it, initiated an intense This rules out an axiomatization of Second study of Turing reducibility which is still, Order Logic SOL, whose set of valid sen- today, one of the most active research areas tences (on the empty vocabulary) is not an- of logic, the largest (and technically most alytical. Somewhat surprisingly, it also rules sophisticated) part of computability or re- out an axiomatization of the theory cursion theory.

Tf = {A | for all ﬁnite (D,E), (D,E) |= A} V. Recursion and Programming 0 0 of ﬁnite graphs, which is Π1 but not Σ1 (Tra- chtenbrot). In its most general form, a recursive def- inition of a function x is expressed by a re- G. Turing reducibility cursive (or ﬁxed point) equation Imagine a Turing machine with a second (8) x(t) = f(t,x), query tape which it handles exactly like its where the functional f(t,x) provides a primary tape, implementing somewhat more method for computing each value x(t), per- complex transitions of the form haps using (“calling”) other values of x in ′ ′ ′ q,s1,s2 7→ q ,s1,s2,m1,m2 the process. It is possible to characterize the MATHEMATICAL LOGIC 17 computable functions on the natural num- complete, with the pointwise partial order- bers using simple recursive equations of this ing form, generalizations of the primitive recur- sive deﬁnition (2) in III-E. Though con- π ≤ ρ ⇔ for all x,π(x) ≤ ρ(x). ceptually less direct than Turing’s approach Here π : D → W is monotone if through idealized machines, this modeling of computability by “recursiveness” provides a x ≤D y =⇒ π(x) ≤W π(y), powerful tool for establishing properties of and it is Scott-continuous if, in addition, for computable functions, and it is especially every chain C in D, useful in the theory of programming lan- guages. π(supremum(C)) = supremum(π[C]).