You are on page 1of 193

Undergraduate Logic

Michael Stob August 16, 1996

ii

Preface
These notes form the textbook for the course Advanced Logic (Mathematics 381/Philosophy 381) taught at Calvin College. The main goal of this course is to give a self-contained introduction to mathematical logic through the completeness and incompleteness theorems of Godel. A second goal of almost equal importance is to develop further in each student the ability to construct clear and correct proofs to mathematical propositions. Included as an aid to reaching this second goal is an appendix that discusses the process of writing proofs. The notes are not self-contained and were not intended to be so. First, they are meant to be accompanied by the dialogue that occurs in the classroom. The lectures and the discussions about the problems are essential ingredients to understanding. Second, the material cannot be understood without doing most of the problems that are included. Important results and techniques are sometimes encountered for the rst time in the problems. These notes are certainly not polished. Mistakes of all sorts (both grammatical and mathematical) abound. I would be grateful to the reader for pointing out to me any such errors.

Contents
I Preliminaries
1 2 3 4 5 6 7 Introduction : : : : : : : : : : : Mathematical Induction : : : : Inductive De nitions - Formulas Structural Induction : : : : : : Ambiguity : : : : : : : : : : : : Countability : : : : : : : : : : : Computability : : : : : : : : : :

: : : : : : : : : : : :

: : : : : : : : : : : :

: : : : : : : : : : : :

: : : : : : : : : : : :

: : : : : : : : : : : :

: : : : : : : : : : : :

: : : : : : : : : : : :

: : : : : : : : : : : :

: : : : : : : : : : : :

: : : : : : : : : : : :

: : : : : : : : : : : :

: : : : : : : : : : : :

: : : : : : : : : : : :

: : : : : : : : : : : :

: : : : : : : : : : : :

: : : : : : : : : : : :

: : : : : : : : : : : :

1 5 10 15 19 23 27

II Propositional Logic
1 2 3 4 5

Truth : : : : : : : : : : : Tautological Consequence Compactness : : : : : : : Resolution : : : : : : : : : Resolution - 2 : : : : : : :

: : : : :

: : : : :

: : : : :

33

33 38 43 48 52

IIIStructures
1 2 3

What is a Structure? : : : : : : : : : : : : : : : : : : : : : : : 55 One Binary Relation : : : : : : : : : : : : : : : : : : : : : : : 59 One Binary Function : : : : : : : : : : : : : : : : : : : : : : : 64

55

IV First-order Logic
1 2 3 4 5 6

The language of rst-order logic What is Truth? : : : : : : : : : Proofs : : : : : : : : : : : : : : Logical Axioms : : : : : : : : : Proofs in Arithmetic : : : : : : Some Theorems about Proofs : iii

: : : : : :

: : : : : :

: : : : : :

: : : : : :

: : : : : :

: : : : : :

: : : : : :

: : : : : :

: : : : : :

: : : : : :

: : : : : :

: : : : : :

: : : : : :

: : : : : :

: : : : : :

: : : : : :

: : : : : :

69

69 75 80 84 87 92

iv 7 8 9 10 1 2 3 4 5 6 7 8 Completeness : : : : : : : : : : : : : : : : Completeness - The Model : : : : : : : : : Extensions to the Completeness Theorem : Applications of Completeness : : : : : : :

CONTENTS
: : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 97 : 100 : 103 : 107 : 113 : 117 : 125 : 127 : 130 : 134 : 138 : 140 : 143 : 148 : 152 : 160 : 163 : 166 : 169 : 171 : 175 : 179 : 182 : 182 : 182 : 183 : 184 : 186

V Computability

Unlimited Register Machines : : : : : : : : : A Plethora of URM-Computable Functions : Minimalization and the recursive functions : Church's Thesis : : : : : : : : : : : : : : : : Godel-numberings : : : : : : : : : : : : : : : The Universal Machine : : : : : : : : : : : : Undecidability : : : : : : : : : : : : : : : : : Naturally Occuring Undecidable Problems : Is Number Theory Easy? : : : : : : : : Godel's Incompleteness Theorem : : : Q and Numerability : : : : : : : : : : Computability and Binumerability : : Diagonalization and Godel's Theorem : Proofs in Mathematics : : : : : : Written Proofs : : : : : : : : : : Proverbs : : : : : : : : : : : : : : Contraposition and Contradiction Ten Rules : : : : : : : : : : : : : Forms of Theorems : : : : : : : : 6.1 Biconditional Theorems : 6.2 Existence Theorems : : : 6.3 Uniqueness : : : : : : : : 6.4 Universal Statements : : : Sets : : : : : : : : : : : : : : : :

113

VI Incompleteness
1 2 3 4 5

: : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : :

: : : : : : : : : : : : : : : :

143

A Writing Proofs
1 2 3 4 5 6

: : : : : : : : : : :

: : : : : : : : : : :

: : : : : : : : : : :

165

Chapter I Introduction and Mathematical Preliminaries


1 Introduction
We start with a de nition of mathematics.

De nition 1.1. Mathematics is the proving of propositions about abstract


objects. De nition 1.1 answers two questions about mathematics. First, the definition tells us what a mathematician studies | abstract objects. Second, the de nition tells us the method that a mathematician uses to come to knowledge about these objects | by proofs. One question about mathematics left unanswered in De nition 1.1 however is the purpose of mathematics. For what purpose do we seek to gain knowledge about abstract objects? This is the \applications" question: how is mathematics applied to the \real world?" One answer to this question can be found in the notion of mathematical model. The abstract objects of mathematics are usually proposed for study because they are thought to provide a model for some real-world phenomena. Functions of a single real variable model the data in the dynamics of straight-line motion. Abstract groups provide models for transformations and symmetries of physical objects. Probability theory provides a model for dealing with situations involving uncertainty. With this conception of mathematics in mind, we are now in a position to locate mathematical logic as a branch of mathematics. Mathematical logic 1

CHAPTER I. PRELIMINARIES

is the branch of mathematics which seeks to provide a mathematical model of mathematics itself. To see what this means, consider the de nition of mathematics above. A central problem in understanding mathematics is understanding what constitutes a proof. In this course we will expend much of our e ort in providing a mathematical model of proof. That is, we will give a de nition of an abstract object, which we will also call a proof, which we hope will model the most important features of proofs in the \real world" (if one calls mathematics the real world). Our principle questions will revolve around the issue of the relationship of truth to proof. Godel's celebrated Incompleteness Theorem is a good example of the sort of result we will prove. This theorem says, roughly, that given any \reasonable" set of axioms for elementary arithmetic, there is a true proposition of arithmetic for which there is no deduction from those axioms. That is, there is a true but unprovable proposition about the natural numbers. With all mathematical models there is the question of how faithful the model is to the phenomenon being modeled. A proof is not an abstract object after all, it is an argument given usually in words and pictures by one human to another. It is a phenomenon with psychological and sociological dimensions. At the end of the course it will be up to you to decide whether the abstract system we develop accurately describes mathematics. We will actually provide two models of proof. The rst, called propositional logic, will turn out to be woefully inadequate. The notion of deduction in propositional logic will not model much of what we understand as mathematical proof. The second model, rst-order predicate logic, is a model of proof adequate for describing much (and some say all) of mathematical discourse. We start with propositional logic since it isolates an important subsystem of predicate logic and also because it serves as a model for studying more sophisticated and complicated models of proof. In propositional logic, we have a model the sole purpose of which is to describe the way mathematicians use the words \and," \or,"\if-then," and \not." To grasp the issues, consider the following deduction. If the ring R is local then it is Noetherian and has exactly one maximal ideal. R is not Noetherian. Therefore, R is not local. You probably don't know what a local ring or a Noetherian ring is. You probably know that a maximal ideal is an ideal that is maximal among

1. INTRODUCTION

all ideals, whatever an ideal is. Furthermore, you probably didn't know that local rings are Noetherian. Nevertheless, you immediately recognize the deduction as valid. That is, if the two hypotheses are true then the conclusion is true as well. This observation is based on your understanding of the words \if," \then," \and," and \or" and not on your understanding of ring theory. This is the relationship among propositions that we wish to model. The formal study of propositional logic begins in section 3, but we give a short introduction here. Propositions such as mathematicians might assert will be modeled in propositional logic by strings of symbols called formulas (which abbreviates the expression well-formed formulas). A typical formula looks like this ((P ^ P ) ! (:P ))
1 2 3 1 2 3 1

(1.1)

We think of this formula as modeling a proposition as follows. The symbols P , P , and P stand for certain propositions. For instance P might stand for the proposition \2 + 2 = 4," P for the proposition \4 + 6 = 10," and P for the proposition \2 + 2 + 6 = 9." Note that P and P are standing for true propositions and P for a false one. The symbols ^, :, and ! are to be interpreted as \and," \not," and \implies" respectively. Thus the formula in question stands for the (true) proposition \2 + 2 = 4 and 4 + 6 = 10 implies that it is not the case that 2 + 2 + 6 = 9." The complete symbol table for propositional logic is
2 3 1 2 3

Symbol

Interpretation propositions and or implies (if-then) not for grouping

P , P , :::
1

()

^ _ ! :

The argument from ring theory above can now be symbolized as follows. (P ! (P ^ P )) (:P ) (:P )
1 2 3 2 1

CHAPTER I. PRELIMINARIES

This symbolization captures all the structure of the argument. We make one further remark. Propositions are themselves abstract objects propositions are expressed by English sentences but are not the same as them. Two di erent sentences might be used to express the same proposition and one sentence might express di erent propositions (say at di erent times). We will not make much of the di erence between sentences and propositions in these notes.

Exercises

1. Criticize De nition 1.1. (For instance, are there some things that you would call mathematics that this de nition omits? And are there things that the de nition calls mathematics that you would not?) 2. What questions might a model of \proof" try to answer? 3. Find an interpretation of P , P and P so that the formula (1.1) represents a false proposition. 4. (a) The following is a truth table for ^. P Q P ^Q T T T T F F F T F F F F Explain what each row and column of the truth table represents. (b) Construct truth tables for _, !, and :. Some lines of the tables are less obvious than others | explain why. 5. Suppose that P and Q are sentences. Rephrase each of the following sentences using the words \if" and \then." (a) P only if Q. (b) P whenever Q. (c) P implies Q. (d) P is a necessary condition for Q. (e) P is a su cient condition for Q.
1 2 3

2 Mathematical Induction
Mathematical induction is a very important proof technique that we will use often in these notes. Let N be the set f0 1 2 : : : g of natural numbers. The principle of Mathematical Induction is used to prove statements of the form, \For all natural numbers n : : : ."

2. MATHEMATICAL INDUCTION

Theorem 2.1 (Principle of Mathematical Induction). Suppose that X


N is a set satisfying

1. 0 2 X and 2. for every k 2 N , if k 2 X then k + 1 2 X . Then X = N .

Example 2.2. We use mathematical induction to show that for every natural number n, 0+1+2+ + n = n(n + 1)=2: (2.1)

Let X be the set of natural numbers for which equation (2.1) is true. To prove that every natural number is in X we must prove two things. First, we must show that 0 2 X that is, we must show that (2.1) holds for 0. This is true since 0 = 0(1)=2. Second, we must show that for every natural number k, if k 2 X is true, then k + 1 2 X is true. That is, we must show that if 1 + 2 + + k = k(k + 1)=2, then 1 + 2 + + (k + 1) = (k + 1)(k + 1 + 1)=2. To do this, suppose that k is an integer satisfying 1+2+ Then 1 + 2 + + (k + 1) = k(k + 1)=2 + (k + 1) = k(k + 1)=2 + 2(k + 1)=2 = (k + 1)(k + 2)=2: (2.3) + k = k(k + 1)=2 (2.2)

But equation (2.3) is the equation needed to show that k + 1 2 X . Thus, by the Principle of Mathematical Induction, X contains all natural numbers and so (2.1) is true for all natural numbers.

CHAPTER I. PRELIMINARIES

In a proof using Theorem 2.1, the step corresponding to (1) is called the basis step of the proof and the step corresponding to (2) is called the inductive step. We will not prove Theorem 2.1. In fact there really is no way to prove this Theorem without assuming a principle at least as strong as Theorem 2.1. We discuss this situation at the end of this section. There are several other forms of mathematical induction which are frequently used. Suppose for instance that we are trying to prove a proposition that holds of all but nitely integers. It is easy to see that the following principle is true and useful in this situation. Theorem 2.3. Suppose that X is a set of natural numbers and c is a natural number such that 1. c 2 X and 2. For all k c, if k 2 X then k + 1 2 X . Then for every natural number n c, n 2 X . Example 2.4. Consider the inequality 2n < 2n. Since 2n grows faster than any polynomial in n, it is easy to believe that there is a number c such that 2n < 2n for all n c. To prove this, notice that the inequality does not hold for n = 1 2, but that it does hold for n = 3, since 6 < 8. So let's take c = 3 in Theorem 2.3. The base case, n = 3, is already established. Suppose then that k 3 and that 2k < 2k . We must show that 2(k + 1) < 2k . But
+1

2(k + 1) = 2k + 2 < 2k + 2k < 2k + 2k = 2(2k ) = 2k :


+1

The following principle is sometimes called Strong Induction.

Theorem 2.5 (Principle of Strong Induction). Suppose that X is a set


of natural numbers such that for every k 2 N , if for all j < k, j 2 X , then k 2 X Then X = N .

There are two ways in which Theorem 2.5 appears stronger than Theorem 2.1. First, the basis step of the induction is missing. Second, in proving the induction step, one is allowed to assume that all smaller numbers are in the set X rather than just the predecessor of the number in question. Actually,

2. MATHEMATICAL INDUCTION

the fact that the basis step is missing is only an apparent strengthening usually the proof of the induction step for k = 0 amounts to a basis step and must be handled separately. Theorem 2.5 is not actually stronger than Theorem 2.1 however since it can be proved from Theorem 2.1. Example 2.6. The Fibonacci sequence is the sequence ffng of natural numbers de ned by the following rules. f = 1 f = 1 fn = fn; + fn; n 3: We will show that for every n p!! p! 1 1+ 5 n; 1; 5 n : (2.4) fn = p 2 2 5 The induction will use the Theorem 2.5. Because of the way the Fibonnaci sequence is de ned, it is inevitable that the proofs for n = 1 and n = 2 will be di erent than those for other n. We could think of this argument as having two basis steps. For these basis steps, it is easy to see that (2.4) is true for n = 1 and n = 2. For the rest of the proof, let k 3 be an integer such that (2.3) holds for p n < k. To show that (2.3) holds for n = k, let all p ; ). We must show then that fk = p (ck ; dk ). c = ( ) and d = ( Using the induction hypothesis we get fk = fk; + fk; 1 1 = p (ck; ; dk; ) + p (ck; ; dk; ) 5 5 1 (ck; (c + 1) ; dk; (d + 1)) = p 5 1 (ck; (c ) ; dk; (d )) since c = c + 1 and d = d + 1 = p 5 1 = p (ck ; dk ) 5 In these notes, we will take mathematical induction to be an axiom about the set of natural numbers and simply accept this principle as true. You can probably convince yourself that it is believable and consistent with your informal picture of the set of natural numbers. Most logicians prefer to take another principle as an axiom from which mathematical induction can be proved.
1 2 1 2 1+ 5 2 1 5 2 1 5 1 2 1 1 2 2 2 2 2 2 2 2 2 2

CHAPTER I. PRELIMINARIES

set of natural numbers. Then Y has a least element. (That is, there is a natural number n 2 Y such that for all m 2 Y , n m.)

Axiom 2.7 (Well-Ordering Principle). Suppose that Y is an nonempty

In an exercise below, you are asked to show that the Well-Ordering Principle implies the Principle of Mathematical Induction.

Exercises
1. Show that 1 + 2 +
2 2

+n = nn
2

( +1)(2 +1) 6

for every n.

2. Show that

n X j =1

1 = n for every n 0. j (j + 1) n + 1
2

3. For what values n is n < 2n? Prove your claim. 4. Prove that every integer n 2 is a product of prime numbers. Use Strong Induction. (Recall that a prime number is an natural number greater than 1 that is not the product of two lesser natural numbers.) 5. Suppose that you have available only 3 and 5 cents stamps. Show by using a suitable modi cation of Strong Induction (modify Strong Induction along the lines of Theorem 2.3) that you can make any amount in postage greater than 7 cents. 6. A binary string is a nite sequence of 0's and 1's. (a) Let Bn be the number of binary strings of length n. Show by induction that Bn = 2n. (b) A binary string = b b : : : bn is good if it does not contain two adjacent 1's. Let Gn be the number of strings of length n that are good. Notice that G = 2 and G = 3. Conjecture and prove a simple formula for Gn.
1 2 1 2

7. The Fibonacci sequence is without a doubt the most studied sequence in mathematics. (a) Show that f + f + (b) Show that f + f +
1 2 2 4

+ fn = fn ; 1 for every n. + f n = f n ; 1.
+2 2 2 +1

2. MATHEMATICAL INDUCTION
(c) Show that fn m = fnfm + fn fm for all m n constant and use induction on n.) Prove Theorem 2.1 assuming Theorem 2.5. Prove Theorem 2.5 assuming Theorem 2.1. Prove Theorem 2.1 assuming Axiom 2.7. Prove Axiom 2.7 assuming Theorem 2.1.
+ +1 +1 +1

9 1. (Hold m

8. 9. 10. 11.

10

3 Inductive De nitions - Formulas

CHAPTER I. PRELIMINARIES

In this section we give the de nition of formula of propositional logic. Formulas are sequences of symbols. The list of symbols is given in the following de nition. De nition 3.1. The symbols of propositional logic consist of 1. A set PVAR = fP P : : : g of symbols called (propositional) variables 2. The symbols ^ _ : ! $ which are called the conjunction, disjunction, negation, implication, and biimplication symbols respectively. These symbols are called connective symbols 3. The parentheses ( and ). We are assuming of course that ^ _ : ! $ ( ) P P : : : are all different symbols and that none is a proper subsequence of any of the others. Furthermore, P , though we write it with two di erent symbols of English, is just one symbol of propositional logic. De nition 3.2. The set of formulas of propositional logic, PROP, is de ned as follows. 1. Every variable is a formula. 2. If ' is a formula, then so is (:'). 3. If ' and are formulas, then so are (a) (' ^ ), (b) (' _ ), (c) (' ! ), and (d) (' $ ). 4. No sequence of symbols is a formula which is not required to be by 1, 2, and 3. This de nition seems somewhat circular it appears that 2 and 3 require us to know already what a formula is in order to de ne one. This de nition is an example of what is known as an inductive de nition. We shall discuss inductive de nitions in general in a moment. However we can see how 2 and 3 are used by considering an example.
1 2 1 2 1

3. INDUCTIVE DEFINITIONS - FORMULAS


show this by a line-by-line proof. 1) 2) 3) 4) 5) 6)
1 2 1 2 3

11

Example 3.3. We claim that ((:(P _ P )) ! P ) is a formula. We can


Formula P P (P _ P ) (:(P _ P )) P ((:(P _ P )) ! P )
1 2 1 2 3 1 2 3

Reason Rule 1 Rule 1 Rule 3b and Lines 1,2 Rule 2 and Line 3 Rule 1 Rule 3c and Lines 4,5
1 2 3

Another way to see this is by the tree ((:(P _ P )) ! P ) (:(P _ P ))


1 2

(P _ P )
1 2

P P In this tree, each node is labelled by a formula. The leaves are labelled by variables. Each interior node can be seen to be a formula because its children are. The root of the tree is labelled by the formula in question. De nition 3.2 is an example of what is known as an inductive de nition. In an inductive de nition of a set A, we specify which elements of a (larger) set B are in A by giving two types of rules. One type of rule, a basis rule, speci es that certain elements of B are in A unconditionally. In De nition 3.2, part 1 is such a rule. It speci es that each variable is a formula. In this de nition, the larger set B is the set of all nite sequences of the symbols of propositional logic. The second sort of rule in an inductive de nition, called an inductive rule, speci es that a certain element (called the conclusion of the rule) is in A whenever certain other elements (called the hypotheses of the rule) are in A. In De nition 3.2, rules 2 and 3 are inductive rules. Rule 2, for instance, asserts that (:P ) is a formula since we know that P is a
1 2 1 1

12

CHAPTER I. PRELIMINARIES

formula by Rule 1. Rule 4 in the de nition of formula limits formulas to only those strings of symbols required to be formulas by rules 1, 2, and 3. Before giving a more precise de nition of inductive de nitions, we give some further examples. The following de nition will be helpful.

De nition 3.4. An alphabet is a set S of symbols. A ( nite) sequence of


symbols s s : : : sn from alphabet S is called a word or string over S . We let S i denote the set of words over S of length i. We allow i = 0 we denote the empty word by . We let SEQ(S ) denote the set of all words over S 1 SEQ = S i. Sometimes SEQ(S ) is denoted by S . A language over S is i any subset of SEQ(S ).
1 2 =0

So the set of formulas of propositional logic is a language over the symbols of propositional logic. We now give some examples of inductive de nitions of languages. First, we see that SEQ(S ) itself has an inductive de nition.

De nition 3.5. Given a set S , the set SEQ(S ) is de ned as follows.


1. The empty sequence, , is an element of SEQ(S ). 2. If is in SEQ(S ) and x 2 S , then x is in SEQ(S ). Notice that in De nition 3.5 we have omitted the analogue of clause 4 in the de nition of formula namely, we have not explicitly stated a limiting condition. We will always assume that such a condition is meant in an inductive de nition.

Example 3.6. The set of arithmetic expressions, EXP, is de ned as follows.


1. Any integer constant is in EXP. 2. If and are in EXP, then so are + , ; , ; , , and = . It is easy to see that 2+3= ; 4 is in EXP according to De nition 3.6. One property of the de nition of EXP bears mentioning at this point. Consider the arithmetic expression 2 + 3 5. The two trees below show that this expression can be shown to be in EXP in two fundamentally di erent ways.

3. INDUCTIVE DEFINITIONS - FORMULAS


2+3*5 2+3 2 5 2 2+3*5 3*5

13

3 3 5 In the rst tree, 2 + 3 5 is shown to be in EXP using rule 2 with 2 + 3 as and 5 as . In the second tree, 2 + 3 5 is shown to be in EXP by applying rule 2 of the de nition with 2 as and 3 5 as . This is related to the fact that 2 + 3 5 is ambiguous as an arithmetic expression | some people would evaluate it as 25 (thinking of the expression as being generated as in the rst tree) and others would compute the value of the expression as 17 (which is the natural value if the second tree is used). This ambiguity is not present in our de nition of formula | this is the purpose of parentheses. We will examine the matter of ambiguity further in Section 5.

Example 3.7. Let B = SEQ(fa b cg). Let A


follows.

B be the set de ned as

1. The empty word is in A. 2. If is a word in A then so are a , c, and b c. (Here a means the word formed by adjoining a to the beginning of and similarly for the other cases.) It is easy to see that abbccc is a word in A. In the next section, we will see how to prove propositions about inductive sets. But you should be able to convince yourself that the set A of words de ned by De nition 3.7 consists of all words of B such that no c precedes any b or a and there are at least as many occurrences of c in are there are of b.

Exercises
1. Write trees to show that each of the following sequences of symbols are formulas. (a) ((P ! P ) _ P )
1 2 3

14
1 2 3 1 2 3 4

CHAPTER I. PRELIMINARIES
(b) (((:P ) ! P ) _ P ) (c) (((P ! P ) ! P ) ! P ) 2. For each of the following strings , argue that is not a formula. (a) (P :) (b) :P (c) ((P _ P )) 3. Consider the following inductive de nition of a language A. De nition 3.8. Let A SEQ(fa bg) be de ned as follows (a) The empty word is in A. (b) If is in A then so are a a and b b.
1 1 1 3

