| author | krauss | 
| Sun, 01 Apr 2012 22:14:59 +0200 | |
| changeset 47260 | 3b9eeb4a2967 | 
| parent 46950 | d0181abdbdac | 
| child 48891 | c0eafbd55de3 | 
| permissions | -rw-r--r-- | 
| 42151 | 1 | (* Title: HOL/HOLCF/Domain.thy | 
| 15741 | 2 | Author: Brian Huffman | 
| 3 | *) | |
| 4 | ||
| 5 | header {* Domain package *}
 | |
| 6 | ||
| 7 | theory Domain | |
| 41285 | 8 | imports Representable Domain_Aux | 
| 46950 
d0181abdbdac
declare command keywords via theory header, including strict checking outside Pure;
 wenzelm parents: 
46947diff
changeset | 9 | keywords | 
| 
d0181abdbdac
declare command keywords via theory header, including strict checking outside Pure;
 wenzelm parents: 
46947diff
changeset | 10 | "domaindef" :: thy_decl and "lazy" "unsafe" and | 
| 
d0181abdbdac
declare command keywords via theory header, including strict checking outside Pure;
 wenzelm parents: 
46947diff
changeset | 11 | "domain_isomorphism" "domain" :: thy_decl | 
| 30910 | 12 | uses | 
| 40575 | 13 |   ("Tools/domaindef.ML")
 | 
| 40504 | 14 |   ("Tools/Domain/domain_isomorphism.ML")
 | 
| 15 |   ("Tools/Domain/domain_axioms.ML")
 | |
| 16 |   ("Tools/Domain/domain.ML")
 | |
| 15741 | 17 | begin | 
| 18 | ||
| 40504 | 19 | default_sort "domain" | 
| 20 | ||
| 21 | subsection {* Representations of types *}
 | |
| 22 | ||
| 23 | lemma emb_prj: "emb\<cdot>((prj\<cdot>x)::'a) = cast\<cdot>DEFL('a)\<cdot>x"
 | |
| 24 | by (simp add: cast_DEFL) | |
| 25 | ||
| 26 | lemma emb_prj_emb: | |
| 27 | fixes x :: "'a" | |
| 28 |   assumes "DEFL('a) \<sqsubseteq> DEFL('b)"
 | |
| 29 | shows "emb\<cdot>(prj\<cdot>(emb\<cdot>x) :: 'b) = emb\<cdot>x" | |
| 30 | unfolding emb_prj | |
| 31 | apply (rule cast.belowD) | |
| 32 | apply (rule monofun_cfun_arg [OF assms]) | |
| 33 | apply (simp add: cast_DEFL) | |
| 34 | done | |
| 35 | ||
| 36 | lemma prj_emb_prj: | |
| 37 |   assumes "DEFL('a) \<sqsubseteq> DEFL('b)"
 | |
| 38 | shows "prj\<cdot>(emb\<cdot>(prj\<cdot>x :: 'b)) = (prj\<cdot>x :: 'a)" | |
| 39 | apply (rule emb_eq_iff [THEN iffD1]) | |
| 40 | apply (simp only: emb_prj) | |
| 41 | apply (rule deflation_below_comp1) | |
| 42 | apply (rule deflation_cast) | |
| 43 | apply (rule deflation_cast) | |
| 44 | apply (rule monofun_cfun_arg [OF assms]) | |
| 45 | done | |
| 46 | ||
| 47 | text {* Isomorphism lemmas used internally by the domain package: *}
 | |
| 48 | ||
| 49 | lemma domain_abs_iso: | |
| 50 | fixes abs and rep | |
| 51 |   assumes DEFL: "DEFL('b) = DEFL('a)"
 | |
| 52 | assumes abs_def: "(abs :: 'a \<rightarrow> 'b) \<equiv> prj oo emb" | |
| 53 | assumes rep_def: "(rep :: 'b \<rightarrow> 'a) \<equiv> prj oo emb" | |
| 54 | shows "rep\<cdot>(abs\<cdot>x) = x" | |
| 55 | unfolding abs_def rep_def | |
| 56 | by (simp add: emb_prj_emb DEFL) | |
| 57 | ||
| 58 | lemma domain_rep_iso: | |
| 59 | fixes abs and rep | |
| 60 |   assumes DEFL: "DEFL('b) = DEFL('a)"
 | |
