Presentation is loading. Please wait.

Presentation is loading. Please wait.

資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen)

Similar presentations


Presentation on theme: "資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen)"— Presentation transcript:

1

2 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

3 Predicates & Quantifiers

4 Predicates The statement “ X is greater than 3” has 2 parts: object (variable X) and predicate (“is greater than 3”). The statement “ X is greater than 3” has 2 parts: object (variable X) and predicate (“is greater than 3”). Let P(X) denote statement “X is greater than 3”, where P denote the predicate “is greater than 3”. P(X) is also said to be the value of propositional function P(·) at X. Let P(X) denote statement “X is greater than 3”, where P denote the predicate “is greater than 3”. P(X) is also said to be the value of propositional function P(·) at X. For example, let P(X) denote “X > 3”, what are the truth values of P(4) and P(2)? For example, let P(X) denote “X > 3”, what are the truth values of P(4) and P(2)?

5 Predicates Let Q(x, y) denote the statement “x = y+3”, What are the truth values of the propositions Q(1, 2) and Q(3, 0)? Let Q(x, y) denote the statement “x = y+3”, What are the truth values of the propositions Q(1, 2) and Q(3, 0)? Let R(x, y, z) denote the statement “x+y = z”, What are the truth values of the propositions R(1, 2, 3) and R(0, 0, 1)? Let R(x, y, z) denote the statement “x+y = z”, What are the truth values of the propositions R(1, 2, 3) and R(0, 0, 1)? A statement of the form P(x 1, x 2, …, x n ) is the value of the propositional function P at the n- tuple (x 1, x 2, …, x n ), and P is also called a predicate. A statement of the form P(x 1, x 2, …, x n ) is the value of the propositional function P at the n- tuple (x 1, x 2, …, x n ), and P is also called a predicate.

6 Predicate Logic Predicate logic is an extension of propositional logic that permits concisely reasoning about whole classes of entities. Predicate logic is an extension of propositional logic that permits concisely reasoning about whole classes of entities. Propositional logic (recall) treats simple propositions (sentences) as atomic entities. Propositional logic (recall) treats simple propositions (sentences) as atomic entities. In contrast, predicate logic distinguishes the subject of a sentence from its predicate. In contrast, predicate logic distinguishes the subject of a sentence from its predicate. - Remember these English grammar terms? - Remember these English grammar terms?

7 Applications of Predicate Logic It is the formal notation for writing perfectly clear, concise, and unambiguous mathematical definitions, axioms, and theorems for any branch of mathematics. It is the formal notation for writing perfectly clear, concise, and unambiguous mathematical definitions, axioms, and theorems for any branch of mathematics. - Predicate logic with function symbols, the “=” operator, and a few proof-building rules is sufficient for defining any conceivable mathematical system, and for proving anything that can be proved within that system! - Predicate logic with function symbols, the “=” operator, and a few proof-building rules is sufficient for defining any conceivable mathematical system, and for proving anything that can be proved within that system!

8 Other Applications Predicate logic is the foundation of the field of mathematical logic, which culminated in Gödel’s incompleteness theorem, which revealed the ultimate limits of mathematical thought : Predicate logic is the foundation of the field of mathematical logic, which culminated in Gödel’s incompleteness theorem, which revealed the ultimate limits of mathematical thought : Given any finitely describable, consistent proof procedure, there will always remain Given any finitely describable, consistent proof procedure, there will always remain some true statements that will never be some true statements that will never be proven by that procedure. proven by that procedure. i.e., we can’t discover all mathematical truths, unless we sometimes resort to making guesses. Kurt Gödel 1906-1978

9 Practical Applications of Predicate Logic It is the basis for clearly expressed formal specifications for any complex system. It is the basis for clearly expressed formal specifications for any complex system. It is basis for automatic theorem provers and many other Artificial Intelligence systems. It is basis for automatic theorem provers and many other Artificial Intelligence systems. E.g. automatic program verification systems. Predicate-logic like statements are supported by some of the more sophisticated database query engines and container class libraries. Predicate-logic like statements are supported by some of the more sophisticated database query engines and container class libraries. - these are types of programming tools. - these are types of programming tools.

10 Subjects and Predicates In the sentence “The dog is sleeping”: In the sentence “The dog is sleeping”: - The phrase “the dog” denotes the subject : the object or entity that the sentence is about. - The phrase “the dog” denotes the subject : the object or entity that the sentence is about. - The phrase “is sleeping” denotes the predicate : a property that is true of the subject. - The phrase “is sleeping” denotes the predicate : a property that is true of the subject. In predicate logic, a predicate is modeled as a function P(·) from objects to propositions. In predicate logic, a predicate is modeled as a function P(·) from objects to propositions. - P(x) = “x is sleeping” (where x is any object). - P(x) = “x is sleeping” (where x is any object).

