author | blanchet |
Thu, 20 Nov 2014 17:29:18 +0100 | |
changeset 59018 | ec8ea2465d2a |
parent 55232 | 7a46672934a3 |
child 60770 | 240563fbf41d |
permissions | -rw-r--r-- |
17481 | 1 |
(* Title: Sequents/ILL.thy |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
2 |
Author: Sara Kalvala and Valeria de Paiva |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
3 |
Copyright 1995 University of Cambridge |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
4 |
*) |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
5 |
|
17481 | 6 |
theory ILL |
7 |
imports Sequents |
|
8 |
begin |
|
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
9 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
10 |
consts |
14765 | 11 |
Trueprop :: "two_seqi" |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
12 |
|
22894 | 13 |
tens :: "[o, o] => o" (infixr "><" 35) |
14 |
limp :: "[o, o] => o" (infixr "-o" 45) |
|
15 |
liff :: "[o, o] => o" (infixr "o-o" 45) |
|
16 |
FShriek :: "o => o" ("! _" [100] 1000) |
|
17 |
lconj :: "[o, o] => o" (infixr "&&" 35) |
|
18 |
ldisj :: "[o, o] => o" (infixr "++" 35) |
|
19 |
zero :: "o" ("0") |
|
20 |
top :: "o" ("1") |
|
21 |
eye :: "o" ("I") |
|
22 |
aneg :: "o=>o" ("~_") |
|
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
23 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
24 |
|
14765 | 25 |
(* context manipulation *) |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
26 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
27 |
Context :: "two_seqi" |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
28 |
|
14765 | 29 |
(* promotion rule *) |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
30 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
31 |
PromAux :: "three_seqi" |
14765 | 32 |
|
33 |
syntax |
|
35113 | 34 |
"_Trueprop" :: "single_seqe" ("((_)/ |- (_))" [6,6] 5) |
35 |
"_Context" :: "two_seqe" ("((_)/ :=: (_))" [6,6] 5) |
|
36 |
"_PromAux" :: "three_seqe" ("promaux {_||_||_}") |
|
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
37 |
|
17481 | 38 |
parse_translation {* |
52143 | 39 |
[(@{syntax_const "_Trueprop"}, K (single_tr @{const_syntax Trueprop})), |
40 |
(@{syntax_const "_Context"}, K (two_seq_tr @{const_syntax Context})), |
|
41 |
(@{syntax_const "_PromAux"}, K (three_seq_tr @{const_syntax PromAux}))] |
|
35113 | 42 |
*} |
17481 | 43 |
|
44 |
print_translation {* |
|
52143 | 45 |
[(@{const_syntax Trueprop}, K (single_tr' @{syntax_const "_Trueprop"})), |
46 |
(@{const_syntax Context}, K (two_seq_tr' @{syntax_const "_Context"})), |
|
47 |
(@{const_syntax PromAux}, K (three_seq_tr' @{syntax_const "_PromAux"}))] |
|
35113 | 48 |
*} |
17481 | 49 |
|
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
50 |
defs |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
51 |
|
17481 | 52 |
liff_def: "P o-o Q == (P -o Q) >< (Q -o P)" |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
53 |
|
17481 | 54 |
aneg_def: "~A == A -o 0" |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
55 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
56 |
|
51309 | 57 |
axiomatization where |
14765 | 58 |
|
51309 | 59 |
identity: "P |- P" and |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
60 |
|
51309 | 61 |
zerol: "$G, 0, $H |- A" and |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
62 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
63 |
(* RULES THAT DO NOT DIVIDE CONTEXT *) |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
64 |
|
51309 | 65 |
derelict: "$F, A, $G |- C ==> $F, !A, $G |- C" and |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
66 |
(* unfortunately, this one removes !A *) |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
67 |
|
51309 | 68 |
contract: "$F, !A, !A, $G |- C ==> $F, !A, $G |- C" and |
14765 | 69 |
|
51309 | 70 |
weaken: "$F, $G |- C ==> $G, !A, $F |- C" and |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
71 |
(* weak form of weakening, in practice just to clean context *) |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
72 |
(* weaken and contract not needed (CHECK) *) |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
73 |
|
51309 | 74 |
promote2: "promaux{ || $H || B} ==> $H |- !B" and |
17481 | 75 |
promote1: "promaux{!A, $G || $H || B} |
51309 | 76 |
==> promaux {$G || $H, !A || B}" and |
77 |
promote0: "$G |- A ==> promaux {$G || || A}" and |
|
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
78 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
79 |
|
14765 | 80 |
|
51309 | 81 |
tensl: "$H, A, B, $G |- C ==> $H, A >< B, $G |- C" and |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
82 |
|
51309 | 83 |
impr: "A, $F |- B ==> $F |- A -o B" and |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
84 |
|
17481 | 85 |
conjr: "[| $F |- A ; |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
86 |
$F |- B |] |
51309 | 87 |
==> $F |- (A && B)" and |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
88 |
|
51309 | 89 |
conjll: "$G, A, $H |- C ==> $G, A && B, $H |- C" and |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
90 |
|
51309 | 91 |
conjlr: "$G, B, $H |- C ==> $G, A && B, $H |- C" and |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
92 |
|
51309 | 93 |
disjrl: "$G |- A ==> $G |- A ++ B" and |
94 |
disjrr: "$G |- B ==> $G |- A ++ B" and |
|
17481 | 95 |
disjl: "[| $G, A, $H |- C ; |
96 |
$G, B, $H |- C |] |
|
51309 | 97 |
==> $G, A ++ B, $H |- C" and |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
98 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
99 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
100 |
(* RULES THAT DIVIDE CONTEXT *) |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
101 |
|
17481 | 102 |
tensr: "[| $F, $J :=: $G; |
103 |
$F |- A ; |
|
104 |
$J |- B |] |
|
51309 | 105 |
==> $G |- A >< B" and |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
106 |
|
17481 | 107 |
impl: "[| $G, $F :=: $J, $H ; |
108 |
B, $F |- C ; |
|
109 |
$G |- A |] |
|
51309 | 110 |
==> $J, A -o B, $H |- C" and |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
111 |
|
14765 | 112 |
|
17481 | 113 |
cut: " [| $J1, $H1, $J2, $H3, $J3, $H2, $J4, $H4 :=: $F ; |
114 |
$H1, $H2, $H3, $H4 |- A ; |
|
51309 | 115 |
$J1, $J2, A, $J3, $J4 |- B |] ==> $F |- B" and |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
116 |
|
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 |
(* CONTEXT RULES *) |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
119 |
|
51309 | 120 |
context1: "$G :=: $G" and |
121 |
context2: "$F, $G :=: $H, !A, $G ==> $F, A, $G :=: $H, !A, $G" and |
|
122 |
context3: "$F, $G :=: $H, $J ==> $F, A, $G :=: $H, A, $J" and |
|
123 |
context4a: "$F :=: $H, $G ==> $F :=: $H, !A, $G" and |
|
124 |
context4b: "$F, $H :=: $G ==> $F, !A, $H :=: $G" and |
|
17481 | 125 |
context5: "$F, $G :=: $H ==> $G, $F :=: $H" |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
126 |
|
55232 | 127 |
text "declarations for lazy classical reasoning:" |
128 |
lemmas [safe] = |
|
129 |
context3 |
|
130 |
context2 |
|
131 |
promote0 |
|
132 |
disjl |
|
133 |
conjr |
|
134 |
tensl |
|
135 |
lemmas [unsafe] = |
|
136 |
context4b |
|
137 |
context4a |
|
138 |
context1 |
|
139 |
promote2 |
|
140 |
promote1 |
|
141 |
weaken |
|
142 |
derelict |
|
143 |
impl |
|
144 |
tensr |
|
145 |
impr |
|
146 |
disjrr |
|
147 |
disjrl |
|
148 |
conjlr |
|
149 |
conjll |
|
150 |
zerol |
|
151 |
identity |
|
21427 | 152 |
|
55228 | 153 |
lemma aux_impl: "$F, $G |- A \<Longrightarrow> $F, !(A -o B), $G |- B" |
21427 | 154 |
apply (rule derelict) |
155 |
apply (rule impl) |
|
156 |
apply (rule_tac [2] identity) |
|
157 |
apply (rule context1) |
|
158 |
apply assumption |
|
159 |
done |
|
160 |
||
55228 | 161 |
lemma conj_lemma: " $F, !A, !B, $G |- C \<Longrightarrow> $F, !(A && B), $G |- C" |
21427 | 162 |
apply (rule contract) |
163 |
apply (rule_tac A = " (!A) >< (!B) " in cut) |
|
164 |
apply (rule_tac [2] tensr) |
|
165 |
prefer 3 |
|
166 |
apply (subgoal_tac "! (A && B) |- !A") |
|
167 |
apply assumption |
|
55232 | 168 |
apply best |
21427 | 169 |
prefer 3 |
170 |
apply (subgoal_tac "! (A && B) |- !B") |
|
171 |
apply assumption |
|
55232 | 172 |
apply best |
21427 | 173 |
apply (rule_tac [2] context1) |
174 |
apply (rule_tac [2] tensl) |
|
55232 | 175 |
prefer 2 apply assumption |
21427 | 176 |
apply (rule context3) |
177 |
apply (rule context3) |
|
178 |
apply (rule context1) |
|
179 |
done |
|
180 |
||
55228 | 181 |
lemma impr_contract: "!A, !A, $G |- B \<Longrightarrow> $G |- (!A) -o B" |
21427 | 182 |
apply (rule impr) |
183 |
apply (rule contract) |
|
184 |
apply assumption |
|
185 |
done |
|
186 |
||
55228 | 187 |
lemma impr_contr_der: "A, !A, $G |- B \<Longrightarrow> $G |- (!A) -o B" |
21427 | 188 |
apply (rule impr) |
189 |
apply (rule contract) |
|
190 |
apply (rule derelict) |
|
191 |
apply assumption |
|
192 |
done |
|
193 |
||
194 |
lemma contrad1: "$F, (!B) -o 0, $G, !B, $H |- A" |
|
195 |
apply (rule impl) |
|
196 |
apply (rule_tac [3] identity) |
|
197 |
apply (rule context3) |
|
198 |
apply (rule context1) |
|
199 |
apply (rule zerol) |
|
200 |
done |
|
201 |
||
202 |
||
203 |
lemma contrad2: "$F, !B, $G, (!B) -o 0, $H |- A" |
|
204 |
apply (rule impl) |
|
205 |
apply (rule_tac [3] identity) |
|
206 |
apply (rule context3) |
|
207 |
apply (rule context1) |
|
208 |
apply (rule zerol) |
|
209 |
done |
|
210 |
||
211 |
lemma ll_mp: "A -o B, A |- B" |
|
212 |
apply (rule impl) |
|
213 |
apply (rule_tac [2] identity) |
|
214 |
apply (rule_tac [2] identity) |
|
215 |
apply (rule context1) |
|
216 |
done |
|
217 |
||
55228 | 218 |
lemma mp_rule1: "$F, B, $G, $H |- C \<Longrightarrow> $F, A, $G, A -o B, $H |- C" |
21427 | 219 |
apply (rule_tac A = "B" in cut) |
220 |
apply (rule_tac [2] ll_mp) |
|
221 |
prefer 2 apply (assumption) |
|
222 |
apply (rule context3) |
|
223 |
apply (rule context3) |
|
224 |
apply (rule context1) |
|
225 |
done |
|
226 |
||
55228 | 227 |
lemma mp_rule2: "$F, B, $G, $H |- C \<Longrightarrow> $F, A -o B, $G, A, $H |- C" |
21427 | 228 |
apply (rule_tac A = "B" in cut) |
229 |
apply (rule_tac [2] ll_mp) |
|
230 |
prefer 2 apply (assumption) |
|
231 |
apply (rule context3) |
|
232 |
apply (rule context3) |
|
233 |
apply (rule context1) |
|
234 |
done |
|
235 |
||
236 |
lemma or_to_and: "!((!(A ++ B)) -o 0) |- !( ((!A) -o 0) && ((!B) -o 0))" |
|
55232 | 237 |
by best |
21427 | 238 |
|
55228 | 239 |
lemma o_a_rule: "$F, !( ((!A) -o 0) && ((!B) -o 0)), $G |- C \<Longrightarrow> |
21427 | 240 |
$F, !((!(A ++ B)) -o 0), $G |- C" |
241 |
apply (rule cut) |
|
242 |
apply (rule_tac [2] or_to_and) |
|
243 |
prefer 2 apply (assumption) |
|
244 |
apply (rule context3) |
|
245 |
apply (rule context1) |
|
246 |
done |
|
247 |
||
248 |
lemma conj_imp: "((!A) -o C) ++ ((!B) -o C) |- (!(A && B)) -o C" |
|
249 |
apply (rule impr) |
|
250 |
apply (rule conj_lemma) |
|
251 |
apply (rule disjl) |
|
55232 | 252 |
apply (rule mp_rule1, best)+ |
21427 | 253 |
done |
254 |
||
255 |
lemma not_imp: "!A, !((!B) -o 0) |- (!((!A) -o B)) -o 0" |
|
55232 | 256 |
by best |
21427 | 257 |
|
258 |
lemma a_not_a: "!A -o (!A -o 0) |- !A -o 0" |
|
259 |
apply (rule impr) |
|
260 |
apply (rule contract) |
|
261 |
apply (rule impl) |
|
262 |
apply (rule_tac [3] identity) |
|
263 |
apply (rule context1) |
|
55232 | 264 |
apply best |
21427 | 265 |
done |
266 |
||
55228 | 267 |
lemma a_not_a_rule: "$J1, !A -o 0, $J2 |- B \<Longrightarrow> $J1, !A -o (!A -o 0), $J2 |- B" |
21427 | 268 |
apply (rule_tac A = "!A -o 0" in cut) |
269 |
apply (rule_tac [2] a_not_a) |
|
55232 | 270 |
prefer 2 apply assumption |
271 |
apply best |
|
21427 | 272 |
done |
273 |
||
274 |
ML {* |
|
55228 | 275 |
val safe_pack = |
55232 | 276 |
@{context} |
55228 | 277 |
|> fold_rev Cla.add_safe @{thms conj_lemma ll_mp contrad1 |
278 |
contrad2 mp_rule1 mp_rule2 o_a_rule a_not_a_rule} |
|
279 |
|> Cla.add_unsafe @{thm aux_impl} |
|
280 |
|> Cla.get_pack; |
|
21427 | 281 |
|
55228 | 282 |
val power_pack = |
283 |
Cla.put_pack safe_pack @{context} |
|
284 |
|> Cla.add_unsafe @{thm impr_contr_der} |
|
285 |
|> Cla.get_pack; |
|
21427 | 286 |
*} |
287 |
||
288 |
method_setup best_safe = |
|
55228 | 289 |
{* Scan.succeed (fn ctxt => SIMPLE_METHOD' (Cla.best_tac (Cla.put_pack safe_pack ctxt))) *} |
21427 | 290 |
|
291 |
method_setup best_power = |
|
55228 | 292 |
{* Scan.succeed (fn ctxt => SIMPLE_METHOD' (Cla.best_tac (Cla.put_pack power_pack ctxt))) *} |
21427 | 293 |
|
294 |
||
295 |
(* Some examples from Troelstra and van Dalen *) |
|
296 |
||
297 |
lemma "!((!A) -o ((!B) -o 0)) |- (!(A && B)) -o 0" |
|
298 |
by best_safe |
|
299 |
||
300 |
lemma "!((!(A && B)) -o 0) |- !((!A) -o ((!B) -o 0))" |
|
301 |
by best_safe |
|
302 |
||
303 |
lemma "!( (!((! ((!A) -o B) ) -o 0)) -o 0) |- |
|
304 |
(!A) -o ( (! ((!B) -o 0)) -o 0)" |
|
305 |
by best_safe |
|
306 |
||
307 |
lemma "!( (!A) -o ( (! ((!B) -o 0)) -o 0) ) |- |
|
308 |
(!((! ((!A) -o B) ) -o 0)) -o 0" |
|
309 |
by best_power |
|
310 |
||
311 |
end |