Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 1: The Foundations: Logic and Proofs 1.1 Propositional Logic 1.2 Propositional Equivalences 1.3 Predicates and Quantifiers 1.4 Nested Quantifiers.

Similar presentations


Presentation on theme: "Chapter 1: The Foundations: Logic and Proofs 1.1 Propositional Logic 1.2 Propositional Equivalences 1.3 Predicates and Quantifiers 1.4 Nested Quantifiers."— Presentation transcript:

1 Chapter 1: The Foundations: Logic and Proofs 1.1 Propositional Logic 1.2 Propositional Equivalences 1.3 Predicates and Quantifiers 1.4 Nested Quantifiers 1.5 Rules of Inference 1.6 Introduction to Proofs 1.7 Proof Methods and Strategy

2 Predicate: A generalization of propositions ; A propositions which contain variables Predicates become propositions once every variable is bound- by – assigning it a value from the Universe of Discourse U or – quantifying it P. 1 Predicates

3 Examples: Let U = Z, the integers = {... -2, -1, 0, 1, 2,...} – P(x): x > 0 is the predicate. It has no truth value until the variable x is bound. Examples of propositions where x is assigned a value: (a)P(-3) (?, true or false); (b)P(0)(?); (c)(c) P(3)(?). The collection of integers for which P(x) is true are the positive integers. P(y) ν ¬ P(0) is not a proposition. The variable y has not been bound. However, P(3) ν ¬ P(0) is a proposition which is true. P. 1 Predicates

4 Example: Let R be the three-variable predicate R(x, y, z): x + y = z Find the truth value of R(2, -1, 5), R(3, 4, 7), R(x, 3, z) P. 1 Predicates

5 Quantifiers: Universal P(x) is true for every x in the universe of discourse. Notation: universal quantifier ∀ xP(x) ‘For all x, P(x)’, ‘For every x, P(x)’ The variable x is bound by the universal quantifier producing a proposition. An element for which P(x) is false is called a counterexample of ∀ xP(x). Example: U={1,2,3} ∀ xP(x)  P(1) Λ P(2) Λ P(3) P. 1

6 Quantifiers: Universal Example 8: Let P(x) be the statement “x+1>x.” What is the truth value of the quantification ∀ xP(x) where the domain consists of all real number. HW: P36, example 13 P. 1

7 Quantifiers: Existential P(x) is true for some x in the universe of discourse. Notation: existential quantifier ∃ xP(x) – ‘There is an x such that P(x),’ – ‘For some x, P(x)’, – ‘For at least one x, P(x)’, – ‘I can find an x such that P(x).’ Example: U={1,2,3} – ∃ xP(x)  P(1) ν P(2) ν P(3) P. 1

8 Quantifiers: Existential Example 14: Let P(x) denote the statement “x>3.” What is the truth value of the quantification ∃ xP(x), where the domain consists of all real numbers. HW: Page 37, Example 16. P. 1

9 Quantifiers P. 1

10 Quantifiers: Unique Existential P(x) is true for one and only one x in the universe of discourse. Notation: unique existential ∃ !xP(x) – ‘There is a unique x such that P(x),’ – ‘There is one and only one x such that P(x),’ – ‘One can find only one x such that P(x).’ P. 1

11 Quantifiers Example: U={1,2,3} Truth Table: P(1) P(2) P(3) ∃ !xP(x) P. 1

12 Quantifiers Note: A predicate is not a proposition until all variables have been bound either by quantification or assignment of a value! P. 1

13 Precedence of Quantifiers The quantifiers  and  have higher precedence than all logical operators from propositional calculus. Example:  xP(x)  Q(x) means (a) (  xP(x))  Q(x) (b)  x(P(x)  Q(x)) P. 1

14 Binding Variables Example:  x(x+y=1) Bound variable: Free variable: Example:  x(P(x)  Q(x))  xR(x) The scope of  : The scope of  : The same meaning of  x(P(x)  Q(x))  yR(y) P. 1

15 Logical Equivalences Involving Quantifiers Example 19: Show that  x(P(x)  Q(x)) and  xP(x)  xQ(x) are logically equivalent. P. 1

16 Logical Equivalences Involving Quantifiers Statement 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. Symbol: S  T P. 1

17 Equivalences Involving the Negation Operator Equivalences involving the negation operator ¬ ∀ xP(x)  ∃ x ¬ P(x) ¬ ∃ xP(x)  ∀ x ¬ P(x) Distributing a negation operator across a quantifier changes a universal to an existential and vice versa. P. 1

18 Equivalences Involving the Negation Operator Example 20: What are the negations of the statements: “There is an honest politician” Example 20: What are the negations of the statements: “All Americans eat cheeseburgers”. HW: Example 21 in P41. P. 1

19 Translating from English into Logical Expressions (single quantifier) Example 23: Express the statement “Every student in this class has studied calculus” using predicates and quantifiers. P. 1

