<<

M3P65: Mathematical

Lecturers: Dr. Zaniar Ghadernezhad and Prof. David Evans ∗

June 12, 2020

Contents

1 Propositional logic 2 1.1 Propositional formulas and induction ...... 2 1.2 Valuation maps ...... 4 1.3 Substitution ...... 6 1.4 The Deductive approach ...... 9 1.4.1 Formalising deduction ...... 11 1.5 Soundness and Completeness theorems ...... 11 1.6 Consistent and maximally consistent sets of formulae ...... 14

2 Predicate logic 19 2.1 First order structures, languages and formulas ...... 19 2.2 Interpretations of languages and assignments ...... 21 2.3 Variable binding and subformulas ...... 23 2.4 Substitution ...... 26 2.5 Some examples of structures ...... 27 2.6 Variable scoping ...... 28 2.7 Natural Deduction ...... 30 2.8 Completeness and the model existence lemma ...... 32 2.8.1 Extension by constants and Henkin extensions ...... 32 2.8.2 The proof of Lemma 2.35 ...... 35 2.8.3 Proof of the model existence lemma ...... 35 2.9 Soundness of equality deduction rules ...... 38 2.10 Some conclusions of the completeness theorem ...... 39 2.11 Decidability and the Entscheidungsproblem ...... 40 2.12 Dense linear orders ...... 41

3 Set theory 43 3.0 Basic set theory (Review) ...... 43 3.1 Cardinality ...... 44 3.2 for set theory ...... 46 3.3 Linear orderings ...... 48 3.4 Ordinals ...... 49 3.5 Transfinite induction ...... 53 3.6 Transfinite recursion ...... 54 3.7 The of regularity (foundation) ...... 55 3.7.1 The Zermelo-Fraenkel axioms ...... 55

4 The axiom of choice and consequences 57 4.1 Statement of the axiom of choice and the well ordering principle ...... 57 4.2 Cardinals and cardinality ...... 59 4.3 Zorn’s lemma ...... 60

∗Typeset by Gautam Chaudhuri, source code available here.

1 M3P65: Mathematical Logic 1: Propositional logic 1 Propositional logic

Propositional logic deals with , these are sentences/statements that are either true or false. It is fairly limited in scope, but serves as a foundation for further theories.

1.1 Propositional formulas and induction

Definition 1.1: The language of propositional logic consists of 1. P, a nonempty set of propositions which is either finite or infinite, these are called atoms or atomic propo- sitions. 2. Connectives: ∧; ∨; →; ↔; ¬; ⊥

3. Auxiliary symbols: (; )

Definition 1.2: Let P be the set of atoms or atomic propositions, define W(P) to be the smallest set with the following properties. 1. p ∈ W(P) for all p ∈ P 2. if p; q ∈ W(P) then (pq) ∈ W(P) where  ∈ {∧; ∨; →; ↔}. 3. p ∈ W(P) → (¬p) ∈ W(P) 4. ⊥∈ W(P) We call elements of W(p) the propositional sentences or formulas (built from P).

The language of propositional logic is called meta-language and the variables (symbols) are called meta-variables.

Example: P is given, suppose p; q ∈ P then p ∧ q ∈ W(P). Is ¬p ∈ W(P)? Is ¬¬∧ in W(P)?

Proof. W(P) \ {¬p} satisfies all the properties that W(P) should. Since W(P) \ {¬p} is necessarily smaller, W(P) is no longer the smallest set that satisfies all the properties. This is a contradiction. The second question is proven similarly. 

Theorem 1.3: Induction Suppose A is a property about W(P), then A(φ) holds for all φ ∈ W(P) if 1. A(p) holds for all p ∈ P (the atoms) 2. A(φ) and A(ψ) → A((φψ)) 3. A(φ) → A((¬φ)) 4. A(⊥) holds

Proof. Clearly, the four statements hold for X := {φ ∈ W(P): A(φ)}. Then X ⊆ W(P) as X satisfies all the properties of W(P). From this we deduce that W(P) ⊆ X as W(P) is the smallest set that satisfies all the properties. Hence X = W(P). 

Example: Every statement in W(P) has an even number of brackets.

2 M3P65: Mathematical Logic 1: Propositional logic

Proof. Show each of the inductive properties • Every atomic does not have brackets so they have an even number, so property 1 holds. • Combining two propositions, each with an even number of brackets, will add two brackets to the total. This will result in an even number of brackets, so property 2 holds. • Negating a statement with an even number of brackets adds two brackets to the total, this is still an even number of brackets so property 3 holds. • ⊥ does not have any brackets, so property 4 trivially holds.

So by induction, the property holds for all elements of W(P). 

Definition 1.4: φ ; : : : ; φ ∈ W P φ A sequence 1 n ( ) is called a formation sequence of if: 1. φn = φ 2. For all i, at least one of the following holds

(a) φi is atomic

(b) φi = (φj φk ); j; k < i (c) φi = (¬φj ); j < i

Theorem 1.5: Given P, W(P) is the set of all expressions that have a formation sequence.

Proof. We prove this inductively on φ. Let X = {φ ∈ W(P): φ has a formation sequence} • X clearly contains all the atoms • The combination of two formation sequences using a connective also has a formation sequence by concatenating the two, this implies it is in X. • The negation of a formation sequence also has a formation sequence and is thus in X. • ⊥ is atomic and thus contained in X. by the inductive theorem, X = W(P) 

Example: What is a formation sequence for ((¬p) ∧ q)?

• p; (¬p); q; ((¬p) ∧ q)

• p; q; (¬p); ((¬p) ∧ q)

• p; s; q; r; (p ∧ q); (¬p); ((¬p) ∧ q)

3 M3P65: Mathematical Logic 1: Propositional logic

1.2 Valuation maps

Every p ∈ P has a truth value, 1 or 0. Can we assign truth values to propositions in W(P)?

Definition 1.6: A mapping v : W(P) → {0; 1} is called a valuation map if it satisfies the following ∀φ; ψ ∈ W(P) 1. v((φ ∧ ψ)) = min{v(φ); v(ψ)} 2. v((φ ∨ ψ)) = max{v(φ); v(ψ)} 3. v((φ → ψ)) = 0 ⇐⇒ v(φ) = 1 and v(ψ) = 0 4. v((φ ↔ ψ)) = 1 ⇐⇒ v(φ) = v(ψ) 5. v((¬φ)) = 1 − v(φ) 6. v(⊥) = 0

Lemma 1.7: 0 0 Suppose v; v are two valuation maps s.t. v(p) = v (p) for all atomic p ∈ P, 0 then v(φ) = v (φ) for all φ ∈ W(P).

Proof, Induction on formulae. We check each case of the formation sequences, let φ ∈ W(P). 0 • atoms: Suppose φ is atomic, then by assumption, v(φ) = v (φ). φ ¬φ φ ∈ P v φ − v φ − v 0 φ v 0 φ • negation: Suppose = ( 1) where 1 is atomic. Then ( ) = 1 ( 1) = 1 ( 1) = ( ) φ φ φ φ ; φ ∈ P • connectives: Suppose = ( 1 2) where 1 2 are atomic and  is a connective. Then – If  = ∧ v φ v φ ∧ φ ( ) = (( 1 2)) {v φ ; v φ } = max ( 1) ( 2) {v 0 φ ; v 0 φ } = max ( 1) ( 2) v 0 φ ∧ φ = (( 1 2)) 0 = v (φ)

– We prove the case for  = ∨ similarly. – If  =→, then v φ v φ → φ ( ) = (( 1 2)) v φ ⇐⇒ v φ v φ ( ) = 0 ( 1) = 1 and ( 2) = 0 ⇐⇒ v 0 φ v 0 φ ⇐⇒ v 0 φ → φ ( 1) = 1 and ( 2) = 0 (( 1 2)) = 0 0 ⇐⇒ v (φ) = 0 0 0 Since we have v(φ) = 0 ⇐⇒ v (φ) = 0; v(φ) = v (φ). – The case for  =↔ is clear. – The two maps must agree on ⊥ by definition. We have proven the hypothesis true for every atom, the negation of every atom, and the concatenation of any two atoms by a connective. Thus the hypothesis holds true for any formation sequence, and thus every element φ ∈ W(P). 

Corollary 1.8: 0 0 0 If v : P ∪ {⊥} → {0; 1} s.t. v (⊥) = 0, then there is a unique valuation map v such that v(p) = v (p); ∀p ∈ P

4 M3P65: Mathematical Logic 1: Propositional logic

Suppose P is a finite set with size n, how many valuation maps do we have for W(P)?

Definition 1.9: Let P be a given nonempty set of atoms, let φ ∈ W(P). 1. φ is a tautology if v(φ) = 1 for all valuation maps of W(P) 2. Suppose Γ ⊆ W(P), then φ is a semantic consequence of Γ, written Γ  φ, if, for every valuation map v where v(ψ) = 1 for all ψ ∈ Γ, we have v(φ) = 1. For a tautology φ, we write  φ.

Example: P v W P p; q; p ; q ∈ P Let be a set of atomic propositions, a valuation map on ( ) and 1 1 . :  (p ∨ (¬p))

Proof.

v((p ∨ (¬p))) = max{v(p); v((¬p))} = max{v(p); 1 − v(p)} = 1

 :  ((p ∧ p) → p) :  ((p ∨ p) ↔ p) :  ((p ∧ q) ↔ (q ∧ p)) :  ((¬(p ∧ q)) ↔ ((¬p) ∨ (¬q))) : {p}  p : {p; (p → q)}  q

Proof. We note that v(p) = 1 and v((p → q)) = 1 =⇒ v(q) = 1 (otherwise contradiction) 

Truth Tables We can also check the veracity of statements using truth tables. Some examples are shown below.

v(p) v(q) v((p → q)) v p v ¬p v p ∨ ¬p ( ) (( )) (( ( ))) 0 0 1 0 1 1 0 1 1 1 0 1 1 0 0 1 1 1

Table 1: Truth tables for (p ∨ (¬p)) and (p → q)

Proposition 1.10: Let p; q ∈ P some nonempty set of propositions

1.10.1:  ((p → q) ↔ ((¬p) ∨ q)) 1.10.2:  ((p ↔ q) ↔ ((p → q) ∧ (q → p)))

Proof, use the valuation map. Let v : W(P) → {0; 1} be some valuation map • We expand v((p → q) ↔ ((¬p) ∨ q)) = 1 ⇐⇒ v((p → q)) = v(((¬p) ∨ q))

5 M3P65: Mathematical Logic 1: Propositional logic

Note that v(((¬p)∨q)) = max{1−v(p); v(q)}. So v(((¬p)∨q)) = 0 ⇐⇒ v(p) = 1 and v(q) = 0 ⇐⇒ v((p → q)) = 0. • We expand

v((p ↔ q) ↔ ((p → q) ∧ (q → p))) = 1 ⇐⇒ v((p ↔ q)) = v(((p → q) ∧ (q → p))) v(((p → q) ∧ (q → p))) = min{v((p → q)); v((q → p))} v(((p → q) ∧ (q → p))) = 0 ⇐⇒ v((p → q)) = 0 or v((q → p)) = 0 ⇐⇒ (v(p) = 1 and v(q) = 0) or (v(q) = 1 and v(p) = 0) ⇐⇒ v(p) =6 v(q) ⇐⇒ v((p ↔ q)) = 0



This statement also holds for any formula φ ∈ W(P), but we leave this proof until later.

Remark: The symbols →; ↔ are members of the meta language, the symbols =⇒ ; ⇐⇒ are logical implications.

1.3 Substitution P n ≤ |P| φ ∈ W P p ; : : : ; p ∈ P φ Setting Let be a nonempty set, , ( ) and assume 1 n are atoms appearing in (we p ; : : : ; p φ p ; : : : ; p sometimes call 1 n variables appearing in ( 1 n)). Let ψ ∈ W(P), we write φbψ/pic for a proposition obtained by replacing all instances of pi in φ with ψ.