Characterize the words such that 2 A. 4. Find all integers n such that there is a formula with exactly n symbols. Prove your claim. (You will probably want to use Strong Induction, Theorem 2.5.) 5. Part (b) of this problem (from \Godel, Escher, Bach," by Hofstader) is known as the MU puzzle. De nition 3.9. Let language, L on the alphabet S = fM U Ig be de ned as follows. (a) MI is in L. (b) If M is in L, then M is in L. (c) If I is in L then so is IU. (d) If III is in L, then U is in L. (e) If UU is in L, then is in L. Here and denote any strings over S . (a) Show that MUIIU is in L. (b) (harder) Is MU in L?

4. STRUCTURAL INDUCTION

15

4 Structural Induction
We will often wish to prove that every element of some inductive set has a particular property. The method we will usually use to do this is similar to mathematical induction. We illustrate the method using the particular case of formulas. Theorem 4.1. Let X be a set of formulas. Suppose that 1. For every variable P , P 2 X . 2. For every formula ', if ' 2 X , then (:') 2 X . 3. For all formulas ', , if ' 2 X and 2 X then so are (a) (' ^ ) 2 X , (b) (' _ ) 2 X , (c) (' ! ) 2 X , and (d) (' $ ) 2 X . Then for every formula ', ' 2 X . Proof. The proof is by mathematical induction. As described in the last section, every formula ' has a \proof" a nite sequence of formulas ' : : : 'n such that 'n = ' and for each formula 'i in the sequence, either 'i is a variable, or 'i is a formula by the application of one of the inductive rules with hypotheses among the formulas ' : : : 'i; . We prove that ' 2 X is true by strong induction on the length, n, of the proof. Let n be the length of a proof of ' and suppose that we have shown that 2 X is true for all formulas with proofs of length less than n. Consider the proof ' : : : 'n = ' of '. We may assume that ' 2 X for all i < n since each such formula has a proof of length less than n. Now there are two cases. If ' is a variable, ' 2 X by (1) of the hypothesis. If ' is not a variable then it is a formula by application of one of the inductive rules with hypotheses among the formulas ' : : : 'n; . But in this case, 2 X for each hypothesis of the rule, so that ' 2 X by (2) or (3) above. In applying Theorem 4.1, verifying that (1) is true is called the basis step and (2) and (3) are called inductive steps. We illustrate the use of Theorem 4.1 with an example.
1 1 1 1 1 1

16

CHAPTER I. PRELIMINARIES

Theorem 4.2. Let ' be a formula. The ' has the same number of left

L((:')) = 1 + L(') = 1 + r(') = R((:')): Thus (:') 2 X . The next inductive step, corresponding to (3) of Theorem 4.1, is to assume that ' and are in X and to show that so are (' ^ ), (' _ ), (' ! ) and (' $ ). We do only the case of (' ^ ), the rest are similar. Suppose then that L(') = R(') and L( ) = R( ). Then L((' ^ )) = 1 + L(') + L( ) = 1 + R(') + R( ) = R((' ^ )): Thus (' ^ ) 2 X . The next Theorem gives another example of this method of proof and will play an important role in the \Nonambiguity Theorem," Theorem 5.2.

parentheses as right parentheses. Proof. For formulas ', let L(') and R(') denote the number of left and right parentheses of ' respectively. Let X be the set of all formulas such that L(') = R('). We wish to show that ' 2 X for every formula '. The basis step, corresponding to (1) of Theorem 4.1, is to show that every variable in in X . But L(q) = 0 = R(q) for any variable q. The rst inductive step, corresponding to (2) of Theorem 4.1, is to show that if ' 2 X then (:') 2 X . Since ' 2 X , L(') = R('). But then

Theorem 4.3. Every proper nonempty initial segment of a formula of propo-

sitional logic has more left parentheses than right parentheses. Proof. Let X be the set of formulas ' for which the theorem is true namely every proper nonempty initial segment of ' has more left parentheses that right parentheses. We wish to show that every formula is in X by using structural induction. The basis step, the case of variables, is trivial since variables have no nonempty, proper initial segments. For the rst inductive step, suppose that ' is a formula with this property and consider (:'). The proper initial segments of (:') are obviously (, (:, (:u where u is a nonempty proper initial segment of ', and (:'. The initial segments ( and (: obviously have more left parentheses than right parentheses. If u is a proper initial segment of ', u has more left parentheses than right parentheses by the induction hypothesis. Thus, so does (:u. Finally, ' has the same number of left as right parentheses by Theorem 4.2 and so (:' has one more left than right parentheses.

4. STRUCTURAL INDUCTION

17

Next we assume that ' and satisfy this property and consider (' ^ ). The proper initial segments of (' ^ ) are (, (u where u is a proper initial segment of ', (', ('^, (' ^ v where v is a proper inital segment of , and (' ^ . These cases can be handled as in the previous case by using the induction hypothesis and Theorem 4.2. The other induction steps are similar. The next corollary follows immediately from the previous two theorems.

Corollary 4.4. If ' is a formula, then no proper initial segment of ' is a


formula.

The general principle of structural induction is the following Theorem.

Theorem 4.5. Let S be an inductively de ned set and let X


that

S be such

1. For every basis rule in the de nition of S , if x is placed in S by that basis rule, x 2 X . 2. For every inductive rule in the de nition of S , if each hypothesis of the rule in in X , and x is the conclusion of that rule, then x 2 X . Then X = S .

As another example of Theorem 4.5 in action, recall that we considered the following inductive de nition of a language on the alphabet fa b cg.

De nition 4.6. Let B = fa b cg . Let A B be the set de ned as follows.


1. The empty word is in A. 2. If is a word in A then so are a , c, and b c. We now prove the following Theorem which justi es a claim we made in the last section.

Theorem 4.7. Let A be the language de ned by De nition 4.6. Then for

every in A, has at least as many occurrences of c as of b, and in , no occurrence of c precedes any of b or a.

18

CHAPTER I. PRELIMINARIES

Proof. The basis step of the proof corresponds to 1 of De nition 4.6. It is clear that the empty word has both of the properties mentioned. For the inductive steps, suppose that is a word satisfying the two properties in the statement of the Theorem. Then we must show that a , c, and b c do as well. We only consider the case of b c. Since has at least as many occurrences of c as b, so does b c since this word has one more of each of b and c than does . Furthermore, no occurrence of c in b c precedes any occurrence of b since such a c would have to precede a b in . Similarly, no occurrence of c precedes any of a. We will not prove it, but Theorem 4.7 gives a characterization of the set A de ned by De nition 4.6.

Exercises
1. Show that every formula consists of only nitely many symbols. 2. Let c(') be the number of occurrences of binary connectives in formula ' and let v(') be the number of occurrences of variables in '. Show that c(') + 1 = v('). 3. Let a set E of natural numbers be de ned by this inductive de nition (a) 0 2 E , (b) If n 2 E then n + 2 is in E . Show that E is the set of even numbers. First use structural induction to show that every element of E is even. Then use induction on N to show that if n is even, n 2 E . 4. Solve the MU puzzle of Problem 3-5(b) by using structural induction to show that every word in the language L has a certain property not enjoyed by MU. 5. Give an inductive de nition of the set of \good" words of Problem 2{6(b).

5. AMBIGUITY

19

5 Ambiguity
We now turn to the question of ambiguity in an inductive de nition. We saw in Section 3 that De nition 3.6 of arithmetic expressions gave rise to ambiguous expressions. That is there were expressions (2+3*5, for example) with two fundamentally di erent construction sequences. This ambiguity leads to an ambiguity in interpretation. We want to argue that such ambiguity is not present in the de nition of formula. We rst give a precise statement of what it means for an inductive de nition to be unambiguous. De nition 5.1. An inductive de nition of a set S is unambiguous if the following hold. 1. For each element of S there is only one rule which puts the element into S . 2. If the element is put into S by an inductive rule, then there is only one sequence of hypotheses which can be used with the rule to put the element into the set. A good way of thinking of De nition 5.1 is that an inductive de nition is unambiguous if there is exactly one tree for each of element of the inductively de ned set. Note that nonambiguity is a property of the inductive de nition and not of the inductive set. A set S may have both ambiguous and nonambiguous inductive de nitions. Theorem 5.2. The inductive de nition De nition 3.2 is unambiguous. Proof. We must establish that for each formula there is only one rule that puts into the set of formulas. Furthermore, if that rule is an inductive one, we must show that the hypotheses of the rule are unique. For this purpose, the various cases of part 3 of De nition 3.2 are considered separate rules. Suppose then that is a formula. If is put into the set of formulas by (1) of De nition 3.2, then is a variable, q. If is put into the set of formulas by either of the other rules then begins with (. Thus, if is put into the set of formulas by (1), it is not also put in by (2) or (3). Now if is a formula by (2), then starts with (:. cannot also be put in by an instance of (3), since then would start with (( or (q where q is a variable. Now in this case is of the form (:') for some ' and it is easy to see that ' is unique. Finally suppose that is put into the set of formulas by an instance

20

CHAPTER I. PRELIMINARIES

of (3). Then has the form ( C ) where C is one of the connectives ^, _, !, $ and and are formulas. We show that , , and C are uniquely determined thus completing the proof. Suppose that ' = ( C ) = ( D ) where C and D are connectives and , , , and are formulas. We show that = , C = D and = . To see this notice that C ) = D ). Now we apply Corollary 4.4 to get that neither of and is a proper initial segment of the other so that = . Thus C = D so that C = D and nally = . The ambiguity of De nition 3.6 of arithmetic expressions results from the fact that 2 + 3 4 can by put into the set of arithmetic expressions using the inductive rule for + with hypotheses 2 and 3 4 or the inductive rule for with the hyptheses 2 + 3 and 4. A nonambiguous inductive de nition of a set S allows us to de ne functions on S by structural induction. We consider an important example in the next section. Here we give a simple one and there are others in the exercises.

Example 5.3. We de ne a function g with domain PROP into N . De ne g


as follows: 1. g(Pi) = 2i .
+1

2. If ' if a formula, g((:')) = 3g ' .


( )

3. If ' and are formulas then (a) (b) (c) (d)

g((' ^ g((' _ g((' ! g((' $

)) = 5g ' 7g . )) = 11g ' 13g . )) = 17g ' 19g . )) = 23g ' 29g .
( ) ( ) ( ) ( ) ( ) ( ) ( ) ( )

It is easy to prove by induction that g(') is de ned for every ' 2 PROP. Moreover, the value of g(') is uniquely determined by this de nition precisely because the de nition of PROP is unambiguous. That is, the value of g(') is de ned by precisely one case of the induction de nition. Until now, our understanding of \trees" has been somewhat informal. We now give a precise de nition of the sort of trees that will be useful to us.

5. AMBIGUITY

21

De nition 5.4. A (rooted, labelled, ordered) tree is a nite, nonempty set of


1 2

labelled objects called nodes one of which is called the root and the remainder, if any, are partitioned into m 0 subtrees T , T , : : : ,Tm . Note that De nition 5.4 is (implicitly) an inductive de nition since some trees are de ned in terms of others. The base case, were it to be made explicit, would correspond to the case m = 0 in the de nition. The basic trees have one labelled node and that node is the root. The word ordered in the de nition corresponds to the fact that a root with subtrees S and T is considered a di erent tree than that of a root with subtrees T and S . We will always draw trees with the root at top (trees grow down) and the m subtrees T , : : : Tm if m > 0 below the root from left to right with line segments connecting the root of T to that of each of the Ti . With De nition 5.4 in hand, it is easy to see how to associate trees with elements of an inductive set. The basic rules of an inductive de nition generate trees with only a root and that root is labelled by the element of the inductive set put in by that rule. An inductive rule generates a tree with root corresponding to the element de ned, and subtrees corresponding to the hypotheses.
1

Theorem 5.5. An inductive de nition is unambiguous if and only if for

every two distinct elements of the inductive set, the trees associated with these elements are unique.

Now that we have established that parentheses render our formulas unambiguous, we note that they also make formulas harder to read. So we adopt some conventions for removing parentheses. We shall assume that the precedence of operators is :, ^, _, !, and $ in that order. Thus :P _ P ^ P abbreviates ((:P ) _ (P ^ P )) but to abbreviate ((:P ) ^ (P _ P )) we need parentheses as in :P ^ (P _ P ). Note that we never need the outermost pair of parentheses.
1 2 3 1 2 3 1 2 3 1 2 3

Exercises
1. (a) It is pretty obvious what the subformulas of a formula ' are. Give a precise de nition. (Hint: What you are de ning is a function S such that S (') is a set of formulas, namely the subformulas of '. Give this de nition by structural induction.)

22

CHAPTER I. PRELIMINARIES
(b) In the same way, de ne by structural induction V ('), the set of variables which occur in '. 2. De ne a function h(T ) by induction on the de nition of T , that computes the height of the tree T . Draw some pictures rst to see what a reasonable notion is. The height of a tree with only one node should be 0, think of roots as sitting on the ground. 3. Let g be the function de ned in Example 5.3. The number n such that g(') = n is called the Godel number of '. (a) Compute the Godel number of (P _ (:P )). (b) Show that if ' and are formulas such that g(') = g( ), then ' = . Show this by induction on the Godel number of '.
1 2

6. COUNTABILITY

23

6 Countability
In this section we investigate the question of measuring the size of in nite sets. The simplest example of an in nite set is the set N of natural numbers. We rst investigate the question of which sets have the same size as that of N . The notion of size is made precise in the following de nition. De nition 6.1. A set A is countably in nite (or denumerable) if there is a one-to-one correspondence between A and N (i.e., there is a 1-1 function f mapping A onto N ). A set A is countable if it is nite or countably in nite. If A is countably in nite, we can enumerate or list the elements of A in a sequence a a a : : : with no repetitions. Example 6.2. Let E = f0 2 4 : : : g, the set of even numbers. E is countably in nite the one-to-one correspondence sends the even integer 2n to n. Example 6.3. The set of symbols of propositional logic is countably in nite. This can be seen from the following enumeration of the symbols:
0 1 2

( ) : ^ _ ! $ P P :::
1 2

The next three theorems are the basic tools for showing many sets are countable. Theorem 6.4. A subset of a countable set is countable. Theorem 6.5. Suppose that A and B are countable sets. Then A B = f(a b) : a 2 A b 2 B g is countable. Proof. We suppose that both A and B are in nite. Let A = fa a a : : : g and B = fb b b : : : g. Then the following function f gives a one-to-one correspondence between A B and a subset of N .
0 1 2 0 1 2

f (an bm ) = 2n3m
The correspondence is one-to-one by the uniqueness of the prine factorization of an integer. A B is thus countable by Theorem 6.4. A similar proof allows us to show that the \countable union" of countable sets is countable.

24
set. Then A =

CHAPTER I. PRELIMINARIES
An is countable.

Theorem 6.6. 1 Suppose that for each natural number n, An is a countable


n=0

Proof. We supply two proofs one is a picture, the other uses the same technique as Theorem 6.5. For each n, let An = fan 0 an 1 an 2 : : : g. Consider the following picture which lists all the elements of A in a two-dimensional array.

a a a a

00

-a a -a ;; ;; ;;
01 02

03

10

? ;; ;;

a a

11

;;

12

20

21

30

a We may enumerate A by starting at the upper-left-hand corner and following the arrows. For the second proof, de ne f mapping A onto a subset of N by f (an m) = n 3m . 2 The preceding theorem enables us to show that sets which look much \bigger" than N are countable.
40 +1 +1

? ;;

Corollary 6.7. The set Q of rational numbers is countable.


Proof. Let Z denote the set of integers. Plainly, Z is countable. Given an element q 2 Q , we write q as a fraction in lowest terms m=n where m 2 Z and n 2 N . We now de ne a one-to-one correspondence between Q and a subset of Z N by mapping q to (m n). By Theorems 6.5 and 6.4, Q is countable.

6. COUNTABILITY

25

We are ready to show that PROP is countable. In fact we show something stronger and more useful.

Theorem 6.8. Let A be a countable set. Then SEQ(A) is countably in nite.


Proof. Let An be the set of strings of length n. By Theorem 6.6, we need only show that each set An is countable. This is done by induction on n. Note that A0 consists only of and that A1 is A. Suppose now that n is such that An is countable. An+1 can be identi ed with An A in a natural way. Therefore An+1 is countable as well by Theorem 6.5.

Not all sets are countable however.

Theorem 6.9. Suppose that A is a set with at least two elements. The set
of in nite sequences of elements of A is uncountable. Proof. Suppose to the contrary that the set of in nite sequences of A is countable. Then there is a listing, s1, s2, s3 , : : : of sequences of elements of A which includes all in nite sequences. Let the elements of the sequence si be labeled, si 1, si 2, si 3, : : : . Contrary to the hypothesis that this listing contains all the in nite sequences of elements of A we will produce a sequence s that is not in the list. To nd sj , the j th element of s, let a 2 A be any element of A such that sj j 6= a. This a exists since A has at least two elements. De ne sj = a. To see that s is not in the listing, note that for every j , we have insured that s is not the same sequence as sj .

This proof is known as diagonalization and was rst used by Cantor to show the following. Cantor rst used his diagonal argument to show

Theorem 6.10. The set < of real numbers is uncountable.


If we think of a real number as an (in nite) sequence of decimal digits, this Theorem follows almost directly from Theorem 6.9. (The set of in nite sequences of decimal digits is not countable by the Theorem.) The only problem with this argument is that two di erent decimal expansions may represent the same real number. For instance, 0:299 : : : and 0:300 : : : represent the same real number. This can be easily taken care of however. The following theorem is another example of the use of the diagonal argument.

26

CHAPTER I. PRELIMINARIES

Theorem 6.11. Suppose that S is an in nite set. Then the power set of S , P (S ) = fX j X S g, is uncountable. In fact, there is no function from S onto P (S ). Proof. Suppose that f is a function from S into P (S ). De ne a set X S by X = fx j x 2 f (x)g. We claim that X is not in the range of f . For = suppose that X = f (x) for some x 2 X . Consider whether x 2 X . If x 2 X , then x 2 f (x) = X by the de nition of X . So x 2 X . But then x 2 f (x) so = = = x 2 X , again by the de nition of X . There obviously is a function from P (S ) onto S so Theorem 6.11 can be viewed as saying that P (S ) has \more" elements than S in a certain precise
sense.

Exercises
1. Prove Theorem 6.4. 2. Let F be the set of all functions from N to N . Which of the following sets are countable? (a) F . (b) The set of f 2 F such that f is eventually 0 i.e., there is an n such that f (n) = 0 for all n n . (c) The set of f 2 F such that f is eventually constant. (d) The set of all f such that f is a function from N to f0 1g 3. Prove Theorem 6.10 directly using a diagonal argument like that in the proof of Theorem 6.9. 4. Prove that the set of irrational real numbers is uncountable. 5. Show that every in nite set has a countable subset.
0 0

7. COMPUTABILITY

27

7 Computability
One of the central concepts of mathematics is that of computation. Very roughly, a computation is a mechanical procedure for transforming certain inputs into outputs. Familiar computations in mathematics include such procedures as the arithmetic operations taught in grade school and the various procedures taught in calculus for di erentiating elementary functions. One of the central goals of these notes is to give a mathematical model of computation. We will provide one such model of computation in Chapter V and use it to answer some fundamental questions about proofs in Chapter VI. However in this section we discuss some of the informal aspects of the notion of computation. Certain of these informal features which we shall assume are part of our intuition about computation are the following. 1. The computation is governed by an algorithm, a nite set of instructions each of which is a nite object. 2. The computation is performed by some agent that carries out the instructions in response to some input. 3. The agent acts in a deterministic way. The entire future of the computation is determined by its state at any instant. No random actions are permitted. 4. The instructions specify small and discrete acts. No continuous or analog devices are permitted. 5. The inputs are nite objects say words over some nite alphabet. 6. The computation must terminate in nitely many steps or actions. 7. There should be no xed, nite bound on the size of algorithm, input, or output and no xed nite bound on the length of time necessary to compute the output. All of these may be controversial to some extent but the last condition is the most contentious. Perhaps the number of elementary particles in the universe provides the desired bound on everything. One thing that might be said about this however is that we are attempting to describe the logical and theoretical limitations of computation rather than the physical or practical.

28

CHAPTER I. PRELIMINARIES

in nite) and that L SEQ(A). L is decidable if there is an algorithm which on input x 2 SEQ(A) has as output the correct answer to the question `x 2 L?'. We claim that all of the following languages are decidable. 1. The set of formulas of propositional logic (as a subset of the set of words over the alphabet for propositional logic). 2. The set of prime numbers (as a subset of the set of natural numbers). 3. The language of De nition 4.6. Notice that in our conception of propositional logic, the set of symbols is not nite but is rather countably in nite. To view languages over that set of symbols as appropriate inputs to an algorithm, it is necessary to recode the language of propositional logic into a nite set of symbols. This can easily be done. In fact, the propositional variable P which is one symbol in our language can be represented in a nite language by the string P 23 of three symbols. Thus we need only include P and the ten digits in our language besides the connective symbols and the parentheses. Not every language is decidable however. We prove this in Theorem 7.2. Theorem 7.2. For every nite A, there is a language L SEQ(A) such that L is not decidable. Proof. An algorithm is a nite object over some nite language. Thus there are only countably many algorithms and thus only countably many decidable sets. But there are uncountably many languages L over A by Theorem 6.11. The proof above is rather unsatisfying it does not exhibit any undecidable language. After formalizing the notion of computation, we will nd that many interesting languages are undecidable. An algorithm can run forever. Such \in nite loops" are usually undesirable behavior in a program. There is no sense in which we can examine the output of the entire algorithm. However the algorithm can produce intermediate outputs which can be examined. For example, there is anpalgorithm which runs forever which has as outputs the decimal digits of p2. Thus, while we cannot examine the whole of the decimal expansion for 2 we can
23

De nition 7.1. Suppose that A is a nite set (so that SEQ(A) is countably

7. COMPUTABILITY

29

examine arbitrarily long nite initial segments of it by waiting long enough (perhaps longer than we care to wait). This sort of behavior of an algorithm leads to the following de nition.

De nition 7.3. Suppose that A is a nite set and L


The following languages are e ectively enumerable. 1. The set of formulas of propositional logic. 2. The set of prime numbers.

SEQ(A). L is e ectively enumerable if there is an algorithm which has as outputs all and only the elements of L. (If L is in nite, the algorithm runs forever.)

3. The set of natural numbers n for which there are nonzero natural numbers x y z such that xn + yn = zn. Notice something interesting about (3) until recently it was not known that this set was simply f2g (this is Fermat's Last Theorem which was proved by Andrew Wiles). However, it is easy to see that there is an algorithm to enumerate this set even without assuming the result of Wiles.

Theorem 7.4. A language L SEQ(A) is decidable if and only if both L and SEQ(A) ; L are e ectively enumerable. Proof. Suppose rst that there is an algorithm for answering `x 2 L?' We show how to enumerate L and SEQ(A) ; L by an algorithm. The algorithm for enumerating L works as follows. For each x 2 SEQ(A) the algorithm executes the procedure for answering x 2 L and if it receives the answer \yes", outputs x. Of course the algorithm for enumerating SEQ(A) ; L is
similar. On the other hand, suppose there are algorithms for enumerating each of L and SEQ(A) ; L. The algorithm for deciding L works as follows on input x. It simulates each of the two given algorithms, say by alternating steps, and waits until x is output by one of the two algorithms. It then answers appropriately.

De nition 7.5. A function f from SEQ(A) to SEQ(A) is e ectively computable if there is an algorithm which on input x 2 SEQ(A) has output
f (x).

30

CHAPTER I. PRELIMINARIES

An e ectively computable function may be partial we will usually write ' or for a partial function and reserve f , g, : : : for total functions. Recall that the characteristic function of a set B is the function f de ned by f (x) = 1 if x 2 B and f (x) = 0 otherwise.

Theorem 7.6. L SEQ(A) is decidable if and only if the characteristic function of L is e ectively computable.
A computer scientist would not be happy with our talk about algorithms so far. As we discussed above, most of the computations we have admitted would use physically impossible amounts of resources and e ectively in nite amounts of time. Therefore, theoretical computer scientists pay attention to the complexity of computation. The following informal de nition is one way to begin to measure time-complexity of computation.

De nition 7.7.

1. Given an algorithm, A, for deciding membership in a decidable L SEQ(A) and a function f from N to N , we say A has time complexity f if for every n and every input x of size n, A answers the question x 2 L in less than or equal to f (n) steps.

2. An algorithm A for deciding membership in a decidable L SEQ(A) is polynomial time if A has time complexity p for some polynomial p. In this case we say also that the language L is in polynomial time. One of the most important problems in theoretical computer science is the determination of which languages have polynomial time algorithms.

Exercises
1. Suppose that L and M are decidable sets. (a) Show that L \ M is decidable. (b) Show that L M is decidable. (c) Show that L0 , the complement of L, is decidable. 2. Suppose that L and M are e ectively enumerable. Show that L \ M is e ectively enumerable. 3. Suppose that L is decidable and M

L. Is M necessarily decidable?

7. COMPUTABILITY

31

4. Suppose that g and h are computable number-theoretic functions. Argue that f de ned by f (n) = g(h(n)) is e ectively computable. 5. Which of the following functions (de ned on N ) are e ectively computable? (a) g(x y) = xy . ( x (b) g(x y) = 1 if y < x 0 if y ( (c) h(x) = 1 if there are at least x consecutive 9's in the decimal expansion of 0 otherwise.

32

CHAPTER I. PRELIMINARIES

Chapter II Propositional Logic


1 Truth
Formulas are intended to stand for propositions. In propositional logic, we assume that the variables stand for certain simple propositions and that formulas built up by the inductive rules of the de nition stand for more complex propositions built from the simpler ones. Thus, if ' and stand for the propositions \2 + 2 = 4" and \4 + 3 = 7" then :' stands for the proposition \2 + 2 6= 4" and ' ^ stands for the proposition \2 + 2 = 4 and 4 + 3 = 7." Though variables stand for propositions, the only feature of the propositions that we are modeling is the relationship among the propositions with respect to truth value. Therefore we will rarely mention the actual propositions that we are intending the variables to stand for but we will only declare their truth values.

De nition 1.1. Let TV denote the set = fT F g. The set TV is called the
set of truth values. T and F are read as true and false respectively. An assignment of a truth value to each variable is what we will consider a model of propositional logic.

De nition 1.2. A truth assignment is a function from PVAR to TV. The


set of all truth assignments is denoted TA. A truth assignment determines the truth value of all formulas. We have the following inductive de nition. 33

34

CHAPTER II. PROPOSITIONAL LOGIC

De nition 1.3. Let v : PVAR ! TV be a truth assignment. Then v : PROP ! TV is de ned as follows.
1. v(q) = v(q) for every variable q. 2. Suppose that ' is a formula for which v(') is de ned. Then v((:')) is de ned as follows: ( v((:')) = F if v(') = T T if v(') = F 3. Suppose that ' and are formulas for which v(') and v( ) are de ned. Then we de ne v((' ^ )), v((' _ )), v((' ! )), and v((' $ )) by the following tables.

v(') v( ) v(' ^ ) T T T T F F F T F F F F v(') v( ) v(' ! ) T T T T F F F T T F F T v(') v( ) v(' _ ) T T T T F T F T T F F F v(') v( ) v(' $ ) T T T T F F F T F F F T

1. TRUTH

35

Notice that De nition 1.3 just formalizes the notion of truth table that we introduced in Section 1. The following Theorem is proved by induction and also uses the nonambiguity of the de nition of formula. Theorem 1.4. Given v : PVAR ! TV, there is a unique function v : PROP ! TV satisfying De nition 1.3. De nition 1.5. 1. An assignment v satis es a formula ' if v(') = T . 2. A formula ' is satis able if there is some assignment which satis es '. 3. A formula ' is a tautology if every assignment satis es '. If ' is a tautology we write j= '. Theorem 1.6. Let v and w be two assignments. Suppose that ' is a formula such that for every variable q occurring in ', v (q ) = w(q). Then v (') = w('). Proof. The proof is, as usual, by induction on '. You will be asked to supply the details in the exercises. In Section 1, we informally introduced the notion of truth table. Theorem 1.6 essentially guarantees that truth tables of the sort considered there are enough to determine the truth value of ' under any assignment. Example 1.7. Let ' = (P _ P ) ! :P . The following is a truth table for '. P P P P _ P :P (P _ P ) ! :P T T T T F F T T F T T T T F T T F F T F F T T T F T T T F T F T F T F F F F T T F T F F F F T T The rst line represents the fact that if v is any truth assignment such that v(P ) = T , v(P ) = T and v(P ) = T , then v(') = F . Notice that ' is satis able since there is a line in the truth table which evaluates ' to T . ' is not a tautology however since there are a number of lines that give the value F to '.
1 2 3 1 2 3 1 3 3 1 2 3 1 2 3

36

CHAPTER II. PROPOSITIONAL LOGIC


tautology. 1. A formula ' is satis able if and only if :' is not a

Theorem 1.8.

2. A formula ' is a tautology if and only if :' is not satis able. Proof. For (1) suppose rst that ' is satis able and that v is a truth assignment such that v(') = T . Then v(:') = F . Thus :' is not a tautology. Suppose on the other hand that :' is not a tautology. Let v be an assignment such that v(:') = F . Then v(') = T and so ' is satis able. The proof of (2) is similar and is left for the exercises.

Exercises
1. Determine for each of the following whether they are tautologies. (a) (b) (c) (d) (e) (P ! P ). (P ! (P ! P )). ((P ! P ) ^ (P ! P )). (P ^ (:P )): (((P ! (P ! P )) ! ((P ! P ) ! (P ! P ))):
1 1 1 2 2 1 1 2 1 1 1 1 2 3 1 2 1 3

2. Prove Theorem 1.6. 3. Prove Theorem 1.8(2). 4. (a) Construct a formula ' which has the following for a truth table. P P P ' T T T F T T F T T F T F T F F F F T T F F T F F F F T F F F F F (b) Construct a formula ' which has the following truth table.
1 2 3

1. TRUTH
1 2 3

37

P P P ' T T T F T T F T T F T T T F F F F T T T F T F T F F T T F F F F 5. Describe how to extend your reasoning of exercise 4 to any number of variables and any possible right hand column. 6. Show that TA, the set of truth assignments, is uncountable.

38

2 Tautological Consequence

CHAPTER II. PROPOSITIONAL LOGIC

Consider the following argument. If Gary received the message, then he skipped the meeting. Gary didn't skip the meeting Therefore Gary didn't receive the message. Though the subject matter is not typical of mathematics, the argument form is. And we immediately recognize it as a valid argument. Of course we don't know if Gary received the message or skipped the meeting. We don't know that he would have skipped the meeting even if he did receive the message. Nevertheless, the argument is valid because IF the premises are true, then the conclusion must necessarily be true. If P represents the proposition expressed by \Gary received the message," and P represents the proposition \Gary skipped the meeting," this argument may be written as follows. P !P :P
1 2 1 2 2

This is the relationship among propositions that we want to model. We want to say what if means for a proposition (a conclusion) to logically follow from a set of propositions (hypotheses). Propositional logic gives a partial solution to this problem. It is given in the next de nition. De nition 2.1. A set of formulas, ;, tautologically implies a formula ' if every truth assignment which satis es all the formulas in ;, satis es '. We will write ; j= ' for ; tautologically implies '. Evidently, if ; j= ' and you believe that every formula in ; is true, then you must believe that ' is true. The next theorem records some useful facts about tautological consequence we rst need a de nition. De nition 2.2. If v is a truth assignment and ; a set of formulas, v satis es ; if v satis es every formula in ;. ; is satis able if there is a truth assignment v that satis es ;. For a set of formulas ;, we will say that v satis es ; if v satis es every formula in ;. The following proposition records some useful facts about tautological consequence.

:P

2. TAUTOLOGICAL CONSEQUENCE
this new notation.)

39

Theorem 2.3. 1. If ' is a tautology, then for any set ;, ; j= '. (Therefore j= ' so our notation of j= ' for tautologies ' is consistent with
2. For every set ; of formulas and every formula ', ; j= ' if and only if ; f:'g is not satis able. 4. For every set ;of formulas and formulas 'and , ; f'g j= if and only if ; j= ' ! . 5. If ; and are sets of formulas such that ; then ; is satis able. 6. If ; and j= '. are sets of formulas such that ; and is satis able, and ; j= ', then 3. If ; is a set of formulas which is not satis able, then for every formula ', ; j= '.

Proof. The proofs of some parts are here the rest are left for the exercises. For (1), suppose that ' is a tautology. Then every truth assignment satis es ' so it is obviously the case that, for every ;, if v satis es ;, then v satis es '. For (2) suppose rst that ; j= '. Let v be any truth assignment. If v does not satisfy ;, then obviously v does not satisfy ; f:'g. On the other hand, if v satis es ;, then v satis es ' as well, so that v(:') = F . Thus, in either case, v does not satisfy ; f:'g. The other direction of (2) is proved similarly. For (3), if ; is not satis able, no truth assignment satis es ;. Thus for such ;, every truth assignment satisfying ;satis es every '. For the \only if" direction of (4), assume that ; f'g j= : Let v be any truth assignment such that v satis es ;: To see that v satis es ' ! we consider the two cases as to whether v(') = T or v(') = F . In the latter case, v(' ! ) = T by the de nition of !. In the former case, we have that v satis es ; f'g so that, by hypothesis, v satis es . Thus in this case as well, v satis es ' ! . Again, the \if" direction is similar and the proof in this case is omitted.

Theorem 2.4. Let ', ' , ' , : : : ,'n be formulas. Then the following statements are equivalent.
1 2

40
1. f'1 '2 : : : 'ng j= '.

CHAPTER II. PROPOSITIONAL LOGIC

2. f'1 ^ '2 ^ ^ 'n g j= '. 3. j= ('1 ^ '2 ^ ^ 'n) ! '. Proof. We rst prove that (1) implies (2). Suppose that (1) is true and that v is a truth assignment that satis es f'1 ^ '2 ^ ^ 'ng. The only way that this can happen is that v satis es each of '1, '2, : : : ,'n. Thus, by (1), v satis es '. This is what we needed to show. That (2) implies (3) follows from the part (4) of the preceding theorem. The proof of (3) implies (1) is similar and is omitted. Suppose that we wish to test an argument form for validity. That is, we wish to test ; j= '. If ; is nite, Theorem 2.4 gives an e ective procedure for doing so. If ; = f'1 '2 : : : 'ng, we need only test j= ('1 ^ '2 ^ ^ 'n) ! ' to see if it is a tautology. The procedure for making this test, truth-tables, is an e ective procedure. Example 2.5. Consider the argument at the beginning of this section.

P !P :P
1 2

Here ; = fP ! P :P g and ' = :P . To test the validity of this argument form, we need to show that ((P ! P )^:P ) ! :P is a tautology. This is easy to do via truth tables. De nition 2.6. Formulas ' and are (tautologically) equivalent if v(') = v( ) for all truth assignments v. In this case we write ' . From the point of view of our model, equivalent formulas say the same thing. The proof of the next theorem is left for the exercises. Theorem 2.7. The following are equivalent. 1. ' . 2. ' $ is a tautology. 3. f'g j= and f g j= '.
1 2 2 1 1 2 2 1

:P

2. TAUTOLOGICAL CONSEQUENCE

41

In considering arguments, the following theorem will make our work much easier.

Theorem 2.8. Suppose that ' is a formula with subformula . Suppose that 0

. Let '0 be the formula which results from replacing an occurrence of in ' by 0 . Then ' '0.

Proof. The proof is by structural induction on '. For the basis step, suppose 0 , ' '0 . that ' is a variable. Then = ' so that '0 = 0. Since For the rst inductive step, we assume that ' = (: ) for a formula for which the theorem is true. Then is a subformula of and so we have by 0 where 0 is the result of replacing an the inductive hypothesis that 0 . But '0 = (: 0 ) and it is easy to see that : occurrence of by : 0 if 0. The other inductive steps are similar to the previous one the substitution instance of 0 for must occur in one of the subformulas of the hypothesis of the inductive step.

Exercises
1. Formalize each of the following arguments in propositional logic and determine their validity. If Iraq withdraws from Kuwait, oil prices will go down. Decisive action on the part of George Bush will cause Iraq to withdraw. Don't expect decisive action from George Bush. Therefore oil prices will not go down. If Synod rati es the changes in the church order, some congregations will secede. If some congregations secede from the CRC, tuition will go up dramatically. Synod will ratify the changes in the church order. Thus some churches will withdraw from the CRC and tuition will go up. If a group G is nitely generated and abelian then it is a product of cyclic groups. G is not a product of cyclic groups. Thus G is not abelian.

42

CHAPTER II. PROPOSITIONAL LOGIC


If n is prime then it has no proper divisors other than 1. If n is even then either n = 2 or n has a proper divisor other than 1. Thus if n is even then either n = 2 or n is not prime. 2. Establish each of the following equivalences. In each part, and are arbitrary formulas. (a) ! : _ . (b) ^ :(: _ : ). (c) _ :(: ^ : ). (d) :: . (e) $ ( ! ) ^ ( ! ). 3. Prove (5) and (6) of Theorem 2.3. 4. Prove Theorem 2.7. 5. Show that every formula ' is equivalent to a formula such that the only connectives occurring in are ! and :. 6. Repeat Exercise 5 but with _ and :. 7. Show that there is a formula ' which is not equivalent to any formula such that the only connectives occurring in are $ and :. (Hint: Find a property that is true of all formulas built with only $ and : but that is not true of all formulas.) 8. Show that there is a formula ' which is not equivalent to any formula such that the only connective occurring in is !.

3. COMPACTNESS

43

3 Compactness
Suppose that ; is a nite set and ' is a formula. Then there is an algorithm for deciding if ; j= ', namely the method of truth tables. But what if ; is in nite? We give a partial answer to this question in this section. The answer relies on an important theorem. Theorem 3.1. Suppose that ; is a set of formulas such that every nite subset of ; is satis able. Then ; is satis able. Before we prove this theorem, we discuss what help it gives us in deciding whether ; j= '. We know that ; is countable (Why?) so let ; = f' ' : : : g. Now by Theorem 2.3, ; j= ' if and only if ; f:'g is not satis able. By the Compactness Theorem, ; f:'g is not satis able if and only if there is a nite subset of ; such that f:'g is not satis able. This is the case only if there is n such that f' ' : : : 'ng f:'g is not satis able. But this can be checked by truth tables. Thus we have the following \algorithm" for testing whether ; j= '. We assume that we can e ectively list ' ' : : : . For each n in turn test whether f' ' : : : 'n :'g is satisable. If not, halt and output ; j= '. Otherwise proceed to the next n. It is quite obvious that this algorithm halts if and only if ; j= ' and in this case outputs the correct answer to this question. However, if ; 6j= ', the algorithm executes forever. Left open by this result is the question of whether there is an algorithm which answers the question of whether ; j= ' which always outputs the correct answer and always halts. That is, the set f' : ; j= 'g is e ectively enumerable but it is not clear if it is decidable. We now prove the Compactness Theorem. We give two very di erent proofs. For the rst proof, we need a de nition and a lemma. De nition 3.2. A set, ;, of formulas is nitely satis able if every nite subset of ; is satis able. Using this terminology, the Compactness Theorem says that a set of formulas is satis able if and only if it is nitely satis able. Lemma 3.3. Suppose that is a nitely satis able set of formulas. Then for every formula ', at least one of f'g or f:'g is nitely satis able.
1 2 1 2 1 2 1 2

44

CHAPTER II. PROPOSITIONAL LOGIC

Proof. Suppose to the contrary that neither f'g nor f:'g is nitely satis able. Then there are nite subsets 1 and 2 of such that neither f'g nor 2 f:'g is satis able. Consider 0 0 = 1 2 . 0 is a nite 1 subset of and so is satis able. Let v satisfy . Now v satis es either ' or :'. But in the former case, v satis es 1 f'g and in the latter case v satis es 2 f:'g. This is the desired contradiction. Proof. (of the Compactness Theorem). Let '1 '2 : : : be an enumeration of all the formulas. We construct a set of formulas which is nitely satis able in stages. At each stage n1= 0 1 2 : : : we construct n so that 0 1 : : : . We then de ne = n.
0

Stage 0: = ;. Stage n+1: n = 'n if n 'n is nitely satis able. Otherwise n = n :'n. We rst claim that for each n, n is nitely satis able. This is proved using the Lemma and induction on n. Next we claim that is nitely satis able. To see this, notice that if 0 is a nite subset of , 0 n for some n. Next we notice that for every formula ', either ' 2 or :' 2 . Now we de ne a truth assignment v. We intend that v satis es . If so, then clearly v satis es ; since ; . De ne v(Pn) = T if and only if Pn 2 . To show that v satis es , we show that v(') = T if and only if ' 2 . We prove this by induction on '. The basis step is just our de nition of v. For the inductive step we will do only the case of the connective ^. Suppose that ' and are formulas such that v(') = T if and only if ' 2 and similarly for . We must show that v(' ^ ) = T if and only if ' ^ 2 : (3.1) We rst claim that ' ^ 2 if and only if ' 2 and 2 . To see this, suppose rst that ' ^ 2 . Then ' 2 since otherwise :' 2 and is not nitely satis able. Similarly, 2 . On the other hand, suppose that both ' and are in . Then ' ^ 2 since otherwise :(' ^ ) 2 and we would have f' :(' ^ )g but f' :(' ^ )g is not satis able. Now it is easy to complete the proof of 3.1. We have that v(' ^ ) = T if and only if v(') = T and v( ) = T . By the induction hypothesis, this is true if and only if ' 2 and 2 . Finally, by what we have just proved,this is true if and only if ' ^ 2 .
0 +1 +1

3. COMPACTNESS

45

The second proof of the Compactness Theorem also relies on a Lemma. This is an important lemma of independent interest. Lemma 3.4 (Konig's Lemma). Suppose that S is an in nite subtree of the full binary tree. Then S has an in nite branch. Proof. We build an branch of S in stages. At stage n in the construction we will have constructed the nite initial segment, n , of length n. At each stage n we will choose n so that the subtree of S below n is in nite. Stage 0: Let = . (It is obvious that the subtree of S below is in nite.) Stage n + 1: Suppose that we are given n on S of length n such that the subtree of S below n is in nite. There are at most two nodes on S extending n of length n + 1. Therefore at least one of these nodes has the property that the subtree of S below it is in nite. Let n be such a node.
0 0 +1

Let B be the branch of the full binary tree which contains each n. It is obvious that B is an in nite branch through S . It is clear that a version of Konigs Lemma can be proved for any nitely branching tree in place of S . The lemma may fail if the tree can have in nitely many branchings at a single node. Proof. (Second proof of the Compactness Theorem). We construct a truth assignment that shows that is satis able if it is nitely satis able. We think of a truth assignment as being an in nite path through the full binary tree. At level n of the tree, we decide whether v(Pn) is T or F . Speci cally, for such a path, we de ne v(Pn) = T if and only if the node in the path at level n is labeled with 1. To show that an assignment that satis es exists, we use Konig's Lemma. The subtree S of the full binary tree is de ned as follows. For any node in the full binary tree, represents a partial truth assignment to nitely many of the variables. Let ; be the set of formulas that only mention these variables. Now ; might be an in nite set but it can contain only nitely many pairwise inequivalent formulas. Thus, ; is satis able by hypothesis. Then we put in S if the partial truth assignment it represents satis es ; . It is easy to see that S is a subtree of the full binary tree. S is in nite since it has nodes at each level. Thus S has an

46

CHAPTER II. PROPOSITIONAL LOGIC

in nite branch and this branch represents a truth assignment that satis es all formulas. As an application of the Compactness Theorem, we prove an interesting fact about map colorings. In 1977, Ken Appel and Wolfgang Haken showed that every nite planar map can be colored with four colors. Here it is required that countries with a common border have distinct colors. The question of how many colors are su cient to color every planar map was rst asked by Francis Guthrie in 1852, but the proof that four colors su ce eluded many good mathematicians (as well as many good and not-so-good amateurs). The proof that Appel and Haken gave was novel in that it used hundreds of hours of computing time to check many speci c examples of map con gurations to rule out any possible maps that might require ve colors. No short, noncomputer proof is known. We won't prove the four color theorem here but we will use the Compactness Theorem to show that the nite version of the four color Theorem can be extended to in nite maps. Theorem 3.5. Every planar map with countably many countries is fourcolorable. Proof. Number the countries with the natural numbers. Also number the four colors 1 2 3 4. We will use an in nite set of formulas to describe the properties a four-coloring of a map must have. For each proposition of the form \Country i has color j " we reserve a variable - we will call that variable Ci j . Since there are only countably many countries, only countably many such variables are needed. The following formula then represents the fact that the i country has a color. Ci _ Ci _ Ci _ Ci Similarly, there is a formula which represents the fact that country i doesn't have two colors (see exercises). Finally, for each pair of countries that are adjacent, there is a formula that represents the fact that the two countries don't have the same color (see exercises). Let ; be the set of all the formulas described above. Suppose that ;0 is a nite subset of ;. Then ;0 mentions only nitely many countries. Thus it is satis able since the coloring problem it describes is one of four coloring nitely many countries. Thus ; is nitely satis able. So it is satis able. The truth assignment which satis es it gives us a coloring of the whole map.
th 0 1 2 3

3. COMPACTNESS

47

Exercises
1. Are the following in nite sets of formulas satis able? (a) fP :P _ P :P _ P : : : g. (b) f:P _ :P P _ P :P _ :P P _ P : : : g. 2. Suppose that ; is a nitely satis able set of formulas such that no formula in ; contains the variable P . In the rst proof of the Compactness Theorem, a truth assignment is constructed which satis es ;. What value does this truth assignment give to P ? 3. Prove the two missing facts in the proof of the in nite Four-Color Theorem. 4. Give an example of a tree with in nitely many nodes but no in nite branch. 5. Show that there is an in nite sequence of decimal digits d d : : : such that for every n, there is a prime number which starts with the digits d d : : : dn. (Hint: Konig's Lemma, suitably modi ed, might be helpful here.) 6. Suppose that ; j= '. Show that there is a nite ;0 ; such that ;0 j= '.
1 1 2 2 3 1 2 1 2 3 4 3 4 1 1 0 1 0 1

48

4 Resolution

CHAPTER II. PROPOSITIONAL LOGIC

There is an algorithm which on input ' determines whether ' is a tautology. The method of truth tables is one such algorithm. This method is expensive however if ' has n variables, there are 2n lines in the truth table. In implementing a deduction algorithm on a computer, this time-complexity is unacceptable. For this reason, automated theorem provers use a variety of di erent methods to attempt to speed up the process of determining validity of arguments. Though all of these methods turn out to have the same complexity in general, some are more e cient than others in certain cases. We look at one such method here, the method of resolution. Resolution is a method for determining whether a formula ' is satis able. Of course this problem is equivalent to the problem of determining whether :' is a tautology and so it is just as useful to solve the satis ability problem as it is to solve the tautology problem. To begin, we will write ' in a standard form. De nition 4.1. 1. A literal is a variable or the negation of a variable. We will usually use L to denote a literal. 2. A conjunction is a formula of form ' ^ ' ^ ^ 'n. We write such a n ^ conjunction as 'i .
1 2

3. A disjunction is a formula of form ' _ ' _ n _ disjunction as 'i.


1 2

i=1

_ 'n. We write the

4. A formula is in conjunctive normal form if it is a conjunction of disjunctions of literals. 5. A formula is in disjunctive normal form if it is a disjunction of conjunctions of literals. Thus a formula in conjunctive normal form can be written as
i=1 j =1

i=1

0 n m ^ @_
i

1 Li j A

where each of Li j is either Pk or :Pk for some k. A formula in disjunctive normal form has a similar representation.

4. RESOLUTION
mal form and is equivalent to a formula in disjunctive normal form.

49

Theorem 4.2. Every formula is equivalent to a formula in conjunctive norProof. The proof is by induction on the formula '. The basis step is trivial since any variable is in conjunctive normal form and in disjunctive normal form. For the induction cases, we use DeMorgan's rules (see Exercises 2(b) and (c) of Section 2) and the distributive rule. For example, suppose that ' = : and is equivalent to a formula in disjunctive normal form, say
i=1 j =1

0 n m ^ @_
i

1 Li j A :

Then

0 n 0 m 11 n 0 m 1 n 0 m 1 ^ @ _ AA _ @ _ A _ @ ^ ' :@ Li j ( : Li j ( :Li j A
i i i

i=1 j =1

i=1

j =1

i=1 j =1

and the last formula is in conjunctive normal form. Similarly, ' is equivalent to a formula in disjunctive normal form since is equivalent to a formula in conjunctive normal form. Since the order of formulas in a disjunction or conjunction do not matter, we will simplify our representation of formulas in conjunctive normal form.

De nition 4.3.

1. A clause is a set of literals. A clause is intended to represent the disjunction of the literals in the clause. We also allow an empty clause, which we denote by .

2. A clause set is a set of clauses. A clause set is intended to represent the conjuntion of the formulas represented by the clauses in the set.

Example 4.4. Consider the formula ' = (P ^ P ) _ :P . We rst convert ' to conjunctive normal form which is (P _ :P ) ^ (P _ :P ). A clause set that represents ' is ffP :P g fP :P gg . Example 4.5. Given a clause set, we can easily construct a formula which
1 2 3 1 3 2 3 1 3 2 3 1 2 3 2 3 4 1 2 3 2 3 4

represents it. This formula is obviously not unique. For example, the clause set ffP P P g f:P g f:P P gg represents the formula (P _ P _ P ) ^ (:P ) ^ (:P _ P ).

50

CHAPTER II. PROPOSITIONAL LOGIC

ment v which satis es at least one of the literals in the clause. (Note that by this de nition, is not satis able. This is important for reasons that will be clear in the sequel.) A clause set is satis able if there is a valuation which satis es every clause in it. The empty clause set, on this de nition, is satis able. Again, the empty clause, , is not satis able but the empty clause set is satis able. Example 4.7. Continuing Example 4.5, we see that the clause set

De nition 4.6. We say that a clause is satis able if there is a truth assign-

ffP P P g f:P g f:P P gg


1 2 3 2 3 4

is satis able by any truth assignment, v such that v(P ) = T , v(P ) = F , v(P ) = F . Of course it is satis ed by other truth assignments as well.
1 2 3

It is easy to see that a formula is satis able if and only if the clause set which represents it is satis able. If ' is a formula, we will use ' to denote the associated clause set. De nition 4.8. If C and D are clauses and L is a variable such that L 2 C and :L 2 D, then R = (C ;fLg) (D ;f:Lg) is called a resolvent of C and D. (In general there may be more than one resolvent of a pair of clauses.) Example 4.9. 1. Suppose that C = fP :P P g and that D = fP :P P g. Then R = fP P :P P g is a resolvent of C and D using the variable P and R = fP P :P P g is a resolvent of C and D using P.
1 2 3 2 3 4 1 1 3 3 4 2 2 1 2 2 4 3

2. Let C = fP g and D = f:P g. Then is the only resolvent of C and D. The next theorem gives the important property of resolvents for our purposes. Theorem 4.10. Let ' be a formula though of as a clause set. Let C and D be clauses of ' with resolvent R. Then ' and ' fRg are equivalent.
1 1

Proof. One direction of the equivalence is easy to establish if v is a truth assignment which satis es ' fRg, then v satis es '. Let v be an assignment

4. RESOLUTION

51

satisfying '. We show that v satis es ' fRg as well. We need only show that v satis es R. Suppose that R is a resolvent of C and D on variable P and P 2 C . Suppose rst that v(P ) = T the case that v(P ) = F is similar. Since v(P ) = T and v satis es D, v satis es a literal in D other that :P . Thus v satis es a literal in R and thus v satis es R. This theorem suggests the following de nition. De nition 4.11. Given a clause set ', the resolution of ', Res('), is the clause set de ned by the following inductive de nition. 1. All the clauses of F are in Res('). 2. If C and D are clauses in Res('), then every resolvent of C and D is in Res('). Though the de nition of Res(') looks as if it could generate an in nite set, in fact it is nite if ' is. This you will prove in the exercises.

Exercises
1. Put the following formulas in conjunctive normal form. (a) (P ! P ). (b) (P ! (P ! P )). (c) ((P ! P ) ^ (P ! P )). (d) (P ^ (:P )): (e) (((P ! (P ! P )) ! ((P ! P ) ! (P ! P ))): 2. For each of the formulas in (1), write a clause set representing them. 3. Find the resolution of the clause set
1 1 1 2 2 1 1 2 1 1 1 1 2 3 1 2 1 3

ffP P :P g f:P P P g f:P :P :P g fP ; 1 P gg:


1 5 2 1 2 3 1 4 5 4

4. Show that Res(') is a nite set. (Hint: every element of Res(') is a clause constructed of literals that occur in '.)

52

5 Resolution - 2

CHAPTER II. PROPOSITIONAL LOGIC

In this section, we show that the method of resolution yields an algorithm which solves the satis ability problem. In this section we show that ' is unsatis able if and only if 2 Res('). This gives an algorithm for deciding unsatis ability since we noticed in the last section that we can generate Res(') in nitely many steps. The rst step towards proving this method works is the following theorem which justi es our convention that is unsatis able.

Theorem 5.1. Suppose that ' is a clause set. If is in Res('), then ' is
not satis able. Proof. Suppose that is in Res('). Then Res(') is not satis able since is not satis able. From Theorem 4.10, we know that ' and Res(') are equivalent. Thus ' is not satis able.

For the other direction we have the following theorem.

Theorem 5.2. Suppose that ' is not satis able. Then 2 Res(').
Proof. We rst assume that no clause of ' contains both a variable and its negation, else we could eliminate the clause and have an equivalent clause set. The proof is by induction on the number n of di erent variables that occur in '. For the base case of n = 1, it is easy to see that, since ' is unsatis able, ' = ffP g f:P gg for some variable P . In this case 2 Res('). Suppose now that the theorem is true for formulas with at most n variables, and suppose that n + 1 variables occur in '. Let P be one of the variables occurring in '. We will construct formulas '0 and '00 each of which has fewer variables than ' and each of which is unsatis able. To construct '0, delete all occurrences of P in clauses of ' and delete all clauses containing :P to form a new clause set. Obviously, '0 has at fewer variables than '. To see that '0 is unsatis able, suppose otherwise and let v be a truth assignment that satis es '0 . De ne a truth assignment v0 by

v0(Q) =

F if Q = P v(Q) otherwise

We claim that v0 satis es '. For since v satis es '0, v satis es at least one literal (other than P ) in each clause of ' that contains P or doesn't contain

5. RESOLUTION - 2

53

either P or :P . On the other hand, since v0(P ) = F , v0 satis es every clause of ' that contains :P . The construction of '00 is similar delete all occurrences of :P in clauses of ' and delete all clauses that contain P . It is also clear that '00 is unsatis able (by using an assignment which makes P true). The construction of '0 and '00 is illustrated in Example 5.3 below. Since each of '0 and '00 are unsatis able and contain fewer variables than ', 2 Res('0) and 2 Res('00) by the induction hypothesis. Consider rst the fact that 2 Res('0). We claim that this implies that fP g 2 Res('). For consider the clauses of '0 used to show that 2 Res('0). Each of these di ers from a clause of ' by at most the variable P . Thus we could add P to each such clause of '0 to change the derivation of 2 Res('0) to one of fP g 2 Res('). Similarly, the fact that 2 Res('00) can be used to show that f:P g 2 Res('). But fP g 2 Res(') and f:P g 2 Res(') imply that 2 Res(') which is what we needed to show. Example 5.3. Consider the clause set

' = ff:P :P P g f:P P g fP g f:P gg: We construct '0 and '00 of the proof by removing the variable P . Then '0 = ff:P g fP g f:P gg and '00 = ff:P P gfP g f:P gg. It is easy to see that 2 Res('0) using the clauses f:P g and fP g. These correspond to the clauses f:P P g and fP g which show that fP g 2 Res('). Similarly, 2 Res('00 ) since fP g 2 Res('00 ) using the rst two clauses and then 2 Res('00) using this clause and the third clause of '00 . The corresponding clauses of ' allow us to see that f:P P g 2 Res(') and then that f:P g 2 Res('). Thus 2 Res(').
1 2 3 1 2 1 3 2 1 1 3 1 3 1 3 1 1 1 2 1 2 3 2 3 2

Exercises
1. Determine whether each of the arguments of Problem 7-1 is valid by formalizing it in propositional logic, transforming it to a question about unsatis ability of a formula, and then by using resolution to answer the question. 2. The formula ' represented by the clause set

ffP P P g f:P P P g f:P P g fP :P :P g fP :P g f:P :P gg


1 2 4 1 2 4 2 4 1 2 4 3 4 3 4

54
4

CHAPTER II. PROPOSITIONAL LOGIC


is unsatis able. Carry out the inductive step of the proof of Theorem 5.2 using the variable P . Namely, write the clause sets '0 and '00 that result from eliminating P . Then show that that is in Res('0 ) and in Res('00). Then use these derivations to show that fP g and f:P g are each in Res('). And nally show that is in Res(').
4 4 4

Chapter III Structures


1 What is a Structure?
Propsitional logic is certainly not strong enough to completely and accurately model the notion of proof. Consider the following argument. Slithy toves are brillig John is a slithy tove John is brillig. While this is obviously a valid argument (although only Lewis Carroll knows what it says) the best we can do at modelling this argument in propositional logic is P P P However the conclusion is not a tautological consequence of the hypotheses of this argument. What is needed in our language is a way to talk about individuals and their properties. There is a bewildering variety of mathematical objects that we might wish to talk about. In rst order logic we will provide a model of mathematical language rich enough to talk about many mathematical objects. In this section, we introduce the notion of a ( rst-order) structure which is the sort of mathematical object that rst-order logic is about. Before giving the de nition of structure, we give some important examples.
1 2 3

55

56

CHAPTER III. STRUCTURES

Example 1.1. The set of natural numbers, N , provides us with our rst,

and most important, example. The natural numbers are an in nite set f0 1 2 : : : g. But there is more to the structure of the natural numbers than just the elements of that set. What is important in number theory is that there are certain operations de ned on the set N . So in considering N as a mathematical structure we also consider as a part of that structure the operations of + and . Were these operations de ned di erently, the natural numbers would be a di erent structure. When we are thinking of N together with the operations of + and , we will write N for the resulting structure. We sometimes write N = (N + ). Again, the natural numbers as a structure consists of a set together with certain binary operations de ned on that set. Example 1.2. Graph theory provides us with our next example. A graph G consists of two sets V and E called the vertex set and edge set of G respectively. The set E consists of certain unordered pairs of distinct vertices from V . The usual picture is that of \dots" for the vertices and \lines" for the edges. A line is drawn between the vertices v and w if and only if the pair (v w) is in the edge set. A useful way to think of a graph as a structure is to think of the vertex set as the set of objects of study and the edge set as being a binary relation on the vertex set. Thus if the pair (v w) is in the edge set then v and w stand in the relation to each other and if the pair (v w) is not an edge, then v and w are not in the edge set. Graphs are useful for representing a set with one binary, symmetric relation de ned on it. Example 1.3. The next example is set theory. Our set theory will be somewhat informal. In set theory, we think of there as being a certain \universe" of objects called sets. These sets bear certain relations one to another. The most important of these relationships is called set membership and is denoted by 2. We write x 2 y for sets x and y if x is an element of y. A structure rst of all consists of a class of objects which we will always assume is a set. This set is called the domain of the structure. On that set, we may have certain operations de ned as in the example of N . In that case, two binary functions + and are de ned on N . Though none of our examples have functions of other aritys, this is certainly possible. For instance, in considering the natural numbers, we might want to consider as a function de ned on N the successor function de ned by S (n) = n +1. Besides functions, it is also possible that we have certain relations de ned on the set.

1. WHAT IS A STRUCTURE?

57

In set theory, the relation 2 is such a relation. Again, though our examples were only binary relations, relations of other arities are conceivable. A unary relation, for instance, is just a property. For example, if our structure has domain the set of toves, a unary relation de ned on the structure might be the property of being slithy. One other thing that we will allow our structures to have is certain distinquished elements. For example, we might single out for special attention the number 0 in the natural numbers. Usually, these distinguished elements are elements of the domain to which we have given names. We now give the formal de nition of structure. De nition 1.4. A structure A is a sequence of the form A = (A ci fj Rk )i2I j2J k2K where 1. A is a nonempty set 2. I is a possibly empty set and for each i 2 I , ci 2 A (each such ci is called a distinguished element of A) 3. J is a possibly empty set and for each j 2 J , fj is an function de ned on A 4. K is a possibly nonempty set such that for each k 2 K , Rk is a relation de ned on A. We illustrate the rather messy de nition with some typical examples. Example 1.5. We slightly modify the structure of the natural numbers dened above and de ne N = (N 0 S + <). Here, 0 is the only distinquished element. S is the unary successor function discussed above. + and are the addition and multiplication operations. < denotes the binary relation \lessthan" which provides a natural ordering on N . Example 1.6. The following table de nes a binary operation, , on the set fa b c dg. a b c d a a b c d b b c d a c c d a b d d a b c The sequence fa b c dg ) is a structure.

58

CHAPTER III. STRUCTURES

In writing the sequence of elements, functions, and relations, we will usually write the distinguished elements rst, the unary functions next, the binary functions next, etc. and then the unary relations, the binary relations, etc. Two structures are di erent if they have di erent sequences. For instance, the structures N = (N + ) and M = (N +) are di erent structures even though they have the same domain and functions since the functions are given in di erent orders. The signi cance of making such a distinction will come later when we talk about the language of rst-order logic. Example 1.7. The objects of a mathematical structure can be quite abstract. Consider a structure appropriate for talking about functions of a real variable. Let C 1 R ] denote the class of functions de ned on R that have innitely many derivatives. There are certain natural functions de ned on this collection of objects for example + (function addition), (function multiplication), and (function composition). Di erentiation (0) can be thought of as a unary function. So a structure appropriate for discussing the rules of di erentiation is (C 1 R ] 0 + ). Example 1.8. The objects of a mathematical structure need not be mathematical in nature. Consider the structure (L S P ) where L is the set of all living people, S is the relation \is a sibling of", and P is the relation \is a parent of". Such a structure is appropriate to consider when discussing the properties of kinship for example the relationship \is a second cousin of" can be described in terms of the relations S and P . (Can you do this?) In the next two sections, we look at some special classes of structures in order to introduce the types of questions asked about structures.

2. ONE BINARY RELATION

59

2 One Binary Relation

Many of the important structures in mathematics can be viewed as structures with relatively few functions and relations. In this section we look at examples of structures which have a single binary relation. De nition 2.1. A binary relation R on a set A is 1. re exive if for all x 2 A, (x x) 2 R 2. antire exive if for all x 2 A, (x x) 62 R 3. symmetric if (x y) 2 R implies (y x) 2 R 4. antisymmetric if (x y) 2 R and (y x) 2 R implies x = y 5. transitive if (x y) 2 R and (y z) 2 R implies (x z) 2 R. Note that a relation can fail to be re exive without being antire exive and can fail to be symmetric without being antisymmetric. De nition 2.2. Suppose that R is a binary relation on A. 1. R is a partial ordering of A if R is re exive, transitive, and antisymmetric 2. R is a linear ordering of A if R is a partial ordering of A such that in addition, for every x y 2 A, either (x y) 2 R or (y x) 2 R. 3. R is an equivalence relation on A if R is re exive, symmetric, and transitive. If R is a partial ordering of a set A, the structure A = (A R) is sometimes called a poset, or a partial order. Example 2.3. Some partial orders are the following. 1. The divisibility relation (j) on the set of natural numbers given by ajb if and only if there is a natural number k such that ak = b. 2. The relation of set inclusion ( ) on the power set of any set. 3. The standard ordering of natural numbers. (This ordering is also a linear ordering of the natural numbers.)

60

CHAPTER III. STRUCTURES

Example 2.4. Consider the partial ordering on the set of factors of 18 determined by the divisibility relation. A diagram of this ordering, called the Hasse diagram of the ordering is the following. 18 u

HHH HH u Hu 6@ ; @ ;; 9 ; ; u @; u 2@ ;3 @@u ; ;
1

In a Haase diagram of the partial ordering (A R), there is a line segment going up from a to b if (a b) 2 R but there is no element c such that (a c) 2 R and (c b) 2 R. The diagram is enough to recover the whole ordering using transitivity. The diagram above shows that 2j6 since there is a line segment going up from 2 to 6. Note that 2j18 even though the corresponding line segment is not present that relationship is implied by transitivity. Consider the two Hasse diagrams below. One represents the partial order of the divisors of 6 under the divisibility relation, the other the subsets of the two element set f0 1g under the set inclusion relation.

1 It is pretty obvious that these partial orderings are structurally the same only the names of the objects have been changed. This concept is captured by the following de nition. De nition 2.5. Suppose that A = (A R) and B = (B S ) are structures with R and S binary relations. A and B are isomorphic if there is a function F mapping A one-to-one and onto B such that for all x y 2 A, (x y) 2 R if and only if (F (x) F (y)) 2 S . We call such an F an isomorphism of A and B.

;;@@@u ; 2u @@ ;; 3 @u ;

6u

f0 u1g ;;@@@u ; f0gu @@ ;;f1g @u ;

2. ONE BINARY RELATION

61

Isomorphic structures are structurally the same. All algebraic properties of one are enjoyed by the other. One might view the mathematician's job as that of classifying structures up to isomorphism. Equivalence relations are also extremely important structures in mathematics. Some important examples of equivalence relations include the following. 1. The relation of the natural numbers of being equivalent modulo 5. (Recall that a is equivalent to b mod 5, written a b (5), if ja ; bj is divisible by 5.) 2. The relation on the power set of a given set, X , in which two sets A X and B X are related just in case there is a one-to-one function from A onto B . Lemma 2.6. Suppose that is an equivalence relation on a set A. For each x 2 A, let x] denote the set fy : x y g. Then for every x and y in A, either x] = y ] or x] and y ] are disjoint. Thus, the sets x] partition A into disjoint classes, called equivalence classes. Another important example of a structure with a single binary relation is a graph. De nition 2.7. A graph is a structure G = (V E ) such that E is a symmetric, antire exive binary relation on V . The elements of the set V are often called the vertices or nodes of the graph. The elements of E are called the edges of G . We represent graphs G by pictures such as the following.
x x x x x x x x

62

CHAPTER III. STRUCTURES

The vertices of the graph are represented by dots, the edges by line segments which connect the appropriate vertices. It does not matter how the graph is drawn e.g., the line segments may be replaced by curves and the crossings have absolutely no signi cance. De nition 2.8. A directed graph is a structure G = (V E ) such that E is an antire exive binary relation on V . The elements of V and E are still called vertices and edges. An edge (x y) is now thought of as being directed from x to y, We represent directed graphs by using arrows for the edges. Edge (x y) is represented by an arrow from x to y. Note that if (x y) is an edge, x 6= y and there may or may not be an edge (y x).

Exercises
1. For each of the following sets A and relations, R, on A, determine which of the properties of De nition 2.1 the relation has. (a) R is the empty relation on a nonempty set A. (b) Let C be a nonempty set, A = SEQ(C ), and let R be the relation on A de ned by ( ) 2 R if is an initial segment of . (c) A is the set of all people and (x y) 2 R just in case x is an ancestor of y. (d) A is the set of natural numbers and (x y) 2 R just in case x + y < 100. 2. Draw the Hasse diagrams for the following posets. (a) The divisors of 30 under the divisibility relation. (b) The power set of f0 1 2g under set inclusion. 3. Let F denote the set of all functions di erentiable on 0 1]. De ne a relation of F by f g just in case f 0 = g0 (where f 0 denotes the derivative of f ). Show that is an equivalence relation on F and describe the equivalence classes. 4. Show that the relation of tautological equivalence, , on PROP, the set of formulas of propositional logic, is an equivalence relation.

2. ONE BINARY RELATION

63

5. How many nonisomorphic partially ordered sets of size three are there? 6. How many nonisomorphic graphs with four vertices are there?

64

3 One Binary Function

CHAPTER III. STRUCTURES

In this section we look at some examples of structures with just one binary function. De nition 3.1. A binary function on a set A is 1. commutative if x y = y x for all x y 2 A 2. associative if x (y z) = (x y) z for all x y z 2 A. De nition 3.2. A structure A = (A ) with one binary function is called a groupoid. A is a 1. semigroup if is associative 2. commutative groupoid if is commutative 3. semilattice if is commutative and associative and for every a 2 A, a a = a. Example 3.3. 1. The set of even natural numbers, E , with the binary operation of multiplication is a commutative semigroup. 2. The structure with universe N of natural numbers with the binary operation x y = min(x y) is a semilattice. De nition 3.4. An element e 2 A is an identity for the binary function if e x = x e = x for every x 2 A. De nition 3.5. A structure A = (A e ) with one distinguished element e and one binary function is a 1. monoid if is associative and e is an identity for 2. commutative monoid if is, in addition, commutative 3. group if it is a monoid and, in addition, for every element x 2 A there is an element y 2 A such that x y = y x = e. That is, every element of A has an inverse. Example 3.6. Many of the most important structures of mathematics are groups or, at least, monoids.

3. ONE BINARY FUNCTION

65

1. Let S be a nonempty set and A = SEQ(S ). Then S = (S ) is a monoid where is de ned by = and , the empty sequence, is the identity. 2. Let S be a set. Then A = (P (S ) S \) is a monoid where P (S ) is the power set of S . 3. N = (N 0 +) is a monoid.
+

4. Z = (Z 0 +) is a group. 5. N = (N 1 ) is a monoid. 6. Let Q denote the positive rational numbers. Then Q = (Q 1 ) is a group.
+ +

If the universe of a groupoid is a small nite set, we sometimes represent the binary function by a function table as in the following example.

Example 3.7. The set f0 1 2 3g forms a group under the following operation. 0 1 2 3 0 0 1 2 3 1 1 2 3 0 2 2 3 0 1 3 3 0 1 2

There is also a concept of isomorphism of groupoids. In fact, we give here a de nition of isomorphism of any two structures.

De nition 3.8. Let A = (A ci fj Rk )i2I j2J k2K and B = (B di gj Sk )i2I j2J k2K
be structures. Suppose also that corresponding functions and relations have the same arity. Then A and B are isomorphic if there is a function F which maps A, one-to-one and onto B , such that 1. for every i 2 I , F (ci) = di, 2. For every j 2 J , if fj is n-ary and a : : : an is a sequence of elements of A, F (f (a a : : : an)) = g(F (a ) F (a ) : : : F (an)).
1 1 2 1 2

66
1 2

CHAPTER III. STRUCTURES


3. For every k 2 K , if Rk is n-ary and a a : : : an is a sequence of elements of A, (a a : : : an) 2 R if and only if (F (a ) F (a ) : : : F (an)) 2 S.
1 2 1 2

The function F which witnesses that A and B are isomorphic is called an isomorphism.

Example 3.9. The groupoids represented by the following tables are isomorphic via the isomorphism F such that F (0) = a, F (1) = c and F (2) = b. 0 1 2 0 0 1 2 1 1 2 0 2 2 0 0 a b c a a b c b b a a c c b a

Exercises
1. For each of the following sets, A, and binary function, , determine whether the resulting structure is a semigroup, semilatice, monoid, or group. (a) A is the set of positive integers, is multiplication. (b) A is the set f0 1gn i.e., the set of binary words of length n and is componentwise addition modulo 2. (c) A is the set of continuous real-valued functions de ned on the real line and is composition. 2. Show that the identity element of a monoid is unique. 3. There are 16 di erent binary operations that can be de ned on a 2 element set. (a) How many isomorphism types of 2 element groupoids are there? (b) How many isomorphism types of 2 element monoids are there? (c) How many isomorphism types of 2 element groups are there? 4. Which of the following function tables represent monoids?

3. ONE BINARY FUNCTION


1 2 3 4 1 2 1 4 3 2 1 2 3 4 3 4 3 2 1 4 3 4 1 2 1 2 3 4 1 1 2 3 4 2 2 1 3 3 3 3 4 2 1 4 4 4 1 2 1 2 3 4 1 1 2 3 4 2 2 1 3 4 3 3 4 3 4 4 4 3 3 4

67

5. Show that no two of the monoids in the previous exercise are isomorphic. 6. (a) Give a reasonable de nition of submonoid. (b) For the monoids in problem 4, nd all submonoids. 7. Show that the set of isomorphisms of a structure onto itself form a group.

68

CHAPTER III. STRUCTURES

Chapter IV First-order Logic


1 The language of rst-order logic
First-order logic is the model of the language that we use to talk about structures. The formal language has two types of symbols: logical symbols and nonlogical (but not illogical) symbols. De nition 1.1. The logical symbols of rst-order logic consist of the following. 1. a set VAR = fv v : : : g of (countably many) symbols called variables 2. the connective symbols : and !
0 1

3. the quanti er 8 4. the parentheses ( and ) and the comma

5. the equality symbol =. Sometimes = is omitted from the language we will refer to the resulting language as rst-order logic without equality. Note that we have not allowed all the propositional connective symbols ^ is missing for example. The reason is simply that we do not wish the language to be too large when we are attempting to prove things about it. By Exercise 2 of Section II.2, we have not lost any expressive power in doing this. Similarly, though in the last section we might want to allow for an existential quanti er, 9, we will introduce this later as an abbreviation for :8:. 69

70

CHAPTER IV. FIRST-ORDER LOGIC

Besides the logical symbols, rst-order language is equipped with symbols so that the particular functions and relations of the structure being talked about can be referred to. The usual way of viewing this is that there is a di erent rst-order language for each di erent type of rst-order structure.

De nition 1.2. A ( rst-order) language L has the following symbols.


1. The logical symbols 2. A possibly empty set of constant symbols 3. For each n 1, a possibly empty set of n-ary function symbols 4. For each n 1, a possibly empty set of n-ary relation symbols. We shall usually use symbols such as c,d,e for constant symbols, f , g for function symbols, and R, S for relation symbols. Depending on the structure we have in mind, other symbols such as 0, +, < might be used. We usually describe a rst-order language L by a listing of the symbols such as (c d f g h R). Here c and d are the constant symbols of L f , g and h are the function symbols and R is the relation symbol. We always list the symbols in the order constant, function, and relation symbols. Strictly speaking, we should also indicate the arity of the function and relation symbols | if it is not clear from the context we will usually do that with a superscript such as f to indicate a 3-ary function. Of course unary and binary functions and relations are the most common in mathematical discourse. First-order languages are used to model talk about rst-order structures which we now de ne.
3

De nition 1.3. Given a language L, an L-structure A consists of the following. 1. A nonempty set A, called the universe of A 2. for each constant symbol c of L, a distinguished element cA. 3. for each n-ary function symbol f of L, an n-ary function f A 4. for each n-ary relation symbol R of L, an n-ary relation RA.

1. THE LANGUAGE OF FIRST-ORDER LOGIC

71

If L = (c d : : : f g : : : R S : : : ), we write a corresponding L-structure as A = (A cA dA : : : f A gA : : : RA S A). So, for example, if L consists of a single binary relation symbol R, an L-structure is any pair (A RA ) consisting of a nonempty set A and a binary relation RA de ned on A. Example 1.4. Consider arithmetic as discussed in Section 1. An appropriate rst-order language for arithmetic is LN = f0 S + E <g . The Lstructure that we have in mind is N = (N 0N S N +N N E N <N ) where each of the nonlogical symbols is interpreted in the standard way. Example 1.5. An appropriate language in which to talk about graphs is the language, L, with just one binary relation R. A graph, G, is then a Lstructure if we think of the vertices of G as being the universe and the edges as de ning a binary relation on the vertices. Of course not every L-structure, A = (A RA ) is a graph. For example, the relation RA might contain a pair (a a) for some a 2 A. Example 1.6. The language of set theory is L = f 2g. Here of course is the constant symbol which we use to denote the emptyset and 2 is the setmembership relation. Again, not all L-structures are reasonable models of set theory. In fact, any graph could be viewed as an L-structure by choosing some arbitrary vertex for the interpretation of the symbol . To de ne the formulas of a rst-order language L, we rst de ne the terms of L. Terms are expressions that can be used as names for elements of the underlying structure. De nition 1.7. Given a language L, the terms of L are given by the following inductive de nition. 1. Every variable is a term. 2. Every constant symbol is a term. 3. Suppose that t , t , : : : , tn are terms and that f is an n-ary function symbol. Then f (t t : : : tn) is a term. Example 1.8. Consider the language LN = f0 S + E <g of Example 1.4. Some terms are: v , 0, +(v v ), E ( (v v ) 0). In order to make terms in our formal language look more like the corresponding expressions in informal mathematics, we will often write a binary function symbol between
1 2 1 2 3 3 27 1 2

72
3 27

CHAPTER IV. FIRST-ORDER LOGIC


3 27

the operands as we do in arithmetic. For instance +(v v ) will normally be written (v + v ). This expression is an abbreviation and is not part of the language L however. The proof of the following proposition is parallel to the proof of similar facts for propositional logic. Theorem 1.9. 1. Suppose that the set of non-logical symbols of L is countable. Then the number of terms of L is countably in nite. 2. The de nition of term is not ambiguous. De nition 1.10. The formulas of a language L are de ned by the following inductive de nition. 1. If t and t are terms, then (t = t ) is a formula. 2. If t , t , : : : tn are terms and R is an n-ary relation symbol, then R(t t : : : tn) is a formula. 3. If ' is a formula, then so is (:'). 4. If ' and are formulas, then so is (' ! ). 5. If ' is a formula and x is a variable, then so is 8x'. Formulas formed by cases (1) and (2) above are called atomic formulas. Example 1.11. Continuing Example 1.4, we see that some of the formulas of LN include: 8v (v = v ) 8v 8v ((v + v ) = 0) (0 = 0 _ (:8v ((v + v ) = v ))) Example 1.12. Consider the language of set-theory: f 2g. The only terms of L are and each of the variables. Some formulas are 2 , 8v (v 2 ), and 9v ((v 2 ) _ ( 2 v )). One important fact should be emphasized here. While L is a natural language for set-theory, it is also a language for any structure with one distinguished element and one binary relation. For instance suppose that we construct an L-structure, A, with the natural numbers as the universe, with 0 being A, the interpretation of the emptyset symbol, and with the less-than relation being 2A . Then 8v (v 2 ) has as translation \every integer is less than 0," a false but meaningful statement.
1 2 1 2 1 2 1 2 1 1 1 2 3 2 3 1 1 1 1 3 3 2 2 2 3 3

1. THE LANGUAGE OF FIRST-ORDER LOGIC

73

The formulas of rst-order logic get quite long and quite messy. We will allow liberal abbreviation from the start. In particular, we use ' _ to abbreviate :' ! ,' ^ for :(:' ^: ), and ' $ for (' ! ) ^ ( ! '). We also use 9vi ' to abbreviate (:8vi (:')): Also to reduce the number of parentheses, we will assume the propositional connectives have the same relative precedence as before. In addition, we assume 8vi is associated with the shortest possible formula that follows it. Thus, 8vi' _ is (8vi ') _ rather than 8vi (' _ ).

Theorem 1.13.

1. Suppose that there are only countably many non-logical symbols in L. Then the number of formulas of L is countably in nite.

2. The de nition of formula is not ambiguous.

Exercises
1. Translate the following English sentences about arithmetic into formulas of LN . (a) 0 is the smallest number. (b) Addition is commutative. (c) Multiplication is distributive over addition. (d) The divisors of an odd number are odd. 2. Translate each of the following formulas of the language LN into English and determine their truth in N . (a) 8v 8v 8v ((v < v ^ v < v ) ! v < v ) (b) 8v 8v (v < v ! 9v (v + v = v )) (c) 8v 9v Sv = v . (d) 8v 9v Sv = v . 3. For each of the following formulas of the language with one binary relation symbol R, write the formula which it abbreviates. (a) 8v 8v R(v v ) ! R(v ). (b) 8v 8v R(v v ) ! 9v R(v v ).
1 2 2 2 2 3 1 2 2 3 1 3 1 1 1 1 2 3 1 3 2 1 2 2 1 1 1 2 2 1 1 2 1 3 3 1 3

74
1 1 1 2

CHAPTER IV. FIRST-ORDER LOGIC


(c) 9v R(v v ) ! 8v (R(v v ) _ 9v R(v v ) _ R(v v )). 4. An L-structure does not have to be a mathematical structure. Consider the set of all people as a universe with binary relations \is a parent of," \is the child of," and \is a sibling of." To form an appropriate language L, use relation symbols P , C , S for these relations. Suppose that proper names serve as constant symbols. Translate these sentences into L. (a) John is Mary's grandfather. (b) First cousins aren't siblings. (c) Every individual has exactly two parents. 5. Prove Theorem 1.9(a).
2 2 3 2 3 3 2

2. WHAT IS TRUTH?

75

2 What is Truth?
In this section we assign meaning to the formulas of a rst-order language L. First, we need to interpret the non-logical symbols of L. This is done by choosing an L-structure A. However this is not enough to assign a clear meaning to all formulas. Consider the formula R(v v ) in the language of one binary relation R. Even having chosen an L-structure, this formula does not have a meaning until individuals are chosen to stand for v and v . Thus to interpret a formula, we also have to choose individuals for each of the variables in the formula.
1 2 1 2

De nition 2.1. Given an L-structure A, an assignment (for A) is a function s : VAR ! A. That is, an assignment s assigns to each variable vi an element of the domain of A, s(vi ).
If s is an assignment, s can be used to assign an individual of A to every term.

De nition 2.2. Given an L-structure A and an assignment s for A, we extend s to a function s de ned on the set of all terms of L as follows.
1. If t is a variable v, then s(t) is already de ned by s(t) = s(v) 2. If t is a constant symbol c, then s(t) = cA 3. If t , t , : : : , tn are terms for which s(ti ) is de ned for each i, f is an n-ary function symbol, and t = f (t t : : : tn), then s(t) = f A(s(t ) s(t ) : : : s(tn)).
1 2 1 2 1 2

Note that s is well-de ned since the de nition of term is unambiguous.

Example 2.3. Let L be the language of arithmetic and let N denote the usual L-structure. Let s be an assignment such that s(v ) = 3, s(v ) = 2, and s(vi ) = 0 for all i = 0 1. Then s(v Ev ) = 9 while s((v +(v v ))) = 0. 6 Given an L-structure A and a formula ', ' may be true in A for some
0 1 0 1 3 2 1 0 1 0 1 0 1

assignments to the variables of ' and false for others. But once an assignment is chosen, ' is either true or false. For example, in the structure of arithmetic, N , the formula v = 2 v is true for the assignment of 2 to v and 4 to v but not for the assignment of 3 to v and 4 to v .

76

CHAPTER IV. FIRST-ORDER LOGIC

De nition 2.4. Given an L-structure A, an assignment s for A, and a formula ', we de ne, by induction on ', the relation A satis es ' with s (written A j= ' s] and also read \s makes ' true in A") as follows. 1. If t and t are terms, then A j= (t = t ) s] if and only if s(t ) = s(t ). 2. If t t : : : tn are terms and R is an n-ary relation symbol, then A j= R(t t : : : tn) s] if and only if (s(t ) s(t ) : : : s(tn)) 2 RA 3. If ' is a formula, then A j= :' s] if and only if it is not the case that A j= ' s] 4. If ' and are formulas then A j= (' ! ) s] if and only if A j= ' s] implies A j= s] 5. A j= 8vi ' s] if and only if A j= ' s(vi =a)] for all a 2 A. (Here s(vi =a) is the assignment s0 such that s0(vi ) = a and s0(vj ) = s(vj ) for all j = i.) 6 Lemma 2.5. For every formula ', variable vi, L-structure A, and assignment s for A, A j= 9vi ' s] if and only if there is a 2 A such that A j= ' s(vi=a)]: Proof. A j= 9vi ' s] if and only if A j= :8vi (:') s]. The latter is true if and only if it is not true that A j= 8vi (:') s]. This is the case if and only if it is not true that A j= :' s(x=a)] for some a 2 A. This is true if and only if A j= ' s(x=a)] for some a 2 A.
1 2 1 2 1 2 1 2 1 2 1 2

Suppose that R is a binary relation symbol. The variable v plays very di erent roles in the formulas ' = 8v R(v v ) and ' = R(v v ). In ' , v stands for a particular (but unspeci ed) element of the underlying structure. In order to interpret ' , we need to know an assignment. That is not the case for ' . The variable v in that formula is just a placeholder. ' is true or false independent of what an assignment determines v to be. We distinguish between these two uses of variables in the next de nition. De nition 2.6. Given a formula ' and a variable vi, we de ne what is meant by an occurrence of vi is free in ' by induction on '. 1. If ' is an atomic formula then every occurrence of vi in ' is free 2. An occurrence of vi in : is free if and only if it is free in
1 1 1 1 1 2 1 1 2 1 2 1 1 1 1

2. WHAT IS TRUTH?

77

3. An occurrence of vi in ' ! is free in that formula if and only if it is free in the subformula ' or that it occurs in 4. An occurrence of vi in 8vj ' is free in that formula if and only if i 6= j and that occurrence of vi is free in '. An occurrence of vi in ' is bound if it is not free. The free variables of ' are those which have at least one free occurrence in '. A sentence is a formula with no free variables. Lemma 2.7. Suppose that s and s0 are assignments for A and suppose that t is a term such that s and s0 agree on the variables occurring in t. Then s(t) = s0 (t). Proof. By induction on t. Theorem 2.8. Suppose that s and s0 are assignments for A and ' is a formula such that s and s0 agree on the free variables of '. Then A j= ' s] if and only if A j= ' s0 ]. Proof. As usual, the proof is by induction on '. The only interesting case is the case of quanti cation. Suppose that ' = 8vi . We have that A j= 8vi s] if and only if A j= s(vi=a)] for all a 2 A and that A j= 8vi s0 ] if and only if A j= s0(vi=a)] for all a 2 A But if s and s0 agree on the free variables of ', s(vi =a) and s0(vi =a) agree on the free variables of . Thus, by the induction hypothesis, A j= s(vi=a)] for all a 2 A if and only if A j= s0 (vi=a)] for all a 2 A: This proves the theorem. Corollary 2.9. Suppose that ' is a sentence. Then either A j= ' s] for every s or A j= ' s] for no s. In the former case we shall write A j= '. Theorem 2.8 says that to determine whether A j= ' s], we need only know the value of s on the nitely many free variables of '. This is similar to the situation that exists in propositional logic in which to determine the truth of a formula under a truth assignment, we only need to know the value of the truth assignment on the variables which actually occur in the formula. This motivates the following de nition.

