Predicate Logic Quantifiers ∀, ∃ ∀ x

advertisement
Predicates
Mathematics for Computer Science
MIT 6.042J/18.062J
Predicates are
Propositions with variables
Predicate Logic
Quantifiers ∀, ∃
Copyright © Albert R. Meyer, 2005.
Example:
P(x,y)
Copyright © Albert R. Meyer, 2005.
Predicates
x+2=y
September 14, 2005
lec 2W.2
Quantifiers
P ( x, y ) ::= [ x + 2 = y ]
x = 1 and y = 3: P(1,3) is true
x = 1 and y = 4: P(1,4) is false
¬P(1,4) is true
Copyright © Albert R. Meyer, 2005.
N
“is defined to be”
lec 2W.1
September 14, 2005
::=
lec 2W.3
September 14, 2005
∀x
For ALL x
∃y
There EXISTS some y
Copyright © Albert R. Meyer, 2005.
September 14, 2005
lec 2W.4
\+
]
Team Problems
Quantifiers
x, y range over Domain
of Discourse
Problems
1&2
∀x ∃y x < y
Domain
integers Z
positive integers Z+
negative integers Znegative reals RCopyright © Albert R. Meyer, 2005.
September 14, 2005
Truth value
True
True
False
True
lec 2W.5
Copyright © Albert R. Meyer, 2005.
September 14, 2005
lec 2W.6
1
Math vs. English
Poet:
Math vs. English
Poet:
G
“All that glitters is not gold.”
G necessarily
“All that glitters is not gold.”
N
Au
∧N
Au
(Poetic license)
No!: gold glitters like gold
Copyright © Albert R. Meyer, 2005.
September 14, 2005
lec 2W.7
Copyright © Albert R. Meyer, 2005.
Math vs. English
Poet: “There is season for every
purpose under heaven”
No!
September 14, 2005
(Poetic license again.)
lec 2W.9
Propositional Validity
Copyright © Albert R. Meyer, 2005.
lec 2W.10
∀z [Q(z) ∧ P(z)]
→ [∀xQ(x) ∧ ∀yP(y)]
True no matter what the
truth values of A and B are
September 14, 2005
September 14, 2005
Predicate Calculus Validity
( A → B ) ∨ ( B → A)
Copyright © Albert R. Meyer, 2005.
lec 2W.8
Math vs. English
Poet: “There is season for every
purpose under heaven”
Copyright © Albert R. Meyer, 2005.
September 14, 2005
True no matter what
• the Domain is,
• the predicates are.
lec 2W.11
Copyright © Albert R. Meyer, 2005.
September 14, 2005
lec 2W.12
2
Not Valid
Validities
∀z [Q(z)∨P(z)] → [∀xQ(x) ∨ ∀yP(y)]
∀z [Q(z)∧P(z)] → [∀xQ(x) ∧ ∀yP(y)]
Proof: Give countermodel, where
∀z [Q(z) ∨ P(z)] is true,
but ∀xQ(x) ∨ ∀yP(y) is false.
Namely, let domain ::= {e, π},
Q(z) ::= [z = e],
P(z) ::= [z = π].
Copyright © Albert R. Meyer, 2005.
September 14, 2005
Proof strategy: We assume
∀z [Q(z) ∧ P(z)]
to prove
∀xQ(x) ∧∀yP(y).
lec 2W.13
Copyright © Albert R. Meyer, 2005.
September 14, 2005
lec 2W.14
Predicate Inference Rule
Validities
Q → P (c )
Q → ∀x.P( x)
∀z [Q(z)∧P(z)] → [∀xQ(x) ∧ ∀yP(y)]
(providing c does not occur in Q)
Universal Generalization (UG)
Copyright © Albert R. Meyer, 2005.
September 14, 2005
lec 2W.15
Proof: Assume ∀z [Q(z)∧P(z)].
So Q(z)∧P(z) holds for all z in the domain.
Now let c be some domain element. So
Q(c)∧P(c) holds, and therefore Q(c) by itself holds.
But c could have been any element of the domain.
So we conclude ∀xQ(x).
(by UG)
We conclude ∀yP(y) similarly. Therefore,
∀xQ(x) ∧ ∀yP(y)
QED.
Copyright © Albert R. Meyer, 2005.
∀x [P(x)∨A] ↔ [∀x P(x)] ∨ A
[¬∀x P(x)] ↔ [∃x ¬ P(x)]
September 14, 2005
lec 2W.16
Team Problems
More Validities
Copyright © Albert R. Meyer, 2005.
September 14, 2005
lec 2W.17
Problems
3&4
Copyright © Albert R. Meyer, 2005.
September 14, 2005
lec 2W.18
3
Download