9 |
9 |
10 (* ############################################################ *) |
10 (* ############################################################ *) |
11 (* The Consistency theorem *) |
11 (* The Consistency theorem *) |
12 (* ############################################################ *) |
12 (* ############################################################ *) |
13 |
13 |
14 val prems = goal MT.thy |
14 goal MT.thy |
15 "[| c:Const; hastyenv(ve,te);<te,e_const(c),t>:ElabRel |] ==> \ |
15 "!!t. [| c:Const; hastyenv(ve,te);<te,e_const(c),t>:ElabRel |] ==> \ |
16 \ <v_const(c), t> : HasTyRel"; |
16 \ <v_const(c), t> : HasTyRel"; |
17 by (cut_facts_tac prems 1); |
17 by (Fast_tac 1); |
18 by (fast_tac htr_cs 1); |
|
19 qed "consistency_const"; |
18 qed "consistency_const"; |
20 |
19 |
21 |
20 |
22 val prems = goalw MT.thy [hastyenv_def] |
21 goalw MT.thy [hastyenv_def] |
23 "[| x:ve_dom(ve); hastyenv(ve,te); <te,e_var(x),t>:ElabRel |] ==> \ |
22 "!!t. [| x:ve_dom(ve); hastyenv(ve,te); <te,e_var(x),t>:ElabRel |] ==> \ |
24 \ <ve_app(ve,x),t>:HasTyRel"; |
23 \ <ve_app(ve,x),t>:HasTyRel"; |
25 by (cut_facts_tac prems 1); |
24 by (Fast_tac 1); |
26 by (fast_tac static_cs 1); |
|
27 qed "consistency_var"; |
25 qed "consistency_var"; |
28 |
26 |
29 |
27 |
30 val prems = goalw MT.thy [hastyenv_def] |
28 goalw MT.thy [hastyenv_def] |
31 "[| ve:ValEnv; x:ExVar; e:Exp; hastyenv(ve,te); \ |
29 "!!t. [| ve:ValEnv; x:ExVar; e:Exp; hastyenv(ve,te); \ |
32 \ <te,e_fn(x,e),t>:ElabRel \ |
30 \ <te,e_fn(x,e),t>:ElabRel \ |
33 \ |] ==> \ |
31 \ |] ==> <v_clos(x, e, ve), t> : HasTyRel"; |
34 \ <v_clos(x, e, ve), t> : HasTyRel"; |
32 by (Best_tac 1); |
35 by (cut_facts_tac prems 1); |
|
36 by (best_tac htr_cs 1); |
|
37 qed "consistency_fn"; |
33 qed "consistency_fn"; |
38 |
34 |
39 val MT_cs = ZF_cs |
35 AddIs (Ty.intrs@TyEnv.intrs@Val_ValEnv.intrs); |
40 addIs (Ty.intrs@TyEnv.intrs@Val_ValEnv.intrs) |
36 AddDs [te_owrE,(ElabRel.dom_subset RS subsetD)]; |
41 addDs [te_owrE,(ElabRel.dom_subset RS subsetD)]; |
|
42 |
37 |
43 val MT_ss = |
38 Addsimps [ve_dom_owr, te_dom_owr, ve_app_owr1, ve_app_owr2, |
44 ZF_ss addsimps |
39 te_app_owr1, te_app_owr2]; |
45 [ve_dom_owr,te_dom_owr,ve_app_owr1,ve_app_owr2,te_app_owr1,te_app_owr2]; |
|
46 |
40 |
47 val clean_tac = |
41 val clean_tac = |
48 REPEAT_FIRST (fn i => |
42 REPEAT_FIRST (fn i => |
49 (eq_assume_tac i) ORELSE |
43 (eq_assume_tac i) ORELSE |
50 (match_tac (Ty.intrs@TyEnv.intrs@Val_ValEnv.intrs) i) ORELSE |
44 (match_tac (Ty.intrs@TyEnv.intrs@Val_ValEnv.intrs) i) ORELSE |
55 \ v_clos(x,e,ve_owr(ve,f,cl)) = cl; \ |
49 \ v_clos(x,e,ve_owr(ve,f,cl)) = cl; \ |
56 \ hastyenv(ve,te); <te,e_fix(f,x,e),t>:ElabRel |] ==> \ |
50 \ hastyenv(ve,te); <te,e_fix(f,x,e),t>:ElabRel |] ==> \ |
57 \ <cl,t>:HasTyRel"; |
51 \ <cl,t>:HasTyRel"; |
58 by (cut_facts_tac prems 1); |
52 by (cut_facts_tac prems 1); |
59 by (etac elab_fixE 1); |
53 by (etac elab_fixE 1); |
60 by (safe_tac ZF_cs); |
54 by (safe_tac (!claset)); |
61 by (EVERY [forward_tac [subst] 1,atac 2,rtac htr_closCI 1]); |
55 by (EVERY [forward_tac [subst] 1,atac 2,rtac htr_closCI 1]); |
62 by clean_tac; |
56 by clean_tac; |
63 by (rtac ve_owrI 1); |
57 by (rtac ve_owrI 1); |
64 by clean_tac; |
58 by clean_tac; |
65 by (dtac (ElabRel.dom_subset RS subsetD) 1); |
59 by (dtac (ElabRel.dom_subset RS subsetD) 1); |
68 (SigmaD1 RS te_owrE) 1 |
62 (SigmaD1 RS te_owrE) 1 |
69 ); |
63 ); |
70 by (assume_tac 1); |
64 by (assume_tac 1); |
71 by (rtac ElabRel.elab_fnI 1); |
65 by (rtac ElabRel.elab_fnI 1); |
72 by clean_tac; |
66 by clean_tac; |
73 by (asm_simp_tac MT_ss 1); |
67 by (Asm_simp_tac 1); |
74 by (stac ve_dom_owr 1); |
68 by (stac ve_dom_owr 1); |
75 by (assume_tac 1); |
69 by (assume_tac 1); |
76 by (etac subst 1); |
70 by (etac subst 1); |
77 by (rtac v_closNE 1); |
71 by (rtac v_closNE 1); |
78 by (asm_simp_tac ZF_ss 1); |
72 by (Asm_simp_tac 1); |
79 |
73 |
80 by (rtac PowI 1); |
74 by (rtac PowI 1); |
81 by (stac ve_dom_owr 1); |
75 by (stac ve_dom_owr 1); |
82 by (assume_tac 1); |
76 by (assume_tac 1); |
83 by (etac subst 1); |
77 by (etac subst 1); |
84 by (rtac v_closNE 1); |
78 by (rtac v_closNE 1); |
85 by (rtac subsetI 1); |
79 by (rtac subsetI 1); |
86 by (etac RepFunE 1); |
80 by (etac RepFunE 1); |
87 by (dtac lem_fix 1); |
81 by (excluded_middle_tac "f=y" 1); |
88 by (etac UnE' 1); |
82 by (Auto_tac()); |
89 by (rtac UnI1 1); |
|
90 by (etac singletonE 1); |
|
91 by (asm_full_simp_tac MT_ss 1); |
|
92 by (rtac UnI2 1); |
|
93 by (etac notsingletonE 1); |
|
94 by (dtac not_sym 1); |
|
95 by (asm_full_simp_tac MT_ss 1); |
|
96 qed "consistency_fix"; |
83 qed "consistency_fix"; |
97 |
84 |
98 |
85 |
99 val prems = goal MT.thy |
86 val prems = goal MT.thy |
100 " [| ve:ValEnv; e1:Exp; e2:Exp; c1:Const; c2:Const; \ |
87 " [| ve:ValEnv; e1:Exp; e2:Exp; c1:Const; c2:Const; \ |