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 |
|
|
30 |
lemma PDUnit_convex_mono: "compact_le x y \<Longrightarrow> PDUnit x \<le>\<natural> PDUnit y"
|
|
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]:
|
|
37 |
"(PDUnit a \<le>\<natural> PDUnit b) = compact_le a b"
|
|
38 |
unfolding convex_le_def upper_le_def lower_le_def Rep_PDUnit by fast
|
|
39 |
|
|
40 |
lemma convex_le_PDUnit_lemma1:
|
|
41 |
"(PDUnit a \<le>\<natural> t) = (\<forall>b\<in>Rep_pd_basis t. compact_le a b)"
|
|
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:
|
|
50 |
"(t \<le>\<natural> PDUnit b) = (\<forall>a\<in>Rep_pd_basis t. compact_le a b)"
|
|
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)
|
|
62 |
let ?A = "{b\<in>Rep_pd_basis z. \<exists>a\<in>Rep_pd_basis t. compact_le a b}"
|
|
63 |
let ?B = "{b\<in>Rep_pd_basis z. \<exists>a\<in>Rep_pd_basis u. compact_le a b}"
|
|
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"
|
|
105 |
assumes 3: "\<And>a b. compact_le a b \<Longrightarrow> P (PDUnit a) (PDUnit b)"
|
|
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 |
|
|
120 |
lemma approx_pd_convex_mono1:
|
|
121 |
"i \<le> j \<Longrightarrow> approx_pd i t \<le>\<natural> approx_pd j t"
|
|
122 |
apply (induct t rule: pd_basis_induct)
|
|
123 |
apply (simp add: compact_approx_mono1)
|
|
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)
|
|
129 |
apply (simp add: compact_approx_le)
|
|
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)
|
|
137 |
apply (simp add: compact_approx_mono)
|
|
138 |
apply (simp add: PDPlus_convex_mono)
|
|
139 |
done
|
|
140 |
|
|
141 |
|
|
142 |
subsection {* Type definition *}
|
|
143 |
|
|
144 |
cpodef (open) 'a convex_pd =
|
|
145 |
"{S::'a::bifinite pd_basis set. convex_le.ideal S}"
|
|
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)"
|
|
151 |
by (rule Rep_convex_pd [simplified])
|
|
152 |
|
|
153 |
lemma Rep_convex_pd_mono: "xs \<sqsubseteq> ys \<Longrightarrow> Rep_convex_pd xs \<subseteq> Rep_convex_pd ys"
|
|
154 |
unfolding less_convex_pd_def less_set_def .
|
|
155 |
|
|
156 |
|
|
157 |
subsection {* Principal ideals *}
|
|
158 |
|
|
159 |
definition
|
|
160 |
convex_principal :: "'a pd_basis \<Rightarrow> 'a convex_pd" where
|
|
161 |
"convex_principal t = Abs_convex_pd {u. u \<le>\<natural> t}"
|
|
162 |
|
|
163 |
lemma Rep_convex_principal:
|
|
164 |
"Rep_convex_pd (convex_principal t) = {u. u \<le>\<natural> t}"
|
|
165 |
unfolding convex_principal_def
|
|
166 |
apply (rule Abs_convex_pd_inverse [simplified])
|
|
167 |
apply (rule convex_le.ideal_principal)
|
|
168 |
done
|
|
169 |
|
|
170 |
interpretation convex_pd:
|
|
171 |
bifinite_basis [convex_le convex_principal Rep_convex_pd approx_pd]
|
|
172 |
apply unfold_locales
|
|
173 |
apply (rule ideal_Rep_convex_pd)
|
|
174 |
apply (rule cont_Rep_convex_pd)
|
|
175 |
apply (rule Rep_convex_principal)
|
|
176 |
apply (simp only: less_convex_pd_def less_set_def)
|
|
177 |
apply (rule approx_pd_convex_le)
|
|
178 |
apply (rule approx_pd_idem)
|
|
179 |
apply (erule approx_pd_convex_mono)
|
|
180 |
apply (rule approx_pd_convex_mono1, simp)
|
|
181 |
apply (rule finite_range_approx_pd)
|
|
182 |
apply (rule ex_approx_pd_eq)
|
|
183 |
done
|
|
184 |
|
|
185 |
lemma convex_principal_less_iff [simp]:
|
|
186 |
"(convex_principal t \<sqsubseteq> convex_principal u) = (t \<le>\<natural> u)"
|
|
187 |
unfolding less_convex_pd_def Rep_convex_principal less_set_def
|
|
188 |
by (fast intro: convex_le_refl elim: convex_le_trans)
|
|
189 |
|
|
190 |
lemma convex_principal_mono:
|
|
191 |
"t \<le>\<natural> u \<Longrightarrow> convex_principal t \<sqsubseteq> convex_principal u"
|
|
192 |
by (rule convex_principal_less_iff [THEN iffD2])
|
|
193 |
|
|
194 |
lemma compact_convex_principal: "compact (convex_principal t)"
|
|
195 |
by (rule convex_pd.compact_principal)
|
|
196 |
|
|
197 |
lemma convex_pd_minimal: "convex_principal (PDUnit compact_bot) \<sqsubseteq> ys"
|
|
198 |
by (induct ys rule: convex_pd.principal_induct, simp, simp)
|
|
199 |
|
|
200 |
instance convex_pd :: (bifinite) pcpo
|
|
201 |
by (intro_classes, fast intro: convex_pd_minimal)
|
|
202 |
|
|
203 |
lemma inst_convex_pd_pcpo: "\<bottom> = convex_principal (PDUnit compact_bot)"
|
|
204 |
by (rule convex_pd_minimal [THEN UU_I, symmetric])
|
|
205 |
|
|
206 |
|
|
207 |
subsection {* Approximation *}
|
|
208 |
|
|
209 |
instance convex_pd :: (bifinite) approx ..
|
|
210 |
|
|
211 |
defs (overloaded)
|
|
212 |
approx_convex_pd_def:
|
|
213 |
"approx \<equiv> (\<lambda>n. convex_pd.basis_fun (\<lambda>t. convex_principal (approx_pd n t)))"
|
|
214 |
|
|
215 |
lemma approx_convex_principal [simp]:
|
|
216 |
"approx n\<cdot>(convex_principal t) = convex_principal (approx_pd n t)"
|
|
217 |
unfolding approx_convex_pd_def
|
|
218 |
apply (rule convex_pd.basis_fun_principal)
|
|
219 |
apply (erule convex_principal_mono [OF approx_pd_convex_mono])
|
|
220 |
done
|
|
221 |
|
|
222 |
lemma chain_approx_convex_pd:
|
|
223 |
"chain (approx :: nat \<Rightarrow> 'a convex_pd \<rightarrow> 'a convex_pd)"
|
|
224 |
unfolding approx_convex_pd_def
|
|
225 |
by (rule convex_pd.chain_basis_fun_take)
|
|
226 |
|
|
227 |
lemma lub_approx_convex_pd:
|
|
228 |
"(\<Squnion>i. approx i\<cdot>xs) = (xs::'a convex_pd)"
|
|
229 |
unfolding approx_convex_pd_def
|
|
230 |
by (rule convex_pd.lub_basis_fun_take)
|
|
231 |
|
|
232 |
lemma approx_convex_pd_idem:
|
|
233 |
"approx n\<cdot>(approx n\<cdot>xs) = approx n\<cdot>(xs::'a convex_pd)"
|
|
234 |
apply (induct xs rule: convex_pd.principal_induct, simp)
|
|
235 |
apply (simp add: approx_pd_idem)
|
|
236 |
done
|
|
237 |
|
|
238 |
lemma approx_eq_convex_principal:
|
|
239 |
"\<exists>t\<in>Rep_convex_pd xs. approx n\<cdot>xs = convex_principal (approx_pd n t)"
|
|
240 |
unfolding approx_convex_pd_def
|
|
241 |
by (rule convex_pd.basis_fun_take_eq_principal)
|
|
242 |
|
|
243 |
lemma finite_fixes_approx_convex_pd:
|
|
244 |
"finite {xs::'a convex_pd. approx n\<cdot>xs = xs}"
|
|
245 |
unfolding approx_convex_pd_def
|
|
246 |
by (rule convex_pd.finite_fixes_basis_fun_take)
|
|
247 |
|
|
248 |
instance convex_pd :: (bifinite) bifinite
|
|
249 |
apply intro_classes
|
|
250 |
apply (simp add: chain_approx_convex_pd)
|
|
251 |
apply (rule lub_approx_convex_pd)
|
|
252 |
apply (rule approx_convex_pd_idem)
|
|
253 |
apply (rule finite_fixes_approx_convex_pd)
|
|
254 |
done
|
|
255 |
|
|
256 |
lemma compact_imp_convex_principal:
|
|
257 |
"compact xs \<Longrightarrow> \<exists>t. xs = convex_principal t"
|
|
258 |
apply (drule bifinite_compact_eq_approx)
|
|
259 |
apply (erule exE)
|
|
260 |
apply (erule subst)
|
|
261 |
apply (cut_tac n=i and xs=xs in approx_eq_convex_principal)
|
|
262 |
apply fast
|
|
263 |
done
|
|
264 |
|
|
265 |
lemma convex_principal_induct:
|
|
266 |
"\<lbrakk>adm P; \<And>t. P (convex_principal t)\<rbrakk> \<Longrightarrow> P xs"
|
|
267 |
apply (erule approx_induct, rename_tac xs)
|
|
268 |
apply (cut_tac n=n and xs=xs in approx_eq_convex_principal)
|
|
269 |
apply (clarify, simp)
|
|
270 |
done
|
|
271 |
|
|
272 |
lemma convex_principal_induct2:
|
|
273 |
"\<lbrakk>\<And>ys. adm (\<lambda>xs. P xs ys); \<And>xs. adm (\<lambda>ys. P xs ys);
|
|
274 |
\<And>t u. P (convex_principal t) (convex_principal u)\<rbrakk> \<Longrightarrow> P xs ys"
|
|
275 |
apply (rule_tac x=ys in spec)
|
|
276 |
apply (rule_tac xs=xs in convex_principal_induct, simp)
|
|
277 |
apply (rule allI, rename_tac ys)
|
|
278 |
apply (rule_tac xs=ys in convex_principal_induct, simp)
|
|
279 |
apply simp
|
|
280 |
done
|
|
281 |
|
|
282 |
|
|
283 |
subsection {* Monadic unit *}
|
|
284 |
|
|
285 |
definition
|
|
286 |
convex_unit :: "'a \<rightarrow> 'a convex_pd" where
|
|
287 |
"convex_unit = compact_basis.basis_fun (\<lambda>a. convex_principal (PDUnit a))"
|
|
288 |
|
|
289 |
lemma convex_unit_Rep_compact_basis [simp]:
|
|
290 |
"convex_unit\<cdot>(Rep_compact_basis a) = convex_principal (PDUnit a)"
|
|
291 |
unfolding convex_unit_def
|
|
292 |
apply (rule compact_basis.basis_fun_principal)
|
|
293 |
apply (rule convex_principal_mono)
|
|
294 |
apply (erule PDUnit_convex_mono)
|
|
295 |
done
|
|
296 |
|
|
297 |
lemma convex_unit_strict [simp]: "convex_unit\<cdot>\<bottom> = \<bottom>"
|
|
298 |
unfolding inst_convex_pd_pcpo Rep_compact_bot [symmetric] by simp
|
|
299 |
|
|
300 |
lemma approx_convex_unit [simp]:
|
|
301 |
"approx n\<cdot>(convex_unit\<cdot>x) = convex_unit\<cdot>(approx n\<cdot>x)"
|
|
302 |
apply (induct x rule: compact_basis_induct, simp)
|
|
303 |
apply (simp add: approx_Rep_compact_basis)
|
|
304 |
done
|
|
305 |
|
|
306 |
lemma convex_unit_less_iff [simp]:
|
|
307 |
"(convex_unit\<cdot>x \<sqsubseteq> convex_unit\<cdot>y) = (x \<sqsubseteq> y)"
|
|
308 |
apply (rule iffI)
|
|
309 |
apply (rule bifinite_less_ext)
|
|
310 |
apply (drule_tac f="approx i" in monofun_cfun_arg, simp)
|
|
311 |
apply (cut_tac x="approx i\<cdot>x" in compact_imp_Rep_compact_basis, simp)
|
|
312 |
apply (cut_tac x="approx i\<cdot>y" in compact_imp_Rep_compact_basis, simp)
|
|
313 |
apply (clarify, simp add: compact_le_def)
|
|
314 |
apply (erule monofun_cfun_arg)
|
|
315 |
done
|
|
316 |
|
|
317 |
lemma convex_unit_eq_iff [simp]:
|
|
318 |
"(convex_unit\<cdot>x = convex_unit\<cdot>y) = (x = y)"
|
|
319 |
unfolding po_eq_conv by simp
|
|
320 |
|
|
321 |
lemma convex_unit_strict_iff [simp]: "(convex_unit\<cdot>x = \<bottom>) = (x = \<bottom>)"
|
|
322 |
unfolding convex_unit_strict [symmetric] by (rule convex_unit_eq_iff)
|
|
323 |
|
|
324 |
lemma compact_convex_unit_iff [simp]:
|
|
325 |
"compact (convex_unit\<cdot>x) = compact x"
|
|
326 |
unfolding bifinite_compact_iff by simp
|
|
327 |
|
|
328 |
|
|
329 |
subsection {* Monadic plus *}
|
|
330 |
|
|
331 |
definition
|
|
332 |
convex_plus :: "'a convex_pd \<rightarrow> 'a convex_pd \<rightarrow> 'a convex_pd" where
|
|
333 |
"convex_plus = convex_pd.basis_fun (\<lambda>t. convex_pd.basis_fun (\<lambda>u.
|
|
334 |
convex_principal (PDPlus t u)))"
|
|
335 |
|
|
336 |
abbreviation
|
|
337 |
convex_add :: "'a convex_pd \<Rightarrow> 'a convex_pd \<Rightarrow> 'a convex_pd"
|
|
338 |
(infixl "+\<natural>" 65) where
|
|
339 |
"xs +\<natural> ys == convex_plus\<cdot>xs\<cdot>ys"
|
|
340 |
|
|
341 |
lemma convex_plus_principal [simp]:
|
|
342 |
"convex_plus\<cdot>(convex_principal t)\<cdot>(convex_principal u) =
|
|
343 |
convex_principal (PDPlus t u)"
|
|
344 |
unfolding convex_plus_def
|
|
345 |
by (simp add: convex_pd.basis_fun_principal
|
|
346 |
convex_pd.basis_fun_mono PDPlus_convex_mono)
|
|
347 |
|
|
348 |
lemma approx_convex_plus [simp]:
|
|
349 |
"approx n\<cdot>(convex_plus\<cdot>xs\<cdot>ys) = convex_plus\<cdot>(approx n\<cdot>xs)\<cdot>(approx n\<cdot>ys)"
|
|
350 |
by (induct xs ys rule: convex_principal_induct2, simp, simp, simp)
|
|
351 |
|
|
352 |
lemma convex_plus_commute: "convex_plus\<cdot>xs\<cdot>ys = convex_plus\<cdot>ys\<cdot>xs"
|
|
353 |
apply (induct xs ys rule: convex_principal_induct2, simp, simp)
|
|
354 |
apply (simp add: PDPlus_commute)
|
|
355 |
done
|
|
356 |
|
|
357 |
lemma convex_plus_assoc:
|
|
358 |
"convex_plus\<cdot>(convex_plus\<cdot>xs\<cdot>ys)\<cdot>zs = convex_plus\<cdot>xs\<cdot>(convex_plus\<cdot>ys\<cdot>zs)"
|
|
359 |
apply (induct xs ys arbitrary: zs rule: convex_principal_induct2, simp, simp)
|
|
360 |
apply (rule_tac xs=zs in convex_principal_induct, simp)
|
|
361 |
apply (simp add: PDPlus_assoc)
|
|
362 |
done
|
|
363 |
|
|
364 |
lemma convex_plus_absorb: "convex_plus\<cdot>xs\<cdot>xs = xs"
|
|
365 |
apply (induct xs rule: convex_principal_induct, simp)
|
|
366 |
apply (simp add: PDPlus_absorb)
|
|
367 |
done
|
|
368 |
|
|
369 |
lemma convex_unit_less_plus_iff [simp]:
|
|
370 |
"(convex_unit\<cdot>x \<sqsubseteq> convex_plus\<cdot>ys\<cdot>zs) =
|
|
371 |
(convex_unit\<cdot>x \<sqsubseteq> ys \<and> convex_unit\<cdot>x \<sqsubseteq> zs)"
|
|
372 |
apply (rule iffI)
|
|
373 |
apply (subgoal_tac
|
|
374 |
"adm (\<lambda>f. f\<cdot>(convex_unit\<cdot>x) \<sqsubseteq> f\<cdot>ys \<and> f\<cdot>(convex_unit\<cdot>x) \<sqsubseteq> f\<cdot>zs)")
|
25925
|
375 |
apply (drule admD, rule chain_approx)
|
25904
|
376 |
apply (drule_tac f="approx i" in monofun_cfun_arg)
|
|
377 |
apply (cut_tac x="approx i\<cdot>x" in compact_imp_Rep_compact_basis, simp)
|
|
378 |
apply (cut_tac xs="approx i\<cdot>ys" in compact_imp_convex_principal, simp)
|
|
379 |
apply (cut_tac xs="approx i\<cdot>zs" in compact_imp_convex_principal, simp)
|
|
380 |
apply (clarify, simp)
|
|
381 |
apply simp
|
|
382 |
apply simp
|
|
383 |
apply (erule conjE)
|
|
384 |
apply (subst convex_plus_absorb [of "convex_unit\<cdot>x", symmetric])
|
|
385 |
apply (erule (1) monofun_cfun [OF monofun_cfun_arg])
|
|
386 |
done
|
|
387 |
|
|
388 |
lemma convex_plus_less_unit_iff [simp]:
|
|
389 |
"(convex_plus\<cdot>xs\<cdot>ys \<sqsubseteq> convex_unit\<cdot>z) =
|
|
390 |
(xs \<sqsubseteq> convex_unit\<cdot>z \<and> ys \<sqsubseteq> convex_unit\<cdot>z)"
|
|
391 |
apply (rule iffI)
|
|
392 |
apply (subgoal_tac
|
|
393 |
"adm (\<lambda>f. f\<cdot>xs \<sqsubseteq> f\<cdot>(convex_unit\<cdot>z) \<and> f\<cdot>ys \<sqsubseteq> f\<cdot>(convex_unit\<cdot>z))")
|
25925
|
394 |
apply (drule admD, rule chain_approx)
|
25904
|
395 |
apply (drule_tac f="approx i" in monofun_cfun_arg)
|
|
396 |
apply (cut_tac xs="approx i\<cdot>xs" in compact_imp_convex_principal, simp)
|
|
397 |
apply (cut_tac xs="approx i\<cdot>ys" in compact_imp_convex_principal, simp)
|
|
398 |
apply (cut_tac x="approx i\<cdot>z" in compact_imp_Rep_compact_basis, simp)
|
|
399 |
apply (clarify, simp)
|
|
400 |
apply simp
|
|
401 |
apply simp
|
|
402 |
apply (erule conjE)
|
|
403 |
apply (subst convex_plus_absorb [of "convex_unit\<cdot>z", symmetric])
|
|
404 |
apply (erule (1) monofun_cfun [OF monofun_cfun_arg])
|
|
405 |
done
|
|
406 |
|
|
407 |
|
|
408 |
subsection {* Induction rules *}
|
|
409 |
|
|
410 |
lemma convex_pd_induct1:
|
|
411 |
assumes P: "adm P"
|
|
412 |
assumes unit: "\<And>x. P (convex_unit\<cdot>x)"
|
|
413 |
assumes insert:
|
|
414 |
"\<And>x ys. \<lbrakk>P (convex_unit\<cdot>x); P ys\<rbrakk> \<Longrightarrow> P (convex_plus\<cdot>(convex_unit\<cdot>x)\<cdot>ys)"
|
|
415 |
shows "P (xs::'a convex_pd)"
|
|
416 |
apply (induct xs rule: convex_principal_induct, rule P)
|
|
417 |
apply (induct_tac t rule: pd_basis_induct1)
|
|
418 |
apply (simp only: convex_unit_Rep_compact_basis [symmetric])
|
|
419 |
apply (rule unit)
|
|
420 |
apply (simp only: convex_unit_Rep_compact_basis [symmetric]
|
|
421 |
convex_plus_principal [symmetric])
|
|
422 |
apply (erule insert [OF unit])
|
|
423 |
done
|
|
424 |
|
|
425 |
lemma convex_pd_induct:
|
|
426 |
assumes P: "adm P"
|
|
427 |
assumes unit: "\<And>x. P (convex_unit\<cdot>x)"
|
|
428 |
assumes plus: "\<And>xs ys. \<lbrakk>P xs; P ys\<rbrakk> \<Longrightarrow> P (convex_plus\<cdot>xs\<cdot>ys)"
|
|
429 |
shows "P (xs::'a convex_pd)"
|
|
430 |
apply (induct xs rule: convex_principal_induct, rule P)
|
|
431 |
apply (induct_tac t rule: pd_basis_induct)
|
|
432 |
apply (simp only: convex_unit_Rep_compact_basis [symmetric] unit)
|
|
433 |
apply (simp only: convex_plus_principal [symmetric] plus)
|
|
434 |
done
|
|
435 |
|
|
436 |
|
|
437 |
subsection {* Monadic bind *}
|
|
438 |
|
|
439 |
definition
|
|
440 |
convex_bind_basis ::
|
|
441 |
"'a pd_basis \<Rightarrow> ('a \<rightarrow> 'b convex_pd) \<rightarrow> 'b convex_pd" where
|
|
442 |
"convex_bind_basis = fold_pd
|
|
443 |
(\<lambda>a. \<Lambda> f. f\<cdot>(Rep_compact_basis a))
|
|
444 |
(\<lambda>x y. \<Lambda> f. convex_plus\<cdot>(x\<cdot>f)\<cdot>(y\<cdot>f))"
|
|
445 |
|
|
446 |
lemma ACI_convex_bind: "ACIf (\<lambda>x y. \<Lambda> f. convex_plus\<cdot>(x\<cdot>f)\<cdot>(y\<cdot>f))"
|
|
447 |
apply unfold_locales
|
|
448 |
apply (simp add: convex_plus_commute)
|
|
449 |
apply (simp add: convex_plus_assoc)
|
|
450 |
apply (simp add: convex_plus_absorb eta_cfun)
|
|
451 |
done
|
|
452 |
|
|
453 |
lemma convex_bind_basis_simps [simp]:
|
|
454 |
"convex_bind_basis (PDUnit a) =
|
|
455 |
(\<Lambda> f. f\<cdot>(Rep_compact_basis a))"
|
|
456 |
"convex_bind_basis (PDPlus t u) =
|
|
457 |
(\<Lambda> f. convex_plus\<cdot>(convex_bind_basis t\<cdot>f)\<cdot>(convex_bind_basis u\<cdot>f))"
|
|
458 |
unfolding convex_bind_basis_def
|
|
459 |
apply -
|
|
460 |
apply (rule ACIf.fold_pd_PDUnit [OF ACI_convex_bind])
|
|
461 |
apply (rule ACIf.fold_pd_PDPlus [OF ACI_convex_bind])
|
|
462 |
done
|
|
463 |
|
|
464 |
lemma monofun_LAM:
|
|
465 |
"\<lbrakk>cont f; cont g; \<And>x. f x \<sqsubseteq> g x\<rbrakk> \<Longrightarrow> (\<Lambda> x. f x) \<sqsubseteq> (\<Lambda> x. g x)"
|
|
466 |
by (simp add: expand_cfun_less)
|
|
467 |
|
|
468 |
lemma convex_bind_basis_mono:
|
|
469 |
"t \<le>\<natural> u \<Longrightarrow> convex_bind_basis t \<sqsubseteq> convex_bind_basis u"
|
|
470 |
apply (erule convex_le_induct)
|
|
471 |
apply (erule (1) trans_less)
|
|
472 |
apply (simp add: monofun_LAM compact_le_def monofun_cfun)
|
|
473 |
apply (simp add: monofun_LAM compact_le_def monofun_cfun)
|
|
474 |
done
|
|
475 |
|
|
476 |
definition
|
|
477 |
convex_bind :: "'a convex_pd \<rightarrow> ('a \<rightarrow> 'b convex_pd) \<rightarrow> 'b convex_pd" where
|
|
478 |
"convex_bind = convex_pd.basis_fun convex_bind_basis"
|
|
479 |
|
|
480 |
lemma convex_bind_principal [simp]:
|
|
481 |
"convex_bind\<cdot>(convex_principal t) = convex_bind_basis t"
|
|
482 |
unfolding convex_bind_def
|
|
483 |
apply (rule convex_pd.basis_fun_principal)
|
|
484 |
apply (erule convex_bind_basis_mono)
|
|
485 |
done
|
|
486 |
|
|
487 |
lemma convex_bind_unit [simp]:
|
|
488 |
"convex_bind\<cdot>(convex_unit\<cdot>x)\<cdot>f = f\<cdot>x"
|
|
489 |
by (induct x rule: compact_basis_induct, simp, simp)
|
|
490 |
|
|
491 |
lemma convex_bind_plus [simp]:
|
|
492 |
"convex_bind\<cdot>(convex_plus\<cdot>xs\<cdot>ys)\<cdot>f =
|
|
493 |
convex_plus\<cdot>(convex_bind\<cdot>xs\<cdot>f)\<cdot>(convex_bind\<cdot>ys\<cdot>f)"
|
|
494 |
by (induct xs ys rule: convex_principal_induct2, simp, simp, simp)
|
|
495 |
|
|
496 |
lemma convex_bind_strict [simp]: "convex_bind\<cdot>\<bottom>\<cdot>f = f\<cdot>\<bottom>"
|
|
497 |
unfolding convex_unit_strict [symmetric] by (rule convex_bind_unit)
|
|
498 |
|
|
499 |
|
|
500 |
subsection {* Map and join *}
|
|
501 |
|
|
502 |
definition
|
|
503 |
convex_map :: "('a \<rightarrow> 'b) \<rightarrow> 'a convex_pd \<rightarrow> 'b convex_pd" where
|
|
504 |
"convex_map = (\<Lambda> f xs. convex_bind\<cdot>xs\<cdot>(\<Lambda> x. convex_unit\<cdot>(f\<cdot>x)))"
|
|
505 |
|
|
506 |
definition
|
|
507 |
convex_join :: "'a convex_pd convex_pd \<rightarrow> 'a convex_pd" where
|
|
508 |
"convex_join = (\<Lambda> xss. convex_bind\<cdot>xss\<cdot>(\<Lambda> xs. xs))"
|
|
509 |
|
|
510 |
lemma convex_map_unit [simp]:
|
|
511 |
"convex_map\<cdot>f\<cdot>(convex_unit\<cdot>x) = convex_unit\<cdot>(f\<cdot>x)"
|
|
512 |
unfolding convex_map_def by simp
|
|
513 |
|
|
514 |
lemma convex_map_plus [simp]:
|
|
515 |
"convex_map\<cdot>f\<cdot>(convex_plus\<cdot>xs\<cdot>ys) =
|
|
516 |
convex_plus\<cdot>(convex_map\<cdot>f\<cdot>xs)\<cdot>(convex_map\<cdot>f\<cdot>ys)"
|
|
517 |
unfolding convex_map_def by simp
|
|
518 |
|
|
519 |
lemma convex_join_unit [simp]:
|
|
520 |
"convex_join\<cdot>(convex_unit\<cdot>xs) = xs"
|
|
521 |
unfolding convex_join_def by simp
|
|
522 |
|
|
523 |
lemma convex_join_plus [simp]:
|
|
524 |
"convex_join\<cdot>(convex_plus\<cdot>xss\<cdot>yss) =
|
|
525 |
convex_plus\<cdot>(convex_join\<cdot>xss)\<cdot>(convex_join\<cdot>yss)"
|
|
526 |
unfolding convex_join_def by simp
|
|
527 |
|
|
528 |
lemma convex_map_ident: "convex_map\<cdot>(\<Lambda> x. x)\<cdot>xs = xs"
|
|
529 |
by (induct xs rule: convex_pd_induct, simp_all)
|
|
530 |
|
|
531 |
lemma convex_map_map:
|
|
532 |
"convex_map\<cdot>f\<cdot>(convex_map\<cdot>g\<cdot>xs) = convex_map\<cdot>(\<Lambda> x. f\<cdot>(g\<cdot>x))\<cdot>xs"
|
|
533 |
by (induct xs rule: convex_pd_induct, simp_all)
|
|
534 |
|
|
535 |
lemma convex_join_map_unit:
|
|
536 |
"convex_join\<cdot>(convex_map\<cdot>convex_unit\<cdot>xs) = xs"
|
|
537 |
by (induct xs rule: convex_pd_induct, simp_all)
|
|
538 |
|
|
539 |
lemma convex_join_map_join:
|
|
540 |
"convex_join\<cdot>(convex_map\<cdot>convex_join\<cdot>xsss) = convex_join\<cdot>(convex_join\<cdot>xsss)"
|
|
541 |
by (induct xsss rule: convex_pd_induct, simp_all)
|
|
542 |
|
|
543 |
lemma convex_join_map_map:
|
|
544 |
"convex_join\<cdot>(convex_map\<cdot>(convex_map\<cdot>f)\<cdot>xss) =
|
|
545 |
convex_map\<cdot>f\<cdot>(convex_join\<cdot>xss)"
|
|
546 |
by (induct xss rule: convex_pd_induct, simp_all)
|
|
547 |
|
|
548 |
lemma convex_map_approx: "convex_map\<cdot>(approx n)\<cdot>xs = approx n\<cdot>xs"
|
|
549 |
by (induct xs rule: convex_pd_induct, simp_all)
|
|
550 |
|
|
551 |
|
|
552 |
subsection {* Conversions to other powerdomains *}
|
|
553 |
|
|
554 |
text {* Convex to upper *}
|
|
555 |
|
|
556 |
lemma convex_le_imp_upper_le: "t \<le>\<natural> u \<Longrightarrow> t \<le>\<sharp> u"
|
|
557 |
unfolding convex_le_def by simp
|
|
558 |
|
|
559 |
definition
|
|
560 |
convex_to_upper :: "'a convex_pd \<rightarrow> 'a upper_pd" where
|
|
561 |
"convex_to_upper = convex_pd.basis_fun upper_principal"
|
|
562 |
|
|
563 |
lemma convex_to_upper_principal [simp]:
|
|
564 |
"convex_to_upper\<cdot>(convex_principal t) = upper_principal t"
|
|
565 |
unfolding convex_to_upper_def
|
|
566 |
apply (rule convex_pd.basis_fun_principal)
|
|
567 |
apply (rule upper_principal_mono)
|
|
568 |
apply (erule convex_le_imp_upper_le)
|
|
569 |
done
|
|
570 |
|
|
571 |
lemma convex_to_upper_unit [simp]:
|
|
572 |
"convex_to_upper\<cdot>(convex_unit\<cdot>x) = upper_unit\<cdot>x"
|
|
573 |
by (induct x rule: compact_basis_induct, simp, simp)
|
|
574 |
|
|
575 |
lemma convex_to_upper_plus [simp]:
|
|
576 |
"convex_to_upper\<cdot>(convex_plus\<cdot>xs\<cdot>ys) =
|
|
577 |
upper_plus\<cdot>(convex_to_upper\<cdot>xs)\<cdot>(convex_to_upper\<cdot>ys)"
|
|
578 |
by (induct xs ys rule: convex_principal_induct2, simp, simp, simp)
|
|
579 |
|
|
580 |
lemma approx_convex_to_upper:
|
|
581 |
"approx i\<cdot>(convex_to_upper\<cdot>xs) = convex_to_upper\<cdot>(approx i\<cdot>xs)"
|
|
582 |
by (induct xs rule: convex_pd_induct, simp, simp, simp)
|
|
583 |
|
|
584 |
text {* Convex to lower *}
|
|
585 |
|
|
586 |
lemma convex_le_imp_lower_le: "t \<le>\<natural> u \<Longrightarrow> t \<le>\<flat> u"
|
|
587 |
unfolding convex_le_def by simp
|
|
588 |
|
|
589 |
definition
|
|
590 |
convex_to_lower :: "'a convex_pd \<rightarrow> 'a lower_pd" where
|
|
591 |
"convex_to_lower = convex_pd.basis_fun lower_principal"
|
|
592 |
|
|
593 |
lemma convex_to_lower_principal [simp]:
|
|
594 |
"convex_to_lower\<cdot>(convex_principal t) = lower_principal t"
|
|
595 |
unfolding convex_to_lower_def
|
|
596 |
apply (rule convex_pd.basis_fun_principal)
|
|
597 |
apply (rule lower_principal_mono)
|
|
598 |
apply (erule convex_le_imp_lower_le)
|
|
599 |
done
|
|
600 |
|
|
601 |
lemma convex_to_lower_unit [simp]:
|
|
602 |
"convex_to_lower\<cdot>(convex_unit\<cdot>x) = lower_unit\<cdot>x"
|
|
603 |
by (induct x rule: compact_basis_induct, simp, simp)
|
|
604 |
|
|
605 |
lemma convex_to_lower_plus [simp]:
|
|
606 |
"convex_to_lower\<cdot>(convex_plus\<cdot>xs\<cdot>ys) =
|
|
607 |
lower_plus\<cdot>(convex_to_lower\<cdot>xs)\<cdot>(convex_to_lower\<cdot>ys)"
|
|
608 |
by (induct xs ys rule: convex_principal_induct2, simp, simp, simp)
|
|
609 |
|
|
610 |
lemma approx_convex_to_lower:
|
|
611 |
"approx i\<cdot>(convex_to_lower\<cdot>xs) = convex_to_lower\<cdot>(approx i\<cdot>xs)"
|
|
612 |
by (induct xs rule: convex_pd_induct, simp, simp, simp)
|
|
613 |
|
|
614 |
text {* Ordering property *}
|
|
615 |
|
|
616 |
lemma convex_pd_less_iff:
|
|
617 |
"(xs \<sqsubseteq> ys) =
|
|
618 |
(convex_to_upper\<cdot>xs \<sqsubseteq> convex_to_upper\<cdot>ys \<and>
|
|
619 |
convex_to_lower\<cdot>xs \<sqsubseteq> convex_to_lower\<cdot>ys)"
|
|
620 |
apply (safe elim!: monofun_cfun_arg)
|
|
621 |
apply (rule bifinite_less_ext)
|
|
622 |
apply (drule_tac f="approx i" in monofun_cfun_arg)
|
|
623 |
apply (drule_tac f="approx i" in monofun_cfun_arg)
|
|
624 |
apply (cut_tac xs="approx i\<cdot>xs" in compact_imp_convex_principal, simp)
|
|
625 |
apply (cut_tac xs="approx i\<cdot>ys" in compact_imp_convex_principal, simp)
|
|
626 |
apply clarify
|
|
627 |
apply (simp add: approx_convex_to_upper approx_convex_to_lower convex_le_def)
|
|
628 |
done
|
|
629 |
|
|
630 |
end
|