11 More About Predicates Convention: Lowercase variables x, y, z... denote objects/entities; uppercase variables P, Q, R… denote propositional functions (predicates). Convention: Lowercase variables x, y, z... denote objects/entities; uppercase variables P, Q, R… denote propositional functions (predicates). Keep in mind that the result of applying a predicate P to an object x is the proposition P(x). But the predicate P itself (e.g. P = “is sleeping”) is not a proposition (not a complete sentence). Keep in mind that the result of applying a predicate P to an object x is the proposition P(x). But the predicate P itself (e.g. P = “is sleeping”) is not a proposition (not a complete sentence). E.g. if P(x) = “x is a prime number”, P(3) is the proposition “3 is a prime number.”

12 Propositional Functions Predicate logic generalizes the grammatical notion of a predicate to also include propositional functions of any number of arguments, each of which may take any grammatical role that a noun can take. Predicate logic generalizes the grammatical notion of a predicate to also include propositional functions of any number of arguments, each of which may take any grammatical role that a noun can take. E.g. let P(x, y, z) = “x gave y the grade z”, then if x = “Mike”, y = “Mary”, z = “A”, then P(x, y, z) = “Mike gave Mary the grade A.” P(x, y, z) = “Mike gave Mary the grade A.”

13 Universes of Discourse (U.D.s) The power of distinguishing objects from predicates is that it lets you state things about many objects at once. The power of distinguishing objects from predicates is that it lets you state things about many objects at once. E.g., let P(x)=“x+1 > x”. We can then say, “For any number x, P(x) is true” instead of “(0+1>0)  (1+1>1)  (2+1>2) ... ” - The collection of values that a variable x can take is called x’s universe of discourse. (domain) - The collection of values that a variable x can take is called x’s universe of discourse. (domain)

14 Quantifiers Quantifiers provide a notation to quantify (count) how many objects satisfy a given predicate. Quantifiers provide a notation to quantify (count) how many objects satisfy a given predicate. There are two types of quantifiers: universal quantification and existential quantification. There are two types of quantifiers: universal quantification and existential quantification.

15 Two Types of Quantifiers “  ” is the FOR  LL or universal quantifier.  x P(x) means for all x in the u.d., P holds. “  ” is the FOR  LL or universal quantifier.  x P(x) means for all x in the u.d., P holds. “  ” is the  XISTS or existential quantifier.  x P(x) means there exists an x in the u.d. (that is, 1 or more) such that P(x) is true. “  ” is the  XISTS or existential quantifier.  x P(x) means there exists an x in the u.d. (that is, 1 or more) such that P(x) is true.

16 The Universal Quantifier  E.g., let the u.d. of x be parking spaces at TCU. Let P(x) be the predicate “x is full.” Let P(x) be the predicate “x is full.” Then the universal quantification of P(x) is Then the universal quantification of P(x) is  x P(x), is the proposition:  x P(x), is the proposition: “All parking spaces at TCU are full.”, i.e., “All parking spaces at TCU are full.”, i.e., “Every parking space at TCU is full.”, i.e., “Every parking space at TCU is full.”, i.e., “For each parking space at TCU, that space is full.” “For each parking space at TCU, that space is full.”

17 The Existential Quantifier  E.g., let the u.d. of x be parking spaces at TCU. Let P(x) be the predicate “x is full.” Let P(x) be the predicate “x is full.” Then the existential quantification of P(x), Then the existential quantification of P(x),  x P(x), is the proposition:  x P(x), is the proposition: “Some parking space at TCU is full.”, i.e., “Some parking space at TCU is full.”, i.e., “There is a parking space at TCU that is full.” “There is a parking space at TCU that is full.” “At least one parking space at TCU is full.” “At least one parking space at TCU is full.”

18 Free and Bound Variables An expression like P(x) is said to have a free variable x (meaning, x is undefined). An expression like P(x) is said to have a free variable x (meaning, x is undefined). A quantifier (either  or  ) operates on an expression having one or more free variables, and binds one or more of those variables, to produce an expression having one or more bound variables. A quantifier (either  or  ) operates on an expression having one or more free variables, and binds one or more of those variables, to produce an expression having one or more bound variables.

