<<

Math 1090 Part two: Predicate (First-Order)

Saeed Ghasemi

York University

5th July 2018

Saeed Ghasemi (York University) Math 1090 5th July 2018 1 / 95 Question. Is propositional logic rich enough to do mathematics and computer science? The answer is “Absolutely not”! Mathematics and computer science deals with structures like sets, strings, numbers, matrices, trees, graphs, programs, Turing machines and many others. The propositional logic is not rich enough to deal with this structures. For example, try expressing the statements “there is a rational number strictly between two given rational numbers” or “every natural number has a unique prime factorization”. We cannot even express these statements in the Boolean Logic, let alone proving them!

Saeed Ghasemi (York University) Math 1090 5th July 2018 2 / 95 Number Theory-Peano’s Arithmetic

In order to express formulas in number theory: We need to be able to refer to numbers, N = {1, 2, 3,... } as variables. we need to have variable symbols that would refer to numbers, like n, m, n0,... . Let’s call them “object variables”. We need to be able to say when two numbers are equal, that’s why we need a “=” for the equality between the variable objects. We need to be able to say expressions like “for all natural numbers ...”. So let’s have a symbol ∀, which says “for all”. We need a special constant denoting 0. We also need to be able to add and multiply numbers. So lets have function + : N × N → N and × : N × N → N for addition and multiplication, respectively (we say these functions have arity2 because they take two inputs, so the function f (x, y, z) = ... has arity 3).

Saeed Ghasemi (York University) Math 1090 5th July 2018 3 / 95 Number Theory-Peano’s Arithmetic

We need a unary (of arity one) function S : N → N defined by S(n) = n + 1. This is called the “successor function”. Lastly we need a predicate symbol “<” expressing formulas like “2 < 3”.

We can abbreviate the structure obtained above by (N, 0, +, ×, S, <). We could also include = there, but since equality is going to be always part of our languages, we just presume it is there. No need to write it! But why did we need the constant 0 or the function S? Suppose we want to express 2 < 3. We need specific numbers, 2 and 3! Well, we can obtain them using 0 and S, e.g., 2 = S(S(0)) and 3 = S(S(S(0))). So we can express any specific number. Now add to the Boolean Logic our new symbols as part of the alphabet. Then we can formulate many things in our new language. For instance if we want to express n ≤ m, then we can write (n = m) ∨ (n < m).

Saeed Ghasemi (York University) Math 1090 5th July 2018 4 / 95 The Alphabet of the General First-Order Language

A language for first order logic consists of the following symbols:

(I) Logical symbols

1 All of V; the Boolean Logic Alphabet. 2 Object variables: x, y, u, v, v0, v1, v2, v3, ..., x0, x1, x2, x3, ... 3 The equality symbol: = 4 The universal quantifier symbol: ∀

(II) Non-logical symbols 1 Object constants; denoted by a, b, c,... 2 Function symbols; denoted by f , g, h,... 3 Predicate symbols; denoted by φ, ψ, φ0,...

Saeed Ghasemi (York University) Math 1090 5th July 2018 5 / 95 Note: The logical symbols belong to every first order language. However, the choice of non-logical symbols depends on the “theory” that we want to study. The equality is only for object variables (e.g., x = y) and not for Boolean variables (“≡ “does the similar job for Boolean variables). In applications, each function and predicate has a fixed arity. Each of the sets of non-logical symbols (object constants, function symbols and predicate symbols) can be empty. Examples. (1) For example the first order language for Number Theory consists of {0, +, ×, S, <} as non-logical symbols; one constant symbol 0, two binary (arity 2) functions +, ×, one unary function S and one binary predicate <. (2) The first order language for Set Theory only has one non-logical symbol, namely {∈}.

Saeed Ghasemi (York University) Math 1090 5th July 2018 6 / 95 Definition (Term) For a first-order language (alphabet) L a term or an L-term is defined recursively as follows: 1 Every object variable and object constant is a term.

2 If t1, t2,... tn are terms and f is an n-ary (of arity n) function symbol (in L) then f (t1, t2,..., tn) is also a term.

The set of all terms is denoted by Term. We denote terms by 0 t, s, t , t1,... . Examples. In the language of Number Theory these are some terms: n 0 n + m S(S(n)) (n × m) + S(m0)

Saeed Ghasemi (York University) Math 1090 5th July 2018 7 / 95 Definition (Term-Calculation/ Term-Parse) A term-calculation (or term-parse) is any finite sequence of strings that we may write respecting the following two requirements: 1 At each step we may write any object variable and object constant.

2 If t1, t2,... tn are already written and f is an n-ary function symbol then we may write f (t1, t2,..., tn).

Proposition An string of symbols from our alphabet (language) L is a term iff it can be written in a step of a term-calculation.

Saeed Ghasemi (York University) Math 1090 5th July 2018 8 / 95 Definition (Atomic formulas) For a first-order language (alphabet) L an atomic formula or an atomic L-formula is defined recursively as follows: 1 Any Boolean variable and Boolean constant is an atomic formula. 2 If t, s are terms then t = s is an atomic formula. 3 For any predicate symbol φ (in L) of arity n, and any n terms t1, t2,..., tn the string φ(t1, t2,..., tn) is an atomic formula.

We denote the set of all atomic formulas by AF . For example m + s(0) < n × 3 and 1 + 0 = 1 are atomic formulas in the language of Number theory.

Saeed Ghasemi (York University) Math 1090 5th July 2018 9 / 95 First-Order Formulas

Definition (First-Order Formulas) For a first-order language (alphabet) L a formula or an L-formula is defined recursively as follows: 1 Any atomic formula is a formula. 2 If A is a formula, then (¬A) is a formula. 3 If A and B are formulas, then so are (A ∧ B), (A ∨ B),(A → B) and (A ≡ B). 4 If A is a formula, then for any choice of (object) variable x the string ((∀x)A) is a formula.

Note: The sub-formula A in the formula ((∀x)A) is called the scope of (∀x). Note: We are only allowed to quantify over first-order (object) variables. We can not quantify over functions or predicates. For example in a first order language we are not allowed to say “for all functions f ...”. Saeed Ghasemi (York University) Math 1090 5th July 2018 10 / 95 Definition (Formula-Calculation/ Formula-Parse) A formula-calculation (or formula-parse) is any finite sequence of strings that we may write respecting the following four requirements: 1 At each step we may write any atomic formula. 2 At any step we may write (¬A), given that A is already written. 3 At any step we may write (A ∧ B), (A ∨ B), (A → B) and (A ≡ B), given that A and B are already written. 4 At any step, and for any variable x, we may write the string ((∀x)A), given that we have already written A.

Proposition An string of symbols from our alphabet (language) L is a formula iff it can be written in a step of a formula calculation.

Saeed Ghasemi (York University) Math 1090 5th July 2018 11 / 95 Examples of formula-calculation

These are some formula-calculations:

p, q, ⊥, (p ∨ q), ((p ∨ q) → ⊥)

>, (¬>), p, ⊥, ((¬>) ∧ p), q, (q ∨ ⊥), ((¬>) ∧ p) ≡ (q ∨ ⊥)

p, x = c, ((∀y)p), u = v, (¬x = c), (((∀y)p)∨u = v), (¬x = c) → (((∀y)p)∨u = v)

