author | lcp |
Thu, 06 Apr 1995 11:47:00 +0200 | |
changeset 245 | 63e249badea6 |
parent 199 | ad45e477926c |
child 248 | c3913a79b6ae |
permissions | -rw-r--r-- |
14 | 1 |
(* Title: HOL/ex/mt.ML |
2 |
ID: $Id$ |
|
3 |
Author: Jacob Frost, Cambridge University Computer Laboratory |
|
4 |
Copyright 1993 University of Cambridge |
|
5 |
||
6 |
Based upon the article |
|
7 |
Robin Milner and Mads Tofte, |
|
8 |
Co-induction in Relational Semantics, |
|
9 |
Theoretical Computer Science 87 (1991), pages 209-220. |
|
10 |
||
11 |
Written up as |
|
18 | 12 |
Jacob Frost, A Case Study of Co-induction in Isabelle/HOL |
14 | 13 |
Report 308, Computer Lab, University of Cambridge (1993). |
245
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
14 |
|
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
15 |
NEEDS TO USE INDUCTIVE DEFS PACKAGE |
14 | 16 |
*) |
17 |
||
18 |
open MT; |
|
19 |
||
20 |
val prems = goal MT.thy "~a:{b} ==> ~a=b"; |
|
21 |
by (cut_facts_tac prems 1); |
|
22 |
by (rtac notI 1); |
|
23 |
by (dtac notE 1); |
|
24 |
by (hyp_subst_tac 1); |
|
25 |
by (rtac singletonI 1); |
|
26 |
by (assume_tac 1); |
|
171 | 27 |
qed "notsingletonI"; |
14 | 28 |
|
29 |
(* ############################################################ *) |
|
30 |
(* Inference systems *) |
|
31 |
(* ############################################################ *) |
|
32 |
||
33 |
val infsys_mono_tac = |
|
34 |
(rewtac subset_def) THEN (safe_tac HOL_cs) THEN (rtac ballI 1) THEN |
|
35 |
(rtac CollectI 1) THEN (dtac CollectD 1) THEN |
|
36 |
REPEAT |
|
37 |
( (TRY ((etac disjE 1) THEN (rtac disjI2 2) THEN (rtac disjI1 1))) THEN |
|
38 |
(REPEAT (etac exE 1)) THEN (REPEAT (rtac exI 1)) THEN (fast_tac set_cs 1) |
|
39 |
); |
|
40 |
||
41 |
val prems = goal MT.thy "P(a,b) ==> P(fst(<a,b>),snd(<a,b>))"; |
|
42 |
by (rtac (fst_conv RS ssubst) 1); |
|
43 |
by (rtac (snd_conv RS ssubst) 1); |
|
44 |
by (resolve_tac prems 1); |
|
171 | 45 |
qed "infsys_p1"; |
14 | 46 |
|
47 |
val prems = goal MT.thy "P(fst(<a,b>),snd(<a,b>)) ==> P(a,b)"; |
|
48 |
by (cut_facts_tac prems 1); |
|
49 |
by (dtac (fst_conv RS subst) 1); |
|
50 |
by (dtac (snd_conv RS subst) 1); |
|
51 |
by (assume_tac 1); |
|
171 | 52 |
qed "infsys_p2"; |
14 | 53 |
|
54 |
val prems = goal MT.thy |
|
55 |
"P(a,b,c) ==> P(fst(fst(<<a,b>,c>)),snd(fst(<<a,b>,c>)),snd(<<a,b>,c>))"; |
|
245
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
56 |
by (simp_tac (prod_ss addsimps prems) 1); |
171 | 57 |
qed "infsys_pp1"; |
14 | 58 |
|
245
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
59 |
goal MT.thy |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
60 |
"!!a.P(fst(fst(<<a,b>,c>)),snd(fst(<<a,b>,c>)),snd(<<a,b>,c>)) ==> P(a,b,c)"; |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
61 |
by (asm_full_simp_tac prod_ss 1); |
171 | 62 |
qed "infsys_pp2"; |
14 | 63 |
|
64 |
(* ############################################################ *) |
|
65 |
(* Fixpoints *) |
|
66 |
(* ############################################################ *) |
|
67 |
||
68 |
(* Least fixpoints *) |
|
69 |
||
70 |
val prems = goal MT.thy "[| mono(f); x:f(lfp(f)) |] ==> x:lfp(f)"; |
|
71 |
by (rtac subsetD 1); |
|
72 |
by (rtac lfp_lemma2 1); |
|
245
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
73 |
by (resolve_tac prems 1); |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
74 |
by (resolve_tac prems 1); |
171 | 75 |
qed "lfp_intro2"; |
14 | 76 |
|
77 |
val prems = goal MT.thy |
|
78 |
" [| x:lfp(f); mono(f); !!y. y:f(lfp(f)) ==> P(y) |] ==> \ |
|
79 |
\ P(x)"; |
|
80 |
by (cut_facts_tac prems 1); |
|
245
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
81 |
by (resolve_tac prems 1); |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
82 |
by (rtac subsetD 1); |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
83 |
by (rtac lfp_lemma3 1); |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
84 |
by (assume_tac 1); |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
85 |
by (assume_tac 1); |
171 | 86 |
qed "lfp_elim2"; |
14 | 87 |
|
88 |
val prems = goal MT.thy |
|
89 |
" [| x:lfp(f); mono(f); !!y. y:f(lfp(f) Int {x.P(x)}) ==> P(y) |] ==> \ |
|
90 |
\ P(x)"; |
|
91 |
by (cut_facts_tac prems 1); |
|
245
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
92 |
by (etac induct 1); |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
93 |
by (assume_tac 1); |
14 | 94 |
by (eresolve_tac prems 1); |
171 | 95 |
qed "lfp_ind2"; |
14 | 96 |
|
97 |
(* Greatest fixpoints *) |
|
98 |
||
99 |
(* Note : "[| x:S; S <= f(S Un gfp(f)); mono(f) |] ==> x:gfp(f)" *) |
|
100 |
||
101 |
val [cih,monoh] = goal MT.thy "[| x:f({x} Un gfp(f)); mono(f) |] ==> x:gfp(f)"; |
|
102 |
by (rtac (cih RSN (2,gfp_upperbound RS subsetD)) 1); |
|
103 |
by (rtac (monoh RS monoD) 1); |
|
245
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
104 |
by (rtac (UnE RS subsetI) 1); |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
105 |
by (assume_tac 1); |
14 | 106 |
by (fast_tac (set_cs addSIs [cih]) 1); |
107 |
by (rtac (monoh RS monoD RS subsetD) 1); |
|
108 |
by (rtac Un_upper2 1); |
|
109 |
by (etac (monoh RS gfp_lemma2 RS subsetD) 1); |
|
171 | 110 |
qed "gfp_coind2"; |
14 | 111 |
|
112 |
val [gfph,monoh,caseh] = goal MT.thy |
|
113 |
"[| x:gfp(f); mono(f); !! y. y:f(gfp(f)) ==> P(y) |] ==> P(x)"; |
|
245
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
114 |
by (rtac caseh 1); |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
115 |
by (rtac subsetD 1); |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
116 |
by (rtac gfp_lemma2 1); |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
117 |
by (rtac monoh 1); |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
118 |
by (rtac gfph 1); |
171 | 119 |
qed "gfp_elim2"; |
14 | 120 |
|
121 |
(* ############################################################ *) |
|
122 |
(* Expressions *) |
|
123 |
(* ############################################################ *) |
|
124 |
||
125 |
val e_injs = [e_const_inj, e_var_inj, e_fn_inj, e_fix_inj, e_app_inj]; |
|
126 |
||
127 |
val e_disjs = |
|
128 |
[ e_disj_const_var, |
|
129 |
e_disj_const_fn, |
|
130 |
e_disj_const_fix, |
|
131 |
e_disj_const_app, |
|
132 |
e_disj_var_fn, |
|
133 |
e_disj_var_fix, |
|
134 |
e_disj_var_app, |
|
135 |
e_disj_fn_fix, |
|
136 |
e_disj_fn_app, |
|
137 |
e_disj_fix_app |
|
138 |
]; |
|
139 |
||
140 |
val e_disj_si = e_disjs @ (e_disjs RL [not_sym]); |
|
141 |
val e_disj_se = (e_disj_si RL [notE]); |
|
142 |
||
143 |
fun e_ext_cs cs = cs addSIs e_disj_si addSEs e_disj_se addSDs e_injs; |
|
144 |
||
145 |
(* ############################################################ *) |
|
146 |
(* Values *) |
|
147 |
(* ############################################################ *) |
|
148 |
||
149 |
val v_disjs = [v_disj_const_clos]; |
|
150 |
val v_disj_si = v_disjs @ (v_disjs RL [not_sym]); |
|
151 |
val v_disj_se = (v_disj_si RL [notE]); |
|
152 |
||
153 |
val v_injs = [v_const_inj, v_clos_inj]; |
|
154 |
||
155 |
fun v_ext_cs cs = cs addSIs v_disj_si addSEs v_disj_se addSDs v_injs; |
|
156 |
||
157 |
(* ############################################################ *) |
|
158 |
(* Evaluations *) |
|
159 |
(* ############################################################ *) |
|
160 |
||
161 |
(* Monotonicity of eval_fun *) |
|
162 |
||
163 |
goalw MT.thy [mono_def, eval_fun_def] "mono(eval_fun)"; |
|
245
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
164 |
(*Causes the most horrendous flexflex-trace.*) |
14 | 165 |
by infsys_mono_tac; |
171 | 166 |
qed "eval_fun_mono"; |
14 | 167 |
|
168 |
(* Introduction rules *) |
|
169 |
||
170 |
goalw MT.thy [eval_def, eval_rel_def] "ve |- e_const(c) ---> v_const(c)"; |
|
171 |
by (rtac lfp_intro2 1); |
|
172 |
by (rtac eval_fun_mono 1); |
|
173 |
by (rewtac eval_fun_def); |
|
245
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
174 |
by (fast_tac set_cs 1); |
171 | 175 |
qed "eval_const"; |
14 | 176 |
|
177 |
val prems = goalw MT.thy [eval_def, eval_rel_def] |
|
178 |
"ev:ve_dom(ve) ==> ve |- e_var(ev) ---> ve_app(ve,ev)"; |
|
179 |
by (cut_facts_tac prems 1); |
|
180 |
by (rtac lfp_intro2 1); |
|
181 |
by (rtac eval_fun_mono 1); |
|
182 |
by (rewtac eval_fun_def); |
|
245
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
183 |
by (fast_tac set_cs 1); |
171 | 184 |
qed "eval_var"; |
14 | 185 |
|
186 |
val prems = goalw MT.thy [eval_def, eval_rel_def] |
|
187 |
"ve |- fn ev => e ---> v_clos(<|ev,e,ve|>)"; |
|
188 |
by (cut_facts_tac prems 1); |
|
189 |
by (rtac lfp_intro2 1); |
|
190 |
by (rtac eval_fun_mono 1); |
|
191 |
by (rewtac eval_fun_def); |
|
245
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
192 |
by (fast_tac set_cs 1); |
171 | 193 |
qed "eval_fn"; |
14 | 194 |
|
195 |
val prems = goalw MT.thy [eval_def, eval_rel_def] |
|
196 |
" cl = <| ev1, e, ve + {ev2 |-> v_clos(cl)} |> ==> \ |
|
197 |
\ ve |- fix ev2(ev1) = e ---> v_clos(cl)"; |
|
198 |
by (cut_facts_tac prems 1); |
|
199 |
by (rtac lfp_intro2 1); |
|
200 |
by (rtac eval_fun_mono 1); |
|
201 |
by (rewtac eval_fun_def); |
|
245
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
202 |
by (fast_tac set_cs 1); |
171 | 203 |
qed "eval_fix"; |
14 | 204 |
|
205 |
val prems = goalw MT.thy [eval_def, eval_rel_def] |
|
206 |
" [| ve |- e1 ---> v_const(c1); ve |- e2 ---> v_const(c2) |] ==> \ |
|
207 |
\ ve |- e1 @ e2 ---> v_const(c_app(c1,c2))"; |
|
208 |
by (cut_facts_tac prems 1); |
|
209 |
by (rtac lfp_intro2 1); |
|
210 |
by (rtac eval_fun_mono 1); |
|
211 |
by (rewtac eval_fun_def); |
|
245
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
212 |
by (fast_tac set_cs 1); |
171 | 213 |
qed "eval_app1"; |
14 | 214 |
|
215 |
val prems = goalw MT.thy [eval_def, eval_rel_def] |
|
216 |
" [| ve |- e1 ---> v_clos(<|xm,em,vem|>); \ |
|
217 |
\ ve |- e2 ---> v2; \ |
|
218 |
\ vem + {xm |-> v2} |- em ---> v \ |
|
219 |
\ |] ==> \ |
|
220 |
\ ve |- e1 @ e2 ---> v"; |
|
221 |
by (cut_facts_tac prems 1); |
|
222 |
by (rtac lfp_intro2 1); |
|
223 |
by (rtac eval_fun_mono 1); |
|
224 |
by (rewtac eval_fun_def); |
|
245
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
225 |
by (fast_tac (set_cs addSIs [disjI2]) 1); |
171 | 226 |
qed "eval_app2"; |
14 | 227 |
|
228 |
(* Strong elimination, induction on evaluations *) |
|
229 |
||
230 |
val prems = goalw MT.thy [eval_def, eval_rel_def] |
|
231 |
" [| ve |- e ---> v; \ |
|
232 |
\ !!ve c. P(<<ve,e_const(c)>,v_const(c)>); \ |
|
233 |
\ !!ev ve. ev:ve_dom(ve) ==> P(<<ve,e_var(ev)>,ve_app(ve,ev)>); \ |
|
234 |
\ !!ev ve e. P(<<ve,fn ev => e>,v_clos(<|ev,e,ve|>)>); \ |
|
235 |
\ !!ev1 ev2 ve cl e. \ |
|
236 |
\ cl = <| ev1, e, ve + {ev2 |-> v_clos(cl)} |> ==> \ |
|
237 |
\ P(<<ve,fix ev2(ev1) = e>,v_clos(cl)>); \ |
|
238 |
\ !!ve c1 c2 e1 e2. \ |
|
239 |
\ [| P(<<ve,e1>,v_const(c1)>); P(<<ve,e2>,v_const(c2)>) |] ==> \ |
|
240 |
\ P(<<ve,e1 @ e2>,v_const(c_app(c1,c2))>); \ |
|
241 |
\ !!ve vem xm e1 e2 em v v2. \ |
|
242 |
\ [| P(<<ve,e1>,v_clos(<|xm,em,vem|>)>); \ |
|
243 |
\ P(<<ve,e2>,v2>); \ |
|
244 |
\ P(<<vem + {xm |-> v2},em>,v>) \ |
|
245 |
\ |] ==> \ |
|
246 |
\ P(<<ve,e1 @ e2>,v>) \ |
|
247 |
\ |] ==> \ |
|
248 |
\ P(<<ve,e>,v>)"; |
|
249 |
by (resolve_tac (prems RL [lfp_ind2]) 1); |
|
250 |
by (rtac eval_fun_mono 1); |
|
251 |
by (rewtac eval_fun_def); |
|
252 |
by (dtac CollectD 1); |
|
253 |
by (safe_tac HOL_cs); |
|
254 |
by (ALLGOALS (resolve_tac prems)); |
|
255 |
by (ALLGOALS (fast_tac set_cs)); |
|
171 | 256 |
qed "eval_ind0"; |
14 | 257 |
|
258 |
val prems = goal MT.thy |
|
259 |
" [| ve |- e ---> v; \ |
|
260 |
\ !!ve c. P(ve,e_const(c),v_const(c)); \ |
|
261 |
\ !!ev ve. ev:ve_dom(ve) ==> P(ve,e_var(ev),ve_app(ve,ev)); \ |
|
262 |
\ !!ev ve e. P(ve,fn ev => e,v_clos(<|ev,e,ve|>)); \ |
|
263 |
\ !!ev1 ev2 ve cl e. \ |
|
264 |
\ cl = <| ev1, e, ve + {ev2 |-> v_clos(cl)} |> ==> \ |
|
265 |
\ P(ve,fix ev2(ev1) = e,v_clos(cl)); \ |
|
266 |
\ !!ve c1 c2 e1 e2. \ |
|
267 |
\ [| P(ve,e1,v_const(c1)); P(ve,e2,v_const(c2)) |] ==> \ |
|
268 |
\ P(ve,e1 @ e2,v_const(c_app(c1,c2))); \ |
|
269 |
\ !!ve vem evm e1 e2 em v v2. \ |
|
270 |
\ [| P(ve,e1,v_clos(<|evm,em,vem|>)); \ |
|
271 |
\ P(ve,e2,v2); \ |
|
272 |
\ P(vem + {evm |-> v2},em,v) \ |
|
273 |
\ |] ==> P(ve,e1 @ e2,v) \ |
|
274 |
\ |] ==> P(ve,e,v)"; |
|
275 |
by (res_inst_tac [("P","P")] infsys_pp2 1); |
|
276 |
by (rtac eval_ind0 1); |
|
277 |
by (ALLGOALS (rtac infsys_pp1)); |
|
278 |
by (ALLGOALS (resolve_tac prems)); |
|
279 |
by (REPEAT ((assume_tac 1) ORELSE (dtac infsys_pp2 1))); |
|
171 | 280 |
qed "eval_ind"; |
14 | 281 |
|
282 |
(* ############################################################ *) |
|
283 |
(* Elaborations *) |
|
284 |
(* ############################################################ *) |
|
285 |
||
286 |
goalw MT.thy [mono_def, elab_fun_def] "mono(elab_fun)"; |
|
287 |
by infsys_mono_tac; |
|
171 | 288 |
qed "elab_fun_mono"; |
14 | 289 |
|
290 |
(* Introduction rules *) |
|
291 |
||
292 |
val prems = goalw MT.thy [elab_def, elab_rel_def] |
|
293 |
"c isof ty ==> te |- e_const(c) ===> ty"; |
|
294 |
by (cut_facts_tac prems 1); |
|
295 |
by (rtac lfp_intro2 1); |
|
296 |
by (rtac elab_fun_mono 1); |
|
297 |
by (rewtac elab_fun_def); |
|
245
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
298 |
by (fast_tac set_cs 1); |
171 | 299 |
qed "elab_const"; |
14 | 300 |
|
301 |
val prems = goalw MT.thy [elab_def, elab_rel_def] |
|
302 |
"x:te_dom(te) ==> te |- e_var(x) ===> te_app(te,x)"; |
|
303 |
by (cut_facts_tac prems 1); |
|
304 |
by (rtac lfp_intro2 1); |
|
305 |
by (rtac elab_fun_mono 1); |
|
306 |
by (rewtac elab_fun_def); |
|
245
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
307 |
by (fast_tac set_cs 1); |
171 | 308 |
qed "elab_var"; |
14 | 309 |
|
310 |
val prems = goalw MT.thy [elab_def, elab_rel_def] |
|
311 |
"te + {x |=> ty1} |- e ===> ty2 ==> te |- fn x => e ===> ty1->ty2"; |
|
312 |
by (cut_facts_tac prems 1); |
|
313 |
by (rtac lfp_intro2 1); |
|
314 |
by (rtac elab_fun_mono 1); |
|
315 |
by (rewtac elab_fun_def); |
|
245
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
316 |
by (fast_tac set_cs 1); |
171 | 317 |
qed "elab_fn"; |
14 | 318 |
|
319 |
val prems = goalw MT.thy [elab_def, elab_rel_def] |
|
320 |
" te + {f |=> ty1->ty2} + {x |=> ty1} |- e ===> ty2 ==> \ |
|
321 |
\ te |- fix f(x) = e ===> ty1->ty2"; |
|
322 |
by (cut_facts_tac prems 1); |
|
323 |
by (rtac lfp_intro2 1); |
|
324 |
by (rtac elab_fun_mono 1); |
|
325 |
by (rewtac elab_fun_def); |
|
245
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
326 |
by (rtac CollectI 1); |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
327 |
by (rtac disjI2 1); |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
328 |
by (rtac disjI2 1); |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
329 |
by (rtac disjI2 1); |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
330 |
by (rtac disjI1 1); |
14 | 331 |
by (fast_tac HOL_cs 1); |
171 | 332 |
qed "elab_fix"; |
14 | 333 |
|
334 |
val prems = goalw MT.thy [elab_def, elab_rel_def] |
|
335 |
" [| te |- e1 ===> ty1->ty2; te |- e2 ===> ty1 |] ==> \ |
|
336 |
\ te |- e1 @ e2 ===> ty2"; |
|
337 |
by (cut_facts_tac prems 1); |
|
338 |
by (rtac lfp_intro2 1); |
|
339 |
by (rtac elab_fun_mono 1); |
|
340 |
by (rewtac elab_fun_def); |
|
245
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
341 |
by (fast_tac (set_cs addSIs [disjI2]) 1); |
171 | 342 |
qed "elab_app"; |
14 | 343 |
|
344 |
(* Strong elimination, induction on elaborations *) |
|
345 |
||
346 |
val prems = goalw MT.thy [elab_def, elab_rel_def] |
|
347 |
" [| te |- e ===> t; \ |
|
348 |
\ !!te c t. c isof t ==> P(<<te,e_const(c)>,t>); \ |
|
349 |
\ !!te x. x:te_dom(te) ==> P(<<te,e_var(x)>,te_app(te,x)>); \ |
|
350 |
\ !!te x e t1 t2. \ |
|
351 |
\ [| te + {x |=> t1} |- e ===> t2; P(<<te + {x |=> t1},e>,t2>) |] ==> \ |
|
352 |
\ P(<<te,fn x => e>,t1->t2>); \ |
|
353 |
\ !!te f x e t1 t2. \ |
|
354 |
\ [| te + {f |=> t1->t2} + {x |=> t1} |- e ===> t2; \ |
|
355 |
\ P(<<te + {f |=> t1->t2} + {x |=> t1},e>,t2>) \ |
|
356 |
\ |] ==> \ |
|
357 |
\ P(<<te,fix f(x) = e>,t1->t2>); \ |
|
358 |
\ !!te e1 e2 t1 t2. \ |
|
359 |
\ [| te |- e1 ===> t1->t2; P(<<te,e1>,t1->t2>); \ |
|
360 |
\ te |- e2 ===> t1; P(<<te,e2>,t1>) \ |
|
361 |
\ |] ==> \ |
|
362 |
\ P(<<te,e1 @ e2>,t2>) \ |
|
363 |
\ |] ==> \ |
|
364 |
\ P(<<te,e>,t>)"; |
|
365 |
by (resolve_tac (prems RL [lfp_ind2]) 1); |
|
366 |
by (rtac elab_fun_mono 1); |
|
367 |
by (rewtac elab_fun_def); |
|
368 |
by (dtac CollectD 1); |
|
369 |
by (safe_tac HOL_cs); |
|
370 |
by (ALLGOALS (resolve_tac prems)); |
|
371 |
by (ALLGOALS (fast_tac set_cs)); |
|
171 | 372 |
qed "elab_ind0"; |
14 | 373 |
|
374 |
val prems = goal MT.thy |
|
375 |
" [| te |- e ===> t; \ |
|
376 |
\ !!te c t. c isof t ==> P(te,e_const(c),t); \ |
|
377 |
\ !!te x. x:te_dom(te) ==> P(te,e_var(x),te_app(te,x)); \ |
|
378 |
\ !!te x e t1 t2. \ |
|
379 |
\ [| te + {x |=> t1} |- e ===> t2; P(te + {x |=> t1},e,t2) |] ==> \ |
|
380 |
\ P(te,fn x => e,t1->t2); \ |
|
381 |
\ !!te f x e t1 t2. \ |
|
382 |
\ [| te + {f |=> t1->t2} + {x |=> t1} |- e ===> t2; \ |
|
383 |
\ P(te + {f |=> t1->t2} + {x |=> t1},e,t2) \ |
|
384 |
\ |] ==> \ |
|
385 |
\ P(te,fix f(x) = e,t1->t2); \ |
|
386 |
\ !!te e1 e2 t1 t2. \ |
|
387 |
\ [| te |- e1 ===> t1->t2; P(te,e1,t1->t2); \ |
|
388 |
\ te |- e2 ===> t1; P(te,e2,t1) \ |
|
389 |
\ |] ==> \ |
|
390 |
\ P(te,e1 @ e2,t2) \ |
|
391 |
\ |] ==> \ |
|
392 |
\ P(te,e,t)"; |
|
393 |
by (res_inst_tac [("P","P")] infsys_pp2 1); |
|
394 |
by (rtac elab_ind0 1); |
|
395 |
by (ALLGOALS (rtac infsys_pp1)); |
|
396 |
by (ALLGOALS (resolve_tac prems)); |
|
397 |
by (REPEAT ((assume_tac 1) ORELSE (dtac infsys_pp2 1))); |
|
171 | 398 |
qed "elab_ind"; |
14 | 399 |
|
400 |
(* Weak elimination, case analysis on elaborations *) |
|
401 |
||
402 |
val prems = goalw MT.thy [elab_def, elab_rel_def] |
|
403 |
" [| te |- e ===> t; \ |
|
404 |
\ !!te c t. c isof t ==> P(<<te,e_const(c)>,t>); \ |
|
405 |
\ !!te x. x:te_dom(te) ==> P(<<te,e_var(x)>,te_app(te,x)>); \ |
|
406 |
\ !!te x e t1 t2. \ |
|
407 |
\ te + {x |=> t1} |- e ===> t2 ==> P(<<te,fn x => e>,t1->t2>); \ |
|
408 |
\ !!te f x e t1 t2. \ |
|
409 |
\ te + {f |=> t1->t2} + {x |=> t1} |- e ===> t2 ==> \ |
|
410 |
\ P(<<te,fix f(x) = e>,t1->t2>); \ |
|
411 |
\ !!te e1 e2 t1 t2. \ |
|
412 |
\ [| te |- e1 ===> t1->t2; te |- e2 ===> t1 |] ==> \ |
|
413 |
\ P(<<te,e1 @ e2>,t2>) \ |
|
414 |
\ |] ==> \ |
|
415 |
\ P(<<te,e>,t>)"; |
|
416 |
by (resolve_tac (prems RL [lfp_elim2]) 1); |
|
417 |
by (rtac elab_fun_mono 1); |
|
418 |
by (rewtac elab_fun_def); |
|
419 |
by (dtac CollectD 1); |
|
420 |
by (safe_tac HOL_cs); |
|
421 |
by (ALLGOALS (resolve_tac prems)); |
|
422 |
by (ALLGOALS (fast_tac set_cs)); |
|
171 | 423 |
qed "elab_elim0"; |
14 | 424 |
|
425 |
val prems = goal MT.thy |
|
426 |
" [| te |- e ===> t; \ |
|
427 |
\ !!te c t. c isof t ==> P(te,e_const(c),t); \ |
|
428 |
\ !!te x. x:te_dom(te) ==> P(te,e_var(x),te_app(te,x)); \ |
|
429 |
\ !!te x e t1 t2. \ |
|
430 |
\ te + {x |=> t1} |- e ===> t2 ==> P(te,fn x => e,t1->t2); \ |
|
431 |
\ !!te f x e t1 t2. \ |
|
432 |
\ te + {f |=> t1->t2} + {x |=> t1} |- e ===> t2 ==> \ |
|
433 |
\ P(te,fix f(x) = e,t1->t2); \ |
|
434 |
\ !!te e1 e2 t1 t2. \ |
|
435 |
\ [| te |- e1 ===> t1->t2; te |- e2 ===> t1 |] ==> \ |
|
436 |
\ P(te,e1 @ e2,t2) \ |
|
437 |
\ |] ==> \ |
|
438 |
\ P(te,e,t)"; |
|
439 |
by (res_inst_tac [("P","P")] infsys_pp2 1); |
|
440 |
by (rtac elab_elim0 1); |
|
441 |
by (ALLGOALS (rtac infsys_pp1)); |
|
442 |
by (ALLGOALS (resolve_tac prems)); |
|
443 |
by (REPEAT ((assume_tac 1) ORELSE (dtac infsys_pp2 1))); |
|
171 | 444 |
qed "elab_elim"; |
14 | 445 |
|
446 |
(* Elimination rules for each expression *) |
|
447 |
||
448 |
fun elab_e_elim_tac p = |
|
449 |
( (rtac elab_elim 1) THEN |
|
450 |
(resolve_tac p 1) THEN |
|
451 |
(REPEAT (fast_tac (e_ext_cs HOL_cs) 1)) |
|
452 |
); |
|
453 |
||
454 |
val prems = goal MT.thy "te |- e ===> t ==> (e = e_const(c) --> c isof t)"; |
|
455 |
by (elab_e_elim_tac prems); |
|
171 | 456 |
qed "elab_const_elim_lem"; |
14 | 457 |
|
458 |
val prems = goal MT.thy "te |- e_const(c) ===> t ==> c isof t"; |
|
459 |
by (cut_facts_tac prems 1); |
|
460 |
by (dtac elab_const_elim_lem 1); |
|
461 |
by (fast_tac prop_cs 1); |
|
171 | 462 |
qed "elab_const_elim"; |
14 | 463 |
|
464 |
val prems = goal MT.thy |
|
465 |
"te |- e ===> t ==> (e = e_var(x) --> t=te_app(te,x) & x:te_dom(te))"; |
|
466 |
by (elab_e_elim_tac prems); |
|
171 | 467 |
qed "elab_var_elim_lem"; |
14 | 468 |
|
469 |
val prems = goal MT.thy |
|
470 |
"te |- e_var(ev) ===> t ==> t=te_app(te,ev) & ev : te_dom(te)"; |
|
471 |
by (cut_facts_tac prems 1); |
|
472 |
by (dtac elab_var_elim_lem 1); |
|
473 |
by (fast_tac prop_cs 1); |
|
171 | 474 |
qed "elab_var_elim"; |
14 | 475 |
|
476 |
val prems = goal MT.thy |
|
477 |
" te |- e ===> t ==> \ |
|
478 |
\ ( e = fn x1 => e1 --> \ |
|
479 |
\ (? t1 t2.t=t_fun(t1,t2) & te + {x1 |=> t1} |- e1 ===> t2) \ |
|
480 |
\ )"; |
|
481 |
by (elab_e_elim_tac prems); |
|
171 | 482 |
qed "elab_fn_elim_lem"; |
14 | 483 |
|
484 |
val prems = goal MT.thy |
|
485 |
" te |- fn x1 => e1 ===> t ==> \ |
|
486 |
\ (? t1 t2. t=t1->t2 & te + {x1 |=> t1} |- e1 ===> t2)"; |
|
487 |
by (cut_facts_tac prems 1); |
|
488 |
by (dtac elab_fn_elim_lem 1); |
|
489 |
by (fast_tac prop_cs 1); |
|
171 | 490 |
qed "elab_fn_elim"; |
14 | 491 |
|
492 |
val prems = goal MT.thy |
|
493 |
" te |- e ===> t ==> \ |
|
494 |
\ (e = fix f(x) = e1 --> \ |
|
495 |
\ (? t1 t2. t=t1->t2 & te + {f |=> t1->t2} + {x |=> t1} |- e1 ===> t2))"; |
|
496 |
by (elab_e_elim_tac prems); |
|
171 | 497 |
qed "elab_fix_elim_lem"; |
14 | 498 |
|
499 |
val prems = goal MT.thy |
|
500 |
" te |- fix ev1(ev2) = e1 ===> t ==> \ |
|
501 |
\ (? t1 t2. t=t1->t2 & te + {ev1 |=> t1->t2} + {ev2 |=> t1} |- e1 ===> t2)"; |
|
502 |
by (cut_facts_tac prems 1); |
|
503 |
by (dtac elab_fix_elim_lem 1); |
|
504 |
by (fast_tac prop_cs 1); |
|
171 | 505 |
qed "elab_fix_elim"; |
14 | 506 |
|
507 |
val prems = goal MT.thy |
|
508 |
" te |- e ===> t2 ==> \ |
|
509 |
\ (e = e1 @ e2 --> (? t1 . te |- e1 ===> t1->t2 & te |- e2 ===> t1))"; |
|
510 |
by (elab_e_elim_tac prems); |
|
171 | 511 |
qed "elab_app_elim_lem"; |
14 | 512 |
|
513 |
val prems = goal MT.thy |
|
514 |
"te |- e1 @ e2 ===> t2 ==> (? t1 . te |- e1 ===> t1->t2 & te |- e2 ===> t1)"; |
|
515 |
by (cut_facts_tac prems 1); |
|
516 |
by (dtac elab_app_elim_lem 1); |
|
517 |
by (fast_tac prop_cs 1); |
|
171 | 518 |
qed "elab_app_elim"; |
14 | 519 |
|
520 |
(* ############################################################ *) |
|
521 |
(* The extended correspondence relation *) |
|
522 |
(* ############################################################ *) |
|
523 |
||
524 |
(* Monotonicity of hasty_fun *) |
|
525 |
||
526 |
goalw MT.thy [mono_def,MT.hasty_fun_def] "mono(hasty_fun)"; |
|
527 |
by infsys_mono_tac; |
|
199 | 528 |
bind_thm("mono_hasty_fun", result()); |
14 | 529 |
|
530 |
(* |
|
531 |
Because hasty_rel has been defined as the greatest fixpoint of hasty_fun it |
|
532 |
enjoys two strong indtroduction (co-induction) rules and an elimination rule. |
|
533 |
*) |
|
534 |
||
535 |
(* First strong indtroduction (co-induction) rule for hasty_rel *) |
|
536 |
||
537 |
val prems = goalw MT.thy [hasty_rel_def] "c isof t ==> <v_const(c),t> : hasty_rel"; |
|
538 |
by (cut_facts_tac prems 1); |
|
539 |
by (rtac gfp_coind2 1); |
|
540 |
by (rewtac MT.hasty_fun_def); |
|
245
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
541 |
by (rtac CollectI 1); |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
542 |
by (rtac disjI1 1); |
14 | 543 |
by (fast_tac HOL_cs 1); |
544 |
by (rtac mono_hasty_fun 1); |
|
171 | 545 |
qed "hasty_rel_const_coind"; |
14 | 546 |
|
547 |
(* Second strong introduction (co-induction) rule for hasty_rel *) |
|
548 |
||
549 |
val prems = goalw MT.thy [hasty_rel_def] |
|
550 |
" [| te |- fn ev => e ===> t; \ |
|
551 |
\ ve_dom(ve) = te_dom(te); \ |
|
552 |
\ ! ev1. \ |
|
553 |
\ ev1:ve_dom(ve) --> \ |
|
554 |
\ <ve_app(ve,ev1),te_app(te,ev1)> : {<v_clos(<|ev,e,ve|>),t>} Un hasty_rel \ |
|
555 |
\ |] ==> \ |
|
556 |
\ <v_clos(<|ev,e,ve|>),t> : hasty_rel"; |
|
557 |
by (cut_facts_tac prems 1); |
|
558 |
by (rtac gfp_coind2 1); |
|
559 |
by (rewtac hasty_fun_def); |
|
245
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
560 |
by (rtac CollectI 1); |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
561 |
by (rtac disjI2 1); |
14 | 562 |
by (fast_tac HOL_cs 1); |
563 |
by (rtac mono_hasty_fun 1); |
|
171 | 564 |
qed "hasty_rel_clos_coind"; |
14 | 565 |
|
566 |
(* Elimination rule for hasty_rel *) |
|
567 |
||
568 |
val prems = goalw MT.thy [hasty_rel_def] |
|
569 |
" [| !! c t.c isof t ==> P(<v_const(c),t>); \ |
|
570 |
\ !! te ev e t ve. \ |
|
571 |
\ [| te |- fn ev => e ===> t; \ |
|
572 |
\ ve_dom(ve) = te_dom(te); \ |
|
573 |
\ !ev1.ev1:ve_dom(ve) --> <ve_app(ve,ev1),te_app(te,ev1)> : hasty_rel \ |
|
574 |
\ |] ==> P(<v_clos(<|ev,e,ve|>),t>); \ |
|
575 |
\ <v,t> : hasty_rel \ |
|
576 |
\ |] ==> P(<v,t>)"; |
|
577 |
by (cut_facts_tac prems 1); |
|
578 |
by (etac gfp_elim2 1); |
|
579 |
by (rtac mono_hasty_fun 1); |
|
580 |
by (rewtac hasty_fun_def); |
|
581 |
by (dtac CollectD 1); |
|
582 |
by (fold_goals_tac [hasty_fun_def]); |
|
583 |
by (safe_tac HOL_cs); |
|
584 |
by (ALLGOALS (resolve_tac prems)); |
|
585 |
by (ALLGOALS (fast_tac set_cs)); |
|
171 | 586 |
qed "hasty_rel_elim0"; |
14 | 587 |
|
588 |
val prems = goal MT.thy |
|
589 |
" [| <v,t> : hasty_rel; \ |
|
590 |
\ !! c t.c isof t ==> P(v_const(c),t); \ |
|
591 |
\ !! te ev e t ve. \ |
|
592 |
\ [| te |- fn ev => e ===> t; \ |
|
593 |
\ ve_dom(ve) = te_dom(te); \ |
|
594 |
\ !ev1.ev1:ve_dom(ve) --> <ve_app(ve,ev1),te_app(te,ev1)> : hasty_rel \ |
|
595 |
\ |] ==> P(v_clos(<|ev,e,ve|>),t) \ |
|
596 |
\ |] ==> P(v,t)"; |
|
597 |
by (res_inst_tac [("P","P")] infsys_p2 1); |
|
598 |
by (rtac hasty_rel_elim0 1); |
|
599 |
by (ALLGOALS (rtac infsys_p1)); |
|
600 |
by (ALLGOALS (resolve_tac prems)); |
|
601 |
by (REPEAT ((assume_tac 1) ORELSE (dtac infsys_p2 1))); |
|
171 | 602 |
qed "hasty_rel_elim"; |
14 | 603 |
|
604 |
(* Introduction rules for hasty *) |
|
605 |
||
606 |
val prems = goalw MT.thy [hasty_def] "c isof t ==> v_const(c) hasty t"; |
|
607 |
by (resolve_tac (prems RL [hasty_rel_const_coind]) 1); |
|
171 | 608 |
qed "hasty_const"; |
14 | 609 |
|
610 |
val prems = goalw MT.thy [hasty_def,hasty_env_def] |
|
611 |
"te |- fn ev => e ===> t & ve hastyenv te ==> v_clos(<|ev,e,ve|>) hasty t"; |
|
612 |
by (cut_facts_tac prems 1); |
|
613 |
by (rtac hasty_rel_clos_coind 1); |
|
614 |
by (ALLGOALS (fast_tac set_cs)); |
|
171 | 615 |
qed "hasty_clos"; |
14 | 616 |
|
617 |
(* Elimination on constants for hasty *) |
|
618 |
||
619 |
val prems = goalw MT.thy [hasty_def] |
|
620 |
"v hasty t ==> (!c.(v = v_const(c) --> c isof t))"; |
|
621 |
by (cut_facts_tac prems 1); |
|
622 |
by (rtac hasty_rel_elim 1); |
|
623 |
by (ALLGOALS (fast_tac (v_ext_cs HOL_cs))); |
|
171 | 624 |
qed "hasty_elim_const_lem"; |
14 | 625 |
|
626 |
val prems = goal MT.thy "v_const(c) hasty t ==> c isof t"; |
|
627 |
by (cut_facts_tac (prems RL [hasty_elim_const_lem]) 1); |
|
628 |
by (fast_tac HOL_cs 1); |
|
171 | 629 |
qed "hasty_elim_const"; |
14 | 630 |
|
631 |
(* Elimination on closures for hasty *) |
|
632 |
||
633 |
val prems = goalw MT.thy [hasty_env_def,hasty_def] |
|
634 |
" v hasty t ==> \ |
|
635 |
\ ! x e ve. \ |
|
636 |
\ v=v_clos(<|x,e,ve|>) --> (? te.te |- fn x => e ===> t & ve hastyenv te)"; |
|
637 |
by (cut_facts_tac prems 1); |
|
638 |
by (rtac hasty_rel_elim 1); |
|
639 |
by (ALLGOALS (fast_tac (v_ext_cs HOL_cs))); |
|
171 | 640 |
qed "hasty_elim_clos_lem"; |
14 | 641 |
|
642 |
val prems = goal MT.thy |
|
643 |
"v_clos(<|ev,e,ve|>) hasty t ==> ? te.te |- fn ev => e ===> t & ve hastyenv te "; |
|
644 |
by (cut_facts_tac (prems RL [hasty_elim_clos_lem]) 1); |
|
645 |
by (fast_tac HOL_cs 1); |
|
171 | 646 |
qed "hasty_elim_clos"; |
14 | 647 |
|
648 |
(* ############################################################ *) |
|
649 |
(* The pointwise extension of hasty to environments *) |
|
650 |
(* ############################################################ *) |
|
651 |
||
652 |
val prems = goal MT.thy |
|
653 |
"[| ve hastyenv te; v hasty t |] ==> \ |
|
654 |
\ ve + {ev |-> v} hastyenv te + {ev |=> t}"; |
|
655 |
by (cut_facts_tac prems 1); |
|
245
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
656 |
by (rewtac hasty_env_def); |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
657 |
by (asm_full_simp_tac (HOL_ss addsimps [ve_dom_owr, te_dom_owr]) 1); |
14 | 658 |
by (safe_tac HOL_cs); |
245
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
659 |
by (excluded_middle_tac "ev=x" 1); |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
660 |
by (asm_full_simp_tac (HOL_ss addsimps [ve_app_owr2, te_app_owr2]) 1); |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
661 |
by (fast_tac set_cs 1); |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
662 |
by (asm_simp_tac (HOL_ss addsimps [ve_app_owr1, te_app_owr1]) 1); |
171 | 663 |
qed "hasty_env1"; |
14 | 664 |
|
665 |
(* ############################################################ *) |
|
666 |
(* The Consistency theorem *) |
|
667 |
(* ############################################################ *) |
|
668 |
||
669 |
val prems = goal MT.thy |
|
670 |
"[| ve hastyenv te ; te |- e_const(c) ===> t |] ==> v_const(c) hasty t"; |
|
671 |
by (cut_facts_tac prems 1); |
|
672 |
by (dtac elab_const_elim 1); |
|
673 |
by (etac hasty_const 1); |
|
171 | 674 |
qed "consistency_const"; |
14 | 675 |
|
676 |
val prems = goalw MT.thy [hasty_env_def] |
|
677 |
" [| ev : ve_dom(ve); ve hastyenv te ; te |- e_var(ev) ===> t |] ==> \ |
|
678 |
\ ve_app(ve,ev) hasty t"; |
|
679 |
by (cut_facts_tac prems 1); |
|
680 |
by (dtac elab_var_elim 1); |
|
681 |
by (fast_tac HOL_cs 1); |
|
171 | 682 |
qed "consistency_var"; |
14 | 683 |
|
684 |
val prems = goal MT.thy |
|
685 |
" [| ve hastyenv te ; te |- fn ev => e ===> t |] ==> \ |
|
686 |
\ v_clos(<| ev, e, ve |>) hasty t"; |
|
687 |
by (cut_facts_tac prems 1); |
|
688 |
by (rtac hasty_clos 1); |
|
689 |
by (fast_tac prop_cs 1); |
|
171 | 690 |
qed "consistency_fn"; |
14 | 691 |
|
692 |
val prems = goalw MT.thy [hasty_env_def,hasty_def] |
|
693 |
" [| cl = <| ev1, e, ve + { ev2 |-> v_clos(cl) } |>; \ |
|
694 |
\ ve hastyenv te ; \ |
|
695 |
\ te |- fix ev2 ev1 = e ===> t \ |
|
696 |
\ |] ==> \ |
|
697 |
\ v_clos(cl) hasty t"; |
|
698 |
by (cut_facts_tac prems 1); |
|
699 |
by (dtac elab_fix_elim 1); |
|
700 |
by (safe_tac HOL_cs); |
|
245
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
701 |
(*Do a single unfolding of cl*) |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
702 |
by ((forward_tac [ssubst] 1) THEN (assume_tac 2)); |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
703 |
by (rtac hasty_rel_clos_coind 1); |
14 | 704 |
by (etac elab_fn 1); |
245
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
705 |
by (asm_simp_tac (HOL_ss addsimps [ve_dom_owr, te_dom_owr]) 1); |
14 | 706 |
|
245
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
707 |
by (asm_simp_tac (HOL_ss addsimps [ve_dom_owr]) 1); |
14 | 708 |
by (safe_tac HOL_cs); |
245
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
709 |
by (excluded_middle_tac "ev2=ev1a" 1); |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
710 |
by (asm_full_simp_tac (HOL_ss addsimps [ve_app_owr2, te_app_owr2]) 1); |
14 | 711 |
by (fast_tac set_cs 1); |
712 |
||
245
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
713 |
by (asm_simp_tac (HOL_ss addsimps [ve_app_owr1, te_app_owr1]) 1); |
14 | 714 |
by (hyp_subst_tac 1); |
715 |
by (etac subst 1); |
|
716 |
by (fast_tac set_cs 1); |
|
171 | 717 |
qed "consistency_fix"; |
14 | 718 |
|
719 |
val prems = goal MT.thy |
|
720 |
" [| ! t te. ve hastyenv te --> te |- e1 ===> t --> v_const(c1) hasty t; \ |
|
721 |
\ ! t te. ve hastyenv te --> te |- e2 ===> t --> v_const(c2) hasty t; \ |
|
722 |
\ ve hastyenv te ; te |- e1 @ e2 ===> t \ |
|
723 |
\ |] ==> \ |
|
724 |
\ v_const(c_app(c1,c2)) hasty t"; |
|
725 |
by (cut_facts_tac prems 1); |
|
726 |
by (dtac elab_app_elim 1); |
|
727 |
by (safe_tac HOL_cs); |
|
728 |
by (rtac hasty_const 1); |
|
729 |
by (rtac isof_app 1); |
|
730 |
by (rtac hasty_elim_const 1); |
|
731 |
by (fast_tac HOL_cs 1); |
|
732 |
by (rtac hasty_elim_const 1); |
|
733 |
by (fast_tac HOL_cs 1); |
|
171 | 734 |
qed "consistency_app1"; |
14 | 735 |
|
736 |
val prems = goal MT.thy |
|
737 |
" [| ! t te. \ |
|
738 |
\ ve hastyenv te --> \ |
|
739 |
\ te |- e1 ===> t --> v_clos(<|evm, em, vem|>) hasty t; \ |
|
740 |
\ ! t te. ve hastyenv te --> te |- e2 ===> t --> v2 hasty t; \ |
|
741 |
\ ! t te. \ |
|
742 |
\ vem + { evm |-> v2 } hastyenv te --> te |- em ===> t --> v hasty t; \ |
|
743 |
\ ve hastyenv te ; \ |
|
744 |
\ te |- e1 @ e2 ===> t \ |
|
745 |
\ |] ==> \ |
|
746 |
\ v hasty t"; |
|
747 |
by (cut_facts_tac prems 1); |
|
748 |
by (dtac elab_app_elim 1); |
|
749 |
by (safe_tac HOL_cs); |
|
245
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
750 |
by ((etac allE 1) THEN (etac allE 1) THEN (etac impE 1)); |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
751 |
by (assume_tac 1); |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
752 |
by (etac impE 1); |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
753 |
by (assume_tac 1); |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
754 |
by ((etac allE 1) THEN (etac allE 1) THEN (etac impE 1)); |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
755 |
by (assume_tac 1); |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
756 |
by (etac impE 1); |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
757 |
by (assume_tac 1); |
14 | 758 |
by (dtac hasty_elim_clos 1); |
759 |
by (safe_tac HOL_cs); |
|
760 |
by (dtac elab_fn_elim 1); |
|
761 |
by (safe_tac HOL_cs); |
|
762 |
by (dtac t_fun_inj 1); |
|
763 |
by (safe_tac prop_cs); |
|
764 |
by ((dtac hasty_env1 1) THEN (assume_tac 1) THEN (fast_tac HOL_cs 1)); |
|
171 | 765 |
qed "consistency_app2"; |
14 | 766 |
|
245
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
767 |
val [major] = goal MT.thy |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
768 |
"ve |- e ---> v ==> \ |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
769 |
\ (! t te. ve hastyenv te --> te |- e ===> t --> v hasty t)"; |
14 | 770 |
|
771 |
(* Proof by induction on the structure of evaluations *) |
|
772 |
||
245
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
773 |
by (rtac (major RS eval_ind) 1); |
14 | 774 |
by (safe_tac HOL_cs); |
245
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
775 |
by (DEPTH_SOLVE |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
776 |
(ares_tac [consistency_const, consistency_var, consistency_fn, |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
777 |
consistency_fix, consistency_app1, consistency_app2] 1)); |
171 | 778 |
qed "consistency"; |
14 | 779 |
|
780 |
(* ############################################################ *) |
|
781 |
(* The Basic Consistency theorem *) |
|
782 |
(* ############################################################ *) |
|
783 |
||
784 |
val prems = goalw MT.thy [isof_env_def,hasty_env_def] |
|
785 |
"ve isofenv te ==> ve hastyenv te"; |
|
786 |
by (cut_facts_tac prems 1); |
|
787 |
by (safe_tac HOL_cs); |
|
245
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
788 |
by (etac allE 1); |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
789 |
by (etac impE 1); |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
790 |
by (assume_tac 1); |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
791 |
by (etac exE 1); |
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
792 |
by (etac conjE 1); |
14 | 793 |
by (dtac hasty_const 1); |
245
63e249badea6
Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents:
199
diff
changeset
|
794 |
by (asm_simp_tac HOL_ss 1); |
171 | 795 |
qed "basic_consistency_lem"; |
14 | 796 |
|
797 |
val prems = goal MT.thy |
|
798 |
"[| ve isofenv te; ve |- e ---> v_const(c); te |- e ===> t |] ==> c isof t"; |
|
799 |
by (cut_facts_tac prems 1); |
|
800 |
by (rtac hasty_elim_const 1); |
|
801 |
by (dtac consistency 1); |
|
802 |
by (fast_tac (HOL_cs addSIs [basic_consistency_lem]) 1); |
|
171 | 803 |
qed "basic_consistency"; |
14 | 804 |
|
805 |