137 |
137 |
138 (* ---------------------------------------------------------- *) |
138 (* ---------------------------------------------------------- *) |
139 section"Lift is flat"; |
139 section"Lift is flat"; |
140 (* ---------------------------------------------------------- *) |
140 (* ---------------------------------------------------------- *) |
141 |
141 |
142 goalw thy [flat_def] "flat (x::'a lift)"; |
142 goal thy "! x y::'a lift. x << y --> x = UU | x = y"; |
143 by (simp_tac (!simpset addsimps [less_lift]) 1); |
143 by (simp_tac (!simpset addsimps [less_lift]) 1); |
144 qed"flat_lift"; |
144 qed"ax_flat_lift"; |
145 |
|
146 bind_thm("ax_flat_lift",flat_lift RS flatE); |
|
147 |
|
148 |
|
149 (* ---------------------------------------------------------- *) |
|
150 section"Continuity Proofs for flift1, flift2, if"; |
|
151 (* ---------------------------------------------------------- *) |
|
152 |
|
153 |
|
154 (* flift1 is continuous in its argument itself*) |
|
155 |
|
156 goal thy "cont (lift_case UU f)"; |
|
157 br flatdom_strict2cont 1; |
|
158 br flat_lift 1; |
|
159 by (Simp_tac 1); |
|
160 qed"cont_flift1_arg"; |
|
161 |
|
162 (* flift1 is continuous in a variable that occurs only |
|
163 in the Def branch *) |
|
164 |
|
165 goal thy "!!f. [| !! a.cont (%y. (f y) a) |] ==> \ |
|
166 \ cont (%y. lift_case UU (f y))"; |
|
167 br cont2cont_CF1L_rev 1; |
|
168 by (strip_tac 1); |
|
169 by (res_inst_tac [("x","y")] Lift_cases 1); |
|
170 by (Asm_simp_tac 1); |
|
171 by (fast_tac (HOL_cs addss !simpset) 1); |
|
172 qed"cont_flift1_not_arg"; |
|
173 |
|
174 (* flift1 is continuous in a variable that occurs either |
|
175 in the Def branch or in the argument *) |
|
176 |
|
177 goal thy "!!f. [| !! a.cont (%y. (f y) a); cont g|] ==> \ |
|
178 \ cont (%y. lift_case UU (f y) (g y))"; |
|
179 br cont2cont_app 1; |
|
180 back(); |
|
181 by (safe_tac set_cs); |
|
182 br cont_flift1_not_arg 1; |
|
183 auto(); |
|
184 br cont_flift1_arg 1; |
|
185 qed"cont_flift1_arg_and_not_arg"; |
|
186 |
|
187 (* flift2 is continuous in its argument itself *) |
|
188 |
|
189 goal thy "cont (lift_case UU (%y. Def (f y)))"; |
|
190 br flatdom_strict2cont 1; |
|
191 br flat_lift 1; |
|
192 by (Simp_tac 1); |
|
193 qed"cont_flift2_arg"; |
|
194 |
145 |
195 (* Two specific lemmas for the combination of LCF and HOL terms *) |
146 (* Two specific lemmas for the combination of LCF and HOL terms *) |
196 |
147 |
197 goal thy "!!f.[|cont g; cont f|] ==> cont(%x. ((f x)`(g x)) s)"; |
148 goal thy "!!f.[|cont g; cont f|] ==> cont(%x. ((f x)`(g x)) s)"; |
198 br cont2cont_CF1L 1; |
149 br cont2cont_CF1L 1; |
206 ba 1; |
157 ba 1; |
207 qed"cont_fapp_app_app"; |
158 qed"cont_fapp_app_app"; |
208 |
159 |
209 |
160 |
210 (* continuity of if then else *) |
161 (* continuity of if then else *) |
211 |
|
212 val prems = goal thy "[| cont f1; cont f2 |] ==> \ |
162 val prems = goal thy "[| cont f1; cont f2 |] ==> \ |
213 \ cont (%x. if b then f1 x else f2 x)"; |
163 \ cont (%x. if b then f1 x else f2 x)"; |
214 by (cut_facts_tac prems 1); |
164 by (cut_facts_tac prems 1); |
215 by (case_tac "b" 1); |
165 by (case_tac "b" 1); |
216 by (TRYALL (fast_tac (HOL_cs addss HOL_ss))); |
166 by (TRYALL (fast_tac (HOL_cs addss HOL_ss))); |
217 qed"cont_if"; |
167 qed"cont_if"; |
218 |
168 |
219 |
|
220 (* ---------------------------------------------------------- *) |
|
221 (* Extension of cont_tac and installation of simplifier *) |
|
222 (* ---------------------------------------------------------- *) |
|
223 |
|
224 bind_thm("cont2cont_CF1L_rev2",allI RS cont2cont_CF1L_rev); |
|
225 |
|
226 val cont_lemmas_ext = [cont_flift1_arg,cont_flift2_arg, |
|
227 cont_flift1_arg_and_not_arg,cont2cont_CF1L_rev2, |
|
228 cont_fapp_app,cont_fapp_app_app,cont_if]; |
|
229 |
|
230 val cont_lemmas2 = cont_lemmas1 @ cont_lemmas_ext; |
|
231 |
|
232 Addsimps cont_lemmas_ext; |
|
233 |
|
234 fun cont_tac i = resolve_tac cont_lemmas2 i; |
|
235 fun cont_tacR i = REPEAT (cont_tac i); |
|
236 |
|
237 fun cont_tacRs i = simp_tac (!simpset addsimps [flift1_def,flift2_def]) i THEN |
|
238 REPEAT (cont_tac i); |
|
239 |
|
240 |
|
241 simpset := !simpset addSolver (K (DEPTH_SOLVE_1 o cont_tac)); |
|
242 |
|
243 (* ---------------------------------------------------------- *) |
|
244 section"flift1, flift2"; |
|
245 (* ---------------------------------------------------------- *) |
|
246 |
|
247 |
|
248 goal thy "flift1 f`(Def x) = (f x)"; |
|
249 by (simp_tac (!simpset addsimps [flift1_def]) 1); |
|
250 qed"flift1_Def"; |
|
251 |
|
252 goal thy "flift2 f`(Def x) = Def (f x)"; |
|
253 by (simp_tac (!simpset addsimps [flift2_def]) 1); |
|
254 qed"flift2_Def"; |
|
255 |
|
256 goal thy "flift1 f`UU = UU"; |
|
257 by (simp_tac (!simpset addsimps [flift1_def]) 1); |
|
258 qed"flift1_UU"; |
|
259 |
|
260 goal thy "flift2 f`UU = UU"; |
|
261 by (simp_tac (!simpset addsimps [flift2_def]) 1); |
|
262 qed"flift2_UU"; |
|
263 |
|
264 Addsimps [flift1_Def,flift2_Def,flift1_UU,flift2_UU]; |
|
265 |
|
266 goal thy "!!x. x~=UU ==> (flift2 f)`x~=UU"; |
|
267 by (def_tac 1); |
|
268 qed"flift2_nUU"; |
|
269 |
|
270 Addsimps [flift2_nUU]; |
|
271 |
|
272 |
|