27
2006 310205 Mathematics for Comter I 1 Lecture 3: Logic (2) Propositional Equivalences Predicates and Quantifiers

1 2006 310205 Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and…

Embed Size (px)

DESCRIPTION

Mathematics for Comter I 3.1. Propositional Equivalences Two propositions P and Q are logically equivalent if P  Q is a tautology. We write P  Q

Citation preview

Page 1: 1 2006 310205 Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and…

2006 310205 Mathematics for Comter I 1

Lecture 3: Logic (2) Propositional Equivalences Predicates and Quantifiers

Page 2: 1 2006 310205 Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and…

2006 310205 Mathematics for Comter I 2

3.1. Propositional Equivalences Categories of compound propositions:

• A tautology is a proposition which is always true.• Classic Example: PP

• A contradiction is a proposition which is always false.• Classic Example: PP

• A contingency is a proposition which neither a tautology nor a contradiction.• Example: (PQ)R

Page 3: 1 2006 310205 Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and…

2006 310205 Mathematics for Comter I 3

3.1. Propositional Equivalences Two propositions P and Q are logically

equivalent if P Q is a tautology. We write

P Q

Page 4: 1 2006 310205 Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and…

2006 310205 Mathematics for Comter I 4

3.1. Propositional Equivalences Example: (PQ)(QP) (P Q) Proof:

• Left side and the right side must have the same truth values, independent of the truth value of the component propositions.

• To show a proposition is not a tautology: use an abbreviated truth table• try to find a counter example or to disprove the

assertion.• search for a case where the proposition is false.

Page 5: 1 2006 310205 Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and…

2006 310205 Mathematics for Comter I 5

3.1. Propositional Equivalences• Two possible cases:

• Case 1: Left side false, right side true.• Case 2: Left side true, right side false.

• Case 1: Try left side false, right side true• Left side false: only one of PQ or QP need be false.

1a. Assume PQ = F. Then P = T, Q = F. But then right side PQ = F. Oops, wrong guess.

1b. Try QP = F. Then Q = T, P = F. But then right side PQ = F. Another wrong guess.

*Proof for (PQ)(QP) (P Q)

P Q PQ

0 0 1

0 1 1

1 0 0

1 1 1

P Q PQ

0 0 1

0 1 0

1 0 0

1 1 1

Page 6: 1 2006 310205 Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and…

2006 310205 Mathematics for Comter I 6

3.1. Propositional Equivalences• Case 2. Try left side true, right side false

• If right side is false, P and Q cannot have the same truth value.2a. Assume P =T, Q = F. Then PQ = F and the conjunction

must be false so the left side cannot be true in this case. Another wrong guess.

2b. Assume Q = T, P = F. Then QP = F. Again the left side cannot be true.

• We have exhausted all possibilities and not found a counter-example. The two propositions must be logically equivalent.

• Note: Given such equivalence, if and only if or iff is also stated as is a necessary and sufficient condition for.

*Proof for (PQ)(QP) (P Q)

P Q PQ

0 0 1

0 1 1

1 0 0

1 1 1

P Q PQ

0 0 1

0 1 0

1 0 0

1 1 1

Page 7: 1 2006 310205 Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and…

2006 310205 Mathematics for Comter I 7

3.1. Propositional Equivalences Some important logical equivalences:

Equivalences Name

PT P

PF PIdentity laws

PT T

PF FDomination laws

PP P

PP PIdempotent laws

(P) PDouble negation law

P T PT

0 1 1

1 1 1

P P PP

0 0 0

1 1 1

Page 8: 1 2006 310205 Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and…

2006 310205 Mathematics for Comter I 8

3.1. Propositional Equivalences Some important logical equivalences:

Equivalences Name

PQ QP

PQ QPCommutative laws

(PQ)R P(QR)

(PQ)R P(QR)Associative laws

P(QR) (PQ)(PR)

P(QR) (PQ)(PR)Distributive laws

(PQ) PQ

(PQ) PQDe Morgan’s laws

Page 9: 1 2006 310205 Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and…

2006 310205 Mathematics for Comter I 9

3.1. Propositional Equivalences Other logical equivalences:

Equivalences Name

PQ PQ Implication

PP T Tautology

PP F Contradiction

(PQ)(QP) (PQ) Equivalence

(PQ)(PQ) P Absurdity

Page 10: 1 2006 310205 Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and…

2006 310205 Mathematics for Comter I 10

3.1. Propositional Equivalences Other logical equivalences:

Equivalent expressions can always be substituted for each other in a more complex expression – useful for simplification.

Equivalences Name

(PQ) (QP) Contrapositive

P(PQ) P

P (PQ) PAbsorption

(P Q)R P(QR) Exportation

Page 11: 1 2006 310205 Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and…

2006 310205 Mathematics for Comter I 11

3.1. Propositional Equivalences Example:

(P(PQ)) can be simplified by using the following series of logical equivalence:

(P(PQ)) P(PQ)) from the second De Morgan’s law P[(P)Q] from the first De Morgan’s law P(PQ) from the double negation law (PP)(PQ] from the distributive law F(PQ) since PPF PQ from the identity law for F (PQ) from the second De Morgan’s law

Page 12: 1 2006 310205 Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and…

2006 310205 Mathematics for Comter I 12

3.1. Propositional Equivalences

But Complexity (2n)…

REMEMBER!

We can always use a truth table to show that the simplified proposition is equivalent to the original proposition.

Page 13: 1 2006 310205 Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and…

2006 310205 Mathematics for Comter I 13

3.2. Predicates and Quantifiers 2+1=3: a proposition x+y=3: propositional functions or predicates