78
0 1 0 1

CHAPTER IV. FIRST-ORDER LOGIC

De nition 2.10. Let ' be a formula all of whose free variables are among v v : : : vn . Let a a : : : an denote elements of an L-structure A. Then we write A j= ' a a : : : an] if A j= ' s] for any (every) assignment s such
that s(vi) = ai for all i n. Thus we can write N j= (v < v ) 2 3] in the case that N is the usual structure for arithmetic. De nition 2.11. A formula ' is satis able if there is a structure A and an assignment s for A such that A j= ' s]. We extend the notion of satis ability to sets of formulas as we did for propositional logic. De nition 2.12. Let ; be a set of formulas, A an L-structure, and s an assignment for A. Then we say A satis es ; with s if A j= ' s] for every ' 2 ;. We write this as A j= ; s]. In this case we say that ; is satis able. De nition 2.13. If A is an L-structure and ; a set of sentences of L, we say that A is a model of ; if A j= ', for every ' 2 ;. In this case we write A j= ;. Example 2.14. Let L be the language with a single binary relation symbol R. Then a partially ordered set is any L-structure which is a model of the set ; consisting of the following formulas:
0 1 0 1

8v R ( v v ) 8v 8v 8v (R(v v ) ! (R(v v ) ! R(v v ))) 8v 8v (R(v v ) ! (R(v v ) ! (v = v )))