19 Example of Binding P(x,y) has 2 free variables, x and y. P(x,y) has 2 free variables, x and y.  x P(x, y) has 1 free variable, and one bound variable. [Which is which? y is free …]  x P(x, y) has 1 free variable, and one bound variable. [Which is which? y is free …] “P(x), where x=3” is another way to bind x. “P(x), where x=3” is another way to bind x. An expression with zero free variables is a bona-fide (actual) proposition. An expression with zero free variables is a bona-fide (actual) proposition. An expression with one or more free variables is still only a predicate: e.g., Q(y) =  x P(x, y). An expression with one or more free variables is still only a predicate: e.g., Q(y) =  x P(x, y).

20 Negations Let  x P(x) be the statement of Let  x P(x) be the statement of “Every student in the class has taken a course in calculus”, where P(x) is “x has taken a course in calculus” “Every student in the class has taken a course in calculus”, where P(x) is “x has taken a course in calculus” What is its negation?  x  P(x) What is its negation?  x  P(x)  (  x P(x)) ≡  x  P(x)  (  x P(x)) ≡  x  P(x)  (  x Q(x)) ≡  x  Q(x)  (  x Q(x)) ≡  x  Q(x)

21 Translating from English into Logical Expressions Express “Every student in this class has studied Calculus” using predicates and quantifiers. Express “Every student in this class has studied Calculus” using predicates and quantifiers. Sol.1: Let C(·) be the predicate of “· has studied Calculus”. Assume universe of disclosure of x consists of the students in the class. It’s  x C(x). It’s  x C(x).

22 Translating from English into Logical Expressions (cont ’ d) Sol.2: If the u.d. is all people. Let S(·) be the predicate of “· is in this class”. The solution is  x S(x)  C(x). [Not  x S(x)  C(x) ? ] Sol.3: We concern about other subjects. Let Q(x, y) be the predicate of “student x has studied subject y”. The solution is  x (S(x)  Q(x, Calculus)).

23 Review: Predicate Logic Objects x, y, z, … Objects x, y, z, … Predicates P, Q, R, … are functions mapping objects x to propositions P(x). Predicates P, Q, R, … are functions mapping objects x to propositions P(x). Multi-argument predicates P(x, y). Multi-argument predicates P(x, y). Quantifiers: [  x P(x)] :≡ “For all x’s, P(x).” [  x P(x)] :≡ “There is an x such that P(x).” Quantifiers: [  x P(x)] :≡ “For all x’s, P(x).” [  x P(x)] :≡ “There is an x such that P(x).” Universes of discourse, bound & free variables. Universes of discourse, bound & free variables.

24 Induction

25 Introduction to Induction A powerful, rigorous technique for proving that a predicate P(n) is true for every natural number n, no matter how large. A powerful, rigorous technique for proving that a predicate P(n) is true for every natural number n, no matter how large. Essentially a “domino effect” principle. Essentially a “domino effect” principle.

26 The First Principle of Mathematical Induction Based on a predicate-logic inference rule: Based on a predicate-logic inference rule: P(0)  n  0 (P(n)  P(n+1))  n  0 P(n)

27 The “ Domino Effect ” Premise #1: Domino #0 falls. Premise #2: For every kN, if domino #k falls, then so does domino #k+1. Conclusion: All of the dominoes fall down! Note: this works even if there are infinitely many dominoes!

