1 (* Title: Sequents/ILL.ML |
1 (* Title: Sequents/ILL.ML |
2 ID: $Id$ |
2 ID: $Id$ |
3 Author: Sara Kalvala and Valeria de Paiva |
3 Author: Sara Kalvala and Valeria de Paiva |
4 Copyright 1992 University of Cambridge |
4 Copyright 1992 University of Cambridge |
5 |
|
6 *) |
5 *) |
7 |
6 |
8 val lazy_cs = empty_pack |
7 val lazy_cs = empty_pack |
9 add_safes [tensl, conjr, disjl, promote0, |
8 add_safes [tensl, conjr, disjl, promote0, |
10 context2,context3] |
9 context2,context3] |
11 add_unsafes [identity, zerol, conjll, conjlr, disjrl, disjrr, |
10 add_unsafes [identity, zerol, conjll, conjlr, disjrl, disjrr, |
12 impr, tensr, impl, derelict, weaken, |
11 impr, tensr, impl, derelict, weaken, |
13 promote1, promote2,context1,context4a,context4b]; |
12 promote1, promote2,context1,context4a,context4b]; |
14 |
13 |
15 fun prom_tac n = REPEAT (resolve_tac [promote0,promote1,promote2] n); |
14 fun prom_tac n = REPEAT (resolve_tac [promote0,promote1,promote2] n); |
16 |
15 |
17 fun auto x = prove_goal thy x (fn prems => [best_tac lazy_cs 1]); |
16 fun auto x = prove_goal (the_context ()) x (fn prems => [best_tac lazy_cs 1]); |
18 |
17 |
19 Goal "$F, $G |- A ==> $F, !(A -o B), $G |- B"; |
18 Goal "$F, $G |- A ==> $F, !(A -o B), $G |- B"; |
20 by (rtac derelict 1); |
19 by (rtac derelict 1); |
21 by (rtac impl 1); |
20 by (rtac impl 1); |
22 by (rtac identity 2); |
21 by (rtac identity 2); |
50 by (rtac contract 1); |
49 by (rtac contract 1); |
51 by (rtac derelict 1); |
50 by (rtac derelict 1); |
52 by (assume_tac 1); |
51 by (assume_tac 1); |
53 qed "impr_contr_der"; |
52 qed "impr_contr_der"; |
54 |
53 |
55 val _ = goal thy "$F, (!B) -o 0, $G, !B, $H |- A"; |
54 val _ = goal (the_context ()) "$F, (!B) -o 0, $G, !B, $H |- A"; |
56 by (rtac impl 1); |
55 by (rtac impl 1); |
57 by (rtac identity 3); |
56 by (rtac identity 3); |
58 by (rtac context3 1); |
57 by (rtac context3 1); |
59 by (rtac context1 1); |
58 by (rtac context1 1); |
60 by (rtac zerol 1); |
59 by (rtac zerol 1); |
61 qed "contrad1"; |
60 qed "contrad1"; |
62 |
61 |
63 |
62 |
64 val _ = goal thy "$F, !B, $G, (!B) -o 0, $H |- A"; |
63 val _ = goal (the_context ()) "$F, !B, $G, (!B) -o 0, $H |- A"; |
65 by (rtac impl 1); |
64 by (rtac impl 1); |
66 by (rtac identity 3); |
65 by (rtac identity 3); |
67 by (rtac context3 1); |
66 by (rtac context3 1); |
68 by (rtac context1 1); |
67 by (rtac context1 1); |
69 by (rtac zerol 1); |
68 by (rtac zerol 1); |
70 qed "contrad2"; |
69 qed "contrad2"; |
71 |
70 |
72 val _ = goal thy "A -o B, A |- B"; |
71 val _ = goal (the_context ()) "A -o B, A |- B"; |
73 by (rtac impl 1); |
72 by (rtac impl 1); |
74 by (rtac identity 2); |
73 by (rtac identity 2); |
75 by (rtac identity 2); |
74 by (rtac identity 2); |
76 by (rtac context1 1); |
75 by (rtac context1 1); |
77 qed "ll_mp"; |
76 qed "ll_mp"; |
92 by (rtac context3 1); |
91 by (rtac context3 1); |
93 by (rtac context3 1); |
92 by (rtac context3 1); |
94 by (rtac context1 1); |
93 by (rtac context1 1); |
95 qed "mp_rule2"; |
94 qed "mp_rule2"; |
96 |
95 |
97 val _ = goal thy "!((!(A ++ B)) -o 0) |- !( ((!A) -o 0) && ((!B) -o 0))"; |
96 val _ = goal (the_context ()) "!((!(A ++ B)) -o 0) |- !( ((!A) -o 0) && ((!B) -o 0))"; |
98 by (best_tac lazy_cs 1); |
97 by (best_tac lazy_cs 1); |
99 qed "or_to_and"; |
98 qed "or_to_and"; |
100 |
99 |
101 Goal "$F, !( ((!A) -o 0) && ((!B) -o 0)), $G |- C ==> \ |
100 Goal "$F, !( ((!A) -o 0) && ((!B) -o 0)), $G |- C ==> \ |
102 \ $F, !((!(A ++ B)) -o 0), $G |- C"; |
101 \ $F, !((!(A ++ B)) -o 0), $G |- C"; |
134 by (assume_tac 2); |
133 by (assume_tac 2); |
135 by (best_tac lazy_cs 1); |
134 by (best_tac lazy_cs 1); |
136 qed "a_not_a_rule"; |
135 qed "a_not_a_rule"; |
137 |
136 |
138 fun thm_to_rule x y = |
137 fun thm_to_rule x y = |
139 prove_goal thy x |
138 prove_goal (the_context ()) x |
140 (fn [prem] => [(rtac cut 1), (rtac y 2), (rtac prem 2), |
139 (fn [prem] => [(rtac cut 1), (rtac y 2), (rtac prem 2), |
141 (best_tac lazy_cs 1)]); |
140 (best_tac lazy_cs 1)]); |
142 |
141 |
143 val safe_cs = lazy_cs add_safes [conj_lemma, ll_mp,contrad1, |
142 val safe_cs = lazy_cs add_safes [conj_lemma, ll_mp,contrad1, |
144 contrad2, mp_rule1, mp_rule2, o_a_rule, |
143 contrad2, mp_rule1, mp_rule2, o_a_rule, |
145 a_not_a_rule] |
144 a_not_a_rule] |
146 add_unsafes [aux_impl]; |
145 add_unsafes [aux_impl]; |
147 |
146 |
148 val power_cs = safe_cs add_unsafes [impr_contr_der]; |
147 val power_cs = safe_cs add_unsafes [impr_contr_der]; |
149 |
148 |
150 fun auto1 x = prove_goal thy x (fn prems => [best_tac safe_cs 1]) ; |
149 fun auto1 x = prove_goal (the_context ()) x (fn prems => [best_tac safe_cs 1]) ; |
151 |
150 |
152 fun auto2 x = prove_goal thy x (fn prems => [best_tac power_cs 1]) ; |
151 fun auto2 x = prove_goal (the_context ()) x (fn prems => [best_tac power_cs 1]) ; |
153 |
152 |
154 |
153 |
155 (* some examples from Troelstra and van Dalen |
154 (* some examples from Troelstra and van Dalen |
156 |
155 |
157 auto1 "!((!A) -o ((!B) -o 0)) |- (!(A && B)) -o 0"; |
156 auto1 "!((!A) -o ((!B) -o 0)) |- (!(A && B)) -o 0"; |