1 1 1 1 1 2 2 3 1 2 2 3 1 3 1 2 2 1 1 2

Exercises 1. Let N be the standard L-structure for the language of arithmetic. Let
1 2 3

s be the assignment such that s(vi) = i for every i. Find s(t) for each of the following terms. (a) (v + (v Ev )) (b) ((v Ev )Ev ) (c) (v 0)Ev
3 4 5 3 4

2. WHAT IS TRUTH?

79

2. Let N be the standard L-structure for the language of arithmetic. Let s be the assignment such that s(vi) = 2i + 1 for each i 2 N . For each of the following formulas ', determine whether N j= ' s]. (a) 8v 9v ((v + v ) = v ) (b) (v < (v + v )) (c) 9v 8v (v < v ). 3. Let L be the language fe g where e is a constant symbol and is a binary function symbol. Find a set ; of L-formulas such that A is a model of ; if and only if A is a monoid. 4. Let L be the language f g of one binary function symbol. For each of the following conditions, write a set of formulas, ;, such that A j= ; if and only if A satis es the condition. (a) A has exactly three elements. (b) A is a semigroup. (c) A is a semilattice. 5. Prove Lemma 2.7.
1 3 1 3 2 1 2 3 1 2 1 2

80

3 Proofs

CHAPTER IV. FIRST-ORDER LOGIC

Our principal concern in studying rst order logic is to give a faithful model of the concept of proof in mathematics. On our model, proofs are about mathematical structures. The language of proofs about that structure is modeled by the appropriate rst-order language. We want to model the situation in which a mathematician starts with a set of hypotheses about the mathematical structure or strutures in question and derives, using a proof, a conclusion about that structure. Of course a conclusion of such a proof is supposed to have a certain logical relation to the hypotheses. Namely the conclusion is supposed to be \true" if the hypotheses are. This relationship is captured in the following de nition.

De nition 3.1. Suppose that ; is a set of formulas and ' is a formula. We say that ' is a logical consequence of ; (written ; j= ') if for every A and assignment s for A, if A j= ; s] then A j= ' s]. A formula ' is valid if j= '. The problem a mathematician faces is deciding whether ; j= '. How can she do this? The de nition suggests that she must check every L-structure A to determine if A j= ; and, if so, whether A j= '. But there are too many L-structures to check. The traditional picture of how mathematics is done

is di erent. On this account, the mathematician proceeds from her hypotheses, ;, to her conclusion ', by certain mechanical rules of inference. The paradigm of this picture is axiomatic geometry where proofs are sequences of steps each an axiom or justi ed by a rule of inference applied to earlier steps. We study this conception of mathematics here.

De nition 3.2. A formal system consists of:


1. A set F of objects called formulas 2. A subset A of F called axioms 3. A set R of pairs (; ') such that ; is a subset of F and ' 2 F called rules of inference. Now we are in a position to describe theorems and proofs.

De nition 3.3. Given a formal system F , the set of theorems of F is de ned


inductively by:

3. PROOFS

81

1. All axioms are theorems of F 2. If ; is a set of theorems of F and (; ') is a rule of inference, then ' is a theorem of F . A proof of ' is a demonstration that ' is a theorem. Proofs are usually given in a line-by-line manner (the traditional high-school geometry approach of listing a numbered sequence of statements and reasons is an exagerrated form of this) but may also be given as trees as with any inductive de ntion. Notice that if (; ') is a rule of inference and ; is an in nite set, proofs may be \in nitely long." This is because the tree for the proof might have in nitely many branches at a single node. Notice too that in this way of viewing proofs, every inductive de nition can be viewed as de ning a formal system. Therefore many of the things that we say about proofs are true about derivations in any inductive de nition. Example 3.4. For F , the set of formulas of a formal system, we take PROPf: !g, the set of formulas of propositional logic using only the connectives : and !. For A, the set of axioms, we take all formulas which have any of the following three forms:

'!( ! ) (' ! ( ! )) ! (' ! ) ! (' ! )) (:' ! ) ! ((:' ! : ) ! ')) For the rules of inference, we take all pairs of the form (f' ' ! g ). (This is called the rule of modus ponens.) It can be shown that ' is a theorem of this system if and only if ' is a tautology. We now begin to describe rst-order formal systems. To construct a rstorder formal system, we rst specify a rst-order language L. The formulas of the formal system are, of course, the rst-order formulas over L. The axioms of a rst-order formal system come in two di erent varieties. There will be a set of logical axioms which do not vary from formal system to formal system. Of course these axioms should model facts which we take to be \obviously" true about all L-structures. An example of such an axiom is 8v (v = v ). We give a complete list of these axioms in the next section. In addition to the logical axioms, we may have a set ; of non-logical axioms. These axioms correspond to our hypotheses in a particular domain of study.
1 1 1

82

CHAPTER IV. FIRST-ORDER LOGIC

For example, ; might include the de ning properties of a partial order. For rules of inference, we will only allow instances of modus ponens. That is, the rules of inference will be all pairs of the form (f' ' ! g ) where ' and are formulas. Since for a xed language, L, the logical axioms and rules of inference are xed, the theorems of a formal system depend only on the nonlogical axioms, ;. This motivates the following de nition. De nition 3.5. We say that there is a proof of ' from ; in L (written ; ` ') if ' is a theorem of the rst-order formal system with non-logical axioms ;. We can now recover our intuitive picture of a line-by-line proof. Theorem 3.6. ; ` ', if and only if there is a nite sequence of formulas ' ' : : : 'n such that 'n = ' and for each i n, either 1. 'i is a logical axiom, 2. 'i 2 ;, or 3. there are j k < i such that 'k = 'j ! 'i . Proof. By induction on '. Any proof \uses" only nitely many axioms. Therefore we have the following compactness phenomenon. Theorem 3.7. Suppose that ; ` '. Then there is a nite subset of ; such that ` '. Unless we say otherwise, we will assume that the language is countable (i.e., has only countably many non-logical symbols). We will also assume in this case that the set of non-logical symbols is decidable so that the set of formulas of the language is decidable. Then we have the following. Theorem 3.8. Supppose that the set of formulas of a rst-order logic is decidable. Suppose that ; is a decidable set of formulas. Then the set f' : ; ` 'g is an e ectively enumerable set. In particular, the set of valid formulas is e ectively enumerable. Proof. The set of \line-by-line" proofs from ; is decidable in this case. Thus the set of last lines of proofs is e ectively enumerable.
1 2

3. PROOFS

83

Exercises

1. Show that f' ' ! g j= . 2. Show that ; f'g j= if and only if ; j= ' ! . 3. Suppose that ; and are sets of formulas over some language L and that ; . Show that if ; ` ' then ` '. 4. Show that if ; ` ' and f'g ` then ; ` . 5. Show that if ; ` ' ! , then ; f'g ` . 6. Show that f8v (' ! ) 8v 'g j= 8v .
1 1 1

84

4 Logical Axioms

CHAPTER IV. FIRST-ORDER LOGIC

In this section we list the logical axioms for any rst-order language. Let L be a xed rst-order language. There are in nitely many logical axioms for L which fall into eight natural categories. We list these here after discussing some preliminary issues. The rst of these preliminary issues is the relationship of propositional logic to rst-order logic. Consider for example the formula x = y ! x = y. We see immediately that the logical form of this formula is the same as that of P ! P which is a tautology of propositional logic. We would certainly agree that this formula is valid for this reason. Also, since we have an e ective procedure for determining tautologyhood, it is certainly reasonable that we would allow all such formulas to be axioms. In order to say what it means for a formula to be a tautology in this way we will describe how to interpret the part of rst-order logic that involves the connectives : and ! as a propositional logic. To be precise, we shall call any formula which is either atomic or is built by rule 4 of the inductive de nition of formula a propositional variable. Thus x = y and 8v (R(v v ) ! R(v v )) are propositional variables but x = y ! y = x is not. It is easy to see that every formula of rst-order logic can be thought of as a formula of propositional logic in this way. (Notice that the set of propositional variables may be uncountable if the language is. This is only minor extension to propositional logic for only nitely many variables occur in any particular formula.) Now, testing whether a formula is a tautology is just a matter of truth tables. For example, in the formula
1 1 3 3 4 4 3

(8v R(v ) ! 8v 8v (R(v ) ! Q(v ))) ! (:8v 8v (R(v ) ! Q(v ))) ! :8v R(v ))
1 1 2 3 2 3 2 3 2 3 1 1

the subformulas (8v R(v ) and 8v 8v (R(v ) ! Q(v )) are propositional variables so that the entire formula is a tautology for the same reason that (P ! P ) ! (:P ! :P ) is. A second matter preparatory to the listing of the axioms below concerns the concept of substituting terms for variables.
1 1 2 3 2 3 1 2 2 1

De nition 4.1. Suppose that ' is a formula and t a term of L. Then


1 1 2

'(vi=t) is the formula which results from substituting the term t for each free occurence of the variable vi in '. Example 4.2. Let LN be the language of arithmetic. Let ' = 8v (v + v =

4. LOGICAL AXIOMS
1 2 1 1 1 1 1

85

v ) and let t = 0. Then '(v =t) = 8v (v + 0 = v ). On the other hand, '(v =t) = ' since no occurences of v are free in '. De nition 4.3. t is substitutable for vi in ' if every occurence of any variable that occurs in t is free in '(vi=t). De nition 4.3 is meant to help us describe what happens in the following situation. Let ' be the formula 8v (v = v ). ' \says" roughly that everything is equal to one xed (but unspeci ed) element which we are temporarily naming v . Obviously this formula can be true only in a structure with one element. Now '(v =v ) says essentially the same thing but with v in place of v . However '(v =v ) = 8v (v = v ) which \says" that everything is equal to itself (which is obviously true in all structures). Of course v is not substitutable for v in '. We shall want to distinquish between these two cases below. We can also give an inductive de nition of t is substitutable for vi in ' which will be useful in some cases. This de nition is left to the exercises.
3 3 1 1 1 4 4 1 1 3 3 3 3 3 1

Logical Axioms for L


1. All tautologies. 2. For all formulas ' and and variables vi, 8vi(' ! ) ! (8vi ' ! 8vi ) 3. For all formulas ' and variables vi, if vi is not free in ' then ' ! 8vi ' 4. For all formulas ', variables vi and terms t, if t is substitutable for vi in ', 8vi' ! '(vi=t) 5. Equality axioms. If r, s and t are terms, t = t t = s ! s = t t = s ! (s = r ! t = r) 6. For all terms t : : : tn and s : : : sn and n-ary function symbols f t = s ! (t = s ! : : : ! (tn = sn ! f (t t : : : tn) = f (s s : : : sn)) : : : )
1 1 1 1 2 2 1 2 1 2

86
1

CHAPTER IV. FIRST-ORDER LOGIC


7. For all terms t : : : tn and s : : : sn and n-ary relation symbols R
1

t = s ! (t = s ! : : : ! (tn = sn ! (R(t t : : : tn) ! R(s s : : : sn)) : : : )


1 1 2 2 1 2 1 2

8. Generalization. If ' is an axiom and vi a variable then

8vi '
The logical axioms are supposed to be true about every structure. That is the content of the next theorem. Theorem 4.4. Suppose that ' is a logical axiom in some rst-order language L. Then j= ' (i.e., for every L-structure A, every formula ', and every assignment s for A, we have A j= ' s]). The following Corollary is called the Soundness Theorem it shows that reasoning in rst-order logic does not lead us to false conclusions. Corollary 4.5 (The Soundness Theorem). Suppose that ; is a set of formulas and ' is a formula such that ; ` '. Then for every L-structure A, if A j= ; then A j= ' (i.e., ; j= '). The Soundness Theorem says that proofs do not lead us astray the statements we prove are all true. That is, if we start with true hypotheses ; and prove theorem ', then ' is also true. The converse | that proofs allow us to prove all true things | is also true but harder to prove. The proof of this fact occupies sections 7 and 8.

Exercises
1. De ne t is substitutable for vi in ' by induction on '. 2. Show that j= ' for every axiom '. 3. Prove Theorem 4.4. (Hint: Prove this by induction on the proof of '. Use Exercise 2 and also Excercise 1 of Section 3.) 4. Prove the Soundness Theorem.

5. PROOFS IN ARITHMETIC

87

5 Proofs in Arithmetic

So you think that you want to see some actual proofs in some rst-order logical system. You're wrong, you know. These systems were never intended to be systems in which we actually write proofs. Proofs in the real world look nothing like proofs in a rst-order system. Proofs in a rst-order system are long, messy, not particularly intuitive, and extremely hard to follow. But perhaps a few examples will give you a better feeling of what can be proved in a rst-order system and how such a system might serve as a good model of mathematical practice. We will give some examples of proofs in arithmetic. For this purpose, we let L be the language of arithmetic. Recall that L = (0 S + E <). We will refer to N as the standard model of arithmetic. The reason for this terminology will become clear later. The arithmetician, or number theorist as she is usually called, has the task of determining for what sentences ' is it the case that N j= '. On our view of proof, she does this by writing down a certain reasonable set of axioms, ;, such that N j= ;. She then writes proofs, that is she attempts to decide for which sentences ' is it the case that ; ` '. By the Soundness Theorem, if N j= ; and ; ` ', then N j= '. The mathematician hopes, in addition, that she has chosen the axioms so that if N j= ' then ; ` '. Here is a rst attempt at a set of axioms for arithmetic. The set of axioms is a variant of a set normally called Robinson's Q we call our set Q as well. 1. 8v (S (v ) 6= 0) 2. 8v 8v (S (v ) = S (v ) ! v = v ) 3. 8v 8v (v < S (v ) ! (v < v _ v = v )) 4. 8v (v 6< 0) 5. 8v 8v (v < v _ v = v _ v < v ) 6. 8v (v + 0 = v ) 7. 8v 8v (v + S (v ) = S (v + v )) 8. 8v (v 0 = 0) 9. 8v 8v (v S (v ) = v v + v )
1 1 1 1 1 1 1 1 1 1 2 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 2 1 1 1 2 1 2 1 2 1 2 1 2 1 2 1

88 10. 8v (v E 0 = S (0))
1 1

CHAPTER IV. FIRST-ORDER LOGIC


v)
1 1 2 11

11. 8v 8v (v ES (v ) = v Ev
1 2 1 2 1

We will refer to the axioms above as : : : . It is clear that N j= i for each i 11. Notice that most of the formulas listed above are not actually formulas but abbreviate formulas. For example, S (v ) 6= 0 abbreviates :(S (v ) = 0). We will use one further abbreviation. If the meaning is clear we will omit the parentheses around the argument of the S function symbol as in S 0 for S (0). Before writing some proofs in Q, we introduce some notation. For each natural number n, we introduce a symbol, n, to denote the term S S (0) in which there are n successive occurences of the successor symbol. If s is any assignment to N , we have that s(n) = n. We shall write our proofs in line-by-line fashion | you are invited to write a tree. For our rst two theorems, we prove that addition works the way you think it should.
1 1

Theorem 5.1. For any natural number n, Q ` n + 0 = n.


Proof. Fix a natural number n.

Statement Reason 1 8v (v + 0 = v ) 2 8v (v + 0 = v ) ! n + 0 = n Logical axiom 4 MP, 1 and 2 3 n+0=n


1 1 1 1 1 1 6

Theorem 5.2. For any natural numbers n and m, Q ` n + m = n + m.


Proof. We prove this by induction on m. The case m = 0 is the base case and is Theorem 5.1. Suppose then that Q ` n + m = n + m. To prove the proposition true for m + 1 we have the following.

5. PROOFS IN ARITHMETIC
1 2 3 4 5 6 7 8 9 10 11 Statement 8v 8v (v + S (v ) = S (v + v )) 8v 8v (v +S (v ) = S (v +v )) ! 8v (n +S (v ) = S (n + v )) 8v (n + S (v ) = S (n + v )) 8v (n + S (v ) = S (n + v )) ! n + Sm = S (n + m) n + Sm = S (n + m) n+m=n+m n + m = n + m ! S (n + m) = S (n + m) S (n + m) = S (n + m) n + Sm = S (n + m) ! (S (n + m) = S (n + m) ! n + Sm = S (n + m)) S (n + m) = S (n + m) ! n + Sm = S (n + m) n + Sm = S (n + m)
1 2 1 2 1 2 1 2 1 2 1 2 2 2 2 2 2 2 2 2 2

89 Reason Logical axiom 4 MP, 1 and 2 Logical Axiom 4 MP, 3 and 4 (induction) Logical Axiom 6 MP 6 and 7 Logical Axiom 5 (trans.) MP 5 and 9 MP 8 and 10 behave correctly.
7

The last line is what we wanted to prove: n + m + 1 = n + m + 1. Using similar reasoning, we can show that E and

Theorem 5.3. For all natural numbers n and m, Q ` n m = nm and Q ` nEm = nm .


We now proves some facts about <.

Theorem 5.4. Q ` 8v (v < 1 ! (v = 0)):


1 1 1

Proof.

1 2 3 4 5 6

Statement 8v (v 6< 0) 8v 8v (v < S (v ) ! (v < v _ v = v )) 8v 8v (v < S (v ) ! (v < v _ v = v )) ! (v < 1 ! (v < 0 _ v = 0))] 8v (v < 1 ! (v < 0 _ v = 0)) 8v (v < 1 ! (v < 0 _ v = 0)) ! (v 6< 0 ! (v < 1 ! v = 0))] 8v (v < 1 ! v = 0)
1 1 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Reason
4

L. Ax. 4,8 L. Ax. 2, MP tautology, L. Ax. 8 L. Ax. 2, MP

90

CHAPTER IV. FIRST-ORDER LOGIC

