1705 error_free (Norm s0) = error_free s1" |
1709 error_free (Norm s0) = error_free s1" |
1706 by simp |
1710 by simp |
1707 next |
1711 next |
1708 case (BinOp binop e1 e2 s0 s1 s2 v1 v2 L accC T) |
1712 case (BinOp binop e1 e2 s0 s1 s2 v1 v2 L accC T) |
1709 have hyp_e1: "PROP ?TypeSafe (Norm s0) s1 (In1l e1) (In1 v1)" . |
1713 have hyp_e1: "PROP ?TypeSafe (Norm s0) s1 (In1l e1) (In1 v1)" . |
1710 have hyp_e2: "PROP ?TypeSafe s1 s2 (In1l e2) (In1 v2)" . |
1714 have hyp_e2: "PROP ?TypeSafe s1 s2 |
|
1715 (if need_second_arg binop v1 then In1l e2 else In1r Skip) |
|
1716 (In1 v2)" . |
1711 have conf_s0: "Norm s0\<Colon>\<preceq>(G, L)" . |
1717 have conf_s0: "Norm s0\<Colon>\<preceq>(G, L)" . |
1712 have wt: "\<lparr>prg = G, cls = accC, lcl = L\<rparr>\<turnstile>In1l (BinOp binop e1 e2)\<Colon>T" . |
1718 have wt: "\<lparr>prg = G, cls = accC, lcl = L\<rparr>\<turnstile>In1l (BinOp binop e1 e2)\<Colon>T" . |
1713 then obtain e1T e2T where |
1719 then obtain e1T e2T where |
1714 wt_e1: "\<lparr>prg = G, cls = accC, lcl = L\<rparr>\<turnstile>e1\<Colon>-e1T" and |
1720 wt_e1: "\<lparr>prg = G, cls = accC, lcl = L\<rparr>\<turnstile>e1\<Colon>-e1T" and |
1715 wt_e2: "\<lparr>prg = G, cls = accC, lcl = L\<rparr>\<turnstile>e2\<Colon>-e2T" and |
1721 wt_e2: "\<lparr>prg = G, cls = accC, lcl = L\<rparr>\<turnstile>e2\<Colon>-e2T" and |
1716 wt_binop: "wt_binop G binop e1T e2T" and |
1722 wt_binop: "wt_binop G binop e1T e2T" and |
1717 T: "T=Inl (PrimT (binop_type binop))" |
1723 T: "T=Inl (PrimT (binop_type binop))" |
1718 by (auto elim!: wt_elim_cases) |
1724 by (auto elim!: wt_elim_cases) |
|
1725 have wt_Skip: "\<lparr>prg = G, cls = accC, lcl = L\<rparr>\<turnstile>Skip\<Colon>\<surd>" |
|
1726 by simp |
1719 from conf_s0 wt_e1 |
1727 from conf_s0 wt_e1 |
1720 obtain conf_s1: "s1\<Colon>\<preceq>(G, L)" and |
1728 obtain conf_s1: "s1\<Colon>\<preceq>(G, L)" and |
1721 wt_v1: "normal s1 \<longrightarrow> G,store s1\<turnstile>v1\<Colon>\<preceq>e1T" and |
1729 wt_v1: "normal s1 \<longrightarrow> G,store s1\<turnstile>v1\<Colon>\<preceq>e1T" and |
1722 error_free_s1: "error_free s1" |
1730 error_free_s1: "error_free s1" |
1723 by (auto dest!: hyp_e1) |
1731 by (auto dest!: hyp_e1) |
1724 from conf_s1 wt_e2 error_free_s1 |
1732 from conf_s1 wt_e2 wt_Skip error_free_s1 |
1725 obtain conf_s2: "s2\<Colon>\<preceq>(G, L)" and |
1733 obtain conf_s2: "s2\<Colon>\<preceq>(G, L)" and |
1726 wt_v2: "normal s2 \<longrightarrow> G,store s2\<turnstile>v2\<Colon>\<preceq>e2T" and |
|
1727 error_free_s2: "error_free s2" |
1734 error_free_s2: "error_free s2" |
1728 by (auto dest!: hyp_e2) |
1735 by (cases "need_second_arg binop v1") |
1729 from wt_v1 wt_v2 wt_binop T |
1736 (auto dest!: hyp_e2 ) |
|
1737 from wt_binop T |
1730 have "G,L,snd s2\<turnstile>In1l (BinOp binop e1 e2)\<succ>In1 (eval_binop binop v1 v2)\<Colon>\<preceq>T" |
1738 have "G,L,snd s2\<turnstile>In1l (BinOp binop e1 e2)\<succ>In1 (eval_binop binop v1 v2)\<Colon>\<preceq>T" |
1731 by (cases binop) auto |
1739 by (cases binop) auto |
1732 with conf_s2 error_free_s2 |
1740 with conf_s2 conf_s1 error_free_s2 error_free_s1 |
1733 show "s2\<Colon>\<preceq>(G, L) \<and> |
1741 show "s2\<Colon>\<preceq>(G, L) \<and> |
1734 (normal s2 \<longrightarrow> |
1742 (normal s2 \<longrightarrow> |
1735 G,L,snd s2\<turnstile>In1l (BinOp binop e1 e2)\<succ>In1 (eval_binop binop v1 v2)\<Colon>\<preceq>T) \<and> |
1743 G,L,snd s2\<turnstile>In1l (BinOp binop e1 e2)\<succ>In1 (eval_binop binop v1 v2)\<Colon>\<preceq>T) \<and> |
1736 error_free (Norm s0) = error_free s2" |
1744 error_free (Norm s0) = error_free s2" |
1737 by simp |
1745 by simp |
2362 (error_free (Norm s0) = error_free s2) " |
2370 (error_free (Norm s0) = error_free s2) " |
2363 by auto |
2371 by auto |
2364 qed |
2372 qed |
2365 then show ?thesis . |
2373 then show ?thesis . |
2366 qed |
2374 qed |
|
2375 |
|
2376 text {* |
|
2377 |
|
2378 |
|
2379 *} (* dummy text command to break paragraph for latex; |
|
2380 large paragraphs exhaust memory of debian pdflatex *) |
2367 |
2381 |
2368 corollary eval_ts: |
2382 corollary eval_ts: |
2369 "\<lbrakk>G\<turnstile>s \<midarrow>e-\<succ>v \<rightarrow> s'; wf_prog G; s\<Colon>\<preceq>(G,L); \<lparr>prg=G,cls=C,lcl=L\<rparr>\<turnstile>e\<Colon>-T\<rbrakk> |
2383 "\<lbrakk>G\<turnstile>s \<midarrow>e-\<succ>v \<rightarrow> s'; wf_prog G; s\<Colon>\<preceq>(G,L); \<lparr>prg=G,cls=C,lcl=L\<rparr>\<turnstile>e\<Colon>-T\<rbrakk> |
2370 \<Longrightarrow> s'\<Colon>\<preceq>(G,L) \<and> (normal s' \<longrightarrow> G,store s'\<turnstile>v\<Colon>\<preceq>T) \<and> |
2384 \<Longrightarrow> s'\<Colon>\<preceq>(G,L) \<and> (normal s' \<longrightarrow> G,store s'\<turnstile>v\<Colon>\<preceq>T) \<and> |
2371 (error_free s = error_free s')" |
2385 (error_free s = error_free s')" |
2393 "\<lbrakk>G\<turnstile>s \<midarrow>s0\<rightarrow> s'; wf_prog G; s\<Colon>\<preceq>(G,L); \<lparr>prg=G,cls=C,lcl=L\<rparr>\<turnstile>s0\<Colon>\<surd>\<rbrakk> |
2407 "\<lbrakk>G\<turnstile>s \<midarrow>s0\<rightarrow> s'; wf_prog G; s\<Colon>\<preceq>(G,L); \<lparr>prg=G,cls=C,lcl=L\<rparr>\<turnstile>s0\<Colon>\<surd>\<rbrakk> |
2394 \<Longrightarrow> s'\<Colon>\<preceq>(G,L) \<and> (error_free s \<longrightarrow> error_free s')" |
2408 \<Longrightarrow> s'\<Colon>\<preceq>(G,L) \<and> (error_free s \<longrightarrow> error_free s')" |
2395 apply (drule (3) eval_type_sound) |
2409 apply (drule (3) eval_type_sound) |
2396 apply clarsimp |
2410 apply clarsimp |
2397 done |
2411 done |
|
2412 |
|
2413 lemma wf_eval_Fin: |
|
2414 assumes wf: "wf_prog G" and |
|
2415 wt_c1: "\<lparr>prg = G, cls = C, lcl = L\<rparr>\<turnstile>In1r c1\<Colon>Inl (PrimT Void)" and |
|
2416 conf_s0: "Norm s0\<Colon>\<preceq>(G, L)" and |
|
2417 eval_c1: "G\<turnstile>Norm s0 \<midarrow>c1\<rightarrow> (x1,s1)" and |
|
2418 eval_c2: "G\<turnstile>Norm s1 \<midarrow>c2\<rightarrow> s2" and |
|
2419 s3: "s3=abupd (abrupt_if (x1\<noteq>None) x1) s2" |
|
2420 shows "G\<turnstile>Norm s0 \<midarrow>c1 Finally c2\<rightarrow> s3" |
|
2421 proof - |
|
2422 from eval_c1 wt_c1 wf conf_s0 |
|
2423 have "error_free (x1,s1)" |
|
2424 by (auto dest: eval_type_sound) |
|
2425 with eval_c1 eval_c2 s3 |
|
2426 show ?thesis |
|
2427 by - (rule eval.Fin, auto simp add: error_free_def) |
|
2428 qed |
|
2429 |
2398 end |
2430 end |