Professional Documents
Culture Documents
COMP2600 / COMP6260
Dirk Pattinson
Australian National University
Semester 2, 2016
Recap: propositional natural deduction
p q p ∧ q p ∧ q
p ∧ q p q
[p] [q ]
.. ..
p p p ∨ q r r
p ∨ q q ∨ p r
1 / 33
First-order logic
Example:
Natural language First order logic
All 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
1 ∀x . student(x ) → happy(x )
2 student(Lisa)
4 happy(Lisa) →-E, 2, 3
3 / 33
Quantifiers
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
5 / 33
Negating “there exists”
¬ (∃ x . P (x )) ↔ (∀ x . ¬ P (x ))
Examples:
I “No students dislike COMP2600”.
I ¬ ∃ s ∈ Student. s dislikes COMP2600
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 exam
I “There are some students who did not pass the exam”.
7 / 33
Mixed negated quantifiers
Here are four different expressions of the fact that there is no upper bound to
the 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
(∃ x ∈ 0.
/ P (x )) ≡ F
9 / 33
Universal quantifiers with empty domains
10 / 33
Universal quantifiers with empty domains
11 / 33
Natural deduction in first-order logic
12 / 33
Instantiation
13 / 33
Instantiation
n ∀x . Fish(x) → HasFins(x)
.. ..
13 / 33
Generalisation
P (a) (a arbitrary, a variable)
∀-I (universal generalisation)
∀x . P (x )
14 / 33
Generalisation
P (a) (a arbitrary, a variable)
∀-I (universal generalisation)
∀x . P (x )
n a ..
.. ..
m Cat(a) → EatsFish(a)
14 / 33
Generalisation
P (a) (a arbitrary, a variable)
∀-I (universal generalisation)
∀x . P (x )
n a ..
.. ..
m Cat(a) → EatsFish(a)
14 / 33
Breaching the arbitrariness requirement
When we generalise for a variable a, the same proof steps must be possible for
all members of the domain.
15 / 33
Breaching the arbitrariness requirement
When we generalise for a variable a, the same proof steps must be possible for
all members of the domain.
15 / 33
Breaching the arbitrariness requirement
When we generalise for a variable a, the same proof steps must be possible for
all members of the domain.
15 / 33
Breaching the arbitrariness requirement
When we generalise for a variable a, the same proof steps must be possible for
all members of the domain.
3 Cat(kitty) ∧-E, 1
15 / 33
Breaching the arbitrariness requirement
When we generalise for a variable a, the same proof steps must be possible for
all members of the domain.
3 Cat(kitty) ∧-E, 1
4 HasFur(kitty) →-E, 2, 3
15 / 33
Breaching the arbitrariness requirement
When we generalise for a variable a, the same proof steps must be possible for
all members of the domain.
3 Cat(kitty) ∧-E, 1
4 HasFur(kitty) →-E, 2, 3
15 / 33
Free and bound variables
16 / 33
Free and bound variables
16 / 33
Example
(∀x . ∀y . P (x , y )) ↔ (∀y . ∀x . P (x , y ))
17 / 33
Example
(∀x . ∀y . P (x , y )) ↔ (∀y . ∀x . P (x , y ))
17 / 33
Example
(∀x . ∀y . P (x , y )) ↔ (∀y . ∀x . P (x , y ))
1 ∀x . ∀y . P (x , y )
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
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
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
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, 4
Exercise: also show the reverse to get equivalence, ↔
17 / 33
Generalisation
P (a)
∃x . P (x )
18 / 33
Generalisation
P (a)
∃x . P (x )
n Dog(fido)
.. ..
m ∃x . Dog(x ) ∃-I, n
18 / 33
An invalid argument
1 ∀x . P (x )
2 P (a ) ∀-E, 1
3 ∃x . P (x ) ∃-I, 2
Which step is invalid ??
19 / 33
Instantiation
[P (a)]
..
∃x . P (x ) 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 follows
as 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
21 / 33
Example
21 / 33
Example
21 / 33
Example
2 ∀x . Elephant(x ) → Huge(x )
21 / 33
Example
2 ∀x . Elephant(x ) → Huge(x )
3 a Elephant(a)
21 / 33
Example
2 ∀x . Elephant(x ) → Huge(x )
3 a Elephant(a)
21 / 33
Example
2 ∀x . Elephant(x ) → Huge(x )
3 a Elephant(a)
5 Huge(a) →-E, 3, 4
21 / 33
Example
2 ∀x . Elephant(x ) → Huge(x )
3 a Elephant(a)
5 Huge(a) →-E, 3, 4
6 ∃x . Huge(x ) ∃-I, 5
21 / 33
Example
2 ∀x . Elephant(x ) → Huge(x )
3 a Elephant(a)
5 Huge(a) →-E, 3, 4
6 ∃x . Huge(x ) ∃-I, 5
The notation reflects an assumption: since there is some individual x such that
Elephant(x ), assume that individual is a
21 / 33
Swapping the order of existential quantifiers
(∃x . ∃y . P (x , y )) ↔ (∃y . ∃x . P (x , y ))
22 / 33
Swapping the order of existential quantifiers
(∃x . ∃y . P (x , y )) ↔ (∃y . ∃x . P (x , y ))
22 / 33
Swapping the order of existential quantifiers
(∃x . ∃y . P (x , y )) ↔ (∃y . ∃x . P (x , y ))
1 ∃x . ∃y . P (x , y )
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 )
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 )
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
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
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
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–6
Exercise: also show the converse to get equivalence, ↔
22 / 33
Swapping the order of existential and universal
quantifiers
∃x . ∀y . P (x , y )
Proof of
∀y . ∃x . P (x , y )
23 / 33
Swapping the order of existential and universal
quantifiers
∃x . ∀y . P (x , y )
Proof of
∀y . ∃x . P (x , y )
23 / 33
Swapping the order of existential and universal
quantifiers
∃x . ∀y . P (x , y )
Proof of
∀y . ∃x . P (x , y )
1 ∃x . ∀y . P (x , y )
23 / 33
Swapping the order of existential and universal
quantifiers
∃x . ∀y . P (x , y )
Proof of
∀y . ∃x . P (x , y )
1 ∃x . ∀y . P (x , y )
2 b a ∀y . P (a, y )
23 / 33
Swapping the order of existential and universal
quantifiers
∃x . ∀y . P (x , y )
Proof of
∀y . ∃x . P (x , y )
1 ∃x . ∀y . P (x , y )
2 b a ∀y . P (a, y )
3 P (a , b ) ∀-E, 2
23 / 33
Swapping the order of existential and universal
quantifiers
∃x . ∀y . P (x , y )
Proof of
∀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
23 / 33
Swapping the order of existential and universal
quantifiers
∃x . ∀y . P (x , y )
Proof of
∀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
23 / 33
Swapping the order of existential and universal
quantifiers
∃x . ∀y . P (x , y )
Proof of
∀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 universal
quantifiers
∃x . ∀y . P (x , y )
Another proof of
∀y . ∃x . P (x , y )
24 / 33
Swapping the order of existential and universal
quantifiers
∃x . ∀y . P (x , y )
Another proof of
∀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.
24 / 33
Swapping the order of existential and universal
quantifiers
∃x . ∀y . P (x , y )
Another proof of
∀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.
24 / 33
Swapping the order of existential and universal
quantifiers
∃x . ∀y . P (x , y )
Another proof of
∀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 )
24 / 33
Swapping the order of existential and universal
quantifiers
∃x . ∀y . P (x , y )
Another proof of
∀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 )
24 / 33
Swapping the order of existential and universal
quantifiers
∃x . ∀y . P (x , y )
Another proof of
∀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
24 / 33
Swapping the order of existential and universal
quantifiers
∃x . ∀y . P (x , y )
Another proof of
∀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
24 / 33
Swapping the order of existential and universal
quantifiers
∃x . ∀y . P (x , y )
Another proof of
∀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
24 / 33
Swapping the order of existential and universal
quantifiers
∃x . ∀y . P (x , y )
Another proof of
∀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.
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.
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.
25 / 33
The “quantifier negation” equivalence
(∀x . ¬ P (x )) ↔ ¬(∃x . P (x ))
¬(∃x . P (x ))
Prove
∀x . ¬ P (x )
26 / 33
The “quantifier negation” equivalence
(∀x . ¬ P (x )) ↔ ¬(∃x . P (x ))
¬(∃x . P (x ))
Prove
∀x . ¬ P (x )
26 / 33
The “quantifier negation” equivalence
(∀x . ¬ P (x )) ↔ ¬(∃x . P (x ))
¬(∃x . P (x ))
Prove
∀x . ¬ P (x )
1 ¬(∃x . P (x ))
26 / 33
The “quantifier negation” equivalence
(∀x . ¬ P (x )) ↔ ¬(∃x . P (x ))
¬(∃x . P (x ))
Prove
∀x . ¬ P (x )
1 ¬(∃x . P (x ))
2 a P (a)
26 / 33
The “quantifier negation” equivalence
(∀x . ¬ P (x )) ↔ ¬(∃x . P (x ))
¬(∃x . P (x ))
Prove
∀x . ¬ P (x )
1 ¬(∃x . P (x ))
2 a P (a)
3 ∃x . P (x ) ∃-I, 2
26 / 33
The “quantifier negation” equivalence
(∀x . ¬ P (x )) ↔ ¬(∃x . P (x ))
¬(∃x . P (x ))
Prove
∀x . ¬ P (x )
1 ¬(∃x . P (x ))
2 a P (a)
3 ∃x . P (x ) ∃-I, 2
26 / 33
The “quantifier negation” equivalence
(∀x . ¬ P (x )) ↔ ¬(∃x . P (x ))
¬(∃x . P (x ))
Prove
∀x . ¬ P (x )
1 ¬(∃x . P (x ))
2 a P (a)
3 ∃x . P (x ) ∃-I, 2
5 ¬ P (a ) ¬I, 2–4
26 / 33
The “quantifier negation” equivalence
(∀x . ¬ P (x )) ↔ ¬(∃x . P (x ))
¬(∃x . P (x ))
Prove
∀x . ¬ P (x )
1 ¬(∃x . P (x ))
2 a P (a)
3 ∃x . P (x ) ∃-I, 2
5 ¬ P (a ) ¬I, 2–4
6 ∀x . ¬ P (x ) ∀-I, 5
26 / 33
The “quantifier negation” equivalence
27 / 33
The “quantifier negation” equivalence
1 ∀x . ¬ P (x )
27 / 33
The “quantifier negation” equivalence
1 ∀x . ¬ P (x )
2 ∃x . P (x )
27 / 33
The “quantifier negation” equivalence
1 ∀x . ¬ P (x )
2 ∃x . P (x )
3 a P (a)
27 / 33
The “quantifier negation” equivalence
1 ∀x . ¬ P (x )
2 ∃x . P (x )
3 a P (a)
4 ¬ P (a) ∀-E, 1
27 / 33
The “quantifier negation” equivalence
1 ∀x . ¬ P (x )
2 ∃x . P (x )
3 a P (a)
4 ¬ P (a) ∀-E, 1
27 / 33
The “quantifier negation” equivalence
1 ∀x . ¬ P (x )
2 ∃x . P (x )
3 a P (a)
4 ¬ P (a) ∀-E, 1
6 ⊥ see below
27 / 33
The “quantifier negation” equivalence
1 ∀x . ¬ P (x )
2 ∃x . P (x )
3 a P (a)
4 ¬ P (a) ∀-E, 1
6 ⊥ see below
7 ⊥ ∃-E, 2, 3–6
27 / 33
The “quantifier negation” equivalence
1 ∀x . ¬ P (x )
2 ∃x . P (x )
3 a P (a)
4 ¬ P (a) ∀-E, 1
6 ⊥ see below
7 ⊥ ∃-E, 2, 3–6
27 / 33
Introduction to metalogic
28 / 33
Soundness and completeness
When using another proof method such as natural deduction, must ensure it:
only proves valid statements, and
proves 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 valid
Complete, 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, then
so is the conclusion
i.e. show that rules preserve validity
Uses induction similar to that we saw last week
30 / 33
Showing completeness
31 / 33
The importance of soundness and completeness
32 / 33
Metalogic of first order logic
33 / 33