41959
|
1 |
(* Title: Sequents/LK/Quantifiers.thy
|
21426
|
2 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory
|
|
3 |
Copyright 1992 University of Cambridge
|
|
4 |
|
|
5 |
Classical sequent calculus: examples with quantifiers.
|
|
6 |
*)
|
|
7 |
|
|
8 |
theory Quantifiers
|
55229
|
9 |
imports "../LK"
|
21426
|
10 |
begin
|
|
11 |
|
61386
|
12 |
lemma "\<turnstile> (\<forall>x. P) \<longleftrightarrow> P"
|
21426
|
13 |
by fast
|
|
14 |
|
61386
|
15 |
lemma "\<turnstile> (\<forall>x y. P(x,y)) \<longleftrightarrow> (\<forall>y x. P(x,y))"
|
21426
|
16 |
by fast
|
|
17 |
|
61386
|
18 |
lemma "\<forall>u. P(u), \<forall>v. Q(v) \<turnstile> \<forall>u v. P(u) \<and> Q(v)"
|
21426
|
19 |
by fast
|
|
20 |
|
|
21 |
|
|
22 |
text "Permutation of existential quantifier."
|
|
23 |
|
61386
|
24 |
lemma "\<turnstile> (\<exists>x y. P(x,y)) \<longleftrightarrow> (\<exists>y x. P(x,y))"
|
21426
|
25 |
by fast
|
|
26 |
|
61386
|
27 |
lemma "\<turnstile> (\<forall>x. P(x) \<and> Q(x)) \<longleftrightarrow> (\<forall>x. P(x)) \<and> (\<forall>x. Q(x))"
|
21426
|
28 |
by fast
|
|
29 |
|
|
30 |
(*Converse is invalid*)
|
61386
|
31 |
lemma "\<turnstile> (\<forall>x. P(x)) \<or> (\<forall>x. Q(x)) \<longrightarrow> (\<forall>x. P(x) \<or> Q(x))"
|
21426
|
32 |
by fast
|
|
33 |
|
|
34 |
|
61385
|
35 |
text "Pushing \<forall>into an implication."
|
21426
|
36 |
|
61386
|
37 |
lemma "\<turnstile> (\<forall>x. P \<longrightarrow> Q(x)) \<longleftrightarrow> (P \<longrightarrow> (\<forall>x. Q(x)))"
|
21426
|
38 |
by fast
|
|
39 |
|
61386
|
40 |
lemma "\<turnstile> (\<forall>x. P(x) \<longrightarrow> Q) \<longleftrightarrow> ((\<exists>x. P(x)) \<longrightarrow> Q)"
|
21426
|
41 |
by fast
|
|
42 |
|
61386
|
43 |
lemma "\<turnstile> (\<exists>x. P) \<longleftrightarrow> P"
|
21426
|
44 |
by fast
|
|
45 |
|
|
46 |
|
61385
|
47 |
text "Distribution of \<exists>over disjunction."
|
21426
|
48 |
|
61386
|
49 |
lemma "\<turnstile> (\<exists>x. P(x) \<or> Q(x)) \<longleftrightarrow> (\<exists>x. P(x)) \<or> (\<exists>x. Q(x))"
|
21426
|
50 |
by fast
|
|
51 |
|
|
52 |
(*Converse is invalid*)
|
61386
|
53 |
lemma "\<turnstile> (\<exists>x. P(x) \<and> Q(x)) \<longrightarrow> (\<exists>x. P(x)) \<and> (\<exists>x. Q(x))"
|
21426
|
54 |
by fast
|
|
55 |
|
|
56 |
|
|
57 |
text "Harder examples: classical theorems."
|
|
58 |
|
61386
|
59 |
lemma "\<turnstile> (\<exists>x. P \<longrightarrow> Q(x)) \<longleftrightarrow> (P \<longrightarrow> (\<exists>x. Q(x)))"
|
21426
|
60 |
by fast
|
|
61 |
|
61386
|
62 |
lemma "\<turnstile> (\<exists>x. P(x) \<longrightarrow> Q) \<longleftrightarrow> (\<forall>x. P(x)) \<longrightarrow> Q"
|
21426
|
63 |
by fast
|
|
64 |
|
61386
|
65 |
lemma "\<turnstile> (\<forall>x. P(x)) \<or> Q \<longleftrightarrow> (\<forall>x. P(x) \<or> Q)"
|
21426
|
66 |
by fast
|
|
67 |
|
|
68 |
|
|
69 |
text "Basic test of quantifier reasoning"
|
|
70 |
|
61386
|
71 |
lemma "\<turnstile> (\<exists>y. \<forall>x. Q(x,y)) \<longrightarrow> (\<forall>x. \<exists>y. Q(x,y))"
|
21426
|
72 |
by fast
|
|
73 |
|
61386
|
74 |
lemma "\<turnstile> (\<forall>x. Q(x)) \<longrightarrow> (\<exists>x. Q(x))"
|
21426
|
75 |
by fast
|
|
76 |
|
|
77 |
|
|
78 |
text "The following are invalid!"
|
|
79 |
|
|
80 |
(*INVALID*)
|
61386
|
81 |
lemma "\<turnstile> (\<forall>x. \<exists>y. Q(x,y)) \<longrightarrow> (\<exists>y. \<forall>x. Q(x,y))"
|
21426
|
82 |
apply fast?
|
|
83 |
apply (rule _)
|
|
84 |
oops
|
|
85 |
|
|
86 |
(*INVALID*)
|
61386
|
87 |
lemma "\<turnstile> (\<exists>x. Q(x)) \<longrightarrow> (\<forall>x. Q(x))"
|
21426
|
88 |
apply fast?
|
|
89 |
apply (rule _)
|
|
90 |
oops
|
|
91 |
|
|
92 |
(*INVALID*)
|
61386
|
93 |
schematic_goal "\<turnstile> P(?a) \<longrightarrow> (\<forall>x. P(x))"
|
21426
|
94 |
apply fast?
|
|
95 |
apply (rule _)
|
|
96 |
oops
|
|
97 |
|
|
98 |
(*INVALID*)
|
61386
|
99 |
schematic_goal "\<turnstile> (P(?a) \<longrightarrow> (\<forall>x. Q(x))) \<longrightarrow> (\<forall>x. P(x) \<longrightarrow> Q(x))"
|
21426
|
100 |
apply fast?
|
|
101 |
apply (rule _)
|
|
102 |
oops
|
|
103 |
|
|
104 |
|
|
105 |
text "Back to things that are provable..."
|
|
106 |
|
61386
|
107 |
lemma "\<turnstile> (\<forall>x. P(x) \<longrightarrow> Q(x)) \<and> (\<exists>x. P(x)) \<longrightarrow> (\<exists>x. Q(x))"
|
21426
|
108 |
by fast
|
|
109 |
|
|
110 |
(*An example of why exR should be delayed as long as possible*)
|
61386
|
111 |
lemma "\<turnstile> (P \<longrightarrow> (\<exists>x. Q(x))) \<and> P \<longrightarrow> (\<exists>x. Q(x))"
|
21426
|
112 |
by fast
|
|
113 |
|
|
114 |
|
|
115 |
text "Solving for a Var"
|
|
116 |
|
61386
|
117 |
schematic_goal "\<turnstile> (\<forall>x. P(x) \<longrightarrow> Q(f(x))) \<and> (\<forall>x. Q(x) \<longrightarrow> R(g(x))) \<and> P(d) \<longrightarrow> R(?a)"
|
21426
|
118 |
by fast
|
|
119 |
|
|
120 |
|
|
121 |
text "Principia Mathematica *11.53"
|
|
122 |
|
61386
|
123 |
lemma "\<turnstile> (\<forall>x y. P(x) \<longrightarrow> Q(y)) \<longleftrightarrow> ((\<exists>x. P(x)) \<longrightarrow> (\<forall>y. Q(y)))"
|
21426
|
124 |
by fast
|
|
125 |
|
|
126 |
|
|
127 |
text "Principia Mathematica *11.55"
|
|
128 |
|
61386
|
129 |
lemma "\<turnstile> (\<exists>x y. P(x) \<and> Q(x,y)) \<longleftrightarrow> (\<exists>x. P(x) \<and> (\<exists>y. Q(x,y)))"
|
21426
|
130 |
by fast
|
|
131 |
|
|
132 |
|
|
133 |
text "Principia Mathematica *11.61"
|
|
134 |
|
61386
|
135 |
lemma "\<turnstile> (\<exists>y. \<forall>x. P(x) \<longrightarrow> Q(x,y)) \<longrightarrow> (\<forall>x. P(x) \<longrightarrow> (\<exists>y. Q(x,y)))"
|
21426
|
136 |
by fast
|
|
137 |
|
|
138 |
|
|
139 |
(*21 August 88: loaded in 45.7 secs*)
|
|
140 |
(*18 September 2005: loaded in 0.114 secs*)
|
|
141 |
|
|
142 |
end
|