Obviously, steps 3{6 all abbreviate many routine and boring steps. The next section will give us many ways to abbreviate such proofs so that we can argue that proofs exist for certain formulas without actually writing out all the steps. A proof by induction on m using proofs similar to that of the previous theorem su ces to prove the following theorem. Theorem 5.5. For all natural numbers m, Q ` 8v (v < m + 1 ! (v = 0 _ _ v = m)). You are probably wondering whether we have written down enough axioms to characterize N . The answer is no. Theorem 5.6. There are sentences ' such that N j= ' but such that Q 6` '. Proof. The following sentences are examples of sentences true in N but not provable from Q. ' = 8v (v 6= S (v )) ' = 8v 8v (v v = v v ) To see this, we rst construct an L-structure, A, which is di erent than N but for which A j= Q. To construct A, let A = N f1g. We de ne each <A, S A, +A , A , and E A so that A is a substructure of N . Therefore we need only examine how to extend these operations to 1. We de ne <A so that n < 1 for every n 2 N . We de ne S (1) = 1, and for each of the binary operations, , we de ne a b = 1 if either or both of a or b is 1 except for the following cases: 1 0 = 0, 1E 0 = 1, 0E 1 = 0, and 1 + 0 = 1. It is easy to see that A j= Q. However A 6j= ' and A 6j= ' . Thus Q 6` ' and Q 6` ' . This follows from the soundness theorem for if Q ` ', Q j= ' and so A j= '. Of course we could add the sentences ' and ' as new axioms of arithmetic. However we shall see in Chapter 5 that there is no \reasonable" set of axioms which we can add so that all sentences true about N are provable from the axioms.
1 1 1 1 1 2 1 1 1 1 2 1 2 2 1 1 2 1 2 1 2

Exercises

1. Write down three sentences ' that are true in N but such that Q 6` '. (Hint: Examine some properties of the structure A of the proof of Theorem 5.6.

5. PROOFS IN ARITHMETIC

91

2. (a) Prove that Q ` 0 < 1. (b) Show that Q ` 1 6= 3. (You need not write out the proof in Q you merely need to show that the proof exists.) 3. (a) Show that Q ` 0 6= 1. (b) Prove that if m < n then Q ` m < n. (Fix m and prove this by induction on n > m.) 4. Prove Theorem 5.5.

92

6 Some Theorems about Proofs

CHAPTER IV. FIRST-ORDER LOGIC

Showing that formulas are theorems of a rst-order formal system is di cult. This is because the system has relatively few axioms and only one rule of inference. This economy is necessary so that theorems about the formal system can be proved more easily. But it does make it more di cult to prove theorems in the system. In this section we prove a few theorems about what can be proved in the system which will aid us in further study of the system. The rst of these is often called the Deduction Theorem for rst-order logic. For the purposes of economy of expression, we will assume for the remainder of the section that L is a xed rst-order language. Theorem 6.1. Suppose that ; is a set of formulas and ' and are formulas. Then ; f'g ` if and only if ; ` ' ! . Proof. The \if" part of this proof is Exercise 5 of Section 3. For the \only if" part, assume that ; f'g ` . We show that ; ` ' ! by induction on the inductive de nition of proofs from ; f'g. Thus there are four cases either is a logical axiom, is an element of ;, is ', or follows by modus ponens from two other theorems from ; f'g. In the rst case ( is a logical axiom) we claim that ! (' ! ) is also a logical axiom. This is the case since this formula is a tautology. Since and ! (' ! ) are both axioms, ; ` and ; ` ! (' ! ). Thus by modus ponens, ; ` ' ! . In the second case, that 2 ;, we have that ; ` and so again by modus ponens applied to ! (' ! ), ; ` ' ! . In the third case, that ' = , ' ! is a tautology so again ; ` ' ! . Finally, suppose that ; f'g ` by reason of modus ponens applied to two other formulas say and ! . By induction, we may assume that ; ` ' ! and ; ` ' ! ( ! ) It is easy to verify that ; ` (' ! ( ! )) ! ((' ! ) ! (' ! )) (6.2) since the formula on the right is a tautology. Thus ; ` ' ! follows from 6.1 and 6.2 by modus ponens. The next two lemmas, the Lemma on Variables and the Lemma on Constants, and their corollaries are useful tools in arguing that various theorems (6.1)

6. SOME THEOREMS ABOUT PROOFS

93

are provable in a rst-order system. One bit of terminology will be useful we will think of a proof in a rst-order system in a line-by-line manner and then we will say that a variable vi occurs free in a proof (or that a constant symbol c occurs in the proof) if it occurs free (or occurs) in any one of the formulas which are the lines of the proof.

Lemma 6.2 (Lemma on Variables). Suppose that vi is a variable which is not free in any formula in ; and suppose that ; ` '. Then ; ` 8vi '. Furthermore there is a proof of 8vi' from ; such that vi does not occur free
in the proof. Proof. Of course we prove this by induction on the inductive de nition of ; ` '. Suppose rst that ' is an axiom. Then 8vi ' is an axiom. Suppose next that ' 2 ;. Then the following is a proof of 8vi ':

' ' ! 8vi ' 8vi '


The second line in this proof is an instance of axiom scheme 3. Note that vi does not occur free in any of the three lines since vi does not occur free in ' if ' 2 ;. The third case is that ' is the result of modus ponens applied to two other formulas, say ! ' and for which the lemma is true. Thus we may assume that ; ` 8vi and ; ` 8vi( ! ') via proofs in which vi does not occur free. Then we conjoin these proofs together with the axiom 8vi ( ! ') ! (8vi ! 8vi'), which is an instance of axiom scheme 2, and use modus ponens twice to get a proof of 8vi ' in which vi does not occur free.

Corollary 6.3. Suppose that ; ` ' and that vi is a variable which does not
occur free in ' or any formula of ;. Then there is a proof of ' from ; such that vi does not occur free in any formula used in the proof of ' from ;. Proof. By the lemma, we may prove 8vi ' from ; without using a formula in which vi occurs free. Now the formula 8vi ' ! ' is an instance of axiom scheme (4). Thus we may deduce ' from it and the deduction of 8vi ' using modus ponens.

Recall that a sentence is a formula with no free variables.

94

CHAPTER IV. FIRST-ORDER LOGIC

Corollary 6.4. If ; is a set of sentences and ' is a sentence such that ; ` ', there is a proof of ' from ; using only sentences. Corollary 6.5 (Change of Variables). Suppose that vi is a variable that does not occur in ' and vj is any variable. Then 8vi '(vj =vi) ` 8vj '. Proof. 8vi '(vj =vi) ! '(vj =vi )(vi=vj ) is an axiom (scheme 4) since vj is sub-

stitutable for vi in '(vj =vi). (The only free occurences of vi in '(vj =vi) are at the places that vj occured free in ' since vi does not occur in ' and hence no instance of vj substituted for vi becomes bound.) Of course '(vj =vi)(vi =vj ) = '. Thus 8vi '(vj =vi) ` '. But vj does not occur free in 8vi'(vj =vi). Thus by the lemma, 8vi '(vj =vi) ` 8vj '.

Lemma 6.6 (Lemma on Constants). Suppose that ; is a set of formulas in which the constant symbol c does not occur and suppose that ; ` '. Then

for any variable vi which does not occur in the proof of ', there is a proof of '(c=vi) from ; such that c does not occur in that proof. (Here, of course, '(c=vi) is the result of replacing all occurences of c by vi .) Proof. Let P be a proof of ' from ;. Let vi be a variable that does not occur in P at all. Let P 0 be the result of replacing every occurence of c in P by vi. We claim that P 0 is a proof of '(c=vi) from ;. To see this, notice that logical axioms are transformed to logical axioms under this transformation, elements of ; are unchanged since c does not occur in ;, and instances of modus ponens are transformed to instances of modus ponens. Thus the resulting sequence of formulas is a proof and it is a proof of '(c=vi).

The next lemma takes a little bit of work just to understand the statement. But it really says something quite trivial.

Lemma 6.7. Suppose that ' is a formula, A a structure, and s an assignment for A. Suppose that t is a term which is substitutable for vi in '.
Then

A j= '(vi=t) s] if and only if A j= ' s(vi=s(t))]

Proof. The proof is by induction on '. For ease of notation, write s0 for the assignment s(vi=s(t)). One rst proves that for every term u, s(u(vi=t)) = s0(u). With this in hand, it is easy to prove the lemma for the case of atomic formulas. For instance, consider the atomic formula u1 = u2 for terms u1 and u2. Then A j= (u1 = u2)(vi=t) s] if and only if s(u1(vi=t)) = s(u2(vi=t)) if and

6. SOME THEOREMS ABOUT PROOFS


1 2 1 2

95

only if s0(u ) = s0(u ) if and only if A j= (u = u ) s0]. The only interesting case in the induction is the universal quanti er. Suppose then that ' is 8vj and that the lemma is true for . The interesting case here is if vj 6= vi , t is substitutable for vi in , and vj does not occur in t. Here goes. We rst note that in this case (8vj )(vi=t) = 8vj ( (vi=t)). Thus A j= (8vj )(vi=t) s] if and only if A j= 8vj ( (vi=t)) s] if and only if it is the case that for all a 2 A, A j= (vi=t) s(vj =a)]: (6.3) We now apply the induction hypothesis to (but with the assignment s(vj =a) in place of s. Thus we get that (6.3) is true if and only if for all a 2 A, A j= s(vj =a)(vi=s(vj =a)(t))]: (6.4) But since vj does not occur in t, s(vj =a)(t) = s(t) and s(vj =a)(vi=s(t)) = s(vi=s(t))(vj =a). Therefore, (6.4) is true if and only if for all a 2 A, A j= s(vi=s(t))(vj =a)]. But this is true if and only if A j= 8vj s0].

Exercises 1. De nition 6.8. A set ; of formulas is inconsistent if there is a formula ' such that ; ` ' and ; ` :'. ; is consistent if it is not inconsistent.
Prove the following. (a) ; is inconsistent if and only if for every formula , ; ` . (Hint: gf ! (:' ! ) is a tautology of all ' and .) (b) ; f'g is consistent if and only if ; 6` :'. (c) Given a consistent set ; of formulas and an arbitrary formula ', either ; f'g or ; f:'g is consistent. (d) A set, ;, of formulas is consistent if and only if every nite subset of ; is consistent. 2. De nition 6.9. A theory is a set of sentences closed under `. (i.e., T is a theory if ' 2 T whenever T ` '.)

De nition 6.10. Given an L-structure A, the theory of A is the set of sentences ' such that A j= '. The theory of A, is denoted by TH(A).

96

CHAPTER IV. FIRST-ORDER LOGIC

De nition 6.11. A set of sentences T is complete if for every sentence ', either ' 2 T or :' 2 T .
Prove the following. (a) There is a smallest theory. That is show that for a xed language L, there is a set of sentences T such that for every theory T 0, T T 0. (b) There is a largest theory. (c) The theory of A is a theory. (d) The theory of A is consistent. (e) The theory of A is complete. (f) If T is consistent and complete then for sentences ', T ` ' if and only if ' 2 T . 3. De nition 6.12. A set of axioms for a theory T is a set of sentences, ;, such that ; T and ; ` ' for every ' 2 T . Prove the following. (a) For every set ; if sentences, there is a theory T such that ; is a set of axioms for T . (b) For every theory, T , there is a set of axioms for T . 4. (a) Suppose that t is a term and v a variable such that v does not occur in t. Show that ` 9v(t = v). (b) Show that if t is a term and v does occur in t, 6` 9v(t = v). (Hint: First show that there is a structure A such that A 6j= 9v(t = v). Then appeal to the Soundness Theorem.)

7. COMPLETENESS

97

7 Completeness
Suppose that ; is a set of formulas. If ; is satis able (i.e., there is a structure A such that A j= ;) then obviously ; is consistent. This is essentially the Soundness Theorem. The next theorem shows that the converse is true as well.

Theorem 7.1 (Completeness Theorem). Suppose that ; is a consistent set of formulas. Then ; is satis able that is, there is a structure A and an assignment, s, such that A j= ; s].
Before proving this important theorem, we prove several corollaries.

Corollary 7.2. Suppose that ; is a set of formulas and that ' is a formula. Then ; j= ' implies that ; ` '. Proof. Suppose that ; j= '. Then ; f:'g is not satis able. Thus by the Theorem, ; f:'g is not consistent. Thus ; ` ' (by Exercise 1 of Section
6).

Corollary 7.3 (Compactness Theorem). Suppose that every nite subset of ; is satis able. Then ; is satis able. Proof. If every nite subset of ; is satis able, then every nite subset of ; is consistent. But this implies that ; itself is consistent (by Exercise 1 of Section 6). This in turn implies that ; is satis able.

Example 7.4. Let ; be the usual rst-order axioms for groups in the language L = fe g. Let ' be a sentence in the language L. Then there is a group in which ' is true just in case ; f'g is consistent. Furthermore, if ' is true in every group then ; ` '.
The rest of this section and the next is devoted to the proof of Theorem 7.1. So suppose that ; is a consistent set of formulas in the language L. We make two further assumptions to facilitate the proof. These are not necessary and we explain how to remove these later. Assume that 1. L has only countably many nonlogical symbols, and 2. Every formula in ; is a sentence.

98
0 1

CHAPTER IV. FIRST-ORDER LOGIC

Next we choose a countably in nite set of new constant symbols, C = fc c : : : g, which are not in L. Let L0 = L C then L0 also satis es the rst assumption above. Now ; can be viewed as a set of L0 sentences and we have the following lemma. Lemma 7.5. ; is consistent as a set of L0 sentences. Proof. Suppose to the contrary that there is an L0 formula ' such that ; ` ' and ; ` :'. By successively applying the Lemma on Constants to the proofs of ' and :', we can replace all the constants from C that occur in these proofs with variables that do not otherwise occur in them. This yields proofs of formulas and : (where is a result of replacing the constants occuring in ' by variables) such that , : and all the formulas which occur in the proofs are formulas of L. This yields the contradiction that ; is inconsistent as a set of sentences of L. We next make a de nition. De nition 7.6. A set, , is sentences is a Henkin set (over L0 ) if for every formula ' with exactly one free variable (say vi), there is a constant symbol, c, such that the sentence 9vi' ! '(vi=c) is in . Lemma 7.7. There is a set of sentences ; which is consistent and is a Henkin set. Proof. Since the language L0 is countable, there is a list (' x ) (' x ) : : : of pairs (' x) such that ' is a formula of L0 which has free variable x and no other free variables. Let ci1 ci2 : : : be distinct constants chosen from C such that ci does not occur in any of the formulas ' ' : : : 'j; . (This can be done since no constant in C occurs in ; and there are only nitely many other formulas to consider.) We claim that the set of sentences = ; f9xj ' ! '(xj =ci ) : j = 0 1 : : : g is a consistent Henkin set. It is obvious that is a Henkin set. To show that it is consistent, otherwise let n be least such that n = ; f9xj ' ! '(xj =ci ) : j = 0 1 : : : ng is inconsistent. Then n; ` :(9xn ' ! '(xn =ci )). Thus using various tautologies and modus ponens, n; ` 9xn ' and n; ` :'(xn=ci ).By the Lemma on Constants, the latter implies that n; ` :'(xn=v) for some variable v is a variable that does not occur in the proof of :'(xn =ci ). (This is the use of our assumption that ci does not occur in any formula of n; .) Thus n; ` 8v:'(xn=v) by the Lemma on Variables and so by Corollary 6.5, n; ` 8xn :'. But n; ` :8xn :'. Thus n; is not consistent, contrary to assumption.
1 1 2 2
j

7. COMPLETENESS

99

We now have a set of sentences such that ; and is a Henkin set. Lemma 7.8. There is a complete, consistent theory such that . Proof. The proof is essentially the same as the rst proof Theorem 3.1, the Compactness Theorem for propositional logic. Let ' ' : : : be a listing of all the sentences of L0 this is possible since there are only countably many such formulas by our rst assumption above. We construct : : : so S . In addition, we guarantee that each n is consistent and then let = n n that by setting = . The construction is as follows. Given n either n f'g is consistent or n f:'g is consistent by Exercise 1 of Section 6. In the former case let n = n f'g, otherwise let n = n f:'g. In either case it is clear that n is consistent. Now we note that is complete since we decide the fate of 'n when constructing n and is consistent, else one of the sets n is not. Let us review the properties of : 1. is consistent 2. is complete 3. is a Henkin set (since is a Henkin set and ) 4. ;. We complete the proof by showing that any set with properties 1,2, and 3 is satis able. We will do this by explicitly constructing a structure A such that A j= . Then that A j= ; by 4. (Note that A will be an L0structure and not an L-structure. However we can think of it as an Lstructure by \forgetting" the interpretations of the constant symbols of C .) The construction of A occupies the next section.
1 2 0 1 0 +1 +1 +1 +1

Exercises

1. Suppose that T and T are theories such that for every structure A, A j= T if and only if A 6j= T . Show that there is a sentence ' such that A j= ' if and only if A j= T . (Hint: rst show that T T is inconsistent and then use this fact.) 2. Suppose that the set of symbols of a rst-order language L is a decidable set. Show that the set of valid formulas is e ectively enumerable.
1 2 1 2 1 1 2

100

8 Completeness - The Model


model.

CHAPTER IV. FIRST-ORDER LOGIC

Theorem 8.1. Let be a complete consistent Henkin theory in a language L0 . Then has a model. Proof. The model will be called A. We rst de ne the universe, A, of the
We next de ne a relation on the set of closed terms by t u if and only if ` t = u: Lemma 8.3. is a equivalence relation on the set of closed terms. Proof. This follows easily from the logical axioms of axiom scheme 5. For a closed term t, let t] denote the equivalence class of t. We now de ne A. De nition 8.4. The Henkin model, A, for is de ned as follows. 1. The universe A of A is de ned by A = f t] : t is a closed term of L0g 2. For each constant symbol c of L0 , cA = c] 3. For each n-ary function symbol f of L0 , given closed terms t t : : : tn, f A( t ] t ] : : : tn]) = f (t t : : : tn)]
1 2 1 2 1 2

De nition 8.2. A closed term of L0 is a term with no variable.

4. For each n-ary relaltion symbol R of L0, given closed terms t t : : : tn, ( t ] t ] : : : tn]) 2 RA if and only if ` R(t t : : : tn)
1 2 1 2 1 2

Lemma 8.5. The model de ned in De nition 8.4 is well-de ned. That is,
for each n-ary function symbol f , and sequence of terms t1 t2 : : : value f A( t1 ] t2] : : : tn ]) is uniquely determined by the above de Also, for each n-ary relation symbol and sequence of closed terms t1 t2 the truth of ( t1 ] t2 ] : : : tn]) 2 RA is uniquely determined by the de

tn, the

: : : tn ,

nition. nition.

8. COMPLETENESS - THE MODEL

101

Proof. What we have to prove for an n-ary function symbol is this: if t1 t2 : : : tn and s1 s2 : : : sn are sequences of terms such that ti si for each i n, then f (t1 t2 : : : tn) f (s1 s2 : : : sn). This follows from logical axiom scheme 6. For ti si means that ` ti = si. Thus by axiom scheme 6 and modus ponens n times, ` f (t1 t2 : : : tn) = f (s1 s2 : : : sn). A similar argument shows that RA is well de ned for each relation symbol R. Having de ned A, we are now ready to complete the proof by showing that A j= . Lemma 8.6. For every sentence ' of L0, A j= ' if and only if ` '. Proof. The proof is by induction on '. First note that for every assignment s to A and for every closed term t, s(t) = t]. Case 1: ' is t1 = t2 for terms t1 and t2. Then since ' is a sentence, t1 and t2 are closed terms. We have that for every assignment s, A j= ' s] if and only if s(t1 ) = s(t2 ) if and only if t1] = t2] if and only if ` t1 = t2 . Case 2: ' is R(t1 t2 : : : tn) for terms t1 , t2, : : : , tn and n-ary relation symbol R. This case is quite similar to Case 1. We have that for every assigment s, A j= ' s] if and only if (s(t1 ) s(t2 ) : : : s(tn)) 2 RA if and only if ( t1] t2 ] : : : tn]) 2 RA if and only if ` R(t1 t2 : : : tn). Case 3: ' is : . Then A j= ' if and only if A 6j= if and only if 6` (by the induction hypothesis) if and only if ` ' (by the completeness of ). Case 4: ' is ! . This case is left to the exercises. Case 5: ' is 8vi . Then A j= ' if and only if A j= 8vi s] for all assignments s. This is true if and only if A j= s(vi=a)] for all assigments s and elements a 2 A. Since elements of A are simply the equivalence classes of closed terms, we have that this is true if and only if A j= s(vi = t])] for all assignments s and closed terms t. By Lemma 6.7, this is true if and only if A j= (vi=t) s] for all assignments s and closed terms t. Since (vi=t) is a sentence, by induction we are entitled to assume that this is true if and only if ` (vi =t) for all closed terms t. Thus what remains to be proved is

direction of (8.1) follows by the completeness of . For the other direction, suppose that 6` 8vi . Then ` 9vi : by completeness. But then, since is a Henkin theory, ` : (vi=c) for some constant c. Thus 6` (vi=c)

` (vi=t) for all closed terms t if and only if ` 8vi (8.1) Now 8vi ! (vi=t) is a logical axiom for any closed term t so the if

102

CHAPTER IV. FIRST-ORDER LOGIC

for some constant c. Since a constant is a closed term, we have in this case that 6` (vi=t) for some closed term t and 8.1 is proven.

Corollary 8.7 (Lowenheim-Skolem Theorem). Suppose that ; is a set

of sentences in a countable language which has a model. Then ; has a countable model. Proof. If ; has a model, it is consistent. Thus the proof of Theorem 8.1, the Henkin model for a consistent, complete Henkin extension of ; is a model of ;. But this model is countable since every element of the model is an equivalence class of closed terms and there are only countably many closed terms.

Exercises
1. Complete the proof of Lemma 8.6 by proving case 4 of the induction. 2. (The Skolem Paradox) Set theory is a rst-order theory in the language f2g. Thus, by the Lowenheim-Skolem Theorem, it has a countable model i.e., there are only countably many sets. Then how could it be possible to prove the theorem that there is an uncountable set?

9. EXTENSIONS TO THE COMPLETENESS THEOREM

103

9 Extensions to the Completeness Theorem


We made two assumptions in the proof of the Completeness Theorem, the e ect of which was to limit what we proved to the following theorem.

Theorem 9.1. Suppose that L a a countable language and ; a consistent set of L sentences. Then ; has a countable model.
We give some idea in this section of how these assumptions might be removed. We rst discuss the extension of Theorem 9.1 to countable consistent sets of formulas (rather than sentences). That is we show the following.

Theorem 9.2. Suppose that L is a countable language and that ; is a consistent set of L formulas. Then there is a structure A and an assignment s such that A j= ; s]. Proof. Choose a countable set D = fd d : : : g of constant symbols not occurring in L. Let ;0 be the result of replacing for every i, each free occur0 1

rence of vi in any formula of ; by di. Notice that ;0 is a set of sentences. We rst argue that ;0 is consistent. To see this, suppose for a contradiction that is such that ;0 ` and ;0 ` : . Now we can almost argue that ; is inconsistent in the following way. We might attempt to use the Lemma on Constants by replacing each occurrence of the constant symbol di in the proofs of and : from ;0, by vi . If we do this for each i, we might think that we now have a proof in L from ; of some formula ' and :'. However this is not quite right since this substitution might not preserve the proofs. The reason is that some of the occurrences of di might occur within the scope of a quanti er 8vi . However there is a way around this. For each constant symbol di occurring in the proofs of and : from ;0 , we rst remove the corresponding variable vi from occurring in the proof at all. We omit the details of how we do this, however it is plausible that this can be done by appealing to a generalization of Lemma 6.5 and the fact that we may assume that the proofs consist entirely of sentences. Then we make the indicated substitutions. Once we have shown that ;0 is consistent, we apply Theorem 9.1 to get an L0 structure A0 0such that A0 j= ;0. Of course we take for our L-structure, A, the structure A with the interpretations of the constant symbols di forgotten. For the assignment s, we let s(vi) = dA for all i. Since A0 j= ;0, it is easy to i see that A j= ; s] this essentially follows from Lemma 6.7.
0

104

CHAPTER IV. FIRST-ORDER LOGIC

We now discuss the extension of the completeness theorem to uncountable languages. Now in some sense, uncountable languages are unrealistic objects. Typical languages have the property that the set of symbols of the language is decidable but no uncountable set is decidable. However, there is at least one situation in which it might be considered natural (or at least useful) to allow an uncountable set of symbols. Suppose that we are attempting to write a set of axioms to describe an uncountable structure. For example, suppose that we are writing axioms to describe the properties of the real numbers. We might wish to introduce a constant symbol, c, for each element of the underlying structure so that we could have terms denoting each such element. In this case we would need uncountably many constant symbols. A careful examination of the proof of the Completeness Theorem reveals two crucial uses of the countability assumption. The rst occurs in the construction of a Henkin set containing ;, the second occurs in the proof of Lindenbaum's Lemma (extending the Henkin set to a complete set). In each case, we used the fact that the set of formulas of L0 is countable so that we could consider each one in turn in stages n, one for each integer. But if L is uncountable, the set of formulas of L is uncountable, so no construction in countably many stages will get the job done. What is needed is an extension to the uncountable case of the idea of a construction in stages. This requires more knowledge of set theory than we wish to assume or introduce at this point. Thus we will just sketch the basic ideas to (perhaps) render plausible the extension of the Completeness Theorem to this case. We need the following de nition.

De nition 9.3. A relation R is a well-ordering of a set A if R is a linear


order such that, in addition, every non-empty subset B of A has a least element in the ordering R.

Example 9.4.

1. The natural numbers are well-ordered by <. The fact that every non-empty set of natural numbers has a <-least element is equivalent to the Principle of Mathematical Induction. (See Exercise 1)

2. The set of integers are not well-ordered by < since the set itself does not have a least element. 3. The set SEQ(f0 1g) of nite sequences of zeros and ones is not wellordered by the lexicographic ordering. (See Exercise 1/.

9. EXTENSIONS TO THE COMPLETENESS THEOREM

105

The following axiom is a possible axiom for set theory it is equivalent to the Axiom of Choice and is accepted as a legitimate tool by most mathematicians. Axiom 9.5. Every set can be well-ordered. It is by no means obvious how an uncountable set such as the real numbers can be well-ordered. Now we can explain how a proof by (Trans nite) induction on an uncountable set goes. We illustrate by giving the idea of the proof of Lindenbaum's Lemma. Lemma 9.6 (Lindenbaum's Lemma). Suppose that ; is a consistent set of sentences in the (possibly uncountable) language L. Then there is a complete, consistent set containing ;. Proof. Let S be the set of sentences in the language L. Let R be a wellordering of S . We construct in stages so that at each stage we consider one of the sentences ' of S and add either ' or :' to . We shall begin the construction by setting = ;. Suppose that at a given stage we have constructed so that is consistent. Let A be the set of sentences which we have not considered so far. If A is empty, we are done. Else, choose the R-least sentence of A. Now either f'g or f:'g is consistent. In the former case, let = f'g, else let = f:'g. It is easy to see that we have preserved the consistency of . Do this for as many stages as necessary to consider all the sentences '. The resulting is consistent, since otherwise the inconsistency would have been introduced at some stage before the \end" of the construction. The \proof" of the extension of ; to a Henkin set is similar to that of Lindenbaum's Lemma. One important point should be noted we must introduce as many constant symbols as there are existential sentences in the language L. Thus, the cardinality of the set of constant symbols (and therefore the set of closed terms) of the extended language L0 is the same as that of L. Thus we have the following complete statement of the completeness theorem. Theorem 9.7. Suppose that ; is a consistent set of formulas in a rstorder language L. Then there is a structure A and an assignment s such that A j= ; s]. Furthermore, the cardinality of the structure is less than or equal to that of the language.

106

CHAPTER IV. FIRST-ORDER LOGIC

Exercises

1. Show that the set SEQ(f0 1g) of nite sequences of zeros and ones is not well-ordered by the lexicographic ordering. 2. Show that SEQ(f0 1g) can be well-ordered by constructing an ordering.

10. APPLICATIONS OF COMPLETENESS

107

10 Applications of Completeness
Most applications of the Completeness Theorem are actually applications of the Compactness Theorem (which was a corollary). We give several in this section. For the most part, these applications are limitation theorems they give limits on what can be expressed using rst-order languages. As a rst example, we show that the property of being nite is not rst-order. Theorem 10.1. Let L be a rst-order language. There is no set of sentences ; such that A j= ; if and only if A has nitely many elements. Proof. Suppose that ; is a set of sentences which has arbitrarily large nite models. We show that ; has an in nite model. To this end let C = fc0 c : : : g be a countable set of new constant symbols. Let L0 = L C . Let ; = ; fci 6= cj : i 6= j g. Now suppose that is a nite subset of ;0. Now only mentions nitely many of the constants from C (say n many). Thus any model of ; of size at least n can be made into a model of by assigning the values of these n constants appropriately. Since every nite subset of ;0 has a model, so does ;0. This model is a model of ; with in nitely many elements. What we have really proved is the following. Corollary 10.2. Suppose that ; is a set of sentences which has arbitrarily large nite models. Then ; has an in nite model. Corollary 10.3. Let LG be the language of group theory. There is no set of sentences ; such that G j= ; if and only if G is a nite group. Corollary 10.4. Let ' be a sentence in LG. Then if ' is true in groups of arbitrarily large order, ' is true in some in nite group. By the theorem, it is not possible to have a theory of nite structures. It is possible however to say things about the cardinality of a structure. Example 10.5. For every natural number n there is a sentence n such that A j= n only if A has exactly n elements. For example, is the sentence 9v 9v (v 6= v ^ 8v (v = v _ v = v )): It is also possible to write a set of sentences ; such that A j= ; implies that A is in nite. For there is a sentence n (in the language of equality alone) which \says" that a structure has at least n elements. (Modify n above.) Thus ; = f n : n 2 N g has only in nite models.
0 1 2 1 2 1 2 3 3 1 3 2

108

CHAPTER IV. FIRST-ORDER LOGIC

We consider more examples from group theory. Let LG = fe g and be the axioms for group theory. For x x : : : x where there are n occurrences of x, we write xn.

De nition 10.6. An element a of a group G has order n if an = e. An


element a has nite order if it has order n for some natural number n. A group G is a torsion group if every element of G has nite order. A group G is torsion-free if no element of G other than the identity has nite order.
is not rst-order.)

Theorem 10.7. 1. There is no set of sentences ; such that G j= ; if and only if G is a torsion group. (Informally, the theory of torsion groups
2. There is no nite set of sentences such that G j= if and only if G is torsion-free. (Informally, the theory of torsion-free groups is not nitely axiomatizable.) Proof. For (1), suppose that such a set of sentences ; exists. Expand the language LG by adding one new constant symbol, c. Expand the set ; of sentences by adding the sentences c 6= e, c c 6= e, c c c 6= e, : : : . Every nite subset of ; has a model since there are torsion groups with elements of arbitrarily large nite order. But then ; has a model G and G is a group with an element (cG ) which does not have nite order. For (2), suppose that exists. For every n, let 'n be the sentence 8v1 (v1 6= e ! v1n 6= e) 'n says that every element other than the identity has order greater than n. Let ; = f'n : n 2 N g. Obviously G j= ; if and only if G is a torsion-free group. Thus ; j= . But by completeness, ; ` ' for every ' 2 . Since is nite, there is a nite set ; such that ` ' for every ' 2 . Thus j= . But can have in it only nitely many of the sentences 'n. Thus there are models of 'n which have elements of nite order. But then there are models of which have elements of nite order. This contradicts the assumption on .

Suppose that a mathematician is studying a certain mathematical structure, say N . We might describe her job as that of characterizing N up to isomorphism. Can she do this? If she limits her assertions to rst-order sentences, the most that she can do is to characterize the theory of the structure she is interested in.

10. APPLICATIONS OF COMPLETENESS

109

De nition 10.8. Suppose that A and B are structures in a rst-order language L. A is elementarily equivalent to B if TH(A) = TH(B). That is A is elementarily equivalent to B if for all sentences ', A j= ' if and only if B j= '. We write A B if A is elementarily equivalent to B and A = B if A is isomorphic to B. A mathematician limited to rst-order sentences can only

characterize a structure up to elementary equivalence. Theorem 10.9. If A = B then A B. Proof. Suppose that A = B via the isomorphism F . One proves that A B by showing that for all formulas ' and assignments s, A j= ' s] if and only if B j= ' F s]. The induction is boring and therefore left to the reader. The last theorem is intuitively clear an isomorphism preserves all properties, not just those which can be expressed in a rst-order way. The converse is not true. We illustrate with the natural numbers. Recall that LN is the language of arithmetic TH(N ) is called true arithmetic. True arithmetic is what a number theorist wants to know. N is called the standard model of true arithmetic. Theorem 10.10. There are nonstandard models of true arithmetic. That is, there is a structure A such that A j= TH(N ) but such that A 6= N . Proof. We give two proofs. For the rst, choose an uncountable set C of new constant symbols and let L = LN C . Let ; = TH(N ) fc 6= d : c d 2 C g. Every nite subset of ; has a model for such a set can only mention nitely many of the new constant symbols in C . Thus N can be made into a model of by interpreting those constant symbols as nitely many distinct natural numbers. Therefore ; has a model A. A j= TH(N ), but A is not isomorphic to N since A is uncountable. In the second proof, we construct a nonstandard model of true arithmetic which is countable. We rst extend LN to a new language L by adding just one constant symbol c. We extend TH(N ) to a larger set ; of sentences by adding the axioms fc 6= 0 c 6= S 0 c 6= SS 0 : : : g. Again, it is easy to see that each nite subset of ; has a model therefore ; has a model, A. Furthermore, we can take A to be countable by the Lowenheim-Skolem Theorem. But A has an element, cA, which is not any of the standard natural numbers. It is easy to see that no such structure (when viewed as an LN structure) can be isomorphic to N .

110

CHAPTER IV. FIRST-ORDER LOGIC

The last theorem leaves open the question as to whether a mathematician might be able to characterize N up to elementary equivalence. How hard is it to determine which sentences ' are in TH(N )? As a nal example of applications of the compactness theorem, we prove an interesting theorem about the real numbers. Let LR be an apporpriate language for talking about the real numbers a good choice is LR = f0 1 + E <g. Let R denote the usual structure of the real numbers in this language. We show that TH(R) has nonstandard models.

Theorem 10.11. TH(R) has nonstandard models.


Proof. Again, we give two proofs. The rst is simple by the LowenheimSkolem Theorem, TH(R) has countable models. The second proof is more instructive for it illustrates an interesting algebraic di erence between the standard model of TH(R) and the model constructed. Add a single constant symbol to the language LR . To TH(R) add the sentences 0 < c, c < 1, c + c < 1, c + c + c < 1, : : : . The resulting set has a model since any nite subset of it clearly has a model. (A nite subset can only mention nitely many of the new axioms so R itself can be interpreted as a model of the set.) But a model A of this set has a positive element, a, such that no nite number of a's sum to a number greater than 1. This property must be preserved by an isomorphism but R has no such element.

Theorem 10.11 is the beginnings of a subject called nonstandard analysis. In nonstandard analysis, the limit de nitions of calculus are given alternate formulations in terms of \in nitesimals" in nitely small positive numbers such as that of the proof of Theorem 10.11.

Exercises
1. Show that there is no rst-order theory of well-orderings. That is show that there is no set of sentences ; in the language with one binary relation R such that A j= ; if and only if RA is a well-ordering of A. (Hint: rst show that RA is a well-ordering of A if it is a linear ordering for which there is no in nite descending chain. An in nite descending chain is a sequence of elements a , a , : : : such that : : : Ra Ra Ra .)
0 1 2 1 0

2. Suppose that L is a countable language and that ; is a set of L sentences that has an in nite model. Show that L has models of arbitrarily large

10. APPLICATIONS OF COMPLETENESS

111

cardinality. (Hint: the idea of the proof of Theorem 10.10 might be useful in this connection.) 3. Show that every in nite model A for a language L has an elementarily equivalent model B such that not every element of B is the interpretation of some constant symbol of L. (Hint: the other idea in the proof of Theorem 10.10 is useful here.) 4. Suppose that T T T : : : is a strictly increasing set of theories in a language L. Show that the union T = Tn is a consistent theory n and is not nitely axiomatizable. (Hint: the idea of the second part of the proof of Theorem 10.7 could be employed here.)
1 2 3

112

CHAPTER IV. FIRST-ORDER LOGIC

Chapter V Computability
1 Unlimited Register Machines
In Chapter I, Section 7, we considered the informal notion of computation. In this section, we attempt to de ne formally the e ectively computable functions by giving a precise model of computation. This model is based on a very simple sort of computing machine called an unlimited register machine.

De nition 1.1. An unlimited register machine (URM) consists of an an innite number of registers labelled R , R , : : : each of which at any moment of time contains a natural number and an instruction counter I which contains a natural number. (The contents of Rn is denoted rn.) The contents of the registers and the instruction counter may be altered by the URM in response to a program.
1 2

De nition 1.2. A program is a nite sequence I , : : : Ip of instructions. An


instruction of a URM is one of the following:
1

1. Constant Instructions. For each n 2 N and m 2 N there is an instruction C (n m). The response of the URM to C (n m) is to place the natural number n in register Rm and to increment the instruction counter by 1.
+

2. Addition Instructions. For each n 2 N , m 2 N and k 2 N , there is an instruction A(n m k). The response of the URM to A(m n k) is to add the contents of registers Rn and Rm , place the result in register Rk , and increment the instruction counter by 1.
+ + +

113

114

CHAPTER V. COMPUTABILITY
+ + +

3. Jump Instructions. For each n 2 N , m 2 N and k 2 N there is an instruction J (m n k). The response of the URM to J (m n k) is to compare the contents of Rn to Rm . If rn rm then k is placed in the instruction counter else the instruction counter is increment by 1. 4. Transfer Instructions. For each n 2 N and m 2 N there is an instruction T (n m). The response of the URM to T (n m) is to copy the contents of Rn to Rm and increment the instruction counter by 1. Rn is left unchanged by the instruction. The URM behaves as follows. Natural numbers are placed in each of the registers of the URM with all but nitely many of the registers initially containing the number 0. The natural number 1 is placed in the instruction counter. The machine is given a program I : : : In and executes the instruction corresponding to the number in the instruction counter. This continues until the number in the instruction counter is not the number of of an instruction in the program. This happens after the machine executes instruction In (and this instruction is not a jump instruction) or executes a jump instruction that instructs it to jump to an instruction that does not exist. De nition 1.3. An con guration of a URM is a sequence i, r , r , : : : of natural numbers. A con guration i, r , r , : : : represents the contents of the instruction counter and the registers at a given point in the computation. De nition 1.4. A program and an con guration (called the initial con guration) determine a computation. The computation may or may not halt. If the computation halts, it determines a nal con guration. Example 1.5. Consider the following program. I C (1 3) I C (0 4) I J (1 2 8) I A(2 3 2) I A(4 3 4) I J (1 2 8) I J (1 1 4) I T (4 1)
+ + 1 1 2 1 2 1 2 3 4 5 6 7 8

1. UNLIMITED REGISTER MACHINES


1 2 1

115

Suppose that an URM has an initial con guration r = 7 and r = 5. The computation that results determines a nal con guration with r = 2 (and certain other numbers in registers R , R , R ). In general, if the initial con guration is such that y = r < x = r , then the nal con guration has r = x ; y. On the other hand, if x y, then the nal con guration has r = 0.
2 3 4 2 1 1 1

Note that while a program is a nite object, a computation may be in nite the program might be instructed to execute instructions inde nitely. The simplest example of such behavior is the one instruction program J (1 1 1). This is the behavior programmers call an \in nite loop."

De nition 1.6. Suppose that P is a program and a , a , : : : a con guration.


1 2

1. P (a a : : : ) denotes the computation under P with initial con guration a , a , : : : .


1 2 1 2

2. P (a a : : : ) # denotes that the computation halts. (We say the computation converges.)
1 2

3. P (a a : : : ) " denotes that the computation does not halt. (We say the computation diverges.)
1 2

4. P (a : : : ak ) denotes the computation P (a a : : : ak 0 0 : : : ).


1 1 2

De nition 1.7. Let ' be a (possibly partial) function from N n to N .


1. We say that the computation P (a : : : an) converges to b (and write P (a : : : an) # b) if the computation converges and in the nal con guration, b is in R .
1 1 1

2. We say that P URM-computes ' if for every a , : : : , an, b it is the case that P (a : : : an) # b if and only if '(a : : : an) = b.
1 1 1

3. ' is URM-computable if there is a program P which URM-computes '.

De nition 1.8. If P is a program, denote by 'n the unique n-ary partial P


function which P URM-computes.

116

CHAPTER V. COMPUTABILITY

Since URM-computable functions may be total (de ned for all inputs) or partial, we use the following conventions. Roman letters (f , g, h, : : : ) will denote total functions while Greek letters (', , : : : ) will denote functions that are not necessarily total. Given a program P , it is not always obvious that the function that P computes is total. Of course if P does not have any jump instructions or if all jump instructions jump to a statement later in the program, P will eventually halt for all inputs. However if a jump instruction causes a jump to an instruction earlier in the program, that instruction might be the cause of non-termination for some inputs.

Exercises
1. Show that the following functions are URM-computable. (a) f (x y) = x + y. (b) f (x y) = jx ; yj. (Hint: Modify Exercise 1.5.) (c) f (x y) = xy. (d) f (x y) = x div y (the whole number part of the quotient x=y) (e) f (x y) = x mod y (the remainder of x=y) 2. Suppose that p(x) is a polynomial with natural number coe cients. Argue that p is URM-computable. 3. Argue that T instructions are not necessary. That is, show that the action of T instructions can be simulated using other instructions.

2. A PLETHORA OF URM-COMPUTABLE FUNCTIONS

117

2 A Plethora of URM-Computable Functions


In this section we show that many functions are URM-computable. Our goal is to give evidence that any function that is e ectively computable is, in fact, URM-computable. In this section and the next, our strategy is to give an inductive de nition of a large class of functions that are URM-computable. The base case is the following simple theorem. Theorem 2.1. The following basic functions are URM-computable. 1. the zero function: Z (x) = 0. 2. the successor function: S (x) = x + 1. i 3. the projection functions: Pn(x : : : xn) = xi . Proof. The instruction C (0 1) computes the function Z . The successor function is computed by the following two instruction program: C (1 2), A(1 2 1). i Finally, the projection function Pn is computed by the transfer instruction T (i 1). Suppose that f and g are total, URM-computable functions. Then it is reasonable to think that f g is URM-computable by a program that results from concatenating the programs for g and f . This almost works except for two problems. If the program for g is followed immediately by the program for f , the jump instructions are not quite right. First, the jump instructions for f are not numbered correctly since the rst instruction for the program for f is not the rst instruction of the new program. Also the program for g might end by jumping into the middle of the program for f rather than to its beginning. A second problem is that the program for g might leave garbage in registers that the program for f assumes initially contain zeros. These two problems are handled by the following lemma. Lemma 2.2. Suppose that ' is a function computed by the program P . Then there is a program P 0 that also computes ' such that 1. If J (m n k) is a jump instruction in P 0 and P 0 has p0 many instructions, then k p0 + 1. 2. The nal con guration of P 0 on any input for which P 0 halts has zeros in every register except possibly R .
1 1

118

CHAPTER V. COMPUTABILITY

Proof. Suppose that the program P has p many instructions. We may also assume that there is a number ` such that no instruction of P mentions any register Ri such that i > `. Then we modify P as follows. First, if J (n m k) is any jump instruction of P such that k > p, we change that instruction to J (n m p + 1). It is obvious that the program modi ed in this way computes the same function since the only e ect of such a jump instruction is to cause the computation to halt in either case. Second we add to the end of program P instructions C (0 2) C (0 3) : : :C (0 `). This has the e ect of \zeroing out" all registers that program P uses. The program that results from these two modi cations is P 0. It is now easy to see the following. Theorem 2.3 (Composition). Suppose that f and g are total, URM-computable functions. Then the function h de ned by h(x) = f (g (x)) is URM-computable. Proof. Suppose that P and P 0 are programs that compute f and g respectively. We may suppose that P and P 0 have the special properties of Lemma 2.2. Construct a program as follows. Let ` be the number of instructions in the program P 0. Replace each jump instruction J (n m k) of program P by the instruction J (n m k + `). Concatenate the instructions of P 0 with those of the modi ed program P . It is easy to see that the resulting program computes h. An URM program might compute a partial function in that the program need not halt for all inputs. The following notion is useful for talking about equality of partial functions. De nition 2.4. Suppose that ' and are (possibly partial) k-ary functions. We write '(x1 : : : xk ) ' (x1 : : : xk ) if whenever one of '(x1 : : : xk ) or (x1 : : : xk ) is de ned then so is the other and in this case they are equal. The next theorem is the natural generalization of Theorem 2.3 to partial functions of possibly more than one variable. Theorem 2.5 (Substitution). Suppose that functions : N k ! N and '1 : : : 'k : N n ! N are URM-computable. Then the function de ned by