| 61 | assumes abs_def: "(abs :: 'a \<rightarrow> 'b) \<equiv> prj oo emb" | |
| 62 | assumes rep_def: "(rep :: 'b \<rightarrow> 'a) \<equiv> prj oo emb" | |
| 63 | shows "abs\<cdot>(rep\<cdot>x) = x" | |
| 64 | unfolding abs_def rep_def | |
| 65 | by (simp add: emb_prj_emb DEFL) | |
| 66 | ||
| 67 | subsection {* Deflations as sets *}
 | |
| 68 | ||
| 41287 
029a6fc1bfb8
type 'defl' takes a type parameter again (cf. b525988432e9)
 huffman parents: 
41285diff
changeset | 69 | definition defl_set :: "'a::bifinite defl \<Rightarrow> 'a set" | 
| 40504 | 70 | where "defl_set A = {x. cast\<cdot>A\<cdot>x = x}"
 | 
| 71 | ||
| 72 | lemma adm_defl_set: "adm (\<lambda>x. x \<in> defl_set A)" | |
| 73 | unfolding defl_set_def by simp | |
| 74 | ||
| 75 | lemma defl_set_bottom: "\<bottom> \<in> defl_set A" | |
| 76 | unfolding defl_set_def by simp | |
| 77 | ||
| 78 | lemma defl_set_cast [simp]: "cast\<cdot>A\<cdot>x \<in> defl_set A" | |
| 79 | unfolding defl_set_def by simp | |
| 80 | ||
| 81 | lemma defl_set_subset_iff: "defl_set A \<subseteq> defl_set B \<longleftrightarrow> A \<sqsubseteq> B" | |
| 82 | apply (simp add: defl_set_def subset_eq cast_below_cast [symmetric]) | |
| 83 | apply (auto simp add: cast.belowI cast.belowD) | |
| 84 | done | |
| 85 | ||
| 86 | subsection {* Proving a subtype is representable *}
 | |
| 87 | ||
| 88 | text {* Temporarily relax type constraints. *}
 | |
| 89 | ||
| 90 | setup {*
 | |
| 91 | fold Sign.add_const_constraint | |
| 41287 
029a6fc1bfb8
type 'defl' takes a type parameter again (cf. b525988432e9)
 huffman parents: 
41285diff
changeset | 92 |   [ (@{const_name defl}, SOME @{typ "'a::pcpo itself \<Rightarrow> udom defl"})
 | 
| 40504 | 93 |   , (@{const_name emb}, SOME @{typ "'a::pcpo \<rightarrow> udom"})
 | 
| 94 |   , (@{const_name prj}, SOME @{typ "udom \<rightarrow> 'a::pcpo"})
 | |
| 41292 
2b7bc8d9fd6e
use deflations over type 'udom u' to represent predomains;
 huffman parents: 
41290diff
changeset | 95 |   , (@{const_name liftdefl}, SOME @{typ "'a::pcpo itself \<Rightarrow> udom u defl"})
 | 
| 
2b7bc8d9fd6e
use deflations over type 'udom u' to represent predomains;
 huffman parents: 
41290diff
changeset | 96 |   , (@{const_name liftemb}, SOME @{typ "'a::pcpo u \<rightarrow> udom u"})
 | 
| 
2b7bc8d9fd6e
use deflations over type 'udom u' to represent predomains;
 huffman parents: 
41290diff
changeset | 97 |   , (@{const_name liftprj}, SOME @{typ "udom u \<rightarrow> 'a::pcpo u"}) ]
 | 
| 40504 | 98 | *} | 
| 99 | ||
| 41292 
2b7bc8d9fd6e
use deflations over type 'udom u' to represent predomains;
 huffman parents: 
