author | wenzelm |
Thu, 17 Aug 2000 10:33:37 +0200 | |
changeset 9619 | 6125cc9efc18 |
parent 6303 | 5e0b1ad1a447 |
permissions | -rw-r--r-- |
2520 | 1 |
(* Title: HOL/W0/Type.ML |
2 |
ID: $Id$ |
|
3 |
Author: Dieter Nazareth and Tobias Nipkow |
|
4 |
Copyright 1995 TU Muenchen |
|
5 |
*) |
|
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
6 |
|
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
7 |
Addsimps [mgu_eq,mgu_mg,mgu_free]; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
8 |
|
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
9 |
(* mgu does not introduce new type variables *) |
5069 | 10 |
Goalw [new_tv_def] |
5148
74919e8f221c
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5069
diff
changeset
|
11 |
"[|mgu t1 t2 = Ok u; new_tv n t1; new_tv n t2|] ==> \ |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
12 |
\ new_tv n u"; |
2520 | 13 |
by (fast_tac (set_cs addDs [mgu_free]) 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
14 |
qed "mgu_new"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
15 |
|
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
16 |
(* application of id_subst does not change type expression *) |
5069 | 17 |
Goalw [id_subst_def] |
3842 | 18 |
"$ id_subst = (%t::typ. t)"; |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
19 |
by (rtac ext 1); |
5184 | 20 |
by (induct_tac "t" 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
21 |
by (ALLGOALS Asm_simp_tac); |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
22 |
qed "app_subst_id_te"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
23 |
Addsimps [app_subst_id_te]; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
24 |
|
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
25 |
(* application of id_subst does not change list of type expressions *) |
5069 | 26 |
Goalw [app_subst_list] |
3842 | 27 |
"$ id_subst = (%ts::typ list. ts)"; |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
28 |
by (rtac ext 1); |
5184 | 29 |
by (induct_tac "ts" 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
30 |
by (ALLGOALS Asm_simp_tac); |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
31 |
qed "app_subst_id_tel"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
32 |
Addsimps [app_subst_id_tel]; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
33 |
|
5069 | 34 |
Goalw [id_subst_def,o_def] "$s o id_subst = s"; |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
35 |
by (rtac ext 1); |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
36 |
by (Simp_tac 1); |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
37 |
qed "o_id_subst"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
38 |
Addsimps[o_id_subst]; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
39 |
|
5069 | 40 |
Goalw [dom_def,id_subst_def,empty_def] |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
41 |
"dom id_subst = {}"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
42 |
by (Simp_tac 1); |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
43 |
qed "dom_id_subst"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
44 |
Addsimps [dom_id_subst]; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
45 |
|
5069 | 46 |
Goalw [cod_def] |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
47 |
"cod id_subst = {}"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
48 |
by (Simp_tac 1); |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
49 |
qed "cod_id_subst"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
50 |
Addsimps [cod_id_subst]; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
51 |
|
5069 | 52 |
Goalw [free_tv_subst] |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
53 |
"free_tv id_subst = {}"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
54 |
by (Simp_tac 1); |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
55 |
qed "free_tv_id_subst"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
56 |
Addsimps [free_tv_id_subst]; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
57 |
|
5069 | 58 |
Goalw [dom_def,cod_def,UNION_def,Bex_def] |
5148
74919e8f221c
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5069
diff
changeset
|
59 |
"[| v : free_tv(s n); v~=n |] ==> v : cod s"; |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
60 |
by (Simp_tac 1); |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
61 |
by (safe_tac (empty_cs addSIs [exI,conjI,notI])); |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
62 |
by (assume_tac 2); |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
63 |
by (rotate_tac 1 1); |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
64 |
by (Asm_full_simp_tac 1); |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
65 |
qed "cod_app_subst"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
66 |
Addsimps [cod_app_subst]; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
67 |
|
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
68 |
|
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
69 |
(* composition of substitutions *) |
5069 | 70 |
Goal |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
71 |
"$ g ($ f t::typ) = $ (%x. $ g (f x) ) t"; |
5184 | 72 |
by (induct_tac "t" 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
73 |
by (ALLGOALS Asm_simp_tac); |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
74 |
qed "subst_comp_te"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
75 |
|
5069 | 76 |
Goalw [app_subst_list] |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
77 |
"$ g ($ f ts::typ list) = $ (%x. $ g (f x)) ts"; |
5184 | 78 |
by (induct_tac "ts" 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
79 |
(* case [] *) |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
80 |
by (Simp_tac 1); |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
81 |
(* case x#xl *) |
4089 | 82 |
by (asm_full_simp_tac (simpset() addsimps [subst_comp_te]) 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
83 |
qed "subst_comp_tel"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
84 |
|
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
85 |
|
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
86 |
(* constructor laws for app_subst *) |
5069 | 87 |
Goalw [app_subst_list] |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
88 |
"$ s [] = []"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
89 |
by (Simp_tac 1); |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
90 |
qed "app_subst_Nil"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
91 |
|
5069 | 92 |
Goalw [app_subst_list] |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
93 |
"$ s (t#ts) = ($ s t)#($ s ts)"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
94 |
by (Simp_tac 1); |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
95 |
qed "app_subst_Cons"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
96 |
|
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
97 |
Addsimps [app_subst_Nil,app_subst_Cons]; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
98 |
|
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
99 |
(* constructor laws for new_tv *) |
5069 | 100 |
Goalw [new_tv_def] |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
101 |
"new_tv n (TVar m) = (m<n)"; |
4089 | 102 |
by (fast_tac (HOL_cs addss simpset()) 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
103 |
qed "new_tv_TVar"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
104 |
|
5069 | 105 |
Goalw [new_tv_def] |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
106 |
"new_tv n (t1 -> t2) = (new_tv n t1 & new_tv n t2)"; |
4089 | 107 |
by (fast_tac (HOL_cs addss simpset()) 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
108 |
qed "new_tv_Fun"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
109 |
|
5069 | 110 |
Goalw [new_tv_def] |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
111 |
"new_tv n []"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
112 |
by (Simp_tac 1); |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
113 |
qed "new_tv_Nil"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
114 |
|
5069 | 115 |
Goalw [new_tv_def] |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
116 |
"new_tv n (t#ts) = (new_tv n t & new_tv n ts)"; |
4089 | 117 |
by (fast_tac (HOL_cs addss simpset()) 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
118 |
qed "new_tv_Cons"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
119 |
|
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
120 |
Addsimps [new_tv_TVar,new_tv_Fun,new_tv_Nil,new_tv_Cons]; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
121 |
|
5069 | 122 |
Goalw [id_subst_def,new_tv_def,free_tv_subst,dom_def,cod_def] |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
123 |
"new_tv n id_subst"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
124 |
by (Simp_tac 1); |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
125 |
qed "new_tv_id_subst"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
126 |
Addsimps[new_tv_id_subst]; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
127 |
|
5069 | 128 |
Goalw [new_tv_def] |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
129 |
"new_tv n s = ((!m. n <= m --> (s m = TVar m)) & \ |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
130 |
\ (! l. l < n --> new_tv n (s l) ))"; |
2520 | 131 |
by (safe_tac HOL_cs ); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
132 |
(* ==> *) |
4089 | 133 |
by (fast_tac (HOL_cs addDs [leD] addss (simpset() addsimps [free_tv_subst,dom_def])) 1); |
2520 | 134 |
by (subgoal_tac "m:cod s | s l = TVar l" 1); |
135 |
by (safe_tac HOL_cs ); |
|
4089 | 136 |
by (fast_tac (HOL_cs addDs [UnI2] addss (simpset() addsimps [free_tv_subst])) 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
137 |
by (dres_inst_tac [("P","%x. m:free_tv x")] subst 1 THEN atac 1); |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
138 |
by (Asm_full_simp_tac 1); |
4089 | 139 |
by (fast_tac (set_cs addss (simpset() addsimps [free_tv_subst,cod_def,dom_def])) 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
140 |
(* <== *) |
2520 | 141 |
by (rewrite_goals_tac [free_tv_subst,cod_def,dom_def] ); |
142 |
by (safe_tac set_cs ); |
|
143 |
by (cut_inst_tac [("m","m"),("n","n")] less_linear 1); |
|
144 |
by (fast_tac (HOL_cs addSIs [less_or_eq_imp_le]) 1); |
|
145 |
by (cut_inst_tac [("m","ma"),("n","n")] less_linear 1); |
|
146 |
by (fast_tac (HOL_cs addSIs [less_or_eq_imp_le]) 1); |
|
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
147 |
qed "new_tv_subst"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
148 |
|
5518 | 149 |
Goal "new_tv n x = (!y:set x. new_tv n y)"; |
5184 | 150 |
by (induct_tac "x" 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
151 |
by (ALLGOALS Asm_simp_tac); |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
152 |
qed "new_tv_list"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
153 |
|
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
154 |
(* substitution affects only variables occurring freely *) |
5069 | 155 |
Goal |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
156 |
"new_tv n (t::typ) --> $(%x. if x=n then t' else s x) t = $s t"; |
5184 | 157 |
by (induct_tac "t" 1); |
4686 | 158 |
by (ALLGOALS Asm_simp_tac); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
159 |
qed "subst_te_new_tv"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
160 |
Addsimps [subst_te_new_tv]; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
161 |
|
5069 | 162 |
Goal |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
163 |
"new_tv n (ts::typ list) --> $(%x. if x=n then t else s x) ts = $s ts"; |
5184 | 164 |
by (induct_tac "ts" 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
165 |
by (ALLGOALS Asm_full_simp_tac); |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
166 |
qed "subst_tel_new_tv"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
167 |
Addsimps [subst_tel_new_tv]; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
168 |
|
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
169 |
(* all greater variables are also new *) |
5069 | 170 |
Goal |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
171 |
"n<=m --> new_tv n (t::typ) --> new_tv m t"; |
5184 | 172 |
by (induct_tac "t" 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
173 |
(* case TVar n *) |
4089 | 174 |
by (fast_tac (HOL_cs addIs [less_le_trans] addss simpset()) 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
175 |
(* case Fun t1 t2 *) |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
176 |
by (Asm_simp_tac 1); |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
177 |
qed_spec_mp "new_tv_le"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
178 |
Addsimps [lessI RS less_imp_le RS new_tv_le]; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
179 |
|
5069 | 180 |
Goal |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
181 |
"n<=m --> new_tv n (ts::typ list) --> new_tv m ts"; |
5184 | 182 |
by (induct_tac "ts" 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
183 |
(* case [] *) |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
184 |
by (Simp_tac 1); |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
185 |
(* case a#al *) |
4089 | 186 |
by (fast_tac (HOL_cs addIs [new_tv_le] addss simpset()) 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
187 |
qed_spec_mp "new_tv_list_le"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
188 |
Addsimps [lessI RS less_imp_le RS new_tv_list_le]; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
189 |
|
5069 | 190 |
Goal |
5148
74919e8f221c
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5069
diff
changeset
|
191 |
"[| n<=m; new_tv n (s::subst) |] ==> new_tv m s"; |
4089 | 192 |
by (asm_full_simp_tac (simpset() addsimps [new_tv_subst]) 1); |
5655
afd75136b236
Mods because of: Installed trans_tac in solver of simpset().
nipkow
parents:
5518
diff
changeset
|
193 |
by (Clarify_tac 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
194 |
by (res_inst_tac [("P","l < n"),("Q","n <= l")] disjE 1); |
5655
afd75136b236
Mods because of: Installed trans_tac in solver of simpset().
nipkow
parents:
5518
diff
changeset
|
195 |
by (Clarify_tac 1); |
4089 | 196 |
by (ALLGOALS (asm_full_simp_tac (simpset() addsimps [new_tv_le])) ); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
197 |
qed "new_tv_subst_le"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
198 |
Addsimps [lessI RS less_imp_le RS new_tv_subst_le]; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
199 |
|
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
200 |
(* new_tv property remains if a substitution is applied *) |
5069 | 201 |
Goal |
5148
74919e8f221c
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5069
diff
changeset
|
202 |
"[| n<m; new_tv m (s::subst) |] ==> new_tv m (s n)"; |
4089 | 203 |
by (asm_full_simp_tac (simpset() addsimps [new_tv_subst]) 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
204 |
qed "new_tv_subst_var"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
205 |
|
5446
506259e4e546
reflecting changes to Option.ML, List.{thy|ML}, mainly list_all
oheimb
parents:
5184
diff
changeset
|
206 |
Goal "new_tv n s --> new_tv n (t::typ) --> new_tv n ($ s t)"; |
5184 | 207 |
by (induct_tac "t" 1); |
4089 | 208 |
by (ALLGOALS(fast_tac (HOL_cs addss (simpset() addsimps [new_tv_subst])))); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
209 |
qed_spec_mp "new_tv_subst_te"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
210 |
Addsimps [new_tv_subst_te]; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
211 |
|
5446
506259e4e546
reflecting changes to Option.ML, List.{thy|ML}, mainly list_all
oheimb
parents:
5184
diff
changeset
|
212 |
Goal "new_tv n s --> new_tv n (ts::typ list) --> new_tv n ($ s ts)"; |
4089 | 213 |
by (simp_tac (simpset() addsimps [new_tv_list]) 1); |
5184 | 214 |
by (induct_tac "ts" 1); |
6303 | 215 |
by Safe_tac; |
5446
506259e4e546
reflecting changes to Option.ML, List.{thy|ML}, mainly list_all
oheimb
parents:
5184
diff
changeset
|
216 |
by (ALLGOALS(fast_tac (HOL_cs addss (simpset() addsimps [new_tv_subst])))); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
217 |
qed_spec_mp "new_tv_subst_tel"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
218 |
Addsimps [new_tv_subst_tel]; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
219 |
|
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
220 |
(* auxilliary lemma *) |
5446
506259e4e546
reflecting changes to Option.ML, List.{thy|ML}, mainly list_all
oheimb
parents:
5184
diff
changeset
|
221 |
Goal "new_tv n ts --> new_tv (Suc n) ((TVar n)#ts)"; |
4089 | 222 |
by (simp_tac (simpset() addsimps [new_tv_list]) 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
223 |
qed "new_tv_Suc_list"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
224 |
|
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
225 |
|
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
226 |
(* composition of substitutions preserves new_tv proposition *) |
5069 | 227 |
Goal |
5148
74919e8f221c
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5069
diff
changeset
|
228 |
"[| new_tv n (s::subst); new_tv n r |] ==> \ |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
229 |
\ new_tv n (($ r) o s)"; |
4089 | 230 |
by (asm_full_simp_tac (simpset() addsimps [new_tv_subst]) 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
231 |
qed "new_tv_subst_comp_1"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
232 |
|
5069 | 233 |
Goal |
5148
74919e8f221c
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5069
diff
changeset
|
234 |
"[| new_tv n (s::subst); new_tv n r |] ==> \ |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
235 |
\ new_tv n (%v.$ r (s v))"; |
4089 | 236 |
by (asm_full_simp_tac (simpset() addsimps [new_tv_subst]) 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
237 |
qed "new_tv_subst_comp_2"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
238 |
|
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
239 |
Addsimps [new_tv_subst_comp_1,new_tv_subst_comp_2]; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
240 |
|
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
241 |
(* new type variables do not occur freely in a type structure *) |
5069 | 242 |
Goalw [new_tv_def] |
5148
74919e8f221c
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5069
diff
changeset
|
243 |
"new_tv n ts ==> n~:(free_tv ts)"; |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
244 |
by (fast_tac (HOL_cs addEs [less_irrefl]) 1); |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
245 |
qed "new_tv_not_free_tv"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
246 |
Addsimps [new_tv_not_free_tv]; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
247 |
|
5069 | 248 |
Goal |
5518 | 249 |
"(t::typ): set ts --> free_tv t <= free_tv ts"; |
5184 | 250 |
by (induct_tac "ts" 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
251 |
(* case [] *) |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
252 |
by (Simp_tac 1); |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
253 |
(* case x#xl *) |
4686 | 254 |
by (fast_tac (set_cs addss simpset()) 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
255 |
qed_spec_mp "ftv_mem_sub_ftv_list"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
256 |
Addsimps [ftv_mem_sub_ftv_list]; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
257 |
|
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
258 |
|
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
259 |
(* if two substitutions yield the same result if applied to a type |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
260 |
structure the substitutions coincide on the free type variables |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
261 |
occurring in the type structure *) |
5069 | 262 |
Goal |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
263 |
"$ s1 (t::typ) = $ s2 t --> n:(free_tv t) --> s1 n = s2 n"; |
5184 | 264 |
by (induct_tac "t" 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
265 |
(* case TVar n *) |
4089 | 266 |
by (fast_tac (HOL_cs addss simpset()) 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
267 |
(* case Fun t1 t2 *) |
4089 | 268 |
by (fast_tac (HOL_cs addss simpset()) 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
269 |
qed_spec_mp "eq_subst_te_eq_free"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
270 |
|
5069 | 271 |
Goal |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
272 |
"(!n. n:(free_tv t) --> s1 n = s2 n) --> $ s1 (t::typ) = $ s2 t"; |
5184 | 273 |
by (induct_tac "t" 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
274 |
(* case TVar n *) |
4089 | 275 |
by (fast_tac (HOL_cs addss simpset()) 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
276 |
(* case Fun t1 t2 *) |
4089 | 277 |
by (fast_tac (HOL_cs addss simpset()) 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
278 |
qed_spec_mp "eq_free_eq_subst_te"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
279 |
|
5148
74919e8f221c
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5069
diff
changeset
|
280 |
Goal "$s1 (ts::typ list) = $s2 ts --> n:(free_tv ts) --> s1 n = s2 n"; |
5184 | 281 |
by (induct_tac "ts" 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
282 |
(* case [] *) |
4089 | 283 |
by (fast_tac (HOL_cs addss simpset()) 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
284 |
(* case x#xl *) |
4089 | 285 |
by (fast_tac (HOL_cs addIs [eq_subst_te_eq_free] addss (simpset())) 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
286 |
qed_spec_mp "eq_subst_tel_eq_free"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
287 |
|
5148
74919e8f221c
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5069
diff
changeset
|
288 |
Goal "(!n. n:(free_tv ts) --> s1 n = s2 n) --> $s1 (ts::typ list) = $s2 ts"; |
5184 | 289 |
by (induct_tac "ts" 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
290 |
(* case [] *) |
4089 | 291 |
by (fast_tac (HOL_cs addss simpset()) 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
292 |
(* case x#xl *) |
4089 | 293 |
by (fast_tac (HOL_cs addIs [eq_free_eq_subst_te] addss (simpset())) 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
294 |
qed_spec_mp "eq_free_eq_subst_tel"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
295 |
|
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
296 |
(* some useful theorems *) |
5069 | 297 |
Goalw [free_tv_subst] |
5148
74919e8f221c
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5069
diff
changeset
|
298 |
"v : cod s ==> v : free_tv s"; |
2520 | 299 |
by (fast_tac set_cs 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
300 |
qed "codD"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
301 |
|
5069 | 302 |
Goalw [free_tv_subst,dom_def] |
5148
74919e8f221c
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5069
diff
changeset
|
303 |
"x ~: free_tv s ==> s x = TVar x"; |
2520 | 304 |
by (fast_tac set_cs 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
305 |
qed "not_free_impl_id"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
306 |
|
5148
74919e8f221c
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5069
diff
changeset
|
307 |
Goalw [new_tv_def] "[| new_tv n t; m:free_tv t |] ==> m<n"; |
2520 | 308 |
by (fast_tac HOL_cs 1 ); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
309 |
qed "free_tv_le_new_tv"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
310 |
|
5148
74919e8f221c
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5069
diff
changeset
|
311 |
Goal "free_tv (s (v::nat)) <= insert v (cod s)"; |
3385
f59e64fe4058
New statement and proof of free_tv_subst_var in order to cope with new
paulson
parents:
3207
diff
changeset
|
312 |
by (expand_case_tac "v:dom s" 1); |
4089 | 313 |
by (fast_tac (set_cs addss (simpset() addsimps [cod_def])) 1); |
314 |
by (fast_tac (set_cs addss (simpset() addsimps [dom_def])) 1); |
|
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
315 |
qed "free_tv_subst_var"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
316 |
|
5148
74919e8f221c
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5069
diff
changeset
|
317 |
Goal "free_tv ($ s (t::typ)) <= cod s Un free_tv t"; |
5184 | 318 |
by (induct_tac "t" 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
319 |
(* case TVar n *) |
4089 | 320 |
by (simp_tac (simpset() addsimps [free_tv_subst_var]) 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
321 |
(* case Fun t1 t2 *) |
4089 | 322 |
by (fast_tac (set_cs addss simpset()) 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
323 |
qed "free_tv_app_subst_te"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
324 |
|
5148
74919e8f221c
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5069
diff
changeset
|
325 |
Goal "free_tv ($ s (ts::typ list)) <= cod s Un free_tv ts"; |
5184 | 326 |
by (induct_tac "ts" 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
327 |
(* case [] *) |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
328 |
by (Simp_tac 1); |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
329 |
(* case a#al *) |
2520 | 330 |
by (cut_facts_tac [free_tv_app_subst_te] 1); |
4089 | 331 |
by (fast_tac (set_cs addss simpset()) 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
332 |
qed "free_tv_app_subst_tel"; |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
333 |
|
5069 | 334 |
Goalw [free_tv_subst,dom_def] |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
335 |
"free_tv (%u::nat. $ s1 (s2 u) :: typ) <= \ |
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
336 |
\ free_tv s1 Un free_tv s2"; |
2520 | 337 |
by (fast_tac (set_cs addSDs [free_tv_app_subst_te RS subsetD, |
338 |
free_tv_subst_var RS subsetD] |
|
4089 | 339 |
addss (simpset() delsimps bex_simps |
2520 | 340 |
addsimps [cod_def,dom_def])) 1); |
2518
bee082efaa46
This is the old version og MiniML for the monomorphic case.
nipkow
parents:
diff
changeset
|
341 |
qed "free_tv_comp_subst"; |