DISCRETE MATHEMATICS I LECTURES CHAPTER 3 Dr. Adam P. Anthony Spring 2011 Some material adapted from lecture notes provided by Dr. Chungsim Han and Dr. Sam Lomonaco
This Week Introduction to First Order Logic (Sections 3.1—3.3) Predicates and Logic Functions Quantifiers Basic Logic Using Quantifiers Implication, negation rules for quantifiers
Propositional Functions Propositional function (open sentence): Statement involving one or more variables, e.g.: P(x) = x-3 > 5. Let us call this propositional function P(x), where P is the predicate and x is the variable. What is the truth value of P(2) ? false What is the truth value of P(8) ? What is the truth value of P(9) ? false true
Propositional Functions Let us consider the propositional function Q(x, y, z) defined as: Q(x, y, z) = x + y = z. Here, Q is the predicate and x, y, and z are the variables. What is the truth value of Q(2, 3, 5) ? true What is the truth value of Q(0, 1, 2) ? What is the truth value of Q(9, -9, 0) ? false true
Function Domains Propositional functions are just like mathematical functions, they must have a domain: Real numbers Integers People Students Professors Stock Traders? Domains are used to clarify the purpose of the predicate Let x be the set of all Students. Let FT(x) = x is a full time student Sometimes domains are extremely important, particularly with if- then statements
Universal Quantification Let P(x) be a propositional function. Universally quantified sentence: For all x in the universe of discourse P(x) is true. Using the universal quantifier : x P(x) “for all x P(x)” or “for every x P(x)” (Note: x P(x) is either true or false, so it is a proposition, not a propositional function.)
Universal Quantification Example: S(x): x is a B-W student. G(x): x is a genius. What does x (S(x) G(x)) mean ? “If x is a UMBC student, then x is a genius.” OR “All UMBC students are geniuses.”
Existential Quantification Existentially quantified sentence: There exists an x in the universe of discourse for which P(x) is true. Using the existential quantifier : x P(x) “There is an x such that P(x).” “There is at least one x such that P(x).” (Note: x P(x) is either true or false, so it is a proposition, not a propositional function.)
Existential Quantification Example: P(x): x is a B-W professor. G(x): x is a genius. What does x (P(x) G(x)) mean ? “There is an x such that x is a UMBC professor and x is a genius.” OR “At least one B-W professor is a genius.”
Quantifiers, Predicates and Domains A properly defined quantified statement will have predicates and domains clearly specified How do we say there is a value for x that makes (5x =3) true? Let x be the set of all real numbers R Let P(x) = (5x = 3) x P(x) Sometimes, this is more trouble than it’s worth to be this clear so we’ll use shorthand: x in real numbers such that 5x = 3 Or, even shorter: x in R, 5x = 3 Finally, if predicates are used (particularly with implication) but no quantifier is given, then assume is used: P(x) → Q(x) ≡ ∀ x P(x) → Q(x)
Exercise Re-write each statement using and (sometimes both!) as appropriate: a) There Exists a negative real x such that x 2 =8 a) For every nonzero real a, there is a real b such that ab = 1 a) All even integers are positive a) Some integers are prime a) If n 2 =4 then n = 2
Exercise Determine the truth values of the following statements: a) For all real numbers x, x 2 ≥ 0 a) For all real numbers x, x 2 > 0 a) There is an integer n such that n 2 = 4 a) There is an integer n such that n 2 = 3 b) For all integers x, If x = 2 then x 2 = 4 a) If x 2 = 4 then x = 2
Truth Values of Quantified Statements Take the statement: ∀ vertebrates a, Bird(a) → Fly(a) Is it True? Disproof by Counter-example Take the statement: ∃ species s, Pig(s) ∧ Fly(s) Is it True? How do we disprove this one? Disproof by exhaustive search Picking domains carefully here can make search easier In Reality, ∀ is a generalized version of AND ( ∧ ) and ∃ is a generalized version of OR ∨ : To say ∀ x P(x) means we are saying P(x) is true for everything in the world at the same time ∀ x P(x) ≡ P(x 1 ) ∧ P(x 2 ) ∧ … ∧ P(x n ) To say that ∃ x P(x) means we are saying that P(x) is true for at least one (or more or ALL) thing in the world ∃ x P(x) ≡ P(x 1 ) ∨ P(x 2 ) ∨ … ∨ P(x n ) In Reality, ∀ is a generalized version of AND ( ∧ ) and ∃ is a generalized version of OR ∨ : To say ∀ x P(x) means we are saying P(x) is true for everything in the world at the same time ∀ x P(x) ≡ P(x 1 ) ∧ P(x 2 ) ∧ … ∧ P(x n ) To say that ∃ x P(x) means we are saying that P(x) is true for at least one (or more or ALL) thing in the world ∃ x P(x) ≡ P(x 1 ) ∨ P(x 2 ) ∨ … ∨ P(x n )
Generalized DeMorgan’s DeMorgan’s law can apply to longer expressions as long as the connective used is the same throughout: ¬(p ∧ q ∧ r ∧ z) ≡ ¬p ∨ ¬q ∨ ¬r ∨ ¬z Repeatedly apply associative laws to see how this works So if ∀ and ∃ are just short-hand for ∧ and ∨ then what happens if we negate them?
Negating Quantified Statements ∀ x P(x) ≡ P(x 1 ) ∧ P(x 2 ) ∧ … ∧ P(x n ) ∃ x P(x) ≡ P(x 1 ) ∨ P(x 2 ) ∨ … ∨ P(x n ) ¬( ∀ x P(x)) ≡ ¬(P(x 1 ) ∧ P(x 2 ) ∧ … ∧ P(x n )) ≡ ¬P(x 1 ) ∨ ¬P(x 2 ) ∨ … ∨ ¬P(x n ) ≡ ∃ x ¬P(x) ¬( ∃ x P(x)) ≡ ¬(P(x 1 ) ∨ P(x 2 ) ∨ … ∨ P(x n )) ≡ ¬P(x 1 ) ∧ ¬P(x 2 ) ∧ … ∧ ¬P(x n ) ≡ ∀ x ¬P(x)
Tying It All Together Things seem strange now…logic functions…predicates…quantifiers… Everything we learned before today is still applicable: Theorem (laws for simplification) Implication elimination/negation Converse/contrapositive/inverse Any other equivalences/tautologies/contradictions Truth tables can be used, but less frequently at this point
Exercise Write negations for the following statements: a) For all numbers x, x 2 > 0 b) There is an integer n such that n 2 = 3 c) All even integers are positive d) Some integers are prime
Exercise cont. a) For any real x, if x ≥ 0, then x 2 ≥x b) For any integer n, if n 2 =n, then n = c) Some dogs go to hell d) EVERYBODY fails MTH 161!
Exercise Rewrite the following using ∀ and ∃, then determine the truth value of each statement (hint: negating the statement can help—HOW?): a) All even integers are positive b) Some integers are prime c) There is a positive real x such that x 2 ≥ x 3 d) For any real x, if x ≥ 1, then x 2 ≥ x
2.1.4 continued a) For any integer n, if n 2 = n, then n = 0 b) For any real x, if x 2 = -1, then x = -1 c) If n 2 = 4, then n = 2
Major Pitfalls with Conditionals Remember how we interpret implication If you can’t prove me wrong, then I’m right For what things in the world is student(x) → smart(x) true? Smart students Anybody who is not a student (vacuously true case) When is ∀ people x, student(x) → smart(x) true? When is it false? When is ∃ person x, student(x) → smart(x) true? When is it false? If we meant to say, ‘there exists a student who is smart’ how do we fix this?
Common Uses of Quantifiers Universal quantifiers are often used with “implies” to form “rules”: ( x) student(x) smart(x) means “All students are smart” Universal quantification is rarely used to make blanket statements about every individual in the world: ( x)student(x) smart(x) means “Everyone in the world is a student and is smart” Existential quantifiers are usually used with “and” to specify a list of properties about an individual: ( x) student(x) smart(x) means “There is a student who is smart”
Using Multiple Variables, Quantifiers We already saw a multivariable predicate: Q(x, y, z) = x + y = z. We can quantify this as (for example): ∃ real x ∃ real y ∃ real z, such that Q(x,y,z) Read this as: there exist real number values x, y, and z such that the sum of x and y is z We can also mix-and-match quantifiers, but it’s trickier and in English it can be confusing: ‘There is a person supervising every detail of the production process’ Work out on the board
Understanding Mixed Quantifiers Here’s how you could ‘determine’ the truth of the following: ∀ x in D, ∃ y in E such that P(x,y) Have a friend pick anything in D, then you have to find something in E that makes P(x,y) true If you ever fail, then the statement is false (counterexample). ∃ x in D such that ∀ y in E, P(x,y) You need to pick a ‘trump card’: Pick one item from D such that no matter what someone picks out of E, P(x,y) will be true Your friend should always fail to prove you wrong
Exercise Express the following using ∀ and ∃, then evaluate the truth of the expression a) For any real x, there is a real y such that x + y = 0 b) There is a real x such that for any real y, x ≤ y c) For any real x, there is a real y such that y < x
Less Mathematical Practice (2.2.2) Every gardener likes the sun. x gardener(x) likes(x,Sun) You can fool some of the people all of the time. x t person(x) time(t) can-fool(x,t) You can fool all of the people some of the time. x t (person(x) time(t) can-fool(x,t)) x (person(x) t (time(t) can-fool(x,t)) All purple mushrooms are poisonous. x (mushroom(x) purple(x)) poisonous(x) No purple mushroom is poisonous. x purple(x) mushroom(x) poisonous(x) x (mushroom(x) purple(x)) poisonous(x)
Logic to English Translation (2.2.3) a) x person(x) male(x) v female(x) b) x male(x) ^ person(x) c) x boy(x) male(x) ^ young(x)
Negating Mixed Quantifiers Easy: just apply the negation rule we learned earlier for quantifiers, moving the negation in bit- by-bit: ¬( ∀ x in D, ∃ y in E such that P(x,y)) ≡ ∃ x in D, ¬(E y in E such that P(x,y)) ≡ ∃ x in D, ∀ y in E such that ¬P(x,y) Works same for ∃ x in D such that ∀ y in E, P(x,y) Work out on board!
Exercise Negate the following until all negation signs are touching a predicate: a) ∀ x ∀ y, P(x,y) b) ∀ x ∃ y, (P(x) ∧ Z(x,y)) c) ∃ x ∀ y, (P(x) → R(y))
Order Matters (half the time)! If all your quantifiers are the same, you can put them in any order and the meaning remains: ∀ reals x, ∀ reals y, x + y = y + x ≡ ∀ reals y, ∀ reals x, x + y = y + x Similar for ∃ You have to be VERY careful about the order of mixed quantifiers: What is the difference between: ∀ people x, ∃ a person y such that loves(x,y) ∃ person x such that ∀ people y, loves(x,y)
Valid Arguments Using Quantifiers Quantifiers help avoid having to name everything in the domain But what if we reach a point where we are looking at a particular item? What can we conclude about that item, if all we have a quantified statements?
Universal Instantiation Rule of Universal Instantiation: If some property is true of EVERYTHING in a domain, then it is true of any PARTICULAR thing in that domain x in D, P(x) is TRUE for all things in the domain D Now, observe an item a from the domain D: Can we conclude anything? P(a) has to be true
Universal Modus Ponens x in D, P(x) Q(x) P(a) is true for a particular a in D Therefore, Q(a) is true Universal instantiation makes this work. How?
Universal Modus Tollens x in D, P(x) Q(x) Q(a) for some particular a in D Therefore, P(a) Same Reasoning about Universal Instantiation here, as well!
Universal Modus Ponens or Universal Modus Tollens? a) All good cars are expensive A smarty is not expensive Therefore, a smarty is not a good car b) Any sum of two rational numbers is rational The numbers a and b are rational Therefore, a + b is rational
Fill In The Blanks (Modus Ponens or Modus Tollens) If n is even, then n = 2k for some integer k (4x + 2) is even Therefore, _________________ If m is odd, then m = 2k + 1 for some integer k r 2i + 1 for any integer I Therefore, __________________ n is even if and only if n = 2k for some integer k (m + 1) 2 = 2l and l is an integer Therefore, __________________
Other Quantified Arguments All of the arguments we looked at in CH 2 have a quantified version of one form or another Universal Transitivity: x P(x) Q(x) x Q(x) R(x) x P(x) R(x) Invalid arguments can be quantified as well, so be careful! Don’t forget about Converse, Inverse error
Diagrams For Analyzing Arguments All good cars are expensive A smarty is not an expensive car Therefore, a smarty is not a good car Expensive Cars Smarty Expensive Cars Good Cars
Diagram Example 1 All CS Majors are smart Pam is not a CS Major Therefore, Pam is not smart
Diagram Example 2 If a product of two numbers is 0, then at least one of the numbers is 0. x 0 and y 0 Therefore, xy 0
Diagram Example 3 No college cafeteria food is good No good food is wasted Therefore, No college cafeteria food is wasted
Diagram Example 4 All teachers occasionally make mistakes No gods ever make mistakes Therefore, No teachers are gods