28 Validity of Induction Proof that  n  0 P(n) is a valid consequent: Given any k  0, the 2 nd antecedent  k  0 (P(k)  P(k+1)) trivially implies that  k  0 (k<n)  (P(k)  P(k+1)), i.e., that (P(0)  P(1))  (P(1)  P(2))  …  (P(n  1)  P(n)). Repeatedly applying the hypothetical syllogism rule to adjacent implications in this list n−1 times then gives us P(0)  P(n); which together with P(0) (antecedent #1) and modus pones gives us P(n). Thus  n  0 P(n). ■

29 Outline of An Inductive Proof Let us say we want to prove  n P(n)… Let us say we want to prove  n P(n)… – Do the base case (or basis step): Prove P(0). – Do the inductive step: Prove  n P(n)  P(n+1). E.g. you could use a direct proof, as follows: Let n  N, assume P(n). (inductive hypothesis) Let n  N, assume P(n). (inductive hypothesis) Now, under this assumption, prove P(n+1). Now, under this assumption, prove P(n+1). – The inductive inference rule then gives us  n P(n).  n P(n).

30 Generalizing Induction Rule can also be used to prove  n  c P(n) for a given constant c  Z, where maybe c  0. Rule can also be used to prove  n  c P(n) for a given constant c  Z, where maybe c  0. – In this circumstance, the base case is to prove P(c) rather than P(0), and the inductive step is to prove  n  c (P(n)  P(n+1)). Induction can also be used to prove  n  c P(a n ) for any arbitrary series {a n }. Induction can also be used to prove  n  c P(a n ) for any arbitrary series {a n }. Can reduce these to the form already shown. Can reduce these to the form already shown.

31 The Second Principle of Mathematical Induction Characterized by another inference rule: Characterized by another inference rule: P(0) P(0) “ Strong Induction ”  n  0: (  0  k  n P(k))  P(n+1)  n  0: P(n)  n  0: (  0  k  n P(k))  P(n+1)  n  0: P(n) The only difference between this and the 1 st principle is that: The only difference between this and the 1 st principle is that: - the inductive step here makes use of the stronger hypothesis that P(k) is true for all smaller numbers k < n+1, not just for k = n. P is true in all previous cases

32 Examples of Induction Examples of Induction

33 1 st Principle Example Prove that the sum of the first n odd positive integers is n 2. That is, prove: Prove that the sum of the first n odd positive integers is n 2. That is, prove: Proof by induction: Proof by induction: – Base case: Let n=1. The sum of the first 1 odd positive integer is 1 which equals 1 2. (cont’d…) P(n)P(n)

34 1 st Principle Example (cont’d) Inductive step: Prove  n≥1: P(n)→P(n+1). Let n≥1, assume P(n), and prove P(n+1) By inductive hypothesis P(n). ■

35 Another Induction Example Prove that   n > 0, n 0, n < 2 n. Let P(n) = (n < 2 n ) Let P(n) = (n < 2 n ) Base case: P(1) = (1<2 1 ) = (1<2) = T. Inductive step: For n>0, prove P(n)→P(n+1). Assuming n < 2 n, prove n + 1 < 2 n+1. Note n + 1 < 2 n + 1 (by inductive hypothesis) < 2 n + 2 n (1 < 2 = 2 · 2 0 ≤ 2 · 2 n-1 = 2 n ) < 2 n + 2 n (1 < 2 = 2 · 2 0 ≤ 2 · 2 n-1 = 2 n ) = 2 n+1 = 2 n+1 So n + 1 < 2 n+1, and we’re done. ■

36 More Induction Examples 1.n 3 – n is divisible by 3 2.1 + 2 + 2 2 + … + 2 n = 2 n+1 – 1 3.Sums of Geometric Progressions 4.An Inequality for Harmonic Numbers 5., where 6.DeMorgan’s law 7.Number of Subsets of a finite set 8.2 n < n!

37 More Induction Examples E.g. 9: Any chessboard with 2 n ×2 n squares but with one removed can be tiled using L-shaped pieces (which cover 3 squares at a time). E.g. 10: The greedy algorithm (selects talk with earliest ending time) schedules the most talks in a single lecture halls.

38 The Second Principle of Mathematical Induction Characterized by another inference rule: Characterized by another inference rule: P(0) P(0) “ Strong Induction ”  n  0: (  0  k  n P(k))  P(n+1)  n  0: P(n)  n  0: (  0  k  n P(k))  P(n+1)  n  0: P(n) The only difference between this and the 1 st principle is that: The only difference between this and the 1 st principle is that: - the inductive step here makes use of the stronger hypothesis that P(k) is true for all smaller numbers k < n+1, not just for k = n. P is true in all previous cases

39 The 2 nd Principle of Math Induction P(n) 為一命題,其中 n 為自然數: P(n) 為一命題,其中 n 為自然數: 1. 若 P(1), P(2), P(3), …, P(q) 成立, 1. 若 P(1), P(2), P(3), …, P(q) 成立, 2. 假設對於所有介於 1  i  k 之自然數 2. 假設對於所有介於 1  i  k 之自然數 ( 其中 q  k) , P(i) 成立, ( 其中 q  k) , P(i) 成立, 3. 在 1& 2 成立下,若 P(k+1) 亦成立, 3. 在 1& 2 成立下,若 P(k+1) 亦成立, 則  n  0: P(n) 則  n  0: P(n) 成立。

40 2 nd Principle Example Show that every n>1 can be written as a product  pi = p1p2…ps of some series of s prime numbers. Let P(n) = “n has that property” Base case: n = 2, let s = 1, p1 = 2. Inductive step: Let n2. Assume 2 ≤ k ≤ n: P(k). Consider n+1. If it’s prime, let s = 1, p1 = n+1. Else n+1 = ab, where 2 ≤ a ≤ n and 2 ≤ b ≤ n. Then a = p1p2…pt and b = q1q2…qu. Then we have that n+1 = p1p2…pt q1q2…qu, a product of s = t+u primes. ■

41 Another 2 nd Principle Example Prove that every amount of postage of 12 cents or more can be formed using just 4-cent and 5-cent stamps. P(n) = “n can be…” Prove that every amount of postage of 12 cents or more can be formed using just 4-cent and 5-cent stamps. P(n) = “n can be…” Base case: 12 = 3(4), 13 = 2(4)+1(5), 14 = 1(4)+2(5), 15 = 3(5), so  12  n  15, P(n). Base case: 12 = 3(4), 13 = 2(4)+1(5), 14 = 1(4)+2(5), 15 = 3(5), so  12  n  15, P(n). Inductive step: Let n≥15, assume  12  k  n P(k). Inductive step: Let n≥15, assume  12  k  n P(k). Note 12  n  3  n, so P(n  3), so add a 4-cent stamp to get postage for n+1. Note 12  n  3  n, so P(n  3), so add a 4-cent stamp to get postage for n+1.

42 The Well-Ordering Property Another way to prove the validity of the inductive inference rule is by the well-ordering property, which says that: Another way to prove the validity of the inductive inference rule is by the well-ordering property, which says that: - Every non-empty set of non-negative integers has a minimum (smallest) element. - Every non-empty set of non-negative integers has a minimum (smallest) element. -   S  N :  m  S :  n  S : m  n -   S  N :  m  S :  n  S : m  n This implies that {n|  P(n)} (if non-empty) has a minimal element m, but then the assumption that P(m−1)  P((m−1)+1) would be contradicted. This implies that {n|  P(n)} (if non-empty) has a minimal element m, but then the assumption that P(m−1)  P((m−1)+1) would be contradicted.

43 The Well-Ordering Property Any non-empty subset of Z + contains a smallest element. (Z + is well ordered) Any non-empty subset of Z + contains a smallest element. (Z + is well ordered) Example 1: If a is an integer and d is a positive integer. There are unique integers q and r with 0 ≦ r<d and a = d×q + r. Example 2: If there is a cycle of length m (m ≧ 3) among the players in a round-robin tournament, there must be a cycle of three.

44 The Method of Infinite Descent A way to prove that P(n) is false for all n  N. A way to prove that P(n) is false for all n  N. (Sort of a converse to the principle of induction) (Sort of a converse to the principle of induction) Prove first that  P(n):  k<n: P(k). Prove first that  P(n):  k<n: P(k). - Basically, “For every P there is a smaller P.” - Basically, “For every P there is a smaller P.” But by the well-ordering property of N, we know that  P(m)   P(n):  P(k): n≤k. But by the well-ordering property of N, we know that  P(m)   P(n):  P(k): n≤k. - Basically, “If there is a P, there is a smallest P.” - Basically, “If there is a P, there is a smallest P.” Note that these are contradictory unless ¬  P(m), Note that these are contradictory unless ¬  P(m), - that is,  m  N: ¬P(m). There is no P. - that is,  m  N: ¬P(m). There is no P.

45 Infinite Descent Infinite Descent : For a propositional function P(n), P(k) is false for all positive integers. Infinite Descent : For a propositional function P(n), P(k) is false for all positive integers. Example: is irrational.

46 Infinite Descent Example Theorem: 2 1/2 is irrational. Theorem: 2 1/2 is irrational. Proof: Suppose 2 1/2 is rational, then  m, n  Z + : 2 1/2 =m/n. Let M, N be the m, n with the least n. So  k<N, j: 2 1/2 = j/k (let j = 2N−M, k = M−N). ■

47 補 充 Propositional Equivalence

48 Propositional Equivalence Compound propositions p and q that have same truth values in all possible cases are called logically equivalent, denoted as p≡ q. Compound propositions p and q that have same truth values in all possible cases are called logically equivalent, denoted as p≡ q. The symbol ≡ is not a logical connective, it means that p≡ q is not a compound prop. The symbol ≡ is not a logical connective, it means that p≡ q is not a compound prop. Sometimes, the symbol  is used instead of ≡. Sometimes, the symbol  is used instead of ≡.

49 Tautologies and Contradictions A tautology is a compound proposition that is true no matter what the truth values of its atomic propositions are! A tautology is a compound proposition that is true no matter what the truth values of its atomic propositions are! Ex. p   p [Truth table …] Ex. p   p [Truth table …] A contradiction is a compound proposition that is false no matter what! A contradiction is a compound proposition that is false no matter what! Ex. p   p [Truth table …] Ex. p   p [Truth table …] Other compound props. are contingencies. Other compound props. are contingencies.

50 Logical Equivalence Compound proposition p is logically equivalent to compound proposition q, written p≡ q, IFF the compound proposition p  q is a tautology. Compound proposition p is logically equivalent to compound proposition q, written p≡ q, IFF the compound proposition p  q is a tautology. Compound propositions p and q are logically equivalent to each other IFF p and q contain the same truth values as each other in all rows of their truth tables. Compound propositions p and q are logically equivalent to each other IFF p and q contain the same truth values as each other in all rows of their truth tables.

51 Prove Equivalence via Truth Tables Ex. Prove that p  q ≡  (  p   q). F T T T T T T T T T F F F F F F F F T T

52 Equivalence Laws These are similar to the arithmetic identities you may have learned in algebra, but for propositional equivalences instead. These are similar to the arithmetic identities you may have learned in algebra, but for propositional equivalences instead. They provide a pattern or template that can be used to match all or part of a much more complicated proposition and to find an equivalence for it. They provide a pattern or template that can be used to match all or part of a much more complicated proposition and to find an equivalence for it.

53 Example of Equivalence Laws Identity: p  T ≡ p p  F ≡ p Identity: p  T ≡ p p  F ≡ p Domination: p  T ≡ T p  F ≡ F Domination: p  T ≡ T p  F ≡ F Idempotent: p  p ≡ p p  p ≡ p Idempotent: p  p ≡ p p  p ≡ p Double negation:  p ≡ p Double negation:  p ≡ p Commutative: p  q ≡ q  p p  q ≡ q  p Commutative: p  q ≡ q  p p  q ≡ q  p Associative: (p  q)  r ≡ p  (q  r) (p  q)  r ≡ p  (q  r) Associative: (p  q)  r ≡ p  (q  r) (p  q)  r ≡ p  (q  r)

54 More Equivalence Laws Distributive: p  (q  r) ≡ (p  q)  (p  r) p  (q  r) ≡ (p  q)  (p  r) Distributive: p  (q  r) ≡ (p  q)  (p  r) p  (q  r) ≡ (p  q)  (p  r) De Morgan’s:  (p  q) ≡  p   q  (p  q) ≡  p   q De Morgan’s:  (p  q) ≡  p   q  (p  q) ≡  p   q Trivial tautology/contradiction: p   p ≡ T p   p ≡ F Trivial tautology/contradiction: p   p ≡ T p   p ≡ F

55 Nested Quantifiers

56 Example: Let the u.d. of x & y be people. Let L(x, y) = “x likes y” (a predicate with 2 free variables) Then  y L(x, y) = “There is someone whom x likes.” (A predicate with 1 free variable, x) Then  x (  y L(x, y)) = “Everyone has someone whom they like.” (A proposition with 0 free variables.)

57 Quantifier Exercise If R(x,y)=“x relies upon y,” express the following in unambiguous English:  x(  y R(x,y))=  y(  x R(x,y))=  x(  y R(x,y))=  y(  x R(x,y))=  x(  y R(x,y))= Everyone has someone to rely on. There’s a poor overburdened soul whom everyone relies upon (including himself)! There’s some needy person who relies upon everybody (including himself). Everyone has someone who relies upon them. Everyone relies upon everybody, (including themselves)!

58 Natural Language Is Ambiguous “Everybody likes somebody.” “Everybody likes somebody.” – For everybody, there is somebody they like,  x  y Likes(x, y)  x  y Likes(x, y) – or, there is somebody (a popular person) whom everyone likes?  y  x Likes(x, y)  y  x Likes(x, y) “Somebody likes everybody.” “Somebody likes everybody.” – Same problem: Depends on context, emphasis. [Probably more likely]

59 More Conventions Sometimes the universe of discourse is restricted within the quantification, Sometimes the universe of discourse is restricted within the quantification, E.g.,  x>0 P(x) is shorthand for E.g.,  x>0 P(x) is shorthand for “For all x that are greater than zero, P(x).” “For all x that are greater than zero, P(x).” =  x ( x>0  P(x) ) =  x ( x>0  P(x) )  x>0 P(x) is shorthand for  x>0 P(x) is shorthand for “There is an x greater than zero such that P(x).” “There is an x greater than zero such that P(x).” =  x (x>0  P(x)) =  x (x>0  P(x))

60 More About Binding  x  x P(x) - x is not a free variable in  x P(x), therefore the  x binding isn’t used.  x  x P(x) - x is not a free variable in  x P(x), therefore the  x binding isn’t used. (  x P(x) )  Q(x) - The variable x is outside of the scope of the  x quantifier, and is therefore free. Not a proposition! (  x P(x) )  Q(x) - The variable x is outside of the scope of the  x quantifier, and is therefore free. Not a proposition! (  x P(x) )  (  x Q(x) ) – This is legal, because there are 2 different x’s! (  x P(x) )  (  x Q(x) ) – This is legal, because there are 2 different x’s!

61 Quantifier Equivalence Laws Definitions of quantifiers: If u.d.=a,b,c,…  x P(x)  P(a)  P(b)  P(c)  …  x P(x)  P(a)  P(b)  P(c)  … Definitions of quantifiers: If u.d.=a,b,c,…  x P(x)  P(a)  P(b)  P(c)  …  x P(x)  P(a)  P(b)  P(c)  … From those, we can prove the laws:  x P(x)   x  P(x)  x P(x)   x  P(x) From those, we can prove the laws:  x P(x)   x  P(x)  x P(x)   x  P(x) Which propositional equivalence laws can be used to prove this? Which propositional equivalence laws can be used to prove this?

62 (Chalkboard) (Chalkboard) Another way to see why the order of quantifiers matters is to expand out the definitions of FORALL and EXISTS in terms of AND and OR. E.g., suppose the universe of discourse just consists of two objects a and b. Now, consider some predicate P(x, y). Then, (Chalkboard) Another way to see why the order of quantifiers matters is to expand out the definitions of FORALL and EXISTS in terms of AND and OR. E.g., suppose the universe of discourse just consists of two objects a and b. Now, consider some predicate P(x, y). Then, FORALL x EXISTS y P(x, y)  (EXISTS y P(a, y)) /\ (EXISTS y P(b, y))  (EXISTS y P(a, y)) /\ (EXISTS y P(b, y))  (P(a, a) \/ P(a, b)) /\ P(b, a) \/ P(b, b)).  (P(a, a) \/ P(a, b)) /\ P(b, a) \/ P(b, b)). In contrast, EXISTS y FORALL x P(x, y)  (FORALL x P(x, a)) \/ (FORALL x P(x, b))  (FORALL x P(x, a)) \/ (FORALL x P(x, b))  (P(a, a) /\ P(b, a)) \/ (P(a, b) /\ P(b, b)).  (P(a, a) /\ P(b, a)) \/ (P(a, b) /\ P(b, b)).

