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