| author | paulson | 
| Mon, 21 Jan 2002 10:52:05 +0100 | |
| changeset 12819 | 2f61bca07de7 | 
| parent 12408 | 2884148a9fe9 | 
| child 13550 | 5a176b8dda84 | 
| permissions | -rw-r--r-- | 
| 10341 | 1  | 
(* ID: $Id$ *)  | 
| 10295 | 2  | 
theory Basic = Main:  | 
3  | 
||
4  | 
lemma conj_rule: "\<lbrakk> P; Q \<rbrakk> \<Longrightarrow> P \<and> (Q \<and> P)"  | 
|
5  | 
apply (rule conjI)  | 
|
6  | 
apply assumption  | 
|
7  | 
apply (rule conjI)  | 
|
8  | 
apply assumption  | 
|
9  | 
apply assumption  | 
|
10  | 
done  | 
|
11  | 
||
12  | 
||
13  | 
lemma disj_swap: "P | Q \<Longrightarrow> Q | P"  | 
|
14  | 
apply (erule disjE)  | 
|
15  | 
apply (rule disjI2)  | 
|
16  | 
apply assumption  | 
|
17  | 
apply (rule disjI1)  | 
|
18  | 
apply assumption  | 
|
19  | 
done  | 
|
20  | 
||
21  | 
lemma conj_swap: "P \<and> Q \<Longrightarrow> Q \<and> P"  | 
|
22  | 
apply (rule conjI)  | 
|
23  | 
apply (drule conjunct2)  | 
|
24  | 
apply assumption  | 
|
25  | 
apply (drule conjunct1)  | 
|
26  | 
apply assumption  | 
|
27  | 
done  | 
|
28  | 
||
29  | 
lemma imp_uncurry: "P \<longrightarrow> Q \<longrightarrow> R \<Longrightarrow> P \<and> Q \<longrightarrow> R"  | 
|
30  | 
apply (rule impI)  | 
|
31  | 
apply (erule conjE)  | 
|
32  | 
apply (drule mp)  | 
|
33  | 
apply assumption  | 
|
34  | 
apply (drule mp)  | 
|
35  | 
apply assumption  | 
|
36  | 
apply assumption  | 
|
37  | 
done  | 
|
38  | 
||
| 10957 | 39  | 
text {*
 | 
| 10843 | 40  | 
by eliminates uses of assumption and done  | 
41  | 
*}  | 
|
42  | 
||
43  | 
lemma imp_uncurry: "P \<longrightarrow> Q \<longrightarrow> R \<Longrightarrow> P \<and> Q \<longrightarrow> R"  | 
|
44  | 
apply (rule impI)  | 
|
45  | 
apply (erule conjE)  | 
|
46  | 
apply (drule mp)  | 
|
47  | 
apply assumption  | 
|
48  | 
by (drule mp)  | 
|
49  | 
||
50  | 
||
| 10295 | 51  | 
text {*
 | 
52  | 
substitution  | 
|
53  | 
||
54  | 
@{thm[display] ssubst}
 | 
|
55  | 
\rulename{ssubst}
 | 
|
56  | 
*};  | 
|
57  | 
||
58  | 
lemma "\<lbrakk> x = f x; P(f x) \<rbrakk> \<Longrightarrow> P x"  | 
|
| 10843 | 59  | 
by (erule ssubst)  | 
| 10295 | 60  | 
|
61  | 
text {*
 | 
|
62  | 
also provable by simp (re-orients)  | 
|
63  | 
*};  | 
|
64  | 
||
| 11182 | 65  | 
text {*
 | 
66  | 
the subst method  | 
|
67  | 
||
68  | 
@{thm[display] mult_commute}
 | 
|
69  | 
\rulename{mult_commute}
 | 
|
70  | 
||
71  | 
this would fail:  | 
|
72  | 
apply (simp add: mult_commute)  | 
|
73  | 
*};  | 
|
74  | 
||
75  | 
||
76  | 
lemma "\<lbrakk>P x y z; Suc x < y\<rbrakk> \<Longrightarrow> f z = x*y"  | 
|
77  | 
txt{*
 | 
|
78  | 
@{subgoals[display,indent=0,margin=65]}
 | 
|
79  | 
*};  | 
|
80  | 
apply (subst mult_commute)  | 
|
81  | 
txt{*
 | 
|
82  | 
@{subgoals[display,indent=0,margin=65]}
 | 
|
83  | 
*};  | 
|
84  | 
oops  | 
|
85  | 
||
86  | 
(*exercise involving THEN*)  | 
|
87  | 
lemma "\<lbrakk>P x y z; Suc x < y\<rbrakk> \<Longrightarrow> f z = x*y"  | 
|
88  | 
apply (rule mult_commute [THEN ssubst])  | 
|
89  | 
oops  | 
|
90  | 
||
91  | 
||
92  | 
lemma "\<lbrakk>x = f x; triple (f x) (f x) x\<rbrakk> \<Longrightarrow> triple x x x"  | 
|
| 10957 | 93  | 
apply (erule ssubst)  | 
94  | 
  --{* @{subgoals[display,indent=0,margin=65]} *}
 | 