63 (Chalkboard) To see that these two are inequivalent, suppose only P(a, a) and P(b, b) are true. Then, the first proposition (with the FORALL first) is true, but, the second proposition (with the EXISTS first) is true. Students can come up with this counterexample in-class as an exercise. To see that these two are inequivalent, suppose only P(a, a) and P(b, b) are true. Then, the first proposition (with the FORALL first) is true, but, the second proposition (with the EXISTS first) is true. Students can come up with this counterexample in-class as an exercise.

64 More Equivalence Laws  x  y P(x,y)   y  x P(x,y)  x  y P(x,y)   y  x P(x,y)  x  y P(x,y)   y  x P(x,y)  x  y P(x,y)   y  x P(x,y)  x (P(x)  Q(x))  (  x P(x))  (  x Q(x))  x (P(x)  Q(x))  (  x P(x))  (  x Q(x))  x (P(x)  Q(x))  (  x P(x))  (  x Q(x))  x (P(x)  Q(x))  (  x P(x))  (  x Q(x)) Exercise: See if you can prove these yourself. – What propositional equivalences did you use?

65 More Notational Conventions Quantifiers bind as loosely as needed: parenthesize  x P(x)  Q(x) Quantifiers bind as loosely as needed: parenthesize  x P(x)  Q(x) Consecutive quantifiers of the same type can be combined:  x  y  z P(x,y,z)   x,y,z P(x,y,z) or even  xyz P(x,y,z) Consecutive quantifiers of the same type can be combined:  x  y  z P(x,y,z)   x,y,z P(x,y,z) or even  xyz P(x,y,z) All quantified expressions can be reduced to the canonical alternating form  x 1  x 2  x 3  x 4 … P(x 1, x 2, x 3, x 4, …) All quantified expressions can be reduced to the canonical alternating form  x 1  x 2  x 3  x 4 … P(x 1, x 2, x 3, x 4, …) ( )