41290diff
changeset | 100 | lemma typedef_domain_class: | 
| 40504 | 101 | fixes Rep :: "'a::pcpo \<Rightarrow> udom" | 
| 102 | fixes Abs :: "udom \<Rightarrow> 'a::pcpo" | |
| 41287 
029a6fc1bfb8
type 'defl' takes a type parameter again (cf. b525988432e9)
 huffman parents: 
41285diff
changeset | 103 | fixes t :: "udom defl" | 
| 40504 | 104 | assumes type: "type_definition Rep Abs (defl_set t)" | 
| 105 | assumes below: "op \<sqsubseteq> \<equiv> \<lambda>x y. Rep x \<sqsubseteq> Rep y" | |
| 106 | assumes emb: "emb \<equiv> (\<Lambda> x. Rep x)" | |
| 107 | assumes prj: "prj \<equiv> (\<Lambda> x. Abs (cast\<cdot>t\<cdot>x))" | |
| 108 | assumes defl: "defl \<equiv> (\<lambda> a::'a itself. t)" | |
| 41292 
2b7bc8d9fd6e
use deflations over type 'udom u' to represent predomains;
 huffman parents: 
41290diff
changeset | 109 | assumes liftemb: "(liftemb :: 'a u \<rightarrow> udom u) \<equiv> u_map\<cdot>emb" | 
| 
2b7bc8d9fd6e
use deflations over type 'udom u' to represent predomains;
 huffman parents: 
41290diff
changeset | 110 | assumes liftprj: "(liftprj :: udom u \<rightarrow> 'a u) \<equiv> u_map\<cdot>prj" | 
| 41436 | 111 |   assumes liftdefl: "(liftdefl :: 'a itself \<Rightarrow> _) \<equiv> (\<lambda>t. liftdefl_of\<cdot>DEFL('a))"
 | 
| 41292 
2b7bc8d9fd6e
use deflations over type 'udom u' to represent predomains;
 huffman parents: 
41290diff
changeset | 112 |   shows "OFCLASS('a, domain_class)"
 | 
| 
2b7bc8d9fd6e
use deflations over type 'udom u' to represent predomains;
 huffman parents: 
41290diff
changeset | 113 | proof | 
| 40504 | 114 | have emb_beta: "\<And>x. emb\<cdot>x = Rep x" | 
| 115 | unfolding emb | |
| 116 | apply (rule beta_cfun) | |
| 40834 
a1249aeff5b6
change cpodef-generated cont_Rep rules to cont2cont format
 huffman parents: 
40830diff
changeset | 117 | apply (rule typedef_cont_Rep [OF type below adm_defl_set cont_id]) | 
| 40504 | 118 | done | 
| 119 | have prj_beta: "\<And>y. prj\<cdot>y = Abs (cast\<cdot>t\<cdot>y)" | |
| 120 | unfolding prj | |
| 121 | apply (rule beta_cfun) | |
| 122 | apply (rule typedef_cont_Abs [OF type below adm_defl_set]) | |
| 123 | apply simp_all | |
| 124 | done | |
| 125 | have prj_emb: "\<And>x::'a. prj\<cdot>(emb\<cdot>x) = x" | |
| 126 | using type_definition.Rep [OF type] | |
| 127 | unfolding prj_beta emb_beta defl_set_def | |
| 128 | by (simp add: type_definition.Rep_inverse [OF type]) | |
| 129 | have emb_prj: "\<And>y. emb\<cdot>(prj\<cdot>y :: 'a) = cast\<cdot>t\<cdot>y" | |
| 130 | unfolding prj_beta emb_beta | |
| 131 | by (simp add: type_definition.Abs_inverse [OF type]) | |
| 132 | show "ep_pair (emb :: 'a \<rightarrow> udom) prj" | |
| 133 | apply default | |
| 134 | apply (simp add: prj_emb) | |
| 135 | apply (simp add: emb_prj cast.below) | |
| 136 | done | |
| 137 |   show "cast\<cdot>DEFL('a) = emb oo (prj :: udom \<rightarrow> 'a)"
 | |