|
95  | 
back --{* @{subgoals[display,indent=0,margin=65]} *}
 | 
|
96  | 
back --{* @{subgoals[display,indent=0,margin=65]} *}
 | 
|
97  | 
back --{* @{subgoals[display,indent=0,margin=65]} *}
 | 
|
98  | 
back --{* @{subgoals[display,indent=0,margin=65]} *}
 | 
|
| 10295 | 99  | 
apply assumption  | 
100  | 
done  | 
|
101  | 
||
| 11182 | 102  | 
lemma "\<lbrakk> x = f x; triple (f x) (f x) x \<rbrakk> \<Longrightarrow> triple x x x"  | 
| 10295 | 103  | 
apply (erule ssubst, assumption)  | 
104  | 
done  | 
|
105  | 
||
| 10843 | 106  | 
text{*
 | 
| 10957 | 107  | 
or better still  | 
| 10843 | 108  | 
*}  | 
109  | 
||
| 11182 | 110  | 
lemma "\<lbrakk> x = f x; triple (f x) (f x) x \<rbrakk> \<Longrightarrow> triple x x x"  | 
| 10843 | 111  | 
by (erule ssubst)  | 
112  | 
||
113  | 
||
| 11182 | 114  | 
lemma "\<lbrakk> x = f x; triple (f x) (f x) x \<rbrakk> \<Longrightarrow> triple x x x"  | 
115  | 
apply (erule_tac P="\<lambda>u. triple u u x" in ssubst)  | 
|
| 10843 | 116  | 
apply (assumption)  | 
| 10295 | 117  | 
done  | 
118  | 
||
119  | 
||
| 11182 | 120  | 
lemma "\<lbrakk> x = f x; triple (f x) (f x) x \<rbrakk> \<Longrightarrow> triple x x x"  | 
121  | 
by (erule_tac P="\<lambda>u. triple u u x" in ssubst)  | 
|
| 10843 | 122  | 
|
123  | 
||
| 10295 | 124  | 
text {*
 | 
125  | 
negation  | 
|
126  | 
||
127  | 
@{thm[display] notI}
 | 
|
128  | 
\rulename{notI}
 | 
|
129  | 
||
130  | 
@{thm[display] notE}
 | 
|
131  | 
\rulename{notE}
 | 
|
132  | 
||
133  | 
@{thm[display] classical}
 | 
|
134  | 
\rulename{classical}
 | 
|
135  | 
||
136  | 
@{thm[display] contrapos_pp}
 | 
|
137  | 
\rulename{contrapos_pp}
 | 
|
138  | 
||
| 11407 | 139  | 
@{thm[display] contrapos_pn}
 | 
140  | 
\rulename{contrapos_pn}
 | 
|
141  | 
||
| 10295 | 142  | 
@{thm[display] contrapos_np}
 | 
143  | 
\rulename{contrapos_np}
 | 
|
144  | 
||
145  | 
@{thm[display] contrapos_nn}
 | 
|
146  | 
\rulename{contrapos_nn}
 | 
|
147  | 
*};  | 
|
148  | 
||
149  | 
||
150  | 
lemma "\<lbrakk>\<not>(P\<longrightarrow>Q); \<not>(R\<longrightarrow>Q)\<rbrakk> \<Longrightarrow> R"  | 
|
151  | 
apply (erule_tac Q="R\<longrightarrow>Q" in contrapos_np)  | 
|
| 10957 | 152  | 
	--{* @{subgoals[display,indent=0,margin=65]} *}
 | 