Therefore any string appearing in each of these sequences is a formula. We sometimes use the same notations WFF, to denote the set of all first -ordered (well-formed) formulas. We simply say WFF is the set of all formulas and denote its members by wff.

Saeed Ghasemi (York University) Math 1090 5th July 2018 12 / 95 Definition (The Complexity of Formulas) The complexity of a wff is the total number of occurrences of ∀, ¬, ∧, ∨, →, ≡, in the formula.

For example, p and x = y have complexity 0. ((∀x)((∀y)(¬x = z))) has complexity 3. Definition We introduce a new symbol in the metatheory (an abbreviation, not a formal symbol) ∃, called the existential quantifier. For any formula A, the string (∃x)A) abbreviates the formula (¬(∀x)(¬A)).

Saeed Ghasemi (York University) Math 1090 5th July 2018 13 / 95 Priorities and Bracket Reductions

1 Outermost brackets are redundant. 2 The priorities, decreasing from left to right, is agreed to be: ((∀x) and ¬ have equal priorites.) n o (∀x) ¬ , ∧, ∨, →, ≡

3 If ◦ ∈ {∧, ∨, →, ≡} and a formula is like · · · ◦ A ◦ ... then the right ◦ acts first. That means · · · ◦ (A ◦ ... .

¬¬A is short for ¬(¬A). ¬(∀x)A is short for ¬((∀x)A). (∀x)¬A is short for (∀x)(¬A). (∀x)(∀x)A is short for (∀x)((∀y)A). (∃x)(∀x)A is short for (∃x)((∀y)A).

Saeed Ghasemi (York University) Math 1090 5th July 2018 14 / 95 More Examples of Formulas

Instead of (u = v → (((∀x)x = a) ∧ p)) we write

u = v → (∀x)x = a ∧ p

Instead of ((∀z)(¬x = y)) we write

(∀z)¬x = y

Saeed Ghasemi (York University) Math 1090 5th July 2018 15 / 95 Definition (Subformulas) The concept of “B is a subformula of A” is defined inductively: 1 A is atomic: then A and B are identical strings. 2 A is (¬C): then either B is the same string as A or B is a subformula of C. 3 A is C ◦ D where ◦ ∈ {∧, ∨, →, ≡}: then either B is the same string as A or B is a subformula of C or of D or both. 4 A is (∀x)C: then either B is the same string as A or B is a subformula of C.

Saeed Ghasemi (York University) Math 1090 5th July 2018 16 / 95 From now on whenever we say “variable” we mean “object variable”, and for “Boolean variables” we always say and write the word “Boolean”. Definition (Bound and Free Occurrences of variables) An occurrence of a variable x in a formula A is called bound iff either that occurrence is in the substring (∀x) of it is in the scope of some (∀x) in A. Otherwise we say the occurrence of x is free.

Example: In the formula below the bound occurrences of x are boxed and the rest are free.

x = y → x = y ∨ (∀ x ) x = z)

Saeed Ghasemi (York University) Math 1090 5th July 2018 17 / 95 Abstraction of First-Order Formulas

The abstraction of a first-order formula A is when we identify the “shortest” subformulas that contain each non-Boolean symbols (the object variables and object constants, functions, predicates, =, and ∀) in the formula A and replace (re-name) them by “new” (fresh) Boolean variables. Examples: The abstraction the formula p → x = y ∨ (∀x)φx ∧ q is p → p00 ∨ p000 ∧ q. The abstraction the formula x = y → x = y ∨ z = v is p → p ∨ q. The abstraction the formula (∀x)(x = y → (∀z)z = a ∨ q) is p. Saeed Ghasemi (York University) Math 1090 5th July 2018 18 / 95 The abstraction the formula

p → x = y ∨ (∀x)(φx ∧ q)

is p → p0 ∨ p00.

Note Exactly the atomic formulas and formulas of the form ((∀x)A) get abstracted.

Proposition The abstraction of any first-order formula is a Boolean formula

Proof. By induction on the complexity of formulas.

Saeed Ghasemi (York University) Math 1090 5th July 2018 19 / 95 The “abstraction” of formulas enables us to use the semantics (truth table) syntactic (proof) techniques from Boolean logic. In first-order logic Boolean variables are used to denote the statements about objects that we either do not know what it says or we don’t care about what it says.

Definition (Tautologies and Tautological implications)

We say a first-order formula A is a , and write |=taut A, iff its abstraction is a tautology. In first-order logic we write Γ |=taut A iff the abstraction of the formulas in Γ tautologically imply the abstraction of A.

Saeed Ghasemi (York University) Math 1090 5th July 2018 20 / 95 Definition (Substitution of Terms into Variables) If s, t are terms and x is a variable we define s[x := t] inductively as follows:

 s if s is a constant or a variable   (not x) s[x := t] is t if s is x   f (s1[x := t],..., sn[x := t]) if s is f (s1,..., sn)

Saeed Ghasemi (York University) Math 1090 5th July 2018 21 / 95 Definition (Substitution of Terms into Variables) If A is a first-order formula and x is a variable we define A[x := t] inductively as follows:

 φ(s [x := t],..., s [x := t]) if A is φ(s ,..., s )  1 n 1 n  s1[x := t] = s2[x := t] if A is s1 = s2  ¬C[x := t] if A is ¬C   C[x := t] ◦ D[x := t] if A is C ◦ D  A if A is one of the p, >, ⊥, (∀x)B  A[x := t] is (∀y)B[x := t] if A is (∀y)B, where -   y (not x) does not occur in -   t or x is not free in B.   undefined if A is (∀y)B, where -   y (not x) does occur in t and -   x is free in B. Saeed Ghasemi (York University) Math 1090 5th July 2018 22 / 95 The intuition behind the definition of A[x := t] is that no free variable has to be “captured” (to fall into the scope of a quantifier) as a result of this substitution. The operations [x := t] takes place in the metatheory and has the highest priority against all the other formal and informal operations such as ∀, ∃, ¬, ∧, ∨, →, ≡. Examples. (1) t = s[x := s0] is actually t = (s[x := s0]) (2) (∀x)A[x := t] is (∀x)(A[x := t]) (3) (x = y)[y := x] is x[y := x] = y[y := x] which is x = x (4) (∀x)x = y[y := x] is (∀x)x = x (5) ((∀x)x = y)[y := x] is “undefined”, because otherwise the x that was free (the third one from left) would get captured. (6) (∀x)(x = y)[y := x] is (∀x)x = x

Saeed Ghasemi (York University) Math 1090 5th July 2018 23 / 95 (7) (∀x)(∀y)φ(x, y)[y := x] is (∀x)(∀y)φ(x, y)[y := x] which is (∀x)(∀y)φ(x, y) (8) (z = a ∨ (∀x)x = y)[y := x] is (z = a)[y := x] ∨ ((∀x)x = y)[y := x], but ((∀x)x = y)[y := x] is undefined, so the whole thing is undefined. Now we want to substitute Boolean variables with formulas. There are two almost identical definitions, “conditional substitution” and “unconditional substitution”.

Saeed Ghasemi (York University) Math 1090 5th July 2018 24 / 95 Definition (Unconditional Substitution) The unconditional substitution of a formula B into all occurrences of a Boolean variable p in a formula A is denoted by A[p B] and is defined inductively as follows:

 B if A is p  A if A is Atomic Formula but is not p  A[p\B] is ¬C[p\B] if A is ¬C  C[p\B] ◦ D[p\B] if A is C ◦ D  (∀x)C[p\B] if A is (∀x)C

