More porting to new locales.
1 (* Title: HOLCF/ConvexPD.thy
5 header {* Convex powerdomain *}
8 imports UpperPD LowerPD
11 subsection {* Basis preorder *}
14 convex_le :: "'a pd_basis \<Rightarrow> 'a pd_basis \<Rightarrow> bool" (infix "\<le>\<natural>" 50) where
15 "convex_le = (\<lambda>u v. u \<le>\<sharp> v \<and> u \<le>\<flat> v)"
17 lemma convex_le_refl [simp]: "t \<le>\<natural> t"
18 unfolding convex_le_def by (fast intro: upper_le_refl lower_le_refl)
20 lemma convex_le_trans: "\<lbrakk>t \<le>\<natural> u; u \<le>\<natural> v\<rbrakk> \<Longrightarrow> t \<le>\<natural> v"
21 unfolding convex_le_def by (fast intro: upper_le_trans lower_le_trans)
23 interpretation convex_le!: preorder convex_le
24 by (rule preorder.intro, rule convex_le_refl, rule convex_le_trans)
26 lemma upper_le_minimal [simp]: "PDUnit compact_bot \<le>\<natural> t"
27 unfolding convex_le_def Rep_PDUnit by simp
29 lemma PDUnit_convex_mono: "x \<sqsubseteq> y \<Longrightarrow> PDUnit x \<le>\<natural> PDUnit y"
30 unfolding convex_le_def by (fast intro: PDUnit_upper_mono PDUnit_lower_mono)
32 lemma PDPlus_convex_mono: "\<lbrakk>s \<le>\<natural> t; u \<le>\<natural> v\<rbrakk> \<Longrightarrow> PDPlus s u \<le>\<natural> PDPlus t v"
33 unfolding convex_le_def by (fast intro: PDPlus_upper_mono PDPlus_lower_mono)
35 lemma convex_le_PDUnit_PDUnit_iff [simp]:
36 "(PDUnit a \<le>\<natural> PDUnit b) = a \<sqsubseteq> b"
37 unfolding convex_le_def upper_le_def lower_le_def Rep_PDUnit by fast
39 lemma convex_le_PDUnit_lemma1:
40 "(PDUnit a \<le>\<natural> t) = (\<forall>b\<in>Rep_pd_basis t. a \<sqsubseteq> b)"
41 unfolding convex_le_def upper_le_def lower_le_def Rep_PDUnit
42 using Rep_pd_basis_nonempty [of t, folded ex_in_conv] by fast
44 lemma convex_le_PDUnit_PDPlus_iff [simp]:
45 "(PDUnit a \<le>\<natural> PDPlus t u) = (PDUnit a \<le>\<natural> t \<and> PDUnit a \<le>\<natural> u)"
46 unfolding convex_le_PDUnit_lemma1 Rep_PDPlus by fast
48 lemma convex_le_PDUnit_lemma2:
49 "(t \<le>\<natural> PDUnit b) = (\<forall>a\<in>Rep_pd_basis t. a \<sqsubseteq> b)"
50 unfolding convex_le_def upper_le_def lower_le_def Rep_PDUnit
51 using Rep_pd_basis_nonempty [of t, folded ex_in_conv] by fast
53 lemma convex_le_PDPlus_PDUnit_iff [simp]:
54 "(PDPlus t u \<le>\<natural> PDUnit a) = (t \<le>\<natural> PDUnit a \<and> u \<le>\<natural> PDUnit a)"
55 unfolding convex_le_PDUnit_lemma2 Rep_PDPlus by fast
57 lemma convex_le_PDPlus_lemma:
58 assumes z: "PDPlus t u \<le>\<natural> z"
59 shows "\<exists>v w. z = PDPlus v w \<and> t \<le>\<natural> v \<and> u \<le>\<natural> w"
60 proof (intro exI conjI)
61 let ?A = "{b\<in>Rep_pd_basis z. \<exists>a\<in>Rep_pd_basis t. a \<sqsubseteq> b}"
62 let ?B = "{b\<in>Rep_pd_basis z. \<exists>a\<in>Rep_pd_basis u. a \<sqsubseteq> b}"
63 let ?v = "Abs_pd_basis ?A"
64 let ?w = "Abs_pd_basis ?B"
65 have Rep_v: "Rep_pd_basis ?v = ?A"
66 apply (rule Abs_pd_basis_inverse)
67 apply (rule Rep_pd_basis_nonempty [of t, folded ex_in_conv, THEN exE])
68 apply (cut_tac z, simp only: convex_le_def lower_le_def, clarify)
69 apply (drule_tac x=x in bspec, simp add: Rep_PDPlus, erule bexE)
70 apply (simp add: pd_basis_def)
73 have Rep_w: "Rep_pd_basis ?w = ?B"
74 apply (rule Abs_pd_basis_inverse)
75 apply (rule Rep_pd_basis_nonempty [of u, folded ex_in_conv, THEN exE])
76 apply (cut_tac z, simp only: convex_le_def lower_le_def, clarify)
77 apply (drule_tac x=x in bspec, simp add: Rep_PDPlus, erule bexE)
78 apply (simp add: pd_basis_def)
81 show "z = PDPlus ?v ?w"
83 apply (simp add: convex_le_def, erule conjE)
84 apply (simp add: Rep_pd_basis_inject [symmetric] Rep_PDPlus)
85 apply (simp add: Rep_v Rep_w)
86 apply (rule equalityI)
88 apply (simp only: upper_le_def)
89 apply (drule (1) bspec, erule bexE)
90 apply (simp add: Rep_PDPlus)
94 show "t \<le>\<natural> ?v" "u \<le>\<natural> ?w"
96 apply (simp_all add: convex_le_def upper_le_def lower_le_def Rep_PDPlus Rep_v Rep_w)
101 lemma convex_le_induct [induct set: convex_le]:
102 assumes le: "t \<le>\<natural> u"
103 assumes 2: "\<And>t u v. \<lbrakk>P t u; P u v\<rbrakk> \<Longrightarrow> P t v"
104 assumes 3: "\<And>a b. a \<sqsubseteq> b \<Longrightarrow> P (PDUnit a) (PDUnit b)"
105 assumes 4: "\<And>t u v w. \<lbrakk>P t v; P u w\<rbrakk> \<Longrightarrow> P (PDPlus t u) (PDPlus v w)"
107 using le apply (induct t arbitrary: u rule: pd_basis_induct)
109 apply (induct_tac u rule: pd_basis_induct1)
111 apply (simp, clarify, rename_tac a b t)
112 apply (subgoal_tac "P (PDPlus (PDUnit a) (PDUnit a)) (PDPlus (PDUnit b) t)")
113 apply (simp add: PDPlus_absorb)
114 apply (erule (1) 4 [OF 3])
115 apply (drule convex_le_PDPlus_lemma, clarify)
119 lemma pd_take_convex_chain:
120 "pd_take n t \<le>\<natural> pd_take (Suc n) t"
121 apply (induct t rule: pd_basis_induct)
122 apply (simp add: compact_basis.take_chain)
123 apply (simp add: PDPlus_convex_mono)
126 lemma pd_take_convex_le: "pd_take i t \<le>\<natural> t"
127 apply (induct t rule: pd_basis_induct)
128 apply (simp add: compact_basis.take_less)
129 apply (simp add: PDPlus_convex_mono)
132 lemma pd_take_convex_mono:
133 "t \<le>\<natural> u \<Longrightarrow> pd_take n t \<le>\<natural> pd_take n u"
134 apply (erule convex_le_induct)
135 apply (erule (1) convex_le_trans)
136 apply (simp add: compact_basis.take_mono)
137 apply (simp add: PDPlus_convex_mono)
141 subsection {* Type definition *}
143 typedef (open) 'a convex_pd =
144 "{S::'a pd_basis set. convex_le.ideal S}"
145 by (fast intro: convex_le.ideal_principal)
147 instantiation convex_pd :: (profinite) sq_ord
151 "x \<sqsubseteq> y \<longleftrightarrow> Rep_convex_pd x \<subseteq> Rep_convex_pd y"
156 instance convex_pd :: (profinite) po
157 by (rule convex_le.typedef_ideal_po
158 [OF type_definition_convex_pd sq_le_convex_pd_def])
160 instance convex_pd :: (profinite) cpo
161 by (rule convex_le.typedef_ideal_cpo
162 [OF type_definition_convex_pd sq_le_convex_pd_def])
164 lemma Rep_convex_pd_lub:
165 "chain Y \<Longrightarrow> Rep_convex_pd (\<Squnion>i. Y i) = (\<Union>i. Rep_convex_pd (Y i))"
166 by (rule convex_le.typedef_ideal_rep_contlub
167 [OF type_definition_convex_pd sq_le_convex_pd_def])
169 lemma ideal_Rep_convex_pd: "convex_le.ideal (Rep_convex_pd xs)"
170 by (rule Rep_convex_pd [unfolded mem_Collect_eq])
173 convex_principal :: "'a pd_basis \<Rightarrow> 'a convex_pd" where
174 "convex_principal t = Abs_convex_pd {u. u \<le>\<natural> t}"
176 lemma Rep_convex_principal:
177 "Rep_convex_pd (convex_principal t) = {u. u \<le>\<natural> t}"
178 unfolding convex_principal_def
179 by (simp add: Abs_convex_pd_inverse convex_le.ideal_principal)
181 interpretation convex_pd!:
182 ideal_completion convex_le pd_take convex_principal Rep_convex_pd
184 apply (rule pd_take_convex_le)
185 apply (rule pd_take_idem)
186 apply (erule pd_take_convex_mono)
187 apply (rule pd_take_convex_chain)
188 apply (rule finite_range_pd_take)
189 apply (rule pd_take_covers)
190 apply (rule ideal_Rep_convex_pd)
191 apply (erule Rep_convex_pd_lub)
192 apply (rule Rep_convex_principal)
193 apply (simp only: sq_le_convex_pd_def)
196 text {* Convex powerdomain is pointed *}
198 lemma convex_pd_minimal: "convex_principal (PDUnit compact_bot) \<sqsubseteq> ys"
199 by (induct ys rule: convex_pd.principal_induct, simp, simp)
201 instance convex_pd :: (bifinite) pcpo
202 by intro_classes (fast intro: convex_pd_minimal)
204 lemma inst_convex_pd_pcpo: "\<bottom> = convex_principal (PDUnit compact_bot)"
205 by (rule convex_pd_minimal [THEN UU_I, symmetric])
207 text {* Convex powerdomain is profinite *}
209 instantiation convex_pd :: (profinite) profinite
213 approx_convex_pd_def: "approx = convex_pd.completion_approx"
216 apply (intro_classes, unfold approx_convex_pd_def)
217 apply (rule convex_pd.chain_completion_approx)
218 apply (rule convex_pd.lub_completion_approx)
219 apply (rule convex_pd.completion_approx_idem)
220 apply (rule convex_pd.finite_fixes_completion_approx)
225 instance convex_pd :: (bifinite) bifinite ..
227 lemma approx_convex_principal [simp]:
228 "approx n\<cdot>(convex_principal t) = convex_principal (pd_take n t)"
229 unfolding approx_convex_pd_def
230 by (rule convex_pd.completion_approx_principal)
232 lemma approx_eq_convex_principal:
233 "\<exists>t\<in>Rep_convex_pd xs. approx n\<cdot>xs = convex_principal (pd_take n t)"
234 unfolding approx_convex_pd_def
235 by (rule convex_pd.completion_approx_eq_principal)
238 subsection {* Monadic unit and plus *}
241 convex_unit :: "'a \<rightarrow> 'a convex_pd" where
242 "convex_unit = compact_basis.basis_fun (\<lambda>a. convex_principal (PDUnit a))"
245 convex_plus :: "'a convex_pd \<rightarrow> 'a convex_pd \<rightarrow> 'a convex_pd" where
246 "convex_plus = convex_pd.basis_fun (\<lambda>t. convex_pd.basis_fun (\<lambda>u.
247 convex_principal (PDPlus t u)))"
250 convex_add :: "'a convex_pd \<Rightarrow> 'a convex_pd \<Rightarrow> 'a convex_pd"
251 (infixl "+\<natural>" 65) where
252 "xs +\<natural> ys == convex_plus\<cdot>xs\<cdot>ys"
255 "_convex_pd" :: "args \<Rightarrow> 'a convex_pd" ("{_}\<natural>")
258 "{x,xs}\<natural>" == "{x}\<natural> +\<natural> {xs}\<natural>"
259 "{x}\<natural>" == "CONST convex_unit\<cdot>x"
261 lemma convex_unit_Rep_compact_basis [simp]:
262 "{Rep_compact_basis a}\<natural> = convex_principal (PDUnit a)"
263 unfolding convex_unit_def
264 by (simp add: compact_basis.basis_fun_principal PDUnit_convex_mono)
266 lemma convex_plus_principal [simp]:
267 "convex_principal t +\<natural> convex_principal u = convex_principal (PDPlus t u)"
268 unfolding convex_plus_def
269 by (simp add: convex_pd.basis_fun_principal
270 convex_pd.basis_fun_mono PDPlus_convex_mono)
272 lemma approx_convex_unit [simp]:
273 "approx n\<cdot>{x}\<natural> = {approx n\<cdot>x}\<natural>"
274 apply (induct x rule: compact_basis.principal_induct, simp)
275 apply (simp add: approx_Rep_compact_basis)
278 lemma approx_convex_plus [simp]:
279 "approx n\<cdot>(xs +\<natural> ys) = approx n\<cdot>xs +\<natural> approx n\<cdot>ys"
280 by (induct xs ys rule: convex_pd.principal_induct2, simp, simp, simp)
282 lemma convex_plus_assoc:
283 "(xs +\<natural> ys) +\<natural> zs = xs +\<natural> (ys +\<natural> zs)"
284 apply (induct xs ys arbitrary: zs rule: convex_pd.principal_induct2, simp, simp)
285 apply (rule_tac x=zs in convex_pd.principal_induct, simp)
286 apply (simp add: PDPlus_assoc)
289 lemma convex_plus_commute: "xs +\<natural> ys = ys +\<natural> xs"
290 apply (induct xs ys rule: convex_pd.principal_induct2, simp, simp)
291 apply (simp add: PDPlus_commute)
294 lemma convex_plus_absorb: "xs +\<natural> xs = xs"
295 apply (induct xs rule: convex_pd.principal_induct, simp)
296 apply (simp add: PDPlus_absorb)
299 interpretation aci_convex_plus!: ab_semigroup_idem_mult "op +\<natural>"
301 (rule convex_plus_assoc convex_plus_commute convex_plus_absorb)+
303 lemma convex_plus_left_commute: "xs +\<natural> (ys +\<natural> zs) = ys +\<natural> (xs +\<natural> zs)"
304 by (rule aci_convex_plus.mult_left_commute)
306 lemma convex_plus_left_absorb: "xs +\<natural> (xs +\<natural> ys) = xs +\<natural> ys"
307 by (rule aci_convex_plus.mult_left_idem)
309 lemmas convex_plus_aci = aci_convex_plus.mult_ac_idem
311 lemma convex_unit_less_plus_iff [simp]:
312 "{x}\<natural> \<sqsubseteq> ys +\<natural> zs \<longleftrightarrow> {x}\<natural> \<sqsubseteq> ys \<and> {x}\<natural> \<sqsubseteq> zs"
315 "adm (\<lambda>f. f\<cdot>{x}\<natural> \<sqsubseteq> f\<cdot>ys \<and> f\<cdot>{x}\<natural> \<sqsubseteq> f\<cdot>zs)")
316 apply (drule admD, rule chain_approx)
317 apply (drule_tac f="approx i" in monofun_cfun_arg)
318 apply (cut_tac x="approx i\<cdot>x" in compact_basis.compact_imp_principal, simp)
319 apply (cut_tac x="approx i\<cdot>ys" in convex_pd.compact_imp_principal, simp)
320 apply (cut_tac x="approx i\<cdot>zs" in convex_pd.compact_imp_principal, simp)
321 apply (clarify, simp)
325 apply (subst convex_plus_absorb [of "{x}\<natural>", symmetric])
326 apply (erule (1) monofun_cfun [OF monofun_cfun_arg])
329 lemma convex_plus_less_unit_iff [simp]:
330 "xs +\<natural> ys \<sqsubseteq> {z}\<natural> \<longleftrightarrow> xs \<sqsubseteq> {z}\<natural> \<and> ys \<sqsubseteq> {z}\<natural>"
333 "adm (\<lambda>f. f\<cdot>xs \<sqsubseteq> f\<cdot>{z}\<natural> \<and> f\<cdot>ys \<sqsubseteq> f\<cdot>{z}\<natural>)")
334 apply (drule admD, rule chain_approx)
335 apply (drule_tac f="approx i" in monofun_cfun_arg)
336 apply (cut_tac x="approx i\<cdot>xs" in convex_pd.compact_imp_principal, simp)
337 apply (cut_tac x="approx i\<cdot>ys" in convex_pd.compact_imp_principal, simp)
338 apply (cut_tac x="approx i\<cdot>z" in compact_basis.compact_imp_principal, simp)
339 apply (clarify, simp)
343 apply (subst convex_plus_absorb [of "{z}\<natural>", symmetric])
344 apply (erule (1) monofun_cfun [OF monofun_cfun_arg])
347 lemma convex_unit_less_iff [simp]: "{x}\<natural> \<sqsubseteq> {y}\<natural> \<longleftrightarrow> x \<sqsubseteq> y"
349 apply (rule profinite_less_ext)
350 apply (drule_tac f="approx i" in monofun_cfun_arg, simp)
351 apply (cut_tac x="approx i\<cdot>x" in compact_basis.compact_imp_principal, simp)
352 apply (cut_tac x="approx i\<cdot>y" in compact_basis.compact_imp_principal, simp)
354 apply (erule monofun_cfun_arg)
357 lemma convex_unit_eq_iff [simp]: "{x}\<natural> = {y}\<natural> \<longleftrightarrow> x = y"
358 unfolding po_eq_conv by simp
360 lemma convex_unit_strict [simp]: "{\<bottom>}\<natural> = \<bottom>"
361 unfolding inst_convex_pd_pcpo Rep_compact_bot [symmetric] by simp
363 lemma convex_unit_strict_iff [simp]: "{x}\<natural> = \<bottom> \<longleftrightarrow> x = \<bottom>"
364 unfolding convex_unit_strict [symmetric] by (rule convex_unit_eq_iff)
366 lemma compact_convex_unit_iff [simp]:
367 "compact {x}\<natural> \<longleftrightarrow> compact x"
368 unfolding profinite_compact_iff by simp
370 lemma compact_convex_plus [simp]:
371 "\<lbrakk>compact xs; compact ys\<rbrakk> \<Longrightarrow> compact (xs +\<natural> ys)"
372 by (auto dest!: convex_pd.compact_imp_principal)
375 subsection {* Induction rules *}
377 lemma convex_pd_induct1:
379 assumes unit: "\<And>x. P {x}\<natural>"
380 assumes insert: "\<And>x ys. \<lbrakk>P {x}\<natural>; P ys\<rbrakk> \<Longrightarrow> P ({x}\<natural> +\<natural> ys)"
381 shows "P (xs::'a convex_pd)"
382 apply (induct xs rule: convex_pd.principal_induct, rule P)
383 apply (induct_tac a rule: pd_basis_induct1)
384 apply (simp only: convex_unit_Rep_compact_basis [symmetric])
386 apply (simp only: convex_unit_Rep_compact_basis [symmetric]
387 convex_plus_principal [symmetric])
388 apply (erule insert [OF unit])
391 lemma convex_pd_induct:
393 assumes unit: "\<And>x. P {x}\<natural>"
394 assumes plus: "\<And>xs ys. \<lbrakk>P xs; P ys\<rbrakk> \<Longrightarrow> P (xs +\<natural> ys)"
395 shows "P (xs::'a convex_pd)"
396 apply (induct xs rule: convex_pd.principal_induct, rule P)
397 apply (induct_tac a rule: pd_basis_induct)
398 apply (simp only: convex_unit_Rep_compact_basis [symmetric] unit)
399 apply (simp only: convex_plus_principal [symmetric] plus)
403 subsection {* Monadic bind *}
407 "'a pd_basis \<Rightarrow> ('a \<rightarrow> 'b convex_pd) \<rightarrow> 'b convex_pd" where
408 "convex_bind_basis = fold_pd
409 (\<lambda>a. \<Lambda> f. f\<cdot>(Rep_compact_basis a))
410 (\<lambda>x y. \<Lambda> f. x\<cdot>f +\<natural> y\<cdot>f)"
412 lemma ACI_convex_bind:
413 "ab_semigroup_idem_mult (\<lambda>x y. \<Lambda> f. x\<cdot>f +\<natural> y\<cdot>f)"
415 apply (simp add: convex_plus_assoc)
416 apply (simp add: convex_plus_commute)
417 apply (simp add: convex_plus_absorb eta_cfun)
420 lemma convex_bind_basis_simps [simp]:
421 "convex_bind_basis (PDUnit a) =
422 (\<Lambda> f. f\<cdot>(Rep_compact_basis a))"
423 "convex_bind_basis (PDPlus t u) =
424 (\<Lambda> f. convex_bind_basis t\<cdot>f +\<natural> convex_bind_basis u\<cdot>f)"
425 unfolding convex_bind_basis_def
427 apply (rule fold_pd_PDUnit [OF ACI_convex_bind])
428 apply (rule fold_pd_PDPlus [OF ACI_convex_bind])
432 "\<lbrakk>cont f; cont g; \<And>x. f x \<sqsubseteq> g x\<rbrakk> \<Longrightarrow> (\<Lambda> x. f x) \<sqsubseteq> (\<Lambda> x. g x)"
433 by (simp add: expand_cfun_less)
435 lemma convex_bind_basis_mono:
436 "t \<le>\<natural> u \<Longrightarrow> convex_bind_basis t \<sqsubseteq> convex_bind_basis u"
437 apply (erule convex_le_induct)
438 apply (erule (1) trans_less)
439 apply (simp add: monofun_LAM monofun_cfun)
440 apply (simp add: monofun_LAM monofun_cfun)
444 convex_bind :: "'a convex_pd \<rightarrow> ('a \<rightarrow> 'b convex_pd) \<rightarrow> 'b convex_pd" where
445 "convex_bind = convex_pd.basis_fun convex_bind_basis"
447 lemma convex_bind_principal [simp]:
448 "convex_bind\<cdot>(convex_principal t) = convex_bind_basis t"
449 unfolding convex_bind_def
450 apply (rule convex_pd.basis_fun_principal)
451 apply (erule convex_bind_basis_mono)
454 lemma convex_bind_unit [simp]:
455 "convex_bind\<cdot>{x}\<natural>\<cdot>f = f\<cdot>x"
456 by (induct x rule: compact_basis.principal_induct, simp, simp)
458 lemma convex_bind_plus [simp]:
459 "convex_bind\<cdot>(xs +\<natural> ys)\<cdot>f = convex_bind\<cdot>xs\<cdot>f +\<natural> convex_bind\<cdot>ys\<cdot>f"
460 by (induct xs ys rule: convex_pd.principal_induct2, simp, simp, simp)
462 lemma convex_bind_strict [simp]: "convex_bind\<cdot>\<bottom>\<cdot>f = f\<cdot>\<bottom>"
463 unfolding convex_unit_strict [symmetric] by (rule convex_bind_unit)
466 subsection {* Map and join *}
469 convex_map :: "('a \<rightarrow> 'b) \<rightarrow> 'a convex_pd \<rightarrow> 'b convex_pd" where
470 "convex_map = (\<Lambda> f xs. convex_bind\<cdot>xs\<cdot>(\<Lambda> x. {f\<cdot>x}\<natural>))"
473 convex_join :: "'a convex_pd convex_pd \<rightarrow> 'a convex_pd" where
474 "convex_join = (\<Lambda> xss. convex_bind\<cdot>xss\<cdot>(\<Lambda> xs. xs))"
476 lemma convex_map_unit [simp]:
477 "convex_map\<cdot>f\<cdot>(convex_unit\<cdot>x) = convex_unit\<cdot>(f\<cdot>x)"
478 unfolding convex_map_def by simp
480 lemma convex_map_plus [simp]:
481 "convex_map\<cdot>f\<cdot>(xs +\<natural> ys) = convex_map\<cdot>f\<cdot>xs +\<natural> convex_map\<cdot>f\<cdot>ys"
482 unfolding convex_map_def by simp
484 lemma convex_join_unit [simp]:
485 "convex_join\<cdot>{xs}\<natural> = xs"
486 unfolding convex_join_def by simp
488 lemma convex_join_plus [simp]:
489 "convex_join\<cdot>(xss +\<natural> yss) = convex_join\<cdot>xss +\<natural> convex_join\<cdot>yss"
490 unfolding convex_join_def by simp
492 lemma convex_map_ident: "convex_map\<cdot>(\<Lambda> x. x)\<cdot>xs = xs"
493 by (induct xs rule: convex_pd_induct, simp_all)
495 lemma convex_map_map:
496 "convex_map\<cdot>f\<cdot>(convex_map\<cdot>g\<cdot>xs) = convex_map\<cdot>(\<Lambda> x. f\<cdot>(g\<cdot>x))\<cdot>xs"
497 by (induct xs rule: convex_pd_induct, simp_all)
499 lemma convex_join_map_unit:
500 "convex_join\<cdot>(convex_map\<cdot>convex_unit\<cdot>xs) = xs"
501 by (induct xs rule: convex_pd_induct, simp_all)
503 lemma convex_join_map_join:
504 "convex_join\<cdot>(convex_map\<cdot>convex_join\<cdot>xsss) = convex_join\<cdot>(convex_join\<cdot>xsss)"
505 by (induct xsss rule: convex_pd_induct, simp_all)
507 lemma convex_join_map_map:
508 "convex_join\<cdot>(convex_map\<cdot>(convex_map\<cdot>f)\<cdot>xss) =
509 convex_map\<cdot>f\<cdot>(convex_join\<cdot>xss)"
510 by (induct xss rule: convex_pd_induct, simp_all)
512 lemma convex_map_approx: "convex_map\<cdot>(approx n)\<cdot>xs = approx n\<cdot>xs"
513 by (induct xs rule: convex_pd_induct, simp_all)
516 subsection {* Conversions to other powerdomains *}
518 text {* Convex to upper *}
520 lemma convex_le_imp_upper_le: "t \<le>\<natural> u \<Longrightarrow> t \<le>\<sharp> u"
521 unfolding convex_le_def by simp
524 convex_to_upper :: "'a convex_pd \<rightarrow> 'a upper_pd" where
525 "convex_to_upper = convex_pd.basis_fun upper_principal"
527 lemma convex_to_upper_principal [simp]:
528 "convex_to_upper\<cdot>(convex_principal t) = upper_principal t"
529 unfolding convex_to_upper_def
530 apply (rule convex_pd.basis_fun_principal)
531 apply (rule upper_pd.principal_mono)
532 apply (erule convex_le_imp_upper_le)
535 lemma convex_to_upper_unit [simp]:
536 "convex_to_upper\<cdot>{x}\<natural> = {x}\<sharp>"
537 by (induct x rule: compact_basis.principal_induct, simp, simp)
539 lemma convex_to_upper_plus [simp]:
540 "convex_to_upper\<cdot>(xs +\<natural> ys) = convex_to_upper\<cdot>xs +\<sharp> convex_to_upper\<cdot>ys"
541 by (induct xs ys rule: convex_pd.principal_induct2, simp, simp, simp)
543 lemma approx_convex_to_upper:
544 "approx i\<cdot>(convex_to_upper\<cdot>xs) = convex_to_upper\<cdot>(approx i\<cdot>xs)"
545 by (induct xs rule: convex_pd_induct, simp, simp, simp)
547 lemma convex_to_upper_bind [simp]:
548 "convex_to_upper\<cdot>(convex_bind\<cdot>xs\<cdot>f) =
549 upper_bind\<cdot>(convex_to_upper\<cdot>xs)\<cdot>(convex_to_upper oo f)"
550 by (induct xs rule: convex_pd_induct, simp, simp, simp)
552 lemma convex_to_upper_map [simp]:
553 "convex_to_upper\<cdot>(convex_map\<cdot>f\<cdot>xs) = upper_map\<cdot>f\<cdot>(convex_to_upper\<cdot>xs)"
554 by (simp add: convex_map_def upper_map_def cfcomp_LAM)
556 lemma convex_to_upper_join [simp]:
557 "convex_to_upper\<cdot>(convex_join\<cdot>xss) =
558 upper_bind\<cdot>(convex_to_upper\<cdot>xss)\<cdot>convex_to_upper"
559 by (simp add: convex_join_def upper_join_def cfcomp_LAM eta_cfun)
561 text {* Convex to lower *}
563 lemma convex_le_imp_lower_le: "t \<le>\<natural> u \<Longrightarrow> t \<le>\<flat> u"
564 unfolding convex_le_def by simp
567 convex_to_lower :: "'a convex_pd \<rightarrow> 'a lower_pd" where
568 "convex_to_lower = convex_pd.basis_fun lower_principal"
570 lemma convex_to_lower_principal [simp]:
571 "convex_to_lower\<cdot>(convex_principal t) = lower_principal t"
572 unfolding convex_to_lower_def
573 apply (rule convex_pd.basis_fun_principal)
574 apply (rule lower_pd.principal_mono)
575 apply (erule convex_le_imp_lower_le)
578 lemma convex_to_lower_unit [simp]:
579 "convex_to_lower\<cdot>{x}\<natural> = {x}\<flat>"
580 by (induct x rule: compact_basis.principal_induct, simp, simp)
582 lemma convex_to_lower_plus [simp]:
583 "convex_to_lower\<cdot>(xs +\<natural> ys) = convex_to_lower\<cdot>xs +\<flat> convex_to_lower\<cdot>ys"
584 by (induct xs ys rule: convex_pd.principal_induct2, simp, simp, simp)
586 lemma approx_convex_to_lower:
587 "approx i\<cdot>(convex_to_lower\<cdot>xs) = convex_to_lower\<cdot>(approx i\<cdot>xs)"
588 by (induct xs rule: convex_pd_induct, simp, simp, simp)
590 lemma convex_to_lower_bind [simp]:
591 "convex_to_lower\<cdot>(convex_bind\<cdot>xs\<cdot>f) =
592 lower_bind\<cdot>(convex_to_lower\<cdot>xs)\<cdot>(convex_to_lower oo f)"
593 by (induct xs rule: convex_pd_induct, simp, simp, simp)
595 lemma convex_to_lower_map [simp]:
596 "convex_to_lower\<cdot>(convex_map\<cdot>f\<cdot>xs) = lower_map\<cdot>f\<cdot>(convex_to_lower\<cdot>xs)"
597 by (simp add: convex_map_def lower_map_def cfcomp_LAM)
599 lemma convex_to_lower_join [simp]:
600 "convex_to_lower\<cdot>(convex_join\<cdot>xss) =
601 lower_bind\<cdot>(convex_to_lower\<cdot>xss)\<cdot>convex_to_lower"
602 by (simp add: convex_join_def lower_join_def cfcomp_LAM eta_cfun)
604 text {* Ordering property *}
606 lemma convex_pd_less_iff:
607 "(xs \<sqsubseteq> ys) =
608 (convex_to_upper\<cdot>xs \<sqsubseteq> convex_to_upper\<cdot>ys \<and>
609 convex_to_lower\<cdot>xs \<sqsubseteq> convex_to_lower\<cdot>ys)"
610 apply (safe elim!: monofun_cfun_arg)
611 apply (rule profinite_less_ext)
612 apply (drule_tac f="approx i" in monofun_cfun_arg)
613 apply (drule_tac f="approx i" in monofun_cfun_arg)
614 apply (cut_tac x="approx i\<cdot>xs" in convex_pd.compact_imp_principal, simp)
615 apply (cut_tac x="approx i\<cdot>ys" in convex_pd.compact_imp_principal, simp)
617 apply (simp add: approx_convex_to_upper approx_convex_to_lower convex_le_def)
620 lemmas convex_plus_less_plus_iff =
621 convex_pd_less_iff [where xs="xs +\<natural> ys" and ys="zs +\<natural> ws", standard]
623 lemmas convex_pd_less_simps =
624 convex_unit_less_plus_iff
625 convex_plus_less_unit_iff
626 convex_plus_less_plus_iff