| 12390 | 153  | 
apply (intro impI)  | 
| 10957 | 154  | 
	--{* @{subgoals[display,indent=0,margin=65]} *}
 | 
| 10843 | 155  | 
by (erule notE)  | 
| 10295 | 156  | 
|
| 
11080
 
22855d091249
various revisions in response to comments from Tobias
 
paulson 
parents: 
10957 
diff
changeset
 | 
157  | 
text {*
 | 
| 
 
22855d091249
various revisions in response to comments from Tobias
 
paulson 
parents: 
10957 
diff
changeset
 | 
158  | 
@{thm[display] disjCI}
 | 
| 
 
22855d091249
various revisions in response to comments from Tobias
 
paulson 
parents: 
10957 
diff
changeset
 | 
159  | 
\rulename{disjCI}
 | 
| 
 
22855d091249
various revisions in response to comments from Tobias
 
paulson 
parents: 
10957 
diff
changeset
 | 
160  | 
*};  | 
| 
 
22855d091249
various revisions in response to comments from Tobias
 
paulson 
parents: 
10957 
diff
changeset
 | 
161  | 
|
| 10295 | 162  | 
lemma "(P \<or> Q) \<and> R \<Longrightarrow> P \<or> Q \<and> R"  | 
| 12408 | 163  | 
apply (intro disjCI conjI)  | 
| 10957 | 164  | 
	--{* @{subgoals[display,indent=0,margin=65]} *}
 | 
| 10295 | 165  | 
|
166  | 
apply (elim conjE disjE)  | 
|
167  | 
apply assumption  | 
|
| 10957 | 168  | 
	--{* @{subgoals[display,indent=0,margin=65]} *}
 | 
| 10295 | 169  | 
|
| 10843 | 170  | 
by (erule contrapos_np, rule conjI)  | 
| 10957 | 171  | 
text{*
 | 
| 10295 | 172  | 
proof\ {\isacharparenleft}prove{\isacharparenright}{\isacharcolon}\ step\ {\isadigit{6}}\isanewline
 | 
173  | 
\isanewline  | 
|
174  | 
goal\ {\isacharparenleft}lemma{\isacharparenright}{\isacharcolon}\isanewline
 | 
|
175  | 
{\isacharparenleft}P\ {\isasymor}\ Q{\isacharparenright}\ {\isasymand}\ R\ {\isasymLongrightarrow}\ P\ {\isasymor}\ Q\ {\isasymand}\ R\isanewline
 | 
|
176  | 
\ {\isadigit{1}}{\isachardot}\ {\isasymlbrakk}R{\isacharsemicolon}\ Q{\isacharsemicolon}\ {\isasymnot}\ P{\isasymrbrakk}\ {\isasymLongrightarrow}\ Q\isanewline
 | 
|
177  | 
\ {\isadigit{2}}{\isachardot}\ {\isasymlbrakk}R{\isacharsemicolon}\ Q{\isacharsemicolon}\ {\isasymnot}\ P{\isasymrbrakk}\ {\isasymLongrightarrow}\ R
 | 
|
178  | 
*}  | 
|
179  | 
||
180  | 
||
| 11182 | 181  | 
text{*rule_tac, etc.*}
 | 
182  | 
||
183  | 
||
184  | 
lemma "P&Q"  | 
|
185  | 
apply (rule_tac P=P and Q=Q in conjI)  | 
|
186  | 
oops  | 
|
187  | 
||
188  | 
||
| 10295 | 189  | 
text{*Quantifiers*}
 | 
190  | 
||
| 
11080
 
22855d091249
various revisions in response to comments from Tobias
 
paulson 
parents: 
10957 
diff
changeset
 | 
191  | 
|
| 
 
22855d091249
various revisions in response to comments from Tobias
 
paulson 
parents: 
10957 
diff
changeset
 | 