| 138 | by (rule cfun_eqI, simp add: defl emb_prj) | |
| 41292 
2b7bc8d9fd6e
use deflations over type 'udom u' to represent predomains;
 huffman parents: 
41290diff
changeset | 139 | qed (simp_all only: liftemb liftprj liftdefl) | 
| 40504 | 140 | |
| 141 | lemma typedef_DEFL: | |
| 142 | assumes "defl \<equiv> (\<lambda>a::'a::pcpo itself. t)" | |
| 143 |   shows "DEFL('a::pcpo) = t"
 | |
| 144 | unfolding assms .. | |
| 145 | ||
| 146 | text {* Restore original typing constraints. *}
 | |
| 147 | ||
| 148 | setup {*
 | |
| 149 | fold Sign.add_const_constraint | |
| 41287 
029a6fc1bfb8
type 'defl' takes a type parameter again (cf. b525988432e9)
 huffman parents: 
41285diff
changeset | 150 |   [ (@{const_name defl}, SOME @{typ "'a::domain itself \<Rightarrow> udom defl"})
 | 
| 40504 | 151 |   , (@{const_name emb}, SOME @{typ "'a::domain \<rightarrow> udom"})
 | 
| 152 |   , (@{const_name prj}, SOME @{typ "udom \<rightarrow> 'a::domain"})
 | |
| 41292 
2b7bc8d9fd6e
use deflations over type 'udom u' to represent predomains;
 huffman parents: 
41290diff
changeset | 153 |   , (@{const_name liftdefl}, SOME @{typ "'a::predomain itself \<Rightarrow> udom u defl"})
 | 
| 
2b7bc8d9fd6e
use deflations over type 'udom u' to represent predomains;
 huffman parents: 
41290diff
changeset | 154 |   , (@{const_name liftemb}, SOME @{typ "'a::predomain u \<rightarrow> udom u"})
 | 
| 
2b7bc8d9fd6e
use deflations over type 'udom u' to represent predomains;
 huffman parents: 
41290diff
changeset | 155 |   , (@{const_name liftprj}, SOME @{typ "udom u \<rightarrow> 'a::predomain u"}) ]
 | 
| 40504 | 156 | *} | 
| 157 | ||
| 40575 | 158 | use "Tools/domaindef.ML" | 
| 40504 | 159 | |
| 160 | subsection {* Isomorphic deflations *}
 | |
| 161 | ||
| 41292 
2b7bc8d9fd6e
use deflations over type 'udom u' to represent predomains;
 huffman parents: 
41290diff
changeset | 162 | definition isodefl :: "('a \<rightarrow> 'a) \<Rightarrow> udom defl \<Rightarrow> bool"
 | 
| 
2b7bc8d9fd6e
use deflations over type 'udom u' to represent predomains;
 huffman parents: 
41290diff
changeset | 163 | where "isodefl d t \<longleftrightarrow> cast\<cdot>t = emb oo d oo prj" | 
| 
2b7bc8d9fd6e
use deflations over type 'udom u' to represent predomains;
 huffman parents: 
41290diff
changeset | 164 | |
| 
2b7bc8d9fd6e
use deflations over type 'udom u' to represent predomains;
 huffman parents: 
41290diff
changeset | 165 | definition isodefl' :: "('a::predomain \<rightarrow> 'a) \<Rightarrow> udom u defl \<Rightarrow> bool"
 | 
| 
2b7bc8d9fd6e
use deflations over type 'udom u' to represent predomains;
 huffman parents: 
