author | wenzelm |
Tue, 10 Dec 2024 22:40:07 +0100 | |
changeset 81574 | c4abe6582ee5 |
parent 81573 | 972fecd8907a |
child 81577 | a712bf5ccab0 |
permissions | -rw-r--r-- |
42151 | 1 |
(* Title: HOL/HOLCF/Domain.thy |
15741 | 2 |
Author: Brian Huffman |
3 |
*) |
|
4 |
||
62175 | 5 |
section \<open>Domain package\<close> |
15741 | 6 |
|
7 |
theory Domain |
|
81573 | 8 |
imports Representable Map_Functions Fixrec |
46950
d0181abdbdac
declare command keywords via theory header, including strict checking outside Pure;
wenzelm
parents:
46947
diff
changeset
|
9 |
keywords |
63432 | 10 |
"lazy" "unsafe" and |
69913 | 11 |
"domaindef" "domain" :: thy_defn and |
12 |
"domain_isomorphism" :: thy_decl |
|
15741 | 13 |
begin |
14 |
||
81573 | 15 |
subsection \<open>Continuous isomorphisms\<close> |
16 |
||
17 |
text \<open>A locale for continuous isomorphisms\<close> |
|
18 |
||
19 |
locale iso = |
|
20 |
fixes abs :: "'a \<rightarrow> 'b" |
|
21 |
fixes rep :: "'b \<rightarrow> 'a" |
|
22 |
assumes abs_iso [simp]: "rep\<cdot>(abs\<cdot>x) = x" |
|
23 |
assumes rep_iso [simp]: "abs\<cdot>(rep\<cdot>y) = y" |
|
24 |
begin |
|
25 |
||
26 |
lemma swap: "iso rep abs" |
|
27 |
by (rule iso.intro [OF rep_iso abs_iso]) |
|
28 |
||
29 |
lemma abs_below: "(abs\<cdot>x \<sqsubseteq> abs\<cdot>y) = (x \<sqsubseteq> y)" |
|
30 |
proof |
|
31 |
assume "abs\<cdot>x \<sqsubseteq> abs\<cdot>y" |
|
32 |
then have "rep\<cdot>(abs\<cdot>x) \<sqsubseteq> rep\<cdot>(abs\<cdot>y)" by (rule monofun_cfun_arg) |
|
33 |
then show "x \<sqsubseteq> y" by simp |
|
34 |
next |
|
35 |
assume "x \<sqsubseteq> y" |
|
36 |
then show "abs\<cdot>x \<sqsubseteq> abs\<cdot>y" by (rule monofun_cfun_arg) |
|
37 |
qed |
|
38 |
||
39 |
lemma rep_below: "(rep\<cdot>x \<sqsubseteq> rep\<cdot>y) = (x \<sqsubseteq> y)" |
|
40 |
by (rule iso.abs_below [OF swap]) |
|
41 |
||
42 |
lemma abs_eq: "(abs\<cdot>x = abs\<cdot>y) = (x = y)" |
|
43 |
by (simp add: po_eq_conv abs_below) |
|
44 |
||
45 |
lemma rep_eq: "(rep\<cdot>x = rep\<cdot>y) = (x = y)" |
|
46 |
by (rule iso.abs_eq [OF swap]) |
|
47 |
||
48 |
lemma abs_strict: "abs\<cdot>\<bottom> = \<bottom>" |
|
49 |
proof - |
|
50 |
have "\<bottom> \<sqsubseteq> rep\<cdot>\<bottom>" .. |
|
51 |
then have "abs\<cdot>\<bottom> \<sqsubseteq> abs\<cdot>(rep\<cdot>\<bottom>)" by (rule monofun_cfun_arg) |
|
52 |
then have "abs\<cdot>\<bottom> \<sqsubseteq> \<bottom>" by simp |
|
53 |
then show ?thesis by (rule bottomI) |
|
54 |
qed |
|
55 |
||
56 |
lemma rep_strict: "rep\<cdot>\<bottom> = \<bottom>" |
|
57 |
by (rule iso.abs_strict [OF swap]) |
|
58 |
||
59 |
lemma abs_defin': "abs\<cdot>x = \<bottom> \<Longrightarrow> x = \<bottom>" |
|
60 |
proof - |
|
61 |
have "x = rep\<cdot>(abs\<cdot>x)" by simp |
|
62 |
also assume "abs\<cdot>x = \<bottom>" |
|
63 |
also note rep_strict |
|
64 |
finally show "x = \<bottom>" . |
|
65 |
qed |
|
66 |
||
67 |
lemma rep_defin': "rep\<cdot>z = \<bottom> \<Longrightarrow> z = \<bottom>" |
|
68 |
by (rule iso.abs_defin' [OF swap]) |
|
69 |
||
70 |
lemma abs_defined: "z \<noteq> \<bottom> \<Longrightarrow> abs\<cdot>z \<noteq> \<bottom>" |
|
71 |
by (erule contrapos_nn, erule abs_defin') |
|
72 |
||
73 |
lemma rep_defined: "z \<noteq> \<bottom> \<Longrightarrow> rep\<cdot>z \<noteq> \<bottom>" |
|
74 |
by (rule iso.abs_defined [OF iso.swap]) (rule iso_axioms) |
|
75 |
||
76 |
lemma abs_bottom_iff: "(abs\<cdot>x = \<bottom>) = (x = \<bottom>)" |
|
77 |
by (auto elim: abs_defin' intro: abs_strict) |
|
78 |
||
79 |
lemma rep_bottom_iff: "(rep\<cdot>x = \<bottom>) = (x = \<bottom>)" |
|
80 |
by (rule iso.abs_bottom_iff [OF iso.swap]) (rule iso_axioms) |
|
81 |
||
82 |
lemma casedist_rule: "rep\<cdot>x = \<bottom> \<or> P \<Longrightarrow> x = \<bottom> \<or> P" |
|
83 |
by (simp add: rep_bottom_iff) |
|
84 |
||
85 |
lemma compact_abs_rev: "compact (abs\<cdot>x) \<Longrightarrow> compact x" |
|
86 |
proof (unfold compact_def) |
|
87 |
assume "adm (\<lambda>y. abs\<cdot>x \<notsqsubseteq> y)" |
|
88 |
with cont_Rep_cfun2 |
|
89 |
have "adm (\<lambda>y. abs\<cdot>x \<notsqsubseteq> abs\<cdot>y)" by (rule adm_subst) |
|
90 |
then show "adm (\<lambda>y. x \<notsqsubseteq> y)" using abs_below by simp |
|
91 |
qed |
|
92 |
||
93 |
lemma compact_rep_rev: "compact (rep\<cdot>x) \<Longrightarrow> compact x" |
|
94 |
by (rule iso.compact_abs_rev [OF iso.swap]) (rule iso_axioms) |
|
95 |
||
96 |
lemma compact_abs: "compact x \<Longrightarrow> compact (abs\<cdot>x)" |
|
97 |
by (rule compact_rep_rev) simp |
|
98 |
||
99 |
lemma compact_rep: "compact x \<Longrightarrow> compact (rep\<cdot>x)" |
|
100 |
by (rule iso.compact_abs [OF iso.swap]) (rule iso_axioms) |
|
101 |
||
102 |
lemma iso_swap: "(x = abs\<cdot>y) = (rep\<cdot>x = y)" |
|
103 |
proof |
|
104 |
assume "x = abs\<cdot>y" |
|
105 |
then have "rep\<cdot>x = rep\<cdot>(abs\<cdot>y)" by simp |
|
106 |
then show "rep\<cdot>x = y" by simp |
|
107 |
next |
|
108 |
assume "rep\<cdot>x = y" |
|
109 |
then have "abs\<cdot>(rep\<cdot>x) = abs\<cdot>y" by simp |
|
110 |
then show "x = abs\<cdot>y" by simp |
|
111 |
qed |
|
112 |
||
113 |
end |
|
114 |
||
115 |
subsection \<open>Proofs about take functions\<close> |
|
116 |
||
117 |
text \<open> |
|
118 |
This section contains lemmas that are used in a module that supports |
|
119 |
the domain isomorphism package; the module contains proofs related |
|
120 |
to take functions and the finiteness predicate. |
|
121 |
\<close> |
|
122 |
||
123 |
lemma deflation_abs_rep: |
|
124 |
fixes abs and rep and d |
|
125 |
assumes abs_iso: "\<And>x. rep\<cdot>(abs\<cdot>x) = x" |
|
126 |
assumes rep_iso: "\<And>y. abs\<cdot>(rep\<cdot>y) = y" |
|
127 |
shows "deflation d \<Longrightarrow> deflation (abs oo d oo rep)" |
|
128 |
by (rule ep_pair.deflation_e_d_p) (simp add: ep_pair.intro assms) |
|
129 |
||
130 |
lemma deflation_chain_min: |
|
131 |
assumes chain: "chain d" |
|
132 |
assumes defl: "\<And>n. deflation (d n)" |
|
133 |
shows "d m\<cdot>(d n\<cdot>x) = d (min m n)\<cdot>x" |
|
134 |
proof (rule linorder_le_cases) |
|
135 |
assume "m \<le> n" |
|
136 |
with chain have "d m \<sqsubseteq> d n" by (rule chain_mono) |
|
137 |
then have "d m\<cdot>(d n\<cdot>x) = d m\<cdot>x" |
|
138 |
by (rule deflation_below_comp1 [OF defl defl]) |
|
139 |
moreover from \<open>m \<le> n\<close> have "min m n = m" by simp |
|
140 |
ultimately show ?thesis by simp |
|
141 |
next |
|
142 |
assume "n \<le> m" |
|
143 |
with chain have "d n \<sqsubseteq> d m" by (rule chain_mono) |
|
144 |
then have "d m\<cdot>(d n\<cdot>x) = d n\<cdot>x" |
|
145 |
by (rule deflation_below_comp2 [OF defl defl]) |
|
146 |
moreover from \<open>n \<le> m\<close> have "min m n = n" by simp |
|
147 |
ultimately show ?thesis by simp |
|
148 |
qed |
|
149 |
||
150 |
lemma lub_ID_take_lemma: |
|
151 |
assumes "chain t" and "(\<Squnion>n. t n) = ID" |
|
152 |
assumes "\<And>n. t n\<cdot>x = t n\<cdot>y" shows "x = y" |
|
153 |
proof - |
|
154 |
have "(\<Squnion>n. t n\<cdot>x) = (\<Squnion>n. t n\<cdot>y)" |
|
155 |
using assms(3) by simp |
|
156 |
then have "(\<Squnion>n. t n)\<cdot>x = (\<Squnion>n. t n)\<cdot>y" |
|
157 |
using assms(1) by (simp add: lub_distribs) |
|
158 |
then show "x = y" |
|
159 |
using assms(2) by simp |
|
160 |
qed |
|
161 |
||
162 |
lemma lub_ID_reach: |
|
163 |
assumes "chain t" and "(\<Squnion>n. t n) = ID" |
|
164 |
shows "(\<Squnion>n. t n\<cdot>x) = x" |
|
165 |
using assms by (simp add: lub_distribs) |
|
166 |
||
167 |
lemma lub_ID_take_induct: |
|
168 |
assumes "chain t" and "(\<Squnion>n. t n) = ID" |
|
169 |
assumes "adm P" and "\<And>n. P (t n\<cdot>x)" shows "P x" |
|
170 |
proof - |
|
171 |
from \<open>chain t\<close> have "chain (\<lambda>n. t n\<cdot>x)" by simp |
|
172 |
from \<open>adm P\<close> this \<open>\<And>n. P (t n\<cdot>x)\<close> have "P (\<Squnion>n. t n\<cdot>x)" by (rule admD) |
|
173 |
with \<open>chain t\<close> \<open>(\<Squnion>n. t n) = ID\<close> show "P x" by (simp add: lub_distribs) |
|
174 |
qed |
|
175 |
||
176 |
subsection \<open>Finiteness\<close> |
|
177 |
||
178 |
text \<open> |
|
179 |
Let a ``decisive'' function be a deflation that maps every input to |
|
180 |
either itself or bottom. Then if a domain's take functions are all |
|
181 |
decisive, then all values in the domain are finite. |
|
182 |
\<close> |
|
183 |
||
184 |
definition |
|
185 |
decisive :: "('a::pcpo \<rightarrow> 'a) \<Rightarrow> bool" |
|
186 |
where |
|
187 |
"decisive d \<longleftrightarrow> (\<forall>x. d\<cdot>x = x \<or> d\<cdot>x = \<bottom>)" |
|
188 |
||
189 |
lemma decisiveI: "(\<And>x. d\<cdot>x = x \<or> d\<cdot>x = \<bottom>) \<Longrightarrow> decisive d" |
|
190 |
unfolding decisive_def by simp |
|
191 |
||
192 |
lemma decisive_cases: |
|
193 |
assumes "decisive d" obtains "d\<cdot>x = x" | "d\<cdot>x = \<bottom>" |
|
194 |
using assms unfolding decisive_def by auto |
|
195 |
||
196 |
lemma decisive_bottom: "decisive \<bottom>" |
|
197 |
unfolding decisive_def by simp |
|
198 |
||
199 |
lemma decisive_ID: "decisive ID" |
|
200 |
unfolding decisive_def by simp |
|
201 |
||
202 |
lemma decisive_ssum_map: |
|
203 |
assumes f: "decisive f" |
|
204 |
assumes g: "decisive g" |
|
205 |
shows "decisive (ssum_map\<cdot>f\<cdot>g)" |
|
206 |
apply (rule decisiveI) |
|
207 |
subgoal for s |
|
208 |
apply (cases s, simp_all) |
|
209 |
apply (rule_tac x=x in decisive_cases [OF f], simp_all) |
|
210 |
apply (rule_tac x=y in decisive_cases [OF g], simp_all) |
|
211 |
done |
|
212 |
done |
|
213 |
||
214 |
lemma decisive_sprod_map: |
|
215 |
assumes f: "decisive f" |
|
216 |
assumes g: "decisive g" |
|
217 |
shows "decisive (sprod_map\<cdot>f\<cdot>g)" |
|
218 |
apply (rule decisiveI) |
|
219 |
subgoal for s |
|
220 |
apply (cases s, simp) |
|
221 |
subgoal for x y |
|
222 |
apply (rule decisive_cases [OF f, where x = x], simp_all) |
|
223 |
apply (rule decisive_cases [OF g, where x = y], simp_all) |
|
224 |
done |
|
225 |
done |
|
226 |
done |
|
227 |
||
228 |
lemma decisive_abs_rep: |
|
229 |
fixes abs rep |
|
230 |
assumes iso: "iso abs rep" |
|
231 |
assumes d: "decisive d" |
|
232 |
shows "decisive (abs oo d oo rep)" |
|
233 |
apply (rule decisiveI) |
|
234 |
subgoal for s |
|
235 |
apply (rule decisive_cases [OF d, where x="rep\<cdot>s"]) |
|
236 |
apply (simp add: iso.rep_iso [OF iso]) |
|
237 |
apply (simp add: iso.abs_strict [OF iso]) |
|
238 |
done |
|
239 |
done |
|
240 |
||
241 |
lemma lub_ID_finite: |
|
242 |
assumes chain: "chain d" |
|
243 |
assumes lub: "(\<Squnion>n. d n) = ID" |
|
244 |
assumes decisive: "\<And>n. decisive (d n)" |
|
245 |
shows "\<exists>n. d n\<cdot>x = x" |
|
246 |
proof - |
|
247 |
have 1: "chain (\<lambda>n. d n\<cdot>x)" using chain by simp |
|
248 |
have 2: "(\<Squnion>n. d n\<cdot>x) = x" using chain lub by (rule lub_ID_reach) |
|
249 |
have "\<forall>n. d n\<cdot>x = x \<or> d n\<cdot>x = \<bottom>" |
|
250 |
using decisive unfolding decisive_def by simp |
|
251 |
hence "range (\<lambda>n. d n\<cdot>x) \<subseteq> {x, \<bottom>}" |
|
252 |
by auto |
|
253 |
hence "finite (range (\<lambda>n. d n\<cdot>x))" |
|
254 |
by (rule finite_subset, simp) |
|
255 |
with 1 have "finite_chain (\<lambda>n. d n\<cdot>x)" |
|
256 |
by (rule finite_range_imp_finch) |
|
257 |
then have "\<exists>n. (\<Squnion>n. d n\<cdot>x) = d n\<cdot>x" |
|
258 |
unfolding finite_chain_def by (auto simp add: maxinch_is_thelub) |
|
259 |
with 2 show "\<exists>n. d n\<cdot>x = x" by (auto elim: sym) |
|
260 |
qed |
|
261 |
||
262 |
lemma lub_ID_finite_take_induct: |
|
263 |
assumes "chain d" and "(\<Squnion>n. d n) = ID" and "\<And>n. decisive (d n)" |
|
264 |
shows "(\<And>n. P (d n\<cdot>x)) \<Longrightarrow> P x" |
|
265 |
using lub_ID_finite [OF assms] by metis |
|
266 |
||
267 |
subsection \<open>Proofs about constructor functions\<close> |
|
268 |
||
269 |
text \<open>Lemmas for proving nchotomy rule:\<close> |
|
270 |
||
271 |
lemma ex_one_bottom_iff: |
|
272 |
"(\<exists>x. P x \<and> x \<noteq> \<bottom>) = P ONE" |
|
273 |
by simp |
|
274 |
||
275 |
lemma ex_up_bottom_iff: |
|
276 |
"(\<exists>x. P x \<and> x \<noteq> \<bottom>) = (\<exists>x. P (up\<cdot>x))" |
|
277 |
by (safe, case_tac x, auto) |
|
278 |
||
279 |
lemma ex_sprod_bottom_iff: |
|
280 |
"(\<exists>y. P y \<and> y \<noteq> \<bottom>) = |
|
281 |
(\<exists>x y. (P (:x, y:) \<and> x \<noteq> \<bottom>) \<and> y \<noteq> \<bottom>)" |
|
282 |
by (safe, case_tac y, auto) |
|
283 |
||
284 |
lemma ex_sprod_up_bottom_iff: |
|
285 |
"(\<exists>y. P y \<and> y \<noteq> \<bottom>) = |
|
286 |
(\<exists>x y. P (:up\<cdot>x, y:) \<and> y \<noteq> \<bottom>)" |
|
287 |
by (safe, case_tac y, simp, case_tac x, auto) |
|
288 |
||
289 |
lemma ex_ssum_bottom_iff: |
|
290 |
"(\<exists>x. P x \<and> x \<noteq> \<bottom>) = |
|
291 |
((\<exists>x. P (sinl\<cdot>x) \<and> x \<noteq> \<bottom>) \<or> |
|
292 |
(\<exists>x. P (sinr\<cdot>x) \<and> x \<noteq> \<bottom>))" |
|
293 |
by (safe, case_tac x, auto) |
|
294 |
||
295 |
lemma exh_start: "p = \<bottom> \<or> (\<exists>x. p = x \<and> x \<noteq> \<bottom>)" |
|
296 |
by auto |
|
297 |
||
298 |
lemmas ex_bottom_iffs = |
|
299 |
ex_ssum_bottom_iff |
|
300 |
ex_sprod_up_bottom_iff |
|
301 |
ex_sprod_bottom_iff |
|
302 |
ex_up_bottom_iff |
|
303 |
ex_one_bottom_iff |
|
304 |
||
305 |
text \<open>Rules for turning nchotomy into exhaust:\<close> |
|
306 |
||
307 |
lemma exh_casedist0: "\<lbrakk>R; R \<Longrightarrow> P\<rbrakk> \<Longrightarrow> P" (* like make_elim *) |
|
308 |
by auto |
|
309 |
||
310 |
lemma exh_casedist1: "((P \<or> Q \<Longrightarrow> R) \<Longrightarrow> S) \<equiv> (\<lbrakk>P \<Longrightarrow> R; Q \<Longrightarrow> R\<rbrakk> \<Longrightarrow> S)" |
|
311 |
by rule auto |
|
312 |
||
313 |
lemma exh_casedist2: "(\<exists>x. P x \<Longrightarrow> Q) \<equiv> (\<And>x. P x \<Longrightarrow> Q)" |
|
314 |
by rule auto |
|
315 |
||
316 |
lemma exh_casedist3: "(P \<and> Q \<Longrightarrow> R) \<equiv> (P \<Longrightarrow> Q \<Longrightarrow> R)" |
|
317 |
by rule auto |
|
318 |
||
319 |
lemmas exh_casedists = exh_casedist1 exh_casedist2 exh_casedist3 |
|
320 |
||
321 |
text \<open>Rules for proving constructor properties\<close> |
|
322 |
||
323 |
lemmas con_strict_rules = |
|
324 |
sinl_strict sinr_strict spair_strict1 spair_strict2 |
|
325 |
||
326 |
lemmas con_bottom_iff_rules = |
|
327 |
sinl_bottom_iff sinr_bottom_iff spair_bottom_iff up_defined ONE_defined |
|
328 |
||
329 |
lemmas con_below_iff_rules = |
|
330 |
sinl_below sinr_below sinl_below_sinr sinr_below_sinl con_bottom_iff_rules |
|
331 |
||
332 |
lemmas con_eq_iff_rules = |
|
333 |
sinl_eq sinr_eq sinl_eq_sinr sinr_eq_sinl con_bottom_iff_rules |
|
334 |
||
335 |
lemmas sel_strict_rules = |
|
336 |
cfcomp2 sscase1 sfst_strict ssnd_strict fup1 |
|
337 |
||
338 |
lemma sel_app_extra_rules: |
|
339 |
"sscase\<cdot>ID\<cdot>\<bottom>\<cdot>(sinr\<cdot>x) = \<bottom>" |
|
340 |
"sscase\<cdot>ID\<cdot>\<bottom>\<cdot>(sinl\<cdot>x) = x" |
|
341 |
"sscase\<cdot>\<bottom>\<cdot>ID\<cdot>(sinl\<cdot>x) = \<bottom>" |
|
342 |
"sscase\<cdot>\<bottom>\<cdot>ID\<cdot>(sinr\<cdot>x) = x" |
|
343 |
"fup\<cdot>ID\<cdot>(up\<cdot>x) = x" |
|
344 |
by (cases "x = \<bottom>", simp, simp)+ |
|
345 |
||
346 |
lemmas sel_app_rules = |
|
347 |
sel_strict_rules sel_app_extra_rules |
|
348 |
ssnd_spair sfst_spair up_defined spair_defined |
|
349 |
||
350 |
lemmas sel_bottom_iff_rules = |
|
351 |
cfcomp2 sfst_bottom_iff ssnd_bottom_iff |
|
352 |
||
353 |
lemmas take_con_rules = |
|
354 |
ssum_map_sinl' ssum_map_sinr' sprod_map_spair' u_map_up |
|
355 |
deflation_strict deflation_ID ID1 cfcomp2 |
|
356 |
||
357 |
subsection \<open>ML setup\<close> |
|
358 |
||
359 |
named_theorems domain_deflation "theorems like deflation a ==> deflation (foo_map$a)" |
|
360 |
and domain_map_ID "theorems like foo_map$ID = ID" |
|
361 |
||
362 |
ML_file \<open>Tools/Domain/domain_take_proofs.ML\<close> |
|
363 |
ML_file \<open>Tools/cont_consts.ML\<close> |
|
364 |
ML_file \<open>Tools/cont_proc.ML\<close> |
|
365 |
simproc_setup cont ("cont f") = \<open>K ContProc.cont_proc\<close> |
|
366 |
||
367 |
ML_file \<open>Tools/Domain/domain_constructors.ML\<close> |
|
368 |
ML_file \<open>Tools/Domain/domain_induction.ML\<close> |
|
369 |
||
40504 | 370 |
|
62175 | 371 |
subsection \<open>Representations of types\<close> |
40504 | 372 |
|
81573 | 373 |
default_sort "domain" |
374 |
||
40504 | 375 |
lemma emb_prj: "emb\<cdot>((prj\<cdot>x)::'a) = cast\<cdot>DEFL('a)\<cdot>x" |
376 |
by (simp add: cast_DEFL) |
|
377 |
||
378 |
lemma emb_prj_emb: |
|
379 |
fixes x :: "'a" |
|
380 |
assumes "DEFL('a) \<sqsubseteq> DEFL('b)" |
|
381 |
shows "emb\<cdot>(prj\<cdot>(emb\<cdot>x) :: 'b) = emb\<cdot>x" |
|
382 |
unfolding emb_prj |
|
383 |
apply (rule cast.belowD) |
|
384 |
apply (rule monofun_cfun_arg [OF assms]) |
|
385 |
apply (simp add: cast_DEFL) |
|
386 |
done |
|
387 |
||
388 |
lemma prj_emb_prj: |
|
389 |
assumes "DEFL('a) \<sqsubseteq> DEFL('b)" |
|
390 |
shows "prj\<cdot>(emb\<cdot>(prj\<cdot>x :: 'b)) = (prj\<cdot>x :: 'a)" |
|
391 |
apply (rule emb_eq_iff [THEN iffD1]) |
|
392 |
apply (simp only: emb_prj) |
|
393 |
apply (rule deflation_below_comp1) |
|
394 |
apply (rule deflation_cast) |
|
395 |
apply (rule deflation_cast) |
|
396 |
apply (rule monofun_cfun_arg [OF assms]) |
|
397 |
done |
|
398 |
||
62175 | 399 |
text \<open>Isomorphism lemmas used internally by the domain package:\<close> |
40504 | 400 |
|
401 |
lemma domain_abs_iso: |
|
402 |
fixes abs and rep |
|
403 |
assumes DEFL: "DEFL('b) = DEFL('a)" |
|
404 |
assumes abs_def: "(abs :: 'a \<rightarrow> 'b) \<equiv> prj oo emb" |
|
405 |
assumes rep_def: "(rep :: 'b \<rightarrow> 'a) \<equiv> prj oo emb" |
|
406 |
shows "rep\<cdot>(abs\<cdot>x) = x" |
|
407 |
unfolding abs_def rep_def |
|
408 |
by (simp add: emb_prj_emb DEFL) |
|
409 |
||
410 |
lemma domain_rep_iso: |
|
411 |
fixes abs and rep |
|
412 |
assumes DEFL: "DEFL('b) = DEFL('a)" |
|
413 |
assumes abs_def: "(abs :: 'a \<rightarrow> 'b) \<equiv> prj oo emb" |
|
414 |
assumes rep_def: "(rep :: 'b \<rightarrow> 'a) \<equiv> prj oo emb" |
|
415 |
shows "abs\<cdot>(rep\<cdot>x) = x" |
|
416 |
unfolding abs_def rep_def |
|
417 |
by (simp add: emb_prj_emb DEFL) |
|
418 |
||
62175 | 419 |
subsection \<open>Deflations as sets\<close> |
40504 | 420 |
|
41287
029a6fc1bfb8
type 'defl' takes a type parameter again (cf. b525988432e9)
huffman
parents:
41285
diff
changeset
|
421 |
definition defl_set :: "'a::bifinite defl \<Rightarrow> 'a set" |
40504 | 422 |
where "defl_set A = {x. cast\<cdot>A\<cdot>x = x}" |
423 |
||
424 |
lemma adm_defl_set: "adm (\<lambda>x. x \<in> defl_set A)" |
|
425 |
unfolding defl_set_def by simp |
|
426 |
||
427 |
lemma defl_set_bottom: "\<bottom> \<in> defl_set A" |
|
428 |
unfolding defl_set_def by simp |
|
429 |
||
430 |
lemma defl_set_cast [simp]: "cast\<cdot>A\<cdot>x \<in> defl_set A" |
|
431 |
unfolding defl_set_def by simp |
|
432 |
||
433 |
lemma defl_set_subset_iff: "defl_set A \<subseteq> defl_set B \<longleftrightarrow> A \<sqsubseteq> B" |
|
434 |
apply (simp add: defl_set_def subset_eq cast_below_cast [symmetric]) |
|
435 |
apply (auto simp add: cast.belowI cast.belowD) |
|
436 |
done |
|
437 |
||
62175 | 438 |
subsection \<open>Proving a subtype is representable\<close> |
40504 | 439 |
|
62175 | 440 |
text \<open>Temporarily relax type constraints.\<close> |
40504 | 441 |
|
62175 | 442 |
setup \<open> |
40504 | 443 |
fold Sign.add_const_constraint |
69597 | 444 |
[ (\<^const_name>\<open>defl\<close>, SOME \<^typ>\<open>'a::pcpo itself \<Rightarrow> udom defl\<close>) |
445 |
, (\<^const_name>\<open>emb\<close>, SOME \<^typ>\<open>'a::pcpo \<rightarrow> udom\<close>) |
|
446 |
, (\<^const_name>\<open>prj\<close>, SOME \<^typ>\<open>udom \<rightarrow> 'a::pcpo\<close>) |
|
447 |
, (\<^const_name>\<open>liftdefl\<close>, SOME \<^typ>\<open>'a::pcpo itself \<Rightarrow> udom u defl\<close>) |
|
448 |
, (\<^const_name>\<open>liftemb\<close>, SOME \<^typ>\<open>'a::pcpo u \<rightarrow> udom u\<close>) |
|
449 |
, (\<^const_name>\<open>liftprj\<close>, SOME \<^typ>\<open>udom u \<rightarrow> 'a::pcpo u\<close>) ] |
|
62175 | 450 |
\<close> |
40504 | 451 |
|
41292
2b7bc8d9fd6e
use deflations over type 'udom u' to represent predomains;
huffman
parents:
41290
diff
changeset
|
452 |
lemma typedef_domain_class: |
40504 | 453 |
fixes Rep :: "'a::pcpo \<Rightarrow> udom" |
454 |
fixes Abs :: "udom \<Rightarrow> 'a::pcpo" |
|
41287
029a6fc1bfb8
type 'defl' takes a type parameter again (cf. b525988432e9)
huffman
parents:
41285
diff
changeset
|
455 |
fixes t :: "udom defl" |
40504 | 456 |
assumes type: "type_definition Rep Abs (defl_set t)" |
67399 | 457 |
assumes below: "(\<sqsubseteq>) \<equiv> \<lambda>x y. Rep x \<sqsubseteq> Rep y" |
40504 | 458 |
assumes emb: "emb \<equiv> (\<Lambda> x. Rep x)" |
459 |
assumes prj: "prj \<equiv> (\<Lambda> x. Abs (cast\<cdot>t\<cdot>x))" |
|
460 |
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
|
461 |
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
|
462 |
assumes liftprj: "(liftprj :: udom u \<rightarrow> 'a u) \<equiv> u_map\<cdot>prj" |
41436 | 463 |
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
|
464 |
shows "OFCLASS('a, domain_class)" |
2b7bc8d9fd6e
use deflations over type 'udom u' to represent predomains;
huffman
parents:
41290
diff
changeset
|
465 |
proof |
40504 | 466 |
have emb_beta: "\<And>x. emb\<cdot>x = Rep x" |
467 |
unfolding emb |
|
468 |
apply (rule beta_cfun) |
|
40834
a1249aeff5b6
change cpodef-generated cont_Rep rules to cont2cont format
huffman
parents:
40830
diff
changeset
|
469 |
apply (rule typedef_cont_Rep [OF type below adm_defl_set cont_id]) |
40504 | 470 |
done |
471 |
have prj_beta: "\<And>y. prj\<cdot>y = Abs (cast\<cdot>t\<cdot>y)" |
|
472 |
unfolding prj |
|
473 |
apply (rule beta_cfun) |
|
474 |
apply (rule typedef_cont_Abs [OF type below adm_defl_set]) |
|
475 |
apply simp_all |
|
476 |
done |
|
477 |
have prj_emb: "\<And>x::'a. prj\<cdot>(emb\<cdot>x) = x" |
|
478 |
using type_definition.Rep [OF type] |
|
479 |
unfolding prj_beta emb_beta defl_set_def |
|
480 |
by (simp add: type_definition.Rep_inverse [OF type]) |
|
481 |
have emb_prj: "\<And>y. emb\<cdot>(prj\<cdot>y :: 'a) = cast\<cdot>t\<cdot>y" |
|
482 |
unfolding prj_beta emb_beta |
|
483 |
by (simp add: type_definition.Abs_inverse [OF type]) |
|
484 |
show "ep_pair (emb :: 'a \<rightarrow> udom) prj" |
|
61169 | 485 |
apply standard |
40504 | 486 |
apply (simp add: prj_emb) |
487 |
apply (simp add: emb_prj cast.below) |
|
488 |
done |
|
489 |
show "cast\<cdot>DEFL('a) = emb oo (prj :: udom \<rightarrow> 'a)" |
|
490 |
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
|
491 |
qed (simp_all only: liftemb liftprj liftdefl) |
40504 | 492 |
|
493 |
lemma typedef_DEFL: |
|
494 |
assumes "defl \<equiv> (\<lambda>a::'a::pcpo itself. t)" |
|
495 |
shows "DEFL('a::pcpo) = t" |
|
496 |
unfolding assms .. |
|
497 |
||
62175 | 498 |
text \<open>Restore original typing constraints.\<close> |
40504 | 499 |
|
62175 | 500 |
setup \<open> |
40504 | 501 |
fold Sign.add_const_constraint |
69597 | 502 |
[(\<^const_name>\<open>defl\<close>, SOME \<^typ>\<open>'a::domain itself \<Rightarrow> udom defl\<close>), |
503 |
(\<^const_name>\<open>emb\<close>, SOME \<^typ>\<open>'a::domain \<rightarrow> udom\<close>), |
|
504 |
(\<^const_name>\<open>prj\<close>, SOME \<^typ>\<open>udom \<rightarrow> 'a::domain\<close>), |
|
505 |
(\<^const_name>\<open>liftdefl\<close>, SOME \<^typ>\<open>'a::predomain itself \<Rightarrow> udom u defl\<close>), |
|
506 |
(\<^const_name>\<open>liftemb\<close>, SOME \<^typ>\<open>'a::predomain u \<rightarrow> udom u\<close>), |
|
507 |
(\<^const_name>\<open>liftprj\<close>, SOME \<^typ>\<open>udom u \<rightarrow> 'a::predomain u\<close>)] |
|
62175 | 508 |
\<close> |
40504 | 509 |
|
69605 | 510 |
ML_file \<open>Tools/domaindef.ML\<close> |
40504 | 511 |
|
62175 | 512 |
subsection \<open>Isomorphic deflations\<close> |
40504 | 513 |
|
41292
2b7bc8d9fd6e
use deflations over type 'udom u' to represent predomains;
huffman
parents:
41290
diff
changeset
|
514 |
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
|
515 |
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
|
516 |
|
2b7bc8d9fd6e
use deflations over type 'udom u' to represent predomains;
huffman
parents:
41290
diff
changeset
|
517 |
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
|
518 |
where "isodefl' d t \<longleftrightarrow> cast\<cdot>t = liftemb oo u_map\<cdot>d oo liftprj" |
40504 | 519 |
|
520 |
lemma isodeflI: "(\<And>x. cast\<cdot>t\<cdot>x = emb\<cdot>(d\<cdot>(prj\<cdot>x))) \<Longrightarrow> isodefl d t" |
|
521 |
unfolding isodefl_def by (simp add: cfun_eqI) |
|
522 |
||
523 |
lemma cast_isodefl: "isodefl d t \<Longrightarrow> cast\<cdot>t = (\<Lambda> x. emb\<cdot>(d\<cdot>(prj\<cdot>x)))" |
|
524 |
unfolding isodefl_def by (simp add: cfun_eqI) |
|
525 |
||
526 |
lemma isodefl_strict: "isodefl d t \<Longrightarrow> d\<cdot>\<bottom> = \<bottom>" |
|
527 |
unfolding isodefl_def |
|
528 |
by (drule cfun_fun_cong [where x="\<bottom>"], simp) |
|
529 |
||
530 |
lemma isodefl_imp_deflation: |
|
531 |
fixes d :: "'a \<rightarrow> 'a" |
|
532 |
assumes "isodefl d t" shows "deflation d" |
|
533 |
proof |
|
534 |
note assms [unfolded isodefl_def, simp] |
|
535 |
fix x :: 'a |
|
536 |
show "d\<cdot>(d\<cdot>x) = d\<cdot>x" |
|
537 |
using cast.idem [of t "emb\<cdot>x"] by simp |
|
538 |
show "d\<cdot>x \<sqsubseteq> x" |
|
539 |
using cast.below [of t "emb\<cdot>x"] by simp |
|
540 |
qed |
|
541 |
||
542 |
lemma isodefl_ID_DEFL: "isodefl (ID :: 'a \<rightarrow> 'a) DEFL('a)" |
|
543 |
unfolding isodefl_def by (simp add: cast_DEFL) |
|
544 |
||
545 |
lemma isodefl_LIFTDEFL: |
|
41292
2b7bc8d9fd6e
use deflations over type 'udom u' to represent predomains;
huffman
parents:
41290
diff
changeset
|
546 |
"isodefl' (ID :: 'a \<rightarrow> 'a) LIFTDEFL('a::predomain)" |
2b7bc8d9fd6e
use deflations over type 'udom u' to represent predomains;
huffman
parents:
41290
diff
changeset
|
547 |
unfolding isodefl'_def by (simp add: cast_liftdefl u_map_ID) |
40504 | 548 |
|
549 |
lemma isodefl_DEFL_imp_ID: "isodefl (d :: 'a \<rightarrow> 'a) DEFL('a) \<Longrightarrow> d = ID" |
|
550 |
unfolding isodefl_def |
|
551 |
apply (simp add: cast_DEFL) |
|
552 |
apply (simp add: cfun_eq_iff) |
|
553 |
apply (rule allI) |
|
554 |
apply (drule_tac x="emb\<cdot>x" in spec) |
|
555 |
apply simp |
|
556 |
done |
|
557 |
||
558 |
lemma isodefl_bottom: "isodefl \<bottom> \<bottom>" |
|
559 |
unfolding isodefl_def by (simp add: cfun_eq_iff) |
|
560 |
||
561 |
lemma adm_isodefl: |
|
562 |
"cont f \<Longrightarrow> cont g \<Longrightarrow> adm (\<lambda>x. isodefl (f x) (g x))" |
|
563 |
unfolding isodefl_def by simp |
|
564 |
||
565 |
lemma isodefl_lub: |
|
566 |
assumes "chain d" and "chain t" |
|
567 |
assumes "\<And>i. isodefl (d i) (t i)" |
|
568 |
shows "isodefl (\<Squnion>i. d i) (\<Squnion>i. t i)" |
|
41529 | 569 |
using assms unfolding isodefl_def |
40504 | 570 |
by (simp add: contlub_cfun_arg contlub_cfun_fun) |
571 |
||
572 |
lemma isodefl_fix: |
|
573 |
assumes "\<And>d t. isodefl d t \<Longrightarrow> isodefl (f\<cdot>d) (g\<cdot>t)" |
|
574 |
shows "isodefl (fix\<cdot>f) (fix\<cdot>g)" |
|
575 |
unfolding fix_def2 |
|
576 |
apply (rule isodefl_lub, simp, simp) |
|
577 |
apply (induct_tac i) |
|
578 |
apply (simp add: isodefl_bottom) |
|
579 |
apply (simp add: assms) |
|
580 |
done |
|
581 |
||
582 |
lemma isodefl_abs_rep: |
|
583 |
fixes abs and rep and d |
|
584 |
assumes DEFL: "DEFL('b) = DEFL('a)" |
|
585 |
assumes abs_def: "(abs :: 'a \<rightarrow> 'b) \<equiv> prj oo emb" |
|
586 |
assumes rep_def: "(rep :: 'b \<rightarrow> 'a) \<equiv> prj oo emb" |
|
587 |
shows "isodefl d t \<Longrightarrow> isodefl (abs oo d oo rep) t" |
|
588 |
unfolding isodefl_def |
|
589 |
by (simp add: cfun_eq_iff assms prj_emb_prj emb_prj_emb) |
|
590 |
||
41436 | 591 |
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
|
592 |
unfolding isodefl_def isodefl'_def |
41436 | 593 |
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
|
594 |
|
40592
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents:
40575
diff
changeset
|
595 |
lemma isodefl_sfun: |
40504 | 596 |
"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
|
597 |
isodefl (sfun_map\<cdot>d1\<cdot>d2) (sfun_defl\<cdot>t1\<cdot>t2)" |
40504 | 598 |
apply (rule isodeflI) |
40592
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents:
40575
diff
changeset
|
599 |
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
|
600 |
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
|
601 |
apply (simp add: sfun_map_map isodefl_strict) |
40504 | 602 |
done |
603 |
||
604 |
lemma isodefl_ssum: |
|
605 |
"isodefl d1 t1 \<Longrightarrow> isodefl d2 t2 \<Longrightarrow> |
|
606 |
isodefl (ssum_map\<cdot>d1\<cdot>d2) (ssum_defl\<cdot>t1\<cdot>t2)" |
|
607 |
apply (rule isodeflI) |
|
608 |
apply (simp add: cast_ssum_defl cast_isodefl) |
|
609 |
apply (simp add: emb_ssum_def prj_ssum_def) |
|
610 |
apply (simp add: ssum_map_map isodefl_strict) |
|
611 |
done |
|
612 |
||
613 |
lemma isodefl_sprod: |
|
614 |
"isodefl d1 t1 \<Longrightarrow> isodefl d2 t2 \<Longrightarrow> |
|
615 |
isodefl (sprod_map\<cdot>d1\<cdot>d2) (sprod_defl\<cdot>t1\<cdot>t2)" |
|
616 |
apply (rule isodeflI) |
|
617 |
apply (simp add: cast_sprod_defl cast_isodefl) |
|
618 |
apply (simp add: emb_sprod_def prj_sprod_def) |
|
619 |
apply (simp add: sprod_map_map isodefl_strict) |
|
620 |
done |
|
621 |
||
41297 | 622 |
lemma isodefl_prod: |
40504 | 623 |
"isodefl d1 t1 \<Longrightarrow> isodefl d2 t2 \<Longrightarrow> |
41297 | 624 |
isodefl (prod_map\<cdot>d1\<cdot>d2) (prod_defl\<cdot>t1\<cdot>t2)" |
40504 | 625 |
apply (rule isodeflI) |
626 |
apply (simp add: cast_prod_defl cast_isodefl) |
|
627 |
apply (simp add: emb_prod_def prj_prod_def) |
|
41297 | 628 |
apply (simp add: prod_map_map cfcomp1) |
40504 | 629 |
done |
630 |
||
631 |
lemma isodefl_u: |
|
41437 | 632 |
"isodefl d t \<Longrightarrow> isodefl (u_map\<cdot>d) (u_defl\<cdot>t)" |
40504 | 633 |
apply (rule isodeflI) |
41437 | 634 |
apply (simp add: cast_u_defl cast_isodefl) |
635 |
apply (simp add: emb_u_def prj_u_def liftemb_eq liftprj_eq u_map_map) |
|
636 |
done |
|
637 |
||
638 |
lemma isodefl_u_liftdefl: |
|
639 |
"isodefl' d t \<Longrightarrow> isodefl (u_map\<cdot>d) (u_liftdefl\<cdot>t)" |
|
640 |
apply (rule isodeflI) |
|
641 |
apply (simp add: cast_u_liftdefl isodefl'_def) |
|
40504 | 642 |
apply (simp add: emb_u_def prj_u_def liftemb_eq liftprj_eq) |
643 |
done |
|
644 |
||
645 |
lemma encode_prod_u_map: |
|
41297 | 646 |
"encode_prod_u\<cdot>(u_map\<cdot>(prod_map\<cdot>f\<cdot>g)\<cdot>(decode_prod_u\<cdot>x)) |
40504 | 647 |
= sprod_map\<cdot>(u_map\<cdot>f)\<cdot>(u_map\<cdot>g)\<cdot>x" |
648 |
unfolding encode_prod_u_def decode_prod_u_def |
|
649 |
apply (case_tac x, simp, rename_tac a b) |
|
650 |
apply (case_tac a, simp, case_tac b, simp, simp) |
|
651 |
done |
|
652 |
||
41297 | 653 |
lemma isodefl_prod_u: |
41292
2b7bc8d9fd6e
use deflations over type 'udom u' to represent predomains;
huffman
parents:
41290
diff
changeset
|
654 |
assumes "isodefl' d1 t1" and "isodefl' d2 t2" |
41297 | 655 |
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
|
656 |
using assms unfolding isodefl'_def |
2b7bc8d9fd6e
use deflations over type 'udom u' to represent predomains;
huffman
parents:
41290
diff
changeset
|
657 |
unfolding liftemb_prod_def liftprj_prod_def |
2b7bc8d9fd6e
use deflations over type 'udom u' to represent predomains;
huffman
parents:
41290
diff
changeset
|
658 |
by (simp add: cast_prod_liftdefl cfcomp1 encode_prod_u_map sprod_map_map) |
40504 | 659 |
|
40592
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents:
40575
diff
changeset
|
660 |
lemma encode_cfun_map: |
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents:
40575
diff
changeset
|
661 |
"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
|
662 |
= 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
|
663 |
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
|
664 |
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
|
665 |
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
|
666 |
done |
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents:
40575
diff
changeset
|
667 |
|
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents:
40575
diff
changeset
|
668 |
lemma isodefl_cfun: |
40830 | 669 |
assumes "isodefl (u_map\<cdot>d1) t1" and "isodefl d2 t2" |
670 |
shows "isodefl (cfun_map\<cdot>d1\<cdot>d2) (sfun_defl\<cdot>t1\<cdot>t2)" |
|
671 |
using isodefl_sfun [OF assms] unfolding isodefl_def |
|
672 |
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
|
673 |
|
62175 | 674 |
subsection \<open>Setting up the domain package\<close> |
40504 | 675 |
|
57945
cacb00a569e0
prefer 'named_theorems' over Named_Thms, with subtle change of semantics due to visual order vs. internal reverse order;
wenzelm
parents:
48891
diff
changeset
|
676 |
named_theorems domain_defl_simps "theorems like DEFL('a t) = t_defl$DEFL('a)" |
59028 | 677 |
and domain_isodefl "theorems like isodefl d t ==> isodefl (foo_map$d) (foo_defl$t)" |
57945
cacb00a569e0
prefer 'named_theorems' over Named_Thms, with subtle change of semantics due to visual order vs. internal reverse order;
wenzelm
parents:
48891
diff
changeset
|
678 |
|
69605 | 679 |
ML_file \<open>Tools/Domain/domain_isomorphism.ML\<close> |
680 |
ML_file \<open>Tools/Domain/domain_axioms.ML\<close> |
|
681 |
ML_file \<open>Tools/Domain/domain.ML\<close> |
|
40504 | 682 |
|
683 |
lemmas [domain_defl_simps] = |
|
40592
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents:
40575
diff
changeset
|
684 |
DEFL_cfun DEFL_sfun DEFL_ssum DEFL_sprod DEFL_prod DEFL_u |
41437 | 685 |
liftdefl_eq LIFTDEFL_prod u_liftdefl_liftdefl_of |
40504 | 686 |
|
687 |
lemmas [domain_map_ID] = |
|
41297 | 688 |
cfun_map_ID sfun_map_ID ssum_map_ID sprod_map_ID prod_map_ID u_map_ID |
40504 | 689 |
|
690 |
lemmas [domain_isodefl] = |
|
40592
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents:
40575
diff
changeset
|
691 |
isodefl_u isodefl_sfun isodefl_ssum isodefl_sprod |
41436 | 692 |
isodefl_cfun isodefl_prod isodefl_prod_u isodefl'_liftdefl_of |
41437 | 693 |
isodefl_u_liftdefl |
40504 | 694 |
|
695 |
lemmas [domain_deflation] = |
|
40592
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents:
40575
diff
changeset
|
696 |
deflation_cfun_map deflation_sfun_map deflation_ssum_map |
41297 | 697 |
deflation_sprod_map deflation_prod_map deflation_u_map |
40504 | 698 |
|
62175 | 699 |
setup \<open> |
40737
2037021f034f
remove map function names from domain package theory data
huffman
parents:
40592
diff
changeset
|
700 |
fold Domain_Take_Proofs.add_rec_type |
68357 | 701 |
[(\<^type_name>\<open>cfun\<close>, [true, true]), |
702 |
(\<^type_name>\<open>sfun\<close>, [true, true]), |
|
703 |
(\<^type_name>\<open>ssum\<close>, [true, true]), |
|
704 |
(\<^type_name>\<open>sprod\<close>, [true, true]), |
|
705 |
(\<^type_name>\<open>prod\<close>, [true, true]), |
|
706 |
(\<^type_name>\<open>u\<close>, [true])] |
|
62175 | 707 |
\<close> |
40504 | 708 |
|
15741 | 709 |
end |