Saeed Ghasemi (York University) Math 1090 5th July 2018 25 / 95 Definition (Conditional Substitution) The Conditional substitution of a formula B into all occurrences of a Boolean variable p in a formula A is denoted by A[p := B] and is defined inductively as follows:

 B if A is p   A if A is Atomic Formula but is not p  ¬C[p := B] if A is ¬C A[p := B] is C[p := B] ◦ D[p := B] if A is C ◦ D   (∀x)C[p := B] if A is (∀x)C and x is not free in B  undefined else

Examples. • ((∀x)p)[p\x = y] is (∀x)x = y • ((∀x)p)[p := x = y] is undefined.

Saeed Ghasemi (York University) Math 1090 5th July 2018 26 / 95 Induction on the complexity of First-order formulas

Suppose P(A) is an statement about the (first-order) formula A and suppose we want to prove by induction on the formula complexity that P(A) holds for every formula A. Then (Basis): Show that P(A) holds for every atomic formula A. Assume P(B) and P(C) hold for formulas B and C (Induction Hypothesis). Show that P(A) holds of A is one of the ¬B, B ◦ C, where ◦ ∈ {∧, ∨, →, ≡} and for (∀x)B. If you can follow these steps then the Induction Principle implies that P(A) holds for every formula.

Saeed Ghasemi (York University) Math 1090 5th July 2018 27 / 95 Proposition If z is a fresh variable (does not occur) in A, then A[x := z][z := x] is A.

Proof carries out by induction on the complexity of the formula A, but before going on with the proof, lets note that this is not true if z is not fresh in A. For example let A be the formula x = z, then (x = z)[x := z][z := x] is (z = z)[z := x], which is x = x. That is s not A. Proof.

Suppose A is an atomic formula, that is A is t = s or φ(t1,... tn). We need to compute t[x := z][z := x] first, when z does not occur in t, since z is fresh in A. We claim that for every such t we have that

(?) t[x := z][z := x] is t

To show this we also use Induction (this time on the complexity of terms), Basis has two cases Case 1) t is x then t[x := z][z := x] is t.

Saeed Ghasemi (York University) Math 1090 5th July 2018 28 / 95 proof continues: Case 2) t is y (not x) or t is a constant. Then since t is also not z we have t[x := z][z := x] is x. If t is f (s1,..., sn). Then t[x := z][z := x] is f (s1[x := z][z := x],..., sn[x := z][z := x]). By I. H. for any si we have that si [x := z][z := x] is si . Therefore t[x := z][z := x] is f (s1,..., sn), which is t again. This finishes the proof of the claim. Basis. It is clear that if A is a Boolean variable or a Boolean constant then A[x := z][z := x] is A. Suppose A is an atomic formula t = s, then A[x := z][z := x] is t[x := z][z := x] = s[x := z][z := x], which by (?) is A. If A is φ(s1,..., sn) then A[x := z][z := x] is φ(s1[x := z][z := x],..., sn[x := z][z := x]), which by (?) is nothing but A. Inductive step. If A is one of ¬B or B ◦ C, it is clear from the definition of A[x := z][z := x] and I.H. that A[x := z][z := x] is A.

Saeed Ghasemi (York University) Math 1090 5th July 2018 29 / 95 proof continues: To deal with the stage of formation with (∀), assume the result is true for B (I.H.) and consider two cases where A is either (∀x)B and (∀w)B, where w is not x. Remember that since our assumption was that z does not occur in A, so it does not occur in B either. The first case: A is (∀x)B. Then ((∀x)B)[x := z][z := x] is ((∀x)B)[z := x], which is (∀x)B[z := x]( z is not free in B, nor it is bound!), which is A, since z does not occur in B. The second case: A is (∀w)B. Then ((∀w)B)[x := z][z := x] is (∀w)(B[x := z])[z := x] (by definition and the fact that z is not w!), which is (∀w)B[z := x][z := x] (by definition and the fact that x is not w!). By I. H. we know that B[z := x][z := x] is B, therefore (∀w)B[z := x][z := x] is (∀w)B, which is A. Done!

Saeed Ghasemi (York University) Math 1090 5th July 2018 30 / 95 Axioms of First-Order Logic

Ax1. All tautologies: meaning all the first-order formulas whose abstraction is a Boolean tautology. Ax2. (specialization or substitution axiom) : All the formulas of the form (∀x)A → A[x := t]. Ax3. All the formulas of the form (∀x)(A → B) → (∀x)A → (∀x)B. Ax4. All the formulas of the form A → (∀x)A, where x does not occur free in A. Ax5. (Identity axiom): All the formulas of the form x = x. Ax6. (Leibniz axiom for identity): All the formulas of the form t = s → (A[x := t] ≡ A[x := s]). Ax7.(Partial Generalization) If A is an axiom then (∀x)A is also an axiom, for any choice of variable x. Every “instance” of these axioms is an axiom, so there are in fact infinitely axioms.

• We show the set of all first-order axioms by Λ1. Saeed Ghasemi (York University) Math 1090 5th July 2018 31 / 95 Primary Rules of Inference

We have the same of rules of inference as the Boolean logic. 1. Boolean Leibniz rule A ≡ B C[p := A] ≡ C[p := B] Provided that p is not in the scope of any quantifiers in C. 2. Equanimity rule

A, A ≡ B B We will abbreviate Boolean Leibniz by BL. We apply these rules to abstractions of formulas. In BL it is important that p does not belong to a scope of any quantifier in C, otherwise p will disappear in the abstraction of C[p := A] and C[p := B].

Saeed Ghasemi (York University) Math 1090 5th July 2018 32 / 95 The concept of “theorem calculation” and theorems remains unchanged. Definition (Theorem Calculation or Proof) Let Γ be a given set of (first-order) formulas. A “theorem-calculation ” or “proof” from Γ is a finite ordered sequence of formulas such that: In any stage we may write down

1 Any member of Λ1 or Γ 2 As long as all the formulas of the numerator of an “instance” of Leibniz rule or equanimity are already written down, we may write the denominator for the same instance.

Any formula in Γ-proof is called “assumption” or “hypothesis” or “nonlogical axiom”. Any Γ-proof has to finish in finitely many steps. Therefore it only uses finitely many formulas in Γ and axioms.

Saeed Ghasemi (York University) Math 1090 5th July 2018 33 / 95 Definition Any formula A that appears in in a Γ-proof is called a Γ-theorem. If A is a Γ-theorem we write Γ ` A.

If A is a Γ-theorem and Γ = ∅, we write ` A and we call A an “absolute theorem” or a “logical theorem”.

Definition (Inductive definition of theorems) A formula E is a Γ-theorem iff one of the following holds.

Th1. E belongs to Γ ∪ Λ1 Th2. If (an instance of) A ≡ B is a Γ-theorem, then E is equal to C[p := A] ≡ C[p := B], provided that p does not appear in scope of any formula C, for any formula C and variable p. Th3. If both A and A ≡ E are Γ-theorems.

Saeed Ghasemi (York University) Math 1090 5th July 2018 34 / 95 Remarks:

