Formal proof that there is no greatest natural number

advertisement
Computer Science 202a, Prof. Dana Angluin
1
Formal proof that there is no greatest natural number
To see the correspondence between an informal (prose) proof and a formalized (symbolic) proof, we considered
both kinds of proofs of the statement that there is no greatest natural number.
Informal proof
Assume, for the sake of contradiction, that there is a greatest natural number. Call it n. Then n + 1 is a
natural number and n < n + 1. This contradicts the claim that n is the greatest natural number, so we
conclude that there is no greatest natural number.
Formal proof
First we need to translate the statement into logical expressions. We choose to use predicates < and ≥ and
the function that maps n to n + 1.
To express the fact that there is no greatest natural number, we can write
¬∃x∀y(x ≥ y).
This says that there is no x that is greater than or equal to every y. A logically equivalent form is
∀x∃y(x < y).
Here we have used the fact that for all x and y, ¬(x ≥ y) is logically equivalent to (x < y).
To render the informal proof by contradiction symbolically, we take the first formula above as the goal,
and assume its negation, that is, assume for the sake of contradiction that
1. ∃x∀y(x ≥ y).
Using existential instantiation we may substitute the variable n for x, removing the existential quantifier, to
get the following.
2. ∀y(n ≥ y).
(This corresponds to the step of the informal proof in which we said “Call it n.”) Now we apply universal
instantiation to (2), substituting the individual n + 1 for y and removing the universal quantifier, to get the
following.
3. (n ≥ n + 1).
Now we need an axiom, lemma or theorem relating ≥ and n + 1; we assume we have proved the following
lemma.
4.∀x(x < x + 1).
Using universal instantiation with n for x in this statement, we have
5. (n < n + 1).
Applying Conjunction to (3) and (5), we get the following.
6. (n ≥ n + 1) ∧ (n < n + 1).
And now we need an axiom, lemma or theorem relating < and ≥, so we assume we have proved the following
lemma.
7. ∀x∀y¬((x ≥ y) ∧ (x < y)).
This says that we never have both (x ≥ y) and (x < y). We now apply universal instantiation, first
substituting n for x and then substituting n + 1 for y to give
8. ∀y¬((n ≥ y) ∧ (n < y)),
Computer Science 202a, Prof. Dana Angluin
2
and then
9. ¬((n ≥ n + 1) ∧ (n < n + 1)).
Combining (6) and (9) and using the logical equivalence
p ∧ ¬p ≡ 0,
we get
10. 0.
We have derived the contradiction 0 from the assumption (1), so we conclude that its negation is true, that
is,
¬∃x∀y(x ≥ y),
which is what we set out to prove.
Proof that n is even if and only if n2 is even
We specify predicates E(n) (for n is even) and O(n) (for n is odd), and a function q(n) = n2 . We can
(informally) show that if n is even, then n2 is even as follows. Proof: if n is even, then n = 2m for some
integer m, and n2 = 4m2 = 2(2m2 ). Because n2 is expressed as twice an integer, n2 is even. This we can
express symbolically as a lemma as follows.
1. ∀n(E(n) → E(q(n)).
Similarly, we can (informally) show that if n is odd, then n2 is odd as follows. Proof: if n is odd, then
n = 2m + 1 for some integer m, and n2 = 4m2 + 4m + 1 = 2(2m2 + 2m) + 1. Because n2 is expressed as one
more than twice an integer, n2 is odd. We have another lemma, expressed symbolically as follows.
2. ∀n(O(n) → O(q(n))).
Now suppose we want to prove the following lemma:
∀n(E(n) ↔ E(q(n))).
We note that to prove a biconditional (p ↔ q), it suffices to prove both (p → q) and (q → p). That is, p if
and only if q is equivalent to p implies q and q implies p. This is justified by the logical equivalence:
(p ↔ q) ≡ (p → q) ∧ (q → p).
We also need an axiom, lemma, or theorem that relates even and odd. It suffices to assume the following
lemma.
3. ∀x(E(x) ↔ ¬O(x)).
This says that x is even if and only if it is not odd.
To prove the direction E(q(n)) → E(n), we let n be an arbitrary element and assume E(q(n)) as follows.
4. E(q(n)).
Using Universal Instantiation, substituting q(n) for x in (3), we have the following.
5. E(q(n)) ↔ ¬O(q(n)).
Because
(p ↔ q) → (p → q)
is a tautology, we can derive from (5) that
6. E(q(n)) → ¬O(q(n)).
Computer Science 202a, Prof. Dana Angluin
3
Applying Modus Tollens to (4) and (6), we get
7. ¬O(q(n)).
Applying Universal Instantiation to (2) (substituting n for n), we have
8. O(n) → O(q(n)).
Appplying Modus Tollens to (7) and (8), we have
9. ¬O(n).
Once again using Universal Instantiation, substituting n for x in (3), we have
10. E(n) ↔ ¬O(n).
Because
(p ↔ q) → (q → p)
is also a tautology, we have
11. ¬O(n) → E(n).
Applying Modus Ponens to (9) and (11) we get
12. E(n).
Thus, from the assumption (4) we can prove (12), and therefore
13. E(q(n)) → E(n).
Because this was shown for an arbitrary element n, we can apply Universal Instantiation to conclude that
14. ∀n(E(q(n)) → E(n)).
Finally, combining this with (1) we have the desired result:
∀n(E(n) ↔ E(q(n)).
Download