author | huffman |
Fri, 20 Jun 2008 17:58:16 +0200 | |
changeset 27292 | 7be079726009 |
parent 27289 | c49d427867aa |
child 27297 | 2c42b1505f25 |
permissions | -rw-r--r-- |
25904 | 1 |
(* Title: HOLCF/ConvexPD.thy |
2 |
ID: $Id$ |
|
3 |
Author: Brian Huffman |
|
4 |
*) |
|
5 |
||
6 |
header {* Convex powerdomain *} |
|
7 |
||
8 |
theory ConvexPD |
|
9 |
imports UpperPD LowerPD |
|
10 |
begin |
|
11 |
||
12 |
subsection {* Basis preorder *} |
|
13 |
||
14 |
definition |
|
15 |
convex_le :: "'a pd_basis \<Rightarrow> 'a pd_basis \<Rightarrow> bool" (infix "\<le>\<natural>" 50) where |
|
16 |
"convex_le = (\<lambda>u v. u \<le>\<sharp> v \<and> u \<le>\<flat> v)" |
|
17 |
||
18 |
lemma convex_le_refl [simp]: "t \<le>\<natural> t" |
|
19 |
unfolding convex_le_def by (fast intro: upper_le_refl lower_le_refl) |
|
20 |
||
21 |
lemma convex_le_trans: "\<lbrakk>t \<le>\<natural> u; u \<le>\<natural> v\<rbrakk> \<Longrightarrow> t \<le>\<natural> v" |
|
22 |
unfolding convex_le_def by (fast intro: upper_le_trans lower_le_trans) |
|
23 |
||
24 |
interpretation convex_le: preorder [convex_le] |
|
25 |
by (rule preorder.intro, rule convex_le_refl, rule convex_le_trans) |
|
26 |
||
27 |
lemma upper_le_minimal [simp]: "PDUnit compact_bot \<le>\<natural> t" |
|
28 |
unfolding convex_le_def Rep_PDUnit by simp |
|
29 |
||
26420
57a626f64875
make preorder locale into a superclass of class po
huffman
parents:
26407
diff
changeset
|
30 |
lemma PDUnit_convex_mono: "x \<sqsubseteq> y \<Longrightarrow> PDUnit x \<le>\<natural> PDUnit y" |
25904 | 31 |
unfolding convex_le_def by (fast intro: PDUnit_upper_mono PDUnit_lower_mono) |
32 |
||
33 |
lemma PDPlus_convex_mono: "\<lbrakk>s \<le>\<natural> t; u \<le>\<natural> v\<rbrakk> \<Longrightarrow> PDPlus s u \<le>\<natural> PDPlus t v" |
|
34 |
unfolding convex_le_def by (fast intro: PDPlus_upper_mono PDPlus_lower_mono) |
|
35 |
||
36 |
lemma convex_le_PDUnit_PDUnit_iff [simp]: |
|
26420
57a626f64875
make preorder locale into a superclass of class po
huffman
parents:
26407
diff
changeset
|
37 |
"(PDUnit a \<le>\<natural> PDUnit b) = a \<sqsubseteq> b" |
25904 | 38 |
unfolding convex_le_def upper_le_def lower_le_def Rep_PDUnit by fast |
39 |
||
40 |
lemma convex_le_PDUnit_lemma1: |
|
26420
57a626f64875
make preorder locale into a superclass of class po
huffman
parents:
26407
diff
changeset
|
41 |
"(PDUnit a \<le>\<natural> t) = (\<forall>b\<in>Rep_pd_basis t. a \<sqsubseteq> b)" |
25904 | 42 |
unfolding convex_le_def upper_le_def lower_le_def Rep_PDUnit |
43 |
using Rep_pd_basis_nonempty [of t, folded ex_in_conv] by fast |
|
44 |
||
45 |
lemma convex_le_PDUnit_PDPlus_iff [simp]: |
|
46 |
"(PDUnit a \<le>\<natural> PDPlus t u) = (PDUnit a \<le>\<natural> t \<and> PDUnit a \<le>\<natural> u)" |
|
47 |
unfolding convex_le_PDUnit_lemma1 Rep_PDPlus by fast |
|
48 |
||
49 |
lemma convex_le_PDUnit_lemma2: |
|
26420
57a626f64875
make preorder locale into a superclass of class po
huffman
parents:
26407
diff
changeset
|
50 |
"(t \<le>\<natural> PDUnit b) = (\<forall>a\<in>Rep_pd_basis t. a \<sqsubseteq> b)" |
25904 | 51 |
unfolding convex_le_def upper_le_def lower_le_def Rep_PDUnit |
52 |
using Rep_pd_basis_nonempty [of t, folded ex_in_conv] by fast |
|
53 |
||
54 |
lemma convex_le_PDPlus_PDUnit_iff [simp]: |
|
55 |
"(PDPlus t u \<le>\<natural> PDUnit a) = (t \<le>\<natural> PDUnit a \<and> u \<le>\<natural> PDUnit a)" |
|
56 |
unfolding convex_le_PDUnit_lemma2 Rep_PDPlus by fast |
|
57 |
||
58 |
lemma convex_le_PDPlus_lemma: |
|
59 |
assumes z: "PDPlus t u \<le>\<natural> z" |
|
60 |
shows "\<exists>v w. z = PDPlus v w \<and> t \<le>\<natural> v \<and> u \<le>\<natural> w" |
|
61 |
proof (intro exI conjI) |
|
26420
57a626f64875
make preorder locale into a superclass of class po
huffman
parents:
26407
diff
changeset
|
62 |
let ?A = "{b\<in>Rep_pd_basis z. \<exists>a\<in>Rep_pd_basis t. a \<sqsubseteq> b}" |
57a626f64875
make preorder locale into a superclass of class po
huffman
parents:
26407
diff
changeset
|
63 |
let ?B = "{b\<in>Rep_pd_basis z. \<exists>a\<in>Rep_pd_basis u. a \<sqsubseteq> b}" |
25904 | 64 |
let ?v = "Abs_pd_basis ?A" |
65 |
let ?w = "Abs_pd_basis ?B" |
|
66 |
have Rep_v: "Rep_pd_basis ?v = ?A" |
|
67 |
apply (rule Abs_pd_basis_inverse) |
|
68 |
apply (rule Rep_pd_basis_nonempty [of t, folded ex_in_conv, THEN exE]) |
|
69 |
apply (cut_tac z, simp only: convex_le_def lower_le_def, clarify) |
|
70 |
apply (drule_tac x=x in bspec, simp add: Rep_PDPlus, erule bexE) |
|
71 |
apply (simp add: pd_basis_def) |
|
72 |
apply fast |
|
73 |
done |
|
74 |
have Rep_w: "Rep_pd_basis ?w = ?B" |
|
75 |
apply (rule Abs_pd_basis_inverse) |
|
76 |
apply (rule Rep_pd_basis_nonempty [of u, folded ex_in_conv, THEN exE]) |
|
77 |
apply (cut_tac z, simp only: convex_le_def lower_le_def, clarify) |
|
78 |
apply (drule_tac x=x in bspec, simp add: Rep_PDPlus, erule bexE) |
|
79 |
apply (simp add: pd_basis_def) |
|
80 |
apply fast |
|
81 |
done |
|
82 |
show "z = PDPlus ?v ?w" |
|
83 |
apply (insert z) |
|
84 |
apply (simp add: convex_le_def, erule conjE) |
|
85 |
apply (simp add: Rep_pd_basis_inject [symmetric] Rep_PDPlus) |
|
86 |
apply (simp add: Rep_v Rep_w) |
|
87 |
apply (rule equalityI) |
|
88 |
apply (rule subsetI) |
|
89 |
apply (simp only: upper_le_def) |
|
90 |
apply (drule (1) bspec, erule bexE) |
|
91 |
apply (simp add: Rep_PDPlus) |
|
92 |
apply fast |
|
93 |
apply fast |
|
94 |
done |
|
95 |
show "t \<le>\<natural> ?v" "u \<le>\<natural> ?w" |
|
96 |
apply (insert z) |
|
97 |
apply (simp_all add: convex_le_def upper_le_def lower_le_def Rep_PDPlus Rep_v Rep_w) |
|
98 |
apply fast+ |
|
99 |
done |
|
100 |
qed |
|
101 |
||
102 |
lemma convex_le_induct [induct set: convex_le]: |
|
103 |
assumes le: "t \<le>\<natural> u" |
|
104 |
assumes 2: "\<And>t u v. \<lbrakk>P t u; P u v\<rbrakk> \<Longrightarrow> P t v" |
|
26420
57a626f64875
make preorder locale into a superclass of class po
huffman
parents:
26407
diff
changeset
|
105 |
assumes 3: "\<And>a b. a \<sqsubseteq> b \<Longrightarrow> P (PDUnit a) (PDUnit b)" |
25904 | 106 |
assumes 4: "\<And>t u v w. \<lbrakk>P t v; P u w\<rbrakk> \<Longrightarrow> P (PDPlus t u) (PDPlus v w)" |
107 |
shows "P t u" |
|
108 |
using le apply (induct t arbitrary: u rule: pd_basis_induct) |
|
109 |
apply (erule rev_mp) |
|
110 |
apply (induct_tac u rule: pd_basis_induct1) |
|
111 |
apply (simp add: 3) |
|
112 |
apply (simp, clarify, rename_tac a b t) |
|
113 |
apply (subgoal_tac "P (PDPlus (PDUnit a) (PDUnit a)) (PDPlus (PDUnit b) t)") |
|
114 |
apply (simp add: PDPlus_absorb) |
|
115 |
apply (erule (1) 4 [OF 3]) |
|
116 |
apply (drule convex_le_PDPlus_lemma, clarify) |
|
117 |
apply (simp add: 4) |
|
118 |
done |
|
119 |
||
27289 | 120 |
lemma approx_pd_convex_chain: |
121 |
"approx_pd n t \<le>\<natural> approx_pd (Suc n) t" |
|
25904 | 122 |
apply (induct t rule: pd_basis_induct) |
27289 | 123 |
apply (simp add: compact_basis.take_chain) |
25904 | 124 |
apply (simp add: PDPlus_convex_mono) |
125 |
done |
|
126 |
||
127 |
lemma approx_pd_convex_le: "approx_pd i t \<le>\<natural> t" |
|
128 |
apply (induct t rule: pd_basis_induct) |
|
27289 | 129 |
apply (simp add: compact_basis.take_less) |
25904 | 130 |
apply (simp add: PDPlus_convex_mono) |
131 |
done |
|
132 |
||
133 |
lemma approx_pd_convex_mono: |
|
134 |
"t \<le>\<natural> u \<Longrightarrow> approx_pd n t \<le>\<natural> approx_pd n u" |
|
135 |
apply (erule convex_le_induct) |
|
136 |
apply (erule (1) convex_le_trans) |
|
27289 | 137 |
apply (simp add: compact_basis.take_mono) |
25904 | 138 |
apply (simp add: PDPlus_convex_mono) |
139 |
done |
|
140 |
||
141 |
||
142 |
subsection {* Type definition *} |
|
143 |
||
144 |
cpodef (open) 'a convex_pd = |
|
26407
562a1d615336
rename class bifinite_cpo to profinite; generalize powerdomains from bifinite to profinite
huffman
parents:
26041
diff
changeset
|
145 |
"{S::'a::profinite pd_basis set. convex_le.ideal S}" |
25904 | 146 |
apply (simp add: convex_le.adm_ideal) |
147 |
apply (fast intro: convex_le.ideal_principal) |
|
148 |
done |
|
149 |
||
150 |
lemma ideal_Rep_convex_pd: "convex_le.ideal (Rep_convex_pd xs)" |
|
26927 | 151 |
by (rule Rep_convex_pd [unfolded mem_Collect_eq]) |
25904 | 152 |
|
153 |
lemma Rep_convex_pd_mono: "xs \<sqsubseteq> ys \<Longrightarrow> Rep_convex_pd xs \<subseteq> Rep_convex_pd ys" |
|
26806 | 154 |
unfolding less_convex_pd_def less_set_eq . |
25904 | 155 |
|
156 |
definition |
|
157 |
convex_principal :: "'a pd_basis \<Rightarrow> 'a convex_pd" where |
|
158 |
"convex_principal t = Abs_convex_pd {u. u \<le>\<natural> t}" |
|
159 |
||
160 |
lemma Rep_convex_principal: |
|
161 |
"Rep_convex_pd (convex_principal t) = {u. u \<le>\<natural> t}" |
|
162 |
unfolding convex_principal_def |
|
163 |
apply (rule Abs_convex_pd_inverse [simplified]) |
|
164 |
apply (rule convex_le.ideal_principal) |
|
165 |
done |
|
166 |
||
167 |
interpretation convex_pd: |
|
26927 | 168 |
ideal_completion [convex_le approx_pd convex_principal Rep_convex_pd] |
25904 | 169 |
apply unfold_locales |
170 |
apply (rule approx_pd_convex_le) |
|
171 |
apply (rule approx_pd_idem) |
|
172 |
apply (erule approx_pd_convex_mono) |
|
27289 | 173 |
apply (rule approx_pd_convex_chain) |
25904 | 174 |
apply (rule finite_range_approx_pd) |
27289 | 175 |
apply (rule approx_pd_covers) |
26420
57a626f64875
make preorder locale into a superclass of class po
huffman
parents:
26407
diff
changeset
|
176 |
apply (rule ideal_Rep_convex_pd) |
57a626f64875
make preorder locale into a superclass of class po
huffman
parents:
26407
diff
changeset
|
177 |
apply (rule cont_Rep_convex_pd) |
57a626f64875
make preorder locale into a superclass of class po
huffman
parents:
26407
diff
changeset
|
178 |
apply (rule Rep_convex_principal) |
26806 | 179 |
apply (simp only: less_convex_pd_def less_set_eq) |
25904 | 180 |
done |
181 |
||
27289 | 182 |
text {* Convex powerdomain is pointed *} |
25904 | 183 |
|
184 |
lemma convex_pd_minimal: "convex_principal (PDUnit compact_bot) \<sqsubseteq> ys" |
|
185 |
by (induct ys rule: convex_pd.principal_induct, simp, simp) |
|
186 |
||
187 |
instance convex_pd :: (bifinite) pcpo |
|
26927 | 188 |
by intro_classes (fast intro: convex_pd_minimal) |
25904 | 189 |
|
190 |
lemma inst_convex_pd_pcpo: "\<bottom> = convex_principal (PDUnit compact_bot)" |
|
191 |
by (rule convex_pd_minimal [THEN UU_I, symmetric]) |
|
192 |
||
27289 | 193 |
text {* Convex powerdomain is profinite *} |
25904 | 194 |
|
26962
c8b20f615d6c
use new class package for classes profinite, bifinite; remove approx class
huffman
parents:
26927
diff
changeset
|
195 |
instantiation convex_pd :: (profinite) profinite |
c8b20f615d6c
use new class package for classes profinite, bifinite; remove approx class
huffman
parents:
26927
diff
changeset
|
196 |
begin |
25904 | 197 |
|
26962
c8b20f615d6c
use new class package for classes profinite, bifinite; remove approx class
huffman
parents:
26927
diff
changeset
|
198 |
definition |
c8b20f615d6c
use new class package for classes profinite, bifinite; remove approx class
huffman
parents:
26927
diff
changeset
|
199 |
approx_convex_pd_def: "approx = convex_pd.completion_approx" |
26927 | 200 |
|
26962
c8b20f615d6c
use new class package for classes profinite, bifinite; remove approx class
huffman
parents:
26927
diff
changeset
|
201 |
instance |
26927 | 202 |
apply (intro_classes, unfold approx_convex_pd_def) |
203 |
apply (simp add: convex_pd.chain_completion_approx) |
|
204 |
apply (rule convex_pd.lub_completion_approx) |
|
205 |
apply (rule convex_pd.completion_approx_idem) |
|
206 |
apply (rule convex_pd.finite_fixes_completion_approx) |
|
207 |
done |
|
208 |
||
26962
c8b20f615d6c
use new class package for classes profinite, bifinite; remove approx class
huffman
parents:
26927
diff
changeset
|
209 |
end |
c8b20f615d6c
use new class package for classes profinite, bifinite; remove approx class
huffman
parents:
26927
diff
changeset
|
210 |
|
26927 | 211 |
instance convex_pd :: (bifinite) bifinite .. |
25904 | 212 |
|
213 |
lemma approx_convex_principal [simp]: |
|
214 |
"approx n\<cdot>(convex_principal t) = convex_principal (approx_pd n t)" |
|
215 |
unfolding approx_convex_pd_def |
|
26927 | 216 |
by (rule convex_pd.completion_approx_principal) |
25904 | 217 |
|
218 |
lemma approx_eq_convex_principal: |
|
219 |
"\<exists>t\<in>Rep_convex_pd xs. approx n\<cdot>xs = convex_principal (approx_pd n t)" |
|
220 |
unfolding approx_convex_pd_def |
|
26927 | 221 |
by (rule convex_pd.completion_approx_eq_principal) |
26407
562a1d615336
rename class bifinite_cpo to profinite; generalize powerdomains from bifinite to profinite
huffman
parents:
26041
diff
changeset
|
222 |
|
25904 | 223 |
|
26927 | 224 |
subsection {* Monadic unit and plus *} |
25904 | 225 |
|
226 |
definition |
|
227 |
convex_unit :: "'a \<rightarrow> 'a convex_pd" where |
|
228 |
"convex_unit = compact_basis.basis_fun (\<lambda>a. convex_principal (PDUnit a))" |
|
229 |
||
230 |
definition |
|
231 |
convex_plus :: "'a convex_pd \<rightarrow> 'a convex_pd \<rightarrow> 'a convex_pd" where |
|
232 |
"convex_plus = convex_pd.basis_fun (\<lambda>t. convex_pd.basis_fun (\<lambda>u. |
|
233 |
convex_principal (PDPlus t u)))" |
|
234 |
||
235 |
abbreviation |
|
236 |
convex_add :: "'a convex_pd \<Rightarrow> 'a convex_pd \<Rightarrow> 'a convex_pd" |
|
237 |
(infixl "+\<natural>" 65) where |
|
238 |
"xs +\<natural> ys == convex_plus\<cdot>xs\<cdot>ys" |
|
239 |
||
26927 | 240 |
syntax |
241 |
"_convex_pd" :: "args \<Rightarrow> 'a convex_pd" ("{_}\<natural>") |
|
242 |
||
243 |
translations |
|
244 |
"{x,xs}\<natural>" == "{x}\<natural> +\<natural> {xs}\<natural>" |
|
245 |
"{x}\<natural>" == "CONST convex_unit\<cdot>x" |
|
246 |
||
247 |
lemma convex_unit_Rep_compact_basis [simp]: |
|
248 |
"{Rep_compact_basis a}\<natural> = convex_principal (PDUnit a)" |
|
249 |
unfolding convex_unit_def |
|
27289 | 250 |
by (simp add: compact_basis.basis_fun_principal PDUnit_convex_mono) |
26927 | 251 |
|
25904 | 252 |
lemma convex_plus_principal [simp]: |
26927 | 253 |
"convex_principal t +\<natural> convex_principal u = convex_principal (PDPlus t u)" |
25904 | 254 |
unfolding convex_plus_def |
255 |
by (simp add: convex_pd.basis_fun_principal |
|
256 |
convex_pd.basis_fun_mono PDPlus_convex_mono) |
|
257 |
||
26927 | 258 |
lemma approx_convex_unit [simp]: |
259 |
"approx n\<cdot>{x}\<natural> = {approx n\<cdot>x}\<natural>" |
|
27289 | 260 |
apply (induct x rule: compact_basis.principal_induct, simp) |
26927 | 261 |
apply (simp add: approx_Rep_compact_basis) |
262 |
done |
|
263 |
||
25904 | 264 |
lemma approx_convex_plus [simp]: |
26927 | 265 |
"approx n\<cdot>(xs +\<natural> ys) = approx n\<cdot>xs +\<natural> approx n\<cdot>ys" |
27289 | 266 |
by (induct xs ys rule: convex_pd.principal_induct2, simp, simp, simp) |
25904 | 267 |
|
268 |
lemma convex_plus_assoc: |
|
26927 | 269 |
"(xs +\<natural> ys) +\<natural> zs = xs +\<natural> (ys +\<natural> zs)" |
27289 | 270 |
apply (induct xs ys arbitrary: zs rule: convex_pd.principal_induct2, simp, simp) |
271 |
apply (rule_tac x=zs in convex_pd.principal_induct, simp) |
|
25904 | 272 |
apply (simp add: PDPlus_assoc) |
273 |
done |
|
274 |
||
26927 | 275 |
lemma convex_plus_commute: "xs +\<natural> ys = ys +\<natural> xs" |
27289 | 276 |
apply (induct xs ys rule: convex_pd.principal_induct2, simp, simp) |
26927 | 277 |
apply (simp add: PDPlus_commute) |
278 |
done |
|
279 |
||
280 |
lemma convex_plus_absorb: "xs +\<natural> xs = xs" |
|
27289 | 281 |
apply (induct xs rule: convex_pd.principal_induct, simp) |
25904 | 282 |
apply (simp add: PDPlus_absorb) |
283 |
done |
|
284 |
||
26927 | 285 |
interpretation aci_convex_plus: ab_semigroup_idem_mult ["op +\<natural>"] |
286 |
by unfold_locales |
|
287 |
(rule convex_plus_assoc convex_plus_commute convex_plus_absorb)+ |
|
288 |
||
289 |
lemma convex_plus_left_commute: "xs +\<natural> (ys +\<natural> zs) = ys +\<natural> (xs +\<natural> zs)" |
|
290 |
by (rule aci_convex_plus.mult_left_commute) |
|
291 |
||
292 |
lemma convex_plus_left_absorb: "xs +\<natural> (xs +\<natural> ys) = xs +\<natural> ys" |
|
293 |
by (rule aci_convex_plus.mult_left_idem) |
|
294 |
||
295 |
lemmas convex_plus_aci = aci_convex_plus.mult_ac_idem |
|
296 |
||
25904 | 297 |
lemma convex_unit_less_plus_iff [simp]: |
26927 | 298 |
"{x}\<natural> \<sqsubseteq> ys +\<natural> zs \<longleftrightarrow> {x}\<natural> \<sqsubseteq> ys \<and> {x}\<natural> \<sqsubseteq> zs" |
25904 | 299 |
apply (rule iffI) |
300 |
apply (subgoal_tac |
|
26927 | 301 |
"adm (\<lambda>f. f\<cdot>{x}\<natural> \<sqsubseteq> f\<cdot>ys \<and> f\<cdot>{x}\<natural> \<sqsubseteq> f\<cdot>zs)") |
25925 | 302 |
apply (drule admD, rule chain_approx) |
25904 | 303 |
apply (drule_tac f="approx i" in monofun_cfun_arg) |
27289 | 304 |
apply (cut_tac x="approx i\<cdot>x" in compact_basis.compact_imp_principal, simp) |
305 |
apply (cut_tac x="approx i\<cdot>ys" in convex_pd.compact_imp_principal, simp) |
|
306 |
apply (cut_tac x="approx i\<cdot>zs" in convex_pd.compact_imp_principal, simp) |
|
25904 | 307 |
apply (clarify, simp) |
308 |
apply simp |
|
309 |
apply simp |
|
310 |
apply (erule conjE) |
|
26927 | 311 |
apply (subst convex_plus_absorb [of "{x}\<natural>", symmetric]) |
25904 | 312 |
apply (erule (1) monofun_cfun [OF monofun_cfun_arg]) |
313 |
done |
|
314 |
||
315 |
lemma convex_plus_less_unit_iff [simp]: |
|
26927 | 316 |
"xs +\<natural> ys \<sqsubseteq> {z}\<natural> \<longleftrightarrow> xs \<sqsubseteq> {z}\<natural> \<and> ys \<sqsubseteq> {z}\<natural>" |
25904 | 317 |
apply (rule iffI) |
318 |
apply (subgoal_tac |
|
26927 | 319 |
"adm (\<lambda>f. f\<cdot>xs \<sqsubseteq> f\<cdot>{z}\<natural> \<and> f\<cdot>ys \<sqsubseteq> f\<cdot>{z}\<natural>)") |
25925 | 320 |
apply (drule admD, rule chain_approx) |
25904 | 321 |
apply (drule_tac f="approx i" in monofun_cfun_arg) |
27289 | 322 |
apply (cut_tac x="approx i\<cdot>xs" in convex_pd.compact_imp_principal, simp) |
323 |
apply (cut_tac x="approx i\<cdot>ys" in convex_pd.compact_imp_principal, simp) |
|
324 |
apply (cut_tac x="approx i\<cdot>z" in compact_basis.compact_imp_principal, simp) |
|
25904 | 325 |
apply (clarify, simp) |
326 |
apply simp |
|
327 |
apply simp |
|
328 |
apply (erule conjE) |
|
26927 | 329 |
apply (subst convex_plus_absorb [of "{z}\<natural>", symmetric]) |
25904 | 330 |
apply (erule (1) monofun_cfun [OF monofun_cfun_arg]) |
331 |
done |
|
332 |
||
26927 | 333 |
lemma convex_unit_less_iff [simp]: "{x}\<natural> \<sqsubseteq> {y}\<natural> \<longleftrightarrow> x \<sqsubseteq> y" |
334 |
apply (rule iffI) |
|
335 |
apply (rule bifinite_less_ext) |
|
336 |
apply (drule_tac f="approx i" in monofun_cfun_arg, simp) |
|
27289 | 337 |
apply (cut_tac x="approx i\<cdot>x" in compact_basis.compact_imp_principal, simp) |
338 |
apply (cut_tac x="approx i\<cdot>y" in compact_basis.compact_imp_principal, simp) |
|
339 |
apply clarsimp |
|
26927 | 340 |
apply (erule monofun_cfun_arg) |
341 |
done |
|
342 |
||
343 |
lemma convex_unit_eq_iff [simp]: "{x}\<natural> = {y}\<natural> \<longleftrightarrow> x = y" |
|
344 |
unfolding po_eq_conv by simp |
|
345 |
||
346 |
lemma convex_unit_strict [simp]: "{\<bottom>}\<natural> = \<bottom>" |
|
347 |
unfolding inst_convex_pd_pcpo Rep_compact_bot [symmetric] by simp |
|
348 |
||
349 |
lemma convex_unit_strict_iff [simp]: "{x}\<natural> = \<bottom> \<longleftrightarrow> x = \<bottom>" |
|
350 |
unfolding convex_unit_strict [symmetric] by (rule convex_unit_eq_iff) |
|
351 |
||
352 |
lemma compact_convex_unit_iff [simp]: |
|
353 |
"compact {x}\<natural> \<longleftrightarrow> compact x" |
|
354 |
unfolding bifinite_compact_iff by simp |
|
355 |
||
356 |
lemma compact_convex_plus [simp]: |
|
357 |
"\<lbrakk>compact xs; compact ys\<rbrakk> \<Longrightarrow> compact (xs +\<natural> ys)" |
|
27289 | 358 |
by (auto dest!: convex_pd.compact_imp_principal) |
26927 | 359 |
|
25904 | 360 |
|
361 |
subsection {* Induction rules *} |
|
362 |
||
363 |
lemma convex_pd_induct1: |
|
364 |
assumes P: "adm P" |
|
26927 | 365 |
assumes unit: "\<And>x. P {x}\<natural>" |
366 |
assumes insert: "\<And>x ys. \<lbrakk>P {x}\<natural>; P ys\<rbrakk> \<Longrightarrow> P ({x}\<natural> +\<natural> ys)" |
|
25904 | 367 |
shows "P (xs::'a convex_pd)" |
27289 | 368 |
apply (induct xs rule: convex_pd.principal_induct, rule P) |
369 |
apply (induct_tac a rule: pd_basis_induct1) |
|
25904 | 370 |
apply (simp only: convex_unit_Rep_compact_basis [symmetric]) |
371 |
apply (rule unit) |
|
372 |
apply (simp only: convex_unit_Rep_compact_basis [symmetric] |
|
373 |
convex_plus_principal [symmetric]) |
|
374 |
apply (erule insert [OF unit]) |
|
375 |
done |
|
376 |
||
377 |
lemma convex_pd_induct: |
|
378 |
assumes P: "adm P" |
|
26927 | 379 |
assumes unit: "\<And>x. P {x}\<natural>" |
380 |
assumes plus: "\<And>xs ys. \<lbrakk>P xs; P ys\<rbrakk> \<Longrightarrow> P (xs +\<natural> ys)" |
|
25904 | 381 |
shows "P (xs::'a convex_pd)" |
27289 | 382 |
apply (induct xs rule: convex_pd.principal_induct, rule P) |
383 |
apply (induct_tac a rule: pd_basis_induct) |
|
25904 | 384 |
apply (simp only: convex_unit_Rep_compact_basis [symmetric] unit) |
385 |
apply (simp only: convex_plus_principal [symmetric] plus) |
|
386 |
done |
|
387 |
||
388 |
||
389 |
subsection {* Monadic bind *} |
|
390 |
||
391 |
definition |
|
392 |
convex_bind_basis :: |
|
393 |
"'a pd_basis \<Rightarrow> ('a \<rightarrow> 'b convex_pd) \<rightarrow> 'b convex_pd" where |
|
394 |
"convex_bind_basis = fold_pd |
|
395 |
(\<lambda>a. \<Lambda> f. f\<cdot>(Rep_compact_basis a)) |
|
26927 | 396 |
(\<lambda>x y. \<Lambda> f. x\<cdot>f +\<natural> y\<cdot>f)" |
25904 | 397 |
|
26927 | 398 |
lemma ACI_convex_bind: |
399 |
"ab_semigroup_idem_mult (\<lambda>x y. \<Lambda> f. x\<cdot>f +\<natural> y\<cdot>f)" |
|
25904 | 400 |
apply unfold_locales |
26041
c2e15e65165f
locales ACf, ACIf, ACIfSL and ACIfSLlin have been abandoned in favour of the existing algebraic classes ab_semigroup_mult, ab_semigroup_idem_mult, lower_semilattice (resp. uper_semilattice) and linorder
haftmann
parents:
25925
diff
changeset
|
401 |
apply (simp add: convex_plus_assoc) |
25904 | 402 |
apply (simp add: convex_plus_commute) |
403 |
apply (simp add: convex_plus_absorb eta_cfun) |
|
404 |
done |
|
405 |
||
406 |
lemma convex_bind_basis_simps [simp]: |
|
407 |
"convex_bind_basis (PDUnit a) = |
|
408 |
(\<Lambda> f. f\<cdot>(Rep_compact_basis a))" |
|
409 |
"convex_bind_basis (PDPlus t u) = |
|
26927 | 410 |
(\<Lambda> f. convex_bind_basis t\<cdot>f +\<natural> convex_bind_basis u\<cdot>f)" |
25904 | 411 |
unfolding convex_bind_basis_def |
412 |
apply - |
|
26927 | 413 |
apply (rule fold_pd_PDUnit [OF ACI_convex_bind]) |
414 |
apply (rule fold_pd_PDPlus [OF ACI_convex_bind]) |
|
25904 | 415 |
done |
416 |
||
417 |
lemma monofun_LAM: |
|
418 |
"\<lbrakk>cont f; cont g; \<And>x. f x \<sqsubseteq> g x\<rbrakk> \<Longrightarrow> (\<Lambda> x. f x) \<sqsubseteq> (\<Lambda> x. g x)" |
|
419 |
by (simp add: expand_cfun_less) |
|
420 |
||
421 |
lemma convex_bind_basis_mono: |
|
422 |
"t \<le>\<natural> u \<Longrightarrow> convex_bind_basis t \<sqsubseteq> convex_bind_basis u" |
|
423 |
apply (erule convex_le_induct) |
|
424 |
apply (erule (1) trans_less) |
|
27289 | 425 |
apply (simp add: monofun_LAM monofun_cfun) |
426 |
apply (simp add: monofun_LAM monofun_cfun) |
|
25904 | 427 |
done |
428 |
||
429 |
definition |
|
430 |
convex_bind :: "'a convex_pd \<rightarrow> ('a \<rightarrow> 'b convex_pd) \<rightarrow> 'b convex_pd" where |
|
431 |
"convex_bind = convex_pd.basis_fun convex_bind_basis" |
|
432 |
||
433 |
lemma convex_bind_principal [simp]: |
|
434 |
"convex_bind\<cdot>(convex_principal t) = convex_bind_basis t" |
|
435 |
unfolding convex_bind_def |
|
436 |
apply (rule convex_pd.basis_fun_principal) |
|
437 |
apply (erule convex_bind_basis_mono) |
|
438 |
done |
|
439 |
||
440 |
lemma convex_bind_unit [simp]: |
|
26927 | 441 |
"convex_bind\<cdot>{x}\<natural>\<cdot>f = f\<cdot>x" |
27289 | 442 |
by (induct x rule: compact_basis.principal_induct, simp, simp) |
25904 | 443 |
|
444 |
lemma convex_bind_plus [simp]: |
|
26927 | 445 |
"convex_bind\<cdot>(xs +\<natural> ys)\<cdot>f = convex_bind\<cdot>xs\<cdot>f +\<natural> convex_bind\<cdot>ys\<cdot>f" |
27289 | 446 |
by (induct xs ys rule: convex_pd.principal_induct2, simp, simp, simp) |
25904 | 447 |
|
448 |
lemma convex_bind_strict [simp]: "convex_bind\<cdot>\<bottom>\<cdot>f = f\<cdot>\<bottom>" |
|
449 |
unfolding convex_unit_strict [symmetric] by (rule convex_bind_unit) |
|
450 |
||
451 |
||
452 |
subsection {* Map and join *} |
|
453 |
||
454 |
definition |
|
455 |
convex_map :: "('a \<rightarrow> 'b) \<rightarrow> 'a convex_pd \<rightarrow> 'b convex_pd" where |
|
26927 | 456 |
"convex_map = (\<Lambda> f xs. convex_bind\<cdot>xs\<cdot>(\<Lambda> x. {f\<cdot>x}\<natural>))" |
25904 | 457 |
|
458 |
definition |
|
459 |
convex_join :: "'a convex_pd convex_pd \<rightarrow> 'a convex_pd" where |
|
460 |
"convex_join = (\<Lambda> xss. convex_bind\<cdot>xss\<cdot>(\<Lambda> xs. xs))" |
|
461 |
||
462 |
lemma convex_map_unit [simp]: |
|
463 |
"convex_map\<cdot>f\<cdot>(convex_unit\<cdot>x) = convex_unit\<cdot>(f\<cdot>x)" |
|
464 |
unfolding convex_map_def by simp |
|
465 |
||
466 |
lemma convex_map_plus [simp]: |
|
26927 | 467 |
"convex_map\<cdot>f\<cdot>(xs +\<natural> ys) = convex_map\<cdot>f\<cdot>xs +\<natural> convex_map\<cdot>f\<cdot>ys" |
25904 | 468 |
unfolding convex_map_def by simp |
469 |
||
470 |
lemma convex_join_unit [simp]: |
|
26927 | 471 |
"convex_join\<cdot>{xs}\<natural> = xs" |
25904 | 472 |
unfolding convex_join_def by simp |
473 |
||
474 |
lemma convex_join_plus [simp]: |
|
26927 | 475 |
"convex_join\<cdot>(xss +\<natural> yss) = convex_join\<cdot>xss +\<natural> convex_join\<cdot>yss" |
25904 | 476 |
unfolding convex_join_def by simp |
477 |
||
478 |
lemma convex_map_ident: "convex_map\<cdot>(\<Lambda> x. x)\<cdot>xs = xs" |
|
479 |
by (induct xs rule: convex_pd_induct, simp_all) |
|
480 |
||
481 |
lemma convex_map_map: |
|
482 |
"convex_map\<cdot>f\<cdot>(convex_map\<cdot>g\<cdot>xs) = convex_map\<cdot>(\<Lambda> x. f\<cdot>(g\<cdot>x))\<cdot>xs" |
|
483 |
by (induct xs rule: convex_pd_induct, simp_all) |
|
484 |
||
485 |
lemma convex_join_map_unit: |
|
486 |
"convex_join\<cdot>(convex_map\<cdot>convex_unit\<cdot>xs) = xs" |
|
487 |
by (induct xs rule: convex_pd_induct, simp_all) |
|
488 |
||
489 |
lemma convex_join_map_join: |
|
490 |
"convex_join\<cdot>(convex_map\<cdot>convex_join\<cdot>xsss) = convex_join\<cdot>(convex_join\<cdot>xsss)" |
|
491 |
by (induct xsss rule: convex_pd_induct, simp_all) |
|
492 |
||
493 |
lemma convex_join_map_map: |
|
494 |
"convex_join\<cdot>(convex_map\<cdot>(convex_map\<cdot>f)\<cdot>xss) = |
|
495 |
convex_map\<cdot>f\<cdot>(convex_join\<cdot>xss)" |
|
496 |
by (induct xss rule: convex_pd_induct, simp_all) |
|
497 |
||
498 |
lemma convex_map_approx: "convex_map\<cdot>(approx n)\<cdot>xs = approx n\<cdot>xs" |
|
499 |
by (induct xs rule: convex_pd_induct, simp_all) |
|
500 |
||
501 |
||
502 |
subsection {* Conversions to other powerdomains *} |
|
503 |
||
504 |
text {* Convex to upper *} |
|
505 |
||
506 |
lemma convex_le_imp_upper_le: "t \<le>\<natural> u \<Longrightarrow> t \<le>\<sharp> u" |
|
507 |
unfolding convex_le_def by simp |
|
508 |
||
509 |
definition |
|
510 |
convex_to_upper :: "'a convex_pd \<rightarrow> 'a upper_pd" where |
|
511 |
"convex_to_upper = convex_pd.basis_fun upper_principal" |
|
512 |
||
513 |
lemma convex_to_upper_principal [simp]: |
|
514 |
"convex_to_upper\<cdot>(convex_principal t) = upper_principal t" |
|
515 |
unfolding convex_to_upper_def |
|
516 |
apply (rule convex_pd.basis_fun_principal) |
|
27289 | 517 |
apply (rule upper_pd.principal_mono) |
25904 | 518 |
apply (erule convex_le_imp_upper_le) |
519 |
done |
|
520 |
||
521 |
lemma convex_to_upper_unit [simp]: |
|
26927 | 522 |
"convex_to_upper\<cdot>{x}\<natural> = {x}\<sharp>" |
27289 | 523 |
by (induct x rule: compact_basis.principal_induct, simp, simp) |
25904 | 524 |
|
525 |
lemma convex_to_upper_plus [simp]: |
|
26927 | 526 |
"convex_to_upper\<cdot>(xs +\<natural> ys) = convex_to_upper\<cdot>xs +\<sharp> convex_to_upper\<cdot>ys" |
27289 | 527 |
by (induct xs ys rule: convex_pd.principal_induct2, simp, simp, simp) |
25904 | 528 |
|
529 |
lemma approx_convex_to_upper: |
|
530 |
"approx i\<cdot>(convex_to_upper\<cdot>xs) = convex_to_upper\<cdot>(approx i\<cdot>xs)" |
|
531 |
by (induct xs rule: convex_pd_induct, simp, simp, simp) |
|
532 |
||
27289 | 533 |
lemma convex_to_upper_bind [simp]: |
534 |
"convex_to_upper\<cdot>(convex_bind\<cdot>xs\<cdot>f) = |
|
535 |
upper_bind\<cdot>(convex_to_upper\<cdot>xs)\<cdot>(convex_to_upper oo f)" |
|
536 |
by (induct xs rule: convex_pd_induct, simp, simp, simp) |
|
537 |
||
538 |
lemma convex_to_upper_map [simp]: |
|
539 |
"convex_to_upper\<cdot>(convex_map\<cdot>f\<cdot>xs) = upper_map\<cdot>f\<cdot>(convex_to_upper\<cdot>xs)" |
|
540 |
by (simp add: convex_map_def upper_map_def cfcomp_LAM) |
|
541 |
||
542 |
lemma convex_to_upper_join [simp]: |
|
543 |
"convex_to_upper\<cdot>(convex_join\<cdot>xss) = |
|
544 |
upper_bind\<cdot>(convex_to_upper\<cdot>xss)\<cdot>convex_to_upper" |
|
545 |
by (simp add: convex_join_def upper_join_def cfcomp_LAM eta_cfun) |
|
546 |
||
25904 | 547 |
text {* Convex to lower *} |
548 |
||
549 |
lemma convex_le_imp_lower_le: "t \<le>\<natural> u \<Longrightarrow> t \<le>\<flat> u" |
|
550 |
unfolding convex_le_def by simp |
|
551 |
||
552 |
definition |
|
553 |
convex_to_lower :: "'a convex_pd \<rightarrow> 'a lower_pd" where |
|
554 |
"convex_to_lower = convex_pd.basis_fun lower_principal" |
|
555 |
||
556 |
lemma convex_to_lower_principal [simp]: |
|
557 |
"convex_to_lower\<cdot>(convex_principal t) = lower_principal t" |
|
558 |
unfolding convex_to_lower_def |
|
559 |
apply (rule convex_pd.basis_fun_principal) |
|
27289 | 560 |
apply (rule lower_pd.principal_mono) |
25904 | 561 |
apply (erule convex_le_imp_lower_le) |
562 |
done |
|
563 |
||
564 |
lemma convex_to_lower_unit [simp]: |
|
26927 | 565 |
"convex_to_lower\<cdot>{x}\<natural> = {x}\<flat>" |
27289 | 566 |
by (induct x rule: compact_basis.principal_induct, simp, simp) |
25904 | 567 |
|
568 |
lemma convex_to_lower_plus [simp]: |
|
26927 | 569 |
"convex_to_lower\<cdot>(xs +\<natural> ys) = convex_to_lower\<cdot>xs +\<flat> convex_to_lower\<cdot>ys" |
27289 | 570 |
by (induct xs ys rule: convex_pd.principal_induct2, simp, simp, simp) |
25904 | 571 |
|
572 |
lemma approx_convex_to_lower: |
|
573 |
"approx i\<cdot>(convex_to_lower\<cdot>xs) = convex_to_lower\<cdot>(approx i\<cdot>xs)" |
|
574 |
by (induct xs rule: convex_pd_induct, simp, simp, simp) |
|
575 |
||
27289 | 576 |
lemma convex_to_lower_bind [simp]: |
577 |
"convex_to_lower\<cdot>(convex_bind\<cdot>xs\<cdot>f) = |
|
578 |
lower_bind\<cdot>(convex_to_lower\<cdot>xs)\<cdot>(convex_to_lower oo f)" |
|
579 |
by (induct xs rule: convex_pd_induct, simp, simp, simp) |
|
580 |
||
581 |
lemma convex_to_lower_map [simp]: |
|
582 |
"convex_to_lower\<cdot>(convex_map\<cdot>f\<cdot>xs) = lower_map\<cdot>f\<cdot>(convex_to_lower\<cdot>xs)" |
|
583 |
by (simp add: convex_map_def lower_map_def cfcomp_LAM) |
|
584 |
||
585 |
lemma convex_to_lower_join [simp]: |
|
586 |
"convex_to_lower\<cdot>(convex_join\<cdot>xss) = |
|
587 |
lower_bind\<cdot>(convex_to_lower\<cdot>xss)\<cdot>convex_to_lower" |
|
588 |
by (simp add: convex_join_def lower_join_def cfcomp_LAM eta_cfun) |
|
589 |
||
25904 | 590 |
text {* Ordering property *} |
591 |
||
592 |
lemma convex_pd_less_iff: |
|
593 |
"(xs \<sqsubseteq> ys) = |
|
594 |
(convex_to_upper\<cdot>xs \<sqsubseteq> convex_to_upper\<cdot>ys \<and> |
|
595 |
convex_to_lower\<cdot>xs \<sqsubseteq> convex_to_lower\<cdot>ys)" |
|
596 |
apply (safe elim!: monofun_cfun_arg) |
|
597 |
apply (rule bifinite_less_ext) |
|
598 |
apply (drule_tac f="approx i" in monofun_cfun_arg) |
|
599 |
apply (drule_tac f="approx i" in monofun_cfun_arg) |
|
27289 | 600 |
apply (cut_tac x="approx i\<cdot>xs" in convex_pd.compact_imp_principal, simp) |
601 |
apply (cut_tac x="approx i\<cdot>ys" in convex_pd.compact_imp_principal, simp) |
|
25904 | 602 |
apply clarify |
603 |
apply (simp add: approx_convex_to_upper approx_convex_to_lower convex_le_def) |
|
604 |
done |
|
605 |
||
26927 | 606 |
lemmas convex_plus_less_plus_iff = |
607 |
convex_pd_less_iff [where xs="xs +\<natural> ys" and ys="zs +\<natural> ws", standard] |
|
608 |
||
609 |
lemmas convex_pd_less_simps = |
|
610 |
convex_unit_less_plus_iff |
|
611 |
convex_plus_less_unit_iff |
|
612 |
convex_plus_less_plus_iff |
|
613 |
convex_unit_less_iff |
|
614 |
convex_to_upper_unit |
|
615 |
convex_to_upper_plus |
|
616 |
convex_to_lower_unit |
|
617 |
convex_to_lower_plus |
|
618 |
upper_pd_less_simps |
|
619 |
lower_pd_less_simps |
|
620 |
||
25904 | 621 |
end |