Remark: Substitution of ψ for pi defines a map from W(P) to W(P). • ( φ; if φ atomic and φ =6 pi φbψ/pic = ψ; if φ = pi

φ φ φ • If = ( 1 2), then φbψ/p c φ φ bψ/p c i = ( 1 2) i φ bψ/p c φ bψ/p c = ( 1 i  2 i )

φ ¬φ • = ( 1) φbψ/p c ¬φ bψ/p c i = ( 1) i ¬φ bψ/p c = ( 1 i )

Theorem 1.11: Substitution φ ↔ φ If  ( 1 2), then ψbφ /pc ↔ ψbφ /pc  ( 1 2 )

Proof. We use induction on formulae

• Suppose that ψ is atomic, either ψ =6 p in which case ψbφi/pc = ψ and the theorem trivially holds, or ψ = p. ψbφ /pc φ ; i ; v φ v φ v – In the latter case i = i = 1 2, by assumption we have ( 1) = ( 2), for all valuation maps . v ψbφ /pc v ψbφ /pc – This implies ( 1 ) = ( 2 ) for all valuation maps. ψbφ /pc ↔ ψbφ /pc – Which implies  ( 1 2 ).

6 M3P65: Mathematical Logic 1: Propositional logic

ψ ¬ψ ψ • Suppose that = ( 1), where 1 is atomic. v ψbφ /pc v ¬ψ bφ /pc ( 1 ) = (( 1 1 )) − v ψ bφ /pc = 1 ( 1 1 ) v ¬ψ bφ /pc = (( 1 2 )) v ψbφ /pc = ( 2 )

ψ ψ ψ ψ ψ • Suppose that = ( 1 2), where 1 and 2 are atomic.

v ψbφ /pc v ψ bφ /pc ψ bφ /pc ( 1 ) = (( 1 1  2 1 )) v ψ bφ /pc ψ bφ /pc = (( 1 2  2 2 )) v ψbφ /pc = ( 2 )



Exercise: Use the theorem stated above to show that:

•  ((φ → ψ) ↔ ((¬φ) ∨ ψ)) •  ((φ ↔ ψ) ↔ ((φ → ψ) ∧ (ψ → φ)))

Corollary: For every φ ∈ W(P) there is a ψ ∈ W(P) such that ψ only has connectives {∧; ∨; ¬} such that  (φ ↔ ψ)

Proof, induction on formulae. We prove a much stronger result below. 

Definition 1.12: n A truth function on n variables is a function F : {0; 1} → {0; 1}.

φ ∈ W P φ n p ; : : : ; p ; n ≤ |P| φ F { ; }n → Let ( ) and assume has variables 1 n . Then we obtain from a truth function φ : 0 1 { ; }; x 7→ v φ v p x ; i ≤ n 0 1 ¯ x¯( ) where x¯( i) = i .

Example: x ; ;:::; ⇒ v p ; v p ; : : : ; v p ¯ = (0 1 1) = x¯( 1) = 0 x¯( 2) = 1 x¯( n) = 1

Remark:  (φ ↔ ψ) ⇐⇒ Fφ = Fψ

Definition 1.13: We say a set A of connectives is adequate if for every 1 ≤ n ≤ |P|, and for every truth function on n-variables F. There exists some formula φ ∈ W(P) which is only constructed using connectives from A and the variables p ; : : : ; p F F 1 n such that = φ.

7 M3P65: Mathematical Logic 1: Propositional logic

Theorem 1.14: The set {∧; ¬; ∨} is adequate.

n Proof. Let F : {0; 1} → {0; 1}

F x ; ∀x F F ⊥↔ p ∧ ¬p Case 1 (¯) = 0 ¯, ⊥ = (p∧(¬p)) as  ( ( ( )))

n T {x ∈ { ; } F x } {x ;:::; x }; x x1; : : : ; xn ; r ≥ Case 2 Let = ¯ 0 1 : (¯) = 1 = ¯1 ¯r ¯i = ( i i ) 1. ( j j j p if xi = 1 Let i ≤ r, define qi = j j (¬p ) if xi = 0 qj pj v qj v pj xj qj ¬pj v qj v ¬pj − xj Suppose i = , then x¯( i) = x¯( ) = i . If i = ( ), then x¯( i) = x¯(( )) = 1 i .

j j v q ⇐⇒ v pj x ψ q1 ∧ · · · ∧ qn Claim: x¯( i) = 1 x¯( ) = i . Let i = i i . Then F x ⇐⇒ v ψ ψi (¯) = 1 x¯( i) = 1 ⇐⇒ v qj ; ∀j ≤ n x¯( i) = 1 ⇐⇒ v pj xj ; ∀j ≤ n x¯( ) = i ⇐⇒ x¯ = x¯i θ ψ ∨ · · · ∨ ψ Then let = 1 r F x ⇐⇒ F x ; i ≤ r θ(¯) = 1 ψi (¯) = 1 ⇐⇒ v ψ x¯( i) = 1 ⇐⇒ x¯ = x¯i ⇐⇒ x¯ ∈ T



Definition 1.15: Suppose that φ ∈ W(P) and it is of the form of case two in the previous theorem. φ is then in Disjunctive Normal Form (DNF).

Corollary 1.16: Suppose φ ∈ W(P), then there is ψ ∈ W(P) in DNF s.t.  (φ ↔ ψ).

Proof. Take F = Fφ and apply the previous theorem. 

Exercise: The following set of connectives are adequate, • {¬; ∧} • {¬; ∨} • {¬; →} • {→; ⊥}

8 M3P65: Mathematical Logic 1: Propositional logic

1.4 The Deductive approach

Suppose v : W(P) → {0; 1} is a valuation function, then this is uniquely determined by knowing the value of v(p); p ∈ P.

Exercise: Show that v(' → ψ) = 1 ⇐⇒ v(') ≤ v(ψ)

If P is a non-empty set of atoms, we can construct the set W(P), the set of all prop. formulas generated by P. We can take Σ ⊆ W(P) and derive semantic consequences from it Σ  ' using a valuation function. We can also define Σ 2 ' ⇐⇒ ∃ valuation map v s.t. v(ψ) = 1; ∀ψ ∈ Σ and v(') = 0.

Non-semantic approach We want to deal with logic as a codification of exact reasoning, i.e. deduction rules. The process by which this is done is called natural or formal deduction. A deduction begins with a set of premises, e.g. ' and ' → ψ. Then using a deduction rule (in this case modus ponens) we can state a conclusion (in this case ψ). We '' → ψ write this as . ψ

Introduction rules We take our set of connectives to be {→; ∧; ⊥}. As {→; ⊥} was shown to be an adequate set of connectives in a previous exercise, this superset is also adequate. We need some way to introduce formulae that contain these connectives, so we define some introduction rules. • Suppose we have ' and ψ as premises, then we can conclude ' ∧ ψ, this is called ∧ introduction. We write this ' ψ as (∧ I) . ' ∧ ψ • Suppose we have ' as a premise, and with finitely manipulations we derive ψ, then we can remove ' and conclude ' → ψ, this is called → introduction. We write this as

' . . ψ (→ I) ' → ψ

Elimination rules Just as we can deduce formulae with additional connectives from certain premises, we can also eliminate connectives from premises. • Suppose we have ' ∧ ψ as premises, then we can conclude ', this is called ∧ elimination. Note that this is a ' ∧ ψ symmetric operation. We write this as . ' (∧ E) • Suppose we have ' and ' → ψ as premises, then we can conclude ψ, this is called → elimination or modus '' → ψ ponens. We write this as (→ E) . ψ

Additional rules There are a few additional rules we state • Given ⊥ as a premise, we can conclude any ', this is called the falsum rule or the principle of explosion. This ⊥ is written ' (⊥) . • Given ¬' as a premise, if after finitely many manipulations we can derive ⊥, then we can conclude '. This is called reducio ad absurdum. We write this as ¨¬¨' . . ⊥ ' (RAA)

9 M3P65: Mathematical Logic 1: Propositional logic

Remark: Take care not to confuse RAA with →I. Note that we interpret ¬φ as φ →⊥. So

φ¡ . . ⊥ (→I) ¬φ

is actually an application of → introduction. RAA only applies when we start with ¬φ as a hypothesis.

¬φ . . ⊥ (RAA) φ

Example 1.17: Some examples of formal deduction.

: (' ∧ ψ) → (ψ ∧ ψ).

Proof. • Given ' ∧ ψ we can conclude, using ∧ elimination, ' and ψ separately. • By ∧ introduction, we can then conclude ψ ∧ '. • We have shown that ' ∧ ψ yields ψ ∧ ' after finitely many steps, we can therefore use → introduction to remove (' ∧ ψ) and conclude (' ∧ ψ) → (ψ ∧ ').  ' ∧ψ ' ∧ψ (∧E)  ψ ' (∧E) (∧I) ψ ∧ ' (→I) (' ∧ ψ) → (ψ ∧ ')

 : ' → ¬¬'

Proof. • We note that ¬' is equivalent to ' →⊥ as the latter implies that ' cannot be true. • We suppose ' and ¬' as premises, from which we conclude ⊥ by modus ponens. • Using → introduction, we can remove ¬' and conclude ¬' →⊥ given '. • Note that ¬' →⊥ is equivalent to ¬¬'. • So using a second → introduction, we remove ' and conclude ' → ¬¬'.

(2) (1) '7 ¨¬'¨* ' →⊥  :( ) (MP) ⊥ (→I,1) (¬') →⊥:(¬¬') ' → ¬¬' (→ I, 2)



Definition 1.18: ⊆ W P ;' ∈ W P ` ' ' ;:::;' ' ' ∈ ' Let Σ ( ) ( ), then Σ if there is 1 n = such that either i Σ or i is obtained from a deduction rule given above. i.e. 'i or all the (uncancelled) assumptions are in Σ.

10 M3P65: Mathematical Logic 1: Propositional logic

1.4.1 Formalising deduction This subsection gives a slightly more formal treatment of the deduction rules we discussed previously. D0 ∧ introduction is as follows, suppose we have the finite deductions D and , we can then write ' '0

0 D D ' '0 ' ∧ '0

D ∧ elimination is handled similarly, suppose we have the finite deduction , we can then write both ' ∧ ψ

D ' ∧ ψ ' and D ' ∧ ψ ψ

Recall that → introduction cancels one of the premises. The intuition behind this is that a formal implication doesn’t rely on the truth value of the left-hand premise. This is shown below

' D ψ ' → ψ for example, in the sentence if it is snowing, the school is closed, we don’t assume that it is snowing. A deductive reasoning might start with assume the school is closed, but to state the final result, this can be discarded. A diagrammatic example of modus ponens is shown below

D D0 φ φ → ψ ψ

The principle of explosion is simply stated as D ⊥ φ and reducio ad absurdum becomes

¬φ D ⊥ φ

1.5 Soundness and Completeness theorems

Theorem 1.19: Soundness Let Γ ⊆ W(P);' ∈ W(P), Γ ` ' =⇒ Γ  '.

11 M3P65: Mathematical Logic 1: Propositional logic

Theorem 1.20: Completeness Let Γ ⊆ W(P);' ∈ W(P), Γ  ' ⇐⇒ Γ ` '.

Proof, 1.19. Let P be a non-empty set of atoms and let Γ ⊆ W(P). ` φ ⇒ φ φ ; : : : ; φ φ φ We would like to show Γ = Γ  , so if there is a sequence 1 n = such that for each i either φ ∈ φ φ ; : : : ; φ i Γ or i is obtained from the 1 i−1 by a deductive argument; then for every valuation map that yields v(θ ∈ Γ) = 1; v(φ) = 1. We do this by induction on n where n is the length of a proof. If n = 1, then there is no deduction so φ ∈ Γ =⇒ Γ  φ. Thus the base case holds.

Suppose that for some k ≥ 1, we have ∀i < k; Γi  φi.

∧ introduction Let:

• Γi  φi; Γj  φj s.t. i + j < k and • Γk ⊇ Γi; Γj (i.e. we have Γk  Dk such that Dk ` φi ∧ φj ). We would like to show Γk  φi ∧ φk . This is more or less immediate:

• Suppose we have a valuation map v : W(P) → {0; 1} s.t. v(φ ∈ Γk ) = 1. • Since Γi; Γj ⊆ Γk and Γi  φi; Γj  φj , we also have v(φi) = 1 = v(φj ). • Thus v(φi ∧ φj ) = min{v(φi; φj )} = 1.

∧ elimination Let:

• Γi  φ ∧ ψ s.t. i < k and • Γk ⊇ Γi (i.e. we have Γk  Dk ;Dk ` φ). We would like to show that Γk  φ. This is again clear. Suppose we have a valuation map such that v(φ ∧ ψ) = min{φ; ψ} = 1, then we must have v(φ) = 1.

→ introduction Suppose:

• D2;k−1 is a sequence of deductions φ2; : : : ; φk−1 such that the proof

φ1

D2;k−1 φk

φ1 → φk holds, {φ } ∪ D ∪ {φ } • Γk  1 2;k−1 k . \{φ } D ∪ {φ } φ → φ We would like to show for Γ2;k = Γk 1 (for which Γ2;k  2;k−1 k ), that Γ2;k  ( 1 k ). v v φ ∈ v φ → φ • Suppose for a contradiction that there exists a valuation map s.t. ( i Γ2;k ) = 1 and ( 1 k ) = 0. v φ v φ • The latter is true if and only if ( 1) = 1 and ( k ) = 0. ∪ {φ } v θ ∈ v φ • This gives a valuation function on Γk = Γ2;k 1 where ( Γk ) = 1 and ( k ) = 0 • This implies Γk 2 φk which contradicts Γk  φk .

12 M3P65: Mathematical Logic 1: Propositional logic

Modus ponens Let: D {φ ; : : : ; φ } D {φ ; : : : ; φ } • i−1 = 1 i−1 and i+1;k−1 = i+1 k−1 be deductions such that the proof

Di ;k− Di−1 +1 1 φi φi → φk−1 φk−1 holds, D ∪ {φ } • Γi  i−1 i and D ∪ { φ → φ } • Γi+1;k  i+1;k−1 ( i k−1) . ⊇ ; φ D D ` φ D We would like to show that if Γk Γi Γi+1;k then Γk  k−1 (i.e. we have Γk  k , such that k k−1, k = D ∪ {φ } ∪ D ∪ { φ → φ } i−1 i i+1;k−1 ( i k−1) ). This is again clear:

• Suppose we have a valuation function v s.t. v(θ ∈ Γk ) = 1. v φ v φ → φ • In particular we have ( i) = 1 = (( i k−1)). φ ↔ φ ∧ φ → φ v φ • Noting that k−1 ( i ( i k−1)) is a tautology, we have ( k−1) = 1. φ • Thus Γk  k−1

Falsum rule Let: • D be a set of deductions such that the proof D ⊥ holds and

• Γ be such that Γ  D (note that Γ ⊥ if and only if there is no valuation function such that v(θ) = 1 for all θ ∈ Γ). We wish to show that for any φ ∈ W(P), Γ  φ. • Suppose for a contradiction that Γ 2 φ, i.e. we have a valuation function such that for every θ ∈ Γ, v(θ) = 1 and v(φ) = 0. • This contradicts our earlier assertion that there is no valuation function such that v(θ) = 1 for all θ ∈ Γ. • And so Γ  φ.

Reducio ad absurdum Let: • D be a set of deductions such that the proof ¬φ D ⊥ holds,

• Γ be such that Γ  D ∪ {¬φ} and 0 • Γ = Γ \ {¬φ}. 0 We would like to show that if Γ ⊥ then Γ  φ. 0 • Suppose not, i.e. we have a valuation map v such that v(θ) for all θ ∈ Γ and v(φ) = 0. • Then v(¬φ) = 1. 0 • Then v(θ) = 1 for all θ ∈ Γ as Γ = Γ ∪ {¬φ}. • This contradicts Γ ⊥

13 M3P65: Mathematical Logic 1: Propositional logic

• thus Γ  φ. 

Remark: An immediate corollary of the soundness theorem is that if a statement is not a semantic consequence of a set of assumptions, it cannot be deduced from those assumptions. So

Γ 2 φ =⇒ Γ 0 φ

1.6 Consistent and maximally consistent sets of formulae The completeness theorem states that the converse of the soundness theorem is also true. That if a statement is the semantic consequence of a set of assumptions, it can be deduced from those assumptions. To prove this, we will show that if a statement cannot be deduced from a set of assumptions, then it cannot be a semantic consequence of those assumptions. So

Γ 0 φ =⇒ Γ 2 φ

Definition 1.21: We say Γ ⊆ W(P) is consistent if Γ 0⊥ (conversely, it is inconsistent if Γ `⊥).

Lemma 1.22: The following are equivalent

(I) Γ is consistent (II) For no φ ∈ W(P), does both Γ ` φ and Γ ` ¬φ hold. (III) Γ 0 φ for at least one φ ∈ W(P). i.e.

(I∗) Γ is inconsistent (II∗) ∃φ ∈ W(P) for which both Γ ` φ and Γ ` ¬φ hold. (III∗) Γ ` φ for all φ ∈ W(P).

Proof. We show I∗ =⇒ III∗ =⇒ II∗ =⇒ I∗.

I∗ =⇒ III∗ If Γ `⊥, then by the principle of explosion ⊥` φ; ∀φ. So Γ ` φ; ∀φ.

III∗ =⇒ II∗ Let ψ = ¬φ, then Γ ` ψ and Γ ` φ so Γ ` φ and Γ ` ¬φ.

II∗ =⇒ I∗ Since Γ ` φ and Γ ` ¬φ, Γ ` φ ∧ (¬φ) =⇒ Γ `⊥, thus Γ is inconsistent. 

Lemma 1.23: Suppose v is a valuation function and Γ ⊆ W(P) s.t. v(ψ) = 1; ∀ψ ∈ Γ. Then Γ is consistent.

Proof. Suppose not, then by soundness we have Γ `⊥ =⇒ Γ ⊥ which is a contradiction. 

14 M3P65: Mathematical Logic 1: Propositional logic

Lemma 1.25: Suppose that Γ is a consistent set of formulae. (a) If Γ ∪ {¬'} `⊥ then Γ ` '. (b) If Γ ∪ {'} `⊥ then Γ ` ¬'.

Proof. (a) Suppose that D is a set of deductions such that Γ ` D and ¬' D ⊥ • By RAA we have ¨¬¨' D ⊥ ' (RAA)

• and so Γ ` '. (b) Suppose that D is a set of deductions such that Γ ` D and that ' D ⊥ • Then by →I we have

' D ⊥ (→I) ' →⊥: ¬'

• and so Γ ` ¬'. 

Definition 1.26: Γ is called maximally consistent when • Γ is consistent and 0 0 0 • if we have Γ ⊇ Γ such that Γ is consistent, then Γ = Γ. 0 0 So if Γ ) Γ, Γ `⊥ is inconsistent.

Example 1.27: Let v be a valuation function, then Γ = {φ : v(φ) = 1} is maximally consistent.

0 Proof. Suppose that Γ ) Γ. 0 • For ψ ∈ Γ \ Γ, we have that v(ψ) = 0. 0 • Then v(¬ψ) = 1 =⇒ ¬ψ ∈ Γ ( Γ . 0 • ψ; ¬ψ ∈ Γ =⇒ Γ `⊥ is inconsistent. 

15 M3P65: Mathematical Logic 1: Propositional logic

Lemma 1.28: If Γ is maximally consistent, then Γ is closed under deductions. i.e. if Γ ` φ, then φ ∈ Γ.

Proof. Suppose for a contradiction that we have Γ ` φ but φ 6∈ Γ. • Since Γ is maximally consistent, Γ ∪ {φ} `⊥ is inconsistent. • By 1.25 we have that Γ ` ¬φ. • So Γ ` {¬φ; φ} =⇒ Γ `⊥ is inconsistent, which is a contradiction. 

16 M3P65: Mathematical Logic 1: Propositional logic

Lemma 1.29: Let Γ be maximally consistent. Then: (I) For all formulae φ, either φ ∈ Γ or ¬φ ∈ Γ. (II) For all formulae φ; ψ (φ → ψ) ∈ Γ ⇐⇒ (φ ∈ Γ =⇒ ψ ∈ Γ)

Proof. (I) Suppose φ 6∈ Γ. • Then Γ ∪ {φ} is inconsistent. • By 1.25 we have that Γ ` ¬φ. • Then by 1.28 we have ¬φ ∈ Γ. ¬φ 6∈ Γ =⇒ φ ∈ Γ is proven similarly. (II) • ( =⇒ ) Suppose that {(φ → ψ); φ} ∈ Γ. – Then clearly Γ ` {(φ → ψ); φ}. – By MP and 1.28 respectively, we have Γ ` ψ =⇒ ψ ∈ Γ. • ( ⇐= ) Suppose that (φ ∈ Γ =⇒ ψ ∈ Γ). – Suppose for a contradiction that ¬(φ → ψ) ∈ Γ. Exercise: Show that ` (¬(φ → ψ) ↔ (φ ∧ ¬ψ)).

– Thus we have that (φ ∧ ¬ψ) ∈ Γ =⇒ φ; ¬ψ ∈ Γ. – Which implies ψ; ¬ψ ∈ Γ and thus Γ is inconsistent, which is a contradiction. – Thus (φ → ψ) ∈ Γ. 

Corollary 1.30: If Γ is maximally consistent, then

φ ∈ Γ ⇐⇒ ¬φ 6∈ Γ ¬φ ∈ Γ ⇐⇒ φ 6∈ Γ

Lemma 1.31: Lindenbaum lemma for propositional logic ∗ ∗ For each Γ ⊆ W(P) that is consistent, there is a maximally consistent Γ :Γ ⊆ Γ ⊂ W(P)

Proof. We can use Zorn’s lemma. Suppose that |P| is at most countable.

Exercise: Show that W(P) is countable.

• We can then enumerate W(P) by W(P) = {φi : i ∈ Z+}. ⊆ ⊆ ⊆ ::: • Define a non-decreasing sequence, Γ0 Γ1 Γ2 by setting Γ0 = Γ and ( Γn ∪ {φn} :Γn ∪ {φn} is consistent Γn+1 = Γn : else

n ∈ ; • Note that for all Z≥0 Γn is consistent.

17 M3P65: Mathematical Logic 1: Propositional logic

∗ S ∗ • Let n, we claim that is maximally consistent. Γ = n∈Z≥0 Γ Γ ∗ – Suppose for a contradiction that Γ `⊥ is inconsistent. ∗ ∗ Then there is a finite subset {φi ; : : : ; φi } ⊂ such that `⊥. Φ = 1 m Γ Φ ∗ Let t = max{ij : j ≤ m}. ∗ Then Φ ⊆ Γt `⊥ is inconsistent, contradiction. ∗ ∗ Thus Γ is consistent. ∗ – Γ is clearly maximal since for ψ = φm ∈ W(P), Γm ∪ {φm} is either consistent or not. ψ φ ∈ ⊆ ∗ ∗ If it is, then = m Γm+1 Γ . ∗ ∗ ∗ If it is not, then ψ = φm 6∈ Γ and {φm} ∪ Γm ⊆ {φm} ∪ Γ `⊥ is inconsistent. 

Lemma 1.32: Suppose that Γ is consistent. Then there is a valuation function v such that v(θ) = 1; ∀θ ∈ Γ.

∗ Proof. By 1.31 there exists a maximally consistent Γ ⊇ Γ. • Define a valuation function v such that ( ∗ 1 : pi ∈ Γ v(pi) = 0 : else

∗ • We claim that v(φ) = 1 ⇐⇒ φ ∈ Γ .

Exercise: Prove this using induction on formulae.



Corollary 1.33: If Γ 0 φ then there is a valuation function v such that v(θ) = 1; ∀θ ∈ Γ but v(φ) = 0 (i.e. Γ 2 φ).

0 Proof. Note that by the contrapositive of 1.25 (a), we have that Γ 0⊥ =⇒ Γ = Γ ∪ {¬φ} 0⊥ is consistent. 0 • Now by 1.32, we have a valuation function v such that v(θ) = 1; ∀θ ∈ Γ . • Thus v(¬φ) = 1 =⇒ v(φ) = 0 

Proof, 1.20, Completeness theorem. We wish to show that for Γ ⊆ W(P); φ ∈ W(P)

Γ ` φ ⇐⇒ Γ  φ

• Theorem 1.19, soundness, states that Γ ` φ implies Γ  φ. • The above corollary states that Γ 0 φ implies Γ 2 φ. • Thus Γ ` φ ⇐⇒ Γ  φ. 

18 M3P65: Mathematical Logic 2: Predicate logic

2 Predicate logic

Predicate logic, also known as first order logic, allows use to express statements that use quantifiers such as ∀ and ∃. As with propositional logic, we will take two approaches: • The semantic approach will cover 1st order structures and formulae. • The syntactical approach will give a formal system for 1st order logic and allow deductions to be performed. The analogue of the completeness theorem for propositional logic will be Gödel’s completeness theorem.

2.1 First order structures, languages and formulas

Definition 2.1: Suppose A is a set and n ∈ Z+. • An n-ary relation on A is a subset of the form R ⊆ An

n A A × A × · · · × A { a ; : : : ; an ai ∈ A} = | {z } = ( 1 ): n times

n • An n-ary function of A is a well-defined map f : A → A.

Example 2.2: Some relations and functions • ≤ is a 2-ary (binary) relation on R. • + is a binary function on C. • x 7→ ex is a 1-ary (unary) function on C. • P ⊂ Z, the subset of prime numbers, is a unary relation on Z.

Definition 2.3: A first order structure A consists of (I) A non-empty set A which is called the domain of A.

ni (II) A set of relations on A, {Ri ⊆ A : i ∈ I; ni ∈ Z+}.

nj (III) A set of functions on A, {fj : A → A | j ∈ J; nj ∈ Z+}. (IV) A set of constants, {ck ∈ A : k ∈ K }. We can then write A = h A ; (Ri : i ∈ I); (fj : j ∈ J); (ck : k ∈ K )i |{z} | {z } | {z } | {z } domain relations functions constants

We call the information (ni; i ∈ I); (nj ; j ∈ J);K the signature of A.

Example 2.4: Some first order structures ; ≤ I { };J K ∅; n n : (Z≥0 ) is a structure with signature, = 1 = = ≤ = 1 = 2.

19 M3P65: Mathematical Logic 2: Predicate logic

: A group is a structure with: • equality as a binary relation, • a binary function (the group operation), • a unary function (element inversion) and • a constant (the identity element). : A field or ring is a structure with the same the same relations, functions and constants as a group plus: • a second binary function (multiplication) • a second constant (the multiplicative identity)

Definition 2.5: A first order language L consists of: V {v ; v ;::: } (I) A countable set of variables = 1 2 . (II) A set of connectives {∧; ∨; ¬; →; ↔; ⊥; ∀ ; ∃ } |{z} |{z} for all there exists

(III) Auxiliary symbols {(; ); }. (IV) A set of relations R = {Ri : i ∈ I}. (V) A set of functions, F = {fj : j ∈ J}. (VI) A set of constants, C = {Ck : k ∈ K }. : (VII) An equality symbol =.

Remark: A review of propositional logic Propositional logic had a set of elements E = P ∪ {∧; ∨; →; ↔; ¬; ⊥} ∪ {(; )}. We can consider the set Sf (E) = { all finite sequences of elements of E}. n ∗ S n If we view E as the set of all n-sequences of elements of E, then E E Sf E . = n∈Z≥0 = ( ) Note that W(P) ( Sf (E).

Accordingly, we can look at Sf (L) where L is a first order structure.

Definition 2.6: The set of L-terms Term(L) is the smallest set Term(L) ⊆ Sf (L) such that: (I) The set of variables V ⊆ Term(L), i.e. for all i ∈ I; vi ∈ Term(L). f ∈ F n t ; : : : ; t ∈ L f t ; : : : ; t ∈ L (II) If is an f -ary function and 1 nf Term( ), then ( 1 nf ) Term( ). Often we will drop the brackets and write ft1 ··· tnf . (III) The set of constants C ⊆ Term(L), i.e. for all k ∈ K ; ck ∈ Term(L).

Lord = {≤} ∪ {∧; ∨; ¬; →; ↔; ⊥; ∀; ∃} ∪ {(; ); }, where ≤ is a binary relation. Then we only have variables as terms, V = Term(Lord). L { ; f} ∪ · · · f 1 = + where + is a binary function and is a unary function. Then V ⊆ L • Term( 1) as before, ft ∈ L t ∈ L • i Term( 1) for all i Term( ) and

20 M3P65: Mathematical Logic 2: Predicate logic

• ti + tj ∈ Term(L) for all ti; tj ∈ Term(L).

Definition 2.7: The set of L-formulas, Form L, is the smallest subset of Sf (L) such that: (I) ⊥∈ Form(L). t ; : : : ; t ∈ L ⇒ R t ; : : : ; t ∈ L (II) 1 nR Term( ) = ( 1 nR ) Form( ). : t ; t ∈ L ⇒ t t ∈ L (III) 1 2 Term( ) = 1 = 2 Form( ). (IV) φ; ψ ∈ Form(L) =⇒ φψ ∈ Form(L), for any connective . (V) φ ∈ Form(L) =⇒ ¬φ ∈ Form(L). (VI) φ ∈ Form(L) =⇒ ∀vφ ∈ Form(L) and ∃vφ ∈ Form(L).

Example 2.8: Some examples of terms and formulas.

: Consider L = {≤} ∪ {c}, then Term(L) = V ∪ {c} and Form(L) = {vi ≤ vj ; vi ≤ c}. : L { } ∪ { } v ∈ L v v v ∈ L : = + 0 , then 0 + i Term( ) and 0 + i = i + 2 Form( ).

2.2 Interpretations of languages and assignments

Definition 2.9: φ ∈ L φ R t ; : : : ; t R ∈ R n t ; : : : ; t ∈ We say Form( ) is atomic if is of the form i( 1 ni ) where i is a i-ary relation and 1 ni Term(L).

Example 2.10: Suppose L has: • a binary function f, • a unary relation P, • a binary relation R and

• constants c1; c2. Then

v0; fv0v1; c1; fc1v0; ffc1v1c2 are all terms. : P v ;R v ; v ;R fc v ; c ; f c ; v c ( 0) ( 0 1) ( 1 0 2) ( 0 0) = 2 are all atomic formulas. ¬R v ; v ; ∀vR v; c ( 0 1) ( 0) are not atomic.

21 M3P65: Mathematical Logic 2: Predicate logic

Definition 2.11: Let L be a 1st order language with Rn ∈ R; i ∈ I a set of ni-arity relations, fj ∈ F; j ∈ J a set of mj -arity functions and ck ∈ C; k ∈ K a set of constants. An L-structure is a first order structure

A = hA; (Ri : i ∈ I); (fj : j ∈ J); (ck : k ∈ K )i of the same signature as L.

There is a correspondence between L and Ri; fj ; ck in A. This is called an of L.

Remark: Notation We write L R ∪ F ∪ C ∪ · · · = |{z} logical symbols and variables to define a language. If A is an L-structure, then: A • given Ri ∈ R, Ri is the interpretation of Ri in A. A • given fj ∈ F, fj is the interpretation of fj in A. A • given ck ∈ C, ck is the interpretation of ck in A.

Definition 2.12: Let L be 1st order language and A an L-str. A function β : V → A is called an A-assignment. We extend β to Term(L) as follows. A (I) t [β] = β(vi) if t = vi. A A (II) t [β] = ck if t = ck . A A A A (III) t β f t β ; : : : ; t β if t fj t ··· tm . [ ] = j ( 1 [ ] mj [ ]) = 1 j

; ; Example 2.13: (Z≥0 succ 0) ≥ Consider L = R = ∅ ∪ F = {succ} ∪ C = {0} ∪ ::: . We define β : V → A; vi 7→ i. We define succZ 0 (n) := n + 1. Then

Z≥ succ(0)[β] = succ 0 (0[β]) Z≥ Z≥ = succ 0 (0 0 ) Z≥ = 1 0

which implies vi[β] = i = β(vi). We can also show

v β Z≥0 v β succ(succ( 5))[ ] = succ (succ( 5)[ ]) Z≥0 Z≥0 v β = succ (succ ( 5[ ])) Z≥0 Z≥0 β v = succ (succ ( ( 5))) Z≥ = 7 0

Remark: Notation If A is an L-str. and β : V → A is an A-assignment. Then:

22 M3P65: Mathematical Logic 2: Predicate logic

• For a ∈ A, ( β(vi): vi =6 v β(a/v) = a : vi = v

• For v ∈ V ,

β(a/v): V → A; ( β(vi): vi =6 v vi 7→ a : vi = v

Definition 2.14: Suppose that L is a language and A is an L-str. Consider β : Term(L) → A an assignment function. Then a β valuation map on Form(L) is a function v : Form(L) → {0; 1} defined inductively as β (I) v (⊥) = 0. : t ; t ∈ L t t ∈ L (II) For two terms 1 2 Term( ) we have 1 = 2 Form( ). Then ( : tA β tA β v β t t 1 : 1 [ ] = 1 [ ] ( 1 = 2) = 0 : else

t ; : : : ; t ∈ L R t ··· t ∈ L (III) For terms 1 ni Term( ) we have i 1 ni Form( ). Then ( tA β ; : : : ; tA β ∈ R A v β R t ··· t 1 : ( 1 [ ] ni [ ]) i ( i 1 ni ) = 0 : else

β (IV) For φ; ψ ∈ Form(L), v (φψ) is defined as in the cases for propositional logic. β β (V) For φ ∈ Form(L), v (¬φ) = 1 − v (φ). β β a/w (VI) For φ ∈ Form(L), v (∀wφ) = min{v ( )(φ): a ∈ A} β β a/w (VII) For φ ∈ Form(L), v (∃wφ) = max{v ( )(φ): a ∈ A} β • If v (φ) = 1 we write A  φ[β]. • If for all A-assignments β we have A  φ[β], then we write A  φ and say φ is satsfied by A or A is a model of φ. • If for all L-structures A we have A  φ, then we write  φ and say that φ is logically valid.

2.3 Variable binding and subformulas Lemma 2.15: Suppose that A is an L-structure and that φ; ψ ∈ Form(L) are sentences. Then (I) A  φ ∧ ψ ⇐⇒ A  φ and A  ψ. (II) A  φ ∨ ψ ⇐⇒ A  φ or A  ψ. (III) A  ¬φ ⇐⇒ A 2 φ. (IV) A  (φ → ψ) ⇐⇒ (A  φ =⇒ A  ψ). Now suppose that φ ∈ Form(L) is a formula where the only free variable is v ∈ V . (V) A  (∀vφ) ⇐⇒ for all a ∈ A; A  φ[a]. (VI) A  (∃vφ) ⇐⇒ there exists a ∈ A; A  φ[a].

23 M3P65: Mathematical Logic 2: Predicate logic

Proof. The proofs of (I), (II) and (III) are obvious. β (IV) =⇒: Suppose that A  (φ → ψ); φ. Let β : V → A be any assignment. We want to show A  ψ[β] ⇐⇒ v (φ) = 1. β β β v (φ → ψ) = max{1 − v (φ); v (ψ)} β 1 = max{1 − 1; v (φ)} β v (φ) = 1

Exercise: Prove cases (V) and (VI).



Remark: Notation t ∈ L t v ; : : : ; v For Term( ) we write ( 1 n) where:

• the vis are distinct variables.

• all the variables appearing in t are {v1; : : : ; vn}.

Lemma 2.16: γ; β V → A A v ; : : : ; v i ≤ i ≤ n Suppose : are two -assignments which agree on variables 1 n, i.e. for all : 1 , γ v β v t v ; : : : ; v ∈ L ; tA γ tA β ( i) = ( i). Then for ( 1 n) Term( ) [ ] = [ ].

Exercise: Prove the above.

Example: L {R } L V Rv v Consider = i a language with a single binary relation. The terms are therefore Term( ) = and 0 1 is ∀v Rv v ψ an . If Ψ = 0 0 1 is another formula, we note that is a sub-formula of φ ∀v ∀v Rv v ∧ ∃v Rv v = (( 0 0 ) ( 0 0 1)) | {z } ψ

Definition 2.17: Suppose that φ; ψ are L-formulas and ∀xiφ occurs as a subformula of ψ, i.e. ψ = ··· (∀xiφ) ··· . Then we say that φ is the scope of the quantifier ∀xi in ψ.

An occurrence of a variable xi in ψ is bounded if it is in the scope of a quantifier (∀xi) in ψ (for some sub-formula φ). If a variable is not in the scope of any quantifier, it has a free occurrence. Variables with a free occurrence in ψ are called free variables of ψ.

Example: L {R ;R } R Suppose = 1 2 where i are binary relations. ∀x R x x → R x x 1 (( 1 1 2) ( 2 1 2)) | {z } scope of ∀x1 In the equation above:

24 M3P65: Mathematical Logic 2: Predicate logic

• x1 is bound.

• x2 has free occurrence.

∀x R x x → R x x (( 1 ( 1 1 2) ) ( 2 1 2)) | {z } scope of ∀x1 In the equation above:

• The first x1 is bound, the second one is free.

• As before, x2 has free occurrence.

∃x R x x → ∀x R x x (( 1 ( 1 1 2) ) ( 2 ( 2 2 3))) | {z } | {z } scope of ∃x1 scope of∀x2

• x1 is bound.

• The first x2 has free occurrence, the second one is bound.

• x3 has free occurrence.

Definition 2.18: A formula φ ∈ Form(L) is called a sentence if it has no free variables.

Example: For L = {R}, (∀x; Rxx) ∈ Form(L) is a sentence.

Remark: Notation φ ∈ L φ v ; : : : ; v For Form( ), write ( 1 n) when

• the vis are distinct variables.

• the vis are the only free variables appearing in φ.

Lemma 2.19: β; γ A v ; : : : ; v φ ∈ L ; φ v ; : : : ; v Suppose are two -assignments which agree in 1 n and let Form( ) ( 1 n). Then β γ v (φ) = v (φ)

Exercise: Prove the above using induction.

Remark: Notation β V → A A L A φ v ; : : : ; v ∈ L Let : where is the domain of an -str. . Let ( 1 n) Form( ). We write A φ a ; : : : ; a  [ 1 n]

when A  φ[β] and β(vi) = ai for all 1 ≤ i ≤ n.

Recall φ is logically valid if for all L-structures A, we have A  φ.

25 M3P65: Mathematical Logic 2: Predicate logic

Example: : A Consider the formula v = v and let β : V → A; v 7→ a be an assignment for some L-str. A. Then as v [β] = A β : v [β] =⇒ v (v = v) = 1.

Exercise: Show that the following formula is logically valid.

∃v ∀v φ → ∀v ∃v φ ( 1( 2 )) ( 2( 1 )) i.e. an existential quantifier can be moved behind a universal quantifier in its scope.

Corollary: (Lemma 2.19) Suppose φ is a sentence, then either A  φ or A  ¬φ.

For an L-structure A, we write Con(A) = {φ ∈ Form(L): φ is a sentence; A  φ}.

2.4 Substitution P θ ∈ W P p ; : : : ; p θ φ ; : : : ; φ ∈ L ψ Given a non-empty set , suppose ( ) is such that 1 n appear in . Let 1 n Form( ) and let be the formula arrived at by substituting pi in θ with φi. We claim that ψ ∈ Form(L).

Exercise: Prove this by inducting on θ ∈ W(P).

β V → A A v β φ ; : : : ; v β φ x ; ;::: ∈ { ; }n v β ψ Given : an -assignment, we can consider ( ( 1) ( n)) as ¯ = (0 1 ) 0 1 . Thus ( ) = Fθ(x¯).

Corollary: θ θ p ; : : : ; p φ ; : : : ; φ ∈ L ψ ∈ L If = ( 1 n) is a propositional tautology and 1 n Form( ). Then Form( ) defined by replacing each pi in θ with φi is a logically valid formula.

Similar to propositional logic, we can define a substitution.

Definition 2.20: Suppose t; s ∈ Term(L); v ∈ V . Then we define sbt/vc as follows: ( t : vi = v • If s = vi, then sbt/vc = . vi; vi =6 v • If s = c, then sbt/vc = cbt/vc = c. s ft ··· t sbt/vc ft bt/vc · · · t bt/vc • If = 1 mj , then = 1 mj . We can therefore see that substitution is an operator on Term(L).

This can now be extended to formulas.

26 M3P65: Mathematical Logic 2: Predicate logic

Definition 2.21: Let φ ∈ Form(L), then we define φbt/vc as follows: • ⊥ bt/vc =⊥. Rt ··· t bt/vc Rt bt/vc · · · t bt/vc • 1 ni = 1 ni . : : t t bt/vc t bt/vc t bt/vc • ( 1 = 2) = 1 = 2 . • (φψ)bt/vc = φbt/vcψbt/vc (as in propositional logic). ( ∀vi(φbt/vc): v =6 vi • (∀viφ(vi))bt/vc = . ∀viφ(vi): v = vi • (∃viφ)bt/vc is defined analogously.

Example: We must be wary of situations like below, consider

ψ(y) = ∃x(x < y)

and the substitution ψbx/yc = ∃x(x < x). We do not want this to happen so there must be further guards put in place against similarly illegal substitutions. For now, assume that substitutions can only be performed on sentences. A result on the valuation of any substitution is given by Lemma 2.43

2.5 Some examples of structures

Define 0 = ∅; n = {0; 1; : : : ; n − 1} and N = the set of all natural numbers. Consider the structures A hm; ∈; ; ; s i 1 = ˙ 0 +m 1 A h ; <; s ; ; i 2 = N 1 + 0 A h ; <; s ; ·; i 3 = N 2 1 where

• For A1 – For i; j ∈ m = {0; 1; : : : ; m − 1}, j∈˙ i if j 3 i as sets. ( a { ; ; : : : ; a} a ≤ m s m → m; a 7→ + 1 = 0 1 : + 1 – 1 : . 0 : else – +m is defined through repeated addition.

• For A2 – n < m is the usual order on N. s → ; a 7→ a – 1 : N N + 1. – + : N × N → N; (a; b) 7→ a + b.

• For A3 – n < m is the usual order on N. s → ; a 7→ a – 2 : N N + 2. – · : N × N → N; (a; b) 7→ a · b. These are all L-structures where L { R } ∪ { f ; f } ∪ { c } = 2 1 2 |{z} |{z} |{z} |{z} binary unary binary constant

27 M3P65: Mathematical Logic 2: Predicate logic

R v ; v ∈ L Let 2( 1 2) Form( ). Then A R 1 v ; v v ∈v 2 ( 1 2) = 1 ˙ 2 A R 1 v ; v v < v 1 ( 1 2) = 1 2

Some L-terms are c; vi; f1vi; f1f1f1vi and f2f1f1cf1c. Then A c 1 = 0 A c 2 = 0 A c 3 = 1 A A f c 1 f 1 s ( 1 ) = 1 0 = 1(0) = 1 A A f c 2 f 2 s ( 1 ) = 1 0 = 1(0) = 1 A A f c 3 f 3 s ( 1 ) = 1 1 = 2(1) = 3

β V {v ; : : : ; v } → m A β v i Let 1 : = 1 m be an 1-assignment defined by 1( i) = . Then A A R 1 v ; v bβ c R 1 v bβ c; v bβ c 2 ( 1 2) 1 = 2 ( 1 1 2 1 ) A R 1 ; = 2 (1 2) = 1∈˙ 2 thus A1 2 R2v1v2bβ1c. : : ψ ∀x ¬ x c → ∃y f y x ∈ L Define = ( ( ( = ) ( 1( ) = ))) Form( ). As this has no free variables, this is a sentence. It can be shown : A that A ψ; A ψ. However, A ψ since we have ¬ and yet that there is no y such that f 3 y . 1  2  3 2 (0 = 1) 1 ( ) = 0

Exercise: − Consider the group structure G = (G; =; ·; 1; e). G models the following sentences. • ∀x∀y∀z ((x · y) · z) = (x · (y · z)). • ∀x x · e = e · x = x. − − • ∀x x · x 1 = e = x 1 · x. A natural question is whether ∀x∀y x · y = y · x

2.6 Variable scoping

Definition 2.22: Let φ ∈ Form(L); t ∈ Term(L) and vi ∈ V a variable in φ. Then we say t is free from vi in φ if for every variable vj ∈ t, vi is not in the scope of ∀vj nor ∃vj in φ.

Example: Some examples of variable scoping.

: Consider the language L = {<} and the formula φ = ∀x x < y. The term t = x is not free from y in φ as y appears in the scope of ∀x. : Consider the language L { f } ∪ { R } ∪ { K }. = |{z} |{z} |{z} 3-ary binary unary t fx x x φ ∀x Rx x → K x → ∀x Rx x t x x φ Let = 1 2 3 and = ( 2 2 4 1) ( 1 1 2). Then is not free from 2 (or 4) in . But for ψ ∀x Rx x → ∀x K x t x ψ = ( 4 4 2) ( 1 1), is free for 4 in .

28 M3P65: Mathematical Logic 2: Predicate logic

Lemma 2.23: Suppose φ ∈ Form(L), vi is a free variable in φ and let t be an L-term that is free from vi in φ. Then

 ((∀vi φ(vi)) → φ(t))

Proof. For all L-structures A and all A-assignments β, we want to show

A  ((∀vi φ(vi)) → φ(t))bβc Suppose note, then we have

v β ∀v φ v → φ t (( 1 ( i)) ( )) = 0 ⇒ v β ∀v φ v v β φ t = ( 1 ( i)) = 1 and ( ( )) = 0 β a/vi β =⇒ for all a ∈ A; v ( )(φ(vi)) = 1 and v (φ(t)) = 0

A β b/vi Letting b = t bβc ∈ A, we have v ( )(φ(vi)) = 1 which is a contradiction. Thus

A  ((∀vi φ(vi)) → φ(t))bβc which completes the proof. 

Definition 2.24: Suppose Γ ⊆ Form(L), A is an L-structure and β is an A-assignment. We write A  Γbβc if A  ψbβc for all ψ ∈ Γ. We write Γ  φ if for all L-structures A and A-assignments β, A  Γbβc =⇒ A  φbβc.

Recall Lemma 2.15, we can bring an A-assignment β into the statement and write, for example, A  ¬φbβc ⇐⇒ A 2 φbβc. The assumption in the lemma was that the consequences were sentences. However, we can modify the lemma and examine cases when the consequences are not sentences.

Exercise: Find a counterexample to A  ¬φbβc ⇐⇒ A 2 φbβc for when φ is not a sentence.

Lemma 2.25: φ v ; : : : ; φ ∈ L Suppose ( 1 n) Form( ). Then A φ v ; : : : ; v ⇐⇒ ∀v ··· v φ v ; : : : ; v  ( 1 n) 1 n ( 1 n) ∀v ··· v ∀v ∀v · · · ∀v where 1 n = 1 2 n.

Proof. If for all A-assignments β, we have

A φ v ; : : : ; v bβc ⇐⇒ A φba ; : : : ; a c a β v β V → A  ( 1 n)  1 n where i = ( i) for all : n ⇐⇒ A φba ; : : : ; anc for all ai ⊂ A  1 ( )i=1 dom β a /v ;:::;a /v ⇐⇒ v ( 1 1 n n) φ v ; : : : ; v ( ( 1 n)) ⇐⇒ A φ v ; : : : ; v bβ a /v ; : : : ; a /v c  ( 1 n) ( 1 1 n n) ⇐⇒ A ∀v ··· v φ v ; : : : ; v bβc  1 n ( 1 n)

Which completes the proof. 

29 M3P65: Mathematical Logic 2: Predicate logic

Lemma 2.26: Let φ ∈ Form(L). Then (i)  ¬∀x φ ↔ ∃x ¬φ. (ii)  ¬∃x φ ↔ ∀x ¬φ. (iii)  ∀x φ ↔ ¬(∃x ¬φ) (iv)  ∃x φ ↔ ¬(∀x ¬φ)

Proof. Easy exercise. 

Corollary 2.27: Let φ ∈ Form(L), then there exist ψ ∈ Form(L) (with the same number of free variables) s.t.  φ ↔ ψ and ψ has only the connectives {∧; →; ⊥; ∀}.

Noting that  ¬φ ↔ (φ →⊥) we see that this corollary holds.

Lemma 2.28: Suppose φ; θ ∈ Form(L) and v ∈ V is not a free variable in θ. Then

 ∀v (θ → φ(v)) =⇒  θ =⇒ ∀v φ(v)

Proof. For A an L-structure and β an A-assignment. We want to show

A  ∀v (θ → φ(v))bβc =⇒ A  θ =⇒ ∀v φ(v)bβc

β β β β β a/v Suppose v (∀v (θ → φ(v))) = 1 and that v (θ → ∀v φ(v)) = 0. Then v (θ) = 1 and v (∀v φ(v)) = min{v ( )(φ(v)) : a ∈ A} = 0. Thus ∃a ∈ A s.t. A  ¬φ(v)ba/vc. β b/v β β b/v By assumption we have v ( )(θ → φ(v)) = 1 for all b ∈ A. So if v (θ) = 1, we have v ( )(φ(v)) = 1 for all b ∈ A. This raises a contradiction when b = a. 

2.7 Natural Deduction As in propositional logic we wish to make sense of ‘deducing’ one statement from another. This was done by defining certain rules that can be used to convert one set of statements into another. We define natural deduction for predicate logic similarly. In fact, we only introduce two additional rules to the set defined in subsection 1.4.

D ∀ introduction If we can deduce and x is not free for any uncancelled hypothesis of D, then we can write φ(x) D φ(x) This is called ∀ introduction.

∀ elimination If we can deduce ∀v φ(v), then for t ∈ Term(L) which is free from v in φ, we can write ∀v φ v ( ) (∀E) φ(t) This is called ∀ elimination. We define syntactic consequence as done in Definition 1.18.

30 M3P65: Mathematical Logic 2: Predicate logic

Lemma 2.29: Soundness Let Γ ⊆ Form(L). Then Γ ` φ =⇒ Γ  φ

Proof. As before, we induct on the length of proofs. All the rules apart from ∀I and ∀E are exactly the same as in propositional logic (check this as an exercise). It therefore remains to check the soundness of ∀I and ∀E. 

Before we prove this, we provide an additional lemma.

Lemma 2.30: Let Γ ⊆ Form(L). Γ ` φ(v) =⇒ Γ ` ∀v φ(v) if v is not a free variable (it cannot be a bound variable since it’s free in φ) in Γ.

Which is an obvious conclusion of the ∀ introduction rule.

Returning to the proof of soundness. We need to show Γ  φ(x) =⇒ Γ  ∀x φ(x) (a conclusion of the previous lemma).

Suppose that for all A an L-structure and β an A-assignment we have A  φ(x)bβc. It follows using a similar method to Lemma 2.25 that A  (∀x φ(x))bβc.

Exercise: Use Lemma 1.25 to prove soundness for ∀ introduction.

We have previously show that ∀ introduction is a sound deduction rule.

Exercise: Using the same method as Lemma 2.23, show that ∀ elimination is sound.

Exercise: Some natural deductions. : Show ` (∀v (φ ∧ ψ)) → ((∀v φ) ∧ (∀v ψ)). : Suppose that v is not a free variable of θ. Show

` (∀v (θ → φ(v)) → (θ → ∀v (φ(v)))) : Suppose that v is not free in φ. Show that

φ ↔ ∀v φ

31 M3P65: Mathematical Logic 2: Predicate logic

2.8 Completeness and the model existence lemma

As before, would like to show that Γ  φ =⇒ Γ ` φ (completeness). This is again done by showing that Γ 0 φ =⇒ Γ 2 φ. A result that we first need to assume is the model existence lemma.

Lemma 2.32: Model existence If Γ is a set of L-sentences which is consistent (Γ 0⊥), then there is an L-structure A (a model) where A  Γ.

Sketch proof of completeness. Recall that Γ ⊆ Form(L) is inconsistent if Γ `⊥ and that for Γ a consistent set of formulas Γ 0 φ =⇒ Γ ∪ {¬φ} is consistent (Lemma 1.25). With this suppose that Γ 0 φ i.e. Γ∪{¬φ} is consistent. Then we have a model A such that A  Γ∪{¬φ} =⇒ A 2 φ. 

Definition 2.31: Let L be a language.

2.31.1: A theory is a collection of L-sentences T ⊆ Form(L) such that

T ` φ =⇒ φ ∈ T (T is closed under deductions).

2.31.2: Suppose T is a theory, we call Γ ⊆ Form(L) a set of axioms of T if T = {φ ∈ Form(L) a sentence : Γ ` φ}.

2.31.3: A theory T is called Henkin theory if for each sentence of the form ∃x φ(x), there is a constant c ∈ L such that (∃x φ(x) → φ(c)) ∈ T Such a constant is called a Henkin witness.

2.31.4: Suppose T and T 0 are two theories of two languages L and L0 respectively. T 0 is an extension of T if T ⊆ T 0.

So to prove completeness, we just need to prove the model existence lemma. The broad steps are as follows: ∗ ∗ ∗ ∗ • Expand the language L to L by constants and expand Γ to Γ where Γ is a Henkin theory in L . ∗ ∗ • By the Lindenbaum lemma (an extension of Lemma 1.31) we extend Γ in L to a maximally consistent set. ∗ • Build the structure A = {t : t a constant term in L } (the model existence lemma).

2.8.1 Extension by constants and Henkin extensions

Definition 2.33: Let T be an L-theory. For each formula of the form θ = ∃v φ(v) in L, add a constant cθ such that distinct θs yield distinct cθs. Call the resulting language L∗ and define T ∗ to be the theory of axioms

T ∪ {∃v φ(v) → φ(cθ): θ = ∃v φ(v) is a sentence}

We call such an extension an extension by constants. ∗ We write L = L ∪ C, C = {cθ : θ is a sentence of the form ∃v φ(v)}.

32 M3P65: Mathematical Logic 2: Predicate logic

Lemma 2.34: Let T be a theory and T ∗ the extension by constants. Then

∗ T = Form(L) ∩ T i.e. the only L-formulas (those that do not rely on the new constants c) in T ∗ are those already in T . To prove we use the following lemma.

Lemma 2.35: Let Γ be a set of L-sentences. If Γ ∪ {∃v φ(v) → φ(c)} ` ψ where c is a constant not occurring in Γ and ψ, then

Γ ` ψ

We leave the proof of this lemma till later.

Proof, Lemma 2.34. Since T is set of L-sentences closed under deductions (T ` ψ =⇒ ψ ∈ T ), it is enough show ∗ that for an L-sentence ψ, T ` ψ =⇒ T ` ψ. This implies

T ∪ {σ1; : : : ; σn} ` ψ where σi are the new axioms. Note that each σi will be in the form required by Lemma 2.35. Moreover since each ψ is an L-sentence, it will not contain a new constant from L∗. n n T ∪ {σ ; : : : ; σ } ` ψ Proceed by induction on . We immediately see that this holds for = 0. Suppose that 1 k+1 and let T T ∪ {σ ; : : : ; σ } k = 1 k . By applying Lemma 2.35 and our inductive hypothesis, we conclude that T ` ψ. 

Corollary: If T is consistent, then T ∗ is consistent.

Proof. Suppose that T is consistent. ⊥ is an L-sentence which doesn’t contain any constants. By Lemma 2.34 we ∗ have that if T `⊥ then T `⊥ which is a contradiction. 

A natural question to ask at this point is whether T ∗ is a Henkin theory? This is not necessarily true and so we must define another kind extension that does yield a Henkin theory.

Definition 2.36: T T T T ∗ L Let 0 = and inductively define n+1 = ( n) , which is a set of sentences in an n-language. S Define Tω Tn which is a theory in an Lω-language. = n∈Z≥0

Lemma 2.37: Tω is a Henkin theory.

Proof. We show that Tω is in fact a theory and that it is Henkin.

(I) Suppose that Tω ` ψ, we want to show that ψ ∈ Tω.

• We then have {σ1; : : : ; σr} ` ψ where each σi ∈ Tni .

• Note that we have Ti ⊆ Ti+1 ⊆ · · · .

33 M3P65: Mathematical Logic 2: Predicate logic

• Let m = max{ni : i ≤ r}.

• Note that for all i ≤ m, for all σi ∈ Ti we have σi ∈ Tm.

• This implies Tm ` ψ and so ψ ∈ Tm since Tm is a theory.

• Thus Tω is a theory. ψ ∃v φ v L n ∈ T c ∈ L (II) Suppose that = ( ) is an n-sentence for some Z≥0. By the construction of the is we have n+1 ∃v φ v → φ c ∈ T ⊆ T T such that ( ( ) ( )) n+1 ω. Thus ω is a Henkin theory. 

Lemma 2.38: Let T be a theory, then Tω ∩ Form(L) = T

Proof. Again, it is enough to show that Tω ` ψ =⇒ T ` ψ for an L-sentence ψ. Tω ` ψ =⇒ Tn ` ψ, by induction we have T ` ψ. 

Corollary 2.39: When T is consistent, then there is a consistent Henkin extension Tω of T .

Remark: We are assuming that |L| is countable which implies that | Form(L)| is also countable. Thus |Lω| is also countable.

We must now extend our theory so that it is maximally consistent, i.e. any additional sentence will render the theory inconsistent.

Lemma 2.40: Lindenbaum Every consistent theory is contained in a maximally consistent theory within the same language.

Proof. Extend the proof of Lemma 1.31. Requires use of Zorn’s lemma. 

We confirm that the Lindenbaum extension is in fact a Henkin theory.

Lemma 2.41: Any extension of a Henkin theory in the same language is a Henkin theory.

Exercise: Prove the above.

All that remains now is to construct the structure as required by the model existence lemma. m Let our maximally consistent Henkin extension of T be T . Consider A = {t : t is a closed Lω-term}, i.e. t is a term without any variables. We define a structure on this set of symbols. A • For all c ∈ Lω, c = c. ft ··· t f At ··· t ft ··· t f L n → L • For all 1 n, 1 n = 1 n. Note this is well defined as : Term( ω) Term( ω) can be restricted to An. A m • We define that R t1 ··· tn holds iff T ` Rt1 ··· tn. We complete this proof later.

34 M3P65: Mathematical Logic 2: Predicate logic

2.8.2 The proof of Lemma 2.35

Suppose Γ ∪ {∃v φ(v) → φ(c)} ` ψ where c a constant does not occur in Γ or ψ. We want to show Γ ` ψ. (I) Suppose that Γ ` φ and that v is a variable not occurring in either Γ and φ. Then Γbv/cc ` φbv/cc. Sketch. A proof of Γ ` φ is still valid on replacing v with c. A formal proof would utilise induction on proof length.  (II) If c does not occur in Γ, then Γ ` φ(c) implies Γ ` ∀v φ(v). Proof. Apply the previous statement and the ∀I rule.  (III) If x is not a free variable ψ, then ` ∀x φ x → ψ → ∃x φ x → ψ ( ( 1( ) )) ( 1( ) ) Proof. We note that ` (θ → ξ) ↔ (¬ξ → ¬θ). So we will show that ` ∀x ¬ψ → ¬φ x → ¬ψ → ¬∃x φ x ( ( 1( ))) ( 1( )) ((( ∀x(¬(ψ(→( ¬φ x ( ( 1( )) (∀E) ¬ψ → ¬φ c ¬ψ 1( )  (MP) ¬φ c 1( ) (∀I) ∀x¬φ x ¬∃xφ x 1( ): 1( ) (→I) ¬ψ → ¬∃x φ 1 (→I) ∀x ¬ψ → ¬φ x → ¬ψ → ¬∃x φ ( 1( )) ( 1)  (IV) We are now in a position to prove the lemma.

Proof, Lemma 2.35. Suppose we have Γ ` (∃v φ(v) → φ(c)) → ψ. • By a previous statement, this implies Γ ` ∀y((∃v φ(v) → φ(y)) → ψ) where y is a variable not occurring in Γ; ψ; φ. • This implies Γ ` (∃y (∃v φ(v) → φ(y))) → ψ. • With a little work, it can be show that Γ ` (∃v φ(v) → ∃y φ(y)) → ψ. • It is clear that ` (∃v φ(v) → ∃y φ(y)) and so we have Γ ` ψ. 

2.8.3 Proof of the model existence lemma

Recall that given a theory T ⊆ Form(L), we define Tω ⊆ Form(Lω) to be the Henkin extension of the theory in the m extended language Lω. T ⊆ Form(Lω) is then defined to be the maximally consistent extension of Tω, and thus the maximally consistent Henkin extension of T .

The domain of our potential structure is defined to be A = {t : t is a closed Lω-term}. Recall that a term is closed if it contains no variables. And so we define A by: A • For all c ∈ Lω, c = c. ft ··· t f At ··· t ft ··· t • For all 1 n, 1 n = 1 n. Defined as a restriction. A m • R t1 ··· tn holds iff T ` Rt1 ··· tn.

Remark: Note that for φ ∈ Lω a sentence Form( ) m A  φ ⇐⇒ T ` φ is not an obvious fact.

35 M3P65: Mathematical Logic 2: Predicate logic

Proof. We proceed using induction on Form(Lω). • The first case is ⊥. This is clear because both T m 0⊥ and A 2⊥. R ∈ L φ R t ; : : : ; t t ∈ A i A φ T m ` φ • Suppose that for ω we have = ( 1 m) where i for all . We clearly have  , follows from the interpretation of R in A.

• Suppose φ = ¬ψ where the inductive hypothesis holds for ψ. A  φ ⇐⇒ A  ¬ψ ⇐⇒ A 2 ψ m ⇐⇒ T 0 ψ since T m is maximally consistent, we have T m ` ¬ψ ⇐⇒ T m ` φ.

• Suppose φ = θ ∧ ψ where both θ and ψ satisfy the inductive hypothesis. A  φ ⇐⇒ A  θ ∧ ψ ⇐⇒ both A  {θ; ψ} ⇐⇒ both T m ` {θ; ψ} (inductive hypothesis) ⇐⇒ T m ` θ ∧ ψ ⇐⇒ T m ` φ

• Suppose φ = ∀x ψ(x) where ψ satisfies the inductive hypothesis. A  φ ⇐⇒ A  ∀x ψ(x) ⇐⇒ A 2 ∃x ¬ψ(x) ⇐⇒ A 2 ¬ψbac for all a ∈ A ⇐⇒ A  ψbac for all a ∈ A

Note that A 2 ¬ψbac for all a ∈ A but in particular for cθ where θ = ∃x ¬ψ(x). Since we have A  ψbcθc, we can m m m use the induction hypothesis to conclude T ` ψ(cθ). Since T is a Henkin theory we have T ` ∃x ¬ψ(x) → m ¬ψ(cθ) where θ = ∃x ¬ψ(x). Consequently, we have T ` ψ(cθ) → ∀x ψ(x). Thus m m T ` {ψ(cθ); ψ(cθ) → ∀x ψ(x)} =⇒ T ` ∀x ψ(x)

m m For the other direction, suppose T ` ∀x ψ(x). Then for all t where t is free for x in ψ(x) we have T ` ψ(t), particularly for all closed terms t of Lω.

Thus A  ψbtc for all t ∈ A which implies A  ∀x ψ(x). • Consider φ = θ → ψ where θ; ψ satisfy the inductive hypothesis. – A  θ → ψ if and only if A  θ =⇒ A  ψ. m m – By the induction hypothesis we have T ` θ =⇒ T ` ψ. – Thus T m ` θ . . T m ` ψ m m m (→I) T ` θ → T ` ψ : T → θ → ψ Which completes the proof.  : This proof omits the completeness: of the =, but this is not an ordinary relation or connective. The issue is that we never defined deductive rules for =. : We now define the deductive rules for =.

36 M3P65: Mathematical Logic 2: Predicate logic

• : RI1 x = x : x = y • : RI2 y = x : : x = y y = z • : RI3 x = y : : : x y x y ··· xn yn φ x ; : : : ; xn • 1 = 1 1 = 1 = ( 1 ) RI4 φ y ; : : : ; y ( 1 n) : : : x y x y ··· x y t x ; : : : ; x 1 = 1 1 = 1 n = n ( 1 n) • The fourth rule can also be written as : RI4 , note that this is equiv- t x ; : : : ; x t y ; : : : ; y ( 1 n) = ( 1 n) alent to the formulation above. Soundness and completeness of these rules are easy and shall be proven shortly. m Another: implication of these rules is that we can construct a new relation between terms. For t; s ∈ A; t ∼ s ⇐⇒ T ` t = s. This is an equivalence relation due to the rules we have just defined, so the quotient structure is well defined. Explicitly A/ ∼= hA/ ∼;:::i where: A/∼ A • For c ∈ Lω; c = [c ].

• For f ∈ Lω

A/∼ f : A/ ∼→ A/ ∼ f A/∼ tA/∼; : : : ; tA/∼ f A tA; : : : ; tA ( 1 nf ) = [ ( 1 nf )]

• For R ∈ Lω R A/∼ tA/∼; : : : ; tA/∼ ⇐⇒ tA; : : : ; tA ∈ R A ( 1 nR ) ( 1 nR ) This means that the structure defined in the model existence lemma is unique up to this equivalence. Returning to the rules of identity defined previously.

Example: Some examples of the rules of identity. : x y x2 y2 > : = + 2 RI4 2y2 > 2 : x y x2 y2 > : = + 2 RI4 2x2 > 2 : A few important sentences concerning = are given below: : • I1: ∀x x = x : : • I2: ∀x∀y x = y ↔ y = x : : : • I3: ∀x∀y∀z x = y ∧ y = z → x = z | {z } ∀xyz Vn : : • I4: ∀x ··· xn∀y ··· yn xi yi → t x ; : : : ; xn t y ; : : : ; tn for a term t depending on variables xi. 1 1 ( i=1 = ( 1 ) = ( 1 )) Vn : • Note that I4 is equivalent to writing ∀x ··· xn∀y ··· yn xi yi ∧ φ x ; : : : ; xn → φ y ; : : : ; tn for a formula 1 1 ( i=1 = ( 1 ) ( 1 )) φ depending on variables xi.

Lemma 2.42: For each of the Ij above, we have ` Ij.

37 M3P65: Mathematical Logic 2: Predicate logic

: Proof. This follows from the rules of ∀ or just by using Lemma 2.30 on our rules for =. 

It follows from Lemma 2.42 that the relation defined in our proof of completeness is indeed an equivalence relation.

2.9 Soundness of equality deduction rules Showing that the rules RI1 through RI3 are sound is trivial. They all rely on the fact that : : ` x = x =⇒  x = x : : Noting that  x = x is equivalent to stating that for all A an L-structure and all β an A-assignment we have A  x = xbβc.

Proof, soundness of RI4. We will use the formulation of RI4 for terms. • If t is a constant then there is nothing to prove and we are done. : : L A f A x ; : : : ; x f A y ; : : : ; y x y ··· x y • For an -structure we automatically have ( 1 n) = ( 1 n) if 1 = 1 n = n. • Using induction on formulas, proving RI4 is an easy exercise. 

Recall our definition of the substitution of a term with a variable. Given t ∈ Term(L), v a variable and φ ∈ Form(L). φbt/vc is defined inductively as:

• ⊥ bt/vc =⊥. Rt ··· t bt/vc Rt bt/vc · · · t bt/vc • 1 ni = 1 ni . : : t t bt/vc t bt/vc t bt/vc • ( 1 = 2) = 1 = 2 . • (φψ)bt/vc = φbt/vcψbt/vc (as in propositional logic). ( ∀vi(φbt/vc): v =6 vi • (∀viφ(vi))bt/vc = . ∀viφ(vi): v = vi • (∃viφ)bt/vc is defined analogously. There were issues in assigning semantic meaning to φ wen it was not a sentence. These are now alleviated by the following lemma.

Lemma 2.43: Suppose β is an A-assignment for an L-structure A. Then we have

β βbtAbβc/vc v (φbt/vc) = v (φ(v))

Proof. Induction on formulas and use of the following lemma. 

Lemma 2.44: Given β an A-assignment and s; t ∈ Term(L) we have

A A A (tbs/vc) bβc = t bβ(s bβc/v)c

Proof. Induction on Term(L). • For t = c a constant, the proof is clear. tbs/vc = c A A c bβc = c A = tbβ(s bβc/v)c A = c

38 M3P65: Mathematical Logic 2: Predicate logic

• The same argument as above holds for t = vi a variable. t ft ··· t tbs/vc ft bs/vc · · · t bs/vc • Now suppose that = 1 m. By the definition of substitution we have = 1 m . Then tbs/bc Abβc f A t bs/vc Abβc · · · t bs/vc Abβc ( ) = ( 1 ) ( m ) f AtAbβ sAbβc/v c · · · tAbβ sAbβc/v c = 1 ( ) m ( ) ft ··· t Abβ sAbβc/v c = ( 1 m) ( )



Remark: The above lemma was used in the proof of Lemma 2.23

2.10 Some conclusions of the completeness theorem

Theorem 2.45: Compactness Suppose that Σ is a set of L-sentences. Then Σ has a model if and only if every finite subset of Σ has a model.

Proof. The only if direction is trivial. For the if direction, suppose that every finite subset of Σ has a model and suppose for a contradiction that Σ does not have a model. We then have Σ `⊥ by completeness. ⊆ `⊥ This implies that there is a finite subset Σ0 Σ such that Σ0 . Which is a contradiction since an inconsistent theory cannot have a model. 

Theorem 2.46: Downward Löwenheim-Skolem Suppose L is a countable first order language and that A is an L-structure. Let

T = Th(A) := {θ : A  θ and θ ∈ Form(L) is a sentence}

Then there is a countable model B such that B  T .

Example: Though this might seem strange, we can show that given

R = (R; +; ·; <; exp; 0; 1)

which is interpreted as in real analysis, there is a countable model for Th(R).

Proof, Theorem 2.46. Because L is a countable language, T is at most a countable set of L-sentences. By the proof of the completeness theorem, there is a countable model of T . 

It can be shown by the “Lindström theorem” that predicate logic is the “strongest” logic that satisfies both compactness and Löwenheim-Skolem. An example of the two theorems in use is by applying them to the Peano arithmetic.

Example: Consider the structure N = hN; <; succ; 0i where the interpretation is the usual one. The Peano arithmetic on a language L = {<} ∪ {succ} ∪ {0} is the theory consisting of the following axioms. : : P1 • ∀x∀y x = y ↔ succ(x) = succ(y) P2 • ∀x x < succ(x)

39 M3P65: Mathematical Logic 2: Predicate logic

: P3 • ¬(∃y succ(y) = 0) : : P4 • ∀x(¬(x = 0) → ∃y (succ(y) = x)) : P5 • ∀x ¬(succ(x) = x) : P6 • ∀x∃y succ(x) = y

Consider Th(N ) defined as above. It is clear that N is a model for the Pi and so we have Th(N ) Pi for i= 1;:::; 6. Consider the language Lc = L ∪ {c} where c is a new constant, one not in L. Write

tm(x) := succ(succ(··· succ(x) ··· )) | {z } mapplications

N e.g. tm (0) = 2. Now consider the formula φm = (tm(0) < c) ∈ Form(Lc) and let Σ = {φm : m ∈ N}. We claim that Σ ∪ Th(N ) has a model in Lc.

⊆ ∪ N ∪ N Proof. If we can show that every finite subset Σ0 Σ Th( ) has a model, then Σ will have a model by the compactness theorem. • Let 1 ∪ 2 where 1 ⊆ and 2 ⊆ Th N . Σ0 = Σ0 Σ0 Σ0 Σ Σ0 ( ) • Note that Th N is a theory and thus closed under deductions so we naturally have N 1 by soundness. ( )  Σ0

• We have 1 {φm ; : : : ; φm } for some mj . Explicitly φm c > tm for all ≤ i ≤ j. Σ0 = 1 j i = i (0) 1

• Since mr < ms implies tm < tm , if we have φm for m {m ; : : : ; mj } then all the formulas in 1 are r (0) s (0) = max 1 Σ0 satisfied.

• Consider the structure Nm hN; succ; ; m i. Since N ⊆ Nm we have Nm  2. Thus Nm  = 0 | {z+ 1} Σ0 Σ0 =c

Nm • c m > tm which implies that Nm 1. = + 1 (0)  Σ0 N • So for every Σ0 we have m  Σ0 and so by compactness we have a model for Σ. 

Note that N , the ordered natural numbers with a successor function is not a model for Σ ∪ Th(N ). T hN ∪ ; · · ·i An explicit construction of such a model is 1 = ˙Z where any element of Z is greater than every element of ∪ ∈ T L T ∪ N N. It can be shown that N Z 1 and N are not -isomorphic. Note that even though 1  Σ Th( ), if we drop − S the interpretation of c we have T Th N . In general any such Tm ˙ i is a model for this theory of “numbers 1  ( ) = Z i∈mZ beyond the naturals”. We can conclude that the statement “in the naturals, every natural number is obtained by finitely many applications of succ to 0” cannot be expressed by a first order statement. Suppose that such a statement θ exists and that N  θ. θ ∈ N T N T θ We therefore have Th( ). Since we have 1  Th( ) we also have 1 2 which is a contradiction. This can be thought of as a non-standard model of the natural numbers. Similarly we can use compactness to prove the existence of non-standard models of R = (R; +; ·; 1; 0; <) the real numbers. One property that is not satisfied in a non-standard model of the reals is the Archimedean property.

∀ > ∃n ∈ 1 <  0 N n

2.11 Decidability and the Entscheidungsproblem Suppose that θ is a , can we determine whether ` θ or ` ¬θ? By the completeness theorem for propositional logic, this is equivalent to determining whether  θ or 2 θ. This can be known since 2 θ ⇐⇒ there is a n n value x¯ ∈ {0; 1} such that for the truth function Fθ : {0; 1} → {0; 1};Fθ(x¯) = 0. This can easily be found by computing the DNF of θ, so there is an algorithm to determine whether ` θ or ` ¬θ. We say that finding whether a propositional formula is a tautology is decidable.

40 M3P65: Mathematical Logic 2: Predicate logic

The entscheidungsproblen is a question first posed by Hilbert and Ackermann that asks whether the same is true for predicate formulas. Specifically if there is an algorithm that will determine whether any given first order formulais valid? Church and Turing independently showed that that there is no such algorithm. Their proofs are both based on Gödel’s incompleteness theorem.

Definition: A set of natural numbers S is recursively enumerative (RE) if there exists an algorithm that generates all the elements of S. This algorithm does not need to terminate.

Theorem: Gödel’s incompleteness theorem No consistent set of axioms that is RE is capable of generating all valid sentences of hN; +; ·; 0i = N . Equivalently, there is no algorithm that could determine whether a formula of N is valid since this would imply that the set of valid sentences of N is recursively enumerative.

Remark: The completeness and incompleteness theorem are not referring to the same property. The former refers to the ability to give semantic meaning to a deductive proof and vice versa. The latter refers to the failure of a logical system to determine the validity of every sentence.

There are, however, first order theories that are decidable. An example is the theory of abelian groups. A non-example is the theory of Diophantine equations.

2.12 Dense linear orders Suppose L is the language containing a single binary relation ≤.

Definition 2.47: We say an L-structure A is a linear order if it satisfies the following axioms: : φ • ∀x ∀x x ≤ x ∧ x ≤ x → x x 1 1 2 ( 1 2) ( 2 1) ( 1 = 2) φ • ∀x x x x ≤ x ∧ x ≤ x → x ≤ x 2 1 2 3 ( 1 2) ( 2 3) ( 1 3) φ • ∀x x x ≤ x ∨ x ≤ x 3 1 2 ( 1 2) ( 2 1) We say that a linear order is dense if further φ • ∀x ∀z ∃x x < x → x < x ∧ x < x 4 1 2 3 ( 1 2) ( 1 3) ( 3 2) : x < x x ≤ x ∧ ¬ x x where 1 2 is an abbreviation for 1 2 ( 1 = 2). We say that a dense linear order has no end points if further

φ5 • ∀x1∃x2 x1 < x2

φ6 • ∀x1∃x2 x2 < x1

{φ ; : : : ; φ } Q h ; ≤i R h ; ≤i Let ∆ = 1 6 . Note that we have two models for this theory, := Q  ∆ and := R  ∆. It would be nice to show that the models are equivalent in some sense, a statement made rigorous below.

Proposition 2.48:

41 M3P65: Mathematical Logic 2: Predicate logic

For every θ an L-sentence, R  θ ⇐⇒ Q  θ

Intuitively, a result about dense linear orders without endpoints reached in Q will hold for R and vice versa. We will spend the rest of this section proving this result. A result that will be useful later on is that an isomorphism between linear orders preserves the order relation.

Exercise: A If A and B are two linear orders that are isomorphic, then there is a bijection f : A → B such that a ≤ b =⇒ B f(a) ≤ f(b).

Remark: Recall that an isomorphism between L-structures A; B is a bijection F : A → B such that: A B • For every constant c ∈ L;F(c ) = c . m f ∈ L;F f A a ; : : : ; a f B F a ;:::;F a • For every -ary function ( ( 1 m)) = ( ( 1) ( m)). k R ∈ L;R A a ; : : : ; a ⇐⇒ R B F a ;:::;F a • For every -ary relation ( 1 k ) ( ( 1) ( k )). Homomorphisms and embeddings are defined similarly by relaxing the rules above.

An important result for the theory of dense linear orders is that it is decidable, this result is called the Łoś-Vaught test.

Lemma 2.49: Łoś-Vaught test For every L-sentence θ either ∆ ` θ or ∆ ` ¬θ.

∪ {θ} ∪ {¬θ} Proof. Suppose not, then ∆1 = ∆ and ∆2 = ∆ are both consistent.

• by Löwenheim–Skolem theorem, both have countable models A1 and A2.

• By Cantor’s theorem (2.50) A1 and A2 are isomorphic. • This contradicts Corollary 2.51. 

Theorem 2.50: Cantor If A and B are two countable dense linear orders without endpoints, then A and B are isomorphic.

A proof of this uses a technique called back and forth. The corollary follows by the same method.

Corollary 2.51: If A and B are isomorphic, then for all θ an L-sentence,

A  θ ⇐⇒ B  θ

The proof of Proposition 2.48 is now clear.

Proof, Proposition 2.48. We want to show Q  θ ⇐⇒ ∆ ` θ. Note that Q  ∆ so ⇐= is given by the completeness theorem. To show =⇒ consider ∆ 0 θ. Then we have ∆ ` ¬θ and Q 2 ¬θ. We prove R  θ ⇐⇒ ∆ ` θ similarly. 

42 M3P65: Mathematical Logic 3: Set theory

3 Set theory

Set theory is a first order theory that rigorously defines sets and set operations and aims to formally study them. This first order theory is of particular interest because the notion of a set is used almost universally in other areasof mathematics and is thus of foundational importance. In this section we will develop the axioms of set theory and some important theorems.

3.0 Basic set theory (Review) We begin with a introduction to naïve set theory. This doesn’t phrase the theory on an axiomatic footing, but does define some useful concepts that will be made rigorous later. We begin by defining only one operation on sets, that of membership. This allows us to state the axiom of extension- ality.

Definition 3.0.0: The axiom of extensionality Two sets A and B are equal iff ∀x (x ∈ A) ↔ (x ∈ B)

Thus set membership can be thought of as the defining property of a set since a set is uniquely by the elements it contains. Membership also has other uses, for example it can define an order on the natural numbers as defined below.

Example: The natural numbers Let 0 = ∅ and define n + 1 := {0; 1; : : : ; n} for n ≥ 0. With this we can write m < n ⇐⇒ m ∈ n

Our next construction is the power set.

Definition 3.0.1: The axiom of power set If A is a set, then there exists a power set P(A) which satisfies

∀x(x ⊆ A → x ∈ P(A)) where (x ⊆ A) ⇐⇒ (∀y ∈ x → ∀y ∈ A)

Another way of constructing one set from another is the ordered pair.

Definition 3.0.2: Ordered pairs (Kuratowski) n We define the ordered pair (x; y) to be the set {{x}; {x; y}}. We write A × B = {(a; b): a ∈ A; b ∈ B} and A for the n-fold product of A with itself.

Exercise: Show that for any x; y; z; w we have (x; y) = (z; w) ⇐⇒ x = z and y = w.

Note that the set of finite sequences of elements from A is the union S An. n∈N The notion of ordered pairs allows us to define functions f : A → B as subsets f ⊆ A × B such that ∀x ∈ A∃!b ∈ B ((a; b) ∈ f)

43 M3P65: Mathematical Logic 3: Set theory

: where ∃!c ∈ C φ(c) ⇐⇒ ∃c ∈ C (φ(c) ∧ (∀d ∈ C φ(d) → (d = c))). We define A = dom(f) to be the domain of f and B = ran(f) to be the range of f. The set of functions from A to B is A denoted B and is a subset of P(A × B). For a subset X ⊆ A we write its image under f as f[X] = {f(x): x ∈ X}.

3.1 Cardinality We now turn to the subject of cardinality which aims to give each set a “size”.

Definition 3.1.1: We say two sets A and B are equinumerous (or that they have the same cardinality) if there is a bijection f : A → B. We write A ≈ B or |A| = |B|.

With this we can now distinguish the finite and countable sets.

Definition 3.1.2: A set is finite if it is equinumerous with some element of N. It is countably infinite if it is equinumerous with N. It is countable if it is either finite or countably infinite.

Proposition 3.1.3: Some basic facts about cardinalities. (i) Every subset of a countable set is countable. (ii) A set A is countable iff there is an injection A,→ N. (iii) If A and B are countable, then so is A × B. (iv) If the axiom of choice is assumed and if A ;A ;::: are countable. Then S A is countable. 0 1 n∈N n

Exercise: Show that R is not countable.

Theorem 3.1.4: Cantor If X is any set, then there is no surjective function f : X  P(X). In particular we have X 6≈ P(X).

Proof, Cantor’s diagonal argument. Suppose that such a surjection exists.

• Let Y = {y ∈ X : y∈ / f(y)} ⊆ X =⇒ Y ∈ P(X). • We therefore have z ∈ X : f(z) = Y . • If z ∈ Y , then z∈ / f(z) =⇒ z∈ / Y � . • If z∈ / Y , then z∈ / f(z) =⇒ z ∈ Y � . 

Definition 3.1.5: For sets A;B we write |A| ≤ |B| if there is an injective function f : A,→ B, so A is equinumerous with a subset of B.

44 M3P65: Mathematical Logic 3: Set theory

Exercise: Show that this relation is transitive.

Remark: We have |X| ≤ |P(X)| since we have the injection x 7→ {x}. Since we also have X 6≈ P(X) we have |X| < |P(X)|.

Theorem 3.1.6: Cantor-Schröder-Bernstein Suppose that A;B are sets and that f : A → B and g : B → A are both injective functions. Then A ≈ B. i.e

|A| ≤ |B| and |B| ≤ |A| =⇒ |A| = |B|

Proof. Let h = g ◦ f : A → A. • Define A A \ g B and for n > , let A h A . Let A∗ S A and B∗ f A∗ . 0 = [ ] 0 n = [ n−1] = n∈N n = [ ] ∗ ∗ ∗ ∗ ∗ • Note that h[A ] ⊆ A so g[B ] = g(f[A ]) = h[A ] ⊆ A. ∗ ∗ • We claim that g[B \ B ] = A \ A . – If this is true, then f is a bijection between A∗ and B∗ and g is a bijection between B \ B∗ and A \ A∗.

( ∗ f(a): a ∈ A – So k(a) = − ∗ is a bijection from A to B. g 1(a): A \ A • We now prove the claim – Let a ∈ A \ A∗. a∈ / A b ∈ B g b a ∗ As 0 we have such that ( ) = . ∗ Then b∈ / B∗ as ∗ ∗ b∈ / B =⇒ v ∈ f[A ] ∗ ∗ =⇒ g(b) ∈ h[A ] ⊆ A ∗ =⇒ a ∈ A �

∗ ∗ ∗ Thus g[B \ B ] ⊇ A \ A > – Let b ∈ B. ∗ ∗ ∗ ∗ ∗ Suppose that g(b) ∈ A , we will show that b ∈ B which implies that g[B \ B ] ⊆ A \ A . g b ∈/ A g b ∈ A n > ∗ Clearly ( ) 0 so ( ) n for some 0. a ∈ A g b h a ∗ This implies we have some n−1 such that ( ) = ( ). ∗ ∗ Thus g(b) = g(f(a)) =⇒ b = f(a); a ∈ A . ∗ ∗ ∗ And so b ∈ f[A ] = B . 

Example 3.7: The following sets are equinumerous: S { ; }N 1. 1 = The set of all sequences of 0s and 1s, 0 1 S 2. 2 = R S P 3. 3 = (N) S P × 4. 4 = (N N)

45 M3P65: Mathematical Logic 3: Set theory

S N 5. 5 = N the set of all sequences of natural numbers.

Proof. We will find injective functions fi;j : Si → Sj and use the previous theorem.

• We have N ≈ N × N so S3 ≈ S4.

• Moreover S1 ⊆ S5 ⊆ S4 so we have f1;5; f5;4 and f1;4. f S → S • There is a bijection 3;1 : 3 1 given by ( n∈ / X f X a ; a 0 : 3;1( ) = ( n)n∈N n = 1 : n ∈ X

f a 7→ :a a a ··· • We define 1;2 :( n)n∈N 0 0 1 2 . This decimal expansion is clearly an injective function.

• f2;3 is defined as f → P −→P≈ 2;3 : R (Q) (N) r 7→ {q ∈ Q : q < r} 7→ :::

By considering the compositions of these functions, we get the required injective fi;j . 

Some questions that we can now ask are:

• If A and B are sets do we have (|A| ≤ |B|) ∨ (|B| ≤ |A|)? We will show that if we assume the axiom of choice, this is true.

• Is there an X : N ⊂ X ⊂ R such that |N| < |X| < |R|? This is the continuum hypothesis and it turns out to be independent of the other axioms of set theory.

3.2 Axioms for set theory The axioms for set theory as a first order theory are called the Zermelo-Fraenkel axioms. The language for set theory has a single binary relation, set membership, in addition to equality. The axioms themselves give instructions on how to build new sets from “existing sets”.

ZF1: Extensionality ∀x∀y ((x = y) ↔ ∀z ((z ∈ x) ↔ (z ∈ y))) ZF2: Empty set ∃x∀y (y∈ / x). The unique set with this property is the empty set, ∅.

ZF3: Pairing ∀x∀y∃z (∀w (w ∈ z ↔ ((w ∈ x) ∨ (w ∈ y)))) This axiom allows us to construct the natural numbers and ordered pairs. S S ZF4: Union For any set A there is a set B = A = {z : z ∈ A}.

∀A∃B∀x ((x ∈ B) ↔ ∃z ((z ∈ A) ∧ (x ∈ z)))

ZF5: Power set For any set A, there is a set whose elements are the subsets of A, the power set. We write z ⊆ A ⇐⇒ ∀y ((y ∈ z) → (y ∈ A)). ∀A∃B∀z ((z ∈ B) ↔ (z ⊆ A)) P x; y ; : : : ; y ∈ L ZF6: Axiom scheme of specification Suppose that ( 1 r) Form( ), then ∀A∀y · · · ∀y ∃B∀x x ∈ B ↔ x ∈ A ∧ P x; y ; : : : ; y 1 r (( ) (( ) ( 1 r)))

The axiom scheme of specification effectively gives validity to the subset specification notation from everyday math- B {x ∈ A P x; y ; : : : ; y } ematics. Namely = : ( 1 r holds) . : An important example is the intersection, let C =6 ∅ and A ∈ C. Then \ C = {x ∈ A : ∀z ((z ∈ C) → (x ∈ Z))}

46 M3P65: Mathematical Logic 3: Set theory

The Cartesian product of nonempty sets A and B becomes

A × B = {w ∈ P(P(A ∪ B)) : φ(w)} where φ(w) is the following propositional formula

φ(w) = ∃x∃y∀z ((x ∈ A) ∧ (y ∈ B)) ∧ (w = {{x}; {x; y}}) we note that w = {{x}; {x; y}} is a compact notation for the slightly cumbersome expression : : : ∀z ((z ∈ w) ↔ ((∀a ((a ∈ z) ↔ (a = x))) ∨ (∀a ((a ∈ z) ↔ ((a = x) ∨ (a = y)))))) | {z } | {z } z={x} z={x;y}

Definition 3.2.1: For a set a, the successor of a is the set † a = a ∪ {a} We say a set is inductive if † (∅ ∈ A) ∧ (∀x ((x ∈ A) → (x ∈ A)))

† ZF7 Infinity ∃A (∅ ∈ A) ∧ (∀x ((x ∈ A) → (x ∈ A))) Note that our inclusion of the empty set implies that we will always have a copy of {∅; ∅† ; ∅†† ;:::} in our inductive set.

Definition 3.2.2: † Letting A be any inductive set and writing φ(A) = (∅ ∈ A) ∧ (∀x ((x ∈ A) → (x ∈ A))). We can then form

N = {x ∈ A : φ(B) → (x ∈ B)}

This is informally the “intersection of all inductive sets”; note that it does not depend on the choice of A.

Remark: Some notation We can also denote N as ω.

Theorem 3.2.3: Let N be defined as above. (1) N is an inductive set. Moreover for any inductive set B, N ⊆ B. (2) Suppose that P(x) is a formula such that (i) P(∅) holds and † (ii) ∀k((k ∈ N) → (P(k) → P(k ))) holds. Then ∀k((k ∈ N) → P(k))

Proof. The first statement follows more or less immediately from the definition of N. To show the second statement, consider B ⊆ N given by B = {x ∈ N : P(x)}. • By properties (i) and (ii) it is clear that B is an inductive set. • So by the first statement N ⊆ B. • Thus B = N. 

47 M3P65: Mathematical Logic 3: Set theory

† We could then develop arithmetic in N using n as n + 1 which could then lead on to defining Z; Q and R using ZF1-7. : A slightly harder task is to show that the binary relation m ≤ n ⇐⇒ (m = n) ∨ (m ∈ n) for m; n ∈ N is a well ordering on N.

3.3 Linear orderings

Definition 3.3.1: A linear ordering (A; ≤) is a well ordering (or a wo set) if every non-empty subset of A has a least element. i.e. : ∀X (((X ⊆ A) ∧ ¬(X = ∅)) → ∃x ((x ∈ X) ∧ (∀y ((y ∈ X) → (x ≤ y)))))

Example: Some examples and non-examples of wo sets.

• (N; ≤) is a wo set. • (Z; ≤) is not a wo set.

Definition 3.3.2: A A ; ≤ i ; A A Suppose i = ( i i) are two linear orderings for = 1 2. We say 1 and 2 are similar (or isomorphic) if α A → A there is a bijection : 1 2 such that ∀a; b ∈ Aa ≤ b ⇐⇒ α a ≤ α b 1 ( ) 2 ( )

We call α a similarity between A1 and A2 and write A1 'A2.

∀a; v ∈ Aa ≤ b ⇒ α a ≤ α b α If we only have the forward implication 1 = ( ) 2 ( ), we say that is order preserving.

Definition 3.3.3: Let the Ai be as defined previously

A × A A × A ; ≤ 3.3.3.1: The reverse-lexicographic product 1 2 is the linear order ( 1 2 ) defined by : a ; a ≤ a0 ; a0 ⇐⇒ either a < a0 or a a0 and a ≤ a ( 1 2) ( 1 2) 2 2 2 2 = 2 1 1 2

3.3.3.2: Consider the disjoint union of A1 and A2, a : : A A { a; i ∈ A ∪ A × { ; } a ∈ A ↔ i ∧ a ∈ A ↔ i } 1 2 = ( ) ( 1 2) 0 1 : (( 1) ( = 0) ( 2) ( = 1))

A A A ` A ; ≤ a ≤ a a ∈ A a ∈ A We define the sum to be 1 + 2 = ( 1 2 ) where 1 2 for all 1 1 and 2 2. All other orderings are as in A1 and A2.

Intuitively, the reverse-lexicographic product replaces each element of A1 with a copy of A1 in place.

Example: Consider {0; 1} × N. In this case we replace each element of N by the two element set in place. The result is still similar to N. For N × {0; 1} however, we have replaced each element of the two element set by a copy of N, in a sense concatenating two copies of N. This is not similar to N.

The sum can be thought of as a true concatenation of the two orders.

48 M3P65: Mathematical Logic 3: Set theory

Lemma 3.3.4:

Let A1 and A2 be two linear orders. Then A A A × A (1) 1 + 2 and 1 2 are both linear orders. A A A A A × A (2) If 1 and 2 are well ordered sets, then so are 1 + 2 and 1 2.

Proof. The proof for the first statement is left as an exercise.

Exercise: Prove the first statement.

A × A A A We only show that 1 2 is a wo set since the proof for 1 + 2 follows the same lines.

• Let X ⊆ A1 × A2 be a non-empty set. Y {b ∈ A ∃a ∈ A ; a; b ∈ X} ⊆ A • Consider = 2 : 1 ( ) 2.

• Since A2, this has a least element d ∈ A2. Z {x ∈ A x; d ∈ X} ⊆ A • Now consider = 1 :( ) 1. • This also has a least element c.

• It then follows that (c; d) ∈ X is the least element of X. 

3.4 Ordinals Definition 3.4.1: Let X be a set

(i) We say X is transitive if every element of X is a subset of X. i.e. ∀x ((x ∈ X) → (∀y ((y ∈ x) → (y ∈ X)))). (ii) X is ordinal if: (a) X is a transitive set. (b) The relation < on X given by x < y ⇐⇒ x ∈ y is (strict) well-ordering.

Note that for an ordinal α we have, by definition, α∈ / α.

Example: Some examples of ordinals are

1. 0 = ∅ † 2. 1 = 0 = {∅} = {0} † 3. 2 = 1 = {0; 1} † 4. 3 = 2 = {0; 1; 2}

Lemma 3.4.2: † If α is an ordering, so is α = α ∪ {α}.

Proof. Since α is transitive, so is α† . The ordering ∈ on α† is the same as on α but with α added as an extra greatest † element. Thus α is a well ordering. 

49 M3P65: Mathematical Logic 3: Set theory

Proposition 3.4.3: Let ω be the natural numbers as defined previously. (i) If n ∈ ωm then n is an ordinal. (ii) ω is a transitive set.

Proof. ∅ is an ordinal. Thus each element n ∈ ω is an ordinal by the previous lemma and induction. We prove the second statement similarly, it is enough to show that if m ∈ n ∈ ω then m ∈ ω and proceed by induction. 

Proposition 3.4.4: Suppose that α is an ordinal. (i) α∈ / α. (ii) If β ∈ α, then β is an ordinal. (iii) If β is an ordinal and β ⊂ α, then β ∈ α.

(iv) α = {β : β is an ordinal and β ∈ α}.

Proof. Let α be an ordinal. (i) Clear. (ii) Check the definition of an ordinal.

(iii) α \ β ⊂ α is non-empty, thus it will have a least element γ. Remains to show that γ = β. (iv) Follows from part (ii). 

Definition 3.4.5: If α; β are ordinals, we write α < β to mean α ∈ β. We write α ≤ β to mean α ∈ β or α = β. Note that α ≤ β ⇐⇒ α ⊆ β by part (iii) of the above proposition.

Theorem 3.4.6: Suppose that α; β; γ are ordinals. (i) If α < β and β < γ then α < γ.

(ii) If α < β and β < α then α = β. (iii) Exactly one of α < β, α = β or β < α holds. (iv) If X is a non-empty set of ordinals, then X has a least element.

The last statement can be interpreted as saying that ‘the collection of ordinals is well ordered’.

Proof. Let α; β; γ be ordinals.

(i) We have α ⊂ β and β ⊂ γ so α ∈ γ =⇒ α < γ. (ii) If α ≤ β and β ≤ α then we have both α ⊆ β and β ⊆ α thus α = β. (iii) As α∈ / α, it follows that at most one if these holds.

50 M3P65: Mathematical Logic 3: Set theory

• It remains to show that if α =6 β then either α ⊂ β or β ⊂ α. • We first use the definition of ordinals to check that α ⊂ β is an ordinal. • If we have α 6⊂ β, then α ∩ β ⊂ α. • As α ∩ β is an ordinal, part (iv) of the previous proposition gives us α ∩ β ∈ α with a similar statement holding for β 6⊂ α. • Together this gives us α ∩ β ∈ α ∩ β which is a contradiction. (iv) See the notes for a complete proof. 

Corollary 3.4.7: Some minor facts. (i) Suppose that X is a set of ordinals, then S X is an ordinal. (ii) ω is an ordinal.

Proof. We have that S X is a set of ordinals, ∈ is therefore a well ordering by the above theorem. It is easy to check that S X is transitive. The fact that ω is an ordinal is a conclusion of the previous results. 

We can now form more ordinals such as ω† and ω†† . We want to classify the cardinalities of sets using ordinals.

Theorem 3.4.8: If (A; ≤) is a well ordered set, there is a unique ordinal which is similar to (A; ≤).

Definition 3.4.9: Suppose that (A; ≤) is a wo set. We say that X ⊆ A is an initial segment of A if whenever y < x ∈ X then y ∈ X. It is proper if X =6 A.

Example: If α; β are ordinals such that α < β then α is a proper initial segment of β since α = {δ ∈ β : δ < α}.

Lemma 3.4.10: Suppose that (A; ≤) is a wo set. If X ⊂ A is a proper initial segment of A, there is an x ∈ A with X = {a ∈ A : a < x} =: A[x].

Proof. Let x ∈ min(A \ X). • If y < x then y∈ / A \ X =⇒ y ∈ X. Thus A[x] ⊆ X. • If z ∈ X then z =6 x. • So if z∈ / A[x], z > x this contradicts the fact that X is an intitial segment. 

51 M3P65: Mathematical Logic 3: Set theory

Theorem 3.4.11: Suppose that (A; ≤) is a wo set, f : A → A is an order preserving map and f[A] is an initial segment of A. Then ∀x ∈ A f(x) = x.

Proof. Suppose not. Take x y ∈ A f y 6 y . So f| is the identity function on A x → A x . = min( : ( ) = ) A[x] [ ] [ ] Since f is injective and f(x) =6 x we must have f(x) > x. So x∈ / f[A] which is a contradiction since f[A] is an initial segment of A. 

Corollary 3.4.12: If α =6 β are ordinals then α 6≈ β.

Proof. Assume WLOG that β < α, then β is an initial segment of α. Thus α 6≈ β by the above theorem. 

Proof, Theorem 3.4.8. We’ve already shown that if (A; ≤) is similar to an ordinal, it is unique. It only remains to show that such an ordinal exists.

• Consider X = {x ∈ A : A[x] is similar to an ordinal}. • By uniqueness, if x ∈ X there is a unique ordinal αx similar to A[x]. • Let S = {αx : x ∈ X} (∗)

• S is a set of ordinals, we claim that S is also an ordinal. – We need to show that S is transitive.

– Consider β ∈ αx ∈ S and let π : A[x] → αx be a similarity. − – Let y π 1 β , we therefore have a similarity π| A y → {δ ∈ αx δ < β} β. = ( ) A[y] : [ ] : = – Thus we have β = αy ∈ S • Denote S by α.

• If X = A we are done since x 7→ αx gives a similarity between A and α. • By our construction of X, we know it is an initial segment of A.

• So if we suppose that X =6 A we have z ∈ A \ X such that X = A[z].

• We know that x 7→ αx gives a similarity between X and α. • This implies that z ∈ X by the definition of X.

• This is a contradiction, so X = A and A ≈ α. 

Our proof relies on knowing that S as defined in ∗ is in fact a set. To show this we need the Axiom of Replacement.

Definition 3.4.13: F x; y; z ; : : : ; z ∈ L s ; : : : ; s b Suppose that ( 1 r) Form( ) such that whenever 1 3 are fixed sets and is a set, there is a a F a; b; s ; : : : ; s unique set such that ( 1 r) holds.

We call the s1; : : : ; sr parameters. F defines a “function” on sets b 7→ a. We call F an operation on sets where the z1; : : : ; zr are parameter variables.

52 M3P65: Mathematical Logic 3: Set theory

F x; y; z ; : : : ; z s ; : : : ; s ZF8: Replacement: Suppose that ( 1 r) is an operation on sets and that 1 r are sets. In addition suppose that B is a set. Then there is a set A such that

A {a F a; b; s ; : : : ; s b ∈ B} = : ( 1 r) holds for some

In the case of (∗) we have F(a; b) = ‘either b is a wo set similar to the ordinal a, or b is not a wo set (or b is a wo set and not similar to an ordinal) and a = ∅’. By applying F to B = {A[x]: x ∈ X} we get S.

3.5 Transfinite induction

Theorem 3.5.1: Transfinite induction Suppose P(x) is a property of sets. Assume that for all ordinals α we have

(∀β ((β < α) → P(β))) → P(α) (∗∗)

Then P(γ) holds for all ordinals γ.

Remark: If α = ∅ then P(β) holds for all β < α immediately so we have P(∅).

We can use transfinite induction to prove the following results.

Theorem 3.5.2: Suppose that α is an infinite ordinal (so ω ≤ α), then α ≈ α × α.

Corollary 3.5.3: Infinite well ordered sets are equinumerous with their Cartesian powers.

(1) If (A; ≤) is an infinite wo set, we have |A| = |A × A|. (2) Assuming the axiom of choice any set A can be well ordered and so if A is infinite, |A| = |A × A|.

Proof, Theorem 3.5.1. Suppose for a contradiction that there is an ordinal γ such that P(γ) does not hold. By Theo- rem 3.4.6, part (iv) we have that the set {δ an ordinal : δ ≤ γ and P(δ) does not hold} has a least element. Let this be α.

Then for β < α we have that P(β) holds. So by (∗∗) we have that P(α) holds which is a contradiction. 

Proof, Theorem 3.5.2. Let α be an infinite ordinal (ω ≤ α). (1) Assume that if ω ≤ β ≤ α we have that β ≈ β × β. If we can conclude that α ≈ α × α, we are done by transfinite induction. (2) We may assume that α is uncountable and if β < α then |β| < |α|. In fact |β† | < |α|. (3) It is therefore enough to show that |α × α| ≤ |α| since we can then conclude by Theorem 3.1.6. step 1. Suppose we have w.o. ≤ of A = α × α such that for all x ∈ A

|A[x]| < |α| We claim that |α × α| ≤ |α|.

Proof. By Theorem 3.4.8 there is an ordinal γ which is similar to (A; ≤). Let f : γ → A be the similarity. • It is enough to show γ ⊆ α since we will then have |γ| ≤ |α| =⇒ |A| ≤ |α|. • Consider η ∈ γ.

53 M3P65: Mathematical Logic 3: Set theory

• Since f is a similarity, it yields a bijection

η = {δ ∈ γ : δ < η} → A[f(η)]

• So we have that |η| = |A[f(η)]| < |α|. • Thus η < α, if it were not we would have α ≤ η =⇒ α ⊆ η =⇒ |α| ≤ |η| � . • Thus η ∈ α =⇒ γ ⊆ α.  step 2. We must find an ordering on A = α × α as in the first step. • For λ < α let Aλ = {(θ; ζ) ∈ α × α : max(θ; ζ) = λ}. • Define ≤ on A by 0 0 0 0 (θ ; ζ ) < (θ; ζ) ⇐⇒ max(θ ; ζ ) < max(θ; ζ) or 0 0 max(θ ; ζ ) = λ = max(θ; ζ) 0 0 0 and either ζ < ζ or ζ = λ = ζ and θ < θ, the reverse lexicographic order on Aλ. S • We claim that ≤ is a well ordering on A = λ∈α Aλ.

Exercise: Show this.

• It remains to show that if x = (θ; ζ) ∈ A then |A[x]| < |α|. • Let λ = max(θ; ζ); we may assume that λ ≥ ω. † • Let µ = λ . We have µ < α and by the induction hypothesis |µ × µ| = |µ| < |α|. 0 0 0 0 • Then {y ∈ A : y < x} ⊆ {(θ ; ζ ) ∈ A : max(θ ; ζ ) ≤ λ} = µ × µ. • So |A[x]| ≤ |µ × µ| < |α| as required. 

3.6 Transfinite recursion

Transfinite recursion allows us to construct sets G(α), for an ordinal α, such that G(α) is obtained from G(β) where β < α by applying some operation F. We write G  α for {G(β): β < α}, a function F(G  α) = G(α) can then be constructed. We note that G  α is a set because of the axiom of replacement.

Remark: For F an operation on sets, we write F(b) for the result of applying F to the set b.

Theorem 3.6.1: Transfinite recursion Suppose that F is an operation on sets. Then there is an operation G such that for all ordinals α we have

G(α) = G(G  α) 0 0 If G is another such operation, then G(α) = G (α) for all ordinals α.

Proof. Non-examinable, proof on blackboard. 

In practice, we do not usually explicitly write down F as a first order formula.

54 M3P65: Mathematical Logic 3: Set theory

Lemma 3.6.2: Lindenbaum (c.f. Lemma 1.31 and Lemma 2.40). Suppose that L is a first order language whose alphabet of symbols, P, is well ordered. Suppose that Σ is a consistent set of L-sentences. ∗ ∗ ∗ Then there is a consistent set Σ ⊇ Σ of L-sentences such that for every L-sentence ψ either ψ ∈ Σ or ¬ψ ∈ Σ .

As P is well-ordered, we can well order S S Pn. We can first order by length, and then reverse lexicographic = n∈N ordering each Pn. This gives a well ordering on S. Hence we obtain a well ordering of the set of L-sentences.

Let λ be the unique ordinal similar to this well ordered set. Then we can write the set of L-sentences as {φα : α < λ}, a set indexed by λ. ∗ We construct Σ using transfinite recursion. Define, for each ordinal α a set G(α) ⊇ Σ of L-sentences.

 S S Σ ∪ β<α G(β) ∪ {φα } : α < λ and Σ ∪ β<α G(β) ` φα  S S G(α) = Σ ∪ β<α G(β) ∪ {¬φα } : α < λ and Σ ∪ β<α G(β) 0 φα  S Σ ∪ β<α G(β)} : α < λ

Remark: We note that for β < α; G(β) ⊆ G(α). It can be shown (using transfinite induction and results from propositional and predicate logic) that G(α) is consistent.

∗ ∗ ∗ By the construction, letting Σ = G(λ) either φα ∈ Σ or ¬φα ∈ Σ ; ∀α < λ. Similar arguments in other parts of the proof of the Model Existence lemma (2.32) to get the completeness (2.45) and compactness theorems for L.

3.7 The axiom of regularity (foundation) The final axiom of Zermelo-Fraenkel set theory is that of regularity.

ZF9: Regularity ∀x ((x =6 ∅) → (∃a ((a ∈ x) ∧ (a ∩ x = ∅)))) In particular, there is no set b such that b ∈ b. Consider x = {b}, by ZF9 we have b ∩ {b} = φ so b∈ / b. Thus we have encountered all the axioms of Zermelo-Fraenkel set theory (ZF). We reprint them here.

3.7.1 The Zermelo-Fraenkel axioms

ZF1: Extensionality ∀x∀y ((x = y) ↔ ∀z ((z ∈ x) ↔ (z ∈ y))) ZF2: Empty set ∃x∀y (y∈ / x). ZF3: Pairing ∀x∀y∃z (∀w (w ∈ z ↔ ((w ∈ x) ∨ (w ∈ y)))) S S ZF4: Union For any set A there is a set B = A = {z : z ∈ A}.

∀A∃B∀x ((x ∈ B) ↔ ∃z ((z ∈ A) ∧ (x ∈ z)))

ZF5: Power set For any set A, there is a set whose elements are the subsets of A, the power set. We write z ⊆ A ⇐⇒ ∀y ((y ∈ z) → (y ∈ A)). ∀A∃B∀z ((z ∈ B) ↔ (z ⊆ A))

P x; y ; : : : ; y ∈ L ZF6: Axiom scheme of specification Suppose that ( 1 r) Form( ), then ∀A∀y · · · ∀y ∃B∀x x ∈ B ↔ x ∈ A ∧ P x; y ; : : : ; y 1 r (( ) (( ) ( 1 r)))

† ZF7: Infinity ∃A (∅ ∈ A) ∧ (∀x ((x ∈ A) → (x ∈ A)))

55 M3P65: Mathematical Logic 3: Set theory

F x; y; z ; : : : ; z s ; : : : ; s ZF8: Replacement: Suppose that ( 1 r) is an operation on sets and that 1 r are sets. In addition suppose that B is a set. Then there is a set A such that

A {a F a; b; s ; : : : ; s b ∈ B} = : ( 1 r) holds for some

ZF9: Regularity ∀x ((x =6 ∅) → (∃a ((a ∈ x) ∧ (a ∩ x = ∅))))

56 M3P65: Mathematical Logic 4: The axiom of choice and consequences

4 The axiom of choice and consequences

4.1 Statement of the axiom of choice and the well ordering principle

Definition 4.1.1: Axiom of choice S Suppose A is a set of non-empty sets. Then there is a function f : A → A with f(a) ∈ a for all a ∈ A.

We call the ZF axioms and the axiom of choice ZFC.

Example 4.2: Suppose that X is any non-empty set, let A = ¶ (X) \ {∅}, the non-empty subsets of X. By the axiom of choice, there is a function f : A → X such that f(Y ) = Y for every ∅ 6= Y ⊆ X. Such a function is called a choice function on X.

Remark: If (X; ≤) is a well ordered set, then we don’t need the axiom of choice to get a choice function. We can let f(Y ) = min(Y ) for ∅ 6= Y ⊆ X.

Theorem 4.1.3: Well ordering principle (WO) Suppose that X is a non-empty set and f : P(X) \ {∅} → X is a choice function. Then there is a well-ordering ≤ of X, i.e. a well ordered set (X; ≤).

Lemma 4.1.4: Hartogs’ For any set A there is an ordinal α such that there is no injective function h : α → A.

Proof, Theorem 4.1.3. We define G(α) = f(X \{G(β): β < α}). | {z } when =6 ∅ • Let α be the ordinal as yielded by Lemma 4.1.4.

• Consider X˜ = X ∪ {∞} where ∞ is some set with ∞ ∈ X. • Using transfinite recursion, for an ordinal γ, we can define an operation G ( f(X \{G(β): β < γ}): X \{G(β): β < γ} 6= ∅ G(γ) = ∞ : else

Remark: Note that if ∞ ∈/ im(G  γ) then G  γ is an injective function γ → X.

• By Hartogs’ lemma, there is some ordinal α with G(α) =∈ • Take the least such α.

• Thus g = G  α : α → X is an injective function and as G(x) = ∞, the image of g is X. • Thus g is a bijection.

≤ X x ≤ x ⇐⇒ g−1 x ≤ g−1 x ∈ α • We define on by 1 2 ( 1) ( 2) where the ordering on the right is given by on . 

57 M3P65: Mathematical Logic 4: The axiom of choice and consequences

Proof, Lemma 4.1.4, Hartogs’ lemma. Consider X = {(Y; ≤Y ): Y ⊆ A and ≤Y is a well ordering on Y }. By specifi- cation, this is a set.

• Let S = {β : β is an ordinal similar to some (Y; ≤Y ) ∈ X}. • Using Theorem 3.4.8 and replacement, we find that S is a set.

• Note that S = {β : β is an ordinal and there is an injective function β → A}. S • Let σ = S. • This is an ordinal and β ≤ σ for all β ∈ S by Proposition 3.4.4 and Corollary 3.4.7. † • Let α = σ . So σ is an ordinal and for β ∈ S; β ≤ σ < α. • Thus α ∈ S. 

Corollary 4.1.5: Assuming the ZF axioms, then the axiom of choice is equivalent to the well ordering principle. Moreover, if A is any set, then there is ≤A⊆ A × A such that (A; ≤A) is a well ordered set. i.e.

ZF ` (AC ↔ WO)

Proof. We have AC =⇒ WO by Theorem 4.1.3. We now show the converse. S • If A is any set of non-empty sets, let B = A.

• By WO, there is a well ordering ≤B on B. S • We define f : A → A by f(a) = the least element if a with respect to ≤B. 

Corollary 4.1.6: Assuming ZFC, (i) If A is any set, there is an ordinal α ≈ A. (ii) If A;B are any sets, then either |A| ≤ |B| or |B| ≤ |A|.

(iii) (The fundamental theorem of cardinal arithmetic) If A is any infinite set, then |A| = |A × A|.

Proof. Parts (i) and (iii) are proven by Corollary 4.1.5 and Corollary 3.5.3. We now show (ii) • There exist ordinals α; β with A ≈ α and B ≈ β by part (i). • By Theorem 3.4.6, we have either α ⊆ β or β ⊆ α. 

Lemma 4.1.7: Assuming ZFC, suppose that A and B are sets with A =6 ∅. Then |A| ≤ |B| ⇐⇒ there is a surjective function h : B → A.

Exercise: We leave the proof as an exercise.

58 M3P65: Mathematical Logic 4: The axiom of choice and consequences

4.2 Cardinals and cardinality

Definition 4.2.1: An ordinal is a cardinal if it is not equinumerous with any β < α.

Example: If n ∈ ω, n is a cardinal. Moreover ω is a cardinal. Though if β is an infinite ordinal then β ≈ β† so β† is not a cardinal.

For the rest of this section, we assume ZFC.

Lemma 4.2.2: Suppose A is any set. Then there is a unique cardinal α ≈ A.

Proof. By Corollary 4.1.6 there is some ordinal γ ≈ A. Take α to be the least such ordinal. Then α is a cardinal. 

Definition 4.2.3: The unique cardinal equinumerous with A is called the cardinality of A. Denote it by card(A) or |A|.

Exercise: There is an injective function A → B iff card(A) ≤ card(B).

This justifies the use of the notation card(A) = |A|.

Example: Some examples of cardinalities.

1. If A is a countably infinite set, |A| = ω. 2. If α is an ordinal, then |α| = α ⇐⇒ α is a cardinal.

Definition 4.2.4: Suppose A and B are disjoint sets with |A| = κ and |B| = λ (so κ; λ are cardinals). Define • κ + λ := |A ∪ B| • κ · λ := |A × B|

Remark: Note that this doesn’t depend on the choice if A and B.

Theorem 4.2.5: Suppose that κ; λ are cardinals, that κ ≤ λ and λ is infinite. Then:

(i) κ + λ = λ and (ii) κ · λ = λ if κ =6 0.

59 M3P65: Mathematical Logic 4: The axiom of choice and consequences

Proof. To show (ii), note that as κ ≤ λ, we have κ ⊆ λ. This implies κ × λ ⊆ λ × λ. Thus

κ · λ = |κ × λ| ≤ |λ × λ| = |λ|(FTCA) = λ(cardinal)

Since κ =6 0, there is an injective function λ → κ × λ; α 7→ (0; α). So |λ| ≤ |κ × λ|, i.e. λ ≤ κ · λ. To show (i),

λ ≤ κ + λ ≤ λ + λ ≈ {0; 1} × λ = 2 · λ = λ(by (ii))



Theorem 4.2.6: Suppose A is an infinite set of cardinality λ. Suppose that each element of A is a set of cardinality ≤ κ. Then | S A| ≤ λ · κ.

Example: Suppose that P is an infinite set, |P| = λ ≥ ω. Let S be the set of finite sequences of elements of P. So S n S = n∈ω P and then |S| = λ.

Proof. For n ∈ ω; n 6 ; |Pn| λ ····· λ λ by (ii) in Theorem 4.2.5. By Theorem 4.2.6 we have |A| ≤ ω · λ λ. But = 0 = | {z } = = n P ⊆ S so |S| ≥ λ. 

Proof, ??. We can assume that φ ∈ A.

• For each a ∈ A, the set Sa of surjective functions κ → α is non-empty by Lemma 4.1.7. S • Assuming AC, there is a function F : A → α∈A Sa with F(A) ∈ Sa for all a ∈ A. • i.e. F(A): κ → α is a surjective function. • Let h : λ → A be a bijection. S • Define g : λ × κ → A by g(α; β) = (F(h(α)))(β). We note that this is surjective. • So by Lemma 4.1.7 |λ × κ| ≥ | S A| • i.e. | S A| ≤ λ · κ 

4.3 Zorn’s lemma

A partially ordered set (poset) (A; ≤) satisfies:

∀xyz ∈ A (x ≤ y ≤ z → x ≤ z) : ∀xyz ∈ A ((x ≤ y) ∧ (y ≤ x) → (x = y)) ∀xyz ∈ A (x ≤ x)

60 M3P65: Mathematical Logic 4: The axiom of choice and consequences

Example: Consider (P(X); ⊆).A chain C is a poset (A; ≤) is a subset C ⊆ A such that ∀x; y ∈ C ((x ≤ y) ∨ (y ≤ x)). An upper bound of C in A is a ∈ A such that a ≥ c for all c ∈ C. S : If C ⊆ P(X) is a chain, then C is an upper bound for C in P(X).

Definition 4.3.1: Zorn’s Lemma Suppose (A; ≤) is a non-empty poset in which every chain in A has an upper bound in A. Then A has a maximal element : ∃z ∈ A∀x ∈ A ((x ≥ z) → (x = z))

Theorem 4.3.2: ZF ` (AC ↔ ZL), i.e. (1) Assuming ZFC, then ZL holds. (2) Assuming ZF and ZL, then AC follows.

Example 4.3: Assume ZFC. Suppose V is a vector space over a field F. Then V has a basis.

Proof. Use ZL. Let A be the set of linearly independent subsets of V , ordered by ⊆. We claim that if C is a chain in A S S then C ∈ A. So then the hypothesis of ZL holds for (A; ≤). It remains to show that C is linearly independent, i.e. if y1; : : : ; yn ∈ C then y1; : : : ; yn are linearly independent.

There are C1;:::;Cn ∈ C such that yi ∈ Ci. As C is a chain, there is j ≤ n with Ci ≤ Cj for all i ≤ n.

But then y1; : : : ; yn ∈ Cj so y1; : : : ; yn are linearly independent. So by ZL, there is a maximal element B of A. As B ∈ A, B is a linearly independent set. If v ∈ V \ B then B ∪ {v} is not linearly independent (as B is maximally linearly independent). This implies v is a linear combination of vectors in B and thus B spans V . i.e. B is a basis. 

Proof, AC =⇒ ZL. Let f : P(A) \ {∅} → A be a choice function. Suppose for a contradiction that A has no maximal element. • Let C ⊆ A be a chain in A. • By assumption, there is some y ∈ A with c ≤ y for all c ∈ C. • As y is not maximal, there is z ∈ A with z > y. • Therefore z > c for all c ∈ C.

• We can use transfinite recursion to define an operation G such that for all ordinals α; G(α) ∈ A and G(α) = f({z ∈ A : z > G(β) for all β < α}). • So G(0) < G(1) < ··· < G(β) < ··· . • i.e. for all ordinals β < α, we have G(β) < G(α). • So for every ordinal, G  α is an injective function to A. • This contradicts Hartogs’ lemma 4.1.4. 

61 M3P65: Mathematical Logic 4: The axiom of choice and consequences

Postscript

If we assume ZFC, then Gödel’s completeness theorem and the compactness theorem hold for arbitrary first order languages and not just countable languages.

62