All the (Γ-) theorems from Boolean logic carry over unchanged, such as Redundant true, Modus Ponens, de Morgan and etc. The deduction theorem is also true for the first order logic (with a tiny bit of change in the proof!). Most importantly, the Post’s theorem carries over from Boolean Logic to predicate logic: If Γ |=taut A then Γ ` A. The special case where Γ = ∅ follows from Ax1.: If |=taut A, then A belongs to Ax1, therefore ` A. However, soundness needs some adjustments! For example, we know that ` x = x hols for any variable x (Ax5), but the abstraction of x = x is just p, for a Boolean variable p, well we know that 6|=taut p, so 6|=taut x = x. This does not mean our first-order logic is not sound. In fact, it is sound. However in predicate logic the concept of “truth” is narrower than tautologies and tautological implications.

Saeed Ghasemi (York University) Math 1090 5th July 2018 35 / 95 Two Equivalent

Definition Two logics over the same first-order language are called equivalent iff they have the same absolute theorems. • Two equivalent logic also have the same relative theorems. Meaning that if in one logic Γ proves A, so does the other one. This is an easy consequence of the deduction theorem. If both logics extend Boolean logic, then both do enjoy the deduction theorem. here are the two logics that we want to compare: (1) The first-order logic that we introduced (lets call it Logic (1)). (2) The same logic, except that this logic has Modeus Ponens as the only primary rule of inference (lets call it Logic (2)).

Saeed Ghasemi (York University) Math 1090 5th July 2018 36 / 95 Lemma Post’s theorem holds for logic (2) for finite Γ.

Proof.

Suppose A1, A2,..., An |=taut B. We need to show that in logic (2) we have

(?) A1, A2,..., An ` B

By induction on natural numbers, it is easy to show that |=taut A1 → A2 → · · · → An → B. Lets give a Hilbert style proof for (?).

Saeed Ghasemi (York University) Math 1090 5th July 2018 37 / 95 (1) A1 (Hyp.)

(2) A2 (Hyp.) . . . .

(n) An (Hyp.)

(n + 1) A1 → A2 → · · · → An → B (Axiom)

(n + 2) A2 → · · · → An → B ((1), (n + 1) + MP)

(n + 3) A3 → · · · → An → B ((2), (n + 2) + MP) . . . .

(n + 1) An → B ((n − 1), (n + n − 1) + MP) (n + n + 1) B ((n), (n + n) + MP)

Saeed Ghasemi (York University) Math 1090 5th July 2018 38 / 95 Lemma Logic (2) has BL and Eqn as derived rules of inference.

Proof. Suppose A, B and C are first-order formulas. By the soundness theorem for Boolean logic we have that A, A ≡ B |=taut B and A ≡ B |=taut C[p := A] ≡ C[p := B] (note that the soundness is applied for the Boolean abstraction of the corresponding theorems, just as the rules of inference for first-order logic do). By the previous lemma we can replace |=taut with ` since there are only finitely many hypotheses, giving us the Eqn and BL as derived rules of inference.

Saeed Ghasemi (York University) Math 1090 5th July 2018 39 / 95 Theorem Logic (1) and (2) are equivalent.

Proof. Well, they both have same axioms. The axioms and rule of inference Eqn and BL of the logic (1) can imply MP and conversely the axioms and MP of logic (2) implies Eqn and BL.

It is sometimes easier to work with Logic (2) than logic (1) one to prove theorems, especially when proving by induction on the length of the proof. By the theorem above it does not matter which logic we choose.

Saeed Ghasemi (York University) Math 1090 5th July 2018 40 / 95 Theorem (Weak Generalization) Suppose Γ ` A and x is a variable which does not occur free in any formula in Γ, then Γ ` (∀x)A.

Proof. Prove by induction on the length of the Γ-proof. Basis. A has a proof of length 1. The A is either an axiom or it belongs to Γ. A is an axiom: Then A → (∀x)A is also an axiom (Ax7.), therefore Γ ` (∀x)A. A ∈ Γ: Since A ∈ Γ, we know that x is not free in A, therefore A → (∀x)A is an axiom (Ax4). Since also Γ ` A, by MP we have we know Γ ` (∀x)A. Now suppose the theorem is true for any formula that appears in a Γ-proof of length ≤ n (I.H.). Suppose Γ ` A and A has a proof of length n + 1. This means that at some steps before n + 1 of the proof for A, there were formulas B and B → A such that A is derived from them via MP. By I.H. we have Γ ` (∀x)B and Γ ` (∀x)(B → A). By Ax3 we have

Saeed Ghasemi (York University) Math 1090 5th July 2018 41 / 95 Γ ` (∀x)(B → A) → (∀x)A → (∀x)A. By twice application of MP we have Γ ` (∀x)A.

Corollary If Γ ` A and all the formulas that are used in a Γ-proof of A do not have a free occurrence of x, then Γ ` (∀x)A.

Corollary If ` A, then ` (∀x)A.

Note. The last corollary does NOT say for any A we have A ` (∀x)A. One can prove the latter if x is not free in A. The weak generalization theorem says that if A is an “absolute theorem” and (∀x)A is an absolute theorem. In other words, the weak generalization theorem says that if you have written down A in a proof, then you may write down (∀x), but only if A is an absolute theorem.

Saeed Ghasemi (York University) Math 1090 5th July 2018 42 / 95 Theorem (Specialization Rule) (∀x)A ` A[x := t] (of course only if A[x := t] is defined)

Proof.

(1) (∀x)A (Hyp.) (2) (∀x)A → A[x := t](Ax2) (3) A[x := t] ((1), (2) + MP)

Corollary (∀x)A ` A

In a proof we will abbreviate Specialization Rule and its Corollary by “Spec”. Saeed Ghasemi (York University) Math 1090 5th July 2018 43 / 95 Theorem (Distributivity of ∀ over ∧) ` (∀x)(A ∧ B) ≡ (∀x)A ∧ (∀x)B

Proof. By a theorem (Ping-Pong Theorem) it is enough to prove ` (∀x)(A ∧ B) → (∀x)A ∧ (∀x)B and ` A ∧ (∀x)B → (∀x)(A ∧ B). First direction (→):

(1) (∀x)(A ∧ B)(Hyp.) (2) A ∧ B ((1) + Spec.) (3) A ((2) + Ax1) (4) B ((2) + Ax1) (5) (∀x)A ((3) + Gen. : Hypothesis has no free x) (6) (∀x)B ((4) + Gen. : Hypothesis has no free x) (7) (∀x)A ∧ (∀x)B ((5, 6) + Ax1)

Saeed Ghasemi (York University) Math 1090 5th July 2018 44 / 95 proof continues. For the other direction (←):

(1) (∀x)A ∧ (∀x)B (Hyp.) (2) (∀x)A ((1) + Ax1.) (3) (∀x)B ((1) + Ax1) (4) A ((2) + Spec.) (5) B ((3) + Spec.) (6) A ∧ B ((4, 5) + Ax1.) (7) (∀x)(A ∧ B) ((6) + Gen. : Line (1) has no free x)

Saeed Ghasemi (York University) Math 1090 5th July 2018 45 / 95 Theorem ` (∀x)(∀y)A ≡ (∀y)(∀x)A

Proof. Another Ping-Pong argument. (→)

(1) (∀x)(∀y)A (Hyp.) (2) (∀y)A ((1) + Spec.) (3) A ((2) + Spec.) (4) (∀x)A ((3) + Gen. : Line (1) has no free x) (5) (∀x)(∀y)A ((4) + Gen. : Line (1) has no free y)

