7357
|
1 |
(* Title: HOL/HOL_lemmas.ML
|
|
2 |
ID: $Id$
|
|
3 |
Author: Tobias Nipkow
|
|
4 |
Copyright 1991 University of Cambridge
|
|
5 |
|
|
6 |
Derived rules from Appendix of Mike Gordons HOL Report, Cambridge TR 68.
|
|
7 |
*)
|
|
8 |
|
|
9 |
(* ML bindings *)
|
|
10 |
|
|
11 |
val plusI = thm "plusI";
|
|
12 |
val minusI = thm "minusI";
|
|
13 |
val timesI = thm "timesI";
|
|
14 |
val eq_reflection = thm "eq_reflection";
|
|
15 |
val refl = thm "refl";
|
|
16 |
val subst = thm "subst";
|
|
17 |
val ext = thm "ext";
|
9970
|
18 |
val someI = thm "someI";
|
7357
|
19 |
val impI = thm "impI";
|
|
20 |
val mp = thm "mp";
|
|
21 |
val True_def = thm "True_def";
|
|
22 |
val All_def = thm "All_def";
|
|
23 |
val Ex_def = thm "Ex_def";
|
|
24 |
val False_def = thm "False_def";
|
|
25 |
val not_def = thm "not_def";
|
|
26 |
val and_def = thm "and_def";
|
|
27 |
val or_def = thm "or_def";
|
|
28 |
val Ex1_def = thm "Ex1_def";
|
|
29 |
val iff = thm "iff";
|
|
30 |
val True_or_False = thm "True_or_False";
|
|
31 |
val Let_def = thm "Let_def";
|
|
32 |
val if_def = thm "if_def";
|
|
33 |
val arbitrary_def = thm "arbitrary_def";
|
|
34 |
|
|
35 |
|
10063
|
36 |
section "Equality";
|
7357
|
37 |
|
7618
|
38 |
Goal "s=t ==> t=s";
|
|
39 |
by (etac subst 1);
|
|
40 |
by (rtac refl 1);
|
|
41 |
qed "sym";
|
7357
|
42 |
|
|
43 |
(*calling "standard" reduces maxidx to 0*)
|
7618
|
44 |
bind_thm ("ssubst", sym RS subst);
|
7357
|
45 |
|
7618
|
46 |
Goal "[| r=s; s=t |] ==> r=t";
|
|
47 |
by (etac subst 1 THEN assume_tac 1);
|
|
48 |
qed "trans";
|
7357
|
49 |
|
9969
|
50 |
val prems = goal (the_context()) "(A == B) ==> A = B";
|
7357
|
51 |
by (rewrite_goals_tac prems);
|
|
52 |
by (rtac refl 1);
|
|
53 |
qed "def_imp_eq";
|
|
54 |
|
|
55 |
(*Useful with eresolve_tac for proving equalties from known equalities.
|
|
56 |
a = b
|
|
57 |
| |
|
|
58 |
c = d *)
|
|
59 |
Goal "[| a=b; a=c; b=d |] ==> c=d";
|
|
60 |
by (rtac trans 1);
|
|
61 |
by (rtac trans 1);
|
|
62 |
by (rtac sym 1);
|
|
63 |
by (REPEAT (assume_tac 1)) ;
|
|
64 |
qed "box_equals";
|
|
65 |
|
10063
|
66 |
|
|
67 |
section "Congruence rules for application";
|
7357
|
68 |
|
|
69 |
(*similar to AP_THM in Gordon's HOL*)
|
7618
|
70 |
Goal "(f::'a=>'b) = g ==> f(x)=g(x)";
|
|
71 |
by (etac subst 1);
|
|
72 |
by (rtac refl 1);
|
|
73 |
qed "fun_cong";
|
7357
|
74 |
|
|
75 |
(*similar to AP_TERM in Gordon's HOL and FOL's subst_context*)
|
7618
|
76 |
Goal "x=y ==> f(x)=f(y)";
|
|
77 |
by (etac subst 1);
|
|
78 |
by (rtac refl 1);
|
|
79 |
qed "arg_cong";
|
7357
|
80 |
|
7618
|
81 |
Goal "[| f = g; (x::'a) = y |] ==> f(x) = g(y)";
|
|
82 |
by (etac subst 1);
|
|
83 |
by (etac subst 1);
|
|
84 |
by (rtac refl 1);
|
|
85 |
qed "cong";
|
7357
|
86 |
|
10063
|
87 |
|
|
88 |
section "Equality of booleans -- iff";
|
7357
|
89 |
|
7618
|
90 |
val prems = Goal "[| P ==> Q; Q ==> P |] ==> P=Q";
|
7357
|
91 |
by (REPEAT (ares_tac (prems@[impI, iff RS mp RS mp]) 1));
|
|
92 |
qed "iffI";
|
|
93 |
|
7618
|
94 |
Goal "[| P=Q; Q |] ==> P";
|
|
95 |
by (etac ssubst 1);
|
|
96 |
by (assume_tac 1);
|
|
97 |
qed "iffD2";
|
7357
|
98 |
|
7618
|
99 |
Goal "[| Q; P=Q |] ==> P";
|
|
100 |
by (etac iffD2 1);
|
|
101 |
by (assume_tac 1);
|
|
102 |
qed "rev_iffD2";
|
7357
|
103 |
|
|
104 |
bind_thm ("iffD1", sym RS iffD2);
|
|
105 |
bind_thm ("rev_iffD1", sym RSN (2, rev_iffD2));
|
|
106 |
|
7618
|
107 |
val [p1,p2] = Goal "[| P=Q; [| P --> Q; Q --> P |] ==> R |] ==> R";
|
|
108 |
by (REPEAT (ares_tac [p1 RS iffD2, p1 RS iffD1, p2, impI] 1));
|
|
109 |
qed "iffE";
|
7357
|
110 |
|
|
111 |
|
|
112 |
section "True";
|
|
113 |
|
7618
|
114 |
Goalw [True_def] "True";
|
|
115 |
by (rtac refl 1);
|
|
116 |
qed "TrueI";
|
7357
|
117 |
|
7618
|
118 |
Goal "P ==> P=True";
|
|
119 |
by (REPEAT (ares_tac [iffI,TrueI] 1));
|
|
120 |
qed "eqTrueI";
|
7357
|
121 |
|
7618
|
122 |
Goal "P=True ==> P";
|
|
123 |
by (etac iffD2 1);
|
|
124 |
by (rtac TrueI 1);
|
|
125 |
qed "eqTrueE";
|
7357
|
126 |
|
|
127 |
|
10063
|
128 |
section "Universal quantifier";
|
7357
|
129 |
|
9159
|
130 |
val prems = Goalw [All_def] "(!!x::'a. P(x)) ==> ALL x. P(x)";
|
8529
|
131 |
by (resolve_tac (prems RL [eqTrueI RS ext]) 1);
|
|
132 |
qed "allI";
|
7357
|
133 |
|
9159
|
134 |
Goalw [All_def] "ALL x::'a. P(x) ==> P(x)";
|
8529
|
135 |
by (rtac eqTrueE 1);
|
|
136 |
by (etac fun_cong 1);
|
|
137 |
qed "spec";
|
7357
|
138 |
|
9969
|
139 |
val major::prems = Goal "[| ALL x. P(x); P(x) ==> R |] ==> R";
|
7357
|
140 |
by (REPEAT (resolve_tac (prems @ [major RS spec]) 1)) ;
|
|
141 |
qed "allE";
|
|
142 |
|
9969
|
143 |
val prems = Goal
|
9159
|
144 |
"[| ALL x. P(x); [| P(x); ALL x. P(x) |] ==> R |] ==> R";
|
7357
|
145 |
by (REPEAT (resolve_tac (prems @ (prems RL [spec])) 1)) ;
|
|
146 |
qed "all_dupE";
|
|
147 |
|
|
148 |
|
|
149 |
section "False";
|
10063
|
150 |
(*Depends upon spec; it is impossible to do propositional logic before quantifiers!*)
|
7357
|
151 |
|
8529
|
152 |
Goalw [False_def] "False ==> P";
|
|
153 |
by (etac spec 1);
|
|
154 |
qed "FalseE";
|
7357
|
155 |
|
8529
|
156 |
Goal "False=True ==> P";
|
|
157 |
by (etac (eqTrueE RS FalseE) 1);
|
|
158 |
qed "False_neq_True";
|
7357
|
159 |
|
|
160 |
|
10063
|
161 |
section "Negation";
|
7357
|
162 |
|
8529
|
163 |
val prems = Goalw [not_def] "(P ==> False) ==> ~P";
|
|
164 |
by (rtac impI 1);
|
|
165 |
by (eresolve_tac prems 1);
|
|
166 |
qed "notI";
|
7357
|
167 |
|
8529
|
168 |
Goal "False ~= True";
|
|
169 |
by (rtac notI 1);
|
|
170 |
by (etac False_neq_True 1);
|
|
171 |
qed "False_not_True";
|
7357
|
172 |
|
8529
|
173 |
Goal "True ~= False";
|
|
174 |
by (rtac notI 1);
|
|
175 |
by (dtac sym 1);
|
|
176 |
by (etac False_neq_True 1);
|
|
177 |
qed "True_not_False";
|
7357
|
178 |
|
8529
|
179 |
Goalw [not_def] "[| ~P; P |] ==> R";
|
|
180 |
by (etac (mp RS FalseE) 1);
|
|
181 |
by (assume_tac 1);
|
|
182 |
qed "notE";
|
7357
|
183 |
|
9159
|
184 |
(* Alternative ~ introduction rule: [| P ==> ~ Pa; P ==> Pa |] ==> ~ P *)
|
|
185 |
bind_thm ("notI2", notE RS notI);
|
7357
|
186 |
|
|
187 |
|
10063
|
188 |
section "Implication";
|
7357
|
189 |
|
|
190 |
val prems = Goal "[| P-->Q; P; Q ==> R |] ==> R";
|
|
191 |
by (REPEAT (resolve_tac (prems@[mp]) 1));
|
|
192 |
qed "impE";
|
|
193 |
|
|
194 |
(* Reduces Q to P-->Q, allowing substitution in P. *)
|
|
195 |
Goal "[| P; P --> Q |] ==> Q";
|
|
196 |
by (REPEAT (ares_tac [mp] 1)) ;
|
|
197 |
qed "rev_mp";
|
|
198 |
|
|
199 |
val [major,minor] = Goal "[| ~Q; P==>Q |] ==> ~P";
|
|
200 |
by (rtac (major RS notE RS notI) 1);
|
|
201 |
by (etac minor 1) ;
|
10231
|
202 |
qed "contrapos_nn";
|
7357
|
203 |
|
11415
|
204 |
(*not used at all, but we already have the other 3 combinations *)
|
|
205 |
val [major,minor] = Goal "[| Q; P ==> ~Q |] ==> ~P";
|
|
206 |
by (rtac (minor RS notE RS notI) 1);
|
|
207 |
by (assume_tac 1);
|
|
208 |
by (rtac major 1) ;
|
|
209 |
qed "contrapos_pn";
|
|
210 |
|
10231
|
211 |
Goal "t ~= s ==> s ~= t";
|
|
212 |
by (etac contrapos_nn 1);
|
|
213 |
by (etac sym 1);
|
|
214 |
qed "not_sym";
|
|
215 |
|
|
216 |
(*still used in HOLCF*)
|
7357
|
217 |
val [major,minor] = Goal "[| P==>Q; ~Q |] ==> ~P";
|
10231
|
218 |
by (rtac (minor RS contrapos_nn) 1);
|
7357
|
219 |
by (etac major 1) ;
|
|
220 |
qed "rev_contrapos";
|
|
221 |
|
10063
|
222 |
section "Existential quantifier";
|
7357
|
223 |
|
9159
|
224 |
Goalw [Ex_def] "P x ==> EX x::'a. P x";
|
9970
|
225 |
by (etac someI 1) ;
|
8529
|
226 |
qed "exI";
|
7357
|
227 |
|
9869
|
228 |
val [major,minor] =
|
9159
|
229 |
Goalw [Ex_def] "[| EX x::'a. P(x); !!x. P(x) ==> Q |] ==> Q";
|
8529
|
230 |
by (rtac (major RS minor) 1);
|
|
231 |
qed "exE";
|
7357
|
232 |
|
|
233 |
|
10063
|
234 |
section "Conjunction";
|
7357
|
235 |
|
8529
|
236 |
Goalw [and_def] "[| P; Q |] ==> P&Q";
|
|
237 |
by (rtac (impI RS allI) 1);
|
|
238 |
by (etac (mp RS mp) 1);
|
|
239 |
by (REPEAT (assume_tac 1));
|
|
240 |
qed "conjI";
|
7357
|
241 |
|
8529
|
242 |
Goalw [and_def] "[| P & Q |] ==> P";
|
|
243 |
by (dtac spec 1) ;
|
|
244 |
by (etac mp 1);
|
|
245 |
by (REPEAT (ares_tac [impI] 1));
|
|
246 |
qed "conjunct1";
|
7357
|
247 |
|
8529
|
248 |
Goalw [and_def] "[| P & Q |] ==> Q";
|
|
249 |
by (dtac spec 1) ;
|
|
250 |
by (etac mp 1);
|
|
251 |
by (REPEAT (ares_tac [impI] 1));
|
|
252 |
qed "conjunct2";
|
7357
|
253 |
|
8529
|
254 |
val [major,minor] =
|
|
255 |
Goal "[| P&Q; [| P; Q |] ==> R |] ==> R";
|
|
256 |
by (rtac minor 1);
|
|
257 |
by (rtac (major RS conjunct1) 1);
|
|
258 |
by (rtac (major RS conjunct2) 1);
|
|
259 |
qed "conjE";
|
7357
|
260 |
|
8529
|
261 |
val prems =
|
|
262 |
Goal "[| P; P ==> Q |] ==> P & Q";
|
|
263 |
by (REPEAT (resolve_tac (conjI::prems) 1));
|
|
264 |
qed "context_conjI";
|
7357
|
265 |
|
|
266 |
|
10063
|
267 |
section "Disjunction";
|
7357
|
268 |
|
8529
|
269 |
Goalw [or_def] "P ==> P|Q";
|
|
270 |
by (REPEAT (resolve_tac [allI,impI] 1));
|
|
271 |
by (etac mp 1 THEN assume_tac 1);
|
|
272 |
qed "disjI1";
|
7357
|
273 |
|
8529
|
274 |
Goalw [or_def] "Q ==> P|Q";
|
|
275 |
by (REPEAT (resolve_tac [allI,impI] 1));
|
|
276 |
by (etac mp 1 THEN assume_tac 1);
|
|
277 |
qed "disjI2";
|
7357
|
278 |
|
8529
|
279 |
val [major,minorP,minorQ] =
|
|
280 |
Goalw [or_def] "[| P | Q; P ==> R; Q ==> R |] ==> R";
|
|
281 |
by (rtac (major RS spec RS mp RS mp) 1);
|
|
282 |
by (DEPTH_SOLVE (ares_tac [impI,minorP,minorQ] 1));
|
|
283 |
qed "disjE";
|
7357
|
284 |
|
|
285 |
|
10063
|
286 |
section "Classical logic";
|
|
287 |
(*CCONTR -- classical logic*)
|
7357
|
288 |
|
8529
|
289 |
val [prem] = Goal "(~P ==> P) ==> P";
|
|
290 |
by (rtac (True_or_False RS disjE RS eqTrueE) 1);
|
|
291 |
by (assume_tac 1);
|
|
292 |
by (rtac (notI RS prem RS eqTrueI) 1);
|
|
293 |
by (etac subst 1);
|
|
294 |
by (assume_tac 1);
|
|
295 |
qed "classical";
|
7357
|
296 |
|
7832
|
297 |
bind_thm ("ccontr", FalseE RS classical);
|
7357
|
298 |
|
9159
|
299 |
(*notE with premises exchanged; it discharges ~R so that it can be used to
|
|
300 |
make elimination rules*)
|
|
301 |
val [premp,premnot] = Goal "[| P; ~R ==> ~P |] ==> R";
|
|
302 |
by (rtac ccontr 1);
|
|
303 |
by (etac ([premnot,premp] MRS notE) 1);
|
|
304 |
qed "rev_notE";
|
|
305 |
|
7357
|
306 |
(*Double negation law*)
|
|
307 |
Goal "~~P ==> P";
|
|
308 |
by (rtac classical 1);
|
|
309 |
by (etac notE 1);
|
|
310 |
by (assume_tac 1);
|
|
311 |
qed "notnotD";
|
|
312 |
|
|
313 |
val [p1,p2] = Goal "[| Q; ~ P ==> ~ Q |] ==> P";
|
|
314 |
by (rtac classical 1);
|
|
315 |
by (dtac p2 1);
|
|
316 |
by (etac notE 1);
|
|
317 |
by (rtac p1 1);
|
10231
|
318 |
qed "contrapos_pp";
|
7357
|
319 |
|
10063
|
320 |
|
|
321 |
section "Unique existence";
|
7357
|
322 |
|
9159
|
323 |
val prems = Goalw [Ex1_def] "[| P(a); !!x. P(x) ==> x=a |] ==> EX! x. P(x)";
|
8529
|
324 |
by (REPEAT (ares_tac (prems@[exI,conjI,allI,impI]) 1));
|
|
325 |
qed "ex1I";
|
7357
|
326 |
|
|
327 |
(*Sometimes easier to use: the premises have no shared variables. Safe!*)
|
8529
|
328 |
val [ex_prem,eq] = Goal
|
9159
|
329 |
"[| EX x. P(x); !!x y. [| P(x); P(y) |] ==> x=y |] ==> EX! x. P(x)";
|
8529
|
330 |
by (rtac (ex_prem RS exE) 1);
|
7357
|
331 |
by (REPEAT (ares_tac [ex1I,eq] 1)) ;
|
|
332 |
qed "ex_ex1I";
|
|
333 |
|
8529
|
334 |
val major::prems = Goalw [Ex1_def]
|
9159
|
335 |
"[| EX! x. P(x); !!x. [| P(x); ALL y. P(y) --> y=x |] ==> R |] ==> R";
|
8529
|
336 |
by (rtac (major RS exE) 1);
|
|
337 |
by (REPEAT (etac conjE 1 ORELSE ares_tac prems 1));
|
|
338 |
qed "ex1E";
|
7357
|
339 |
|
9159
|
340 |
Goal "EX! x. P x ==> EX x. P x";
|
7357
|
341 |
by (etac ex1E 1);
|
|
342 |
by (rtac exI 1);
|
|
343 |
by (assume_tac 1);
|
|
344 |
qed "ex1_implies_ex";
|
|
345 |
|
|
346 |
|
10063
|
347 |
section "SOME: Hilbert's Epsilon-operator";
|
7357
|
348 |
|
9970
|
349 |
(*Easier to apply than someI if witness ?a comes from an EX-formula*)
|
9969
|
350 |
Goal "EX x. P x ==> P (SOME x. P x)";
|
9404
|
351 |
by (etac exE 1);
|
9970
|
352 |
by (etac someI 1);
|
10175
|
353 |
qed "someI_ex";
|
9404
|
354 |
|
9970
|
355 |
(*Easier to apply than someI: conclusion has only one occurrence of P*)
|
11006
|
356 |
val prems = Goal "[| P a; !!x. P x ==> Q x |] ==> Q (SOME x. P x)";
|
7357
|
357 |
by (resolve_tac prems 1);
|
9970
|
358 |
by (rtac someI 1);
|
7357
|
359 |
by (resolve_tac prems 1) ;
|
9969
|
360 |
qed "someI2";
|
7357
|
361 |
|
9969
|
362 |
(*Easier to apply than someI2 if witness ?a comes from an EX-formula*)
|
11006
|
363 |
val [major,minor] = Goal "[| EX a. P a; !!x. P x ==> Q x |] ==> Q (SOME x. P x)";
|
8529
|
364 |
by (rtac (major RS exE) 1);
|
9969
|
365 |
by (etac someI2 1 THEN etac minor 1);
|
9998
|
366 |
qed "someI2_ex";
|
7357
|
367 |
|
11006
|
368 |
val prems = Goal "[| P a; !!x. P x ==> x=a |] ==> (SOME x. P x) = a";
|
9969
|
369 |
by (rtac someI2 1);
|
7357
|
370 |
by (REPEAT (ares_tac prems 1)) ;
|
9969
|
371 |
qed "some_equality";
|
7357
|
372 |
|
11006
|
373 |
Goal "[| EX!x. P x; P a |] ==> (SOME x. P x) = a";
|
9969
|
374 |
by (rtac some_equality 1);
|
11006
|
375 |
by (atac 1);
|
|
376 |
by (etac ex1E 1);
|
|
377 |
by (etac all_dupE 1);
|
|
378 |
by (dtac mp 1);
|
|
379 |
by (atac 1);
|
7357
|
380 |
by (etac ssubst 1);
|
|
381 |
by (etac allE 1);
|
|
382 |
by (etac mp 1);
|
|
383 |
by (atac 1);
|
9969
|
384 |
qed "some1_equality";
|
7357
|
385 |
|
10175
|
386 |
Goal "P (SOME x. P x) = (EX x. P x)";
|
7357
|
387 |
by (rtac iffI 1);
|
|
388 |
by (etac exI 1);
|
|
389 |
by (etac exE 1);
|
9970
|
390 |
by (etac someI 1);
|
9969
|
391 |
qed "some_eq_ex";
|
7357
|
392 |
|
10175
|
393 |
Goal "(SOME y. y=x) = x";
|
9969
|
394 |
by (rtac some_equality 1);
|
7357
|
395 |
by (rtac refl 1);
|
|
396 |
by (atac 1);
|
9969
|
397 |
qed "some_eq_trivial";
|
7357
|
398 |
|
10175
|
399 |
Goal "(SOME y. x=y) = x";
|
9969
|
400 |
by (rtac some_equality 1);
|
7357
|
401 |
by (rtac refl 1);
|
|
402 |
by (etac sym 1);
|
9969
|
403 |
qed "some_sym_eq_trivial";
|
7357
|
404 |
|
10063
|
405 |
|
|
406 |
section "Classical intro rules for disjunction and existential quantifiers";
|
7357
|
407 |
|
9969
|
408 |
val prems = Goal "(~Q ==> P) ==> P|Q";
|
7357
|
409 |
by (rtac classical 1);
|
|
410 |
by (REPEAT (ares_tac (prems@[disjI1,notI]) 1));
|
|
411 |
by (REPEAT (ares_tac (prems@[disjI2,notE]) 1)) ;
|
|
412 |
qed "disjCI";
|
|
413 |
|
|
414 |
Goal "~P | P";
|
|
415 |
by (REPEAT (ares_tac [disjCI] 1)) ;
|
|
416 |
qed "excluded_middle";
|
|
417 |
|
|
418 |
(*For disjunctive case analysis*)
|
|
419 |
fun excluded_middle_tac sP =
|
|
420 |
res_inst_tac [("Q",sP)] (excluded_middle RS disjE);
|
|
421 |
|
|
422 |
(*Classical implies (-->) elimination. *)
|
|
423 |
val major::prems = Goal "[| P-->Q; ~P ==> R; Q ==> R |] ==> R";
|
|
424 |
by (rtac (excluded_middle RS disjE) 1);
|
|
425 |
by (REPEAT (DEPTH_SOLVE_1 (ares_tac (prems @ [major RS mp]) 1)));
|
|
426 |
qed "impCE";
|
|
427 |
|
|
428 |
(*This version of --> elimination works on Q before P. It works best for
|
|
429 |
those cases in which P holds "almost everywhere". Can't install as
|
|
430 |
default: would break old proofs.*)
|
|
431 |
val major::prems = Goal
|
|
432 |
"[| P-->Q; Q ==> R; ~P ==> R |] ==> R";
|
|
433 |
by (resolve_tac [excluded_middle RS disjE] 1);
|
|
434 |
by (DEPTH_SOLVE (ares_tac (prems@[major RS mp]) 1)) ;
|
|
435 |
qed "impCE'";
|
|
436 |
|
|
437 |
(*Classical <-> elimination. *)
|
|
438 |
val major::prems = Goal
|
|
439 |
"[| P=Q; [| P; Q |] ==> R; [| ~P; ~Q |] ==> R |] ==> R";
|
|
440 |
by (rtac (major RS iffE) 1);
|
9869
|
441 |
by (REPEAT (DEPTH_SOLVE_1
|
|
442 |
(eresolve_tac ([asm_rl,impCE,notE]@prems) 1)));
|
7357
|
443 |
qed "iffCE";
|
|
444 |
|
9159
|
445 |
val prems = Goal "(ALL x. ~P(x) ==> P(a)) ==> EX x. P(x)";
|
7357
|
446 |
by (rtac ccontr 1);
|
|
447 |
by (REPEAT (ares_tac (prems@[exI,allI,notI,notE]) 1)) ;
|
|
448 |
qed "exCI";
|
|
449 |
|
8964
|
450 |
Goal "x + (y+z) = y + ((x+z)::'a::plus_ac0)";
|
|
451 |
by (rtac (thm"plus_ac0.commute" RS trans) 1);
|
|
452 |
by (rtac (thm"plus_ac0.assoc" RS trans) 1);
|
|
453 |
by (rtac (thm"plus_ac0.commute" RS arg_cong) 1);
|
|
454 |
qed "plus_ac0_left_commute";
|
|
455 |
|
|
456 |
Goal "x + 0 = (x ::'a::plus_ac0)";
|
|
457 |
by (rtac (thm"plus_ac0.commute" RS trans) 1);
|
|
458 |
by (rtac (thm"plus_ac0.zero") 1);
|
|
459 |
qed "plus_ac0_zero_right";
|
|
460 |
|
9869
|
461 |
bind_thms ("plus_ac0", [thm"plus_ac0.assoc", thm"plus_ac0.commute",
|
|
462 |
plus_ac0_left_commute,
|
|
463 |
thm"plus_ac0.zero", plus_ac0_zero_right]);
|
7357
|
464 |
|
|
465 |
(* case distinction *)
|
|
466 |
|
8529
|
467 |
val [prem1,prem2] = Goal "[| P ==> Q; ~P ==> Q |] ==> Q";
|
|
468 |
by (rtac (excluded_middle RS disjE) 1);
|
|
469 |
by (etac prem2 1);
|
|
470 |
by (etac prem1 1);
|
|
471 |
qed "case_split_thm";
|
7357
|
472 |
|
|
473 |
fun case_tac a = res_inst_tac [("P",a)] case_split_thm;
|
|
474 |
|
|
475 |
|
|
476 |
(** Standard abbreviations **)
|
|
477 |
|
10731
|
478 |
(* combination of (spec RS spec RS ...(j times) ... spec RS mp) *)
|
7490
|
479 |
local
|
|
480 |
fun wrong_prem (Const ("All", _) $ (Abs (_, _, t))) = wrong_prem t
|
|
481 |
| wrong_prem (Bound _) = true
|
|
482 |
| wrong_prem _ = false;
|
7533
|
483 |
val filter_right = filter (fn t => not (wrong_prem (HOLogic.dest_Trueprop (hd (Thm.prems_of t)))));
|
7490
|
484 |
in
|
|
485 |
fun smp i = funpow i (fn m => filter_right ([spec] RL m)) ([mp]);
|
|
486 |
fun smp_tac j = EVERY'[dresolve_tac (smp j), atac]
|
|
487 |
end;
|
|
488 |
|
|
489 |
|
9869
|
490 |
fun strip_tac i = REPEAT(resolve_tac [impI,allI] i);
|
11006
|
491 |
|