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