(←) is very similar to the above.

Saeed Ghasemi (York University) Math 1090 5th July 2018 46 / 95 Theorem (∀-Monoticity) If Γ ` A → B, then Γ ` (∀x)A → (∀x)B, provided that x does not occur free in any formula in Γ

Proof.

(1) A → B (Γ − theorem) (2) (∀x)(A → B) ((1) + Gen : x does not occur free in Γ) (3) (∀x)(A → B) → (∀x)A → (∀x)B (Ax3) (4) (∀x)A → (∀x)B ((2, 3) + MP)

Saeed Ghasemi (York University) Math 1090 5th July 2018 47 / 95 Corollary If ` A → B, then ` (∀x)A → (∀x)B.

Saeed Ghasemi (York University) Math 1090 5th July 2018 48 / 95 Theorem If Γ ` A ≡ B, then Γ ` (∀x)A ≡ (∀x)B, provided that x does not occur free in any formula in Γ

Proof.

(1) A ≡ B (Γ − theorem)

(2) A → B ((1) |=taut (2), Ax1)

(3) B → A ((1) |=taut (3), Ax1) (4) (∀x)A → (∀x)B ((2) + ∀ − mon) (5) (∀x)B → (∀x)A ((3) + ∀ − mon)

(6) (∀x)A ≡ (∀x)B ((4.5) |=taut (6), Ax1)

Saeed Ghasemi (York University) Math 1090 5th July 2018 49 / 95 Corollary If ` A ≡ B, then ` (∀x)A ≡ (∀x)B.

An example of substitution. Suppose that we have a formula x = y and want to use substitution to obtain y = x. Note that

(x = y)[x := y][y := x] is x = x and (x = y)[y := x][x := y] is y = y One way to obtain y = x via a substitution from x = y is to introduce two new variables z and w and do:

(x = y)[x := z][y := w][z := y][w := x] is y = x

Saeed Ghasemi (York University) Math 1090 5th July 2018 50 / 95 Definition (Simultaneous Substitution) The expression A[x1, x2,..., xr := t1, t2,..., tr ] denotes the simultaneous substitution of the terms t1,..., tr into the variables x1,..., xr and it is defined as

A[x1 := z1] ... [xr := zr ][z1 := t1] ... [zr := tr ] where z1,..., zr are distinct new variables that do not occur in any of A, t1,..., tr at all.

• In simultaneous substitution, because z1,..., zr do not occur in any of A, t1,..., tr , in the sequence of the substitutions the previous substitutions do not have any effect on the next one. Therefore simultaneous substitution is order independent.

Saeed Ghasemi (York University) Math 1090 5th July 2018 51 / 95 Theorem (Substitution Theorem)

If ` A and t1,..., tr are any terms, then ` A[x1, x2,..., xr := t1, t2,..., tr ].

Proof. If ` A then ` (∀x)A (a metatheorem). Then by the specialization rule we have ` A[x := z1]. Apply this argument 2r times to get

` A[x1 := z1] ... [xr := zr ][z1 := t1] ... [zr := tr ] which is ` A[x1, x2,..., xr := t1, t2,..., tr ]

Saeed Ghasemi (York University) Math 1090 5th July 2018 52 / 95 Theorem If Γ ` A and there is a Γ-proof for A which none of the formulas appearing in that proof have free occurrences of x1,..., xr , then Γ ` A[x1,..., xr := t1,..., tr ].

Proof.

Suppose C1,..., Cn is a subset of Γ which x1,..., xr do not occur free in them and C1,..., Cn ` A. Then by applying the deduction theorem n times, we get ` C1 → ... Cn → A. By the substitution theorem we get

` (C1 → · · · → Cn → A)[x1 := z1] ... [xr := zr ][z1 := t1] ... [zr := tr ] but since none of xi or zi appear free in C1,..., Cn we have

` C1 → · · · → Cn → A[x1 := z1] ... [xr := zr ][z1 := t1] ... [zr := tr ]

Saeed Ghasemi (York University) Math 1090 5th July 2018 53 / 95 proof continues. Apply MP n times to get

C1,..., Cn ` A[x1 := z1] ... [xr := zr ][z1 := t1] ... [zr := tr ]

By strengthening hypotheses we have

Γ ` A[x1 := z1] ... [xr := zr ][z1 := t1] ... [zr := tr ]

Saeed Ghasemi (York University) Math 1090 5th July 2018 54 / 95 Theorem (Weak Leibniz–”WL”) If ` A ≡ B then ` C[p\A] ≡ C[p\B].

Proof. The proof is by induction on the complexity of C. Basis. Complexity zero C. There are two cases to consider. (1) C is p. Then we have to show that if ` A ≡ B then ` A ≡ B, which is trivial. (2) C is not p. Then C is one of the q (not p), t = s, φ(t1,..., tn), >, ⊥. Then we must show if ` A ≡ B then ` C ≡ C. But the latter is a theorem so it holds by (Ax1). Inductive step. (i) C is ¬D. By I.H. we have ` D[p\A] ≡ D[p\B]. Then we have ` ¬D[p\A] ≡ ¬D[p\B] by tautological implication (verify that A ≡ B is tautologically equivalent to ¬A ≡ ¬B, for any formulas A, B). Thus by the definition ` (¬D)[p\A] ≡ (¬D)[p\B].

Saeed Ghasemi (York University) Math 1090 5th July 2018 55 / 95 proof continued. (ii) C is D ◦ E, where ◦ ∈ {∧, ∨, →, ≡}: By I. H. ` D[p\A] ≡ D[p\B] and ` E[p\A] ≡ E[p\B]. Hence by tautological implication ` D[p\A] ◦ E[p\A] ≡ D[p\B] ◦ E[p\B] (check the tautological implication!). Thus by definition A ≡ B ` (D ◦ E)[p\A] ≡ (D ◦ E)[p\B]. (iii) C is (∀x)D. By I.H. we have ` D[p\A] ≡ D[p\B]. Therefore by a theorem that we proved, we have ` (∀x)D[p\A] ≡ (∀x)D[p\B]. Again by the definition ` ((∀x)D)[p\A] ≡ ((∀x)D)[p\B].

Note. In order to apply WL, A ≡ B has to be an absolute theorem. We do NOT have A ≡ B ` D[p\A] ≡ D[p\B] in general.

Saeed Ghasemi (York University) Math 1090 5th July 2018 56 / 95 Here is a more generous WL theorem which allows A ≡ B to be a relative theorem. Theorem (Weak Leibniz–”WL”) If Γ ` A ≡ B and none of the bound variables of C occur free in any of the formulas in Γ, then Γ ` C[p\A] ≡ C[p\B].

Proof. The proof is again by induction on C. The basis and inductive steps are exactly the same as the previous WL theorem, replacing ` with Γ ` in the proof. Only the case where C is (∀x)D is different. By I.H. we have Γ ` D[p\A] ≡ D[p\B]. Since x is bound in C, by our assumption it does not occur free in Γ. Hence by a theorem Γ ` (∀x)D[p\A] ≡ (∀x)D[p\B]. Again by the definition Γ ` ((∀x)D)[p\A] ≡ ((∀x)D)[p\B].

Saeed Ghasemi (York University) Math 1090 5th July 2018 57 / 95 The next theorem allows us to drop the side condition on BL rule (the one saying that p can not be in the scope of any quantifiers of C). Theorem (Strong Leibniz–”SL”) A ≡ B ` C[p := A] ≡ C[p := B] (of course only when both C[p := A] and C[p := B] are defined)