66 Defining New Quantifiers As per their name, quantifiers can be used to express that a predicate is true of any given quantity (number) of objects. As per their name, quantifiers can be used to express that a predicate is true of any given quantity (number) of objects. Define  !x P(x) to mean “P(x) is true of exactly one x in the universe of discourse.” Define  !x P(x) to mean “P(x) is true of exactly one x in the universe of discourse.”  !x P(x)   x ( P(x)   y ( P(y)  y  x ) ) “There is an x such that P(x), where there is no y such that P(y) and y is other than x.”  !x P(x)   x ( P(x)   y ( P(y)  y  x ) ) “There is an x such that P(x), where there is no y such that P(y) and y is other than x.”

67 Some Number Theory Examples Let u.d. = the natural numbers 0, 1, 2, … Let u.d. = the natural numbers 0, 1, 2, … “A number x is even, E(x), if and only if it is equal to 2 times some other number.”  x (E(x)  (  y x=2y)) “A number x is even, E(x), if and only if it is equal to 2 times some other number.”  x (E(x)  (  y x=2y)) “A number is prime, P(x), iff it’s greater than 1 and it isn’t the product of two non-unity numbers.”  x ( P(x)  (x>1   yz x=yz  y  1  z  1 ) ) “A number is prime, P(x), iff it’s greater than 1 and it isn’t the product of two non-unity numbers.”  x ( P(x)  (x>1   yz x=yz  y  1  z  1 ) )