41290diff
changeset | 166 | where "isodefl' d t \<longleftrightarrow> cast\<cdot>t = liftemb oo u_map\<cdot>d oo liftprj" | 
| 40504 | 167 | |
| 168 | lemma isodeflI: "(\<And>x. cast\<cdot>t\<cdot>x = emb\<cdot>(d\<cdot>(prj\<cdot>x))) \<Longrightarrow> isodefl d t" | |
| 169 | unfolding isodefl_def by (simp add: cfun_eqI) | |
| 170 | ||
| 171 | lemma cast_isodefl: "isodefl d t \<Longrightarrow> cast\<cdot>t = (\<Lambda> x. emb\<cdot>(d\<cdot>(prj\<cdot>x)))" | |
| 172 | unfolding isodefl_def by (simp add: cfun_eqI) | |
| 173 | ||
| 174 | lemma isodefl_strict: "isodefl d t \<Longrightarrow> d\<cdot>\<bottom> = \<bottom>" | |
| 175 | unfolding isodefl_def | |
| 176 | by (drule cfun_fun_cong [where x="\<bottom>"], simp) | |
| 177 | ||
| 178 | lemma isodefl_imp_deflation: | |
| 179 | fixes d :: "'a \<rightarrow> 'a" | |
| 180 | assumes "isodefl d t" shows "deflation d" | |
| 181 | proof | |
| 182 | note assms [unfolded isodefl_def, simp] | |
| 183 | fix x :: 'a | |
| 184 | show "d\<cdot>(d\<cdot>x) = d\<cdot>x" | |
| 185 | using cast.idem [of t "emb\<cdot>x"] by simp | |
| 186 | show "d\<cdot>x \<sqsubseteq> x" | |
| 187 | using cast.below [of t "emb\<cdot>x"] by simp | |
| 188 | qed | |
| 189 | ||
| 190 | lemma isodefl_ID_DEFL: "isodefl (ID :: 'a \<rightarrow> 'a) DEFL('a)"
 | |
| 191 | unfolding isodefl_def by (simp add: cast_DEFL) | |
| 192 | ||
| 193 | lemma isodefl_LIFTDEFL: | |
| 41292 
2b7bc8d9fd6e
use deflations over type 'udom u' to represent predomains;
 huffman parents: 
41290diff
changeset | 194 |   "isodefl' (ID :: 'a \<rightarrow> 'a) LIFTDEFL('a::predomain)"
 | 
| 
2b7bc8d9fd6e
use deflations over type 'udom u' to represent predomains;
 huffman parents: 
41290diff
changeset | 195 | unfolding isodefl'_def by (simp add: cast_liftdefl u_map_ID) | 
| 40504 | 196 | |
| 197 | lemma isodefl_DEFL_imp_ID: "isodefl (d :: 'a \<rightarrow> 'a) DEFL('a) \<Longrightarrow> d = ID"
 | |
| 198 | unfolding isodefl_def | |
| 199 | apply (simp add: cast_DEFL) | |
| 200 | apply (simp add: cfun_eq_iff) | |
| 201 | apply (rule allI) | |
| 202 | apply (drule_tac x="emb\<cdot>x" in spec) | |
| 203 | apply simp | |
| 204 | done | |
| 205 | ||
| 206 | lemma isodefl_bottom: "isodefl \<bottom> \<bottom>" | |
| 207 | unfolding isodefl_def by (simp add: cfun_eq_iff) | |
| 208 | ||
| 209 | lemma adm_isodefl: | |
| 210 | "cont f \<Longrightarrow> cont g \<Longrightarrow> adm (\<lambda>x. isodefl (f x) (g x))" | |
| 211 | unfolding isodefl_def by simp | |
| 212 | ||
| 213 | lemma isodefl_lub: | |
| 214 | assumes "chain d" and "chain t" | |
| 215 | assumes "\<And>i. isodefl (d i) (t i)" | |
| 216 | shows "isodefl (\<Squnion>i. d i) (\<Squnion>i. t i)" | |
| 41529 | 217 | using assms unfolding isodefl_def | 
| 40504 | 218 | by (simp add: contlub_cfun_arg contlub_cfun_fun) | 
| 219 | ||
| 220 | lemma isodefl_fix: | |
| 221 | assumes "\<And>d t. isodefl d t \<Longrightarrow> isodefl (f\<cdot>d) (g\<cdot>t)" | |
| 222 | shows "isodefl (fix\<cdot>f) (fix\<cdot>g)" | |
| 223 | unfolding fix_def2 | |
| 224 | apply (rule isodefl_lub, simp, simp) | |
| 225 | apply (induct_tac i) | |
| 226 | apply (simp add: isodefl_bottom) | |
| 227 | apply (simp add: assms) | |
| 228 | done | |
| 229 | ||
| 230 | lemma isodefl_abs_rep: | |
| 231 | fixes abs and rep and d | |
| 232 |   assumes DEFL: "DEFL('b) = DEFL('a)"
 | |