Proof. The proof is by induction on the complexity of C. Basis. Complexity zero C. There are two cases to consider. (1) C is p. Then we have to show that A ≡ B ` A ≡ B, which holds, since it is a theorem from Boolean logic (Ax1). (2) C is not p. Then C is one of the q (not p), t = s, φ(t1,..., tn), >, ⊥. Then we must show A ≡ B ` C ≡ C. Since ` C ≡ C, we know that A ≡ B ` C ≡ C follows from (Ax1). Inductive step. (i) C is ¬D. By I.H. we have A ≡ B ` D[p := A] ≡ D[p := B]. Then we have A ≡ B ` ¬D[p := A] ≡ ¬D[p := B] by tautological implication.

Saeed Ghasemi (York University) Math 1090 5th July 2018 58 / 95 proof continued. Thus by the definition A ≡ B ` (¬D)[p := A] ≡ (¬D)[p := B]. (ii) C is D ◦ E, where ◦ ∈ {∧, ∨, →, ≡}: By I. H. A ≡ B ` D[p := A] ≡ D[p := B] and A ≡ B ` E[p := A] ≡ E[p := B]. Hence by tautological implication A ≡ B ` D[p := A] ◦ E[p := A] ≡ D[p := B] ◦ E[p := B] (check the tautological implication!). Thus by definition A ≡ B ` (D ◦ E)[p := A] ≡ (D ◦ E)[p := B]. (iii) C is (∀x)D. By I.H. we have A ≡ B ` D[p := A] ≡ D[p := B]. Since C[p := A] and C[p := B] are defined x is not free in either A or B. Therefore x is not free in A ≡ B. Therefore by a theorem that we proved, we have A ≡ B ` (∀x)D[p := A] ≡ (∀x)D[p := B], which again by definition (since x is not free in either A or B) we have A ≡ B ` ((∀x)D)[p := A] ≡ ((∀x)D)[p := B].

Saeed Ghasemi (York University) Math 1090 5th July 2018 59 / 95 Corollary D → (A ≡ B) ` D → (C[p := A] ≡ C[p := B])

Proof. By deduction theorem it is enough to prove

D → (A ≡ B), D ` C[p := A] ≡ C[p := B]

Then

(1) D (Hyp.) (2) D → (A ≡ B)(Hyp.) (3) A ≡ B ((12) + MP) (4) C[p := A] ≡ C[p := B] ((3) + SL)

Saeed Ghasemi (York University) Math 1090 5th July 2018 60 / 95 Theorem ` (∀x)(A → B) ≡ (A → (∀x)B), provided that x is not free in A.

Proof. We use a Ping-Pong argument again. (→) We show that ` (∀x)(A → B) → (A → (∀x)B).Applying the deduction theorem twice, this is equivalent to show that (∀x)(A → B), A ` (∀x)B.

(1) (∀x)(A → B)(Hyp.) (2) A (Hyp.) (3) A → B ((1) + Spec) (4) B ((2, 3) + MP) (5) (∀x)B ((4) + Gen : there are no free x in lines (1,2))

Saeed Ghasemi (York University) Math 1090 5th July 2018 61 / 95 Proof. (←) We show that ` (A → (∀x)B) → (∀x)(A → B). Applying the deduction theorem, this is equivalent to show that A → (∀x)B ` (∀x)(A → B). Since Hypotheses A → (∀x)B has no free x, by the weak generalization theorem, it is enough to prove A → (∀x)B ` A → B. Applying the deduction theorem again, this is equivalent to show that A → (∀x)B, A ` B

(1) A → (∀x)B (Hyp.) (2) A (Hyp.) (3) (∀x)B ((1, 2) + MP) (4) B ((3) + Spec)

Saeed Ghasemi (York University) Math 1090 5th July 2018 62 / 95 Note. Of course we can write equational-style proofs in predicate logic too, but in most cases Hilbert-style proofs are more convenient in predicate logic. However, equational-style proofs can prove both sides of a Ping-Pong argument ((→) and (←)) in a single blow. So they shorten this kind of proofs.

Saeed Ghasemi (York University) Math 1090 5th July 2018 63 / 95 Corollary ` (∀x)(A ∨ B) ≡ A ∨ (∀x)B, given that x is not free in A.

Proof. (Equational-style)

(∀x)(A ∨ B) ⇐⇒ hWL and ` A ∨ B ≡ ¬A → B (tautology): C − part is (∀x)pi (∀x)(¬A → B) ⇐⇒ htheorem, x is not free in Ai ¬A → (∀x)B ⇐⇒ htautologyi A ∨ (∀x)B

Saeed Ghasemi (York University) Math 1090 5th July 2018 64 / 95 Corollary ` (∃x)(A ∧ B) ≡ A ∧ (∃x)B, given that x is not free in A.

Proof.

(∃x)(A ∧ B) ⇐⇒ hDefinition of ∃i ¬(∀x)¬(A ∧ B) ⇐⇒ hWL and deMoegan : C − part is ¬(∀x)pi ¬(∀x)(¬A ∨ ¬B) ⇐⇒ hWL and theorem − x is not free in ¬A : C − part is ¬pi ¬(¬A ∨ (∀x)¬B) ⇐⇒ hdeMorgani ¬¬A ∧ ¬(∀x)¬B ⇐⇒ hWL double : C − part is p ∧ ¬(∀x)¬Bi

Saeed Ghasemi (York University) Math 1090 5th July 2018 65 / 95 proof continued.

A ∧ ¬(∀x)¬B ⇐⇒ hWL definition of ∃ : C − part is A ∧ pi A ∧ (∃x)B

Note. We might use one sided arrow (⇒) in an equational-style proof. If A → B is a (relative) theorem, in some parts of an equational-style proof we may write

A ⇒hAnnotationi B

Saeed Ghasemi (York University) Math 1090 5th July 2018 66 / 95 Theorem (Empty range) ` (∀x)(⊥ → A) ≡ >.

Proof. By redundant true it is enough to prove ` (∀x)(⊥ → A). We have ` ⊥ → A (Ax1), so by the weak generalization theorem we conclude that ` (∀x)(⊥ → A).

Saeed Ghasemi (York University) Math 1090 5th July 2018 67 / 95 Theorem (Another Distributivity of ∀ over ∧ ) ` (∀x)(A → B) ∧ (∀x)(A → C) ≡ (∀x)(A → B ∧ C).

Proof.

(∀x)(A → B) ∧ (∀x)(A → C) ⇐⇒ hTheorem : Distributivity of ∀ over ∧ i (∀x)((A → B) ∧ (A → C)) ⇐⇒ hWL : tautology (Ax1) : C − part is (∀x)pi (∀x)(A → B ∧ C)

Saeed Ghasemi (York University) Math 1090 5th July 2018 68 / 95 Theorem ` (∀x)(A ∨ B → C) ≡ (∀x)(A → C) ∧ (∀x)(B → C).

Proof.

(∀x)(A → C) ∧ (∀x)(B → C) ⇐⇒ hTheoremi (∀x)((A → C) ∧ (B → C)) ⇐⇒ hWL : tautology (Ax1) : C − part is (∀x)pi (∀x)(A ∨ B → C)