68 Goldbach’s Conjecture (unproven) Using E(x) and P(x) from previous slide, Using E(x) and P(x) from previous slide,  E(x>2):  P(p),P(q): p+q = x or, with more explicit notation: or, with more explicit notation:  x [x>2  E(x)] →  x [x>2  E(x)] →  p  q P(p)  P(q)  p+q = x.  p  q P(p)  P(q)  p+q = x. “Every even number greater than 2 is the sum of two primes.” “Every even number greater than 2 is the sum of two primes.”

69 Calculus Example One way of precisely defining the calculus concept of a limit, using quantifiers: One way of precisely defining the calculus concept of a limit, using quantifiers:

70 Deduction Example Definitions: s :≡ Socrates (ancient Greek philosopher) ; H(x) :≡ “x is human”; M(x) :≡ “x is mortal”. Definitions: s :≡ Socrates (ancient Greek philosopher) ; H(x) :≡ “x is human”; M(x) :≡ “x is mortal”. Premises: H(s) Socrates is human. Premises: H(s) Socrates is human.  x H(x)  M(x) All h umans are mortal.  x H(x)  M(x) All h umans are mortal.

71 Deduction Example Continued Some valid conclusions you can draw: H(s)  M(s) [Instantiate universal.] If Socrates is human then he is mortal.  H(s)  M(s) Socrates is inhuman or mortal. H(s)  (  H(s)  M(s)) Socrates is human, and also either inhuman or mortal. (H(s)   H(s))  (H(s)  M(s)) [Apply distributive law.] F  (H(s)  M(s)) [Trivial contradiction.] H(s)  M(s) [Use identity law.] M(s) Socrates is mortal.