192  | 
text {*
 | 
| 
 
22855d091249
various revisions in response to comments from Tobias
 
paulson 
parents: 
10957 
diff
changeset
 | 
193  | 
@{thm[display] allI}
 | 
| 
 
22855d091249
various revisions in response to comments from Tobias
 
paulson 
parents: 
10957 
diff
changeset
 | 
194  | 
\rulename{allI}
 | 
| 
 
22855d091249
various revisions in response to comments from Tobias
 
paulson 
parents: 
10957 
diff
changeset
 | 
195  | 
|
| 
 
22855d091249
various revisions in response to comments from Tobias
 
paulson 
parents: 
10957 
diff
changeset
 | 
196  | 
@{thm[display] allE}
 | 
| 
 
22855d091249
various revisions in response to comments from Tobias
 
paulson 
parents: 
10957 
diff
changeset
 | 
197  | 
\rulename{allE}
 | 
| 
 
22855d091249
various revisions in response to comments from Tobias
 
paulson 
parents: 
10957 
diff
changeset
 | 
198  | 
|
| 
 
22855d091249
various revisions in response to comments from Tobias
 
paulson 
parents: 
10957 
diff
changeset
 | 
199  | 
@{thm[display] spec}
 | 
| 
 
22855d091249
various revisions in response to comments from Tobias
 
paulson 
parents: 
10957 
diff
changeset
 | 
200  | 
\rulename{spec}
 | 
| 
 
22855d091249
various revisions in response to comments from Tobias
 
paulson 
parents: 
10957 
diff
changeset
 | 
201  | 
*};  | 
| 
 
22855d091249
various revisions in response to comments from Tobias
 
paulson 
parents: 
10957 
diff
changeset
 | 
202  | 
|
| 10295 | 203  | 
lemma "\<forall>x. P x \<longrightarrow> P x"  | 
204  | 
apply (rule allI)  | 
|
| 10843 | 205  | 
by (rule impI)  | 
| 10295 | 206  | 
|
207  | 
lemma "(\<forall>x. P \<longrightarrow> Q x) \<Longrightarrow> P \<longrightarrow> (\<forall>x. Q x)"  | 
|
| 10843 | 208  | 
apply (rule impI, rule allI)  | 
| 10295 | 209  | 
apply (drule spec)  | 
| 10843 | 210  | 
by (drule mp)  | 
| 10957 | 211  | 
|
| 
11080
 
22855d091249
various revisions in response to comments from Tobias
 
paulson 
parents: 
10957 
diff
changeset
 | 
212  | 
text{*rename_tac*}
 | 
| 10957 | 213  | 
lemma "x < y \<Longrightarrow> \<forall>x y. P x (f y)"  | 
| 12390 | 214  | 
apply (intro allI)  | 
| 10957 | 215  | 
	--{* @{subgoals[display,indent=0,margin=65]} *}
 | 
216  | 
apply (rename_tac v w)  | 
|
217  | 
	--{* @{subgoals[display,indent=0,margin=65]} *}
 | 
|
218  | 
oops  | 
|
219  | 
||
| 10295 | 220  | 
|
| 10843 | 221  | 
lemma "\<lbrakk>\<forall>x. P x \<longrightarrow> P (h x); P a\<rbrakk> \<Longrightarrow> P(h (h a))"  | 
| 10295 | 222  | 
apply (frule spec)  | 
| 10957 | 223  | 
	--{* @{subgoals[display,indent=0,margin=65]} *}
 | 
| 10295 | 224  | 
apply (drule mp, assumption)  | 
225  | 
apply (drule spec)  | 
|
| 10957 | 226  | 
	--{* @{subgoals[display,indent=0,margin=65]} *}
 | 
