7355
|
1 |
(* Title: FOL/FOL_lemmas1.ML
|
|
2 |
ID: $Id$
|
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory
|
|
4 |
Copyright 1991 University of Cambridge
|
|
5 |
|
|
6 |
Tactics and lemmas for theory FOL (classical First-Order Logic).
|
|
7 |
*)
|
|
8 |
|
|
9 |
val classical = thm "classical";
|
|
10 |
val ccontr = FalseE RS classical;
|
|
11 |
|
|
12 |
|
|
13 |
(*** Classical introduction rules for | and EX ***)
|
|
14 |
|
|
15 |
qed_goal "disjCI" (the_context ())
|
|
16 |
"(~Q ==> P) ==> P|Q"
|
|
17 |
(fn prems=>
|
|
18 |
[ (rtac classical 1),
|
|
19 |
(REPEAT (ares_tac (prems@[disjI1,notI]) 1)),
|
|
20 |
(REPEAT (ares_tac (prems@[disjI2,notE]) 1)) ]);
|
|
21 |
|
|
22 |
(*introduction rule involving only EX*)
|
|
23 |
qed_goal "ex_classical" (the_context ())
|
|
24 |
"( ~(EX x. P(x)) ==> P(a)) ==> EX x. P(x)"
|
|
25 |
(fn prems=>
|
|
26 |
[ (rtac classical 1),
|
|
27 |
(eresolve_tac (prems RL [exI]) 1) ]);
|
|
28 |
|
|
29 |
(*version of above, simplifying ~EX to ALL~ *)
|
|
30 |
qed_goal "exCI" (the_context ())
|
|
31 |
"(ALL x. ~P(x) ==> P(a)) ==> EX x. P(x)"
|
|
32 |
(fn [prem]=>
|
|
33 |
[ (rtac ex_classical 1),
|
|
34 |
(resolve_tac [notI RS allI RS prem] 1),
|
|
35 |
(etac notE 1),
|
|
36 |
(etac exI 1) ]);
|
|
37 |
|
|
38 |
qed_goal "excluded_middle" (the_context ()) "~P | P"
|
|
39 |
(fn _=> [ rtac disjCI 1, assume_tac 1 ]);
|
|
40 |
|
|
41 |
(*For disjunctive case analysis*)
|
|
42 |
fun excluded_middle_tac sP =
|
|
43 |
res_inst_tac [("Q",sP)] (excluded_middle RS disjE);
|
|
44 |
|
|
45 |
qed_goal "case_split_thm" (the_context ()) "[| P ==> Q; ~P ==> Q |] ==> Q"
|
|
46 |
(fn [p1,p2] => [rtac (excluded_middle RS disjE) 1,
|
|
47 |
etac p2 1, etac p1 1]);
|
|
48 |
|
|
49 |
(*HOL's more natural case analysis tactic*)
|
|
50 |
fun case_tac a = res_inst_tac [("P",a)] case_split_thm;
|
|
51 |
|
|
52 |
|
|
53 |
(*** Special elimination rules *)
|
|
54 |
|
|
55 |
|
|
56 |
(*Classical implies (-->) elimination. *)
|
|
57 |
qed_goal "impCE" (the_context ())
|
|
58 |
"[| P-->Q; ~P ==> R; Q ==> R |] ==> R"
|
|
59 |
(fn major::prems=>
|
|
60 |
[ (resolve_tac [excluded_middle RS disjE] 1),
|
|
61 |
(DEPTH_SOLVE (ares_tac (prems@[major RS mp]) 1)) ]);
|
|
62 |
|
|
63 |
(*This version of --> elimination works on Q before P. It works best for
|
|
64 |
those cases in which P holds "almost everywhere". Can't install as
|
|
65 |
default: would break old proofs.*)
|
|
66 |
qed_goal "impCE'" (the_context ())
|
|
67 |
"[| P-->Q; Q ==> R; ~P ==> R |] ==> R"
|
|
68 |
(fn major::prems=>
|
|
69 |
[ (resolve_tac [excluded_middle RS disjE] 1),
|
|
70 |
(DEPTH_SOLVE (ares_tac (prems@[major RS mp]) 1)) ]);
|
|
71 |
|
|
72 |
(*Double negation law*)
|
|
73 |
qed_goal "notnotD" (the_context ()) "~~P ==> P"
|
|
74 |
(fn [major]=>
|
|
75 |
[ (rtac classical 1), (eresolve_tac [major RS notE] 1) ]);
|
|
76 |
|
|
77 |
qed_goal "contrapos2" (the_context ()) "[| Q; ~ P ==> ~ Q |] ==> P" (fn [p1,p2] => [
|
|
78 |
rtac classical 1,
|
|
79 |
dtac p2 1,
|
|
80 |
etac notE 1,
|
|
81 |
rtac p1 1]);
|
|
82 |
|
|
83 |
(*** Tactics for implication and contradiction ***)
|
|
84 |
|
|
85 |
(*Classical <-> elimination. Proof substitutes P=Q in
|
|
86 |
~P ==> ~Q and P ==> Q *)
|
|
87 |
qed_goalw "iffCE" (the_context ()) [iff_def]
|
|
88 |
"[| P<->Q; [| P; Q |] ==> R; [| ~P; ~Q |] ==> R |] ==> R"
|
|
89 |
(fn prems =>
|
|
90 |
[ (rtac conjE 1),
|
|
91 |
(REPEAT (DEPTH_SOLVE_1
|
|
92 |
(etac impCE 1 ORELSE mp_tac 1 ORELSE ares_tac prems 1))) ]);
|