(x : : : xn) ' (' (x : : : xn) : : : 'k (x : : : xn))


1 1 1 1

is URM-computable.

2. A PLETHORA OF URM-COMPUTABLE FUNCTIONS

119

Proof. Suppose that for each i k, Pi is a program that computes 'i and suppose P is a program computing . Then we need to modify the programs Pi so that they do not interfere with each other and so program Pi places its output in register Ri. We do this in the following way. Let r(i) be the maximum index of a register used by program Pi. We will reserve registers n + 1 n + 2 : : : n + r(1) for program P1. Our program for will rst copy registers 1 2 : : : n to registers n +1 n +2 : : : n + n. Then we will run program P1 suitably modi ed to use registers n + 1, n + 2, : : : n + r(1). The output of program P1 should now be in register n + 1. We then do the same with program P2 except that we use registers n + r(1) + 1, n + r(1) + 2, : : : n + r(1) + r(2). We do this for each of the programs Pi. Finally, we copy the results of programs P1, : : : Pk to registers R1 : : : Rk and run P .

We next show that if a function f is de ned by induction from URMcomputable functions, then f is URM-computable. The next theorem is a simple case of this.

Theorem 2.6. Suppose that h :

function f de ned by the following equations is URM-computable:

N2
0

! N is URM-computable. Then the

f (0) = n f (n + 1) = h(n f (n)):


Proof. The program for f works as follows. If the input (in Register R1 ) is 0, then the program puts n0 in register R1 and halts. Else if n is in register R1 , the program computes f (0), f (1), : : : f (n) in succession in the following way. Register R2 is used as a counter and is initially set to 1. Registers R3 and R4 are used as the input to h and are initially set to 0 and n0 respectively. The program for h is modi ed to use registers Ri for i 3. Upon completion of the execution of h, the output for h is in register R3 . If the counter in R2 is equal to the input in R1, this output is copied to R1 and the program halts. Otherwise, the output of h is placed in R4 , the counter value is placed in R3 and the counter in R2 is incremented. Then h is restarted.

The next theorem generalizes Theorem 2.6 and we will omit the proof.

Theorem 2.7 n(Primitive Recursion). Suppose that functions ' : N n ! N and : N ! N are URM-computable. Then there is an URM+2

120

CHAPTER V. COMPUTABILITY

computable function : N n+1 ! N satsifying the following recursion equations: (0 x1 : : : xn) ' '(x1 : : : xn) (y + 1 x1 : : : xn) ' (y x1 : : : xn (y x1 : : : xn))

The schemes of substitution and primitive recursion generate a large class of functions (starting from the basic functions). We have the following de nition. We use x to denote a nite sequence x : : : xn of number variables.
1

De nition 2.8. The primitive recursive functions are de ned by the following inductive de nition.
i 1. The zero function, successor function, and the projection functions (Pn for all n and i) are primitive recursive,

2. If f , g , : : : , gk are primitive recursive, so is the function h de ned by h(x) = f (g (x) : : : gk (x)).


1 1

3. If f and g are primitive recursive, so is the function h de ned by primitive recursion from f and g:

h(0 x) = f (x) h(y + 1 x) = g(y x h(y x))

Theorem 2.9. Every primitive recursive function is total and URM-computable.


Proof. The proof is by induction on the de nition of primitive recursive functions and uses Theorems 2.1, 2.5 and 2.7. The primitive recursive functions form a large class of URM-computable functions.

Example 2.10. The following functions are URM-computable.


1. xy f (x y) = xy is de ned by the following primitive recursion.

f (0 y) = 0 f (n + 1 y) = f (n y) + y

2. A PLETHORA OF URM-COMPUTABLE FUNCTIONS


2. xy _ _ 3. x;1 (x;y is de ned to be x ; y if x > y and 0 otherwise) _ f (x) = x;1 is de ned by the following primitive recursion.

121

f (0) = 0 f (n + 1) = n
_ 4. x;y

8 < 5. sg(x) = :0 1 8 < 6. sg(x) = :1 0


7. jx ; yj 8. x! 9. min(x y) 10. max(x y)

if x = 0 otherwise if x = 0 otherwise

11. rm(x y) (remainder if x is divided by y convention: rm(y 0) = y for all y) 12. qt(x y) (whole-number quotient if x is divided by y convention: qt(y 0) = 0.) This was an exercise in the last section but the following is a primitive recursive de nition of qt. qt(0 y) = 0 qt(n + 1 y) = qt(n y) + sg(rm(x y))

8 < 13. div(x y) = :1 if x divides y 0 otherwise

122

CHAPTER V. COMPUTABILITY

Important examples of primitive recursion are recorded in the following two theorems.

Theorem 2.11. Suppose that f :


URM-computable.
1

!n N is a total URM-computable function. Then the following functions g : N ! N and h : N n ! N are


N n+1
+1 +1

g(y x : : : xn ) = Pz<y f (z x : : : xn) h(y x : : : xn) = Qz<y f (z x : : : xn)


1 1 1 +1 +1

Theorem 2.12 (Bounded Minimalization). Suppose that f : N n ! N is a total URM-computable function. De ne g : N n ! N by


1 1

8 < g(x : : : xn y) = :the least z < y such that f (x : : : xn z) = 0 if such a z exists y otherwise
Then g is URM-computable. (The function g is written z < y (f (x1 : : : xn z ) = 0) is called the least number operator).)

Example 2.13. The following functions are computable.


8 < 2. Pr(x) = :1 if x is prime 0 otherwise A number x is prime if x has exactly two divisors. So Pr(x) = sg(jD(x);
2j). 3. pn = the n prime number. (convention: p = 0) The inductive step in this de nition is the following.
th 0

1. D(x), the number of divisors of x. (Convention: D(0) = 1.) D(x) = Py x div(y x)

8 < 4. (x)y = :the exponent of py in x if x y > 0 0 if x = 0 or y = 0

_ pn = z < pn! (sg(z;pn))(sg(Pr(z))]


+1

2. A PLETHORA OF URM-COMPUTABLE FUNCTIONS

123

In section I.7, we de ned a decidable language L as one for which there is an algorithm that correctly answers questions of the form x 2 L. In order to model decidable sets and relations, we have the following formal de nition. De nition 2.14. A relation R N n is URM-computable if the characteristic function cR of R de ned by of R

8 < cR(x : : : xn) = :1 if (x : : : xn) 2 R 0 otherwise


1 1

is URM-computable. In other words, we have identi ed the output of 1 with the answer \yes" and an output of 0 with the answer \no." Many of the usual relations we consider in number theory are URM-computable. For example, by Example 2.10, the relation x j y (x divides y) is URM-computable.

Exercises
1. Show that every constant function is URM-computable. 2. Suppose that f (x y) is URM-computable and c is a natural number. Show that h de ned by h(x) = f (x c) is URM-computable. 3. Show that the functions de ned in example 2.10 parts (2), (5), (9), and (11) are URM-computable by showing that they are primitive recursive. 4. Show that the function de ned in example 2.13 part (4) is URMcomputable. 5. Prove Theorem 2.11. 6. De ne f by f (0 y) = y + 1 f (x + 1 0) = f (x 1) f (x + 1 y + 1) = f (x f (x + 1 y)) (a) Compute f (2 2). (b) Prove that for all x y, there is a unique number z such that f (x y ) = z .

124

CHAPTER V. COMPUTABILITY

It can be shown that this function, de ned by \double recursion", is not primitive recursive. 7. Suppose that R and S are URM-computable relations (i.e., R and S are subsets of N .) Show that R S , R \ S and R are URM-computable relations. 8. Suppose that R is an URM-computable set and f and g are URMcomputable functions. Show that the functions h de ned by

8 < h(x) = :f (x) if x 2 R g(x) if x 62 R

is URM-computable. 9. Show that the function f (x) de ned by the Fibonacci sequence is URMcomputable. (f (0) = 1 f (1) = 1 f (2) = 2 etc.). Hint. First show that the function g(x) = 2f x 3f x is URM-computable by showing that it is primitive recursive. Or, argue directly by showing how to construct a program that computes f .
( ) ( +1)

3. MINIMALIZATION AND THE RECURSIVE FUNCTIONS

125

3 Minimalization and the recursive functions


The collection of primitive recursive functions as de ned in the preceding section is a large class of total, URM-computable functions. In this section we introduce one more scheme for generating URM-computable functions. In the preceding section we introduced the least-number operator and showed that bounded searches can be performed within an URM computation. In the next de nition, we extend the use of the least-number operator to unbounded searches and partial functions. De nition 3.1. Let ' : N n ! N . Then the function (x) = y('(x y) = 0) is de ned as follows.
+1

the basic ideas of computation that of an unbounded search. This is often implemented in real computer languages by a WHILE or REPEAT construct. Theorem 3.2 (Minimalization). Suppose that ' is URM-computable. Then so is (x) = y('(x y) = 0). Proof. The program for behaves as follows. Let P be the program for '. Suppose that the program for ' uses registers Ri for i `. The program for rst copies the the input x into registers Rj for j > `. It also reserves such a register for a counter which it initializes to 0. Then x and 0 are placed in registers R : : : Rn and program P is executed. If P halts, the contents of register R is compared to 0. If equal, the value of the counter is copied to register R and the program halts. Else the counter is incremented, the inputs x and the value of the counter are copied to registers R : : : Rn and the process is repeated. De nition 3.3. The recursive functions are de ned by the following inductive de nition.
1 +1 1 1 1 +1

8 >the least y such that > > '(x z) is de ned for all z y if y exists < y('(x y) = 0) = > > and '(x y) = 0 :unde ned otherwise Notice that the function y('(x y) = 0) is not necessarily total. If ' is not total, it might be the case that y('(x y) = 0) is partial. Even if ' is total, y('(x y) = 0) will be partial if there is a x such that '(x y) 6= 0 for all y. One way to think of minimalization is that it incorporates one of

126

CHAPTER V. COMPUTABILITY

i 1. The zero function, successor function, and the projection functions (Pn for all n and i) are recursive, 2. If , ' , : : : , 'k are recursive, so is the function de ned by (x) ' (' (x) : : : 'k (x)). 3. If ' and are recursive, so is the function de ned by primitive recursion from ' and :
1 1

