16356
|
1 |
(* Title: HOL/Isar_examples/Drinker.thy
|
|
2 |
ID: $Id$
|
|
3 |
Author: Makarius
|
|
4 |
*)
|
|
5 |
|
|
6 |
header {* The Drinker's Principle *}
|
|
7 |
|
|
8 |
theory Drinker = Main:
|
|
9 |
|
|
10 |
text {*
|
|
11 |
Two parts of de-Morgan's law -- one intuitionistic and one classical:
|
|
12 |
*}
|
|
13 |
|
|
14 |
lemma deMorgan1: "\<not> (\<exists>x. P x) \<Longrightarrow> \<forall>x. \<not> P x"
|
|
15 |
proof -
|
|
16 |
assume a: "\<not> (\<exists>x. P x)"
|
|
17 |
show ?thesis
|
|
18 |
proof
|
|
19 |
fix x
|
|
20 |
show "\<not> P x"
|
|
21 |
proof
|
|
22 |
assume "P x"
|
|
23 |
then have "\<exists>x. P x" ..
|
|
24 |
with a show False by contradiction
|
|
25 |
qed
|
|
26 |
qed
|
|
27 |
qed
|
|
28 |
|
|
29 |
lemma deMorgan2: "\<not> (\<forall>x. P x) \<Longrightarrow> \<exists>x. \<not> P x"
|
|
30 |
proof (rule classical)
|
|
31 |
assume a: "\<not> (\<forall>x. P x)"
|
|
32 |
assume b: "\<not> (\<exists>x. \<not> P x)"
|
|
33 |
have "\<forall>x. P x"
|
|
34 |
proof
|
|
35 |
fix x
|
|
36 |
show "P x"
|
|
37 |
proof (rule classical)
|
|
38 |
assume c: "\<not> P x"
|
|
39 |
from b have "\<forall>x. \<not> \<not> P x" by (rule deMorgan1)
|
|
40 |
then have "\<not> \<not> P x" ..
|
|
41 |
with c show ?thesis by contradiction
|
|
42 |
qed
|
|
43 |
qed
|
|
44 |
with a show ?thesis by contradiction
|
|
45 |
qed
|
|
46 |
|
|
47 |
text {*
|
|
48 |
Here is another example of classical reasoning: the Drinker's
|
|
49 |
Principle says that for some person, if he is drunk, everybody else
|
|
50 |
is drunk!
|
|
51 |
*}
|
|
52 |
|
|
53 |
theorem Drinker's_Principle: "\<exists>x. drunk x \<longrightarrow> (\<forall>x. drunk x)"
|
|
54 |
proof cases
|
|
55 |
fix a assume "\<forall>x. drunk x"
|
|
56 |
then have "drunk a \<longrightarrow> (\<forall>x. drunk x)" ..
|
|
57 |
then show ?thesis ..
|
|
58 |
next
|
|
59 |
assume "\<not> (\<forall>x. drunk x)"
|
|
60 |
then have "\<exists>x. \<not> drunk x" by (rule deMorgan2)
|
|
61 |
then obtain a where a: "\<not> drunk a" ..
|
|
62 |
have "drunk a \<longrightarrow> (\<forall>x. drunk x)"
|
|
63 |
proof
|
|
64 |
assume "drunk a"
|
|
65 |
with a show "\<forall>x. drunk x" by (contradiction)
|
|
66 |
qed
|
|
67 |
then show ?thesis ..
|
|
68 |
qed
|
|
69 |
|
|
70 |
end
|