Upload
others
View
13
Download
0
Embed Size (px)
Citation preview
Natural deduction for first order logicCOMP2600 / COMP6260
Dirk PattinsonAustralian National University
Semester 2, 2016
Recap: propositional natural deduction
[p]...q
p→q
p p→q
q
[p]...q ∧ ¬q
¬p
[¬p]...q ∧ ¬q
p
p q
p ∧ q
p ∧ q
p
p ∧ q
q
p
p ∨ q
p
q ∨ p
[p] [q]... ...p ∨ q r r
r
1 / 33
First-order logic
First-order logic is an extension of propositional logic.First-order logic is useful when quantifying over the elements of somedomain.More details in Lecture 1
Example:
Natural language First order logicAll COMP2600 students are happy. ∀x . student(x)→happy(x)Lisa is a COMP2600 student. student(Lisa)Lisa is happy. happy(Lisa)
2 / 33
Finding proofs in first-order logic
Truth tables are virtually useless hereThe exception is where domains are smallNatural deduction helpsThere are introduction and elimination rules for quantifiersThere are some handy equational rules which help
Example proof of why COMP2600 student Lisa is happy:
1 ∀x . student(x)→happy(x)
2 student(Lisa)
3 student(Lisa)→happy(Lisa) ∀-E, 1
4 happy(Lisa) →-E, 2, 3
3 / 33
Quantifiers
Over finite domains
D = {x1,x2, . . . ,xn}(∀x ∈ D. P(x))≡ P(x1)∧P(x2)∧ . . .∧P(xn)
D = {x1,x2, . . . ,xn}(∃x ∈ D. P(x))≡ P(x1)∨P(x2)∨ . . .∨P(xn)
4 / 33
An example of domain finiteness
“There is an integer between 4 and 7 that is divisibleby all integers between 1 and 3.”
∃n ∈ {4,5,6,7}. ∀m ∈ {1,2,3}. n mod m = 0
((4 mod 1 = 0)∧ (4 mod 2 = 0)∧ (4 mod 3 = 0)) ∨((5 mod 1 = 0)∧ (5 mod 2 = 0)∧ (5 mod 3 = 0)) ∨((6 mod 1 = 0)∧ (6 mod 2 = 0)∧ (6 mod 3 = 0)) ∨((7 mod 1 = 0)∧ (7 mod 2 = 0)∧ (7 mod 3 = 0))
5 / 33
Negating “there exists”
¬ (∃x . P(x)) ↔ (∀x . ¬P(x))
Examples:I “No students dislike COMP2600”.I ¬∃s ∈ Student. s dislikes COMP2600I ∀s ∈ Student. ¬s dislikes COMP2600I “All students like COMP2600”.
Think about finite domains and compare to De Morgan’s laws!¬(p∨q)↔ (¬p∧¬q) ; ¬(p1∨ . . .∨pn)↔ (¬p1∧ . . .∧¬pn)
6 / 33
Negating “for all”
¬ (∀x . P(x)) ↔ (∃x . ¬P(x))
Examples:I “Not all students passed the exam”.I ¬∀s ∈ Student. s passed the examI ∃s ∈ Student. ¬s passed the examI “There are some students who did not pass the exam”.
Compare to De Morgan’s laws!¬(p∧q)↔ (¬p∨¬q) ; ¬(p1∧ . . .∧pn)↔ (¬p1∨ . . .∨¬pn)
7 / 33
Mixed negated quantifiers
Here are four different expressions of the fact that there is no upper bound tothe natural numbers.We can shift from one to the other by negating the quantifiers.
¬∃m. ∀n. m ≥ n
∀m. ¬∀n. m ≥ n
∀m. ∃n. ¬m ≥ n
∀m. ∃n. m < n
8 / 33
Existential quantifiers with empty domains
Consider the existential formula:
∃x ∈ /0. P(x)
The definition of the existential quantifier says that this should be false,regardless of P, since there are no elements that could exist.
As a result, the following is true:
(∃x ∈ /0. P(x)) ≡ F
9 / 33
Universal quantifiers with empty domains
Consider the universally quantified formula:
∀x ∈ /0. P(x)
What does “for all x in the empty set” mean?
Use the negation rule
(∀x ∈ /0. P(x)) ≡ ¬ (∃x ∈ /0. ¬P(x))
We have(∀x ∈ /0. P(x)) ≡ T
10 / 33
Universal quantifiers with empty domains
“All unicorns climb trees”.Since the set of unicorns is empty, the statement is true.The statement can never be disproved by finding a counterexample.
11 / 33
Natural deduction in first-order logic
∀-E universal instantiation;∀-I universal generalisation;∃-E existential instantiation;∃-I existential generalisation;
Proof in first-order logic is usually based on these rules, together with the rulesfor propositional logic.
12 / 33
Instantiation
∀-E (universal instantiation)∀x . P(x)
P(a)
n ∀x . Fish(x)→HasFins(x)
... ...
m Fish(a)→HasFins(a) ∀-E, nIf a predicate is true for all members of a domain, then it is also true for aspecific one (a must be a member of the domain).
13 / 33
Instantiation
∀-E (universal instantiation)∀x . P(x)
P(a)
n ∀x . Fish(x)→HasFins(x)
... ...
m Fish(a)→HasFins(a) ∀-E, nIf a predicate is true for all members of a domain, then it is also true for aspecific one (a must be a member of the domain).
13 / 33
Generalisation
∀-I (universal generalisation)P(a) (a arbitrary, a variable)
∀x . P(x)
n a ...
... ...
m Cat(a)→EatsFish(a)
m+1 ∀x . Cat(x)→EatsFish(x)
The a on the left of the bar is a guard which reminds us that:I this variable is local to the inner derivation, andI it cannot be free in an assumption
It is like an “assumption” that a is an arbitrary member of the domain.That is, the proof from lines n to m must work for anything in place of a.
14 / 33
Generalisation
∀-I (universal generalisation)P(a) (a arbitrary, a variable)
∀x . P(x)
n a ...
... ...
m Cat(a)→EatsFish(a)
m+1 ∀x . Cat(x)→EatsFish(x)
The a on the left of the bar is a guard which reminds us that:I this variable is local to the inner derivation, andI it cannot be free in an assumption
It is like an “assumption” that a is an arbitrary member of the domain.That is, the proof from lines n to m must work for anything in place of a.
14 / 33
Generalisation
∀-I (universal generalisation)P(a) (a arbitrary, a variable)
∀x . P(x)
n a ...
... ...
m Cat(a)→EatsFish(a)
m+1 ∀x . Cat(x)→EatsFish(x)
The a on the left of the bar is a guard which reminds us that:I this variable is local to the inner derivation, andI it cannot be free in an assumption
It is like an “assumption” that a is an arbitrary member of the domain.That is, the proof from lines n to m must work for anything in place of a.
14 / 33
Breaching the arbitrariness requirement
When we generalise for a variable a, the same proof steps must be possible forall members of the domain.
1 (Cat(kitty)→HasFur(kitty)) ∧ Cat(kitty)
2 Cat(kitty)→HasFur(kitty) ∧-E, 1
3 Cat(kitty) ∧-E, 1
4 HasFur(kitty) →-E, 2, 3
5 ∀x . HasFur(x) WRONG ∀-I, 4
WRONG because kitty appears in an assumption (step 1) (and step 4 is still inthe scope of that assumption)
15 / 33
Breaching the arbitrariness requirement
When we generalise for a variable a, the same proof steps must be possible forall members of the domain.
1 (Cat(kitty)→HasFur(kitty)) ∧ Cat(kitty)
2 Cat(kitty)→HasFur(kitty) ∧-E, 1
3 Cat(kitty) ∧-E, 1
4 HasFur(kitty) →-E, 2, 3
5 ∀x . HasFur(x) WRONG ∀-I, 4
WRONG because kitty appears in an assumption (step 1) (and step 4 is still inthe scope of that assumption)
15 / 33
Breaching the arbitrariness requirement
When we generalise for a variable a, the same proof steps must be possible forall members of the domain.
1 (Cat(kitty)→HasFur(kitty)) ∧ Cat(kitty)
2 Cat(kitty)→HasFur(kitty) ∧-E, 1
3 Cat(kitty) ∧-E, 1
4 HasFur(kitty) →-E, 2, 3
5 ∀x . HasFur(x) WRONG ∀-I, 4
WRONG because kitty appears in an assumption (step 1) (and step 4 is still inthe scope of that assumption)
15 / 33
Breaching the arbitrariness requirement
When we generalise for a variable a, the same proof steps must be possible forall members of the domain.
1 (Cat(kitty)→HasFur(kitty)) ∧ Cat(kitty)
2 Cat(kitty)→HasFur(kitty) ∧-E, 1
3 Cat(kitty) ∧-E, 1
4 HasFur(kitty) →-E, 2, 3
5 ∀x . HasFur(x) WRONG ∀-I, 4
WRONG because kitty appears in an assumption (step 1) (and step 4 is still inthe scope of that assumption)
15 / 33
Breaching the arbitrariness requirement
When we generalise for a variable a, the same proof steps must be possible forall members of the domain.
1 (Cat(kitty)→HasFur(kitty)) ∧ Cat(kitty)
2 Cat(kitty)→HasFur(kitty) ∧-E, 1
3 Cat(kitty) ∧-E, 1
4 HasFur(kitty) →-E, 2, 3
5 ∀x . HasFur(x) WRONG ∀-I, 4
WRONG because kitty appears in an assumption (step 1) (and step 4 is still inthe scope of that assumption)
15 / 33
Breaching the arbitrariness requirement
When we generalise for a variable a, the same proof steps must be possible forall members of the domain.
1 (Cat(kitty)→HasFur(kitty)) ∧ Cat(kitty)
2 Cat(kitty)→HasFur(kitty) ∧-E, 1
3 Cat(kitty) ∧-E, 1
4 HasFur(kitty) →-E, 2, 3
5 ∀x . HasFur(x) WRONG ∀-I, 4
WRONG because kitty appears in an assumption (step 1) (and step 4 is still inthe scope of that assumption)
15 / 33
Free and bound variables
Bound: Every occurrence of variable x in ∀x . p(x) and in ∃x . p(x) is bound.Free: Every occurrence of a variable that is not bound is free.Example:
(∀x . x + y = y + x) ∧ (∀x . ∃y . y > x + z)
Q: Which occurrences of variables are free and which are bound?
A: All occurrences of x are bound; none of z are; and just the last 2occurrences of y are bound.Hence the instance of z is free, as are the first two occurrences of y .
16 / 33
Free and bound variables
Bound: Every occurrence of variable x in ∀x . p(x) and in ∃x . p(x) is bound.Free: Every occurrence of a variable that is not bound is free.Example:
(∀x . x + y = y + x) ∧ (∀x . ∃y . y > x + z)
Q: Which occurrences of variables are free and which are bound?A: All occurrences of x are bound; none of z are; and just the last 2
occurrences of y are bound.Hence the instance of z is free, as are the first two occurrences of y .
16 / 33
Example
(∀x . ∀y . P(x ,y)) ↔ (∀y . ∀x . P(x ,y))
1 ∀x . ∀y . P(x ,y)
2 b a ∀y . P(a,y) ∀-E, 1
3 P(a,b) ∀-E, 2
4 ∀x . P(x ,b) ∀-I, 3
5 ∀y . ∀x . P(x ,y) ∀-I, 4Exercise: also show the reverse to get equivalence,↔
17 / 33
Example
(∀x . ∀y . P(x ,y)) ↔ (∀y . ∀x . P(x ,y))
1 ∀x . ∀y . P(x ,y)
2 b a ∀y . P(a,y) ∀-E, 1
3 P(a,b) ∀-E, 2
4 ∀x . P(x ,b) ∀-I, 3
5 ∀y . ∀x . P(x ,y) ∀-I, 4Exercise: also show the reverse to get equivalence,↔
17 / 33
Example
(∀x . ∀y . P(x ,y)) ↔ (∀y . ∀x . P(x ,y))
1 ∀x . ∀y . P(x ,y)
2 b a ∀y . P(a,y) ∀-E, 1
3 P(a,b) ∀-E, 2
4 ∀x . P(x ,b) ∀-I, 3
5 ∀y . ∀x . P(x ,y) ∀-I, 4Exercise: also show the reverse to get equivalence,↔
17 / 33
Example
(∀x . ∀y . P(x ,y)) ↔ (∀y . ∀x . P(x ,y))
1 ∀x . ∀y . P(x ,y)
2 b a ∀y . P(a,y) ∀-E, 1
3 P(a,b) ∀-E, 2
4 ∀x . P(x ,b) ∀-I, 3
5 ∀y . ∀x . P(x ,y) ∀-I, 4Exercise: also show the reverse to get equivalence,↔
17 / 33
Example
(∀x . ∀y . P(x ,y)) ↔ (∀y . ∀x . P(x ,y))
1 ∀x . ∀y . P(x ,y)
2 b a ∀y . P(a,y) ∀-E, 1
3 P(a,b) ∀-E, 2
4 ∀x . P(x ,b) ∀-I, 3
5 ∀y . ∀x . P(x ,y) ∀-I, 4Exercise: also show the reverse to get equivalence,↔
17 / 33
Example
(∀x . ∀y . P(x ,y)) ↔ (∀y . ∀x . P(x ,y))
1 ∀x . ∀y . P(x ,y)
2 b a ∀y . P(a,y) ∀-E, 1
3 P(a,b) ∀-E, 2
4 ∀x . P(x ,b) ∀-I, 3
5 ∀y . ∀x . P(x ,y) ∀-I, 4Exercise: also show the reverse to get equivalence,↔
17 / 33
Example
(∀x . ∀y . P(x ,y)) ↔ (∀y . ∀x . P(x ,y))
1 ∀x . ∀y . P(x ,y)
2 b a ∀y . P(a,y) ∀-E, 1
3 P(a,b) ∀-E, 2
4 ∀x . P(x ,b) ∀-I, 3
5 ∀y . ∀x . P(x ,y) ∀-I, 4Exercise: also show the reverse to get equivalence,↔
17 / 33
Generalisation
∃-I (existential generalisation)
P(a)
∃x . P(x)
n Dog(fido)
... ...
m ∃x . Dog(x) ∃-I, n
18 / 33
Generalisation
∃-I (existential generalisation)
P(a)
∃x . P(x)
n Dog(fido)
... ...
m ∃x . Dog(x) ∃-I, n
18 / 33
An invalid argument
This argument is invalid if the domain is empty.
1 ∀x . P(x)
2 P(a) ∀-E, 1
3 ∃x . P(x) ∃-I, 2Which step is invalid ??
19 / 33
Instantiation
∃x . P(x)
[P(a)]...q (a arbitrary, a variable)
q (a not free in q)
Rationale: if P(x) holds for some individual x ,let that individual be called a (so P(a) holds)prove that q followsas q doesn’t involve our choice of a,q holds regardless of which individual has P true
The proof of q from P(a) must work for any individual in place of a
20 / 33
Example
Prove∃x . Elephant(x) ∀x . Elephant(x)→Huge(x)
∃x . Huge(x)
1 ∃x . Elephant(x)
2 ∀x . Elephant(x)→Huge(x)
3 a Elephant(a)
4 Elephant(a)→Huge(a) ∀-E, 2
5 Huge(a) →-E, 3, 4
6 ∃x . Huge(x) ∃-I, 5
7 ∃x . Huge(x) ∃-E, 1, 3–6
The notation reflects an assumption: since there is some individual x such thatElephant(x), assume that individual is a
21 / 33
Example
Prove∃x . Elephant(x) ∀x . Elephant(x)→Huge(x)
∃x . Huge(x)
1 ∃x . Elephant(x)
2 ∀x . Elephant(x)→Huge(x)
3 a Elephant(a)
4 Elephant(a)→Huge(a) ∀-E, 2
5 Huge(a) →-E, 3, 4
6 ∃x . Huge(x) ∃-I, 5
7 ∃x . Huge(x) ∃-E, 1, 3–6
The notation reflects an assumption: since there is some individual x such thatElephant(x), assume that individual is a
21 / 33
Example
Prove∃x . Elephant(x) ∀x . Elephant(x)→Huge(x)
∃x . Huge(x)1 ∃x . Elephant(x)
2 ∀x . Elephant(x)→Huge(x)
3 a Elephant(a)
4 Elephant(a)→Huge(a) ∀-E, 2
5 Huge(a) →-E, 3, 4
6 ∃x . Huge(x) ∃-I, 5
7 ∃x . Huge(x) ∃-E, 1, 3–6
The notation reflects an assumption: since there is some individual x such thatElephant(x), assume that individual is a
21 / 33
Example
Prove∃x . Elephant(x) ∀x . Elephant(x)→Huge(x)
∃x . Huge(x)1 ∃x . Elephant(x)
2 ∀x . Elephant(x)→Huge(x)
3 a Elephant(a)
4 Elephant(a)→Huge(a) ∀-E, 2
5 Huge(a) →-E, 3, 4
6 ∃x . Huge(x) ∃-I, 5
7 ∃x . Huge(x) ∃-E, 1, 3–6
The notation reflects an assumption: since there is some individual x such thatElephant(x), assume that individual is a
21 / 33
Example
Prove∃x . Elephant(x) ∀x . Elephant(x)→Huge(x)
∃x . Huge(x)1 ∃x . Elephant(x)
2 ∀x . Elephant(x)→Huge(x)
3 a Elephant(a)
4 Elephant(a)→Huge(a) ∀-E, 2
5 Huge(a) →-E, 3, 4
6 ∃x . Huge(x) ∃-I, 5
7 ∃x . Huge(x) ∃-E, 1, 3–6
The notation reflects an assumption: since there is some individual x such thatElephant(x), assume that individual is a
21 / 33
Example
Prove∃x . Elephant(x) ∀x . Elephant(x)→Huge(x)
∃x . Huge(x)1 ∃x . Elephant(x)
2 ∀x . Elephant(x)→Huge(x)
3 a Elephant(a)
4 Elephant(a)→Huge(a) ∀-E, 2
5 Huge(a) →-E, 3, 4
6 ∃x . Huge(x) ∃-I, 5
7 ∃x . Huge(x) ∃-E, 1, 3–6
The notation reflects an assumption: since there is some individual x such thatElephant(x), assume that individual is a
21 / 33
Example
Prove∃x . Elephant(x) ∀x . Elephant(x)→Huge(x)
∃x . Huge(x)1 ∃x . Elephant(x)
2 ∀x . Elephant(x)→Huge(x)
3 a Elephant(a)
4 Elephant(a)→Huge(a) ∀-E, 2
5 Huge(a) →-E, 3, 4
6 ∃x . Huge(x) ∃-I, 5
7 ∃x . Huge(x) ∃-E, 1, 3–6
The notation reflects an assumption: since there is some individual x such thatElephant(x), assume that individual is a
21 / 33
Example
Prove∃x . Elephant(x) ∀x . Elephant(x)→Huge(x)
∃x . Huge(x)1 ∃x . Elephant(x)
2 ∀x . Elephant(x)→Huge(x)
3 a Elephant(a)
4 Elephant(a)→Huge(a) ∀-E, 2
5 Huge(a) →-E, 3, 4
6 ∃x . Huge(x) ∃-I, 5
7 ∃x . Huge(x) ∃-E, 1, 3–6
The notation reflects an assumption: since there is some individual x such thatElephant(x), assume that individual is a
21 / 33
Example
Prove∃x . Elephant(x) ∀x . Elephant(x)→Huge(x)
∃x . Huge(x)1 ∃x . Elephant(x)
2 ∀x . Elephant(x)→Huge(x)
3 a Elephant(a)
4 Elephant(a)→Huge(a) ∀-E, 2
5 Huge(a) →-E, 3, 4
6 ∃x . Huge(x) ∃-I, 5
7 ∃x . Huge(x) ∃-E, 1, 3–6
The notation reflects an assumption: since there is some individual x such thatElephant(x), assume that individual is a
21 / 33
Swapping the order of existential quantifiers
(∃x . ∃y . P(x ,y)) ↔ (∃y . ∃x . P(x ,y))
1 ∃x . ∃y . P(x ,y)
2 a ∃y . P(a,y)
3 b P(a,b)
4 ∃x . P(x ,b) ∃-I, 3
5 ∃y . ∃x . P(x ,y) ∃-I, 4
6 ∃y . ∃x . P(x ,y) ∃-E, 2, 3–5
7 ∃y . ∃x . P(x ,y) ∃-E, 1, 2–6Exercise: also show the converse to get equivalence,↔
22 / 33
Swapping the order of existential quantifiers
(∃x . ∃y . P(x ,y)) ↔ (∃y . ∃x . P(x ,y))
1 ∃x . ∃y . P(x ,y)
2 a ∃y . P(a,y)
3 b P(a,b)
4 ∃x . P(x ,b) ∃-I, 3
5 ∃y . ∃x . P(x ,y) ∃-I, 4
6 ∃y . ∃x . P(x ,y) ∃-E, 2, 3–5
7 ∃y . ∃x . P(x ,y) ∃-E, 1, 2–6Exercise: also show the converse to get equivalence,↔
22 / 33
Swapping the order of existential quantifiers
(∃x . ∃y . P(x ,y)) ↔ (∃y . ∃x . P(x ,y))
1 ∃x . ∃y . P(x ,y)
2 a ∃y . P(a,y)
3 b P(a,b)
4 ∃x . P(x ,b) ∃-I, 3
5 ∃y . ∃x . P(x ,y) ∃-I, 4
6 ∃y . ∃x . P(x ,y) ∃-E, 2, 3–5
7 ∃y . ∃x . P(x ,y) ∃-E, 1, 2–6Exercise: also show the converse to get equivalence,↔
22 / 33
Swapping the order of existential quantifiers
(∃x . ∃y . P(x ,y)) ↔ (∃y . ∃x . P(x ,y))
1 ∃x . ∃y . P(x ,y)
2 a ∃y . P(a,y)
3 b P(a,b)
4 ∃x . P(x ,b) ∃-I, 3
5 ∃y . ∃x . P(x ,y) ∃-I, 4
6 ∃y . ∃x . P(x ,y) ∃-E, 2, 3–5
7 ∃y . ∃x . P(x ,y) ∃-E, 1, 2–6Exercise: also show the converse to get equivalence,↔
22 / 33
Swapping the order of existential quantifiers
(∃x . ∃y . P(x ,y)) ↔ (∃y . ∃x . P(x ,y))
1 ∃x . ∃y . P(x ,y)
2 a ∃y . P(a,y)
3 b P(a,b)
4 ∃x . P(x ,b) ∃-I, 3
5 ∃y . ∃x . P(x ,y) ∃-I, 4
6 ∃y . ∃x . P(x ,y) ∃-E, 2, 3–5
7 ∃y . ∃x . P(x ,y) ∃-E, 1, 2–6Exercise: also show the converse to get equivalence,↔
22 / 33
Swapping the order of existential quantifiers
(∃x . ∃y . P(x ,y)) ↔ (∃y . ∃x . P(x ,y))
1 ∃x . ∃y . P(x ,y)
2 a ∃y . P(a,y)
3 b P(a,b)
4 ∃x . P(x ,b) ∃-I, 3
5 ∃y . ∃x . P(x ,y) ∃-I, 4
6 ∃y . ∃x . P(x ,y) ∃-E, 2, 3–5
7 ∃y . ∃x . P(x ,y) ∃-E, 1, 2–6Exercise: also show the converse to get equivalence,↔
22 / 33
Swapping the order of existential quantifiers
(∃x . ∃y . P(x ,y)) ↔ (∃y . ∃x . P(x ,y))
1 ∃x . ∃y . P(x ,y)
2 a ∃y . P(a,y)
3 b P(a,b)
4 ∃x . P(x ,b) ∃-I, 3
5 ∃y . ∃x . P(x ,y) ∃-I, 4
6 ∃y . ∃x . P(x ,y) ∃-E, 2, 3–5
7 ∃y . ∃x . P(x ,y) ∃-E, 1, 2–6Exercise: also show the converse to get equivalence,↔
22 / 33
Swapping the order of existential quantifiers
(∃x . ∃y . P(x ,y)) ↔ (∃y . ∃x . P(x ,y))
1 ∃x . ∃y . P(x ,y)
2 a ∃y . P(a,y)
3 b P(a,b)
4 ∃x . P(x ,b) ∃-I, 3
5 ∃y . ∃x . P(x ,y) ∃-I, 4
6 ∃y . ∃x . P(x ,y) ∃-E, 2, 3–5
7 ∃y . ∃x . P(x ,y) ∃-E, 1, 2–6Exercise: also show the converse to get equivalence,↔
22 / 33
Swapping the order of existential quantifiers
(∃x . ∃y . P(x ,y)) ↔ (∃y . ∃x . P(x ,y))
1 ∃x . ∃y . P(x ,y)
2 a ∃y . P(a,y)
3 b P(a,b)
4 ∃x . P(x ,b) ∃-I, 3
5 ∃y . ∃x . P(x ,y) ∃-I, 4
6 ∃y . ∃x . P(x ,y) ∃-E, 2, 3–5
7 ∃y . ∃x . P(x ,y) ∃-E, 1, 2–6Exercise: also show the converse to get equivalence,↔
22 / 33
Swapping the order of existential and universalquantifiers
Proof of∃x . ∀y . P(x ,y)∀y . ∃x . P(x ,y)
1 ∃x . ∀y . P(x ,y)
2 b a ∀y . P(a,y)
3 P(a,b) ∀-E, 2
4 ∃x . P(x ,b) ∃-I, 3
5 ∃x . P(x ,b) ∃-E, 1, 2–4
6 ∀y . ∃x . P(x ,y) ∀-I, 5
23 / 33
Swapping the order of existential and universalquantifiers
Proof of∃x . ∀y . P(x ,y)∀y . ∃x . P(x ,y)
1 ∃x . ∀y . P(x ,y)
2 b a ∀y . P(a,y)
3 P(a,b) ∀-E, 2
4 ∃x . P(x ,b) ∃-I, 3
5 ∃x . P(x ,b) ∃-E, 1, 2–4
6 ∀y . ∃x . P(x ,y) ∀-I, 5
23 / 33
Swapping the order of existential and universalquantifiers
Proof of∃x . ∀y . P(x ,y)∀y . ∃x . P(x ,y)
1 ∃x . ∀y . P(x ,y)
2 b a ∀y . P(a,y)
3 P(a,b) ∀-E, 2
4 ∃x . P(x ,b) ∃-I, 3
5 ∃x . P(x ,b) ∃-E, 1, 2–4
6 ∀y . ∃x . P(x ,y) ∀-I, 5
23 / 33
Swapping the order of existential and universalquantifiers
Proof of∃x . ∀y . P(x ,y)∀y . ∃x . P(x ,y)
1 ∃x . ∀y . P(x ,y)
2 b a ∀y . P(a,y)
3 P(a,b) ∀-E, 2
4 ∃x . P(x ,b) ∃-I, 3
5 ∃x . P(x ,b) ∃-E, 1, 2–4
6 ∀y . ∃x . P(x ,y) ∀-I, 5
23 / 33
Swapping the order of existential and universalquantifiers
Proof of∃x . ∀y . P(x ,y)∀y . ∃x . P(x ,y)
1 ∃x . ∀y . P(x ,y)
2 b a ∀y . P(a,y)
3 P(a,b) ∀-E, 2
4 ∃x . P(x ,b) ∃-I, 3
5 ∃x . P(x ,b) ∃-E, 1, 2–4
6 ∀y . ∃x . P(x ,y) ∀-I, 5
23 / 33
Swapping the order of existential and universalquantifiers
Proof of∃x . ∀y . P(x ,y)∀y . ∃x . P(x ,y)
1 ∃x . ∀y . P(x ,y)
2 b a ∀y . P(a,y)
3 P(a,b) ∀-E, 2
4 ∃x . P(x ,b) ∃-I, 3
5 ∃x . P(x ,b) ∃-E, 1, 2–4
6 ∀y . ∃x . P(x ,y) ∀-I, 5
23 / 33
Swapping the order of existential and universalquantifiers
Proof of∃x . ∀y . P(x ,y)∀y . ∃x . P(x ,y)
1 ∃x . ∀y . P(x ,y)
2 b a ∀y . P(a,y)
3 P(a,b) ∀-E, 2
4 ∃x . P(x ,b) ∃-I, 3
5 ∃x . P(x ,b) ∃-E, 1, 2–4
6 ∀y . ∃x . P(x ,y) ∀-I, 5
23 / 33
Swapping the order of existential and universalquantifiers
Proof of∃x . ∀y . P(x ,y)∀y . ∃x . P(x ,y)
1 ∃x . ∀y . P(x ,y)
2 b a ∀y . P(a,y)
3 P(a,b) ∀-E, 2
4 ∃x . P(x ,b) ∃-I, 3
5 ∃x . P(x ,b) ∃-E, 1, 2–4
6 ∀y . ∃x . P(x ,y) ∀-I, 5
23 / 33
Swapping the order of existential and universalquantifiers
Another proof of∃x . ∀y . P(x ,y)∀y . ∃x . P(x ,y)
We got the previous proof by first looking at the goal, (∀y . . . .), so using ∀-I.Here we first look at what we have, (∃x . . . .), and so use ∃-E.
1 ∃x . ∀y . P(x ,y)
2 a ∀y . P(a,y)
3 b P(a,b) ∀-E, 2
4 ∃x . P(x ,b) ∃-I, 3
5 ∀y . ∃x . P(x ,y) ∀-I, 4
6 ∀y . ∃x . P(x ,y) ∃-E, 1, 2–5
24 / 33
Swapping the order of existential and universalquantifiers
Another proof of∃x . ∀y . P(x ,y)∀y . ∃x . P(x ,y)
We got the previous proof by first looking at the goal, (∀y . . . .), so using ∀-I.Here we first look at what we have, (∃x . . . .), and so use ∃-E.
1 ∃x . ∀y . P(x ,y)
2 a ∀y . P(a,y)
3 b P(a,b) ∀-E, 2
4 ∃x . P(x ,b) ∃-I, 3
5 ∀y . ∃x . P(x ,y) ∀-I, 4
6 ∀y . ∃x . P(x ,y) ∃-E, 1, 2–5
24 / 33
Swapping the order of existential and universalquantifiers
Another proof of∃x . ∀y . P(x ,y)∀y . ∃x . P(x ,y)
We got the previous proof by first looking at the goal, (∀y . . . .), so using ∀-I.Here we first look at what we have, (∃x . . . .), and so use ∃-E.
1 ∃x . ∀y . P(x ,y)
2 a ∀y . P(a,y)
3 b P(a,b) ∀-E, 2
4 ∃x . P(x ,b) ∃-I, 3
5 ∀y . ∃x . P(x ,y) ∀-I, 4
6 ∀y . ∃x . P(x ,y) ∃-E, 1, 2–5
24 / 33
Swapping the order of existential and universalquantifiers
Another proof of∃x . ∀y . P(x ,y)∀y . ∃x . P(x ,y)
We got the previous proof by first looking at the goal, (∀y . . . .), so using ∀-I.Here we first look at what we have, (∃x . . . .), and so use ∃-E.
1 ∃x . ∀y . P(x ,y)
2 a ∀y . P(a,y)
3 b P(a,b) ∀-E, 2
4 ∃x . P(x ,b) ∃-I, 3
5 ∀y . ∃x . P(x ,y) ∀-I, 4
6 ∀y . ∃x . P(x ,y) ∃-E, 1, 2–5
24 / 33
Swapping the order of existential and universalquantifiers
Another proof of∃x . ∀y . P(x ,y)∀y . ∃x . P(x ,y)
We got the previous proof by first looking at the goal, (∀y . . . .), so using ∀-I.Here we first look at what we have, (∃x . . . .), and so use ∃-E.
1 ∃x . ∀y . P(x ,y)
2 a ∀y . P(a,y)
3 b P(a,b) ∀-E, 2
4 ∃x . P(x ,b) ∃-I, 3
5 ∀y . ∃x . P(x ,y) ∀-I, 4
6 ∀y . ∃x . P(x ,y) ∃-E, 1, 2–5
24 / 33
Swapping the order of existential and universalquantifiers
Another proof of∃x . ∀y . P(x ,y)∀y . ∃x . P(x ,y)
We got the previous proof by first looking at the goal, (∀y . . . .), so using ∀-I.Here we first look at what we have, (∃x . . . .), and so use ∃-E.
1 ∃x . ∀y . P(x ,y)
2 a ∀y . P(a,y)
3 b P(a,b) ∀-E, 2
4 ∃x . P(x ,b) ∃-I, 3
5 ∀y . ∃x . P(x ,y) ∀-I, 4
6 ∀y . ∃x . P(x ,y) ∃-E, 1, 2–5
24 / 33
Swapping the order of existential and universalquantifiers
Another proof of∃x . ∀y . P(x ,y)∀y . ∃x . P(x ,y)
We got the previous proof by first looking at the goal, (∀y . . . .), so using ∀-I.Here we first look at what we have, (∃x . . . .), and so use ∃-E.
1 ∃x . ∀y . P(x ,y)
2 a ∀y . P(a,y)
3 b P(a,b) ∀-E, 2
4 ∃x . P(x ,b) ∃-I, 3
5 ∀y . ∃x . P(x ,y) ∀-I, 4
6 ∀y . ∃x . P(x ,y) ∃-E, 1, 2–5
24 / 33
Swapping the order of existential and universalquantifiers
Another proof of∃x . ∀y . P(x ,y)∀y . ∃x . P(x ,y)
We got the previous proof by first looking at the goal, (∀y . . . .), so using ∀-I.Here we first look at what we have, (∃x . . . .), and so use ∃-E.
1 ∃x . ∀y . P(x ,y)
2 a ∀y . P(a,y)
3 b P(a,b) ∀-E, 2
4 ∃x . P(x ,b) ∃-I, 3
5 ∀y . ∃x . P(x ,y) ∀-I, 4
6 ∀y . ∃x . P(x ,y) ∃-E, 1, 2–5
24 / 33
Swapping the order of existential and universalquantifiers
Another proof of∃x . ∀y . P(x ,y)∀y . ∃x . P(x ,y)
We got the previous proof by first looking at the goal, (∀y . . . .), so using ∀-I.Here we first look at what we have, (∃x . . . .), and so use ∃-E.
1 ∃x . ∀y . P(x ,y)
2 a ∀y . P(a,y)
3 b P(a,b) ∀-E, 2
4 ∃x . P(x ,b) ∃-I, 3
5 ∀y . ∃x . P(x ,y) ∀-I, 4
6 ∀y . ∃x . P(x ,y) ∃-E, 1, 2–5
24 / 33
Can quantifiers always be swapped?
∃x . ∀y . Eats(x ,y) → ∀y . ∃x . Eats(x ,y)There is an animal All foods can be eaten
that can eat all foods. by some animal.
∀y . ∃x . Eats(x ,y) → ∃x . ∀y . Eats(x ,y)All foods can be eaten There is an animal
by some animal. that can eat all foods.
Is this second version true? Try to prove it. What happens?
25 / 33
Can quantifiers always be swapped?
∃x . ∀y . Eats(x ,y) → ∀y . ∃x . Eats(x ,y)There is an animal All foods can be eaten
that can eat all foods. by some animal.
∀y . ∃x . Eats(x ,y) → ∃x . ∀y . Eats(x ,y)All foods can be eaten There is an animal
by some animal. that can eat all foods.
Is this second version true? Try to prove it. What happens?
25 / 33
Can quantifiers always be swapped?
∃x . ∀y . Eats(x ,y) → ∀y . ∃x . Eats(x ,y)There is an animal All foods can be eaten
that can eat all foods. by some animal.
∀y . ∃x . Eats(x ,y) → ∃x . ∀y . Eats(x ,y)All foods can be eaten There is an animal
by some animal. that can eat all foods.
Is this second version true? Try to prove it. What happens?
25 / 33
The “quantifier negation” equivalence
(∀x . ¬P(x)) ↔ ¬(∃x . P(x))
Prove¬(∃x . P(x))
∀x . ¬P(x)
1 ¬(∃x . P(x))
2 a P(a)
3 ∃x . P(x) ∃-I, 2
4 (∃x . P(x))∧¬(∃x . P(x)) ∧-I, 1, 3
5 ¬P(a) ¬I, 2–4
6 ∀x . ¬P(x) ∀-I, 5
26 / 33
The “quantifier negation” equivalence
(∀x . ¬P(x)) ↔ ¬(∃x . P(x))
Prove¬(∃x . P(x))
∀x . ¬P(x)
1 ¬(∃x . P(x))
2 a P(a)
3 ∃x . P(x) ∃-I, 2
4 (∃x . P(x))∧¬(∃x . P(x)) ∧-I, 1, 3
5 ¬P(a) ¬I, 2–4
6 ∀x . ¬P(x) ∀-I, 5
26 / 33
The “quantifier negation” equivalence
(∀x . ¬P(x)) ↔ ¬(∃x . P(x))
Prove¬(∃x . P(x))
∀x . ¬P(x)
1 ¬(∃x . P(x))
2 a P(a)
3 ∃x . P(x) ∃-I, 2
4 (∃x . P(x))∧¬(∃x . P(x)) ∧-I, 1, 3
5 ¬P(a) ¬I, 2–4
6 ∀x . ¬P(x) ∀-I, 5
26 / 33
The “quantifier negation” equivalence
(∀x . ¬P(x)) ↔ ¬(∃x . P(x))
Prove¬(∃x . P(x))
∀x . ¬P(x)
1 ¬(∃x . P(x))
2 a P(a)
3 ∃x . P(x) ∃-I, 2
4 (∃x . P(x))∧¬(∃x . P(x)) ∧-I, 1, 3
5 ¬P(a) ¬I, 2–4
6 ∀x . ¬P(x) ∀-I, 5
26 / 33
The “quantifier negation” equivalence
(∀x . ¬P(x)) ↔ ¬(∃x . P(x))
Prove¬(∃x . P(x))
∀x . ¬P(x)
1 ¬(∃x . P(x))
2 a P(a)
3 ∃x . P(x) ∃-I, 2
4 (∃x . P(x))∧¬(∃x . P(x)) ∧-I, 1, 3
5 ¬P(a) ¬I, 2–4
6 ∀x . ¬P(x) ∀-I, 5
26 / 33
The “quantifier negation” equivalence
(∀x . ¬P(x)) ↔ ¬(∃x . P(x))
Prove¬(∃x . P(x))
∀x . ¬P(x)
1 ¬(∃x . P(x))
2 a P(a)
3 ∃x . P(x) ∃-I, 2
4 (∃x . P(x))∧¬(∃x . P(x)) ∧-I, 1, 3
5 ¬P(a) ¬I, 2–4
6 ∀x . ¬P(x) ∀-I, 5
26 / 33
The “quantifier negation” equivalence
(∀x . ¬P(x)) ↔ ¬(∃x . P(x))
Prove¬(∃x . P(x))
∀x . ¬P(x)
1 ¬(∃x . P(x))
2 a P(a)
3 ∃x . P(x) ∃-I, 2
4 (∃x . P(x))∧¬(∃x . P(x)) ∧-I, 1, 3
5 ¬P(a) ¬I, 2–4
6 ∀x . ¬P(x) ∀-I, 5
26 / 33
The “quantifier negation” equivalence
(∀x . ¬P(x)) ↔ ¬(∃x . P(x))
Prove¬(∃x . P(x))
∀x . ¬P(x)
1 ¬(∃x . P(x))
2 a P(a)
3 ∃x . P(x) ∃-I, 2
4 (∃x . P(x))∧¬(∃x . P(x)) ∧-I, 1, 3
5 ¬P(a) ¬I, 2–4
6 ∀x . ¬P(x) ∀-I, 5
26 / 33
The “quantifier negation” equivalence
Proof of the converse:
1 ∀x . ¬P(x)
2 ∃x . P(x)
3 a P(a)
4 ¬P(a) ∀-E, 1
5 P(a)∧¬P(a) ∧-I, 3, 4
6 ⊥ see below
7 ⊥ ∃-E, 2, 3–6
8 ¬(∃x . P(x)) ¬I, 2–7
Think of ⊥ as an abbreviation for any contradiction, say, q∧¬q.From step 5 to 6 uses the proof of the derived rule “contradiction elimination”.
27 / 33
The “quantifier negation” equivalence
Proof of the converse:
1 ∀x . ¬P(x)
2 ∃x . P(x)
3 a P(a)
4 ¬P(a) ∀-E, 1
5 P(a)∧¬P(a) ∧-I, 3, 4
6 ⊥ see below
7 ⊥ ∃-E, 2, 3–6
8 ¬(∃x . P(x)) ¬I, 2–7
Think of ⊥ as an abbreviation for any contradiction, say, q∧¬q.From step 5 to 6 uses the proof of the derived rule “contradiction elimination”.
27 / 33
The “quantifier negation” equivalence
Proof of the converse:
1 ∀x . ¬P(x)
2 ∃x . P(x)
3 a P(a)
4 ¬P(a) ∀-E, 1
5 P(a)∧¬P(a) ∧-I, 3, 4
6 ⊥ see below
7 ⊥ ∃-E, 2, 3–6
8 ¬(∃x . P(x)) ¬I, 2–7
Think of ⊥ as an abbreviation for any contradiction, say, q∧¬q.From step 5 to 6 uses the proof of the derived rule “contradiction elimination”.
27 / 33
The “quantifier negation” equivalence
Proof of the converse:
1 ∀x . ¬P(x)
2 ∃x . P(x)
3 a P(a)
4 ¬P(a) ∀-E, 1
5 P(a)∧¬P(a) ∧-I, 3, 4
6 ⊥ see below
7 ⊥ ∃-E, 2, 3–6
8 ¬(∃x . P(x)) ¬I, 2–7
Think of ⊥ as an abbreviation for any contradiction, say, q∧¬q.From step 5 to 6 uses the proof of the derived rule “contradiction elimination”.
27 / 33
The “quantifier negation” equivalence
Proof of the converse:
1 ∀x . ¬P(x)
2 ∃x . P(x)
3 a P(a)
4 ¬P(a) ∀-E, 1
5 P(a)∧¬P(a) ∧-I, 3, 4
6 ⊥ see below
7 ⊥ ∃-E, 2, 3–6
8 ¬(∃x . P(x)) ¬I, 2–7
Think of ⊥ as an abbreviation for any contradiction, say, q∧¬q.From step 5 to 6 uses the proof of the derived rule “contradiction elimination”.
27 / 33
The “quantifier negation” equivalence
Proof of the converse:
1 ∀x . ¬P(x)
2 ∃x . P(x)
3 a P(a)
4 ¬P(a) ∀-E, 1
5 P(a)∧¬P(a) ∧-I, 3, 4
6 ⊥ see below
7 ⊥ ∃-E, 2, 3–6
8 ¬(∃x . P(x)) ¬I, 2–7
Think of ⊥ as an abbreviation for any contradiction, say, q∧¬q.From step 5 to 6 uses the proof of the derived rule “contradiction elimination”.
27 / 33
The “quantifier negation” equivalence
Proof of the converse:
1 ∀x . ¬P(x)
2 ∃x . P(x)
3 a P(a)
4 ¬P(a) ∀-E, 1
5 P(a)∧¬P(a) ∧-I, 3, 4
6 ⊥ see below
7 ⊥ ∃-E, 2, 3–6
8 ¬(∃x . P(x)) ¬I, 2–7
Think of ⊥ as an abbreviation for any contradiction, say, q∧¬q.From step 5 to 6 uses the proof of the derived rule “contradiction elimination”.
27 / 33
The “quantifier negation” equivalence
Proof of the converse:
1 ∀x . ¬P(x)
2 ∃x . P(x)
3 a P(a)
4 ¬P(a) ∀-E, 1
5 P(a)∧¬P(a) ∧-I, 3, 4
6 ⊥ see below
7 ⊥ ∃-E, 2, 3–6
8 ¬(∃x . P(x)) ¬I, 2–7
Think of ⊥ as an abbreviation for any contradiction, say, q∧¬q.From step 5 to 6 uses the proof of the derived rule “contradiction elimination”.
27 / 33
The “quantifier negation” equivalence
Proof of the converse:
1 ∀x . ¬P(x)
2 ∃x . P(x)
3 a P(a)
4 ¬P(a) ∀-E, 1
5 P(a)∧¬P(a) ∧-I, 3, 4
6 ⊥ see below
7 ⊥ ∃-E, 2, 3–6
8 ¬(∃x . P(x)) ¬I, 2–7
Think of ⊥ as an abbreviation for any contradiction, say, q∧¬q.From step 5 to 6 uses the proof of the derived rule “contradiction elimination”.
27 / 33
Introduction to metalogic
Various proof methods to prove a statement in propositional calculusI Truth tablesI Natural deduction
We hope these all are correct, whatever that meansAt least we would hope these all give the same answers!
28 / 33
Soundness and completeness
A propositional statement is valid iff it can be proved using truth tablesIn this case, we use truth tables as our definition of the semantics ofpropositional logic
When using another proof method such as natural deduction, must ensure it:only proves valid statements, andproves every valid statement
Formally, we say that a proof system (such as the rules of natural deduction) is
Sound, if every derivable (ie, provable) statement or rule is validComplete, if every valid statement or rule is derivable
29 / 33
Showing soundness
For each rule, need to show that whenever both the premises are true, thenso is the conclusioni.e. show that rules preserve validityUses induction similar to that we saw last week
30 / 33
Showing completeness
Note: completeness is a property of the whole set of rules, rather than ofindividual rulesShowing completeness:
Idea is to reproduce the truth-table in a natural deduction proofSteps of each sub-proof similar to the calculations in the truth-tableUse derived rules to mimic the truth-table definition of each connective
31 / 33
The importance of soundness and completeness
Soundness assures us that:every correct natural deduction proof proves a valid statementCompleteness assures us that:there exists a natural deduction proof for every valid statement
32 / 33
Metalogic of first order logic
First order natural deduction is sound and completeSo you can find a proof of any valid statementBut the truth-tables aren’t finite — you can’t actually prove or disprove astatement by truth-tablesIf there is a proof you can find it by mindlessly trying all sequences of rules oflength 1, length 2, . . .But if you don’t find a proof, you haven’t established anythingFirst order logic is semi-decidable
33 / 33