20 Using Quantifiers in System Specifications Example 26: Consider these statements. “All lions are fierce.” “Some lions do not drink coffee.” “Some fierce creatures do not drink coffee.” Let P(x): x is a lion. Q(x): x is fierce. R(x): x drinks coffee. Assuming that the domain consists of all creatures, express the statements in the argument using quantifiers and P(x), Q(x), and R(x). P. 1

21 Logic Programming Prolog(Programming in Logic, developed in the 1970s. Working in AI. Prolog programs including a set of declarations consisting of two types of statements: – Facts : define predicates by specifying the elements that satisfy these predicates. – Rules: define new predicates using those already defined by facts. P. 1

22 Logic Programming Example 28: Facts: instructor(chan, math273) instructor(patel, ee222) instructor(grossman, cs301) enrolled(kevin, math273) enrolled(juana, ee222) enrolled(juana, cs301) enrolled(kiko, math273) enrolled(kiko, cs301) P. 1 Rules: teacher(P,S) :- instructor(P,C), enrolled(S,C) Queries: ?enrolled(kevin, math273) ?enrolled(X,math273) ?teacher(X,juana) Uppercase letters are variables. The “  ” represents by “,” and the “  ” represents by “;” in Prolog.

23 Quantifiers Multiple Quantifiers: read left to right... Example: Let U = R, the real numbers, P(x,y): xy= 0 ∀ x ∀ yP(x, y) ∀ x ∃ yP(x, y) ∃ x ∀ yP(x, y) ∃ x ∃ yP(x, y) The only one that is false is the first one. Suppose P(x,y) is the predicate x/y=1? Assume U=R- {0}. P. 1

24 Quantifiers Example: Let U = {1,2,3}. Find an expression equivalent to ∀ x ∃ yP(x, y) where the variables are bound by substitution instead: Expand from inside out or outside in. Outside in: ∃ yP(1, y) Λ ∃ yP(2, y) Λ ∃ yP(3, y)  [P(1,1) ν P(1,2) ν P(1,3)] Λ [P(2,1) ν P(2,2) ν P(2,3)] Λ [P(3,1) ν P(3,2) ν P(3,3)] HW: Inside Out: P. 1

25 Quantifiers De Morgan’s Laws for Quantifiers P. 1

26 Quantifiers: Converting from English Examples: F(x): x is a fleegle S(x): x is a snurd T(x): x is a thingamabob U={fleegles, snurds, thingamabobs} Note: the equivalent form using the existential quantifier is also given P. 1

27 Quantifiers: Converting from English Everything is a fleegle ∀ xF( x)  ¬ ∃ x¬F(x) Nothing is a snurd. ∀ x¬S(x)  ¬ ∃ xS( x) All fleegles are snurds. ∀ x[F(x) → S(x)]  ∀ x[¬ F(x) ν S(x)]  ∀ x ¬[F(x) Λ ¬ S(x)]  ¬ ∃ x[F(x) Λ ¬ S( x)] P. 1

28 Quantifiers: Converting from English Some fleegles are thingamabobs. ∃ x[F(x) Λ T(x)]  ¬ ∀ x[¬ F(x) ν ¬ T(x)] No snurd is a thingamabob. ∀ x[S(x) → ¬ T(x)]  ¬ ∃ x[S(x ) Λ T(x)] If any fleegle is a snurd then it's also a thingamabob ∀ x[(F(x) Λ S(x)) → T(x)]  ¬ ∃ x[F(x) Λ S(x) Λ ¬ T( x)] P. 1

29 Quantifiers:Dangerous situations Commutativity of quantifiers ∀ x ∀ yP(x, y)  ∀ y ∀ xP(x, y)? YES! ∀ x ∃ yP(x, y)  ∃ y ∀ xP(x, y)? NO! DIFFERENT MEANING! Example: P(x,y): x+y=0, U: Integers ∀ x ∃ yP(x, y) is Ture ∃ y ∀ xP(x, y) is False P. 1

30 Quantifiers:Dangerous situations Distributivity of quantifiers over operators ∀ x[P(x)ΛQ(x)]  ∀ xP( x)Λ ∀ xQ(x)? YES! ∀ x[P(x)→Q(x)]  [ ∀ xP(x)→ ∀ xQ(x)]? NO! Let P(x) sometimes true, sometimes false, and Q(x) is always false, then ∀ x[P(x)→Q(x)] is False [ ∀ xP(x)→ ∀ xQ(x)] is True P. 1

31 Terms Proposition Predicate Universal Quantifier Existential Quantifier Unique Existential Quantifier De Morgan’s Laws for Quantifiers Binding Variables Logic Programming P. 1


Download ppt "Chapter 1: The Foundations: Logic and Proofs 1.1 Propositional Logic 1.2 Propositional Equivalences 1.3 Predicates and Quantifiers 1.4 Nested Quantifiers."

Similar presentations


Ads by Google