(0 x) ' (x) (y + 1 x) ' '(y x (y x)) 4. If ' is recursive, then so is y('(x : : : xn y) = 0). Theorem 3.4. Every recursive function is URM-computable. Proof. This follows by induction using Theorem 3.2 and the theorems of the last section. Theorem 3.4 gives a large, inductively de ned class of functions that are URM-computable. Thus, if we show that a function is recursive, we need not construct a program for an URM to conclude that it is URM-computable. Left open by Theorem 3.4 is the question of whether every URM-computable function is recursive.
1

Exercises
1. Suppose that f is total, injective, and URM-computable. Then f ; is URM-computable (but not necessarily total).
1

4 Church's Thesis
Church's Thesis is the thesis that we have correctly modelled the notion of computability by Unlimited Register Machines. Precisely,

4. CHURCH'S THESIS

127

Axiom 4.1 (Church's Thesis). A function is e ectively computable if and


only if it is URM-computable.

Church's Thesis cannot be proved it equates an informal notion, that of e ective computation, with a formal one, that of URM computation. Indeed we have called it an Axiom. But while it therefore does not need a proof, it does demand some justi cation. There are really two assertions to justify corresponding to the two directions of the biimplications. To establish the plausibility of Church's Thesis, one must rst argue that every URM-computable function is e ectively computable. Most people will accept this assertion immediately. Computations by URMs have all the characteristics of computations that we listed in Section I.7. A computation is performed deterministically, in discrete steps, on nite, discrete input, and according to nitely many controlling instructions. The existence of in nitely many registers does not compromise the nitary nature of the de nition since only nitely many of the registers are used by any particular program or computation. The second direction of Church's Thesis, that all computable functions are URM-computable, is more problematic. The evidence for accepting this assertion is of two sorts. First is the evidence which comes from the many di erent attempts to de ne computable. Turing, Godel, Church, Herbrand, Markov, and Post among others each identi ed a class of functions which they considered to be the e ectively computable functions. The class of recursive functions that we de ned in section 3 is an example of such a class. The important fact however is that all of these de nitions have resulted in the same class of functions being designated as computable. For example, we saw that every URM-computable function is recursive. In section 6 we will sketch a proof that every recursive function is URM-computable. The fact that all these classes of computable functions coincide is strong evidence that we have captured the notion of computability. Another sort of evidence comes from the practice of mathematicians. Functions that mathematicians consider computable have been shown to be URM-computable in every instance that someone has worried about it.

128

CHAPTER V. COMPUTABILITY

We will accept Church's Thesis and use it in the following way. Suppose that we wish to show that a function is computable. We will give an algorithm for computing it (say in English or Pascal) and then appeal to Church's Thesis to assert its computability. In each case that we do this, we are con dent that an unlimited register machine could be constructed to compute the function, but we do not construct it. We give an example of a proof by Church's Thesis to make the issue clearer. Theorem 4.2. The function p such that p(0) = 2, p(1) = 3, p(2) = 5, and in general p(n) = the n + 1-st prime is URM-computable. Proof. There are many algorithms for computing p we describe one straightforward one. We describe how to compute p(n) supposing that we have computed p(0) : : : p(n ; 1). For each natural number m > p(n ; 1) until p(n) is de ned do the following. Divide m by each of the numbers p(0) : : : p(n ; 1). If all of these quotients have nonzero remainder, then m is prime and so de ne p(n) = m. That this procedure works follows from the prime factorization theorem for the natural numbers. This procedure describes a computation and so therefore, by Church's Thesis, we are entitled to say that p is URMcomputable. It is of course not easy to construct the URM-program that computes the function p of the last theorem but it can be done. In light of Church's Thesis, we will henceforth refer to the URM-computable functions as simply the computable functions. Similarly, we will call a set or relation computable if the characteristic function of the set is URMcomputable. Thus, URM-computability substitutes for and is identi ed with the informal notion of decidability. Recall that a set A is called e ectively enumerable if there is an algorithm for listing or enumerating the elements of A. We use Church's thesis to give a formal substitute for this notion. De nition 4.3. A set A is computably enumerable if A is the domain of a computable (URM-computable) function. It might seem that the notion of e ective enumerability would be better identi ed with ranges of computable functions. However, the notions are equivalent. Theorem 4.4. A set A is the domain of some computable function if and only if A is the range of some computable function '.

4. CHURCH'S THESIS

129

Proof. The proof is by Church's Thesis. Suppose that A is the domain of . The function ' works as follows. On input x, ' computes precisely as does . If and when halts, ' outputs x (rather than the output of ). It is evident that the range of ' is the A. Suppose on the other hand that A is the range of '. The program for works as follows. On input x, we simulate ' on inputs 0 1 2 3 : : : until we nd y such that '(y) = x. If this occurs, the program for ' halts (with arbitrary output). Note that we must be careful in the simulation of '. For example, we must not simulate '(0) and wait until '(0) has an output since the program for ' might compute inde nitely on input 0. In this case, we would never get to the simulation of '(1). Instead we do the following. We compute '(0) for one step. Then we compute '(1) for one step. Then '(0), '(1) and '(2) are computed for two steps. This process continues so that if one of the computations '(i) halts, that fact will be discovered. In the light of the last Theorem, we have the following version of Church's Thesis.

Axiom 4.5 (Church's Thesis for E ective Enumerability). A set A is


e ectively enumerable if and only if it is computably enumerable.

Exercises
1. Prove the following facts about c.e. sets. (a) Every nite set is c.e. (b) Every co nite set is c.e. (c) Every computable set is c.e. (d) If U and V are r.e., so is U V . (e) If U and V are r.e, so is U \ V .

130

5 Godel-numberings

CHAPTER V. COMPUTABILITY

In Section I.7, we introduced the informal notion of computability. We claimed that the inputs to computations need to be nite objects. However in developing a model of computation, the Unlimited Register Machine, we have further limited inputs of computations to be natural numbers. (A natural number can be thought of as a nite object in any number of ways computer scientists like to think of a natural number as a nite sequence of 0's and 1's using the binary numeration system.) In this section we will show that this limitation is not restrictive. The key notion is that of Godelnumbering. To Godel-number a set A is to assign to each element of A a natural number. Usually the assignment is e ective in the sense that there is an algorithm to perform the assignment. That is the content of the next de nition.

De nition 5.1. Suppose that A is a nite or countable set. A Godelnumbering of A is an e ectively computable one-to-one function f : A ! N
such that the range R of f is decidable and the inverse function of f is e ectively computable. If a 2 A, we call f (a) the Godel-number of a. Often, but not always, we arrange that f is onto N . We only require however that we can tell a Godel-number when we see one. Notice that a Godel-numbering of a set A is an explicit proof that A is countable. We give a simple but quite common example of Godel-numbering in the next example.

Example 5.2. Suppose that X is a nite set X = fx : : : xng. Let A =


1 th
k k

SEQ(X ). We construct a Godel-numbering f of A as follows. Suppose that a = xi1 xi2 xi . Let pi denote the i prime number. De ne f ( ) = 0 and de ne f (a) = 2i1 3i2 : : : pik It is clear that f is e ectively computable and 1-1 (the latter by the Fundamental Theorem of Arithmetic). It is also easy to see how to compute the inverse of f . The function f is of course not onto N no natural number m such that the prime factorization of m contains pn for some i is a Godeli number, for example. In fact, 1 is not a Godel-number on this numbering. Notice that this general method of numbering SEQ(X ) can be used in case X is nite or countable.
+1

5. GODEL-NUMBERINGS

131

Having Godel-numbered a set A, we can think of A as a set of possible inputs to an URM by identifying an element of A with its Godel-number. In the rest of this section, we Godel-number, among other objects, the set of all URM-programs. This allows us to think of programs as inputs to programs. This apparant circularity should not be unfamiliar. Indeed, a compiler of a programming language is a program that accepts programs as input. Having numbered programs, we will be able to ask, for example, whether certain sets of programs are URM-decidable (via their numbers). In the next two theorems we give speci c Godel-numberings of N N and SEQ(N ). Theorem 5.3. The function (x y) = 2x(2y +1) ; 1 is an URM-computable bijection from N N to N . Furthermore, there are URM-computable functions and such that ; (x) = ( (x) (x)). Proof. It is obvious that is URM-computable. To see that is a bijection notice rst that n = 2x(2y + 1) is the product of a power of 2 and and odd number. By the uniqueness of the prime factorization of n, the power of 2 and the odd number are uniquely determined. The is one-to-one. Next, note that every positive natural number can be written as a product of a power of 2 and an odd number thus is onto. To see that is URMcomputable, note that to compute (z) we need only compute (x y) for pairs x y z until we nd a pair such that (x y) = z. It is clear that an URM program can be written to do this since is URM-computable. Corollary 5.4. The function (x y z) = ( (x y) z) is an URM-computable bijection from N N N to N . Theorem 5.5. The function de ned by
1 2 1 1 2 1 1

(x : : : xk ) = 2x1 + 2x1
1

+ 2 +1

+ 2x1

+ 2+

+ k+

x k;1 ; 1

is a computable bijection from N k to N . (We denote by hx1 : : : xk i, the k>0 number (x1 : : : xk ).) Proof. It is easy to see that is URM-computable. To see that is a bijection, think of natural numbers written in binary notation. It is easy to see that represents a sequence x1 : : : xk naturally in this notation. De nition 5.6. We assign to each instruction I a number (I ) as follows.

132 1. (C (n m)) = 4 (n m ; 1)

CHAPTER V. COMPUTABILITY

2. (A(n m k)) = 4 (m ; 1 n ; 1 k ; 1) + 1 3. (T (n m)) = 4 (m ; 1 n ; 1) + 2 4. (J (m n k)) = 4 (m ; 1 n ; 1 k ; 1) + 3

Theorem 5.7. The function de ned in De nition 5.6 is a bijection from


the set of all instructions to N .
1 2

De nition 5.8. We assign to each program P , a number (P ) as follows. Suppose that P = I I : : : Ik . Then (P ) = h (I ) : : : (Ik )i. Theorem 5.9. The function of De nition 5.8 is a bijection from the set
1

of all programs to N .

De nition 5.10. For natural numbers e and n 1:


1. 'n is the n-ary function computed by the program P such that (P ) = e e. 2. Wen is the domain of the n-ary function computed by the program P such that (P ) = e. We will write 'e for 'e and We for We . Thus ' ' : : : is an e ective listing of all computable functions of one variable and W W : : : is a computable listing of all c.e. sets of natural numbers.
1 1 0 1 0 1

Theorem 5.11. For every computable function ', there is a number e (called
an index for ') such that ' = 'e. (In fact, each computable function has in nitely many indices.)

Exercises
1. Compute (a) (J (3 4 2)) (b) ; (503) (c) (T (3 4) A(1 2 3)) C (0 1))
1

5. GODEL-NUMBERINGS
1

133

2. 3. 4. 5.

(d) ; (100). What function is ' ? What set is W ? Show that each computable function has in nitely many di erent indices. What function is ' ? Show that the following functions are computable. (a) FIRST FIRST(e) is the number of the rst instruction of the program with number e. (b) R R(j ) is the number of the register whose value is (possibly) changed by the instruction with number j . (All instructions except jump instructions change (at most one) register in case of a jump instruction, R should return the value 0.) (c) LENGTH LENGTH(e) is the number of instructions in the program with number e.
0 0 5395

134

6 The Universal Machine

CHAPTER V. COMPUTABILITY

Having numbered all URM programs, we can now think of such programs as possible inputs to other URM programs. In this section we prove the following fundamental theorem.

Theorem 6.1 (The Universal Machine). There is an URM-computable function ' of two variables such that for all e x, '(e x) ' 'e(x).
The universal machine ' receives two inputs, e and x. The rst input e to ' is (a Godel number of) a program P . The action of the universal machine is to simulate that program P on input x. Thus the universal machine can simulate any URM-program. There certainly are programs in real programming languages that have this function. Such a program is usually called an interpreter of a computer language. An interpreter of a language such as BASIC accepts as input a program in that language and some data and simulates that program on that data. Early versions of the computer language BASIC were implemented via interpreters. We will outline three di erent proofs of the Universal Machine Theorem. The rst proof is a proof using Church's Thesis.
Proof. (Proof using Church's Thesis.) We describe an algorithm that computes the function '. The rst phase of the algorithm is to decode the rst argument e. Given e, we can write down the sequence of instructions that form the program with Godel number e. (A simple example of this decoding appeared in the exercises of the last section.) Next, the action of the program is simulated as it would act on input argument x, the second argument to '. Again, it is clear that we can do this e ectively we need only keep track of the changes in the contents of the nitely many registers that the program modi es and the current step of the program.

For so important a theorem, the reader might be uncomfortable settling for a proof by Church's Thesis. A second, and more direct proof, would be to construct explicitly the universal URM program that implements '. While this appears di cult to do, in fact it can be done rather straightforwardly and the program that results has fewer than 100 instructions. (This strikes some people as paradoxical a program with fewer than 100 instructions can accurately simulate the action of countably many di erent programs, even some that are thousands of instructions in length. Of course the trick is that

6. THE UNIVERSAL MACHINE

135

the thousands of instructions come to the machine as data rather than as program. The interchangeability of data and program was one of the key ideas in the early development of the computer and is generally attributed to Von Neumann.) We will not construct the universal machine explicitly however. The remainder of this section is devoted to a third proof of this theorem. Instead of showing directly that the universal function is URM-computable, we will show that it is recursive. Since all recursive functions are URMcomputable, the result follows. In order to show that the function ' is recursive, we need to do some further Godel-numbering. We have already encoded programs we next describe a way to encode computations. We rst encode the possible con gurations of the machine. De nition 6.2. Let i, r , r , r , : : : denote the contents of the instruction counter and the registers of the URM. Then the state of the URM is the number 2i Qi pr . (Since at any stage of a computation all but nitely i many of the registers are zero, this de nition makes sense.) We will use the convention that i = 0 in a state means that the computation has stopped. With this convention, note that every natural number corresponds to a unique state with the exception of 0. Given a program with one input x, the initial state of the computation is s = 2 3x. It will be useful to think of the computation of a Turing machine as proceeding in stages. In each stage t = 1 2 : : : , exactly one instruction is executed unless the computation has halted. The instruction executed at stage t causes the machine to enter state st . The sequence of states s s : : : encodes the complete computation. Note that this sequence will be in nite if the computation does not halt. The following de nition allows us to describe all possible computations in one numerical function. De nition 6.3. De ne T : N ! N by T (e x t) = s if s is the state that results from executing the program with number e for exactly t stages. We use the convention that T (e x 0) = 2 3x for every e and x so that T (e x 0) denotes the initial state of the machine with program e and input x. Furthermore, we make the convention that if t is the last stage such that the program executes (because the instruction executed at stage t is a jump instruction that jumps to a nonexistent instruction or because the instruction is the last instruction of the program) then T (e x u) = T (e x t) for all u t and T (e x t) is a state with step number 0.
1 2 3 1 +1
i

136

CHAPTER V. COMPUTABILITY

The fundamental lemma is the following.

Lemma 6.4. The function T de ned in De nition 6.3 is a total recursive


function.

To see that the lemma su ces to prove the Theorem, suppose that T is recursive. Now '(e x) = (T (e x t(T (e x t) = 0)) . To see that this de nition is correct, note that T (e x t) is the exponent of 2 in the state that results from executing program e on input x for t steps. That exponent is the instruction counter of the program and is 0 if and only if the program has halted. Thus t(T (e x t) = 0) is the stage of the computation when it rst halts. Call this stage t0 then T (e x t0) is the state of the computation at that stage. Call this state s. Now y = (s) is the contents of Register R in the state s and this number y is the result of the computation 'e(x). It remains to prove the Lemma.
1 2 1 1 2 1

Proof. (of Lemma 6.4) The fact that T is total is clear from the de nition of T and the way that URMs behave. To see that T is recursive note that the de nition given above essentially has the form of a primitive recursion. In particular, we have the following claim.

Claim 6.1. De ne a function n by n(e s) = s0 if s0 is the state that results

from executing one step of program e from state s. Then n (so-named because it is the \next state" function) is recursive. Again, we will use the convention that n(e s) = s if the state s indicates that the computation is stopped. To ensure that n is total we will also de ne n(e s) = s if s is a state that program e could never encounter (because the instruction counter is greater than the number of instructions in e).

To see that the claim su ces to prove the Lemma, note that T is now de ned as follows:

T (e x 0) = 2 3x T (e x t + 1) = n(e T (e x t)):
1

This is precisely the form of a primitive recursive de nition. To prove the Lemma, we de ne several functions.

6. THE UNIVERSAL MACHINE


th

137

i(e j ) = the number of the j instruction of program e j (e s) = the step number of the instruction of program e to be executed in state s r(i s) = the state that results from s by execution of instruction number i Claim 6.2. The functions i j r are each recursive. It is clear Claim 6.1 follows from Claim 6.2 since n(e s) = r(i(e j (e s)) s). The Lemma and Theorem thus follow from a proof of Claim 6.2. The proof of Claim 6.2 is completed in the exercises.

Corollary 6.5. Every URM-computable function is recursive.


Proof. The universal function ' de ned in the Theorem is recursive by the third proof outlined above. Now suppose that an arbitrary URM-computable function 'e is given. We have that 'e(x) = '(e x) and the right-hand side is clearly a recursive function (of x) by substitution (and the fact that the constant functions are recursive). Thus 'e is recursive.

Exercises
1. Show that the function d de ned by d(x i) = i digit in the binary representation of x is a recursive function. (Hint: use the functions x div y and x mod y.) 2. Show that the function i of Claim 6.2 is recursive. 3. Show that the function j of Claim 6.2 is recursive. 4. Show that the function t de ned by t(m n s) = the state that results if transfer instruction T (m n) is executed on a machine that is in state s is recursive. 5. Show that the function r of Claim 6.2 is recursive by rst extending the result of the previous problem to each sort of instruction.
th

138

7 Undecidability

CHAPTER V. COMPUTABILITY

It is easy to see that there are functions and sets that are not computable. For there are only countably many computable functions but uncountably many functions. In this section, we show that there are natural noncomputable sets.

De nition 7.1. De ne the following sets K = fe j e 2 Weg TOT = fe j 'e is totalg EMP = fe j We = g INF = fe j We is in niteg HALT = fz j (z) 2 W y g Theorem 7.2. K is not computable.
1

2( )

Proof. Suppose that K is computable, that is suppose that the characteristic function of K , K is computable. The following function is computable (as you will show in the exercises)

8 < if x = 0 (x) = :1 unde ned otherwise

Now consider the composition, K . This function is computable and so has an index it is 'e for some e. Consider whether e 2 'e. If e 2 'e then e 2 K by the de nition of K so that k (e) = 1 and therefore 'e(e) = ( K (e)) is unde ned so in fact e 62 We so e 62 K by the de nition of K . On the other hand, if e 62 K then K (e) = 0 so that 'e(e) = 1 and e 2 We or e 2 K . This contradiction (that neither e 2 K nor e 62 K ) implies that K is not computable.

Corollary 7.3. There is a set that is computably enumerable but not computable. Proof. To see that K is computably enumerable, let ' be the universal machine and de ne (x) = '(x x). It is evident that is computable and that the domain of is K .

7. UNDECIDABILITY

139

The following Theorem gives an important example of the power of using programs as input to programs. In this theorem, programs are used as input to a program that produces other programs in response. Theorem 7.4 (s-1-1 Theorem). Suppose that ' is a binary computable function. Then there is a total unary computable function f such that 'f e (x) = '(e x) for all e x. Proof. We describe the algorithm for f . On input e, f must produce the number f (e) of a program. Let P be the program for '. The behavior of f is to write down a program P 0 which on one input x writes down the two inputs e and x and simply runs P . Explicitly, program P 0 is simply the program for the function (x) = '(e x) which is easily seen to be computable (using the Substitution Theorem and the fact that all constant functions are computable). Now having written down P 0, the program for f needs to return the number of P 0. Given the program P , this number is easy to compute via Church's Thesis. Corollary 7.5. EMP, INF, and TOT are not computable. Proof. De ne a computable function g by the following equation. 'g e (x) = 'e(e) That g is a total computable function is clear by the s-1-1 Theorem. Notice that if e 2 K then 'g e is a total function but if e 62 K then 'g e has an empty domain. Now EMP is not computable for otherwise K would be computable. For to decide whether e 2 K , we rst compute g(e) and then compute the answer to g(e) 2 EMP and answer accordingly. The identical argument shows that INF and TOT are not computable.
( ) ( ) ( ) ( )

Exercises

1. Show that the function de ned in the proof of Theorem 7.2 is computable by writing an URM program to compute it. 2. Show that HALT is not computable. (Hint: Use the strategy of the proof that EMP is not computable.) 3. Show that EMP is c.e. (Hint: use Church's Thesis to give a procedure to enumerate this set.)

140

8 Naturally Occuring Undecidable Problems


The undecidable (i.e., noncomputable) sets that we have so far discovered (such as K ) are related to problems that arise within the study of computation itself. In this section and in the next chapter we discuss the existence of undecidable sets that arise naturally in mathematics. The most important example is the undecidability theorem of Tarski which we will prove in the next Chapter. Here we give some examples without proof from areas of mathematics other than logic. One of the most interesting connections between computation and number theory is given in the following theorem. De nition 8.1. A set A of natural numbers is Diophantine if there is a polynomial p with integer coe cients and n + 1 variables such that A = fx j 9y 9y : : : 9ynp(x y : : : yn) = 0g: Theorem 8.2 (Matijasevic). A is computably enumerable i A is Diophantine. One direction of Matijasevic's Theorem is quite simple. Supppose that A is Diophantine and p is the polynomial that witnesses that fact. We enumerate A as follows. List n + 1-tuples x y is some e ective ordering (say by the usual coding of n + 1-tuples). Compute p(x y) for each. If p(x y) = 0 for some tuple, enumerate x in A. The other direction of the Theorem was the culmination of 40 years of work in logic and number theory, the last piece of which was supplied by Matijasevic in 1970. A very beautiful alternate characterization of the Diophantine sets of positive natural numbers is the following theorem due to Hilary Putnam. Theorem 8.3 (Putnam). A set of positive natural numbers is Diophantine i there is a polynomial p with integer coe cients and n variables such that A = fp(x) j x 2 N n and p(x) 2 N g. Since the set of prime numbers is computably enumerable, it is Diophantine and so by Putnam's Theorem there is a polynomial p such that the positive range of p is the exactly the set of prime numbers! It is known that p can be chosen with fewer than 15 variables. At the turn of the century, David Hilbert proposed a list of problems to guide mathematical research in the twentieth century. Many of these problems have resulted in much interesting mathematics. Hilbert's tenth problem
1 2 1 +

CHAPTER V. COMPUTABILITY

8. NATURALLY OCCURING UNDECIDABLE PROBLEMS

141

was to give a method (an algorithm) for solving the general Diophantine equation. The work of Matijasevic leads quite directly to the following corollary. Corollary 8.4. There is an undecidable Diophantine set. A second famous undecidable problem comes from group theory. Recall that a group is a structure with one binary operation that satis es associativity, has an identity, and for which each element has inverses. Small groups can be presented by giving the complete \multiplication" table of the operation. For larger groups however, alternative means of description are needed. One important means of describing a group is called a group presentation. De nition 8.5. A group presentation with generators X and relations R is a pair of sets (X R) which de ne a group G = (G ; ) as follows. 1. X is a nonempty set of symbols 2. De ne X ; to be the set of symbols of the form x; such that x 2 X . 3. R is a set of pairs (u v) of elements of SEQ(X X ; ). The elements of R are are called relations. 4. Given a word w in SEQ(X X ; ), an elementary transformation of w consists of one of the following: (a) the insertion into or deletion from w of a subword of form xx; or x; x (b) if (u v) 2 R and u is a subword of w, the substitution of v for u in w. 5. De ne an equivalence relation =R on SEQ(X X ; ) by u =R v if there is a nite sequence of elementary transformations which transform u to v. 6. The universe of G is the set of equivalence classes in SEQ(X X ; ) under =R . The identity is the equivalence class of the empty word. The group operation is concatenation of representatives. Example 8.6. Let X = fa bg (so that G has two generators) and let R = f(ab ba)g. This has the e ect of producing an abelian group since any two symbols can be shown to commute. The group G is called the free abelian group on two generators.
1 1 1 1 1 1 1 1 1

142

CHAPTER V. COMPUTABILITY

Given two words in a group given by a presentation, it is not always obvious whether the two words are equivalent (denote the same group element) or not. De nition 8.7. Given a presentation (X R) of a group, the word problem for this presentation is the problem of determining for pairs of words u v, whether u = v in the group. Theorem 8.8 (Boone-Novikov). There is a nitely presented group with undecidable word problem.

Chapter VI Incompleteness
1 Is Number Theory Easy?
The task of the number theorist is to determine the truth of sentences in the language of arithmetic. For example, a major accomplishment of the last few years was the solution to Fermat's Last Problem by Wiles who showed that there are no nontrivial solutions to the equation xx + yn = zn for n > 2. This result is obviously a rst order sentence in the language of arithmetic. If this is the task of a number theorist, it is reasonable to ask how di cult the task might be. Speci cally, we have the following question.

Question 1.1. Is TH(N ) a decidable set?


That is, is there an algorithm which, on input an arbitrary sentence ' in the language LN , outputs \True" or \False" according as to whether N j= ' or not? We will see in this chapter that the answer to Question 1.1 is no. The way to truth in mathematics is through proof. Proofs represent a \mechanical" procedure for nding truth. So a second question, related to the rst, is whether we can nd a \good" set of axioms for TH(N ). The obvious candidate for such a good set is a decidable one.

Question 1.2. Is there a decidable set A of axioms for TH(N )?


The answers to the two questions are, of course, related. We will suppose that for the remainder of this section that the rst-order languages we discuss are Godel-numbered. (Later in this section we will give an explicit Godel-numbering of the formulas of the language of number theory.) We will 143

144

CHAPTER VI. INCOMPLETENESS

also substitute the formal notion of computability for the informal notion of decidability. De nition 1.3. A theory T is computably axiomatizable if there is a set A of axioms for T such that the set of Godel-numbers of sentences in A is computable. We have the following theorem concerning computably axiomatizable theories. Theorem 1.4. Suppose that T is a computably axiomatizable theory. Then T is computably enumerable. Furthermore, if T is complete, T is computable. Proof. Suppose that T is computably axiomatizable by axioms A. Consider the relation R(P ') which holds if P is a proof from axioms A of sentence '. We claim that this relation is computable (via Godel-numbers). For to see whether P constitutes a proof of ' we need to test each line of P to see whether it is an axiom (this is easy to do), an element of A (which we can do because A is a computable set) or a result of modus ponens from previous lines. The relation is therefore computable (by Church's thesis). Now to enumerate T we simply enumerate pairs P ' where P is a proof and ' is a sentence and compute whether P is a proof of '. If so we enumerate ' in T . Suppose that, in addition, T is complete. If T is not consistent then obviously T is computable since all sentences are in T . Suppose then that T is consistent. Then to determine if ' 2 T , we enumerate all proofs P and determine if P is a proof of ' or :'. Since T is complete, we will eventually nd such a P . We then answer the question ' 2 T accordingly.
putable language. Then T is computable if and only if T has a computable set of axioms. Proof. If T is computable, T itself may serve as a computable set of axioms. (Note that in this case the theorems of T all have exceedingly short proofs!) Suppose on the other hand that T has a computable set of axioms A. Then by the Theorem, T is computable since it is complete. So arithmetic has a decidable set of axioms only if it's decidable. We will show that neither is the case. This result is one form of Godel's celebrated Incompleteness Theorem.

Corollary 1.5. Suppose that T is a complete, consistent theory in a com-

1. IS NUMBER THEORY EASY?

145

Theorem 1.6 (Godel, Incompleteness Theorem). Suppose that A is a computable set of sentences in the language LN of number theory such that A TH(N ). Then there is a sentence ' such that ' 2 TH(N ) but A 6` '.

That is there is a true sentence about arithmetic which is not provable from the axioms A. The idea of Godel's proof of his Theorem is this. Godel constructs ' in the language of arithmetic so that ' essentially expresses the proposition \' is not provable from A." Recall that sentences ' are about numbers but can \talk about" sentences through the process of Godel-numbering. Suppose that ' is true (i.e., ' 2 TH(N )). Then ' will be is true but unprovable formula (it is unprovable because it is true). On the other hand, if ' is false, ' is provable from A and so we have a false sentence proved from A. But the assumption is that A TH(N ) so that A proves only true sentences. Thus ' is true. In the remainder of this section we carry out the details of Godel-numbering the language of arithmetic. Recall that this language is L = f0 S + E g. We rst number the terms of L. De nition 1.7. To every term, t, of the language of arithmetic we assign a number called the Godel number of t and denoted by dte by induction as follows. 1. d0e = 1. 2. dvi e = 3i+1.

3. If t is a term,d(St)e = 2 3dte . 4. If t and s are terms, (a) d(s + t)e = 2 3dse5dte . (b) d(s t)e = 2 3dse 5dte . (c) d(sEt)e = 2 3dse5dte . We now assign Godel-numbers to formulas. De nition 1.8. To every formula ' of the language of arithmetic we de ne the Godel number of ', d'e as follows. 1. If t and s are terms then d(s = t)e = 2 3dse5dte .
2 3 4 5

146

CHAPTER VI. INCOMPLETENESS


6 7

2. If t and s are terms then d(s < t)e = 2 3dse5dte . 3. If ' is a formula, then d(:')e = 2 3d'e . 4. If ' and are formulas, then d(' ! )e = 2 3d'e 5d e .
8

5. If ' is a formula and vi a variable, then d8vi 'e = 2 i3d'e .


9+

Finally we assign Godel-numbers to sequences of formulas, thereby assigning a number to each proof (as well as sequences that are not proofs).

De nition 1.9. If ' , ' , 'n is a nite sequence of formulas, then the Godel number of the sequence, d(' ' : : : 'n)e is 2d' e 3d' e pd' e . (Here pn den
1 2

notes the n-th prime number.)

Note that for ease of coding, we have not bothered to make our Godelnumberings onto N as we did for the numberings of URM-programs. It is clear by Church's Thesis that the set of Godel-numbers of terms (formulas, sequences of formulas) is computable. Recall that we use the notation n to denote the term SS S (0) where the successor function symbol occurs n times. Suppose that ' is a formula with m free variables. Then we will use '(n : : : nm ) to denote the result of replacing all free occurrences of the m variables respectively by ni. (It will be clear from context which variable each of the terms ni replaces.) We are now ready to say how arithmetic can \talk" about itself.
1

order theory in the language of arithmetic. Suppose that ' is a formula with one free variable. We say that ' numerates A in T if for every n, n 2 A if and only if T ` '(n). We say that ' binumerates A in T if ' numerates A in T and also n 62 A if and only if T ` :'(n).

De nition 1.10. Suppose that A is a set of natural numbers and T a rst-

Example 1.11. Let E be the set of even natural numbers. Then the formula 9v (2 v = v ) binumerates E in TH(N ).
2 2 1

By the mechanism of numeration, the theory of arithmetic, for example, can talk about sets of sentences. In this way, the theory of arithmetic can talk about itself.

Exercises

1. IS NUMBER THEORY EASY?

147

1. Find the Godel-number of (a) 3 (b) 2 + 1 (c) 8v (v + 0 = v ) 2. (a) Find the term with least Godel-number. (b) Find the formula with least Godel-number. (c) Given any set, T , of sentences of L, nd the proof from T with least Godel number (as a sequence of formulas). 3. Show that the following sets are binumerated in TH(N ). (a) The set of prime numbers. (b) The set of numbers that are powers of primes. (c) The set of Godel-numbers of variables. 4. Use Church's Thesis to argue that the following (partial) functions are computable. (a) The function f such that f (d'e) = d:'e for all formulas '. (b) The function g such that g(d'e) = 1 if the variable v appears free in ' and 0 otherwise. (c) The function h such that h(d8v 'e) = d'(v =0)e for all '.
1 1 1 1 1 1

148

2 Godel's Incompleteness Theorem

CHAPTER VI. INCOMPLETENESS

Our goal in the remaining sections of this chapter is to establish Godel's Incompleteness Theorem and several related results. In this section we state the key technical results needed and use them to establish one version of Godel's Theorem. The key notion is binumerability in theories of arithmetic. We repeat the de nition of binumerate and numerate here, extending it from sets to relations. De nition 2.1. Suppose that R is an n-ary relation on the natural numbers and T a rst-order theory in the language of arithmetic. Suppose that ' is a formula with n free variables. We say that ' numerates R in T if for every n-tuple m : : : mn, (m : : : mn ) 2 R if and only if T ` '(m : : : mn). We say that ' binumerates R in T if ' numerates R in T and also (m : : : mn) 62 R if and only if T ` :'(m : : : mn). Example 2.2. Consider the equality relation R = f(n m) j n = mg. Since ` n = n, R is numerated in any theory T TH(N ) by the formula v = v However it is not the case that if n 6= m, ` n 6= m so it is not necessarily the case that T binumerates R. An example of a theory that binumerates R is the theory Q of Section IV.5. We think of a set as being a unary relation so this de nition of numeration extends that of the last section. Obviously, computably axiomatizable theories are the only interesting ones from the point of view of proving things. The purpose of proof is to give a mechanical substitute for truth. But it defeats the purpose if we cannot, in a mechanistic way, determine what an axiom is. The following lemma connects the notions of computability and numeration. Lemma 2.3. Suppose that T is a computably axiomatizable theory. Then 1. if R is numerated in T then R is computably enumerable 2. if R is binumerated in T , then R is computable. Proof. Suppose that T is a computably axiomatizable theory and that R is a relation numerated in T by a formula '. For simplicity, assume that R is binary so that we have
1 1 1 1 1 1 2

(n m) 2 R if and only if T ` '(n m):

2. GODEL'S INCOMPLETENESS THEOREM

149

Thus to enumerate R we simply enumerate T and each time a sentence of form '(n m) appears in T , we enumerate the pair (n m) in R. The second part of the Lemma follows similarly. The proof of the above Lemma is really just justi cation of the idea that a proof is a sort of a computation. The next lemma, the proof of which we will defer until the next section, provides a partial converse to the preceding lemma and is the crucial tool in establishing Godel's Theorem.

Lemma 2.4. Let Q be the set of axioms of Section IV.5. Suppose that T is any theory such that Q T TH(N ). Then
1. every computably enumerable relation is numerated in T 2. every computable relation is binumerated in T .

We now show that a large class of theories of arithmetic are not computable.

Theorem 2.5. Suppose that T is a theory such that Q T TH(N ). Then


T is not computable.
Proof. By Lemma 2.4, every computably enumerable relation is numerated in T . Let K be the computably enumerable noncomputable set of section V.7 K is therefore numerated in T . Let ' be the formula that numerates K . T is not computable since otherwise K is computable via the fact that n 2 K if and only if '(n) 2 T .

We now can derive three important Theorems from Theorem 2.5. The rst of these follows immediately and gives a negative answer to Question 1.1.

Corollary 2.6. TH(N ) is not computable.


Recall that there is an e ective procedure for determining whether a formula pf propositional logic is valid | the method of truth tables. Church's Theorem says that no such method is available for rst-order logic.

Theorem 2.7 (Church). Let = f' : j= 'g. That is is the set of valid
sentences (in the language of arithmetic). Then is not computable.

150

CHAPTER VI. INCOMPLETENESS

Proof. Note that, by the Completeness Theorem, a formula ' is valid just in case it is provable from the logical axioms alone i.e.,, ` '. Recall that Q is a nite set of axioms let T be the theory generated by these axioms. That is, T = f' : Q ` 'g. Then T satis es the hypotheses of Theorem 2.5 and so is not recursive. Let 1 : : : 11 be the sentences in Q. Now ' 2 T if and only if f 1 : : : 11g ` '. But this is true if and only if ` ( 1 ^ ^ 11 ) ! '. This in turn is true if and only if ( 1 ^ ^ 11 ) ! ' 2 . Thus, a computable procedure for determining membership in would yield a computable procedure for determining membership in T . Thus no such procedure exists.

We should remark that Church's Theorem as we have stated it depends on the fact that we are working in the language of arithmetic. However Church's Theorem is true for any rst-order language that contains at least one binary relation symbol or one function symbol. We now can state Godel's First Incompleteness Theorem in something like the original form giving a negative answer to Question 1.2.

Theorem 2.8 (First Incompleteness Theorem). Suppose that T is a computably axiomatizable theory such that T TH(N ). Then T is incomplete. Proof. By Corollary 2.6, TH(N ) is not computable. Thus, since TH(N ) is complete, Corollary 1.4 guarantees that TH(N ) is not computably axiomatizable. Thus T = TH(N ). Let ' be a sentence in TH(N ) ; T . Then T 6` '. 6 But also, T 6` :' since otherwise :' 2 TH(N ). Thus ' witnesses that T is
not complete. This was not Godel's original proof. We have used the computably enumerable, noncomputable set K to establish this result. Godel proved this Theorem by directly exhibiting the sentence ' which witnesses the incompleteness of T as we described in section 1. Thus it was a corollary to Godel's Theorem that there were computably enumerable, noncomputable sets (and naturally arising ones at that).

Exercises
1. Suppose that R is a relation such that T numerates R. Suppose that T is complete and consistent. Show that T binumerates R.

2. GODEL'S INCOMPLETENESS THEOREM

151

2. Suppose that T is an inconsistent theory. Characterize the relations R such that R is numerated in T . Characterize the relations R such that R is binumerated in T .

152

3 Q and Numerability

CHAPTER VI. INCOMPLETENESS

In this section and the next we prove that every computable relation is binumerated in Q and every computably enumerable relation is numerated in Q. This is the content of Lemma 2.4 which was used heavily in the proof of Godel's Theorem. We repeat the axioms of Q. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11.

8v (S (v ) 6= 0) 8v 8v (S (v ) = S (v ) ! v = v ) 8v 8v (v < S (v ) ! (v < v _ v = v )) 8v (v < 0) 6 8v 8v (v < v _ v = v _ v < v ) 8v (v + 0 = v ) 8v 8v (v + S (v ) = S (v + v )) 8v (v 0 = 0) 8v 8v (v S (v ) = v v + v ) 8v (v E 0 = S (0)) 8v 8v (v ES (v ) = v Ev v )


1 1 1 1 1 1 1 1 1 1 1 1 2 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 2 1 1 1 2 1 2 1 2 1 2 1 2 1 2 1 1 2 1 2 1 2 1

The strategy we will use to show that a relation R is binumerated in Q is as follows. First, we will construct a formula ' that binumerates R in TH(N ). It will usually be easy to see that ' binumerates R in TH(N ) since we will use the \natural" choice for '. Second, we will argue that ' binumerates R in Q. We usually prove this using an argument based on the completeness theorem. We illustrate with the following lemma. Lemma 3.1. The formula v < v binumerates the less-than relation in Q. Proof. Obviously v < v binumerates the less-than relation in TH(N ). To show that it actually binumerates this relation in Q, we must show that if m < n, then Q ` m < n and if m 6< n then Q ` :(m < n). We could prove this by constructing proofs from Q much as we did in Section IV.5. In fact
1 2 1 2

3. Q AND NUMERABILITY

153

this follows almost directly from Theorem 5.5 of that section. However, by the Completeness Theorem, to show that Q ` ' for a sentence ' we need only prove that Q j= '. Suppose that m < n and that A is a model of Q. By Axiom 5 for Q, we have that A j= (m < n) _ (n < m) _ (n = m). But we may rule out the case that A j= n = m by m applications of Axiom 2 and one of Axiom 1. We rule out A j= n < m by numerous applications of Axioms 3,2 and 1. Thus A j= m < n and since A was an arbitrary model of Q, Q ` m < n. If m 6< n, we can apply a similar argument to show that Q ` :(m < n). Using this stragegy, it is clear that Q binumerates such relations as the ternary relation R(n m p) which says that n + m = p using the natural formulas. In order to use the above strategy for showing binumerability in Q, we need to have a clearer picture of what models of Q actually look like. Suppose that A j= Q. Using Axioms 1{4 of Q, we can see that in A, the terms 0 1 2 : : : denote di erent objects which are ordered in the standard way. We will call the collection of these objects the standard part of A. Furthermore, if a 2 A is not in the standard part, then b <A a for any b in the standard part. Axioms 6{11 guarantee that the standard part of A satis es the same multiplication, addition, and exponentiation facts as does N . Thus we can think of N as a substructure of A in a natural way. In the next several lemmas, we will inductively de ne a class of relations that are binumerated in Q. The remarks in the preceding paragraph constitute the base case of the de nition they amount to the following lemma. Lemma 3.2. Suppose that ' is an atomic sentence. Let R be the relation that ' binumerates in TH(N ). Then ' binumerates R in Q. The next lemma allows us to extend the result of the preceding lemma to all quanti er-free sentences. Lemma 3.3. Suppose that ' and binumerate relations R and S respectively in Q. Then ' ^ , ' _ , ' ! , and :' binumerate the relations R and S , R or S , if R then S , and not R respectively. The following corollary follows immediately from the two lemmas. Corollary 3.4. Suppose that ' binumerates the relation R in TH(N ) and ' is quanti er-free. Then ' binumerates the relation R in Q.

154

CHAPTER VI. INCOMPLETENESS

The result of this corollary cannot be extended to all sentences. Recall that there are sentences that are true in N but not provable in Q. Since Q TH(N ), this implies that Q is not complete. By the corollary, Q is complete for quanti er-free sentences. It is the addition of quanti ers that cause problems. For example, consider the formula '(v ) = 8v (v v = v v ). Obviously, ' binumerates the set N in TH(N ) since multiplication is commutative. However neither Q ` '(0) nor Q ` :'(0) so ' does not binumerate any relation in Q. If we restrict the notion of quanti ers to that of bounded quanti ers however, we can extend the result of the corollary. De nition 3.5. Suppose that R is a m + 1-ary relation on N . The m-ary relation S = (8i < n )R(n n : : : nm i) on N is de ned by (n n : : : nm ) 2 S if and only if for all i < n , (n n : : : nm i) 2 S: Similarly, the relation S = (9i < n )R(n n : : : nm i) on N is de ned by (n n : : : nm) 2 S if and only if there is i < n such that (n n : : : nm i) 2 S: To correspond to the notion of bounded quanti ers in relations, we introduce the following notation for formulas. De nition 3.6. Suppose that ' is a formula. The expression (8x < y)' abbreviates the formula 8x(x < y ! '). The expression (9x < y)' abbreviates the formula 9x(x < y ^ '). Lemma 3.7. Suppose that ' binumerates an m + 1-ary relation R in Q. Then (9x < v )'(v v : : : vm x) binumerates (9i < n )R(n n : : : nm i) in Q. Similarly, (8x < v )'(v v : : : vm x) binumerates (8i < n )R(n n : : : nm i) in Q. Proof. For simplicity, let m = 1 and suppose that ' binumerates the binary relation R in Q. De ne the unary relation S by S (j ) = (9i < j )R(j i). We show that (9x < v )'(v x) binumerates S . First suppose that j 2 S . Then there is an i < j such that R(j i). Then Q ` '(j i). But Q ` i < j . Thus Q ` i j ^ '(j i) so that Q ` 9x(x < j ^ '(j x)). On the other hand, suppose that j 62 S . Then for all i < j , Q ` :'(j i). But Q ` (x < j ) ! (x = 0 _ v = 1 _ _ v = j ; 1). Thus Q ` (x < j ) ! (:('(j x)). Therefore Q ` :9x(x < j ! '(j x)). A similar argument holds for the bounded universal quanti er.
1 2 1 2 2 1 1 1 2 1 2 1 1 2 1 1 2 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 2

3. Q AND NUMERABILITY

155

We will sometimes also use bounded quanti ers such as 8i j (where the equality is not strict) and 8i < t (where the bound on the equality is a term rather than a variable) which are de ned in the obvious way. The above lemma holds for such quanti ers as well. Example 3.8. We show that the set of primes is binumerated in Q. Note that a formula de ning the set of primes in TH(N ), is (1 < v ) ^ (8v
1 2

v )((v
1

1) _ :(9v < v )v v = v ):
3 2 2 3 1

Since this relation is built from quanti er-free formulas and bounded quanti ers, it binumerates the set of primes in Q. We summarize the results above in a de nition and a lemma. De nition 3.9. The -formulas are de ned by the following inductive definition. 1. Atomic formulas are -formulas. 2. If ' and are -formulas, then so are :', ' _ , ' ^ , and ' ! . 3. If ' is a -formula, so is (8x < t)', (9x < t)'. Corollary 3.10. Suppose that ' binumerates the relation R in TH(N ) and ' is a -formula. Then ' binumerates the relation R in Q. In what follows, it will sometimes be convenient speak of functions f de ned on N rather than relations. We will say that ' binumerates f just in case it binumerates the graph of f as a relation. We gave such an example above when we considered the addition function as a ternary relation. It is not the case that every computable relation is binumerated by a -formula. (Were it so, we would be done!) However the class of relations binumerated by -formulas is quite rich. Some simple examples can be found in the exercises. In the next lemma, we consider the relations we need for coding inductively de ned functions and relations. Lemma 3.11. The following relations are binumerated in Q. 1. r and s are adjacent prime numbers 2. k is the nth prime
0 0 0 0 0 0 0

156

CHAPTER VI. INCOMPLETENESS

3. i is the exponent of the nth prime in the prime factorization of j 4. n is the greatest integer such that the nth prime divides j . Proof. For each part, it su ces to write a 0 -formula that binumerates the relation in TH(N ). We leave (1), (3), and (4) as exercises. Part (2) is di cult since the relation is an inductively de ned one. The trick is to code the sequence of the rst n primes by a single number (and one that is not too large so that it can be found from n in a bounded way). Claim 3.1. For a xed k and n 1, k is the nth prime if and only if there is a number c < (kn)n such that 1. k is prime 2. 2 does not divide c 3. for any pair of adjacent primes r < b and s b, we have that for all j c, rj divides c if and only if rj+1 divides c 4. kn;1 divides c but kn does not. Proof. (of Claim) Suppose rst that k is the nth prime. Then

c = 2 3 5 : : : kn;
0 1 2 0 1 1

satis es the four conditions above. On the other hand, if c does satisfy the conditions above, then c = 2 3 : : : kn; m for some integer m which has no prime factors smaller than k. Since the exponent of k is n ; 1, k must be the nth prime (by induction). To see that the claim su ces to prove the lemma, note that the de nition of the claim can be written as a -formula '. Therefore ' binumerates the relation in TH(N ).
0

We will write pn for the nth prime, (j )n for the exponent of pn in the prime factorization of j . We will also write l(j ) for the largest n such that pn divides j . We now show how simple inductive de nitions can be binumerated in Q.

3. Q AND NUMERABILITY

157

f a unary function de ned by f (0) = c f (n + 1) = g(n f (n)) Suppose that (the graph of) g is binumerated by a -formula in TH(N ). Then f is binumerated by a -formula in TH(N ) (and so binumerated in Q). Proof. The hypothesis implies that the relation R de ned by (x y z ) 2 R if and only if z = g(x y) is binumerated in Q. De ne a function f^ by f^(n) = 2f 3f : : : pf n for all n. We show that the graph of f^ is binumerated in n Q. To see this notice that f^(n) = w if and only if l(w) = n + 1, (w) = c, and for all i n, (w)i = g(i (w)i). From this it is clear that the graph of f^ is binumerated in Q. Now the graph of f is binumerated since f (n) = m if m = (f^(n))n . The addition of quanti ers that are not bounded takes us out of the domain of binumerated relations. The reason for this is as follows. Suppose that Q ` :'(n) for every n. Then of course N j= 8x:'(x). However it is not necessarily the case that Q ` 8x:'(x). For example it is possible that Q has a nonstandard model A such that for some (nonstandard) a 2 A, A j= ' a]. However we have the following positive result. Lemma 3.13. Suppose that ' is a -formula and let be the formula 9x'. Let R be the relation on N that binumerates in TH(N ). Then numerates R in Q. Proof. For simplicity suppose that ' has two free variables x and y . Let S be the binary relation that ' binumerates in TH(N ). Then since ' is a -formula, ' binumerates S in Q. To show that binumerates R in Q we must show that n 2 R if and only if Q ` 9x'(x n). Suppose that n 2 R. Then there is m such that TH(N ) ` '(m n). Thus (m n) 2 S so that Q ` '(m n). Thus Q ` 9x'(x n). Suppose then that Q ` 9x'(x n). Then TH(N ) ` 9x'(x n) since Q TH(N ). Thus there is m such that TH(N ) j= '(m n). Thus n 2 R. In light of the previous lemma, we have the following de nition. De nition 3.14. A formula is a -formula if it is of form 9x' such that ' is a -formula.
0 0 (0) (1) ( ) +1 0 +1 +1 0 0 1 0

Lemma 3.12. Suppose that g is a binary function, c a natural number, and

158

CHAPTER VI. INCOMPLETENESS


1

In other words, Lemma 3.13 says that a numerates the same relation in Q as it does in TH(N ). To establish that a relation is numerated in Q then it is enough to write a -formula that binumerates it in TH(N ). The form of a -formula is quite restrictive we allow only one unbounded quanti er, it must be an existential quanti er, and it must bind the rest of the formula. The following lemma allows us to relax these restrictions somewhat.
1 1

Lemma 3.15. Suppose that ' and


'_ '^

are 1 formulas. Then each of the following formulas binumerates the same relation in TH(N ) as a 1 formula.

(8x < t)' (9x < t)' 9x'

Proof. We will do some representative parts. Suppose that ' = 9w'0 and = 9v 0 where '0 and 0 are 0 -formulas. We may suppose by changing variables if necessary that no variable occurs in both ' and (we are only interested in these formulas up to logical equivalence). Then ' _ is equivalent in TH(N ) to (9w)'0 _ 00 where 00 is 0(v=w). The formula (9x < t)9w'0 is equivalent to 9w(9x < t)'0 which is a 1 formula. The formula 9x9w'0 is equivalent to 9z(9x < z)(9w < z)'0. Note carefully that the negation of a 1 -formula is not necessarily a 1 formula.

Exercises
1. Show that the following relations are binumerated in Q by writing down a -formula that de nes them. _ (a) x;y = z. (b) rm(x y) = z. (c) qt(x y) = z. (d) x is a power of 2. 2. Prove (1), (3), and (4) of Lemma 3.11. 3. It is not the case that all computable functions are binumerated in Q. However (a) Show that every constant function is binumerated in Q
0

3. Q AND NUMERABILITY

159

(b) The successor function is binumerated in Q i (c) The projection functions Pn are binumerated in Q (d) If f and g are unary functions that are binumerated in Q, then h de ned by h(x) = f (g(x)) is numerated in Q.

160

4 Computability and Binumerability


1

CHAPTER VI. INCOMPLETENESS

The relations that are de nable in the standard model of arithmetic using -formulas are numerable in Q. Using this fact we can now prove Lemma 2.4 every computable (computably enumerable) relation is binumerated (numerated) in Q. The fundamental result is the following.

Theorem 4.1. Suppose that R is a computably enumerable relation. Then R is binumerated in TH(N ) by a -formula. Hence, R is numerated in Q.
1

We rst show that the Theorem is enough to prove the other half of our result.

Corollary 4.2. Suppose that R is a computable relation. Then R is binumerated in Q. Proof. We will assume that R is a unary relation for ease of notation. Since R is computable, both R and R, the complement of R, are computably enumerable. Thus by the Theorem, R is numerated in Q by a 1 -formula = 9y'. Similarly R is numerated in Q by a 1-formula 0 = 9y'0. Here ' and '0 are 0 -formulas (say in the variables x y) that binumerate in Q the binary relations that they binumerate in TH(N ). De ne a formula (x) = 9z'(x z) ^ :(9y < z)'0(x y). We claim that binumerates R in Q. Suppose rst that n 2 R. Then

Q ` '(n m) for some m

(4.1)

since Q numerates R. Also TH(N ) ` :9y'0(n y) since 0 binumerates R in TH(N ). Thus TH(N ) ` :'0(n m) for all m < n. Thus

Q ` '0(n m)for all m < n


0

(4.2)

since '0 is . But from (4.1) and (4.2) is evident that Q ` (n). Now suppose that n 62 R that is that n 2 R. Then TH(N ) ` '0(n m) for some m and TH(N ) ` :'(n m) for all m n. From these two facts and the fact that ' and '0 are -formulas, we have that Q ` : (n).
0

4. COMPUTABILITY AND BINUMERABILITY

161

Proof. (of Theorem 4.1) Suppose that R is a computably enumerable relation. We will suppose that R is a unary relation (i.e., a set) for simplicity. Therefore there is an e such that R is the domain of 'e. Let P be the program with number e R is the set of inputs on which P halts. Let program P have instructions I1 , : : : , In. Recall the notion of state from the proof of the universal machine theorem. The state of the machine is a number 2i Qi 1 pr+1 i where i is the value of the instruction counter and ri is the contents of register Ri at any point in the computation. Claim 4.1. The function n de ned by n(s) = t if program P changes the state of the machine from s to t in one step is binumerated in TH(N ) by a 0 -formula.
i

Claim 4.2. The binary function T de ned by T (x t) = s if program P on input x enters state s in exactly t steps is binumerated in TH(N ) by a
formula.
0

Proof. Consider one instruction, say Ii , of program P . Suppose, for example, that this instruction is C (n m). Then Ii changes the state from s to t if the exponent of 2 in s is i, the exponent of 2 in t is i + 1, the exponent of pm+1 in t is n, and for all k 6= m 1, the exponent of pk+1 in t is the same as that in s. It is evident from our results on the binumerability of functions involving the prime power decomposition of a number, that the relation Ii changes the state from s to t is binumerated by a 0-formula, say 'i. Thus it is easy to see that the function n of the claim is so binumerated (by the forumula '1 _ _ 'n).

Proof. T is de ned by a simple recursion from the function n of the last claim. Therefore T is binumerated in Q by a 0 -formula by Lemma 3.12.

The theorem follows from the two claims since x 2 R if and only if there there is t and s such that (x s t) 2 T and s is the number of a halting computation i.e., (s) = 0. This represents R as a -formula and so shows that R is numerated in Q.
1 1

Exercises
1. We have actually not proved Lemma 2.4 completely.

162

CHAPTER VI. INCOMPLETENESS

(a) We proved (Corollary 4.2) that every computable relation is binumerated in Q. Suppose that Q T and T is consistent. Show that every computable relation is binumerated in T . (b) We proved (Theorem 4.1) that every computably enumerable relation is numerated in Q. Suppose that Q T TH(N ). Show that every computably enumerable relation is numerated in T . 2. A theory T is called sound if T TH(N ). Show that every sound theory is noncomputable.

5. DIAGONALIZATION AND GODEL'S THEOREM

163

5 Diagonalization and Godel's Theorem


In this section, we sketch a proof of Godel's Theorem which is close to that of Godel himself. The proof is essentially a diagonalization argument much like Cantor's proof of the uncountability of the reals and like our de nition of K . After showing that all computable relations are binumerated in any su ciently strong, sound theory of arithmetic, Godel proved the following Lemma. Lemma 5.1 (Diagonalization Lemma). Suppose that T is a theory in the language of arithmetic such that Q T TH(N ). Suppose that ' is a formula with free variable v . Then there is a sentence such that T ` $ '(d e). Proof. De ne a function d in the following way. If n is not the Godel number of a formula with one free variable, let d(n) = 0. Otherwise, let be the formula with Godel number n and de ne d(n) = d (n)e. Then d is a computable function (by Church's Thesis) and so its graph is computable. Let (v v ) binumerate the graph of d in T . Now de ne a formula by
1 1 2

= 9v ('(v ) ^ (v v ) ^ 8v < v (: (v v )))


2 2 1 2 3 2 1 3

We rst claim that for every n, (5.1) T ` (n) $ '(d(n)) To see this, let A j= T and suppose that A j= (n). Then A j= 9v ('(v )^ (n v ) ^ 8v < v (: (n v )). Thus, since T ` (n d(n)), it must be the case that A j= '(d(n)). On the other hand, if A j= '(d(n)), it is clear that A j= (n). Now de ne = (d e). (Informally, says that is true about .) Notice that d(d e) = d (d e)e = d e: Thus, the Lemma follows from (5.1) with n = d e. We now prove Tarski's Theorem and Godel's Theorem. Theorem 5.2 (Tarski). TH(N ) is not binumerable in TH(N ). Proof. Suppose that ' binumerates TH(N ) in TH(N ). Then 2 TH(N ) if and only if '(d e) 2 TH(N ). Let be such that TH(N ) ` $ :'(d e): Such a sentence exists by the Diagonalization Lemma applied to :'. Then
2 2 2 3 2 3

164

CHAPTER VI. INCOMPLETENESS

it is easy to derive a contradiction. For the property of implies that 2 TH(N ) if and only if :'(d e) 2 TH(N ) and this contradicts the fact that ' binumerates TH(N ). Theorem 5.3 (Godel). Suppose that T is a recursively axiomatizable theory such that Q T TH(N ). Then there is a sentence such that 2 TH(N ) ; T . Proof. De ne the relation DEDT by (n m) 2 DEDT if and only if m is the Godel number of a proof from T of the sentence with Godel number n. Since this is a computable relation, there is a formula that binumerates DEDT in TH(N ). Let ' be the formula 9v (v v ). Informally, ' says that there is a proof of the formula with Godel number v . We claim that for every sentence ,
2 1 2 1

T ` if and only if T ` '(d e)

(5.2)

That is, we claim that ' numerates T . To see this suppose that is a sentence with Godel number n and suppose that T ` . Then there is an m such that m is the Godel number of a deduction from T of . Thus T ` (n m) so that T ` '(n). Suppose on the other hand that T ` '(n). Then since T TH(N ), N j= '(n). Thus N j= (n m) for some m. T ` since binumerates DEDT in TH(N ). Now let be the diagonalization of :'. That is T ` $ :'(d e): We claim that 2 TH(N ) ; T . We rst argue that 62 T . For suppose otherwise. Then by 5.2, T ` '(d e). On the other hand, by the de nition of and the diagonalization lemma, T ` :'(d e). This contradiction shows that 62 T . But T ` $ :9v (d e v ). But :9v (d e v ) must be in TH(N ) since it asserts that T 6` . Thus 2 TH(N ) since even in T it is equivalent to a sentence in TH(N ).
2 2 2 2

Exercises

Appendix A Writing Proofs


Proof serves many purposes simultaneously. In being exposed to the scrutiny and judgment of a new audience, the proof is subject to a constant process of criticism and revalidation. Errors, ambiguities, and misunderstandings are cleared up by constant exposure. Proof is respectability. Proof is the seal of authority. Proof, in its best instances, increases understanding by revealing the heart of the matter. Proof suggests new mathematics. The novice who studies proofs gets closer to the creation of new mathematics. Proof is mathematical power, the electric voltage of the subject which vitalizes the static assertions of the theorems. Finally, proof is ritual, and a celebration of the power of pure reason. Such an exercise in reassurance may be necessary in view of all the messes that clear thinking clearly gets us into.

Philip J. Davis and Reuben Hersh

165

166

1 Proofs in Mathematics

APPENDIX A. WRITING PROOFS

I have made such wonderful discoveries that I am myself lost in astonishment out of nothing I have created a new and another world.
John Bolyai

Mathematicians prove their assertions. This distinguishes mathematics from all other sciences and, indeed, all other intellectual pursuits. Indeed, one de nition of mathematics is that it is \proving things about abstract objects." You probably rst met this conception of mathematics in your secondary school geometry course. While Euclid wasn't the rst person to prove mathematical propositions, his treatment of geometry was the rst systematization of a large body of mathematics and has served as a model of mathematical thought for 2200 years. To understand the role of proof in mathematics, we can do no better than to start with Euclid. The basic ingredients of Euclidean geometry are three.

Primitive terms.

Point, line, plane are all primitive terms in modern treatments of Euclidean geometry. We usually call these unde ned terms and do not attempt to give de nitions for them. (Euclid did give de nitions for all his terms we discuss the role of de nition in mathematics later.) Of course a logical system must start somewhere it is impossible to de ne all terms without falling prey to either circularity or in nite regress. David Hilbert, in his Foundations of Geometry, simply starts as follows Let us consider three distinct systems of things. The things composing the rst system, we will call points and designate them by the letters A, B , C , : : : those of the second, we will call straight lines, and designate them by the letters a, b, c : : : and those of the third system, we will call planes and designate them by the Greek letters , , , : : : . Hilbert says nothing about what the \things" are. An axiom is a proposition about the objects in question which we do not attempt to prove but rather which we accept as given. One of Euclid's axioms, for example, was \It shall be possible to draw a straight line joining any two points." Aristotle describes the role of axioms.

Axioms.

1. PROOFS IN MATHEMATICS
It is not everything that can be proved, otherwise the chain of proof would be endless. You must begin somewhere, and you start with things admitted but undemonstrable. These are rst principles common to all sciences which are called axioms or common opinions.

167

Euclid and Aristotle thought of axioms as propositions which were \obviously" true. But it is not necessary to think of them as either true or false. Rather, they are propositions which we agree, perhaps for the sake of argument, to accept as given. to prove new theorems using the laws of logic. The nature of such rules of inference is best illustrated by an example. All men are mortal Socrates is a man Socrates is mortal In this example, the axioms (called premises or hypotheses) are written above the line and the theorem (called the conclusion) is written below the line. The whole argument is called a deduction. This particular argument is an example of a rule of inference which is now usually called Universal Instantiation. Two important features of this argument characterize a rule of inference. First, the relationship of the conclusion to the hypotheses is such that we cannot fail to accept the truth of the conclusion if we accept the truth of the hypotheses. Of course we do not have to accept the truth of the hypotheses and so are not compelled to believe the conclusion. But a rule of inference must necessarily produce true conclusions from true hypotheses. Second, this relationship does not depend on the concepts mentioned (humanity, mortality, Socratiety) but only on the form of the propositions. Hilbert said it this way: \One must be able at any time to relace `points, lines, and planes' with `tables, chairs, and beer mugs.' " The next nonsensical argument is as valid as the previous one. All beer mugs are chairs Socrates is a beer mug Socrates is a chair

Rules of inference. Axioms and previously proved theorems are combined

168

APPENDIX A. WRITING PROOFS

While neither hypothesis is true and certainly the conclusion is false (perhaps your favorite chair is named Socrates but the Socrates I am thinking of was not a chair), this argument too is a perfectly acceptable example of universal instantiation. This then is how mathematics is created. Starting from axioms which are propositions about certain objects which may be unde ned, the rules of inference are used to prove new theorems. Anyone accepting the truth of the axioms, must accept the truth of all the theorems.

Exercises
1. Morris Kline says that
Mathematics is a body of knowledge. But it contains no truths.

In a similar vein, Hilbert said It is not truth but only certainty that is at stake. What do they mean?

2 Written Proofs
I like being a writer it's the paperwork I dislike.
Peter De Vries

2. WRITTEN PROOFS

169

This appendix is speci cally concerned with written proofs. While a proof might be thought of as an abstract object existing only in our minds, the fact is that mathematics advances only in so far as proofs are communicated. And writing remains the principal means of such communication. So to be a mathematician, you need to learn how to prove things but also to write those proofs clearly and correctly. What does a written proof look like? Like any other piece of prose, a written proof is organized into sentences and paragraphs. Like all other correct writing, those sentences are written following all the standard conventions of the language in which they are written. In fact, because of the precision of the thoughts that a proof must convey, it is especially important that the prose be clear and correct. It is useful to think of a proof as consisting of three sorts of sentences. First, some sentences express the result of a deduction. That is they result from other sentences by applying one of the rules of inference as described in the last section. These sentences can be recognized by the fact that they start with words like \therefore", \thus", or \because of this". Of course such a sentence will not normally be the rst sentence of the proof and such a sentence normally depends on one or more earlier sentences of the proof. A second sort of sentence is used to state a given fact. These sentences normally are restatements of hypotheses of the theorem being proved or recall facts that the reader should know already. An example of the latter p type is the sentence \Recall that 2 is an irrational number." Again, these sentences should contain some sort of cue that they are stating hypotheses or previously proved facts rather than asserting something new. Finally, a third sort of sentence appearing in a proof is what might be called \glue" or the prose that holds the other sentences together. These sentences are used for purposes such as to inform the reader of the structure of the argument (\We will next show that G is abelian.") or to establish notation (\Let X = Y Z ."). It is a common error of beginning proof-writers to use too few of these sentences so that the structure of the argument is not clear.

170

APPENDIX A. WRITING PROOFS

This description of what a proof should look like is at odds with some of the ideas of proof that students take with them from high-school mathematics and perhaps even calculus. Some students think that a proof, like the solution to any homework problem, should be a series of equations with few, if any, words. Now an equation is a perfectly acceptable sentence. The equation \x+2=3." is a sentence and could, perhaps, appear in a proof. Mathematical notation serves as abbreviation for words and phrases which would be tedious to write many times. However this equation almost certainly should not appear as a sentence of a proof. For it is not clear whether it expresses a hypothesis or a conclusion. Probably what is meant is \Suppose that x is a real number such that x + 2 = 3:" or \Therefore, it follows from the last equation that x + 2 = 3:" Equations must be tied together with words. A second misconception of proof is a side-e ect of studying geometry in high school. High school geometry courses often teach that a proof should be arranged in two columns in one column we write assertions and in the other we write the reason that the corresponding assertion is true. Look in a mathematics journal and you will see that no mathematician writes proofs in this manner. The main reason for teaching \two-column" proofs is that they sometimes help beginning proof writers concentrate on the logical structure of the argument without having to attend to the details of grammatical writing. A two-column proof reinforces the notion that every sentence in a proof has a de nite purpose. For realistic theorems however (unlike the baby theorems of high school geometry), the two-column proof becomes cumbersome and hard to read. The two-column proof, among other defects, is missing the \glue" described above. These informative sentences are crucial to helping a reader understand a complicated proof. We want the reader to understand not only the justi cation of each step but also the logical structure of the argument as a whole. Nevertheless, a two-column proof is sometimes a good place to start on scratch paper.

3 Proverbs
Here I have written out for you sayings full of knowledge and wise advice
Proverbs 22:20

3. PROVERBS

171

Proof-writing is, to some extent at least, a creative activity. There is no step-by-step recipe that is guaranteed to produce a proof, if followed carefully. Proof-writing is di erent in this way than di erentiation in calculus. Machines can di erentiate as well as you can, but have not made much progress in producing proofs. However, experienced proof-writers do have certain principles by which their search for a proof is at least implicitly guided. In these notes we try to summarize at least some of these principles in the form of proverbs. As a vehicle for introducing the rst few of these proverbs, we consider the proof of the following (easy) Theorem. Theorem 3.1. The square of an even natural number is even. How does one get started writing a proof? The following proverb suggests the answer. Proverb 1. The form of the theorem suggests the outline of the proof. In fact Proverb 2. You can write the rst line of a proof, even if you don't understand the theorem. In a later section, we make a more detailed study of theorem forms. However Theorem 3.1 has a common and easily recognizable form. Here is an abstract version of that form. Theorem 3.2. If object x has property P then x has property Q. or more simply Theorem 3.3. If x is a P then x is a Q. It will become clear to you in your study of abstract mathematics that many theorems have exactly this form, though you might have to rewrite the theorem a bit to see this clearly. Here are some examples from all sorts of di erent mathematical specialities.

172

APPENDIX A. WRITING PROOFS


Every di erentiable function is continuous. Every semistable elliptic curve is modular. The lattice of computably enumerable sets is distributive. If I is a prime ideal of a ring R, then R=I is an integral

Theorem 3.4. Theorem 3.5. Theorem 3.6. Theorem 3.7.

domain. The rst of these theorems is one you know and love from your calculus class. The second is the famous theorem of Wiles proved in 1993 (it implies Fermat's last theorem). The third comes from a eld of mathematical logic known as recursion theory. The last theorem is one that you would meet in an abstract algebra class. Notice that Theorem 3.7 is really about two objects and both properties P and Q express relationships between these two objects. Note too that while Theorem 3.6 appears to be about only one object (the lattice of recursively enumerable sets), the other three theorems are about an unspeci ed number of objects. In fact, our Theorem 3.1 is about in nitely many objects. So if Proverb 1 is correct, the outline of the proof Theorem 3.2 should suggest itself. In fact, by Proverb 2, we should be at least able to write the rst sentence of the proof. Indeed, here is a reasonable way to begin theorems such as Theorem 3.2. Proof. (of Theorem 3.2) Suppose x has property P . We must show that x has property Q. The second sentence might be a bit pedantic but the rst clearly sets the stage. Thus, our proof of Theorem 3.1 begins as follows. Proof. (of Theorem 3.1) Suppose that n is an even natural number. Actually, we can also predict the last line of theorems with this form. We would expect the proof of Theorem 3.1 to look like this. Proof. (of Theorem 3.1) Suppose that n is an even natural number. : : : Then n2 is even. So what remains in the proof of the theorem is to ll in the : : : . We need to reason from the fact that x has property P to the fact that x has property Q. In our particular example, and in many similar cases, the next proverb supplies the key.

3. PROVERBS

173

Proverb 3. Use the de nition.


In some cases it will be obvious that an x with property P also has property Q. However, if it is that obvious, you probably will not be asked to supply a proof in the rst place. So the rst step is usually to determine what it means to have property P . All mathematical terms, except the primitive ones, have precise de nitions. In our case, the following de nition is the important one.

De nition 3.8. A natural number n is even if there is a natural number k


such that n = 2k. Using the de nition gives us the second line of our proof. It also gives us a hint as to what the next to last line of the proof might be.
Proof. (of Theorem 3.1) Suppose that n is an even natural number. Then there is a natural number k such that n = 2k. : : : Thus there is a natural number l such that n2 = 2l. Thus n2 is even.

The only work in this theorem is lling in the remaining gap. And this work is simply a computation. Thus the complete proof is
Proof. (of Theorem 3.1) Suppose that n is an even natural number. Then there is a natural number k such that n = 2k. Therefore n2 = (2k)2 = 4k2 = 2(2k2). Thus there is a natural number l (namely 2k2 ) such that n2 = 2l. Thus n2 is even.

One more (easy) theorem of this type will serve to reinforce the point of this section.

Theorem 3.9. The base angles of an isosceles triangle are congruent.


Recasting this theorem in the form of Theorem 3.2, we might write this theorem as

Theorem 3.10. If a triangle is isosceles, then the base angles of that triangle
are congruent.

A diagram, Figure 3, serves to illustrate the statement of the theorem.

174

APPENDIX A. WRITING PROOFS


B

B BB B

BB B

BC

Proof. Suppose that 4ABC is isosceles. That is, suppose that AB and BC are the same length. (Note the clever use of the de nition of isosceles triangle.) We must show that the base angles and are equal. To do that notice that triangles 4ABC and 4CBA are congruent by side-angle-side. Furthermore, and are corresponding angles of these two triangles. Thus and are congruent (equal) since corresponding parts of congruent triangles are congruent.

Exercises

1. Write good rst and last lines to the proofs of (a) Theorem 3.4 (b) Theorem 3.5 (c) Theorem 3.6 (d) Theorem 3.7. 2. (a) Write a good de nition of \odd natural number." (b) Prove that the square of an odd number is odd. 3. Prove the following theorem Theorem 3.11. If a triangle has two congruent angles, then the triangle is isosceles. (This theorem is the converse of Theorem 3.9. It is always di cult to know what you can assume in geometry, but the proof of this Theorem is similar to that of Theorem 3.9 | it only uses simple facts about congruent triangles.)

4. CONTRAPOSITION AND CONTRADICTION

175

4 Contraposition and Contradiction


\There is no use trying," said Alice \one can't believe impossible things." \I dare say you haven't had much practice," said the Queen, \When I was your age, I always did it for half an hour a day. Why, sometimes I've believed as many as six impossible things before breakfast."
Lewis Carroll

In the last section, we saw how to produce a reasonable outline of a proof of a theorem with the following form. Theorem 4.1. For all x, if x has property P then x has property Q. However Proverb 4. There is more than one way to prove a theorem. In this section, we look at two alternative outlines of the proof of Theorem 4.1. The rst of these is called \proof by contraposition." It depends on the following lemma. Lemma 4.2. Suppose that and are propositions. Then the statement If then (4.1) is logically equivalent to the statement If is not true then is not true. (4.2) (The statement 4.2 is called the contrapositive of the statement 4.1.) Here logically equivalent means that 4.1 is true just in case 4.2 is true. So to prove a statement of form 4.1, it is su cient to prove 4.2. This fact gives us the rst of two alternate outlines for a proof of Theorem 4.1. Proof. (of Theorem 4.1) We prove the theorem by contraposition. Suppose that x does not have property Q. : : : Then x does not have property P. As a speci c example of a proof with this outline, consider the following theorem.

176

APPENDIX A. WRITING PROOFS


2

n is odd. Proof. We prove the theorem by contraposition. Suppose that n is not odd. That is suppose that n is even. Then n is even (by Theorem 3.1). Thus n is not odd. How does one decide whether to prove a theorem directly or by contraposition? Often, the form of the properties P and Q give us a clue. If Q is a negative sort of property, (such as x is not divisible by 3), it may very well be easier to work with the hypothesis that x does not have property Q. Of course we could always try to prove the theorem both ways and see which one works. Another alternate way to prove a Theorem is to give a proof by contradiction. In a proof by contradiction, we suppose that the theorem is false and derive some sort of false statement from that assumption. If mathematics is consistent and if our reasoning is sound, this means that our assumption that the theorem is false is in error. So the outline of a proof by contradiction of Theorem 4.1 is as follows. Proof. (of Theorm 4.1). We prove the theorem by contradiction. So suppose that x has property P but that x does not have property Q. : : : Then 1=2 (or any other obviously false statement). Thus our assumption is in error and it must be the case that if x has property P , x also has property Q. The most famous theorem which is usually proved by contradiction is the following. p Theorem 4.4. 2 is irrational. We rst rephrase the theorem so that it has the form of Theorem 4.1. Theorem 4.5. If x is any real number such that x = 2, then x is not
2 2 2

Theorem 4.3. Suppose that n is a natural number such that n is odd. Then

rational.

This form is logically superior to that of Theorem 4.4 since it doesn't p assume the existence or uniqueness of a number 2. This form also suggests either contraposition or contradiction since the property \is not rational" is not as easy to work with as the property \is rational."

4. CONTRAPOSITION AND CONTRADICTION

177

Proof. We proof Theorem 4.5 by contradiction. So suppose that x is a number such that x2 = 2 and x is rational. Then there are natural numbers p and q such that p and q have no common divisors and x = p . Then q

2=x = p q
2 2 2 2 2 2 2 2

Therefore p = 2q . This implies that p is even and so p is even (See exercise 1 below.) Since p is even, p = 2k for some natural number k. Thus 2q = p = 4k or q = 2k . But this implies that q is even and so that q is even. Thus p and q are both even but this cannot be true since we assumed that p and q had no common divisors. Students sometimes confuse proofs by contradiction and contraposition. The proofs look similar in the beginning since each begins by assuming that x does not have property Q. But a proof by contradiction also assume that x has property P and proves the negation of some true proposition while a proof by contraposition does not make this assumption and simply proves that x does not have property P .
2 2

Exercises
1. Prove that if p is a natural number such that p is even then p is even. 2. Prove that 3 is irrational. p 3. Prove that 6 is irrational. 4. Write the contrapositive of the following theorems. (a) Theorem 3.4 (b) Theorem 3.5 (c) Theorem 3.6 (d) Theorem 3.7. 5. Write the assumption made in a proof by contradiction of the following theorems. (a) Theorem 3.4

178 (b) Theorem 3.5 (c) Theorem 3.6 (d) Theorem 3.7.

APPENDIX A. WRITING PROOFS

5 Ten Rules
When I read some of the rules for speaking and writing the English language correctly : : : I think any fool can make a rule and every fool will mind it.
Henry Thoreau

5. TEN RULES

179

As in most writing, there are certain mistakes that occur over and over again in mathematical writing. As well, there are certain conventions that mathematicians adhere to. In this section, we present ten rules to follow in writing proofs. If you follow these rules, you will go a long way towards making your writing clear and correct. Most of these rules come in one form or another from the wonderful book, Mathematical Writing, by Donald Knuth.

Rule 1 Use the present tense, rst person plural, active voice.
Bad: It will now be shown that : : : Good: We show : : :

Rule 2 Choose the right technical term. For example, not all formulas
are equations.

Rule 3 Don't start a sentence with a symbol.


Bad: xn ; a has n distinct roots. Good: The polynomial xn ; a has n distinct roots.

Rule 4 Respect the equal sign.


Bad: x = 4 = jxj = 2: Good: If x = 4 then jxj = 2.
2 2

180

APPENDIX A. WRITING PROOFS

Rule 5 Normally, if you use \if", use \then".


Bad: If x is positive, x > 0. Good: If x is positive then x > 0.

Rule 6 Don't omit \that".


Bad: Assume x is positive. Good: Assume that x is positive.

Rule 7 Identify the type of variables.


Bad: For all x, y, jx + yj jxj + jyj. Good: For all real numbers x, y, we have jx + yj jxj + jyj. There is an exception to this rule. In many situations, the notation used implies the type of a variable. For example, it is usually understood that n denotes a natural number. In Real Analysis, x almost always denotes a real number. In these cases, the type can be suppressed in the interest of saving ink and avoiding the distraction of extra words.

Rule 8 Use \that" and \which" correctly. (This is more than a common error in mathematical writing many people seem to get this one wrong.) Bad: The least integer which is greater than 27 : : : p Good: The least integer that is greater than 27 : : :

Rule 9 A variable used as an appositive need not be set o by commas.


Bad: Consider the group, G, that : : : Good: Consider the group G that : : :

5. TEN RULES
words. Symbols may, of course, be used in formulas. Bad: Let S be the set of numbers < 1. Good: Let S be the set of numbers less than 1.

181

Rule 10 Don't use symbols such as 9, 8, _, > in text replace them by

182

6 Forms of Theorems

APPENDIX A. WRITING PROOFS

And if you go in, should you turn left or right : : : or right-and-three-quarters? Or maybe not quite? Or go around back and sneak in from behind? Simple it's not, I'm afraid you will nd, for a mind-maker-upper to make up his mind.
Dr. Seuss

Not all theorems have the form of Theorem 3.2. In this section we look at a few of the more common forms. A biconditional theorem is one with form Theorem 6.1. P is true if and only if Q is true. The proof of Theorem 6.1, as you would suspect, has two parts. Proof. (of Theorem 6.1) First, suppose that P is true. : : : Then Q is true. Next, suppose that Q is true. : : : Then P is true. Often, one of the two directions of a biconditional is best proved by contraposition.

6.1 Biconditional Theorems

6.2 Existence Theorems

An existence theorem is one with the form Theorem 6.2. There is an x with property P . Here is a speci c example. Theorem 6.3. There is a real number x such that x + 6x ; 17 = 0. The most common form of proof of a theorem with the form of Theorem 6.2 is Proof. Let x be de ned (constructed, given) by : : : . Then x has property P because : : : .
2

6. FORMS OF THEOREMS
For example, here is a complete proof of Theorem 6.3.
Proof. Let x be given by
2

183

x = ;3 + 26: p p p Then x + 6x ; 17 = (;3 + 26) + 6(;3 + 26) ; 17 = 9 ; 6 26 + 26 ; p 18 + 6 26 ; 17 = 0:


2

It is sometimes possible to prove Theorem 6.2 by contradiction. Such a proof would look like
Proof. (of Theorem 6.2) We prove the theorem by contradiction. So suppose that no such x exists. Thus no x has property P . : : : Then 0=1. Therefore our assumption that no such x exists must be in error so indeed such an x does exist.

Such a proof by contradiction is rather peculiar since we now know that x exists but the proof does not give us any way to nd x.

6.3 Uniqueness

A uniqueness theorem is one with form

Theorem 6.4. There is a unique x with property P .


This theorem actually says two things there is an x with property P but there is only one x with that property. Thus, the proof has two parts an existence part (and we have already discussed that) and a uniqueness part. The proof of Theorem 6.4 therefore looks like this.
Proof. Existence. De ne x by : : : Then x has property P because : : : Uniqueness. Suppose that x and y have property P . : : : Then x = y.

Often, the uniqueness portion of Theorem 6.4 is proved by contradiction. Then the second part of the proof looks like
Proof. Uniqueness. We prove uniqueness by contradiction. So suppose x and y have property P and x 6= y. : : : Then 0=1. Therefore our assumption that x 6= y must be in error.

184

APPENDIX A. WRITING PROOFS

The next theorem is a typical (though simple) example of a uniqueness theorem. Recall that an additive identity is a number 0 with the property that 0 + x = x + 0 = x for all real numbers x. Theorem 6.5. The additive identity for the set of real numbers is unique. Proof. Suppose that 0 and 00 are numbers satisfying the de ning condition for being an additive identity, namely that 0 + x = x + 0 = x for all x (6.1) and 00 + x = x + 00 = x for all x (6.2) Then by 6.1 (with x = 00) we have that 0 + 00 = 00 and by 6.2 (with x = 0) we have that 0 + 00 = 0. Thus 0 = 00.

6.4 Universal Statements

A universal statement is one of form Theorem 6.6. For all x, x has property R. In fact, our original theorem form, Theorem 3.2, can best be understood as a universal statement. Theorem 6.7. For all x, if x has property P then x has property Q. Consider again our proof of Theorem 3.2. We write it somewhat di erently. Proof. Let x be an arbitrary object with property P . Then : : : Then x has property Q. The key feature of this proof that allows us to claim that the Theorem is true of all objects, is that we did not assume any special properties of x (other than P ). That is, though we named x, x was otherwise a \generic" object. You will recall this sort of reasoning from geometry. If you were asked to prove something for all triangles, you probably drew a triangle and labeled the vertices A, B , and C , but realized that you were not allowed to assume anything special about the triangle (say, from the diagram). Your proof had to work for equilateral triangles as well as triangles that were not even isosceles. So the general proof of a universal statement like Theorem 6.6 goes as follows.

6. FORMS OF THEOREMS

185

Proof. Let x be given. : : : Then x has property R. Here, the : : : is lled in by an argument which assumes nothing in particular about x. As a simple concrete example, consider the following Theorem.

Theorem 6.8. For all real numbers x, x + x + 1 0.


2

Proof. Let x be an arbitrary real number. 1 1 x2 + x + 1 = (x2 + x + 4 ) + 3 = (x + 2 )2 + 3 4 4 But (x + 1=2)2 0 so that (x + 1=2)2 + 3=4 > 0. Thus x2 + x + 1 > 0. In this proof, we used no special property of x and so we were entitled to conclude that the property in question held for all x. To prove a theorem like Theorem 6.6 by contradiction, we have to realize that to deny that every x has property R is to assert that some x does not have property R. So a proof by contradiction of Theorem 6.6 might look like this. Proof. We prove the theorem by contradiction. So suppose that there is an x which does not have property R. : : : Then 0=1. Therefore no such x exists. The middle part of this proof would presumably be lled in by an argument showing that x has some impossible property.

186

7 Sets

APPENDIX A. WRITING PROOFS

As a branch of mathematics, set theory is less than one hundred years old, yet it occupies a unique and critical position. Set-theoretic principles and methods pervade mathematics. Settheoretic results have shaken the worlds of analysis, algebra, and topology. Simple questions about sets have split the mathematical community into hostile camps, and the romance of its in nite sets have charmed and challenged philosophers as nothing else in mathematics.
Jim Henle

Set-theory and set-theoretic notation was born out of the nineteenth century struggle in mathematics to give a clear account of the real number system. Our interest in set theory stems from its power as a language for unifying and simplifying mathematical expression. What is a set? As you must have learned in eighth grade, a set is a collection of objects. But what is a collection? A point made in section 1 was the necessity in any logical system of unde ned terms. We might as well stop with set set is an unde ned term in mathematics. The fact that terms such as point or line or set are unde ned does not mean that we know nothing about the objects left unde ned however. We need to stipulate by axioms how the objects behave. We will not give a formal axiom system for set theory here. It is possible, but our informal understanding of set as collection will su ce. We think of a set as a collection of objects. Consider the following examples. 1. 2. 3. 4. 5. The set N of all natural numbers. The set consisting of the numbers , 17, and . The set of all rational solutions to x ; 1 = 0. The set consisting of the numbers 1 and ;1. The set of all the letters of the Greek alphabet.
3 4 2

Note that in examples 2 and 3, the sets were described by listing the members of the collection. In the other three examples, the set was speci ed by giving

7. SETS

187

a rule for determining which elements are in the collection. Corresponding to these two ways of specifying sets, we have two ways of denoting sets. In denoting a set by a complete list of its members as in example 2, we write f 17 g. In denoting a set by a rule as in example 3, we write fx j x + 1 = 0g. The symbol j is read \such that". Also note that the collections speci ed in examples 3 and 4 have precisely the same members. Since sets are collections of objects, these two descriptions must be descriptions of the same set. This, in fact, is the rst axiom in an axiomatization of set theory.
3 4 2

Axiom 7.1 (The Axiom of Extensionality). If A and B are sets, then

A = B is and only if every object belonging to A also belongs to B and every object belonging to B also belongs to A.
Of course the very astute reader might notice hear that \belonging" is also an unde ned term. \Belonging" is a relation between objects and sets. For every object x and set A, either x belongs to A or it doesn't. We write the former as x 2 A the latter as x 62 A. The objects belonging to A are called elements or members of A. With this notation, we can simplify the statement of the axiom of extensionality:

Axiom 7.2 (The Axiom of Extensionality). If A and B are sets then A = B if and only if for all x, x 2 A if and only if x 2 B .
Now the very, very astute reader may notice that we are being very vague about where the objects that can be in sets come from. We will continue to be vague about that so that we can avoid talking about the philosophical issues involved in this discussion. In mathematics, the sets that are usually discussed are collections of garden variety, easily described objects such as numbers or functions or points or lines. We will leave it at that. Set theory plays an important role in mathematical writing because it gives an economical notation for many common mathematical ideas. The notation consists of a large number of de ned relations between sets and functions de ned on sets.

De nition 7.3. If A and B are sets, we say A is a subset of B if every

member of A is a member of B . We write A B if A is a subset of B . We write A B if A B but A 6= B .

188

APPENDIX A. WRITING PROOFS

We can state a little theorem here. It sounds trivial but it actually is quite important as it describes one of the most useful ways of proving that two sets are equal. Theorem 7.4. Suppose that A and B are sets. Then A = B if and only if A B and B A. Two important operations de ned on sets are union and intersection. De nition 7.5. If A and B are sets, the union of A and B is the set fx j x 2 A or x 2 B g. This set is denoted by A B . If A and B are sets the intersection of A and B is the set fx j x 2 A and x 2 B g. This set is denoted by A \ B . Several other pieces of notation are quite useful. The unique set with no elements is called the empty set as is denoted by denoted by . (Why is unique?) Of course it takes axioms to guarantee that the empty set exists and that A B and A \ B exist given that A and B do. (Of course this all seems quite obvious but that's why these facts are axioms!) The notation A ; B denotes the set fx j x 2 A and x 2 B g. The next notation generalizes = the notions of intersection and union to in nite collections of sets. De nition 7.6. Suppose that X is a set and for each 2 X , A is a set. Then
2 \X 2X

A = fx j x 2 A for some 2 X g A = fx j x 2 A for every 2 X g

Often a set A will be thought of as a subset of some larger \universal" set U . For example, when considering sets of natural numbers, the set N might be considered the universal set. In this case, the notation A0 is used to denote the set U ; A and is called the complement of A (in U ).

Exercises
1. Let A, B , and C be sets. Prove (a) A \ B A A B .

7. SETS
(b) (A \ B ) \ C = A \ (B \ C ). (c) A \ (B C ) = (A \ B ) (A \ C ). (d) A0 B 0 = (A \ B )0 . 2. Show that !0 \ A = A0
2X 2X

189

You might also like