author | wenzelm |
Mon, 16 Sep 2013 13:54:58 +0200 | |
changeset 53661 | 7b4cefeb87d8 |
parent 46822 | 95f1e700b712 |
child 57492 | 74bf65a1910a |
permissions | -rw-r--r-- |
1478 | 1 |
(* Title: ZF/Coind/ECR.thy |
2 |
Author: Jacob Frost, Cambridge University Computer Laboratory |
|
915 | 3 |
Copyright 1995 University of Cambridge |
4 |
*) |
|
5 |
||
16417 | 6 |
theory ECR imports Static Dynamic begin |
915 | 7 |
|
8 |
(* The extended correspondence relation *) |
|
9 |
||
10 |
consts |
|
1401 | 11 |
HasTyRel :: i |
915 | 12 |
coinductive |
46822
95f1e700b712
mathematical symbols for Isabelle/ZF example theories
paulson
parents:
45602
diff
changeset
|
13 |
domains "HasTyRel" \<subseteq> "Val * Ty" |
12595 | 14 |
intros |
15 |
htr_constI [intro!]: |
|
16 |
"[| c \<in> Const; t \<in> Ty; isof(c,t) |] ==> <v_const(c),t> \<in> HasTyRel" |
|
17 |
htr_closI [intro]: |
|
18 |
"[| x \<in> ExVar; e \<in> Exp; t \<in> Ty; ve \<in> ValEnv; te \<in> TyEnv; |
|
19 |
<te,e_fn(x,e),t> \<in> ElabRel; |
|
1478 | 20 |
ve_dom(ve) = te_dom(te); |
12595 | 21 |
{<ve_app(ve,y),te_app(te,y)>.y \<in> ve_dom(ve)} \<in> Pow(HasTyRel) |] |
22 |
==> <v_clos(x,e,ve),t> \<in> HasTyRel" |
|
6117 | 23 |
monos Pow_mono |
12595 | 24 |
type_intros Val_ValEnv.intros |
915 | 25 |
|
26 |
(* Pointwise extension to environments *) |
|
27 |
||
24893 | 28 |
definition |
29 |
hastyenv :: "[i,i] => o" where |
|
12595 | 30 |
"hastyenv(ve,te) == |
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
24893
diff
changeset
|
31 |
ve_dom(ve) = te_dom(te) & |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
24893
diff
changeset
|
32 |
(\<forall>x \<in> ve_dom(ve). <ve_app(ve,x),te_app(te,x)> \<in> HasTyRel)" |
12595 | 33 |
|
34 |
(* Specialised co-induction rule *) |
|
35 |
||
36 |
lemma htr_closCI [intro]: |
|
37 |
"[| x \<in> ExVar; e \<in> Exp; t \<in> Ty; ve \<in> ValEnv; te \<in> TyEnv; |
|
38 |
<te, e_fn(x, e), t> \<in> ElabRel; ve_dom(ve) = te_dom(te); |
|
39 |
{<ve_app(ve,y),te_app(te,y)>.y \<in> ve_dom(ve)} \<in> |
|
46822
95f1e700b712
mathematical symbols for Isabelle/ZF example theories
paulson
parents:
45602
diff
changeset
|
40 |
Pow({<v_clos(x,e,ve),t>} \<union> HasTyRel) |] |
12595 | 41 |
==> <v_clos(x, e, ve),t> \<in> HasTyRel" |
13339
0f89104dd377
Fixed quantified variable name preservation for ball and bex (bounded quants)
paulson
parents:
12610
diff
changeset
|
42 |
apply (rule singletonI [THEN HasTyRel.coinduct], auto) |
12595 | 43 |
done |
44 |
||
45 |
(* Specialised elimination rules *) |
|
46 |
||
12610 | 47 |
inductive_cases |
48 |
htr_constE [elim!]: "<v_const(c),t> \<in> HasTyRel" |
|
49 |
and htr_closE [elim]: "<v_clos(x,e,ve),t> \<in> HasTyRel" |
|
12595 | 50 |
|
51 |
||
52 |
(* Properties of the pointwise extension to environments *) |
|
53 |
||
54 |
lemmas HasTyRel_non_zero = |
|
45602 | 55 |
HasTyRel.dom_subset [THEN subsetD, THEN SigmaD1, THEN ValNEE] |
12595 | 56 |
|
57 |
lemma hastyenv_owr: |
|
58 |
"[| ve \<in> ValEnv; te \<in> TyEnv; hastyenv(ve,te); <v,t> \<in> HasTyRel |] |
|
59 |
==> hastyenv(ve_owr(ve,x,v),te_owr(te,x,t))" |
|
60 |
by (auto simp add: hastyenv_def ve_app_owr HasTyRel_non_zero) |
|
61 |
||
62 |
lemma basic_consistency_lem: |
|
63 |
"[| ve \<in> ValEnv; te \<in> TyEnv; isofenv(ve,te) |] ==> hastyenv(ve,te)" |
|
64 |
apply (unfold isofenv_def hastyenv_def) |
|
65 |
apply (force intro: te_appI ve_domI) |
|
66 |
done |
|
67 |
||
68 |
||
69 |
(* ############################################################ *) |
|
70 |
(* The Consistency theorem *) |
|
71 |
(* ############################################################ *) |
|
72 |
||
73 |
lemma consistency_const: |
|
74 |
"[| c \<in> Const; hastyenv(ve,te);<te,e_const(c),t> \<in> ElabRel |] |
|
75 |
==> <v_const(c), t> \<in> HasTyRel" |
|
76 |
by blast |
|
77 |
||
78 |
||
79 |
lemma consistency_var: |
|
80 |
"[| x \<in> ve_dom(ve); hastyenv(ve,te); <te,e_var(x),t> \<in> ElabRel |] ==> |
|
81 |
<ve_app(ve,x),t> \<in> HasTyRel" |
|
82 |
by (unfold hastyenv_def, blast) |
|
83 |
||
84 |
lemma consistency_fn: |
|
85 |
"[| ve \<in> ValEnv; x \<in> ExVar; e \<in> Exp; hastyenv(ve,te); |
|
86 |
<te,e_fn(x,e),t> \<in> ElabRel |
|
87 |
|] ==> <v_clos(x, e, ve), t> \<in> HasTyRel" |
|
88 |
by (unfold hastyenv_def, blast) |
|
89 |
||
90 |
declare ElabRel.dom_subset [THEN subsetD, dest] |
|
91 |
||
92 |
declare Ty.intros [simp, intro!] |
|
93 |
declare TyEnv.intros [simp, intro!] |
|
94 |
declare Val_ValEnv.intros [simp, intro!] |
|
95 |
||
96 |
lemma consistency_fix: |
|
97 |
"[| ve \<in> ValEnv; x \<in> ExVar; e \<in> Exp; f \<in> ExVar; cl \<in> Val; |
|
98 |
v_clos(x,e,ve_owr(ve,f,cl)) = cl; |
|
99 |
hastyenv(ve,te); <te,e_fix(f,x,e),t> \<in> ElabRel |] ==> |
|
100 |
<cl,t> \<in> HasTyRel" |
|
101 |
apply (unfold hastyenv_def) |
|
13339
0f89104dd377
Fixed quantified variable name preservation for ball and bex (bounded quants)
paulson
parents:
12610
diff
changeset
|
102 |
apply (erule elab_fixE, safe) |
12595 | 103 |
apply (rule subst, assumption) |
104 |
apply (rule_tac te="te_owr(te, f, t_fun(t1, t2))" in htr_closCI) |
|
105 |
apply simp_all |
|
106 |
apply (blast intro: ve_owrI) |
|
107 |
apply (rule ElabRel.fnI) |
|
13339
0f89104dd377
Fixed quantified variable name preservation for ball and bex (bounded quants)
paulson
parents:
12610
diff
changeset
|
108 |
apply (simp_all add: ValNEE, force) |
12595 | 109 |
done |
110 |
||
111 |
||
112 |
lemma consistency_app1: |
|
113 |
"[| ve \<in> ValEnv; e1 \<in> Exp; e2 \<in> Exp; c1 \<in> Const; c2 \<in> Const; |
|
114 |
<ve,e1,v_const(c1)> \<in> EvalRel; |
|
115 |
\<forall>t te. |
|
46822
95f1e700b712
mathematical symbols for Isabelle/ZF example theories
paulson
parents:
45602
diff
changeset
|
116 |
hastyenv(ve,te) \<longrightarrow> <te,e1,t> \<in> ElabRel \<longrightarrow> <v_const(c1),t> \<in> HasTyRel; |
12595 | 117 |
<ve, e2, v_const(c2)> \<in> EvalRel; |
118 |
\<forall>t te. |
|
46822
95f1e700b712
mathematical symbols for Isabelle/ZF example theories
paulson
parents:
45602
diff
changeset
|
119 |
hastyenv(ve,te) \<longrightarrow> <te,e2,t> \<in> ElabRel \<longrightarrow> <v_const(c2),t> \<in> HasTyRel; |
12595 | 120 |
hastyenv(ve, te); |
121 |
<te,e_app(e1,e2),t> \<in> ElabRel |] |
|
122 |
==> <v_const(c_app(c1, c2)),t> \<in> HasTyRel" |
|
123 |
by (blast intro!: c_appI intro: isof_app) |
|
124 |
||
125 |
lemma consistency_app2: |
|
126 |
"[| ve \<in> ValEnv; vem \<in> ValEnv; e1 \<in> Exp; e2 \<in> Exp; em \<in> Exp; xm \<in> ExVar; |
|
127 |
v \<in> Val; |
|
128 |
<ve,e1,v_clos(xm,em,vem)> \<in> EvalRel; |
|
46822
95f1e700b712
mathematical symbols for Isabelle/ZF example theories
paulson
parents:
45602
diff
changeset
|
129 |
\<forall>t te. hastyenv(ve,te) \<longrightarrow> |
95f1e700b712
mathematical symbols for Isabelle/ZF example theories
paulson
parents:
45602
diff
changeset
|
130 |
<te,e1,t> \<in> ElabRel \<longrightarrow> <v_clos(xm,em,vem),t> \<in> HasTyRel; |
12595 | 131 |
<ve,e2,v2> \<in> EvalRel; |
46822
95f1e700b712
mathematical symbols for Isabelle/ZF example theories
paulson
parents:
45602
diff
changeset
|
132 |
\<forall>t te. hastyenv(ve,te) \<longrightarrow> <te,e2,t> \<in> ElabRel \<longrightarrow> <v2,t> \<in> HasTyRel; |
12595 | 133 |
<ve_owr(vem,xm,v2),em,v> \<in> EvalRel; |
46822
95f1e700b712
mathematical symbols for Isabelle/ZF example theories
paulson
parents:
45602
diff
changeset
|
134 |
\<forall>t te. hastyenv(ve_owr(vem,xm,v2),te) \<longrightarrow> |
95f1e700b712
mathematical symbols for Isabelle/ZF example theories
paulson
parents:
45602
diff
changeset
|
135 |
<te,em,t> \<in> ElabRel \<longrightarrow> <v,t> \<in> HasTyRel; |
12595 | 136 |
hastyenv(ve,te); <te,e_app(e1,e2),t> \<in> ElabRel |] |
137 |
==> <v,t> \<in> HasTyRel" |
|
138 |
apply (erule elab_appE) |
|
139 |
apply (drule spec [THEN spec, THEN mp, THEN mp], assumption+) |
|
140 |
apply (drule spec [THEN spec, THEN mp, THEN mp], assumption+) |
|
141 |
apply (erule htr_closE) |
|
13339
0f89104dd377
Fixed quantified variable name preservation for ball and bex (bounded quants)
paulson
parents:
12610
diff
changeset
|
142 |
apply (erule elab_fnE, simp) |
12595 | 143 |
apply clarify |
144 |
apply (drule spec [THEN spec, THEN mp, THEN mp]) |
|
145 |
prefer 2 apply assumption+ |
|
13339
0f89104dd377
Fixed quantified variable name preservation for ball and bex (bounded quants)
paulson
parents:
12610
diff
changeset
|
146 |
apply (rule hastyenv_owr, assumption) |
12595 | 147 |
apply assumption |
13339
0f89104dd377
Fixed quantified variable name preservation for ball and bex (bounded quants)
paulson
parents:
12610
diff
changeset
|
148 |
apply (simp add: hastyenv_def, blast+) |
12595 | 149 |
done |
150 |
||
151 |
lemma consistency [rule_format]: |
|
152 |
"<ve,e,v> \<in> EvalRel |
|
46822
95f1e700b712
mathematical symbols for Isabelle/ZF example theories
paulson
parents:
45602
diff
changeset
|
153 |
==> (\<forall>t te. hastyenv(ve,te) \<longrightarrow> <te,e,t> \<in> ElabRel \<longrightarrow> <v,t> \<in> HasTyRel)" |
12595 | 154 |
apply (erule EvalRel.induct) |
155 |
apply (simp_all add: consistency_const consistency_var consistency_fn |
|
156 |
consistency_fix consistency_app1) |
|
157 |
apply (blast intro: consistency_app2) |
|
158 |
done |
|
159 |
||
160 |
lemma basic_consistency: |
|
161 |
"[| ve \<in> ValEnv; te \<in> TyEnv; isofenv(ve,te); |
|
162 |
<ve,e,v_const(c)> \<in> EvalRel; <te,e,t> \<in> ElabRel |] |
|
163 |
==> isof(c,t)" |
|
164 |
by (blast dest: consistency intro!: basic_consistency_lem) |
|
915 | 165 |
|
166 |
end |