Predicate Calculus - Syntax Lila Kari University of Waterloo Predicate Calculus - Syntax CS245, Logic and Computation 1 / 26
The language L pred of Predicate Calculus - Syntax L pred, the formal language of predicate calculus, consists of the following basic symbols: individual constant symbols: a, b, c, a 1, a 2... predicate or relation symbols: F, G, H, P, F 1,... function symbols: f, g, h, f 1,... free variable symbols: u, v, w, u 1,... bound variable symbols: x, y, z, x 1,... connectives:,,,, quantifiers:, punctuation symbols: ( ), Predicate Calculus - Syntax CS245, Logic and Computation 2 / 26
Comments There is a special binary relation symbol called the equality symbol, written as. L pred may or may not contain. L pred containing is called the first order language with equality. In order to emphasize the equality symbol, we stipulate that it is denoted by none of F, G, H... The adjective first-order is used to distinguish the language we study from those in which (1) there are predicates having other predicates as arguments, or (2) in which predicate quantifiers or function quantifiers are permitted, or both. Predicate Calculus - Syntax CS245, Logic and Computation 3 / 26
The terms of L pred Definition. Term(L pred ) is the smallest class of expressions of L pred closed under the following formation rules: (1) Every individual constant symbol is a term of L pred. (2) Every free variable symbol is a term of L pred. (3) If f is an n-ary function symbol and t 1, t 2,... t n are terms of L pred, then f (t 1,... t n ) is a term of L pred. Predicate Calculus - Syntax CS245, Logic and Computation 4 / 26
Atoms of L pred Definition. An expression of L pred is an atom in Atom(L pred ) iff it is of one of the following two forms: (1) P(t 1, t 2,..., t n ) where P is an n-ary predicate (relation symbol) and t 1, t 2,..., t n are terms in Term(L pred ). (2) (t 1, t 2 ) where t 1, t 2 are terms in Term(L pred ). Predicate Calculus - Syntax CS245, Logic and Computation 5 / 26
Formulas of L pred Definition. Form(L pred ), the class of (well-formed) formulas of L pred, is the smallest class of expressions of L pred closed under the following formation rules: (1) Every atom in Atom(L pred ) is a formula of L pred. (2) If A is a formula of L pred then ( A) is a formula of L pred. (3) If A, B are formulas of L pred then (A B), (A B), (A B), (A B) are formulas of L pred. (4) If A(u) is a formula of L pred, where u is a free variable occurring in A, and x is a variable not occurring in A(u), then xa(x) and xa(x) are formulas of L pred. Predicate Calculus - Syntax CS245, Logic and Computation 6 / 26
The terms are the nouns and pronouns of the English language: they are the expressions which can be interpreted as naming an object. The terms are defined to be those expressions which can be built up from the individual constant symbols and variables, possibly by prefixing with function symbols. The atoms (atomic formulas) will be those formulas formed by using only terms and predicates, but which have neither connective nor quantifier symbols. The formulas are those expressions which can be built up from the atoms by use of the connective symbols and the quantifier symbols. Predicate Calculus - Syntax CS245, Logic and Computation 7 / 26
Example (1) For every integer x, there is an integer which is greater than x. (2) 500 is an integer. (3) There is an integer which is greater than 500. Translate into predicate calculus if the domain is the set of real numbers: Symbol N(x) G(y, x) x y Meaning x is an integer y is greater than x for all x there exists y Predicate Calculus - Syntax CS245, Logic and Computation 8 / 26
Example contd. Now the preceding reasoning can be formalized as follows: (1) x(n(x) y(n(y) G(y, x))). (2) N(500) (3) y(n(y) G(y, 500)) Predicate Calculus - Syntax CS245, Logic and Computation 9 / 26
Example - comments To get the first formula from the preceding example x(n(x) y(n(y) G(y, x))) according to the definition of a formula in L pred, we proceed as follows: terms atoms formulas To get N(500) one proceeds as follows: u, v G(u, v), N(u), N(v) (N(u) G(u, v)) y(n(y) G(y, v)) (N(v) y(n(y) G(y, v))) x(n(x) y(n(y) G(y, x))) term 500 atom N(500) Predicate Calculus - Syntax CS245, Logic and Computation 10 / 26
The eight types of formulas in Form(L pred ) Theorem. Any term is of exactly one of three forms: an individual constant symbol, a free variable symbol, or f (t 1,..., t n ) where f is an n-ary function symbol; and in each case it is of that form in exactly one way. Theorem. Any formula of Form(L pred ) is of exactly one of eight forms: an atom (uses only terms and predicates), ( A), (A B), (A B), (A B), (A B), xa(x) or xa(x); and in each case it is of that form in exactly one way. Predicate Calculus - Syntax CS245, Logic and Computation 11 / 26
Generating formulas in L pred The formula x(f (b) y( zg(y, z) H(u, x, y))) is generated as follows: Predicate Calculus - Syntax CS245, Logic and Computation 12 / 26
Sentences (closed formulas) and precedence rules Definition A sentence or a closed formula of L pred is a formula of L pred in which no free variable symbols occurs. The set of sentences of L pred is denoted by Sent(L pred ). As before, we omit brackets to simplify the appearance of a formula using the precedence rules for connectives and quantifiers. Thus the formula can be written as x((a(x) B(x)) C(x)) x(a(x) B(x) C(x)). Predicate Calculus - Syntax CS245, Logic and Computation 13 / 26
Quantification of two variables Let Q(x, y) denote x + y = 0. If the domain is the set of real numbers, what are the truth values of y xq(x, y) and x yq(x, y)? Solution: The formula y xq(x, y) denotes the statement It is true that there is a real number y such that for every real number x, Q(x, y). Since there is no real number y such that x + y = 0 for all real numbers x, this statement, and thus the formula, is false. The formula x yq(x, y) denotes the statement It is true that for every real number x, there is a real number y such that Q(x, y). Given a real number x there is a real number y such that x + y = 0; namely y = x. Hence, this statement, and thus the formula, is true. Conclusion: The order in which quantifiers appear matters! Predicate Calculus - Syntax CS245, Logic and Computation 14 / 26
Quantification of two variables In working with quantifications of more than one variable, it is sometimes helpful to think of them in terms of nested loops. For example, to see whether x yp(x, y) is true, we loop through the values for x and, for each x, we loop through the values for y. If we find that P(x, y) is true for all values of x and y we have determined that x yp(x, y) is true. If we find that we ever hit a value x for which we hit a value y for which P(x, y) is false, then we have shown that x yp(x, y) is false. Predicate Calculus - Syntax CS245, Logic and Computation 15 / 26
Summary: quantification of 2 variables Statement When true? 1. x yp(x, y) P(x, y) is true for every y xp(x, y) pair x, y 2. x yp(x, y) For every x there is a y for which P(x, y) is true 3. x yp(x, y) There is an x for which P(x, y) is true for every y 4. x yp(x, y) There is a pair x, y for which y xp(x, y) P(x, y) is true Predicate Calculus - Syntax CS245, Logic and Computation 16 / 26
Summary: quantification of 2 variables - contd. Statement When false? 1. x yp(x, y) There is a pair x, y for y xp(x, y) which P(x, y) is false 2. x yp(x, y) There is an x such that P(x, y) is false for every y 3. x yp(x, y) For every x there is a y for which P(x, y) is false 4. x yp(x, y) P(x, y) is false for every y xp(x, y) pair x, y Predicate Calculus - Syntax CS245, Logic and Computation 17 / 26
Exercise Let Q(x, y, z) be the statement x + y = z. If the domain is the set of real numbers, what are the truth values of the statements and x y zq(x, y, z) z x yq(x, y, z)? Predicate Calculus - Syntax CS245, Logic and Computation 18 / 26
Negating quantifiers We will often want to consider the negation of a quantified expression. Consider the negation of the statement: Every student in the class has taken a course in calculus. If the domain is the set of all students in this class, this statement can be translated as xp(x) where P(x) is the statement x has taken a course in calculus. The negation of this statement is It is not the case that every student in this class has taken a course in calculus. This is equivalent to There is a student in the class who has not taken a course in calculus., that is x P(x). Predicate Calculus - Syntax CS245, Logic and Computation 19 / 26
Negating quantifiers Consider the proposition There is a student in this class who has taken a course in calculus. which, if the domain is the set of all students in this class, can be translated as xp(x) where P(x) is the statement x has taken a course in calculus. The negation of this statement is It is not the case that there is a student in this class who has taken a course in calculus. This is equivalent to Every student in this class has not taken calculus, that is, x P(x) Predicate Calculus - Syntax CS245, Logic and Computation 20 / 26
Negation of quantifiers summarized Negation Equivalent statement 1. xp(x) x P(x) 2. xp(x) x P(x) When true? When false? 1. xp(x) P(x) is false for every x There is an x for which P(x) is true 2. xp(x) There is an x for which P(x) is true for every x P(x) is false Predicate Calculus - Syntax CS245, Logic and Computation 21 / 26
Assume the domain D is finite, D = {α 1,..., α n } The universal quantifier can be interpreted as a generalization of conjunction: xr(x) = 1 iff R(α 1 ) R(α 2 )... R(α n ) = 1 The existential quantifier can be interpreted as a generalization of disjunction: xr(x) = 1 iff R(α 1 ) R(α 2 )... R(α n ) = 1 Thus, the rules of negating quantifiers can be viewed as generalizations of De Morgan s Laws Predicate Calculus - Syntax CS245, Logic and Computation 22 / 26
First-order languages When associated with a structure, L pred consist of the same classes of symbols as defined before, but the three classes of individual constant symbols, relation symbols, and function symbols should be in one-to-one correspondence with designated individual constants, relations and functions of the structure. We have: non-logical symbols (parameters): individual constants, relations (predicates), and functions. logical symbols: free and bound variable symbols, connectives, quantifier symbols, punctuation, and. Predicate Calculus - Syntax CS245, Logic and Computation 23 / 26
Examples of first-order languages Language of ordered abelian groups Equality: Yes. Predicate symbols: One 2-place predicate. Individual constant symbol: 0 (neutral element for +). Function symbols: a unary function symbol (inverse), a binary function symbol + (addition). Language of set theory Equality: Yes. Predicate symbols: One 2-place predicate symbol. Individual constant symbols:. Function symbols: None. Predicate Calculus - Syntax CS245, Logic and Computation 24 / 26
Examples of first-order languages Language of elementary number theory: Equality: Yes. Predicate symbols: One 2-place predicate symbol <. Individual constant symbols: The symbol 0. One place function symbols: S (for successor) Two-place function symbols: + (for addition), and (for multiplication). Predicate Calculus - Syntax CS245, Logic and Computation 25 / 26
Language of elementary number theory The expressions +(u, v) and +(u, +(v, w)) are terms. They are usually written as u + v and u + v + w. The expressions (+(u, v), 0) and < (+(u, +(v, w)), +(u, v)) are atoms, usually written as u + v = 0 and u + v + w < u + v. The expression < (u, v) < (+(u, u), +(v, v)) is a formula usually written as (u < v) (u + u < v + v) The expression x y(< (x, S(y)) z(< (x, z) < (z, y))) is a formula usually written as x y((x < y + 1) z((x < z) (z < y))). Predicate Calculus - Syntax CS245, Logic and Computation 26 / 26