| 10843 | 227  | 
by (drule mp)  | 
| 10295 | 228  | 
|
229  | 
lemma "\<lbrakk>\<forall>x. P x \<longrightarrow> P (f x); P a\<rbrakk> \<Longrightarrow> P(f (f a))"  | 
|
230  | 
by blast  | 
|
231  | 
||
| 11234 | 232  | 
|
233  | 
text{*
 | 
|
234  | 
the existential quantifier*}  | 
|
235  | 
||
236  | 
text {*
 | 
|
237  | 
@{thm[display]"exI"}
 | 
|
238  | 
\rulename{exI}
 | 
|
239  | 
||
240  | 
@{thm[display]"exE"}
 | 
|
241  | 
\rulename{exE}
 | 
|
242  | 
*};  | 
|
243  | 
||
244  | 
||
245  | 
text{*
 | 
|
246  | 
instantiating quantifiers explicitly by rule_tac and erule_tac*}  | 
|
247  | 
||
248  | 
lemma "\<lbrakk>\<forall>x. P x \<longrightarrow> P (h x); P a\<rbrakk> \<Longrightarrow> P(h (h a))"  | 
|
249  | 
apply (frule spec)  | 
|
250  | 
	--{* @{subgoals[display,indent=0,margin=65]} *}
 | 
|
251  | 
apply (drule mp, assumption)  | 
|
252  | 
	--{* @{subgoals[display,indent=0,margin=65]} *}
 | 
|
253  | 
apply (drule_tac x = "h a" in spec)  | 
|
254  | 
	--{* @{subgoals[display,indent=0,margin=65]} *}
 | 
|
255  | 
by (drule mp)  | 
|
256  | 
||
257  | 
text {*
 | 
|
258  | 
@{thm[display]"dvd_def"}
 | 
|
259  | 
\rulename{dvd_def}
 | 
|
260  | 
*};  | 
|
261  | 
||
262  | 
lemma mult_dvd_mono: "\<lbrakk>i dvd m; j dvd n\<rbrakk> \<Longrightarrow> i*j dvd (m*n :: nat)"  | 
|
263  | 
apply (simp add: dvd_def)  | 
|
264  | 
	--{* @{subgoals[display,indent=0,margin=65]} *}
 | 
|
265  | 
apply (erule exE)  | 
|
266  | 
	--{* @{subgoals[display,indent=0,margin=65]} *}
 | 
|
267  | 
apply (erule exE)  | 
|
268  | 
	--{* @{subgoals[display,indent=0,margin=65]} *}
 | 
|
| 11407 | 269  | 
apply (rename_tac l)  | 
270  | 
	--{* @{subgoals[display,indent=0,margin=65]} *}
 | 
|
271  | 
apply (rule_tac x="k*l" in exI)  | 
|
| 11244 | 272  | 
	--{* @{subgoals[display,indent=0,margin=65]} *}
 | 
| 11234 | 273  | 
apply simp  | 
274  | 
done  | 
|
275  | 
||
| 10957 | 276  | 
text{*
 | 
| 10843 | 277  | 
Hilbert-epsilon theorems*}  | 
278  | 
||
279  | 
text{*
 | 
|
| 11458 | 280  | 
@{thm[display] the_equality[no_vars]}
 | 
281  | 
\rulename{the_equality}
 | 
|
282  | 
||
| 10843 | 283  | 
@{thm[display] some_equality[no_vars]}
 | 
284  | 
\rulename{some_equality}
 | 
|
285  | 
||
286  | 
@{thm[display] someI[no_vars]}
 | 
|
287  | 
\rulename{someI}
 | 
|
288  | 
||
289  | 
@{thm[display] someI2[no_vars]}
 | 
|
290  | 
\rulename{someI2}
 | 
|
291  | 
||
| 
11080
 
22855d091249
various revisions in response to comments from Tobias
 
paulson 
parents: 
10957 
diff
changeset
 | 
292  | 
@{thm[display] someI_ex[no_vars]}
 | 
| 
 
22855d091249
various revisions in response to comments from Tobias
 
paulson 
parents: 
10957 
diff
changeset
 | 
293  | 
\rulename{someI_ex}
 | 
| 
 
22855d091249
various revisions in response to comments from Tobias
 
paulson 
parents: 
10957 
diff
changeset
 | 
294  | 
|
| 10843 | 295  | 
needed for examples  | 
296  | 
||
297  | 
@{thm[display] inv_def[no_vars]}
 | 
|
298  | 
\rulename{inv_def}
 | 
|
299  | 
||
300  | 
@{thm[display] Least_def[no_vars]}
 | 
|
301  | 
\rulename{Least_def}
 | 
|
302  | 
||
303  | 
@{thm[display] order_antisym[no_vars]}
 | 
|
304  | 
\rulename{order_antisym}
 | 
|
305  | 
*}  | 
|
306  | 
||
307  | 
||
| 
11080
 
