author | paulson |
Thu, 09 Jan 1997 10:22:42 +0100 | |
changeset 2498 | 7914881f47c0 |
parent 2083 | b56425a385b9 |
child 2513 | d708d8cdc8e8 |
permissions | -rw-r--r-- |
1300 | 1 |
(* Title: HOL/MiniML/W.ML |
2 |
ID: $Id$ |
|
3 |
Author: Dieter Nazareth and Tobias Nipkow |
|
4 |
Copyright 1995 TU Muenchen |
|
5 |
||
6 |
Correctness and completeness of type inference algorithm W |
|
7 |
*) |
|
8 |
||
9 |
open W; |
|
10 |
||
11 |
Addsimps [Suc_le_lessD]; |
|
1950
97f1c6bf3ace
Miniscoping rules are deleted, as these brittle proofs
paulson
parents:
1925
diff
changeset
|
12 |
Delsimps (ex_simps @ all_simps); |
1300 | 13 |
|
14 |
(* correctness of W with respect to has_type *) |
|
1525 | 15 |
goal W.thy |
16 |
"!a s t m n . Ok (s,t,m) = W e a n --> $s a |- e :: t"; |
|
1300 | 17 |
by (expr.induct_tac "e" 1); |
18 |
(* case Var n *) |
|
19 |
by (asm_simp_tac (!simpset setloop (split_tac [expand_if])) 1); |
|
20 |
(* case Abs e *) |
|
21 |
by (asm_full_simp_tac (!simpset addsimps [app_subst_list] |
|
22 |
setloop (split_tac [expand_bind])) 1); |
|
23 |
by (strip_tac 1); |
|
24 |
by (eres_inst_tac [("x","TVar(n) # a")] allE 1); |
|
2031 | 25 |
by ( fast_tac (HOL_cs addss (!simpset addsimps [eq_sym_conv])) 1); |
1300 | 26 |
(* case App e1 e2 *) |
27 |
by (simp_tac (!simpset setloop (split_tac [expand_bind])) 1); |
|
28 |
by (strip_tac 1); |
|
2031 | 29 |
by ( rename_tac "sa ta na sb tb nb sc" 1); |
1300 | 30 |
by (res_inst_tac [("t2.0","$ sc tb")] has_type.AppI 1); |
31 |
by (res_inst_tac [("s1","sc")] (app_subst_TVar RS subst) 1); |
|
32 |
by (rtac (app_subst_Fun RS subst) 1); |
|
1525 | 33 |
by (res_inst_tac [("t","$sc(tb -> (TVar nb))"),("s","$sc($sb ta)")] subst 1); |
1300 | 34 |
by (Asm_full_simp_tac 1); |
35 |
by (simp_tac (HOL_ss addsimps [subst_comp_tel RS sym]) 1); |
|
36 |
by ( (rtac has_type_cl_sub 1) THEN (rtac has_type_cl_sub 1)); |
|
37 |
by (asm_full_simp_tac (!simpset addsimps [eq_sym_conv]) 1); |
|
1669 | 38 |
by (asm_full_simp_tac (!simpset addsimps [subst_comp_tel RS sym,o_def,has_type_cl_sub,eq_sym_conv]) 1); |
1486 | 39 |
qed_spec_mp "W_correct"; |
1300 | 40 |
|
41 |
val has_type_casesE = map(has_type.mk_cases expr.simps) |
|
1465 | 42 |
[" s |- Var n :: t"," s |- Abs e :: t","s |- App e1 e2 ::t"]; |
1300 | 43 |
|
44 |
||
45 |
(* the resulting type variable is always greater or equal than the given one *) |
|
46 |
goal thy |
|
1465 | 47 |
"!a n s t m. W e a n = Ok (s,t,m) --> n<=m"; |
1300 | 48 |
by (expr.induct_tac "e" 1); |
49 |
(* case Var(n) *) |
|
50 |
by (fast_tac (HOL_cs addss (!simpset setloop (split_tac [expand_if]))) 1); |
|
51 |
(* case Abs e *) |
|
52 |
by (simp_tac (!simpset setloop (split_tac [expand_bind])) 1); |
|
53 |
by (fast_tac (HOL_cs addDs [Suc_leD]) 1); |
|
54 |
(* case App e1 e2 *) |
|
55 |
by (simp_tac (!simpset setloop (split_tac [expand_bind])) 1); |
|
56 |
by (strip_tac 1); |
|
57 |
by (rename_tac "s t na sa ta nb sb sc tb m" 1); |
|
58 |
by (eres_inst_tac [("x","a")] allE 1); |
|
59 |
by (eres_inst_tac [("x","n")] allE 1); |
|
60 |
by (eres_inst_tac [("x","$ s a")] allE 1); |
|
61 |
by (eres_inst_tac [("x","s")] allE 1); |
|
62 |
by (eres_inst_tac [("x","t")] allE 1); |
|
63 |
by (eres_inst_tac [("x","na")] allE 1); |
|
64 |
by (eres_inst_tac [("x","na")] allE 1); |
|
65 |
by (asm_full_simp_tac (!simpset addsimps [eq_sym_conv]) 1); |
|
66 |
by (etac conjE 1); |
|
67 |
by (eres_inst_tac [("x","sa")] allE 1); |
|
68 |
by (eres_inst_tac [("x","ta")] allE 1); |
|
69 |
by (eres_inst_tac [("x","nb")] allE 1); |
|
70 |
by (etac conjE 1); |
|
71 |
by (res_inst_tac [("j","na")] le_trans 1); |
|
72 |
by (Asm_simp_tac 1); |
|
1669 | 73 |
by (Asm_simp_tac 1); |
1486 | 74 |
qed_spec_mp "W_var_ge"; |
1300 | 75 |
|
76 |
Addsimps [W_var_ge]; |
|
77 |
||
78 |
goal thy |
|
1465 | 79 |
"!! s. Ok (s,t,m) = W e a n ==> n<=m"; |
1300 | 80 |
by (asm_full_simp_tac (!simpset addsimps [eq_sym_conv]) 1); |
81 |
qed "W_var_geD"; |
|
82 |
||
83 |
||
84 |
(* auxiliary lemma *) |
|
85 |
goal Maybe.thy "(y = Ok x) = (Ok x = y)"; |
|
2031 | 86 |
by ( simp_tac (!simpset addsimps [eq_sym_conv]) 1); |
1300 | 87 |
qed "rotate_Ok"; |
88 |
||
89 |
||
90 |
(* resulting type variable is new *) |
|
91 |
goal thy |
|
92 |
"!n a s t m. new_tv n a --> W e a n = Ok (s,t,m) --> \ |
|
1525 | 93 |
\ new_tv m s & new_tv m t"; |
1300 | 94 |
by (expr.induct_tac "e" 1); |
95 |
(* case Var n *) |
|
96 |
by (fast_tac (HOL_cs addss (!simpset |
|
1465 | 97 |
addsimps [id_subst_def,list_all_nth,new_tv_list,new_tv_subst] |
1300 | 98 |
setloop (split_tac [expand_if]))) 1); |
99 |
||
100 |
(* case Abs e *) |
|
101 |
by (simp_tac (!simpset addsimps [new_tv_subst,new_tv_Suc_list] |
|
102 |
setloop (split_tac [expand_bind])) 1); |
|
103 |
by (strip_tac 1); |
|
104 |
by (eres_inst_tac [("x","Suc n")] allE 1); |
|
105 |
by (eres_inst_tac [("x","(TVar n)#a")] allE 1); |
|
106 |
by (fast_tac (HOL_cs addss (!simpset |
|
1465 | 107 |
addsimps [new_tv_subst,new_tv_Suc_list])) 1); |
1300 | 108 |
|
109 |
(* case App e1 e2 *) |
|
110 |
by (simp_tac (!simpset setloop (split_tac [expand_bind])) 1); |
|
111 |
by (strip_tac 1); |
|
112 |
by (rename_tac "s t na sa ta nb sb sc tb m" 1); |
|
113 |
by (eres_inst_tac [("x","n")] allE 1); |
|
114 |
by (eres_inst_tac [("x","a")] allE 1); |
|
115 |
by (eres_inst_tac [("x","s")] allE 1); |
|
116 |
by (eres_inst_tac [("x","t")] allE 1); |
|
117 |
by (eres_inst_tac [("x","na")] allE 1); |
|
118 |
by (eres_inst_tac [("x","na")] allE 1); |
|
119 |
by (asm_full_simp_tac (!simpset addsimps [eq_sym_conv]) 1); |
|
120 |
by (eres_inst_tac [("x","$ s a")] allE 1); |
|
121 |
by (eres_inst_tac [("x","sa")] allE 1); |
|
122 |
by (eres_inst_tac [("x","ta")] allE 1); |
|
123 |
by (eres_inst_tac [("x","nb")] allE 1); |
|
2031 | 124 |
by ( asm_full_simp_tac (!simpset addsimps [o_def,rotate_Ok]) 1); |
1300 | 125 |
by (rtac conjI 1); |
126 |
by (rtac new_tv_subst_comp_2 1); |
|
127 |
by (rtac new_tv_subst_comp_2 1); |
|
128 |
by (rtac (lessI RS less_imp_le RS new_tv_subst_le) 1); |
|
129 |
by (res_inst_tac [("n","na")] new_tv_subst_le 1); |
|
130 |
by (asm_full_simp_tac (!simpset addsimps [rotate_Ok]) 1); |
|
131 |
by (Asm_simp_tac 1); |
|
132 |
by (fast_tac (HOL_cs addDs [W_var_geD] addIs |
|
133 |
[new_tv_list_le,new_tv_subst_tel,lessI RS less_imp_le RS new_tv_subst_le]) |
|
134 |
1); |
|
1465 | 135 |
by (etac (sym RS mgu_new) 1); |
1925 | 136 |
by (best_tac (HOL_cs addDs [W_var_geD] |
2031 | 137 |
addIs [new_tv_subst_te,new_tv_list_le, |
138 |
new_tv_subst_tel, |
|
139 |
lessI RS less_imp_le RS new_tv_le, |
|
140 |
lessI RS less_imp_le RS new_tv_subst_le, |
|
141 |
new_tv_le]) 1); |
|
1925 | 142 |
by (fast_tac (HOL_cs addDs [W_var_geD] |
2031 | 143 |
addIs [new_tv_list_le,new_tv_subst_tel,new_tv_le] |
144 |
addss (!simpset)) 1); |
|
1465 | 145 |
by (rtac (lessI RS new_tv_subst_var) 1); |
146 |
by (etac (sym RS mgu_new) 1); |
|
1925 | 147 |
by (best_tac (HOL_cs addSIs [lessI RS less_imp_le RS new_tv_le,new_tv_subst_te] |
148 |
addDs [W_var_geD] |
|
2031 | 149 |
addIs [new_tv_list_le, |
150 |
new_tv_subst_tel, |
|
151 |
lessI RS less_imp_le RS new_tv_subst_le, |
|
152 |
new_tv_le] |
|
153 |
addss !simpset) 1); |
|
1925 | 154 |
by (fast_tac (HOL_cs addDs [W_var_geD] |
2031 | 155 |
addIs [new_tv_list_le,new_tv_subst_tel,new_tv_le] |
1925 | 156 |
addss (!simpset)) 1); |
1486 | 157 |
qed_spec_mp "new_tv_W"; |
1300 | 158 |
|
159 |
||
160 |
goal thy |
|
1465 | 161 |
"!n a s t m v. W e a n = Ok (s,t,m) --> \ |
1300 | 162 |
\ (v:free_tv s | v:free_tv t) --> v<n --> v:free_tv a"; |
163 |
by (expr.induct_tac "e" 1); |
|
164 |
(* case Var n *) |
|
165 |
by (fast_tac (HOL_cs addIs [nth_mem,subsetD,ftv_mem_sub_ftv_list] |
|
166 |
addss (!simpset setloop (split_tac [expand_if]))) 1); |
|
167 |
||
168 |
(* case Abs e *) |
|
169 |
by (asm_full_simp_tac (!simpset addsimps |
|
170 |
[free_tv_subst] setloop (split_tac [expand_bind])) 1); |
|
171 |
by (strip_tac 1); |
|
172 |
by (rename_tac "s t na sa ta m v" 1); |
|
173 |
by (eres_inst_tac [("x","Suc n")] allE 1); |
|
174 |
by (eres_inst_tac [("x","TVar n # a")] allE 1); |
|
175 |
by (eres_inst_tac [("x","s")] allE 1); |
|
176 |
by (eres_inst_tac [("x","t")] allE 1); |
|
177 |
by (eres_inst_tac [("x","na")] allE 1); |
|
178 |
by (eres_inst_tac [("x","v")] allE 1); |
|
1669 | 179 |
by (fast_tac (HOL_cs addIs [cod_app_subst] |
180 |
addss (!simpset addsimps [less_Suc_eq])) 1); |
|
1300 | 181 |
|
182 |
(* case App e1 e2 *) |
|
183 |
by (simp_tac (!simpset setloop (split_tac [expand_bind])) 1); |
|
184 |
by (strip_tac 1); |
|
185 |
by (rename_tac "s t na sa ta nb sb sc tb m v" 1); |
|
186 |
by (eres_inst_tac [("x","n")] allE 1); |
|
187 |
by (eres_inst_tac [("x","a")] allE 1); |
|
188 |
by (eres_inst_tac [("x","s")] allE 1); |
|
189 |
by (eres_inst_tac [("x","t")] allE 1); |
|
190 |
by (eres_inst_tac [("x","na")] allE 1); |
|
191 |
by (eres_inst_tac [("x","na")] allE 1); |
|
192 |
by (eres_inst_tac [("x","v")] allE 1); |
|
193 |
(* second case *) |
|
194 |
by (eres_inst_tac [("x","$ s a")] allE 1); |
|
195 |
by (eres_inst_tac [("x","sa")] allE 1); |
|
196 |
by (eres_inst_tac [("x","ta")] allE 1); |
|
197 |
by (eres_inst_tac [("x","nb")] allE 1); |
|
198 |
by (eres_inst_tac [("x","v")] allE 1); |
|
199 |
by (safe_tac (empty_cs addSIs [conjI,impI] addSEs [conjE]) ); |
|
1669 | 200 |
by (asm_full_simp_tac (!simpset addsimps [rotate_Ok,o_def]) 1); |
1465 | 201 |
by (dtac W_var_geD 1); |
202 |
by (dtac W_var_geD 1); |
|
1300 | 203 |
by ( (forward_tac [less_le_trans] 1) THEN (assume_tac 1) ); |
204 |
by (fast_tac (HOL_cs addDs [free_tv_comp_subst RS subsetD,sym RS mgu_free, |
|
205 |
codD,free_tv_app_subst_te RS subsetD,free_tv_app_subst_tel RS subsetD, |
|
206 |
less_le_trans,less_not_refl2,subsetD] |
|
207 |
addEs [UnE] |
|
208 |
addss !simpset) 1); |
|
209 |
by (Asm_full_simp_tac 1); |
|
1465 | 210 |
by (dtac (sym RS W_var_geD) 1); |
211 |
by (dtac (sym RS W_var_geD) 1); |
|
1300 | 212 |
by ( (forward_tac [less_le_trans] 1) THEN (assume_tac 1) ); |
213 |
by (fast_tac (HOL_cs addDs [mgu_free, codD,free_tv_subst_var RS subsetD, |
|
214 |
free_tv_app_subst_te RS subsetD,free_tv_app_subst_tel RS subsetD, |
|
215 |
less_le_trans,subsetD] |
|
216 |
addEs [UnE] |
|
217 |
addss !simpset) 1); |
|
1486 | 218 |
qed_spec_mp "free_tv_W"; |
1300 | 219 |
|
2083
b56425a385b9
Tidied some proofs: changed needed for de Morgan laws
paulson
parents:
2058
diff
changeset
|
220 |
|
1300 | 221 |
(* Completeness of W w.r.t. has_type *) |
222 |
goal thy |
|
1525 | 223 |
"!s' a t' n. $s' a |- e :: t' --> new_tv n a --> \ |
224 |
\ (? s t. (? m. W e a n = Ok (s,t,m)) & \ |
|
225 |
\ (? r. $s' a = $r ($s a) & t' = $r t))"; |
|
1300 | 226 |
by (expr.induct_tac "e" 1); |
227 |
(* case Var n *) |
|
228 |
by (strip_tac 1); |
|
229 |
by (simp_tac (!simpset addcongs [conj_cong] |
|
2031 | 230 |
setloop (split_tac [expand_if])) 1); |
1300 | 231 |
by (eresolve_tac has_type_casesE 1); |
232 |
by (asm_full_simp_tac (!simpset addsimps [eq_sym_conv,app_subst_list]) 1); |
|
233 |
by (res_inst_tac [("x","id_subst")] exI 1); |
|
234 |
by (res_inst_tac [("x","nth nat a")] exI 1); |
|
235 |
by (Simp_tac 1); |
|
236 |
by (res_inst_tac [("x","s'")] exI 1); |
|
237 |
by (Asm_simp_tac 1); |
|
238 |
||
2058 | 239 |
(** LEVEL 10 **) |
1300 | 240 |
(* case Abs e *) |
241 |
by (strip_tac 1); |
|
242 |
by (eresolve_tac has_type_casesE 1); |
|
243 |
by (eres_inst_tac [("x","%x.if x=n then t1 else (s' x)")] allE 1); |
|
244 |
by (eres_inst_tac [("x","(TVar n)#a")] allE 1); |
|
245 |
by (eres_inst_tac [("x","t2")] allE 1); |
|
246 |
by (eres_inst_tac [("x","Suc n")] allE 1); |
|
247 |
by (fast_tac (HOL_cs addss (!simpset addcongs [conj_cong] |
|
2031 | 248 |
setloop (split_tac [expand_bind]))) 1); |
1300 | 249 |
|
2058 | 250 |
(** LEVEL 17 **) |
1300 | 251 |
(* case App e1 e2 *) |
252 |
by (strip_tac 1); |
|
253 |
by (eresolve_tac has_type_casesE 1); |
|
254 |
by (eres_inst_tac [("x","s'")] allE 1); |
|
255 |
by (eres_inst_tac [("x","a")] allE 1); |
|
1400 | 256 |
by (eres_inst_tac [("x","t2 -> t'")] allE 1); |
1300 | 257 |
by (eres_inst_tac [("x","n")] allE 1); |
258 |
by (safe_tac HOL_cs); |
|
259 |
by (eres_inst_tac [("x","r")] allE 1); |
|
260 |
by (eres_inst_tac [("x","$ s a")] allE 1); |
|
261 |
by (eres_inst_tac [("x","t2")] allE 1); |
|
262 |
by (eres_inst_tac [("x","m")] allE 1); |
|
1465 | 263 |
by (dtac asm_rl 1); |
264 |
by (dtac asm_rl 1); |
|
265 |
by (dtac asm_rl 1); |
|
1300 | 266 |
by (Asm_full_simp_tac 1); |
267 |
by (safe_tac HOL_cs); |
|
268 |
by (fast_tac HOL_cs 1); |
|
269 |
by (fast_tac (HOL_cs addIs [sym RS W_var_geD,new_tv_W RS |
|
2031 | 270 |
conjunct1,new_tv_list_le,new_tv_subst_tel]) 1); |
1300 | 271 |
|
2058 | 272 |
(** LEVEL 35 **) |
1300 | 273 |
by (subgoal_tac |
274 |
"$ (%x.if x=ma then t' else (if x:(free_tv t - free_tv sa) then r x \ |
|
275 |
\ else ra x)) ($ sa t) = \ |
|
276 |
\ $ (%x.if x=ma then t' else (if x:(free_tv t - free_tv sa) then r x \ |
|
1400 | 277 |
\ else ra x)) (ta -> (TVar ma))" 1); |
1300 | 278 |
by (res_inst_tac [("t","$ (%x. if x = ma then t' else \ |
279 |
\ (if x:(free_tv t - free_tv sa) then r x else ra x)) ($ sa t)"), |
|
1400 | 280 |
("s","($ ra ta) -> t'")] ssubst 2); |
1300 | 281 |
by (asm_simp_tac (!simpset addsimps [subst_comp_te]) 2); |
1465 | 282 |
by (rtac eq_free_eq_subst_te 2); |
1300 | 283 |
by (strip_tac 2); |
284 |
by (subgoal_tac "na ~=ma" 2); |
|
285 |
by (fast_tac (HOL_cs addDs [new_tv_W,sym RS W_var_geD, |
|
2031 | 286 |
new_tv_not_free_tv,new_tv_le]) 3); |
2058 | 287 |
(** LEVEL 42 **) |
1300 | 288 |
by (case_tac "na:free_tv sa" 2); |
289 |
(* na ~: free_tv sa *) |
|
290 |
by (asm_simp_tac (!simpset addsimps [not_free_impl_id] |
|
2031 | 291 |
setloop (split_tac [expand_if])) 3); |
1300 | 292 |
(* na : free_tv sa *) |
1400 | 293 |
by (dres_inst_tac [("ts1","$ s a")] (subst_comp_tel RSN (2,trans)) 2); |
1465 | 294 |
by (dtac eq_subst_tel_eq_free 2); |
1300 | 295 |
by (fast_tac (HOL_cs addIs [free_tv_W,free_tv_le_new_tv] addDs [new_tv_W]) 2); |
296 |
by (Asm_simp_tac 2); |
|
297 |
by (case_tac "na:dom sa" 2); |
|
298 |
(* na ~: dom sa *) |
|
299 |
by (asm_full_simp_tac (!simpset addsimps [dom_def] |
|
2031 | 300 |
setloop (split_tac [expand_if])) 3); |
2058 | 301 |
(** LEVEL 50 **) |
1300 | 302 |
(* na : dom sa *) |
1465 | 303 |
by (rtac eq_free_eq_subst_te 2); |
1300 | 304 |
by (strip_tac 2); |
305 |
by (subgoal_tac "nb ~= ma" 2); |
|
306 |
by ((forward_tac [new_tv_W] 3) THEN (atac 3)); |
|
1465 | 307 |
by (etac conjE 3); |
308 |
by (dtac new_tv_subst_tel 3); |
|
1300 | 309 |
by (fast_tac (HOL_cs addIs [new_tv_list_le] addDs [sym RS W_var_geD]) 3); |
310 |
by (fast_tac (set_cs addDs [new_tv_W,new_tv_not_free_tv] addss |
|
2031 | 311 |
(!simpset addsimps [cod_def,free_tv_subst])) 3); |
1300 | 312 |
by (fast_tac (set_cs addss (!simpset addsimps [cod_def,free_tv_subst] |
2031 | 313 |
setloop (split_tac [expand_if]))) 2); |
1300 | 314 |
|
315 |
by (Simp_tac 2); |
|
2058 | 316 |
(** LEVEL 60 **) |
1465 | 317 |
by (rtac eq_free_eq_subst_te 2); |
1300 | 318 |
by (strip_tac 2 ); |
319 |
by (subgoal_tac "na ~= ma" 2); |
|
320 |
by ((forward_tac [new_tv_W] 3) THEN (atac 3)); |
|
1465 | 321 |
by (etac conjE 3); |
322 |
by (dtac (sym RS W_var_geD) 3); |
|
1300 | 323 |
by (fast_tac (HOL_cs addDs [new_tv_list_le,new_tv_subst_tel,new_tv_W,new_tv_not_free_tv]) 3); |
324 |
by (case_tac "na: free_tv t - free_tv sa" 2); |
|
2058 | 325 |
(** LEVEL 68 **) |
1300 | 326 |
(* case na ~: free_tv t - free_tv sa *) |
2031 | 327 |
by ( asm_full_simp_tac (!simpset setloop (split_tac [expand_if])) 3); |
1300 | 328 |
(* case na : free_tv t - free_tv sa *) |
2031 | 329 |
by ( asm_full_simp_tac (!simpset setloop (split_tac [expand_if])) 2); |
1400 | 330 |
by (dres_inst_tac [("ts1","$ s a")] (subst_comp_tel RSN (2,trans)) 2); |
1465 | 331 |
by (dtac eq_subst_tel_eq_free 2); |
1300 | 332 |
by (fast_tac (HOL_cs addIs [free_tv_W,free_tv_le_new_tv] addDs [new_tv_W]) 2); |
1486 | 333 |
by (asm_full_simp_tac (!simpset addsimps [free_tv_subst,dom_def,de_Morgan_disj]) 2); |
2083
b56425a385b9
Tidied some proofs: changed needed for de Morgan laws
paulson
parents:
2058
diff
changeset
|
334 |
(** LEVEL 74 **) |
1300 | 335 |
by (asm_simp_tac (!simpset setloop (split_tac [expand_bind])) 1); |
336 |
by (safe_tac HOL_cs ); |
|
1465 | 337 |
by (dtac mgu_Ok 1); |
2031 | 338 |
by ( fast_tac (HOL_cs addss !simpset) 1); |
1300 | 339 |
by (REPEAT (resolve_tac [exI,conjI] 1)); |
340 |
by (fast_tac HOL_cs 1); |
|
341 |
by (fast_tac HOL_cs 1); |
|
342 |
by ((dtac mgu_mg 1) THEN (atac 1)); |
|
1465 | 343 |
by (etac exE 1); |
1300 | 344 |
by (res_inst_tac [("x","rb")] exI 1); |
1465 | 345 |
by (rtac conjI 1); |
1300 | 346 |
by (dres_inst_tac [("x","ma")] fun_cong 2); |
2031 | 347 |
by ( asm_full_simp_tac (!simpset addsimps [eq_sym_conv]) 2); |
1300 | 348 |
by (simp_tac (!simpset addsimps [subst_comp_tel RS sym]) 1); |
1400 | 349 |
by (res_inst_tac [("ts2","($ sa ($ s a))")] ((subst_comp_tel RS sym) RSN |
1300 | 350 |
(2,trans)) 1); |
2031 | 351 |
by ( asm_full_simp_tac (!simpset addsimps [o_def,eq_sym_conv]) 1); |
2083
b56425a385b9
Tidied some proofs: changed needed for de Morgan laws
paulson
parents:
2058
diff
changeset
|
352 |
(** LEVEL 90 **) |
1465 | 353 |
by (rtac eq_free_eq_subst_tel 1); |
2031 | 354 |
by ( safe_tac HOL_cs ); |
1300 | 355 |
by (subgoal_tac "ma ~= na" 1); |
356 |
by ((forward_tac [new_tv_W] 2) THEN (atac 2)); |
|
1465 | 357 |
by (etac conjE 2); |
358 |
by (dtac new_tv_subst_tel 2); |
|
1300 | 359 |
by (fast_tac (HOL_cs addIs [new_tv_list_le] addDs [sym RS W_var_geD]) 2); |
1486 | 360 |
by (( forw_inst_tac [("n","m")] (sym RSN (2,new_tv_W)) 2) THEN (atac 2)); |
1465 | 361 |
by (etac conjE 2); |
362 |
by (dtac (free_tv_app_subst_tel RS subsetD) 2); |
|
2083
b56425a385b9
Tidied some proofs: changed needed for de Morgan laws
paulson
parents:
2058
diff
changeset
|
363 |
(** LEVEL 100 **) |
1300 | 364 |
by (fast_tac (set_cs addDs [W_var_geD,new_tv_list_le,codD, |
365 |
new_tv_not_free_tv]) 2); |
|
366 |
by (case_tac "na: free_tv t - free_tv sa" 1); |
|
367 |
(* case na ~: free_tv t - free_tv sa *) |
|
368 |
by (asm_full_simp_tac (!simpset setloop (split_tac [expand_if])) 2); |
|
369 |
(* case na : free_tv t - free_tv sa *) |
|
370 |
by (asm_full_simp_tac (!simpset setloop (split_tac [expand_if])) 1); |
|
1465 | 371 |
by (dtac (free_tv_app_subst_tel RS subsetD) 1); |
1300 | 372 |
by (fast_tac (set_cs addDs [codD,subst_comp_tel RSN (2,trans), |
2083
b56425a385b9
Tidied some proofs: changed needed for de Morgan laws
paulson
parents:
2058
diff
changeset
|
373 |
eq_subst_tel_eq_free] |
b56425a385b9
Tidied some proofs: changed needed for de Morgan laws
paulson
parents:
2058
diff
changeset
|
374 |
addss ((!simpset addsimps [de_Morgan_disj,free_tv_subst,dom_def]))) 1); |
b56425a385b9
Tidied some proofs: changed needed for de Morgan laws
paulson
parents:
2058
diff
changeset
|
375 |
(** LEVEL 106 **) |
b56425a385b9
Tidied some proofs: changed needed for de Morgan laws
paulson
parents:
2058
diff
changeset
|
376 |
by (Fast_tac 1); |
1525 | 377 |
qed_spec_mp "W_complete_lemma"; |
378 |
||
379 |
goal W.thy |
|
380 |
"!!e. [] |- e :: t' ==> (? s t. (? m. W e [] n = Ok(s,t,m)) & \ |
|
381 |
\ (? r. t' = $r t))"; |
|
2031 | 382 |
by (cut_inst_tac [("a","[]"),("s'","id_subst"),("e","e"),("t'","t'")] |
1525 | 383 |
W_complete_lemma 1); |
2031 | 384 |
by (ALLGOALS Asm_full_simp_tac); |
1525 | 385 |
qed "W_complete"; |