Saeed Ghasemi (York University) Math 1090 5th July 2018 69 / 95 Theorem (Dummy Renaming for ∀) If z does not occur in A, then ` (∀x)A ≡ (∀z)A[x := z].

Proof. We use Ping-Pong. Note that since z is fresh in A, A[x := z] is defined. (→)

(1) (∀x)A → A[x := z](Ax2) (2) (∀z)(∀x)A → (∀z)A[x := z](∀ − monot) (3) (∀x)A → (∀z)(∀x)A (Ax4): z is not free in (∀x)A) (4) (∀x)A → (∀z)A[x := z] ((3) + Transitivity)

Saeed Ghasemi (York University) Math 1090 5th July 2018 70 / 95 Proof. (←)

(1) (∀z)A[x := z] → A[x := z][z := x](Ax2) (2) (∀z)A[x := z] → A (A[x := z][z := x] is A) (3) (∀x)(∀z)A[x := z] → (∀x)A ((2) + ∀ − Mon) (4) (∀z)A[x := z] → (∀x)A ((3) + Ax4))

Theorem (Dummy Renaming for ∃) If z does not occur in A, then ` (∃x)A ≡ (∃z)A[x := z].

Saeed Ghasemi (York University) Math 1090 5th July 2018 71 / 95 Inserting and Removing ∃

Theorem (Dual of Ax2) ` A[x := t] → (∃x)A

Proof.

A[x := t] → (∃x)A ⇐⇒ hWL + ∃ − def : C − part is A[x := t] → (∃x)Ai A[x := t] → ¬(∀x)¬A ⇐⇒ hTautologyi (∀x)¬A → ¬A[x := t]

Saeed Ghasemi (York University) Math 1090 5th July 2018 72 / 95 Corollary (Dual of Specialization Rule) A[x := t] ` (∃x)A

Corollary A ` (∃x)A

Theorem (Introduction of ∀) If x does not occur free in Γ and A, then Γ ` A → B iff Γ ` A → (∀x)B.

Proof. Suppose Γ ` A → B, then by ∀-monotonicity theorem we have Γ ` (∀x)A → (∀x)B, since x is not free in Γ. And since x is not free in A we have ` A → (∀x)A (Ax4). Therefore Γ ` A → (∀x)B.

Saeed Ghasemi (York University) Math 1090 5th July 2018 73 / 95 proof continued. Suppose Γ ` A → (∀x)B. By Ax2 we have (∀x)B ` B. By transitivity Γ + A ` B. Applying the deduction theorem we conclude that Γ ` A → B.

Theorem (Introduction of ∃) If x does not occur free in Γ and B, then Γ ` A → B iff Γ ` (∃x)A → B.

Proof. First assume Γ ` A → B.

A → B ⇐⇒ hTautologyi ¬B → ¬A ⇐⇒ hIntroduction of ∀i ¬B → (∀x)¬A

Saeed Ghasemi (York University) Math 1090 5th July 2018 74 / 95 proof continued.

⇐⇒ hTautologyi ¬(∀x)¬A → B ⇐⇒ h∃ − definitioni (∃x)A → B

Now assume Γ ` (∃x)A → B. By a theorem we have ` A → (∃x)A. Therefore Γ + A ` (∃x)A and Γ + A ` (∃x)A → B. By transitivity Γ + A ` B. Therefore Γ ` A → B.

Saeed Ghasemi (York University) Math 1090 5th July 2018 75 / 95 Theorem (Auxiliary Variable Metatheorem) Assume that Γ ` (∃x)A and Γ ` A[x := z] → B, where z is a fresh variable with respect to Γ, A and B, then Γ ` B.

Proof. From Introduction of ∃ theorem we have Γ ` (∃z)A[x := z] → B, because z is fresh with respect to Γ and B.

(∃z)A[x := z] → B ⇐⇒ hSL : Dummy renaming for ∃ : z is fresh : C − part is p → Bi (∃x)A → B ⇐⇒ hSL :(∃x)A is a Γ − theorem : C − part is p → Bi > → B ⇐⇒ hTautologyi B

Saeed Ghasemi (York University) Math 1090 5th July 2018 76 / 95 • Auxiliary Variable Metatheorem is very natural and used frequently in mathematics and computer science. It basically says that suppose we want to prove B using some hypotheses Γ, and we also know that from Γ we can deduce (∃x)A, meaning that for some x, A(x) holds, that can be helpful towards proving B. But we may not exactly know or care for which x, A(x) holds! But we can just call this value of x by z. Then we can add A(z) to our hypotheses Γ and hope for an easier proof for B. If we prove B from Γ using this “auxiliary” assumption A(z), then we have proved it using only Γ, since (∃x)A was provable from Γ. • For example, we use Auxiliary Variable Metatheorem in induction. When we want to show that P(n) holds for arbitrary number n, using some assumptions Γ, we use Induction Hypotheses and add an extra assumption that P(k) is true for all k < n. Now we try to prove P(n) using assumptions Γ + P(k) for all k < n.

Saeed Ghasemi (York University) Math 1090 5th July 2018 77 / 95 Corollary Assume that ` (∃x)A and moreover A[x := z] ` B, where z is fresh with respect to A and B, then ` B.

Corollary Assume that A[x := z] ` B, where z is fresh with respect to A and B, then (∃x)A ` B.

Auxiliary Variable Metatheorem is our ticket to remove ∃.

Saeed Ghasemi (York University) Math 1090 5th July 2018 78 / 95 Example. Prove that ` (∃x)(∀y)A → (∀y)(∃x)A. Proof 1. By the deduction theorem it is enough to prove (∃x)(∀y)A ` (∀y)(∃x)A.

(1) (∃x)(∀y)A (Hyp.) (2) (∀y)A[x := z] (Auxiliary hypothesis associated to (1): z is fresh) (3) A[x := z] ((2) + Spec.) (4) (∃x)A ((3) + Dual of Spec.) (5) (∀y)(∃x)A ((4) + Gen : no free y in lines (1, 2))

Saeed Ghasemi (York University) Math 1090 5th July 2018 79 / 95 Proof 2.

(1) A → (∃x)A (abs.theorem) (2) (∀y)A → (∀y)(∃x)A (∀ − mon.) (3) (∃x)(∀y)A → (∀y)(∃x)A (Introduction of ∃.)

Saeed Ghasemi (York University) Math 1090 5th July 2018 80 / 95 Example. Prove that (∃x)(A → B), (∀x)A ` (∃x)B.

(1) (∃x)(A → B)(Hyp.) (2) (∀x)A (Hyp.) (3) A[x := z] → B[x := z] (Aux. hypothesis associated to (1): z fresh) (4) A[x := z] ((2) + Ax2) (5) B[x := z] ((3, 4) + MP) (6) (∃x)B ((5) + Dual of Spec.)

Saeed Ghasemi (York University) Math 1090 5th July 2018 81 / 95 Properties of Equality

We explore the consequences of Ax5 and Ax6. Lemma ( of =) ` x = y → y = x

Proof.

(1) x = y → (x = x ≡ y = x)(Ax6.) (2) x = y → x = x → y = x (Tautological Implication) (3) x = x (Ax5) (4) x = y → y = x ((2, 3) + tautological Implication)

Saeed Ghasemi (York University) Math 1090 5th July 2018 82 / 95 Lemma (Transitivity of =) ` x = y → y = z → x = z