22855d091249
various revisions in response to comments from Tobias
 
paulson 
parents: 
10957 
diff
changeset
 | 
308  | 
lemma "inv Suc (Suc n) = n"  | 
| 10843 | 309  | 
by (simp add: inv_def)  | 
310  | 
||
311  | 
text{*but we know nothing about inv Suc 0*}
 | 
|
312  | 
||
313  | 
theorem Least_equality:  | 
|
314  | 
"\<lbrakk> P (k::nat); \<forall>x. P x \<longrightarrow> k \<le> x \<rbrakk> \<Longrightarrow> (LEAST x. P(x)) = k"  | 
|
| 11456 | 315  | 
apply (simp add: Least_def)  | 
| 10843 | 316  | 
|
| 11458 | 317  | 
txt{*
 | 
| 10843 | 318  | 
@{subgoals[display,indent=0,margin=65]}
 | 
319  | 
*};  | 
|
320  | 
||
| 11456 | 321  | 
apply (rule the_equality)  | 
| 10843 | 322  | 
|
323  | 
txt{*
 | 
|
324  | 
@{subgoals[display,indent=0,margin=65]}
 | 
|
325  | 
||
326  | 
first subgoal is existence; second is uniqueness  | 
|
327  | 
*};  | 
|
328  | 
by (auto intro: order_antisym)  | 
|
329  | 
||
330  | 
||
331  | 
theorem axiom_of_choice:  | 
|
| 
11080
 
22855d091249
various revisions in response to comments from Tobias
 
paulson 
parents: 
10957 
diff
changeset
 | 
