author | haftmann |
Wed, 25 Nov 2009 11:16:57 +0100 | |
changeset 33960 | 53993394ac19 |
parent 33026 | 8f35633c4922 |
child 37671 | fa53d267dab3 |
permissions | -rw-r--r-- |
33026 | 1 |
(* Title: HOL/Isar_Examples/Cantor.thy |
6444
2ebe9e630cab
Miscellaneous Isabelle/Isar examples for Higher-Order Logic.
wenzelm
parents:
diff
changeset
|
2 |
Author: Markus Wenzel, TU Muenchen |
2ebe9e630cab
Miscellaneous Isabelle/Isar examples for Higher-Order Logic.
wenzelm
parents:
diff
changeset
|
3 |
*) |
2ebe9e630cab
Miscellaneous Isabelle/Isar examples for Higher-Order Logic.
wenzelm
parents:
diff
changeset
|
4 |
|
10007 | 5 |
header {* Cantor's Theorem *} |
6444
2ebe9e630cab
Miscellaneous Isabelle/Isar examples for Higher-Order Logic.
wenzelm
parents:
diff
changeset
|
6 |
|
31758 | 7 |
theory Cantor |
8 |
imports Main |
|
9 |
begin |
|
7955 | 10 |
|
11 |
text_raw {* |
|
12388 | 12 |
\footnote{This is an Isar version of the final example of the |
13 |
Isabelle/HOL manual \cite{isabelle-HOL}.} |
|
10007 | 14 |
*} |
7819 | 15 |
|
16 |
text {* |
|
12388 | 17 |
Cantor's Theorem states that every set has more subsets than it has |
18 |
elements. It has become a favorite basic example in pure |
|
19 |
higher-order logic since it is so easily expressed: \[\all{f::\alpha |
|
20 |
\To \alpha \To \idt{bool}} \ex{S::\alpha \To \idt{bool}} |
|
21 |
\all{x::\alpha} f \ap x \not= S\] |
|
22 |
||
23 |
Viewing types as sets, $\alpha \To \idt{bool}$ represents the |
|
24 |
powerset of $\alpha$. This version of the theorem states that for |
|
25 |
every function from $\alpha$ to its powerset, some subset is outside |
|
26 |
its range. The Isabelle/Isar proofs below uses HOL's set theory, |
|
27 |
with the type $\alpha \ap \idt{set}$ and the operator |
|
28 |
$\idt{range}::(\alpha \To \beta) \To \beta \ap \idt{set}$. |
|
10007 | 29 |
*} |
6505 | 30 |
|
10007 | 31 |
theorem "EX S. S ~: range (f :: 'a => 'a set)" |
32 |
proof |
|
33 |
let ?S = "{x. x ~: f x}" |
|
34 |
show "?S ~: range f" |
|
35 |
proof |
|
36 |
assume "?S : range f" |
|
12388 | 37 |
then obtain y where "?S = f y" .. |
23373 | 38 |
then show False |
12388 | 39 |
proof (rule equalityCE) |
40 |
assume "y : f y" |
|
23373 | 41 |
assume "y : ?S" then have "y ~: f y" .. |
42 |
with `y : f y` show ?thesis by contradiction |
|
12388 | 43 |
next |
44 |
assume "y ~: ?S" |
|
23373 | 45 |
assume "y ~: f y" then have "y : ?S" .. |
46 |
with `y ~: ?S` show ?thesis by contradiction |
|
10007 | 47 |
qed |
48 |
qed |
|
49 |
qed |
|
6494 | 50 |
|
6744 | 51 |
text {* |
12388 | 52 |
How much creativity is required? As it happens, Isabelle can prove |
53 |
this theorem automatically using best-first search. Depth-first |
|
54 |
search would diverge, but best-first search successfully navigates |
|
55 |
through the large search space. The context of Isabelle's classical |
|
56 |
prover contains rules for the relevant constructs of HOL's set |
|
57 |
theory. |
|
10007 | 58 |
*} |
6505 | 59 |
|
10007 | 60 |
theorem "EX S. S ~: range (f :: 'a => 'a set)" |
61 |
by best |
|
6494 | 62 |
|
6744 | 63 |
text {* |
12388 | 64 |
While this establishes the same theorem internally, we do not get |
65 |
any idea of how the proof actually works. There is currently no way |
|
66 |
to transform internal system-level representations of Isabelle |
|
67 |
proofs back into Isar text. Writing intelligible proof documents |
|
68 |
really is a creative process, after all. |
|
10007 | 69 |
*} |
6444
2ebe9e630cab
Miscellaneous Isabelle/Isar examples for Higher-Order Logic.
wenzelm
parents:
diff
changeset
|
70 |
|
10007 | 71 |
end |