Proof.

(1) x = y → (y = z ≡ x = z)(Ax6.) (2) x = y → y = z → x = z (Tautological Implication)

Saeed Ghasemi (York University) Math 1090 5th July 2018 83 / 95 Lemma Suppose f is a function symbol of arity n. Then

` x = y → f (z1,..., zi , x, zi+2,..., zn) = f (z1,..., zi , y, zi+2,..., zn)

Proof. Apply Ax6 for A being

f (z1,..., zi , x, zi+2,..., zn) = f (z1,..., zi , y, zi+2,..., zn) then we get ` x = y → f (z1,..., zi , x, zi+2,..., zn) = f (z1,..., zi , y, zi+2,..., zn) ≡

f (z1,..., zi , y, zi+2,..., zn) = f (z1,..., zi , y, zi+2,..., zn)

We have ` f (z1,..., zi , y, zi+2,..., zn) = f (z1,..., zi , y, zi+2,..., zn) by Ax5. Then the tautological implication A → B ≡ C, B ` A → C implies that

Saeed Ghasemi (York University) Math 1090 5th July 2018 84 / 95 proof continued.

` x = y → f (z1,..., zi , x, zi+2,..., zn) = f (z1,..., zi , y, zi+2,..., zn)

Corollary Suppose f is a function symbol of arity n. Then

` x1 = y1 → · · · → xn = yn → f (x1,..., xn) = f (y1,..., yn)

Proof. By the deduction theorem we need to prove

x1 = y1,..., xn = yn `→ f (x1,..., xn) = f (y1,..., yn)

Saeed Ghasemi (York University) Math 1090 5th July 2018 85 / 95 proof continued. By the previous lemma we have

x1 = y1 `→ f (x1, x2 ..., xn) = f (y1, x2 ..., xn) and

x1 = y1, x2 = y2 `→ f (x1, x2, x3 ..., xn) = f (y1, y2, x3 ..., xn) and so on. After n steps we have

x1 = y1,..., xn = yn `→ f (x1,..., xn) = f (y1,..., yn)

Saeed Ghasemi (York University) Math 1090 5th July 2018 86 / 95 Corollary

Suppose f is a function symbol of arity n and ti and si are terms. Then

` t1 = s1 → · · · → tn = sn → f (t1,..., tn) = f (s1,..., sn)

Proof. By the last corollary we have

` x1 = y1 → · · · → xn = yn → f (x1,..., xn) = f (y1,..., yn)

Let A be the formula x1 = y1 → · · · → xn = yn → f (x1,..., xn) = f (y1,..., yn). By the substitution theorem we have ` A[x1,..., xn, y1,... yn := t1,... tn, s1,..., sn]. This is exactly what we had to show.

Saeed Ghasemi (York University) Math 1090 5th July 2018 87 / 95 Theorem Suppose t, t0, s are terms. Then ` t = t0 → s[x := t] = s[x := t0]

Proof. Proof is by induction on complexity of the term s. Basis Case(1) s is a constant or a variable other than x. Then we have to show that ` t = t0 → s = s, which is trivial. Case(2) s is x. Then we have to show that ` t = t0 → t = t0, which is also trivial. Inductive step. Suppose s is f (t1,..., tn) and the theorem is true for 0 0 t1,..., tn, i.e., ` t = t → ti [x := t] = ti [x := t ] for each i = 1,..., n. We need to show that 0 0 t = t ` f (t1,..., tn)[x := t] = f (t1,..., tn)[x := t ].

Saeed Ghasemi (York University) Math 1090 5th July 2018 88 / 95 proof continued.

(1) t = t0 (Hyp.) 0 (2) t1[x := t] = t1[x := t ] ((1) + I .H. + MP) 0 (3) t2[x := t] = t2[x := t ] ((1) + I .H. + MP) ...... 0 (n + 1) tn[x := t] = tn[x := t ] ((1) + I .H. + MP)

(n + 2) f (t1[x := t],..., tn[x := t]) = 0 0 f (t1[x := t ],..., tn[x := t ]) ((1) − (n + 1) + Previous lemma)

Saeed Ghasemi (York University) Math 1090 5th July 2018 89 / 95 First-Order Logic Semantics-very briefly

In order to give meanings to the so far meaningless formulas we interpret the logical symbols as actual mathematical objects. This interpretation is not unique and it is up to us. For a first order language, an interpretation is a pair D = (D, M), where D is a nonempty set, called the domain or underlying set of the interpretation and M is called translator, which is a mapping that assigns an appropriate mathematical objects to each of the symbols of the language. Instead of writing M(...) we write ...D.

Saeed Ghasemi (York University) Math 1090 5th July 2018 90 / 95 Definition (Interpreting a Language-Step 1: Translating the Alphabet) Suppose D = (D, M) is an interpretation of a fixed first order language. 1 For each free variable x, the interpretation or translation of x, denoted by xD (or M(x)), is some member of D. 2 For each Boolean variable p, the interpretation of p, pD is some member of {t, f }. 3 >D = t and ⊥D = f . 4 For each object constant c of the alphabet, the translation cD is some member of D. 5 For each function symbol f of the alphabet, the translation f D is a mathematical function in metatheory with the fame arity as f . f D takes as inputs elements from D and its output value is also and element of D. 6 For each predicate symbol φ of the alphabet, the translation φD is a mathematical relation in metatheory with the fame arity as φ. phi D takes as inputs elements from D and its output value is an element of

Saeed{ Ghasemit, f }. (York University) Math 1090 5th July 2018 91 / 95 Note. Boolean connectives, = and brackets are not translated, they keep their meaning. Note.

Boolean connectives, = and brackets are not translated, they keep their meaning. Definition (Interpreting a Language-Step 2: Translating the Formulas) Suppose D = (D, M) is an interpretation of a fixed first order language and suppose that A is a formula in that language. The interpretation of A via D is denoted by AD and constructed as follows. Logical symbols 1 We replace any occurrence of > and ⊥ with t and f , respectively. 2 We replace a Boolean variable p in A by its interpretation pD, which is either t or f . 3 We replace any free variable x in A with the specific value xD from D. 4 We replace any (∀x) in A with (∀x ∈ D), which means for all values of x in D.

Saeed Ghasemi (York University) Math 1090 5th July 2018 92 / 95 Non-logical symbols 1 We replace any object constant c in A with the specific value cD from D. 2 We replace any function symbol f with the specific function f D, which has inputs from D and output from D 3 We replace any predicate symbol φ with the specific relation φD, which has inputs from D and output from {t, f }.

Definition If AD = t for some A and interpretation D, we say A is true in the interpretation D or D is a model of A. We denote AD by

|=D A

Saeed Ghasemi (York University) Math 1090 5th July 2018 93 / 95 Definition (Universally-or Logically-valid formulas)

A first-order formula is Universally valid or just valid if |=D A holds for “every” interpretation D. Then we write

|= A

Lemma

If |=taut A then |= A

Lemma If A is an axiom, then |= A

Saeed Ghasemi (York University) Math 1090 5th July 2018 94 / 95 Theorem (Soundness in First-Order logic) If ` A then |= A.

Theorem (G¨odel’s Completeness Theorem) If |= A then ` A.

Saeed Ghasemi (York University) Math 1090 5th July 2018 95 / 95