| author | nipkow | 
| Thu, 13 Dec 2001 16:48:07 +0100 | |
| changeset 12488 | 83acab8042ad | 
| parent 12030 | 46d57d0290a2 | 
| child 14981 | e73f8140af78 | 
| permissions | -rw-r--r-- | 
| 2278 | 1 | (* Title: HOLCF/Up3.ML | 
| 2 | ID: $Id$ | |
| 3 | Author: Franz Regensburger | |
| 12030 | 4 | License: GPL (GNU GENERAL PUBLIC LICENSE) | 
| 2278 | 5 | |
| 9169 | 6 | Class instance of  ('a)u for class pcpo
 | 
| 2278 | 7 | *) | 
| 8 | ||
| 2640 | 9 | (* for compatibility with old HOLCF-Version *) | 
| 9169 | 10 | Goal "UU = Abs_Up(Inl ())"; | 
| 11 | by (simp_tac (HOL_ss addsimps [UU_def,UU_up_def]) 1); | |
| 12 | qed "inst_up_pcpo"; | |
| 2640 | 13 | |
| 2278 | 14 | (* -------------------------------------------------------------------------*) | 
| 15 | (* some lemmas restated for class pcpo *) | |
| 16 | (* ------------------------------------------------------------------------ *) | |
| 17 | ||
| 9169 | 18 | Goal "~ Iup(x) << UU"; | 
| 19 | by (stac inst_up_pcpo 1); | |
| 20 | by (rtac less_up2b 1); | |
| 21 | qed "less_up3b"; | |
| 2278 | 22 | |
| 9169 | 23 | Goal "Iup(x) ~= UU"; | 
| 24 | by (stac inst_up_pcpo 1); | |
| 25 | by (rtac defined_Iup 1); | |
| 26 | qed "defined_Iup2"; | |
| 10230 | 27 | AddIffs [defined_Iup2]; | 
| 2278 | 28 | |
| 29 | (* ------------------------------------------------------------------------ *) | |
| 30 | (* continuity for Iup *) | |
| 31 | (* ------------------------------------------------------------------------ *) | |
| 32 | ||
| 9169 | 33 | Goal "contlub(Iup)"; | 
| 34 | by (rtac contlubI 1); | |
| 35 | by (strip_tac 1); | |
| 36 | by (rtac trans 1); | |
| 37 | by (rtac (thelub_up1a RS sym) 2); | |
| 38 | by (fast_tac HOL_cs 3); | |
| 39 | by (etac (monofun_Iup RS ch2ch_monofun) 2); | |
| 40 | by (res_inst_tac [("f","Iup")] arg_cong  1);
 | |
| 41 | by (rtac lub_equal 1); | |
| 42 | by (atac 1); | |
| 43 | by (rtac (monofun_Ifup2 RS ch2ch_monofun) 1); | |
| 44 | by (etac (monofun_Iup RS ch2ch_monofun) 1); | |
| 45 | by (asm_simp_tac Up0_ss 1); | |
| 46 | qed "contlub_Iup"; | |
| 2278 | 47 | |
| 9169 | 48 | Goal "cont(Iup)"; | 
| 49 | by (rtac monocontlub2cont 1); | |
| 50 | by (rtac monofun_Iup 1); | |
| 51 | by (rtac contlub_Iup 1); | |
| 52 | qed "cont_Iup"; | |
| 10230 | 53 | AddIffs [cont_Iup]; | 
| 2278 | 54 | |
| 55 | (* ------------------------------------------------------------------------ *) | |
| 56 | (* continuity for Ifup *) | |
| 57 | (* ------------------------------------------------------------------------ *) | |
| 58 | ||
| 9169 | 59 | Goal "contlub(Ifup)"; | 
| 60 | by (rtac contlubI 1); | |
| 61 | by (strip_tac 1); | |
| 62 | by (rtac trans 1); | |
| 63 | by (rtac (thelub_fun RS sym) 2); | |
| 64 | by (etac (monofun_Ifup1 RS ch2ch_monofun) 2); | |
| 65 | by (rtac ext 1); | |
| 66 | by (res_inst_tac [("p","x")] upE 1);
 | |
| 67 | by (asm_simp_tac Up0_ss 1); | |
| 68 | by (rtac (lub_const RS thelubI RS sym) 1); | |
| 69 | by (asm_simp_tac Up0_ss 1); | |
| 70 | by (etac contlub_cfun_fun 1); | |
| 71 | qed "contlub_Ifup1"; | |
| 2278 | 72 | |
| 73 | ||
| 8161 | 74 | Goal "contlub(Ifup(f))"; | 
| 75 | by (rtac contlubI 1); | |
| 76 | by (strip_tac 1); | |
| 77 | by (rtac disjE 1); | |
| 78 | by (stac thelub_up1a 2); | |
| 79 | by (atac 2); | |
| 80 | by (atac 2); | |
| 81 | by (asm_simp_tac Up0_ss 2); | |
| 82 | by (stac thelub_up1b 3); | |
| 83 | by (atac 3); | |
| 84 | by (atac 3); | |
| 85 | by (fast_tac HOL_cs 1); | |
| 86 | by (asm_simp_tac Up0_ss 2); | |
| 87 | by (rtac (chain_UU_I_inverse RS sym) 2); | |
| 88 | by (rtac allI 2); | |
| 89 | by  (res_inst_tac [("p","Y(i)")] upE 2);
 | |
| 90 | by (asm_simp_tac Up0_ss 2); | |
| 91 | by (rtac notE 2); | |
| 92 | by (dtac spec 2); | |
| 93 | by (etac spec 2); | |
| 94 | by (atac 2); | |
| 95 | by (stac contlub_cfun_arg 1); | |
| 96 | by (etac (monofun_Ifup2 RS ch2ch_monofun) 1); | |
| 97 | by (rtac lub_equal2 1); | |
| 98 | by (rtac (monofun_Rep_CFun2 RS ch2ch_monofun) 2); | |
| 99 | by (etac (monofun_Ifup2 RS ch2ch_monofun) 2); | |
| 100 | by (etac (monofun_Ifup2 RS ch2ch_monofun) 2); | |
| 101 | by (rtac (chain_mono2 RS exE) 1); | |
| 102 | by (atac 2); | |
| 103 | by (etac exE 1); | |
| 104 | by (etac exE 1); | |
| 105 | by (rtac exI 1); | |
| 106 | by  (res_inst_tac [("s","Iup(x)"),("t","Y(i)")] ssubst 1);
 | |
| 107 | by (atac 1); | |
| 108 | by (rtac defined_Iup2 1); | |
| 109 | by (rtac exI 1); | |
| 110 | by (strip_tac 1); | |
| 111 | by (res_inst_tac [("p","Y(i)")] upE 1);
 | |
| 112 | by (asm_simp_tac Up0_ss 2); | |
| 113 | by (res_inst_tac [("P","Y(i) = UU")] notE 1);
 | |
| 114 | by (fast_tac HOL_cs 1); | |
| 115 | by (stac inst_up_pcpo 1); | |
| 116 | by (atac 1); | |
| 117 | qed "contlub_Ifup2"; | |
| 2278 | 118 | |
| 9169 | 119 | Goal "cont(Ifup)"; | 
| 120 | by (rtac monocontlub2cont 1); | |
| 121 | by (rtac monofun_Ifup1 1); | |
| 122 | by (rtac contlub_Ifup1 1); | |
| 123 | qed "cont_Ifup1"; | |
| 2278 | 124 | |
| 9169 | 125 | Goal "cont(Ifup(f))"; | 
| 126 | by (rtac monocontlub2cont 1); | |
| 127 | by (rtac monofun_Ifup2 1); | |
| 128 | by (rtac contlub_Ifup2 1); | |
| 129 | qed "cont_Ifup2"; | |
| 2278 | 130 | |
| 131 | ||
| 132 | (* ------------------------------------------------------------------------ *) | |
| 133 | (* continuous versions of lemmas for ('a)u                                  *)
 | |
| 134 | (* ------------------------------------------------------------------------ *) | |
| 135 | ||
| 10834 | 136 | Goalw [up_def] "z = UU | (EX x. z = up$x)"; | 
| 9245 | 137 | by (simp_tac (Up0_ss addsimps [cont_Iup]) 1); | 
| 138 | by (stac inst_up_pcpo 1); | |
| 139 | by (rtac Exh_Up 1); | |
| 140 | qed "Exh_Up1"; | |
| 2278 | 141 | |
| 10834 | 142 | Goalw [up_def] "up$x=up$y ==> x=y"; | 
| 9245 | 143 | by (rtac inject_Iup 1); | 
| 10230 | 144 | by Auto_tac; | 
| 9245 | 145 | qed "inject_up"; | 
| 2278 | 146 | |
| 10834 | 147 | Goalw [up_def] " up$x ~= UU"; | 
| 10230 | 148 | by Auto_tac; | 
| 9245 | 149 | qed "defined_up"; | 
| 2278 | 150 | |
| 9248 
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
 paulson parents: 
9245diff
changeset | 151 | val prems = Goalw [up_def] | 
| 10834 | 152 | "[| p=UU ==> Q; !!x. p=up$x==>Q|] ==>Q"; | 
| 9245 | 153 | by (rtac upE 1); | 
| 154 | by (resolve_tac prems 1); | |
| 155 | by (etac (inst_up_pcpo RS ssubst) 1); | |
| 156 | by (resolve_tac (tl prems) 1); | |
| 157 | by (asm_simp_tac (Up0_ss addsimps [cont_Iup]) 1); | |
| 158 | qed "upE1"; | |
| 2278 | 159 | |
| 4098 | 160 | val tac = (simp_tac (simpset() addsimps [cont_Iup,cont_Ifup1, | 
| 2566 | 161 | cont_Ifup2,cont2cont_CF1L]) 1); | 
| 2278 | 162 | |
| 10834 | 163 | Goalw [up_def,fup_def] "fup$f$UU=UU"; | 
| 9245 | 164 | by (stac inst_up_pcpo 1); | 
| 165 | by (stac beta_cfun 1); | |
| 166 | by tac; | |
| 167 | by (stac beta_cfun 1); | |
| 168 | by tac; | |
| 169 | by (simp_tac (Up0_ss addsimps [cont_Iup,cont_Ifup1,cont_Ifup2]) 1); | |
| 170 | qed "fup1"; | |
| 2278 | 171 | |
| 10834 | 172 | Goalw [up_def,fup_def] "fup$f$(up$x)=f$x"; | 
| 9245 | 173 | by (stac beta_cfun 1); | 
| 174 | by (rtac cont_Iup 1); | |
| 175 | by (stac beta_cfun 1); | |
| 176 | by tac; | |
| 177 | by (stac beta_cfun 1); | |
| 178 | by (rtac cont_Ifup2 1); | |
| 179 | by (simp_tac (Up0_ss addsimps [cont_Iup,cont_Ifup1,cont_Ifup2]) 1); | |
| 180 | qed "fup2"; | |
| 2278 | 181 | |
| 10834 | 182 | Goalw [up_def,fup_def] "~ up$x << UU"; | 
| 9245 | 183 | by (simp_tac (Up0_ss addsimps [cont_Iup]) 1); | 
| 184 | by (rtac less_up3b 1); | |
| 185 | qed "less_up4b"; | |
| 2278 | 186 | |
| 9248 
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
 paulson parents: 
9245diff
changeset | 187 | Goalw [up_def,fup_def] | 
| 10834 | 188 | "(up$x << up$y) = (x<<y)"; | 
| 9245 | 189 | by (simp_tac (Up0_ss addsimps [cont_Iup]) 1); | 
| 190 | by (rtac less_up2c 1); | |
| 191 | qed "less_up4c"; | |
| 2278 | 192 | |
| 9248 
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
 paulson parents: 
9245diff
changeset | 193 | Goalw [up_def,fup_def] | 
| 10834 | 194 | "[| chain(Y); EX i x. Y(i) = up$x |] ==>\ | 
| 195 | \ lub(range(Y)) = up$(lub(range(%i. fup$(LAM x. x)$(Y i))))"; | |
| 9245 | 196 | by (stac beta_cfun 1); | 
| 197 | by tac; | |
| 198 | by (stac beta_cfun 1); | |
| 199 | by tac; | |
| 200 | by (stac (beta_cfun RS ext) 1); | |
| 201 | by tac; | |
| 202 | by (rtac thelub_up1a 1); | |
| 203 | by (atac 1); | |
| 204 | by (etac exE 1); | |
| 205 | by (etac exE 1); | |
| 206 | by (rtac exI 1); | |
| 207 | by (rtac exI 1); | |
| 208 | by (etac box_equals 1); | |
| 209 | by (rtac refl 1); | |
| 210 | by (simp_tac (Up0_ss addsimps [cont_Iup]) 1); | |
| 211 | qed "thelub_up2a"; | |
| 2278 | 212 | |
| 213 | ||
| 214 | ||
| 9248 
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
 paulson parents: 
9245diff
changeset | 215 | Goalw [up_def,fup_def] | 
| 10834 | 216 | "[| chain(Y); ! i x. Y(i) ~= up$x |] ==> lub(range(Y)) = UU"; | 
| 9245 | 217 | by (stac inst_up_pcpo 1); | 
| 218 | by (rtac thelub_up1b 1); | |
| 219 | by (atac 1); | |
| 220 | by (strip_tac 1); | |
| 221 | by (dtac spec 1); | |
| 222 | by (dtac spec 1); | |
| 10230 | 223 | by (asm_full_simp_tac (Up0_ss addsimps [cont_Iup]) 1); | 
| 9245 | 224 | qed "thelub_up2b"; | 
| 2278 | 225 | |
| 226 | ||
| 10834 | 227 | Goal "(EX x. z = up$x) = (z~=UU)"; | 
| 9169 | 228 | by (rtac iffI 1); | 
| 229 | by (etac exE 1); | |
| 230 | by (hyp_subst_tac 1); | |
| 231 | by (rtac defined_up 1); | |
| 232 | by (res_inst_tac [("p","z")] upE1 1);
 | |
| 233 | by (etac notE 1); | |
| 234 | by (atac 1); | |
| 235 | by (etac exI 1); | |
| 236 | qed "up_lemma2"; | |
| 2278 | 237 | |
| 238 | ||
| 10834 | 239 | Goal "[| chain(Y); lub(range(Y)) = up$x |] ==> EX i x. Y(i) = up$x"; | 
| 9169 | 240 | by (rtac exE 1); | 
| 241 | by (rtac chain_UU_I_inverse2 1); | |
| 242 | by (rtac (up_lemma2 RS iffD1) 1); | |
| 243 | by (etac exI 1); | |
| 244 | by (rtac exI 1); | |
| 245 | by (rtac (up_lemma2 RS iffD2) 1); | |
| 246 | by (atac 1); | |
| 247 | qed "thelub_up2a_rev"; | |
| 2278 | 248 | |
| 10834 | 249 | Goal "[| chain(Y); lub(range(Y)) = UU |] ==> ! i x. Y(i) ~= up$x"; | 
| 10230 | 250 | by (blast_tac (claset() addSDs [chain_UU_I RS spec, | 
| 251 | exI RS (up_lemma2 RS iffD1)]) 1); | |
| 9169 | 252 | qed "thelub_up2b_rev"; | 
| 2278 | 253 | |
| 254 | ||
| 9169 | 255 | Goal "chain(Y) ==> lub(range(Y)) = UU | \ | 
| 10834 | 256 | \ lub(range(Y)) = up$(lub(range(%i. fup$(LAM x. x)$(Y i))))"; | 
| 9169 | 257 | by (rtac disjE 1); | 
| 258 | by (rtac disjI1 2); | |
| 259 | by (rtac thelub_up2b 2); | |
| 260 | by (atac 2); | |
| 261 | by (atac 2); | |
| 262 | by (rtac disjI2 2); | |
| 263 | by (rtac thelub_up2a 2); | |
| 264 | by (atac 2); | |
| 265 | by (atac 2); | |
| 266 | by (fast_tac HOL_cs 1); | |
| 267 | qed "thelub_up3"; | |
| 2278 | 268 | |
| 10834 | 269 | Goal "fup$up$x=x"; | 
| 9169 | 270 | by (res_inst_tac [("p","x")] upE1 1);
 | 
| 271 | by (asm_simp_tac ((simpset_of Cfun3.thy) addsimps [fup1,fup2]) 1); | |
| 272 | by (asm_simp_tac ((simpset_of Cfun3.thy) addsimps [fup1,fup2]) 1); | |
| 273 | qed "fup3"; | |
| 2278 | 274 | |
| 275 | (* ------------------------------------------------------------------------ *) | |
| 276 | (* install simplifier for ('a)u                                             *)
 | |
| 277 | (* ------------------------------------------------------------------------ *) | |
| 278 | ||
| 3327 | 279 | Addsimps [fup1,fup2,defined_up]; |