author | haftmann |
Fri, 20 Oct 2006 18:22:24 +0200 | |
changeset 21084 | 1c898a0c0f2d |
parent 17481 | 75166ebb619b |
permissions | -rw-r--r-- |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
1 |
(* Title: Sequents/ILL.ML |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
2 |
ID: $Id$ |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
3 |
Author: Sara Kalvala and Valeria de Paiva |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
4 |
Copyright 1992 University of Cambridge |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
5 |
*) |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
6 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
7 |
val lazy_cs = empty_pack |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
8 |
add_safes [tensl, conjr, disjl, promote0, |
17481 | 9 |
context2,context3] |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
10 |
add_unsafes [identity, zerol, conjll, conjlr, disjrl, disjrr, |
17481 | 11 |
impr, tensr, impl, derelict, weaken, |
12 |
promote1, promote2,context1,context4a,context4b]; |
|
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
13 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
14 |
fun prom_tac n = REPEAT (resolve_tac [promote0,promote1,promote2] n); |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
15 |
|
17481 | 16 |
fun auto x = prove_goal (the_context ()) x (fn prems => [best_tac lazy_cs 1]); |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
17 |
|
9259 | 18 |
Goal "$F, $G |- A ==> $F, !(A -o B), $G |- B"; |
19 |
by (rtac derelict 1); |
|
20 |
by (rtac impl 1); |
|
21 |
by (rtac identity 2); |
|
22 |
by (rtac context1 1); |
|
23 |
by (assume_tac 1); |
|
24 |
qed "aux_impl"; |
|
25 |
||
26 |
Goal " $F, !A, !B, $G |- C ==> $F, !(A && B), $G |- C"; |
|
27 |
by (rtac contract 1); |
|
28 |
by (res_inst_tac [("A","(!A) >< (!B)")] cut 1); |
|
29 |
by (rtac tensr 2); |
|
30 |
by (rtac (auto "! (A && B) |- !A") 3); |
|
31 |
by (rtac (auto "! (A && B) |- !B") 3); |
|
32 |
by (rtac context1 2); |
|
33 |
by (rtac tensl 2); |
|
34 |
by (assume_tac 2); |
|
35 |
by (rtac context3 1); |
|
36 |
by (rtac context3 1); |
|
37 |
by (rtac context1 1); |
|
38 |
qed "conj_lemma"; |
|
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
39 |
|
9259 | 40 |
Goal "!A, !A, $G |- B ==> $G |- (!A) -o B"; |
41 |
by (rtac impr 1); |
|
42 |
by (rtac contract 1); |
|
43 |
by (assume_tac 1); |
|
44 |
qed "impr_contract"; |
|
45 |
||
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
46 |
|
9259 | 47 |
Goal "A, !A, $G |- B ==> $G |- (!A) -o B"; |
48 |
by (rtac impr 1); |
|
49 |
by (rtac contract 1); |
|
50 |
by (rtac derelict 1); |
|
51 |
by (assume_tac 1); |
|
52 |
qed "impr_contr_der"; |
|
53 |
||
17481 | 54 |
val _ = goal (the_context ()) "$F, (!B) -o 0, $G, !B, $H |- A"; |
9259 | 55 |
by (rtac impl 1); |
56 |
by (rtac identity 3); |
|
57 |
by (rtac context3 1); |
|
58 |
by (rtac context1 1); |
|
59 |
by (rtac zerol 1); |
|
60 |
qed "contrad1"; |
|
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
61 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
62 |
|
17481 | 63 |
val _ = goal (the_context ()) "$F, !B, $G, (!B) -o 0, $H |- A"; |
9259 | 64 |
by (rtac impl 1); |
65 |
by (rtac identity 3); |
|
66 |
by (rtac context3 1); |
|
67 |
by (rtac context1 1); |
|
68 |
by (rtac zerol 1); |
|
69 |
qed "contrad2"; |
|
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
70 |
|
17481 | 71 |
val _ = goal (the_context ()) "A -o B, A |- B"; |
9259 | 72 |
by (rtac impl 1); |
73 |
by (rtac identity 2); |
|
74 |
by (rtac identity 2); |
|
75 |
by (rtac context1 1); |
|
76 |
qed "ll_mp"; |
|
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
77 |
|
9259 | 78 |
Goal "$F, B, $G, $H |- C ==> $F, A, $G, A -o B, $H |- C"; |
79 |
by (res_inst_tac [("A","B")] cut 1); |
|
80 |
by (rtac ll_mp 2); |
|
81 |
by (assume_tac 2); |
|
82 |
by (rtac context3 1); |
|
83 |
by (rtac context3 1); |
|
84 |
by (rtac context1 1); |
|
85 |
qed "mp_rule1"; |
|
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
86 |
|
9259 | 87 |
Goal "$F, B, $G, $H |- C ==> $F, A -o B, $G, A, $H |- C"; |
88 |
by (res_inst_tac [("A","B")] cut 1); |
|
89 |
by (rtac ll_mp 2); |
|
90 |
by (assume_tac 2); |
|
91 |
by (rtac context3 1); |
|
92 |
by (rtac context3 1); |
|
93 |
by (rtac context1 1); |
|
94 |
qed "mp_rule2"; |
|
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
95 |
|
17481 | 96 |
val _ = goal (the_context ()) "!((!(A ++ B)) -o 0) |- !( ((!A) -o 0) && ((!B) -o 0))"; |
9259 | 97 |
by (best_tac lazy_cs 1); |
98 |
qed "or_to_and"; |
|
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
99 |
|
9259 | 100 |
Goal "$F, !( ((!A) -o 0) && ((!B) -o 0)), $G |- C ==> \ |
101 |
\ $F, !((!(A ++ B)) -o 0), $G |- C"; |
|
102 |
by (rtac cut 1); |
|
103 |
by (rtac or_to_and 2); |
|
104 |
by (assume_tac 2); |
|
105 |
by (rtac context3 1); |
|
106 |
by (rtac context1 1); |
|
107 |
qed "o_a_rule"; |
|
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
108 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
109 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
110 |
|
17481 | 111 |
val _ = goal (the_context ()) "((!A) -o C) ++ ((!B) -o C) |- (!(A && B)) -o C"; |
9259 | 112 |
by (rtac impr 1); |
113 |
by (rtac conj_lemma 1); |
|
114 |
by (rtac disjl 1); |
|
115 |
by (ALLGOALS (rtac mp_rule1 THEN' best_tac lazy_cs)); |
|
116 |
qed "conj_imp"; |
|
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
117 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
118 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
119 |
val not_imp = auto "!A, !((!B) -o 0) |- (!((!A) -o B)) -o 0"; |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
120 |
|
9259 | 121 |
Goal "!A -o (!A -o 0) |- !A -o 0"; |
122 |
by (rtac impr 1); |
|
123 |
by (rtac contract 1); |
|
124 |
by (rtac impl 1); |
|
125 |
by (rtac identity 3); |
|
126 |
by (rtac context1 1); |
|
127 |
by (best_tac lazy_cs 1); |
|
128 |
qed "a_not_a"; |
|
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
129 |
|
9259 | 130 |
Goal "$J1, !A -o 0, $J2 |- B ==> $J1, !A -o (!A -o 0), $J2 |- B"; |
131 |
by (res_inst_tac [("A","!A -o 0")] cut 1); |
|
132 |
by (rtac a_not_a 2); |
|
133 |
by (assume_tac 2); |
|
134 |
by (best_tac lazy_cs 1); |
|
135 |
qed "a_not_a_rule"; |
|
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
136 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
137 |
fun thm_to_rule x y = |
17481 | 138 |
prove_goal (the_context ()) x |
9259 | 139 |
(fn [prem] => [(rtac cut 1), (rtac y 2), (rtac prem 2), |
17481 | 140 |
(best_tac lazy_cs 1)]); |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
141 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
142 |
val safe_cs = lazy_cs add_safes [conj_lemma, ll_mp,contrad1, |
17481 | 143 |
contrad2, mp_rule1, mp_rule2, o_a_rule, |
144 |
a_not_a_rule] |
|
145 |
add_unsafes [aux_impl]; |
|
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
146 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
147 |
val power_cs = safe_cs add_unsafes [impr_contr_der]; |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
148 |
|
17481 | 149 |
fun auto1 x = prove_goal (the_context ()) x (fn prems => [best_tac safe_cs 1]) ; |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
150 |
|
17481 | 151 |
fun auto2 x = prove_goal (the_context ()) x (fn prems => [best_tac power_cs 1]) ; |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
152 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
153 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
154 |
(* some examples from Troelstra and van Dalen |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
155 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
156 |
auto1 "!((!A) -o ((!B) -o 0)) |- (!(A && B)) -o 0"; |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
157 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
158 |
auto1 "!((!(A && B)) -o 0) |- !((!A) -o ((!B) -o 0))"; |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
159 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
160 |
auto1 "!( (!((! ((!A) -o B) ) -o 0)) -o 0) |- \ |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
161 |
\ (!A) -o ( (! ((!B) -o 0)) -o 0)"; |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
162 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
163 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
164 |
auto2 "!( (!A) -o ( (! ((!B) -o 0)) -o 0) ) |- \ |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
165 |
\ (!((! ((!A) -o B) ) -o 0)) -o 0"; |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
166 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
167 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
168 |
*) |