Math 1090 Part Two: Predicate (First-Order) Logic
Total Page:16
File Type:pdf, Size:1020Kb
Math 1090 Part two: Predicate (First-Order) Logic 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 = f1; 2; 3;::: g 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 symbol \=" 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 8, 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: 8 (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 f0; +; ×; S; <g 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 f2g. 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 ((8x)A) is a formula. Note: The sub-formula A in the formula ((8x)A) is called the scope of (8x). 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 ((8x)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; ((8y)p); u = v; (:x = c); (((8y)p)_u = v); (:x = c) ! (((8y)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 8; :; ^; _; !; ≡, in the formula. For example, p and x = y have complexity 0. ((8x)((8y)(:x = z))) has complexity 3. Definition We introduce a new symbol in the metatheory (an abbreviation, not a formal symbol) 9, called the existential quantifier. For any formula A, the string (9x)A) abbreviates the formula (:(8x)(: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: ((8x) and : have equal priorites.) n o (8x) : ; ^; _; !; ≡ 3 If ◦ 2 f^; _; !; ≡} and a formula is like · · · ◦ A ◦ ::: then the right ◦ acts first. That means · · · ◦ (A ◦ ::: . ::A is short for :(:A). :(8x)A is short for :((8x)A). (8x):A is short for (8x)(:A). (8x)(8x)A is short for (8x)((8y)A). (9x)(8x)A is short for (9x)((8y)A). Saeed Ghasemi (York University) Math 1090 5th July 2018 14 / 95 More Examples of Formulas Instead of (u = v ! (((8x)x = a) ^ p)) we write u = v ! (8x)x = a ^ p Instead of ((8z)(:x = y)) we write (8z):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.