• A generalization of propositions• Propositions which contain variables• Predicates become propositions once every variable is

bound - by• assigning it a value from the Universe of Discourse Uor• quantifying it

Page 14: 1 2006 310205 Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and…

2006 310205 Mathematics for Comter I 14

3.2.1. Predicates Example 1:

• Let U = Z, the integers = , -2, -1, 0 , 1, 2, 3,

• P(x): x > 0, a predicate or propositional function. • It has no truth value until the variable x is bound.• Examples of propositions where x is assigned a value:

• P(-3) is false, i.e. -3 > 0 is false.• P(0) is false.• P(3) is true.

• The collection of integers for which P(x) is true are the positive integers.

Page 15: 1 2006 310205 Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and…

2006 310205 Mathematics for Comter I 15

3.2.1. Predicates Example 1 (continued):

• P(x): x > 0 is the predicate. • 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.

Example 2:• 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)

Page 16: 1 2006 310205 Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and…

2006 310205 Mathematics for Comter I 16

3.2.2. Quantifiers Specific value vs. Range What range of values in U for which the

bounded propositions are true? Two possibilities:

• Universal: For all values in U• Existential: For some values in U

Page 17: 1 2006 310205 Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and…

2006 310205 Mathematics for Comter I 17

3.2.2. Quantifiers Universal

• P(x) is true for every x in the universe of discourse.• Notation: universal quantifier x P(x)

• For all x, P(x)or• For every x, P(x)

• The variable x is bound by the universal quantifier producing a proposition.

• Example: • U = { 1,2,3 }

x P(x) P(1)P(2)P(3)

Page 18: 1 2006 310205 Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and…

2006 310205 Mathematics for Comter I 18

3.2.2. Quantifiers Existential

• P(x) is true for some x in the universe of discourse.• Notation: existential quantifier x P(x)

• There is an x such that P(x)or• 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 }

x P(x) P(1)P(2)P(3)

Page 19: 1 2006 310205 Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and…

2006 310205 Mathematics for Comter I 19

3.2.2. Quantifiers

Predicate equivalences:• Equivalences involving the negation operator

x P(x) x P(x)x P(x) x P(x)

• Distributing a negation operator across a quantifier changes a universal to an existential, and vice versa.

REMEMBER!

A predicate (propositional function) is not a proposition until all variables have been

bound either by quantification or assignment of a value!

Page 20: 1 2006 310205 Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and…

2006 310205 Mathematics for Comter I 22

3.2.2. Quantifiers Multiple Quantifiers:

• Read from left to right . . .• Example 1:

• Let U = R, the real numbers, P(x,y): xy = 0

xy P(x,y)xy P(x,y)xy P(x,y)xy P(x,y)

• The only one that is false is the first one. Why?• Suppose P(x,y) is the predicate x/y=1?

Page 21: 1 2006 310205 Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and…

2006 310205 Mathematics for Comter I 23

3.2.2. Quantifiers Dangerous situations:

• Commutativity of quantifiersxy P(x, y) yx P(x, y)? YES!

xy P(x, y) yx P(x, y)? NO! DIFFERENT MEANING!

Page 22: 1 2006 310205 Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and…

2006 310205 Mathematics for Comter I 24

3.2.2. Quantifiers Example of non-commutativity of quantifiers:

• Let Q(x, y) denote “x + y = 0.”• Are the truth values of the quantifications yx P(x, y)

and xy P(x, y) the same? The answer is NO since:

yx P(x, y) means “There is a real number y such that for all real numbers x, Q(x, y) is true.”• The statement is false. Why?

x y P(x, y) means “For every real number x there is a real number y such that Q(x, y) is true.”• The statement is true.

Page 23: 1 2006 310205 Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and…

2006 310205 Mathematics for Comter I 25

3.2.3. Converting from English (can be very difficult) Example 1:

• Express the statement “If somebody is female and is a parent, then this person is someone’s mother” as a logical expression.• Let

F(x): x is female.P(x): x is a parentM(x, y): x is the mother of y.

• The statement applies to all people.x ((F(x) (P(x)) y M(x, y))

Page 24: 1 2006 310205 Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and…

2006 310205 Mathematics for Comter I 26

3.2.3. Converting from English Example 2:

• Express the statement “Everyone has exactly one best friend” as a logical expression.• Let

B(x, y): y is the best friend of x.

• The statement says “exactly one best friend”. This means that if y is the best friend of x, then all other people z other than y can not be the best friend of x.

xyz (B(x, y) ((z y) B(x, z)))

Page 25: 1 2006 310205 Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and…

2006 310205 Mathematics for Comter I 27

3.2.3. Converting from English Example 3:

• Consider the following statements. “All lions are fierce.”“Some lions do not drink coffee.”“Some fierce creatures do not drink

coffee.”• The first two are called premises and the third

is called the conclusion. The entire set is called an argument.

Page 26: 1 2006 310205 Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and…

2006 310205 Mathematics for Comter I 28

3.2.3. Converting from English Example 3 (continued):

• We can express these statements as follows.• Let P(x): x is a lion.

Q(x): x is fierce.R(x): x drinks coffee.

• Then x (P(x) Q(x)).x (P(x) R(x)).x (Q(x) R(x)).

• Why can’t we write the second statement asx (P(x) R(x))?

Page 27: 1 2006 310205 Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and…

2006 310205 Mathematics for Comter I 29

3.3. Further Readings Propositional Equivalences

• Rosen: Section 1.2. Predicates and Quantifiers

• Rosen: Section 1.3.