72 Another Example Definitions: H(x) :≡ “x is human”; M(x) :≡ “x is mortal”; G(x) :≡ “x is a god” Definitions: H(x) :≡ “x is human”; M(x) :≡ “x is mortal”; G(x) :≡ “x is a god” Premises: Premises: –  x H(x)  M(x) (“Humans are mortal”) and –  x G(x)   M(x) (“Gods are immortal”). Show that  x (H(x)  G(x)) (“No human is a god.”) Show that  x (H(x)  G(x)) (“No human is a god.”)

73 The Derivation  x H(x)  M(x) and  x G(x)  M(x).  x H(x)  M(x) and  x G(x)  M(x).  x  M(x)  H(x) [Contrapositive.]  x  M(x)  H(x) [Contrapositive.]  x [G(x)  M(x)]  [  M(x)  H(x)]  x [G(x)  M(x)]  [  M(x)  H(x)]  x G(x)  H(x) [Transitivity of .]  x G(x)  H(x) [Transitivity of .]  x  G(x)   H(x) [Definition of .]  x  G(x)   H(x) [Definition of .]  x  (G(x)  H(x)) [DeMorgan’s law.]  x  (G(x)  H(x)) [DeMorgan’s law.]  x G(x)  H(x) [An equivalence law.]  x G(x)  H(x) [An equivalence law.]

74 Summary of Predicate Logic From these sections you should have learned: - Predicate logic notation & conventions - Predicate logic notation & conventions - Conversions: predicate logic  clear English - Conversions: predicate logic  clear English - Meaning of quantifiers, equivalences - Meaning of quantifiers, equivalences - Simple reasoning with quantifiers - Simple reasoning with quantifiers


Download ppt "資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen)"

Similar presentations


Ads by Google