196 |
196 |
197 declare split_if [split del] split_if_asm [split del] |
197 declare split_if [split del] split_if_asm [split del] |
198 option.split [split del] option.split_asm [split del] |
198 option.split [split del] option.split_asm [split del] |
199 not_None_eq [simp del] |
199 not_None_eq [simp del] |
200 split_paired_All [simp del] split_paired_Ex [simp del] |
200 split_paired_All [simp del] split_paired_Ex [simp del] |
201 ML_setup {* |
201 declaration {* K (Simplifier.map_ss (fn ss => ss delloop "split_all_tac")) *} |
202 change_simpset (fn ss => ss delloop "split_all_tac"); |
202 |
203 *} |
|
204 inductive_cases evaln_cases: "G\<turnstile>s \<midarrow>t\<succ>\<midarrow>n\<rightarrow> (v, s')" |
203 inductive_cases evaln_cases: "G\<turnstile>s \<midarrow>t\<succ>\<midarrow>n\<rightarrow> (v, s')" |
205 |
204 |
206 inductive_cases evaln_elim_cases: |
205 inductive_cases evaln_elim_cases: |
207 "G\<turnstile>(Some xc, s) \<midarrow>t \<succ>\<midarrow>n\<rightarrow> (v, s')" |
206 "G\<turnstile>(Some xc, s) \<midarrow>t \<succ>\<midarrow>n\<rightarrow> (v, s')" |
208 "G\<turnstile>Norm s \<midarrow>In1r Skip \<succ>\<midarrow>n\<rightarrow> (x, s')" |
207 "G\<turnstile>Norm s \<midarrow>In1r Skip \<succ>\<midarrow>n\<rightarrow> (x, s')" |
239 |
238 |
240 declare split_if [split] split_if_asm [split] |
239 declare split_if [split] split_if_asm [split] |
241 option.split [split] option.split_asm [split] |
240 option.split [split] option.split_asm [split] |
242 not_None_eq [simp] |
241 not_None_eq [simp] |
243 split_paired_All [simp] split_paired_Ex [simp] |
242 split_paired_All [simp] split_paired_Ex [simp] |
244 ML_setup {* |
243 declaration {* K (Simplifier.map_ss (fn ss => ss addloop ("split_all_tac", split_all_tac))) *} |
245 change_simpset (fn ss => ss addloop ("split_all_tac", split_all_tac)); |
244 |
246 *} |
|
247 lemma evaln_Inj_elim: "G\<turnstile>s \<midarrow>t\<succ>\<midarrow>n\<rightarrow> (w,s') \<Longrightarrow> case t of In1 ec \<Rightarrow> |
245 lemma evaln_Inj_elim: "G\<turnstile>s \<midarrow>t\<succ>\<midarrow>n\<rightarrow> (w,s') \<Longrightarrow> case t of In1 ec \<Rightarrow> |
248 (case ec of Inl e \<Rightarrow> (\<exists>v. w = In1 v) | Inr c \<Rightarrow> w = \<diamondsuit>) |
246 (case ec of Inl e \<Rightarrow> (\<exists>v. w = In1 v) | Inr c \<Rightarrow> w = \<diamondsuit>) |
249 | In2 e \<Rightarrow> (\<exists>v. w = In2 v) | In3 e \<Rightarrow> (\<exists>v. w = In3 v)" |
247 | In2 e \<Rightarrow> (\<exists>v. w = In2 v) | In3 e \<Rightarrow> (\<exists>v. w = In3 v)" |
250 apply (erule evaln_cases , auto) |
248 apply (erule evaln_cases , auto) |
251 apply (induct_tac "t") |
249 apply (induct_tac "t") |
270 by (auto, frule evaln_Inj_elim, auto) |
268 by (auto, frule evaln_Inj_elim, auto) |
271 |
269 |
272 lemma evaln_stmt_eq: "G\<turnstile>s \<midarrow>In1r t\<succ>\<midarrow>n\<rightarrow> (w, s') = (w=\<diamondsuit> \<and> G\<turnstile>s \<midarrow>t \<midarrow>n\<rightarrow> s')" |
270 lemma evaln_stmt_eq: "G\<turnstile>s \<midarrow>In1r t\<succ>\<midarrow>n\<rightarrow> (w, s') = (w=\<diamondsuit> \<and> G\<turnstile>s \<midarrow>t \<midarrow>n\<rightarrow> s')" |
273 by (auto, frule evaln_Inj_elim, auto, frule evaln_Inj_elim, auto) |
271 by (auto, frule evaln_Inj_elim, auto, frule evaln_Inj_elim, auto) |
274 |
272 |
275 ML_setup {* |
273 simproc_setup evaln_expr ("G\<turnstile>s \<midarrow>In1l t\<succ>\<midarrow>n\<rightarrow> (w, s')") = {* |
276 fun enf name lhs = |
274 fn _ => fn _ => fn ct => |
277 let |
275 (case Thm.term_of ct of |
278 fun is_Inj (Const (inj,_) $ _) = true |
276 (_ $ _ $ _ $ _ $ _ $ (Const _ $ _) $ _) => NONE |
279 | is_Inj _ = false |
277 | _ => SOME (mk_meta_eq @{thm evaln_expr_eq})) *} |
280 fun pred (_ $ _ $ _ $ _ $ _ $ x $ _) = is_Inj x |
278 |
281 in |
279 simproc_setup evaln_var ("G\<turnstile>s \<midarrow>In2 t\<succ>\<midarrow>n\<rightarrow> (w, s')") = {* |
282 cond_simproc name lhs pred (thm name) |
280 fn _ => fn _ => fn ct => |
283 end; |
281 (case Thm.term_of ct of |
284 |
282 (_ $ _ $ _ $ _ $ _ $ (Const _ $ _) $ _) => NONE |
285 val evaln_expr_proc = enf "evaln_expr_eq" "G\<turnstile>s \<midarrow>In1l t\<succ>\<midarrow>n\<rightarrow> (w, s')"; |
283 | _ => SOME (mk_meta_eq @{thm evaln_var_eq})) *} |
286 val evaln_var_proc = enf "evaln_var_eq" "G\<turnstile>s \<midarrow>In2 t\<succ>\<midarrow>n\<rightarrow> (w, s')"; |
284 |
287 val evaln_exprs_proc = enf "evaln_exprs_eq" "G\<turnstile>s \<midarrow>In3 t\<succ>\<midarrow>n\<rightarrow> (w, s')"; |
285 simproc_setup evaln_exprs ("G\<turnstile>s \<midarrow>In3 t\<succ>\<midarrow>n\<rightarrow> (w, s')") = {* |
288 val evaln_stmt_proc = enf "evaln_stmt_eq" "G\<turnstile>s \<midarrow>In1r t\<succ>\<midarrow>n\<rightarrow> (w, s')"; |
286 fn _ => fn _ => fn ct => |
289 Addsimprocs [evaln_expr_proc,evaln_var_proc,evaln_exprs_proc,evaln_stmt_proc]; |
287 (case Thm.term_of ct of |
290 |
288 (_ $ _ $ _ $ _ $ _ $ (Const _ $ _) $ _) => NONE |
291 bind_thms ("evaln_AbruptIs", sum3_instantiate (thm "evaln.Abrupt")) |
289 | _ => SOME (mk_meta_eq @{thm evaln_exprs_eq})) *} |
292 *} |
290 |
|
291 simproc_setup evaln_stmt ("G\<turnstile>s \<midarrow>In1r t\<succ>\<midarrow>n\<rightarrow> (w, s')") = {* |
|
292 fn _ => fn _ => fn ct => |
|
293 (case Thm.term_of ct of |
|
294 (_ $ _ $ _ $ _ $ _ $ (Const _ $ _) $ _) => NONE |
|
295 | _ => SOME (mk_meta_eq @{thm evaln_stmt_eq})) *} |
|
296 |
|
297 ML_setup {* bind_thms ("evaln_AbruptIs", sum3_instantiate @{thm evaln.Abrupt}) *} |
293 declare evaln_AbruptIs [intro!] |
298 declare evaln_AbruptIs [intro!] |
294 |
299 |
295 lemma evaln_Callee: "G\<turnstile>Norm s\<midarrow>In1l (Callee l e)\<succ>\<midarrow>n\<rightarrow> (v,s') = False" |
300 lemma evaln_Callee: "G\<turnstile>Norm s\<midarrow>In1l (Callee l e)\<succ>\<midarrow>n\<rightarrow> (v,s') = False" |
296 proof - |
301 proof - |
297 { fix s t v s' |
302 { fix s t v s' |
350 w=arbitrary3 e \<and> G\<turnstile>(Some xc,s) \<midarrow>e\<succ>\<midarrow>n\<rightarrow> (arbitrary3 e,(Some xc,s)))" |
355 w=arbitrary3 e \<and> G\<turnstile>(Some xc,s) \<midarrow>e\<succ>\<midarrow>n\<rightarrow> (arbitrary3 e,(Some xc,s)))" |
351 apply auto |
356 apply auto |
352 apply (frule evaln_abrupt_lemma, auto)+ |
357 apply (frule evaln_abrupt_lemma, auto)+ |
353 done |
358 done |
354 |
359 |
355 ML {* |
360 simproc_setup evaln_abrupt ("G\<turnstile>(Some xc,s) \<midarrow>e\<succ>\<midarrow>n\<rightarrow> (w,s')") = {* |
356 local |
361 fn _ => fn _ => fn ct => |
357 fun is_Some (Const ("Pair",_) $ (Const ("Datatype.option.Some",_) $ _)$ _) =true |
362 (case Thm.term_of ct of |
358 | is_Some _ = false |
363 (_ $ _ $ _ $ _ $ _ $ _ $ (Const ("Pair",_) $ (Const ("Datatype.option.Some",_) $ _)$ _)) |
359 fun pred (_ $ _ $ _ $ _ $ _ $ _ $ x) = is_Some x |
364 => NONE |
360 in |
365 | _ => SOME (mk_meta_eq @{thm evaln_abrupt})) |
361 val evaln_abrupt_proc = |
|
362 cond_simproc "evaln_abrupt" "G\<turnstile>(Some xc,s) \<midarrow>e\<succ>\<midarrow>n\<rightarrow> (w,s')" pred (thm "evaln_abrupt") |
|
363 end; |
|
364 Addsimprocs [evaln_abrupt_proc] |
|
365 *} |
366 *} |
366 |
367 |
367 lemma evaln_LitI: "G\<turnstile>s \<midarrow>Lit v-\<succ>(if normal s then v else arbitrary)\<midarrow>n\<rightarrow> s" |
368 lemma evaln_LitI: "G\<turnstile>s \<midarrow>Lit v-\<succ>(if normal s then v else arbitrary)\<midarrow>n\<rightarrow> s" |
368 apply (case_tac "s", case_tac "a = None") |
369 apply (case_tac "s", case_tac "a = None") |
369 by (auto intro!: evaln.Lit) |
370 by (auto intro!: evaln.Lit) |