Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
PREDICATE LOGIC Schaum’s outline chapter 4 Rosen chapter 1 September 8, 2016 ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 1 / 25 Contents 1 Predicates and quantifiers 2 Logical equivalences for quantifiers 3 Validity and satisfiability 4 Examples ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 2 / 25 Next section 1 Predicates and quantifiers 2 Logical equivalences for quantifiers 3 Validity and satisfiability 4 Examples ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 3 / 25 Motivation Propositional logic cannot adequately express the meaning of all statements in mathematics and in natural language. Example Having assumptions: Every computer connected to the school network is functioning properly. ELVIS is one of the computers connected to the school network. No rules of propositional logic allow us to conclude the truth of the statement ELVIS is functioning properly Classical example From the propositions All men are mortal. Socrates is a man. we cannot derive that Socrates is mortal. ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 4 / 25 Motivation Propositional logic cannot adequately express the meaning of all statements in mathematics and in natural language. Example Having assumptions: Every computer connected to the school network is functioning properly. ELVIS is one of the computers connected to the school network. No rules of propositional logic allow us to conclude the truth of the statement ELVIS is functioning properly Classical example From the propositions All men are mortal. Socrates is a man. we cannot derive that Socrates is mortal. ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 4 / 25 Predicate logic Extends propositional logic by Individuals a, b, ... , ELVIS, ... (Individual) variables x, y , ... Predicates (= propositional functions) P(x), Q(x), R(x, y ), ... Quantifiers ∀, ∃ A propositional function is a generalization of proposition: its argument stands for en element from its domain; its value is T or F depending on the property of its argument(s). ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 5 / 25 Predicate logic Extends propositional logic by Individuals a, b, ... , ELVIS, ... (Individual) variables x, y , ... Predicates (= propositional functions) P(x), Q(x), R(x, y ), ... Quantifiers ∀, ∃ A propositional function is a generalization of proposition: its argument stands for en element from its domain; its value is T or F depending on the property of its argument(s). ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 5 / 25 Propositional function Formally, for a given n ∈ {0, 1, . . .}, a predicate is a n-ary function (=a function with n arguments) of type P : D1 × . . . × Dn → {T , F } U = D1 × . . . × Dn is the domain (or the universe) of the predicate P; the statement P(x1 , . . . , xn ), becomes a proposition (representing a property of its arguments) if either x1 ∈ D1 , . . . , xn ∈ Dn or all variables x1 , . . . , xn are bound by quantifiers (see next slides). Example 1 Let P(x) denote ”x > 2” and U = Z. Then P(5) is true; P(2) is false. Example 2 Let R(x, y , z) denote the statement ”x + y = z” and U = Z. Then R(1, 2, 3) is true; R(0, 0, −5) is false. Jaan Penjam, email: [email protected] ioc.pdf I601: Lecture 1 September 8, 2016 6 / 25 Propositional function Formally, for a given n ∈ {0, 1, . . .}, a predicate is a n-ary function (=a function with n arguments) of type P : D1 × . . . × Dn → {T , F } U = D1 × . . . × Dn is the domain (or the universe) of the predicate P; the statement P(x1 , . . . , xn ), becomes a proposition (representing a property of its arguments) if either x1 ∈ D1 , . . . , xn ∈ Dn or all variables x1 , . . . , xn are bound by quantifiers (see next slides). Example 1 Let P(x) denote ”x > 2” and U = Z. Then P(5) is true; P(2) is false. Example 2 Let R(x, y , z) denote the statement ”x + y = z” and U = Z. Then R(1, 2, 3) is true; R(0, 0, −5) is false. Jaan Penjam, email: [email protected] ioc.pdf I601: Lecture 1 September 8, 2016 6 / 25 Propositional function Formally, for a given n ∈ {0, 1, . . .}, a predicate is a n-ary function (=a function with n arguments) of type P : D1 × . . . × Dn → {T , F } U = D1 × . . . × Dn is the domain (or the universe) of the predicate P; the statement P(x1 , . . . , xn ), becomes a proposition (representing a property of its arguments) if either x1 ∈ D1 , . . . , xn ∈ Dn or all variables x1 , . . . , xn are bound by quantifiers (see next slides). Example 1 Let P(x) denote ”x > 2” and U = Z. Then P(5) is true; P(2) is false. Example 2 Let R(x, y , z) denote the statement ”x + y = z” and U = Z. Then R(1, 2, 3) is true; R(0, 0, −5) is false. Jaan Penjam, email: [email protected] ioc.pdf I601: Lecture 1 September 8, 2016 6 / 25 Universal quantifier Let U is a given domain of discourse (= universe of discourse or simply domain). Definition The universal quantification of P(x) is the statement ”P(x) for all values of x in the domain U .” The notation ∀xP(x) denotes the universal quantification of P(x). Here ∀ is called the universal quantifier. We read ∀xP(x) as ”for all x P(x)” or ”for every x P(x)”. An element for which P(x) is false is called a counterexample of ∀xP(x). ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 7 / 25 Universal quantifier Let U is a given domain of discourse (= universe of discourse or simply domain). Definition The universal quantification of P(x) is the statement ”P(x) for all values of x in the domain U .” The notation ∀xP(x) denotes the universal quantification of P(x). Here ∀ is called the universal quantifier. We read ∀xP(x) as ”for all x P(x)” or ”for every x P(x)”. An element for which P(x) is false is called a counterexample of ∀xP(x). Examples Let P(x) be the statement ”x + 1 > x” and domain is Z. Then the quantification ∀xP(x) is true. Let Q(x) be the statement ”x < 2” and domain is Z. Then the quantification ∀xQ(x) is false. Let R(x) be the statement ”x 2 > 0” and domain is R. Then the quantification ∀xR(x) is false. A counterexample here is x = 0. ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 7 / 25 Universal quantifier Let U is a given domain of discourse (= universe of discourse or simply domain). Definition The universal quantification of P(x) is the statement ”P(x) for all values of x in the domain U .” The notation ∀xP(x) denotes the universal quantification of P(x). Here ∀ is called the universal quantifier. We read ∀xP(x) as ”for all x P(x)” or ”for every x P(x)”. An element for which P(x) is false is called a counterexample of ∀xP(x). Aanother example Let P(x) be the statement ”x 2 > x” and domain is R. Then the quantification ∀xP(x) is false. A counterexample is x = 12 . However, if domain is Z, then the quantification ∀xP(x) is true. ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 7 / 25 Existential quantifier Definition The existential quantification of P(x) is the statement ”There exists an element x in the domain U such that P(x).” We use the notation notation ∃xP(x) for the existential quantification of P(x). Here ∃ is called the existential quantifier. Remark: The meaning of ∃xP(x) changes when the domain changes. Without specifying the domain, the statement ∃xP(x) has no meaning. Examples Let P(x) be the statement ”x > 3” and domain is R. Then the quantification ∃xP(x) is true. Let Q(x) be the statement ”x = x + 1” and domain is R. Then the quantification ∃xQ(x) is false. ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 8 / 25 Existential quantifier Definition The existential quantification of P(x) is the statement ”There exists an element x in the domain U such that P(x).” We use the notation notation ∃xP(x) for the existential quantification of P(x). Here ∃ is called the existential quantifier. Remark: The meaning of ∃xP(x) changes when the domain changes. Without specifying the domain, the statement ∃xP(x) has no meaning. Examples Let P(x) be the statement ”x > 3” and domain is R. Then the quantification ∃xP(x) is true. Let Q(x) be the statement ”x = x + 1” and domain is R. Then the quantification ∃xQ(x) is false. ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 8 / 25 Bound and free variables The quantifiers are said to bind the variable x in the expressions ∀xP(x) and ∃xP(x). Variables in the scope of some quantifier are called bound variables. All other variables in the expression are called free variables. A propositional function that does not contain any free variables is a proposition and has a truth value. ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 9 / 25 Bound and free variables The quantifiers are said to bind the variable x in the expressions ∀xP(x) and ∃xP(x). Variables in the scope of some quantifier are called bound variables. All other variables in the expression are called free variables. A propositional function that does not contain any free variables is a proposition and has a truth value. ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 9 / 25 Bound and free variables The quantifiers are said to bind the variable x in the expressions ∀xP(x) and ∃xP(x). Variables in the scope of some quantifier are called bound variables. All other variables in the expression are called free variables. A propositional function that does not contain any free variables is a proposition and has a truth value. Examples In the statement ∃x(x + y = 1), the variable x is bound, but the variable y is free; In the statement ∃x(P(x) ∧ Q(x)) ∨ ∀xR(x), all variables are bound ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 9 / 25 Quantifiers as conjunctions and/or disjunctions If the domain is finite then universal/existential quantifiers can be expressed by conjunctions/disjunctions. If the domain U = {1, 2, 3, 4}, then I ∀xP(x) = P(1) ∧ P(2) ∧ P(3) ∧ P(4), and I ∃xP(x) = P(1) ∨ P(2) ∨ P(3) ∨ P(4). Even if the domains are infinite, you can still think of the quantifiers in this fashion, but the equivalent expressions without quantifiers will be infinitely long. ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 10 / 25 Quantifiers as conjunctions and/or disjunctions If the domain is finite then universal/existential quantifiers can be expressed by conjunctions/disjunctions. If the domain U = {1, 2, 3, 4}, then I ∀xP(x) = P(1) ∧ P(2) ∧ P(3) ∧ P(4), and I ∃xP(x) = P(1) ∨ P(2) ∨ P(3) ∨ P(4). Even if the domains are infinite, you can still think of the quantifiers in this fashion, but the equivalent expressions without quantifiers will be infinitely long. ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 10 / 25 Quantifiers as conjunctions and/or disjunctions If the domain is finite then universal/existential quantifiers can be expressed by conjunctions/disjunctions. If the domain U = {1, 2, 3, 4}, then I ∀xP(x) = P(1) ∧ P(2) ∧ P(3) ∧ P(4), and I ∃xP(x) = P(1) ∨ P(2) ∨ P(3) ∨ P(4). Even if the domains are infinite, you can still think of the quantifiers in this fashion, but the equivalent expressions without quantifiers will be infinitely long. Example Let P(x) be the statement ”x 2 < 10”. Then it is true for the domain U1 = {1, 2, 3}, but it is false for the domin U2 = {1, 2, 3, 4}. ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 10 / 25 Examples of nested quantifiers Statements with complex semantics require nested quantifiers. Example 1 Statement: ”Every real number has an inverse w.r.t. addition” Domain U = R. The property is expressed by ∀x∃y (x + y = 0) ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 11 / 25 Examples of nested quantifiers Statements with complex semantics require nested quantifiers. Example 1 Statement: ”Every real number has an inverse w.r.t. addition” Domain U = R. The property is expressed by ∀x∃y (x + y = 0) Example 2 Statement: ”Every real number except zero has a multiplicative inverse.” Domain U = R. The property is expressed by ∀x(x 6= 0 → ∃y (xy = 1)) ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 11 / 25 Notation: quantifiers with restricted domains An abbreviated notation is often used to restrict the domain of a quantifier. ∀x < 0.(x 2 > 0) is another way of expressing ∀x(x < 0 → x 2 > 0). √ √ ∀x ∈ A.(0 < x 6 5) is another way of expressing ∀x(x ∈ A → (0 < x) ∧ (x 6 5)). ∃z > 0.(z 2 = 2) is another way of expressing ∃z(z > 0 ∧ z 2 = 2). ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 12 / 25 Precedence of quantifiers The quantifiers ∀ and ∃ have higher precedence than all logical operators from propositional calculus For example ∀xP(x) ∨ Q(x) means (∀xP(x)) ∨ Q(x) rather than ∀x(P(x) ∨ Q(x)). ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 13 / 25 Next section 1 Predicates and quantifiers 2 Logical equivalences for quantifiers 3 Validity and satisfiability 4 Examples ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 14 / 25 Equivalences Statements involving predicates and quantifiers are logically equivalent if and only if they have the same truth value no matter which predicates are substituted into these statements and which domain of discourse is used for the variables in these propositional functions. We use the notation S ≡ T to indicate that two statements S and T involving predicates and quantifiers are logically equivalent. Examples ∀x.¬¬S(x) ≡ ∀x.S(x) ∀x.(P(x) ∧ Q(x)) ≡ ∀x.P(x) ∧ ∀x.Q(x) ∀x.∀y .P(x, y ) ≡ ∀y .∀x.P(x, y ) ∀x.∃y .P(x, y ) 6≡ ∃y .∀x.P(x, y ) ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 15 / 25 Equivalences Statements involving predicates and quantifiers are logically equivalent if and only if they have the same truth value no matter which predicates are substituted into these statements and which domain of discourse is used for the variables in these propositional functions. We use the notation S ≡ T to indicate that two statements S and T involving predicates and quantifiers are logically equivalent. Examples ∀x.¬¬S(x) ≡ ∀x.S(x) ∀x.(P(x) ∧ Q(x)) ≡ ∀x.P(x) ∧ ∀x.Q(x) ∀x.∀y .P(x, y ) ≡ ∀y .∀x.P(x, y ) ∀x.∃y .P(x, y ) 6≡ ∃y .∀x.P(x, y ) ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 15 / 25 Equivalences Statements involving predicates and quantifiers are logically equivalent if and only if they have the same truth value no matter which predicates are substituted into these statements and which domain of discourse is used for the variables in these propositional functions. We use the notation S ≡ T to indicate that two statements S and T involving predicates and quantifiers are logically equivalent. Examples ∀x.¬¬S(x) ≡ ∀x.S(x) ∀x.(P(x) ∧ Q(x)) ≡ ∀x.P(x) ∧ ∀x.Q(x) ∀x.∀y .P(x, y ) ≡ ∀y .∀x.P(x, y ) ∀x.∃y .P(x, y ) 6≡ ∃y .∀x.P(x, y ) ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 15 / 25 Equivalences Statements involving predicates and quantifiers are logically equivalent if and only if they have the same truth value no matter which predicates are substituted into these statements and which domain of discourse is used for the variables in these propositional functions. We use the notation S ≡ T to indicate that two statements S and T involving predicates and quantifiers are logically equivalent. Examples ∀x.¬¬S(x) ≡ ∀x.S(x) ∀x.(P(x) ∧ Q(x)) ≡ ∀x.P(x) ∧ ∀x.Q(x) ∀x.∀y .P(x, y ) ≡ ∀y .∀x.P(x, y ) ∀x.∃y .P(x, y ) 6≡ ∃y .∀x.P(x, y ) ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 15 / 25 Equivalences Statements involving predicates and quantifiers are logically equivalent if and only if they have the same truth value no matter which predicates are substituted into these statements and which domain of discourse is used for the variables in these propositional functions. We use the notation S ≡ T to indicate that two statements S and T involving predicates and quantifiers are logically equivalent. Examples ∀x.¬¬S(x) ≡ ∀x.S(x) ∀x.(P(x) ∧ Q(x)) ≡ ∀x.P(x) ∧ ∀x.Q(x) ∀x.∀y .P(x, y ) ≡ ∀y .∀x.P(x, y ) ∀x.∃y .P(x, y ) 6≡ ∃y .∀x.P(x, y ) ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 15 / 25 Quantifications of two variables. Example where ∀x.∃y .P(x, y ) 6≡ ∃y .∀x.P(x, y ) Let P(x, y ) denote”x + y = 0”, where the domain for all variables consists of all real numbers. ∃y .∀x.P(x, y ) means the proposition ”There is a real number y such that for every real number x, x + y = 0. Actually, no matter what value of y is chosen, there is only one value of x for which x + y = 0. Hence, the proposition ∃y .∀x.P(x, y ) false. ∀x.∃y .P(x, y ) means the proposition ”For every real number x there is a real number y such that x + y = 0. In fact, given a real number x, there is a real number y such that x + y = 0; namely, y = −x. Hence, the statement is true. ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 16 / 25 Quantifications of two variables. The meanings of the different possible quantifications involving two variables. ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 16 / 25 De Morgan’s law for quantifiers The rules for negating quantifiers are: ¬(∀x.P(x)) ≡ ∃x.¬P(x) ¬(∃x.P(x)) ≡ ∀x.¬P(x) ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 17 / 25 Next section 1 Predicates and quantifiers 2 Logical equivalences for quantifiers 3 Validity and satisfiability 4 Examples ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 18 / 25 Validity An assertion in predicate calculus is logically valid (or simply valid) if it is true in every interpretation, that is iff it is true for all domains for every propositional functions substituted for the predicates in the assertion Valid assertions in predicate logic play a role similar to tautologies in propositional logic. Example ∀x.(P(x) ∨ ¬P(x)) ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 19 / 25 Validity An assertion in predicate calculus is logically valid (or simply valid) if it is true in every interpretation, that is iff it is true for all domains for every propositional functions substituted for the predicates in the assertion Valid assertions in predicate logic play a role similar to tautologies in propositional logic. Example ∀x.(P(x) ∨ ¬P(x)) ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 19 / 25 Satisfiability An assertion in predicate calculus is satisfiable iff it is true for some domain for some propositional functions that can be substituted for the predicates in the assertion Valid assertions in predicate logic play a role similar to tautologies in propositional logic. Examples ∀x.∃y .P(x, y ) is satisfiable The domain N, and the propositional function 6 satisfy this assertion. ∀x.(P(x) ∧ ¬P(x)) is unsatisfiable ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 20 / 25 Satisfiability An assertion in predicate calculus is satisfiable iff it is true for some domain for some propositional functions that can be substituted for the predicates in the assertion Valid assertions in predicate logic play a role similar to tautologies in propositional logic. Examples ∀x.∃y .P(x, y ) is satisfiable The domain N, and the propositional function 6 satisfy this assertion. ∀x.(P(x) ∧ ¬P(x)) is unsatisfiable ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 20 / 25 Next section 1 Predicates and quantifiers 2 Logical equivalences for quantifiers 3 Validity and satisfiability 4 Examples ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 21 / 25 Example 1: If x is irrational then so is √ x Let Irrational(x) denote the propositional function ”x is irrational”, and Rational(x) = ¬Irrational(x) Proposition √ ∀x ∈ R+ . Irrational(x) → Irrational( x) Proof. Let x be positive real number. We will show the contrapositive, i.e. √ ∀x ∈ R+ . Rational( x) → Rational(x) √ In other words we prove that if x is rational then so is x. √ Assume that x is a rational number. Then, √ by definition, there must exists two natural numbers m and n such that x = m/n. But then x = m2 /n2 and, since m2 and n2 are natural numbers, which by definition implies that x is a rational number as required. ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 22 / 25 Example 2: n is even iff n2 is even Let Even(x) denote the propositional function ”x is even”, and Odd(x) = ¬Even(x) Proposition ∀n ∈ Z. Even(n) ↔ Even(n2 ) Proof. Let n ∈ Z Necessity. Let’s assume that n is even, i.e. there exists an integer k such that n = 2k. Then n2 = (2k)2 = 4k 2 = 2(2k 2 ), and thus for ` = 2k 2 , n2 = 2` and so is even. Sufficiency. We will show the contrapositive,i.e. Odd(n) → Odd(n2 ). Let’s assume that n is odd, i.e. there exists an integer k such that n = 2k + 1. Then n2 = (2k + 1)2 = 2(2k 2 + 2k) + 1,and thus for ` = 2k 2 + k, n2 = 2` + 1 and so is odd. ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 23 / 25 Example 3: 4k = i 2 − j 2 Proposition ∀k ∈ N. ∃i ∈ N. ∃j ∈ N. 4k = i 2 − j 2 Proof. Let k ∈ N. Let i = k + 1 and j = k − 1. i 2 − j 2 = (k + 1)2 − (k − 1)2 = k 2 + 2k + 1 − k 2 + 2k − 1 = 4k. ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 24 / 25 Example 4: Either n2 ≡ 0 (mod 4) or n2 ≡ 1 (mod 4) Remark: Formula a ≡ b (mod 4) stands for the proposition ”b is the remainder after division of a by 4. Proposition ∀n ∈ Z. n2 ≡ 0 (mod 4) ∨ n2 ≡ 1 (mod 4) Proof. Let n ∈ Z. n is either even or odd. We consider each case separately. (1). Assume n is even. Then there exists m such that n = 2m. But then n2 = 4m2 ≡ 0 (mod 4). (2). Assume n is odd. Then there exists m such that n = 2m + 1. But then n2 = 4m2 + 4m + 1 = 4(m2 + m) + 1 ≡ 1 (mod 4). ioc.pdf Jaan Penjam, email: [email protected] I601: Lecture 1 September 8, 2016 25 / 25