| 233 | assumes abs_def: "(abs :: 'a \<rightarrow> 'b) \<equiv> prj oo emb" | |
| 234 | assumes rep_def: "(rep :: 'b \<rightarrow> 'a) \<equiv> prj oo emb" | |
| 235 | shows "isodefl d t \<Longrightarrow> isodefl (abs oo d oo rep) t" | |
| 236 | unfolding isodefl_def | |
| 237 | by (simp add: cfun_eq_iff assms prj_emb_prj emb_prj_emb) | |
| 238 | ||
| 41436 | 239 | lemma isodefl'_liftdefl_of: "isodefl d t \<Longrightarrow> isodefl' d (liftdefl_of\<cdot>t)" | 
| 41292 
2b7bc8d9fd6e
use deflations over type 'udom u' to represent predomains;
 huffman parents: 
41290diff
changeset | 240 | unfolding isodefl_def isodefl'_def | 
| 41436 | 241 | by (simp add: cast_liftdefl_of u_map_oo liftemb_eq liftprj_eq) | 
| 41292 
2b7bc8d9fd6e
use deflations over type 'udom u' to represent predomains;
 huffman parents: 
41290diff
changeset | 242 | |
| 40592 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 huffman parents: 
40575diff
changeset | 243 | lemma isodefl_sfun: | 
| 40504 | 244 | "isodefl d1 t1 \<Longrightarrow> isodefl d2 t2 \<Longrightarrow> | 
| 40592 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 huffman parents: 
40575diff
changeset | 245 | isodefl (sfun_map\<cdot>d1\<cdot>d2) (sfun_defl\<cdot>t1\<cdot>t2)" | 
| 40504 | 246 | apply (rule isodeflI) | 
| 40592 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 huffman parents: 
40575diff
changeset | 247 | apply (simp add: cast_sfun_defl cast_isodefl) | 
| 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 huffman parents: 
40575diff
changeset | 248 | apply (simp add: emb_sfun_def prj_sfun_def) | 
| 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 huffman parents: 
40575diff
changeset | 249 | apply (simp add: sfun_map_map isodefl_strict) | 
| 40504 | 250 | done | 
| 251 | ||
| 252 | lemma isodefl_ssum: | |
| 253 | "isodefl d1 t1 \<Longrightarrow> isodefl d2 t2 \<Longrightarrow> | |
| 254 | isodefl (ssum_map\<cdot>d1\<cdot>d2) (ssum_defl\<cdot>t1\<cdot>t2)" | |
| 255 | apply (rule isodeflI) | |
| 256 | apply (simp add: cast_ssum_defl cast_isodefl) | |
| 257 | apply (simp add: emb_ssum_def prj_ssum_def) | |
| 258 | apply (simp add: ssum_map_map isodefl_strict) | |
| 259 | done | |
| 260 | ||
| 261 | lemma isodefl_sprod: | |
| 262 | "isodefl d1 t1 \<Longrightarrow> isodefl d2 t2 \<Longrightarrow> | |
| 263 | isodefl (sprod_map\<cdot>d1\<cdot>d2) (sprod_defl\<cdot>t1\<cdot>t2)" | |
| 264 | apply (rule isodeflI) | |
| 265 | apply (simp add: cast_sprod_defl cast_isodefl) | |
| 266 | apply (simp add: emb_sprod_def prj_sprod_def) | |
| 267 | apply (simp add: sprod_map_map isodefl_strict) | |
| 268 | done | |
| 269 | ||
| 41297 | 270 | lemma isodefl_prod: | 
| 40504 | 271 | "isodefl d1 t1 \<Longrightarrow> isodefl d2 t2 \<Longrightarrow> | 
| 41297 | 272 | isodefl (prod_map\<cdot>d1\<cdot>d2) (prod_defl\<cdot>t1\<cdot>t2)" | 
| 40504 | 273 | apply (rule isodeflI) | 
| 274 | apply (simp add: cast_prod_defl cast_isodefl) | |
| 275 | apply (simp add: emb_prod_def prj_prod_def) | |
| 41297 | 276 | apply (simp add: prod_map_map cfcomp1) | 
| 40504 | 277 | done | 
| 278 | ||
| 279 | lemma isodefl_u: | |
| 41437 | 280 | "isodefl d t \<Longrightarrow> isodefl (u_map\<cdot>d) (u_defl\<cdot>t)" | 
| 40504 | 281 | apply (rule isodeflI) | 
| 41437 | 282 | apply (simp add: cast_u_defl cast_isodefl) | 
| 283 | apply (simp add: emb_u_def prj_u_def liftemb_eq liftprj_eq u_map_map) | |
| 284 | done | |
| 285 | ||
| 286 | lemma isodefl_u_liftdefl: | |
| 287 | "isodefl' d t \<Longrightarrow> isodefl (u_map\<cdot>d) (u_liftdefl\<cdot>t)" | |
| 288 | apply (rule isodeflI) | |
| 289 | apply (simp add: cast_u_liftdefl isodefl'_def) | |
| 40504 | 290 | apply (simp add: emb_u_def prj_u_def liftemb_eq liftprj_eq) | 
| 291 | done | |
| 292 | ||
| 293 | lemma encode_prod_u_map: | |
| 41297 | 294 | "encode_prod_u\<cdot>(u_map\<cdot>(prod_map\<cdot>f\<cdot>g)\<cdot>(decode_prod_u\<cdot>x)) | 
| 40504 | 295 | = sprod_map\<cdot>(u_map\<cdot>f)\<cdot>(u_map\<cdot>g)\<cdot>x" | 
| 296 | unfolding encode_prod_u_def decode_prod_u_def | |
| 297 | apply (case_tac x, simp, rename_tac a b) | |
| 298 | apply (case_tac a, simp, case_tac b, simp, simp) | |
| 299 | done | |
| 300 | ||
| 41297 | 301 | lemma isodefl_prod_u: | 
| 41292 
2b7bc8d9fd6e
use deflations over type 'udom u' to represent predomains;
 huffman parents: 
41290diff
changeset | 302 | assumes "isodefl' d1 t1" and "isodefl' d2 t2" | 
| 41297 | 303 | shows "isodefl' (prod_map\<cdot>d1\<cdot>d2) (prod_liftdefl\<cdot>t1\<cdot>t2)" | 
| 41292 
2b7bc8d9fd6e
use deflations over type 'udom u' to represent predomains;
 huffman parents: 
41290diff
changeset | 304 | using assms unfolding isodefl'_def | 
| 
2b7bc8d9fd6e
use deflations over type 'udom u' to represent predomains;
 huffman parents: 
41290diff
changeset | 305 | unfolding liftemb_prod_def liftprj_prod_def | 
| 
2b7bc8d9fd6e
use deflations over type 'udom u' to represent predomains;
 huffman parents: 
41290diff
changeset | 306 | by (simp add: cast_prod_liftdefl cfcomp1 encode_prod_u_map sprod_map_map) | 
| 40504 | 307 | |
| 40592 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 huffman parents: 
40575diff
changeset | 308 | lemma encode_cfun_map: | 
| 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 huffman parents: 
40575diff
changeset | 309 | "encode_cfun\<cdot>(cfun_map\<cdot>f\<cdot>g\<cdot>(decode_cfun\<cdot>x)) | 
| 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 huffman parents: 
40575diff
changeset | 310 | = sfun_map\<cdot>(u_map\<cdot>f)\<cdot>g\<cdot>x" | 
| 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 huffman parents: 
40575diff
changeset | 311 | unfolding encode_cfun_def decode_cfun_def | 
| 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 huffman parents: 
40575diff
changeset | 312 | apply (simp add: sfun_eq_iff cfun_map_def sfun_map_def) | 
| 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 huffman parents: 
40575diff
changeset | 313 | apply (rule cfun_eqI, rename_tac y, case_tac y, simp_all) | 
| 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 huffman parents: 
40575diff
changeset | 314 | done | 
| 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 huffman parents: 
40575diff
changeset | 315 | |
| 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 huffman parents: 
40575diff
changeset | 316 | lemma isodefl_cfun: | 
| 40830 | 317 | assumes "isodefl (u_map\<cdot>d1) t1" and "isodefl d2 t2" | 
| 318 | shows "isodefl (cfun_map\<cdot>d1\<cdot>d2) (sfun_defl\<cdot>t1\<cdot>t2)" | |
| 319 | using isodefl_sfun [OF assms] unfolding isodefl_def | |
| 320 | by (simp add: emb_cfun_def prj_cfun_def cfcomp1 encode_cfun_map) | |
| 40592 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 huffman parents: 
40575diff
changeset | 321 | |
| 40504 | 322 | subsection {* Setting up the domain package *}
 | 
| 323 | ||
| 324 | use "Tools/Domain/domain_isomorphism.ML" | |
| 325 | use "Tools/Domain/domain_axioms.ML" | |
| 326 | use "Tools/Domain/domain.ML" | |
| 327 | ||
| 328 | setup Domain_Isomorphism.setup | |
| 329 | ||
| 330 | lemmas [domain_defl_simps] = | |
| 40592 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 huffman parents: 
40575diff
changeset | 331 | DEFL_cfun DEFL_sfun DEFL_ssum DEFL_sprod DEFL_prod DEFL_u | 
| 41437 | 332 | liftdefl_eq LIFTDEFL_prod u_liftdefl_liftdefl_of | 
| 40504 | 333 | |
| 334 | lemmas [domain_map_ID] = | |
| 41297 | 335 | cfun_map_ID sfun_map_ID ssum_map_ID sprod_map_ID prod_map_ID u_map_ID | 
| 40504 | 336 | |
| 337 | lemmas [domain_isodefl] = | |
| 40592 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 huffman parents: 
40575diff
changeset | 338 | isodefl_u isodefl_sfun isodefl_ssum isodefl_sprod | 
| 41436 | 339 | isodefl_cfun isodefl_prod isodefl_prod_u isodefl'_liftdefl_of | 
| 41437 | 340 | isodefl_u_liftdefl | 
| 40504 | 341 | |
| 342 | lemmas [domain_deflation] = | |
| 40592 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 huffman parents: 
40575diff
changeset | 343 | deflation_cfun_map deflation_sfun_map deflation_ssum_map | 
| 41297 | 344 | deflation_sprod_map deflation_prod_map deflation_u_map | 
| 40504 | 345 | |
| 346 | setup {*
 | |
| 40737 
2037021f034f
remove map function names from domain package theory data
 huffman parents: 
40592diff
changeset | 347 | fold Domain_Take_Proofs.add_rec_type | 
| 
2037021f034f
remove map function names from domain package theory data
 huffman parents: 
40592diff
changeset | 348 |     [(@{type_name cfun}, [true, true]),
 | 
| 
2037021f034f
remove map function names from domain package theory data
 huffman parents: 
40592diff
changeset | 349 |      (@{type_name "sfun"}, [true, true]),
 | 
| 
2037021f034f
remove map function names from domain package theory data
 huffman parents: 
40592diff
changeset | 350 |      (@{type_name ssum}, [true, true]),
 | 
| 
2037021f034f
remove map function names from domain package theory data
 huffman parents: 
40592diff
changeset | 351 |      (@{type_name sprod}, [true, true]),
 | 
| 
2037021f034f
remove map function names from domain package theory data
 huffman parents: 
40592diff
changeset | 352 |      (@{type_name prod}, [true, true]),
 | 
| 
2037021f034f
remove map function names from domain package theory data
 huffman parents: 
40592diff
changeset | 353 |      (@{type_name "u"}, [true])]
 | 
| 40504 | 354 | *} | 
| 355 | ||
| 15741 | 356 | end |