discrete mathematics i lectures chapter 3 dr. adam p. anthony spring 2011 some material adapted from...

42
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

Upload: myles-sanders

Post on 16-Dec-2015

216 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 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

DISCRETE MATHEMATICS ILECTURES CHAPTER 3Dr. Adam P. AnthonySpring 2011

Some material adapted from lecture notes provided by Dr. Chungsim Han and Dr. Sam Lomonaco

Page 2: 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

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

Page 3: 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

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

Page 4: 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

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

Page 5: 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

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

Page 6: 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

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.)

Page 7: 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

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.”

Page 8: 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

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.)

Page 9: 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

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.”

Page 10: 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

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)

Page 11: 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

Exercise 2.1.1

Re-write each statement using and (sometimes both!) as appropriate: a) There Exists a negative real x such that x2=8

b) For every nonzero real a, there is a real b such that ab = 1

c) All even integers are positive

d) Some integers are prime

e) If n2=4 then n = 2

Page 12: 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

Exercise 2.1.2

Determine the truth values of the following statements: a) For all real numbers x, x2 ≥ 0

b) For all real numbers x, x2 > 0

c) There is an integer n such that n2 = 4

d) There is an integer n such that n2 = 3

e) For all integers x, If x = 2 then x2 = 4

f) If x2 = 4 then x = 2

Page 13: 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

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(x1) ∧ P(x2) ∧… ∧P(xn)•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(x1) ∨ P(x2) ∨… ∨P(xn)

Page 14: 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

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?

Page 15: 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

Negating Quantified Statements ∀x P(x) ≡P(x1) ∧ P(x2) ∧… ∧P(xn) ∃x P(x) ≡P(x1) ∨ P(x2) ∨… ∨P(xn) ¬(∀x P(x)) ≡¬(P(x1) ∧ P(x2) ∧… ∧P(xn))

≡¬P(x1) ∨ ¬P(x2) ∨… ∨¬P(xn)

≡∃x ¬P(x) ¬(∃x P(x)) ≡¬(P(x1) ∨ P(x2) ∨… ∨P(xn))

≡¬P(x1) ∧ ¬P(x2) ∧… ∧¬P(xn)

≡∀x ¬P(x)

Page 16: 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

Tying It All Together

Things seem strange now…logic functions…predicates…quantifiers…

Everything we learned before today is still applicable: Theorem 2.1.1 (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

Page 17: 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

Exercise 2.1.3

Write negations for the following statements: a) For all numbers x, x2 > 0

b) There is an integer n such that n2 = 3

c) All even integers are positive

d) Some integers are prime

Page 18: 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

Exercise 2.1.3 cont.

a) For any real x, if x ≥ 0, then x2≥x

b) For any integer n, if n2=n, then n =

c) Some dogs go to hell

d) EVERYBODY fails MTH 161!

Page 19: 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

Exercise 2.1.4

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 x2 ≥ x3

d) For any real x, if x ≥ 1, then x2 ≥ x

Page 20: 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

2.1.4 continued

a) For any integer n, if n2 = n, then n = 0

b) For any real x, if x2 = -1, then x = -1

c) If n2 = 4, then n = 2

Page 21: 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

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?

Page 22: 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

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”

Page 23: 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

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

Page 24: 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

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

Page 25: 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

Exercise 2.2.1

Express the following using ∀ and ∃, then evaluate the truth of the expressiona) 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

Page 26: 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

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)

Page 27: 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

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)

Page 28: 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

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!

Page 29: 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

Exercise 2.2.4

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))

Page 30: 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

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)

Page 31: 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

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?

Page 32: 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

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

Page 33: 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

Universal Modus Ponens

x in D, P(x) Q(x)P(a) is true for a particular a in DTherefore, Q(a) is true

Universal instantiation makes this work. How?

Page 34: 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

Universal Modus Tollens

x in D, P(x) Q(x)Q(a) for some particular a in DTherefore, P(a)

Same Reasoning about Universal Instantiation here, as well!

Page 35: 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

Universal Modus Ponens or Universal Modus Tollens?

a) All good cars are expensiveA smarty is not expensiveTherefore, a smarty is not a good car

b) Any sum of two rational numbers is rationalThe numbers a and b are rationalTherefore, a + b is rational

Page 36: 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

Fill In The Blanks (Modus Ponens or Modus Tollens)

If n is even, then n = 2k for some integer k(4x + 2) is evenTherefore, _________________

If m is odd, then m = 2k + 1 for some integer kr 2i + 1 for any integer ITherefore, __________________

n is even if and only if n = 2k for some integer k(m + 1)2 = 2l and l is an integerTherefore, __________________

Page 37: 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

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

Page 38: 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

Diagrams For Analyzing Arguments All good cars are expensive

A smarty is not an expensive carTherefore, a smarty is not a good car

Expensive Cars

Smarty

Expensive Cars

Good

Cars

Page 39: 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

Diagram Example 1

All CS Majors are smartPam is not a CS MajorTherefore, Pam is not smart

Page 40: 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

Diagram Example 2

If a product of two numbers is 0, then at least one of the numbers is 0.x 0 and y 0Therefore, xy 0

Page 41: 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

Diagram Example 3

No college cafeteria food is goodNo good food is wastedTherefore, No college cafeteria food is wasted

Page 42: 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

Diagram Example 4

All teachers occasionally make mistakesNo gods ever make mistakesTherefore, No teachers are gods