332  | 
"(\<forall>x. \<exists>y. P x y) \<Longrightarrow> \<exists>f. \<forall>x. P x (f x)"  | 
| 10843 | 333  | 
apply (rule exI, rule allI)  | 
334  | 
||
335  | 
txt{*
 | 
|
336  | 
@{subgoals[display,indent=0,margin=65]}
 | 
|
337  | 
||
338  | 
state after intro rules  | 
|
339  | 
*};  | 
|
340  | 
apply (drule spec, erule exE)  | 
|
341  | 
||
342  | 
txt{*
 | 
|
343  | 
@{subgoals[display,indent=0,margin=65]}
 | 
|
344  | 
||
345  | 
applying @text{someI} automatically instantiates
 | 
|
346  | 
@{term f} to @{term "\<lambda>x. SOME y. P x y"}
 | 
|
347  | 
*};  | 
|
348  | 
||
349  | 
by (rule someI)  | 
|
350  | 
||
351  | 
(*both can be done by blast, which however hasn't been introduced yet*)  | 
|
352  | 
lemma "[| P (k::nat); \<forall>x. P x \<longrightarrow> k \<le> x |] ==> (LEAST x. P(x)) = k";  | 
|
| 11154 | 353  | 
apply (simp add: Least_def LeastM_def)  | 
| 10843 | 354  | 
by (blast intro: some_equality order_antisym);  | 
355  | 
||
| 
11080
 
22855d091249
various revisions in response to comments from Tobias
 
paulson 
parents: 
10957 
diff
changeset
 | 
356  | 
theorem axiom_of_choice: "(\<forall>x. \<exists>y. P x y) \<Longrightarrow> \<exists>f. \<forall>x. P x (f x)"  | 
| 10843 | 357  | 
apply (rule exI [of _ "\<lambda>x. SOME y. P x y"])  | 
358  | 
by (blast intro: someI);  | 
|
359  | 
||
| 10957 | 360  | 
text{*end of Epsilon section*}
 | 
361  | 
||
| 10843 | 362  | 
|
| 10295 | 363  | 
lemma "(\<exists>x. P x) \<or> (\<exists>x. Q x) \<Longrightarrow> \<exists>x. P x \<or> Q x"  | 
| 12390 | 364  | 
apply (elim exE disjE)  | 
| 12408 | 365  | 
apply (intro exI disjI1)  | 
| 10295 | 366  | 
apply assumption  | 
| 12408 | 367  | 
apply (intro exI disjI2)  | 
| 10295 | 368  | 
apply assumption  | 
369  | 
done  | 
|
370  | 
||
371  | 
lemma "(P\<longrightarrow>Q) \<or> (Q\<longrightarrow>P)"  | 
|
| 12390 | 372  | 
apply (intro disjCI impI)  | 
373  | 
apply (elim notE)  | 
|
374  | 
apply (intro impI)  | 
|
| 10295 | 375  | 
apply assumption  | 
376  | 
done  | 
|
377  | 
||
378  | 
lemma "(P\<or>Q)\<and>(P\<or>R) \<Longrightarrow> P \<or> (Q\<and>R)"  | 
|
| 12390 | 379  | 
apply (intro disjCI conjI)  | 
| 10295 | 380  | 
apply (elim conjE disjE)  | 
381  | 
apply blast  | 
|
382  | 
apply blast  | 
|
383  | 
apply blast  | 
|
384  | 
apply blast  | 
|
385  | 
(*apply elim*)  | 
|
386  | 
done  | 
|
387  | 
||
388  | 
lemma "(\<exists>x. P \<and> Q x) \<Longrightarrow> P \<and> (\<exists>x. Q x)"  | 
|
389  | 
apply (erule exE)  | 
|
390  | 
apply (erule conjE)  | 
|
391  | 
apply (rule conjI)  | 
|
392  | 
apply assumption  | 
|
393  | 
apply (rule exI)  | 
|
394  | 
apply assumption  | 
|
395  | 
done  | 
|
396  | 
||
397  | 
lemma "(\<exists>x. P x) \<and> (\<exists>x. Q x) \<Longrightarrow> \<exists>x. P x \<and> Q x"  | 
|
398  | 
apply (erule conjE)  | 
|
399  | 
apply (erule exE)  | 
|
400  | 
apply (erule exE)  | 
|
401  | 
apply (rule exI)  | 
|
402  | 
apply (rule conjI)  | 
|
403  | 
apply assumption  | 
|
404  | 
oops  | 
|
405  | 
||
| 11407 | 406  | 
lemma "\<forall>y. R y y \<Longrightarrow> \<exists>x. \<forall>y. R x y"  | 
| 
11080
 
22855d091249
various revisions in response to comments from Tobias
 
paulson 
parents: 
10957 
diff
changeset
 | 
407  | 
apply (rule exI)  | 
| 
 
22855d091249
various revisions in response to comments from Tobias
 
paulson 
parents: 
10957 
diff
changeset
 | 
408  | 
  --{* @{subgoals[display,indent=0,margin=65]} *}
 | 
| 
 
22855d091249
various revisions in response to comments from Tobias
 
paulson 
parents: 
10957 
diff
changeset
 | 
409  | 
apply (rule allI)  | 
| 
 
22855d091249
various revisions in response to comments from Tobias
 
paulson 
parents: 
10957 
diff
changeset
 | 
410  | 
  --{* @{subgoals[display,indent=0,margin=65]} *}
 | 
| 
 
22855d091249
various revisions in response to comments from Tobias
 
paulson 
parents: 
10957 
diff
changeset
 | 
411  | 
apply (drule spec)  | 
| 
 
22855d091249
various revisions in response to comments from Tobias
 
paulson 
parents: 
10957 
diff
changeset
 | 
412  | 
  --{* @{subgoals[display,indent=0,margin=65]} *}
 | 
| 10295 | 413  | 
oops  | 
414  | 
||
| 11407 | 415  | 
lemma "\<forall>x. \<exists>y. x=y"  | 
| 10295 | 416  | 
apply (rule allI)  | 
417  | 
apply (rule exI)  | 
|
418  | 
apply (rule refl)  | 
|
419  | 
done  | 
|
420  | 
||
| 11407 | 421  | 
lemma "\<exists>x. \<forall>y. x=y"  | 
| 10295 | 422  | 
apply (rule exI)  | 
423  | 
apply (rule allI)  | 
|
424  | 
oops  | 
|
425  | 
||
426  | 
end  |