Upload
others
View
4
Download
0
Embed Size (px)
Citation preview
CSE 20: Discrete Mathematics
Daniele Micciancio
Spring 2018
Daniele Micciancio CSE 20: Discrete Mathematics
Summary
So far:
Propositional Logic: and, or, not, impliesReasoning: Truth tables, Equivalences, Proofs.
Today:
Predicate LogicExtend language with “every”, “some”, etc.Translating between English and Formal logicCarrying out proofsReading: Chap. 1.4, 1.5.
Daniele Micciancio CSE 20: Discrete Mathematics
A classic example
Is the following deduction logically correct?
All men are mortalSocrates is a manTherefore, Socrates is mortal
(A) Yes; (B) No; (C) Not enough information; (D) I don’t know
The answer is (A), but we still do not have the tools to formallyjustify it.
Daniele Micciancio CSE 20: Discrete Mathematics
A classic example
Is the following deduction logically correct?
All men are mortalSocrates is a manTherefore, Socrates is mortal
(A) Yes; (B) No; (C) Not enough information; (D) I don’t know
The answer is (A), but we still do not have the tools to formallyjustify it.
Daniele Micciancio CSE 20: Discrete Mathematics
Next question
Is the following deduction logically correct?
All men are mortalSocrates is mortalTherefore, all man are Socrates
What about
All professors are grey at nightI am grey at nightTherefore I am a professor
Notes:
No propositional logic connectives. Atomic propositions.
To study this type of deductions we need to extend thelanguage of propositional logic.
Daniele Micciancio CSE 20: Discrete Mathematics
Next question
Is the following deduction logically correct?
All men are mortalSocrates is mortalTherefore, all man are Socrates
What about
All professors are grey at nightI am grey at nightTherefore I am a professor
Notes:
No propositional logic connectives. Atomic propositions.
To study this type of deductions we need to extend thelanguage of propositional logic.
Daniele Micciancio CSE 20: Discrete Mathematics
Next question
Is the following deduction logically correct?
All men are mortalSocrates is mortalTherefore, all man are Socrates
What about
All professors are grey at nightI am grey at nightTherefore I am a professor
Notes:
No propositional logic connectives. Atomic propositions.
To study this type of deductions we need to extend thelanguage of propositional logic.
Daniele Micciancio CSE 20: Discrete Mathematics
Predicates
A predicate is a logical statement involving variables:
P(x) = “x < 100”Q(x,y,z) = “x + y = z”R(x,y) = “There are x students enrolled in class y”
Replacing the variable with concrete value yields propositions, whichmay be true or false:
P(33) = “33<100”Q(1,2,4) = “1 + 2 = 4”R(120,CSE12) = “There are 120 students enrolled in CSE12”
Predicates may be called “unary”, “binary”, n-ary, etc. dependingon how many variables they have.
Daniele Micciancio CSE 20: Discrete Mathematics
Predicates
A predicate is a logical statement involving variables:
P(x) = “x < 100”Q(x,y,z) = “x + y = z”R(x,y) = “There are x students enrolled in class y”
Replacing the variable with concrete value yields propositions, whichmay be true or false:
P(33) = “33<100”Q(1,2,4) = “1 + 2 = 4”R(120,CSE12) = “There are 120 students enrolled in CSE12”
Predicates may be called “unary”, “binary”, n-ary, etc. dependingon how many variables they have.
Daniele Micciancio CSE 20: Discrete Mathematics
Evaluating Predicates
Course Enrollment
CSE10 122CSE20 78CSE71 47
Q(x , y) = “There are at least x students enrolled in class y”R(y , z) = “Class y has smaller enrollment than class zP(x , y , z) = Q(x , y) ∧ R(z , y)
What is the truth value of
Q(90, CSE20)
(A) True; (B) False; (C) Undefined (Not a proposition)
B: There are less than 90 students in CSE20
Daniele Micciancio CSE 20: Discrete Mathematics
Evaluating Predicates
Course Enrollment
CSE10 122CSE20 78CSE71 47
Q(x , y) = “There are at least x students enrolled in class y”R(y , z) = “Class y has smaller enrollment than class zP(x , y , z) = Q(x , y) ∧ R(z , y)
What is the truth value of
Q(90, CSE20)
(A) True; (B) False; (C) Undefined (Not a proposition)
B: There are less than 90 students in CSE20
Daniele Micciancio CSE 20: Discrete Mathematics
Evaluating Predicates
Course Enrollment
CSE10 122CSE20 78CSE71 47
Q(x , y) = “There are at least x students enrolled in class y”R(y , z) = “Class y has smaller enrollment than class zP(x , y , z) = Q(x , y) ∧ R(z , y)
What is the truth value of
Q(90, CSE20)
(A) True; (B) False; (C) Undefined (Not a proposition)
B: There are less than 90 students in CSE20
Daniele Micciancio CSE 20: Discrete Mathematics
Evaluating Predicates
Course Enrollment
CSE10 122CSE20 78CSE71 47
Q(x , y) = “There are at least x students enrolled in class y”R(y , z) = “Class y has smaller enrollment than class zP(x , y , z) = Q(x , y) ∧ R(z , y)
What is the truth value of
P(90, CSE20, CSE71)
(A) True; (B) False; (C) Undefined (Not a proposition)
Daniele Micciancio CSE 20: Discrete Mathematics
Evaluating Predicates
Course Enrollment
CSE10 122CSE20 78CSE71 47
Q(x , y) = “There are at least x students enrolled in class y”R(y , z) = “Class y has smaller enrollment than class zP(x , y , z) = Q(x , y) ∧ R(y , z)
For what values of x , y , z , is the following predicate true?
P(x , y , z)→ Q(x , z)
(A) Always true; (B) Never true; (C) Depends on x , y , z
A: class z is larger than class y, and class y has at least x students
Daniele Micciancio CSE 20: Discrete Mathematics
Evaluating Predicates
Course Enrollment
CSE10 122CSE20 78CSE71 47
Q(x , y) = “There are at least x students enrolled in class y”R(y , z) = “Class y has smaller enrollment than class zP(x , y , z) = Q(x , y) ∧ R(y , z)
For what values of x , y , z , is the following predicate true?
P(x , y , z)→ Q(x , z)
(A) Always true; (B) Never true; (C) Depends on x , y , z
A: class z is larger than class y, and class y has at least x students
Daniele Micciancio CSE 20: Discrete Mathematics
Universal quantifier (for all)
P(x) = (x > 5)→ (x2 > 25)Q(x) = (x < 5)→ (x2 < 25)
∀x , P(x) = “For all (integers) x , P(x) is true.”
∀x , Q(x) = “For all (integers) x , Q(x) is true.”
Think of ∀ as an upside-down “A” (for “All”)May also be written ∀x .P(x), or ∀xP(x)∀x .P(x) and ∀x .Q(x) are logical statements (either true orfalse)∀x .P(x) is equivalent to ∀y .P(y). (The variable name doesnot matter.)
Are ∀x .P(x) and ∀x .Q(x) true or false?
(A) T T ; (B) T F ; (C) F T ; (D) F F
B: True and False
Daniele Micciancio CSE 20: Discrete Mathematics
Universal quantifier (for all)
P(x) = (x > 5)→ (x2 > 25)Q(x) = (x < 5)→ (x2 < 25)
∀x , P(x) = “For all (integers) x , P(x) is true.”
∀x , Q(x) = “For all (integers) x , Q(x) is true.”
Think of ∀ as an upside-down “A” (for “All”)May also be written ∀x .P(x), or ∀xP(x)∀x .P(x) and ∀x .Q(x) are logical statements (either true orfalse)∀x .P(x) is equivalent to ∀y .P(y). (The variable name doesnot matter.)
Are ∀x .P(x) and ∀x .Q(x) true or false?
(A) T T ; (B) T F ; (C) F T ; (D) F F
B: True and False
Daniele Micciancio CSE 20: Discrete Mathematics
Universal quantifier (for all)
P(x) = (x > 5)→ (x2 > 25)Q(x) = (x < 5)→ (x2 < 25)
∀x , P(x) = “For all (integers) x , P(x) is true.”
∀x , Q(x) = “For all (integers) x , Q(x) is true.”
Think of ∀ as an upside-down “A” (for “All”)May also be written ∀x .P(x), or ∀xP(x)∀x .P(x) and ∀x .Q(x) are logical statements (either true orfalse)∀x .P(x) is equivalent to ∀y .P(y). (The variable name doesnot matter.)
Are ∀x .P(x) and ∀x .Q(x) true or false?
(A) T T ; (B) T F ; (C) F T ; (D) F F
B: True and False
Daniele Micciancio CSE 20: Discrete Mathematics
Existential quantifier (there exists)
P(x) = (x > 5)→ (x2 > 25)Q(x) = (x < 5)→ (x2 < 25)
∃x , P(x) = “For some (integers) x , P(x) is true.”
∃x , Q(x) = “For some (integers) x , Q(x) is true.”
Think of ∃ as an “E” (for “Exists”) written backwardMay also be written ∃x .P(x), or ∃xP(x)∃x .P(x) and ∃x .Q(x) are logical statements (either true orfalse)∃x .P(x) is equivalent to ∃y .P(y). (The variable name doesnot matter.)
Are ∃x .P(x) and ∃x .Q(x) true or false?
(A) T T ; (B) T F ; (C) F T ; (D) F F
A: True and True
Daniele Micciancio CSE 20: Discrete Mathematics
Existential quantifier (there exists)
P(x) = (x > 5)→ (x2 > 25)Q(x) = (x < 5)→ (x2 < 25)
∃x , P(x) = “For some (integers) x , P(x) is true.”
∃x , Q(x) = “For some (integers) x , Q(x) is true.”
Think of ∃ as an “E” (for “Exists”) written backwardMay also be written ∃x .P(x), or ∃xP(x)∃x .P(x) and ∃x .Q(x) are logical statements (either true orfalse)∃x .P(x) is equivalent to ∃y .P(y). (The variable name doesnot matter.)
Are ∃x .P(x) and ∃x .Q(x) true or false?
(A) T T ; (B) T F ; (C) F T ; (D) F F
A: True and True
Daniele Micciancio CSE 20: Discrete Mathematics
Existential quantifier (there exists)
P(x) = (x > 5)→ (x2 > 25)Q(x) = (x < 5)→ (x2 < 25)
∃x , P(x) = “For some (integers) x , P(x) is true.”
∃x , Q(x) = “For some (integers) x , Q(x) is true.”
Think of ∃ as an “E” (for “Exists”) written backwardMay also be written ∃x .P(x), or ∃xP(x)∃x .P(x) and ∃x .Q(x) are logical statements (either true orfalse)∃x .P(x) is equivalent to ∃y .P(y). (The variable name doesnot matter.)
Are ∃x .P(x) and ∃x .Q(x) true or false?
(A) T T ; (B) T F ; (C) F T ; (D) F F
A: True and True
Daniele Micciancio CSE 20: Discrete Mathematics
Tautologies in Predicate calculus
(∀x .(Q(x) ∧ P(x)))→ (∀y .Q(y))(∃x .(P(x)→ Q(x))) ∧ (∀x .P(x))→ ∃x .Q(x)(∃x .(P(x) ∨ Q(x)))↔ (∃x .P(x)) ∨ (∃x .Q(x))
For what direction the following implication holds?
(∀x .(P(x) ∨ Q(x))) [↔???] (∀x .P(x)) ∨ (∀x .Q(x))
(A) ↔ (B) Only →; (C) Only ← ; (D) Neither direction
Answer: C
Why? Let x be an integer values variable, and let
P(x)=“x is an even integer”Q(x)=“x is an odd integer”
How would you read the quantified statements in English?
Daniele Micciancio CSE 20: Discrete Mathematics
Tautologies in Predicate calculus
(∀x .(Q(x) ∧ P(x)))→ (∀y .Q(y))(∃x .(P(x)→ Q(x))) ∧ (∀x .P(x))→ ∃x .Q(x)(∃x .(P(x) ∨ Q(x)))↔ (∃x .P(x)) ∨ (∃x .Q(x))
For what direction the following implication holds?
(∀x .(P(x) ∨ Q(x))) [↔???] (∀x .P(x)) ∨ (∀x .Q(x))
(A) ↔ (B) Only →; (C) Only ← ; (D) Neither direction
Answer: C
Why? Let x be an integer values variable, and let
P(x)=“x is an even integer”Q(x)=“x is an odd integer”
How would you read the quantified statements in English?
Daniele Micciancio CSE 20: Discrete Mathematics
Tautologies in Predicate calculus
(∀x .(Q(x) ∧ P(x)))→ (∀y .Q(y))(∃x .(P(x)→ Q(x))) ∧ (∀x .P(x))→ ∃x .Q(x)(∃x .(P(x) ∨ Q(x)))↔ (∃x .P(x)) ∨ (∃x .Q(x))
For what direction the following implication holds?
(∀x .(P(x) ∨ Q(x))) [↔???] (∀x .P(x)) ∨ (∀x .Q(x))
(A) ↔ (B) Only →; (C) Only ← ; (D) Neither direction
Answer: C
Why? Let x be an integer values variable, and let
P(x)=“x is an even integer”Q(x)=“x is an odd integer”
How would you read the quantified statements in English?
Daniele Micciancio CSE 20: Discrete Mathematics
Quantifying over Finite Domains
Assume variable x ranges over a finite set {1, 2, 3}.
∀x .P(x) ⇐⇒ P(1) ∧ P(2) ∧ P(3)
∃x .P(x) ⇐⇒ P(1) ∨ P(2) ∨ P(3)
Most logic rules about ∀ and ∃ can be understood in terms of ∧and ∨.
De Morgan:
¬(∀x .P(x))
⇐⇒ ¬(P(1) ∧ P(2) ∧ P(3))
⇐⇒ (¬P(1) ∨ ¬P(2) ∨ ¬P(3))
⇐⇒ ∃x .¬P(x)
Daniele Micciancio CSE 20: Discrete Mathematics
Negating quantifiers
¬∀x .P(x) ≡ ∃x .¬P(x)
It is not true that P(x) holds for every xThere is some x for which P(x) is not true
¬∃x .P(x) ≡ ∀x .¬P(x)
It is not true that P(x) holds for some xP(x) is false for every x .
Daniele Micciancio CSE 20: Discrete Mathematics
Proving and disproving quantified statements
∀x .P(x)
Prove: Need to show P(x) for an arbitrary xDisprove: Enough to show that ¬P(x) for some specific x ofour choice
∃x .P(x)
Prove: Enough to show P(x) is true for some specific x of ourchoiceDisprove: Need to show that P(x) is false for an arbitrary x
Daniele Micciancio CSE 20: Discrete Mathematics
Nested quantifiers
Let’s talk about integer numbers. (Variables x , y , z range over Z).
“For every integer x , there is always some bigger integer y .
∀x .∃y .y > x
Note:
Q(x , y) = (y > x) is a binary predicateP(x) = ∃y .Q(x , y) is a unary predicate∀x .P(x) ≡ ∀x .∃y .Q(x , y) is a proposition
Is the statement ∀x .∃y .Q(x , y) true or false?
(A) True; (B) False; (C) It depends on the value of x
Daniele Micciancio CSE 20: Discrete Mathematics
Nested quantifiers
Let’s talk about integer numbers. (Variables x , y , z range over Z).
“For every integer x , there is always some bigger integer y .
∀x .∃y .y > x
Note:
Q(x , y) = (y > x) is a binary predicateP(x) = ∃y .Q(x , y) is a unary predicate∀x .P(x) ≡ ∀x .∃y .Q(x , y) is a proposition
Is the statement ∀x .∃y .Q(x , y) true or false?
(A) True; (B) False; (C) It depends on the value of x
Daniele Micciancio CSE 20: Discrete Mathematics
Nested quantifiers
Let’s talk about integer numbers. (Variables x , y , z range over Z).
“For every integer x , there is always some bigger integer y .
∀x .∃y .y > x
Note:
Q(x , y) = (y > x) is a binary predicateP(x) = ∃y .Q(x , y) is a unary predicate∀x .P(x) ≡ ∀x .∃y .Q(x , y) is a proposition
Is the statement ∀x .∃y .Q(x , y) true or false?
(A) True; (B) False; (C) It depends on the value of x
Daniele Micciancio CSE 20: Discrete Mathematics
Order of quantification
Let’s talk about integer numbers. (Variables x , y , z range over Z).
“For every integer x , there is always some bigger integer y .
∀x .∃y .y > x .
What happen if we swap the order of quantifiers?
∃y .∀x .y > x .
Are the two logical statements equivalent?Is the new statement true or false?How would you read the last statement in English?
“There is an integer y which is bigger than any (other) integer x .
Daniele Micciancio CSE 20: Discrete Mathematics
Order of quantification
Let’s talk about integer numbers. (Variables x , y , z range over Z).
“For every integer x , there is always some bigger integer y .
∀x .∃y .y > x .
What happen if we swap the order of quantifiers?
∃y .∀x .y > x .
Are the two logical statements equivalent?Is the new statement true or false?How would you read the last statement in English?
“There is an integer y which is bigger than any (other) integer x .
Daniele Micciancio CSE 20: Discrete Mathematics
Scope and Precedence
Textbook: ∀,∃ have the highest “precedence”:
∃x .(∀x .P(x) ∧ Q(x))
⇐⇒ ∃x .((∀x .P(x)) ∧ Q(x))
⇐⇒ (∀x .P(x)) ∧ (∃x .Q(x))
This is unusual. Most texts let ∀x and ∃x extend their scope as faras possible, unless limited with parentheses.
∃x .(∀x .P(x) ∧ Q(x))
⇐⇒ ∃x .(∀x .(P(x) ∧ Q(x)))
⇐⇒ (∀x .(P(x) ∧ Q(x)))
Daniele Micciancio CSE 20: Discrete Mathematics