author | huffman |
Wed, 26 Mar 2008 22:38:17 +0100 | |
changeset 26407 | 562a1d615336 |
parent 26041 | c2e15e65165f |
child 26420 | 57a626f64875 |
permissions | -rw-r--r-- |
25904 | 1 |
(* Title: HOLCF/LowerPD.thy |
2 |
ID: $Id$ |
|
3 |
Author: Brian Huffman |
|
4 |
*) |
|
5 |
||
6 |
header {* Lower powerdomain *} |
|
7 |
||
8 |
theory LowerPD |
|
9 |
imports CompactBasis |
|
10 |
begin |
|
11 |
||
12 |
subsection {* Basis preorder *} |
|
13 |
||
14 |
definition |
|
15 |
lower_le :: "'a pd_basis \<Rightarrow> 'a pd_basis \<Rightarrow> bool" (infix "\<le>\<flat>" 50) where |
|
16 |
"lower_le = (\<lambda>u v. \<forall>x\<in>Rep_pd_basis u. \<exists>y\<in>Rep_pd_basis v. compact_le x y)" |
|
17 |
||
18 |
lemma lower_le_refl [simp]: "t \<le>\<flat> t" |
|
19 |
unfolding lower_le_def by (fast intro: compact_le_refl) |
|
20 |
||
21 |
lemma lower_le_trans: "\<lbrakk>t \<le>\<flat> u; u \<le>\<flat> v\<rbrakk> \<Longrightarrow> t \<le>\<flat> v" |
|
22 |
unfolding lower_le_def |
|
23 |
apply (rule ballI) |
|
24 |
apply (drule (1) bspec, erule bexE) |
|
25 |
apply (drule (1) bspec, erule bexE) |
|
26 |
apply (erule rev_bexI) |
|
27 |
apply (erule (1) compact_le_trans) |
|
28 |
done |
|
29 |
||
30 |
interpretation lower_le: preorder [lower_le] |
|
31 |
by (rule preorder.intro, rule lower_le_refl, rule lower_le_trans) |
|
32 |
||
33 |
lemma lower_le_minimal [simp]: "PDUnit compact_bot \<le>\<flat> t" |
|
34 |
unfolding lower_le_def Rep_PDUnit |
|
35 |
by (simp, rule Rep_pd_basis_nonempty [folded ex_in_conv]) |
|
36 |
||
37 |
lemma PDUnit_lower_mono: "compact_le x y \<Longrightarrow> PDUnit x \<le>\<flat> PDUnit y" |
|
38 |
unfolding lower_le_def Rep_PDUnit by fast |
|
39 |
||
40 |
lemma PDPlus_lower_mono: "\<lbrakk>s \<le>\<flat> t; u \<le>\<flat> v\<rbrakk> \<Longrightarrow> PDPlus s u \<le>\<flat> PDPlus t v" |
|
41 |
unfolding lower_le_def Rep_PDPlus by fast |
|
42 |
||
43 |
lemma PDPlus_lower_less: "t \<le>\<flat> PDPlus t u" |
|
44 |
unfolding lower_le_def Rep_PDPlus by (fast intro: compact_le_refl) |
|
45 |
||
46 |
lemma lower_le_PDUnit_PDUnit_iff [simp]: |
|
47 |
"(PDUnit a \<le>\<flat> PDUnit b) = compact_le a b" |
|
48 |
unfolding lower_le_def Rep_PDUnit by fast |
|
49 |
||
50 |
lemma lower_le_PDUnit_PDPlus_iff: |
|
51 |
"(PDUnit a \<le>\<flat> PDPlus t u) = (PDUnit a \<le>\<flat> t \<or> PDUnit a \<le>\<flat> u)" |
|
52 |
unfolding lower_le_def Rep_PDPlus Rep_PDUnit by fast |
|
53 |
||
54 |
lemma lower_le_PDPlus_iff: "(PDPlus t u \<le>\<flat> v) = (t \<le>\<flat> v \<and> u \<le>\<flat> v)" |
|
55 |
unfolding lower_le_def Rep_PDPlus by fast |
|
56 |
||
57 |
lemma lower_le_induct [induct set: lower_le]: |
|
58 |
assumes le: "t \<le>\<flat> u" |
|
59 |
assumes 1: "\<And>a b. compact_le a b \<Longrightarrow> P (PDUnit a) (PDUnit b)" |
|
60 |
assumes 2: "\<And>t u a. P (PDUnit a) t \<Longrightarrow> P (PDUnit a) (PDPlus t u)" |
|
61 |
assumes 3: "\<And>t u v. \<lbrakk>P t v; P u v\<rbrakk> \<Longrightarrow> P (PDPlus t u) v" |
|
62 |
shows "P t u" |
|
63 |
using le |
|
64 |
apply (induct t arbitrary: u rule: pd_basis_induct) |
|
65 |
apply (erule rev_mp) |
|
66 |
apply (induct_tac u rule: pd_basis_induct) |
|
67 |
apply (simp add: 1) |
|
68 |
apply (simp add: lower_le_PDUnit_PDPlus_iff) |
|
69 |
apply (simp add: 2) |
|
70 |
apply (subst PDPlus_commute) |
|
71 |
apply (simp add: 2) |
|
72 |
apply (simp add: lower_le_PDPlus_iff 3) |
|
73 |
done |
|
74 |
||
75 |
lemma approx_pd_lower_mono1: |
|
76 |
"i \<le> j \<Longrightarrow> approx_pd i t \<le>\<flat> approx_pd j t" |
|
77 |
apply (induct t rule: pd_basis_induct) |
|
78 |
apply (simp add: compact_approx_mono1) |
|
79 |
apply (simp add: PDPlus_lower_mono) |
|
80 |
done |
|
81 |
||
82 |
lemma approx_pd_lower_le: "approx_pd i t \<le>\<flat> t" |
|
83 |
apply (induct t rule: pd_basis_induct) |
|
84 |
apply (simp add: compact_approx_le) |
|
85 |
apply (simp add: PDPlus_lower_mono) |
|
86 |
done |
|
87 |
||
88 |
lemma approx_pd_lower_mono: |
|
89 |
"t \<le>\<flat> u \<Longrightarrow> approx_pd n t \<le>\<flat> approx_pd n u" |
|
90 |
apply (erule lower_le_induct) |
|
91 |
apply (simp add: compact_approx_mono) |
|
92 |
apply (simp add: lower_le_PDUnit_PDPlus_iff) |
|
93 |
apply (simp add: lower_le_PDPlus_iff) |
|
94 |
done |
|
95 |
||
96 |
||
97 |
subsection {* Type definition *} |
|
98 |
||
99 |
cpodef (open) 'a lower_pd = |
|
26407
562a1d615336
rename class bifinite_cpo to profinite; generalize powerdomains from bifinite to profinite
huffman
parents:
26041
diff
changeset
|
100 |
"{S::'a::profinite pd_basis set. lower_le.ideal S}" |
25904 | 101 |
apply (simp add: lower_le.adm_ideal) |
102 |
apply (fast intro: lower_le.ideal_principal) |
|
103 |
done |
|
104 |
||
105 |
lemma ideal_Rep_lower_pd: "lower_le.ideal (Rep_lower_pd x)" |
|
106 |
by (rule Rep_lower_pd [simplified]) |
|
107 |
||
108 |
lemma Rep_lower_pd_mono: "x \<sqsubseteq> y \<Longrightarrow> Rep_lower_pd x \<subseteq> Rep_lower_pd y" |
|
109 |
unfolding less_lower_pd_def less_set_def . |
|
110 |
||
111 |
||
112 |
subsection {* Principal ideals *} |
|
113 |
||
114 |
definition |
|
115 |
lower_principal :: "'a pd_basis \<Rightarrow> 'a lower_pd" where |
|
116 |
"lower_principal t = Abs_lower_pd {u. u \<le>\<flat> t}" |
|
117 |
||
118 |
lemma Rep_lower_principal: |
|
119 |
"Rep_lower_pd (lower_principal t) = {u. u \<le>\<flat> t}" |
|
120 |
unfolding lower_principal_def |
|
121 |
apply (rule Abs_lower_pd_inverse [simplified]) |
|
122 |
apply (rule lower_le.ideal_principal) |
|
123 |
done |
|
124 |
||
125 |
interpretation lower_pd: |
|
126 |
bifinite_basis [lower_le lower_principal Rep_lower_pd approx_pd] |
|
127 |
apply unfold_locales |
|
128 |
apply (rule ideal_Rep_lower_pd) |
|
129 |
apply (rule cont_Rep_lower_pd) |
|
130 |
apply (rule Rep_lower_principal) |
|
131 |
apply (simp only: less_lower_pd_def less_set_def) |
|
132 |
apply (rule approx_pd_lower_le) |
|
133 |
apply (rule approx_pd_idem) |
|
134 |
apply (erule approx_pd_lower_mono) |
|
135 |
apply (rule approx_pd_lower_mono1, simp) |
|
136 |
apply (rule finite_range_approx_pd) |
|
137 |
apply (rule ex_approx_pd_eq) |
|
138 |
done |
|
139 |
||
140 |
lemma lower_principal_less_iff [simp]: |
|
141 |
"(lower_principal t \<sqsubseteq> lower_principal u) = (t \<le>\<flat> u)" |
|
142 |
unfolding less_lower_pd_def Rep_lower_principal less_set_def |
|
143 |
by (fast intro: lower_le_refl elim: lower_le_trans) |
|
144 |
||
145 |
lemma lower_principal_mono: |
|
146 |
"t \<le>\<flat> u \<Longrightarrow> lower_principal t \<sqsubseteq> lower_principal u" |
|
147 |
by (rule lower_principal_less_iff [THEN iffD2]) |
|
148 |
||
149 |
lemma compact_lower_principal: "compact (lower_principal t)" |
|
150 |
apply (rule compactI2) |
|
151 |
apply (simp add: less_lower_pd_def) |
|
152 |
apply (simp add: cont2contlubE [OF cont_Rep_lower_pd]) |
|
153 |
apply (simp add: Rep_lower_principal set_cpo_simps) |
|
154 |
apply (simp add: subset_def) |
|
155 |
apply (drule spec, drule mp, rule lower_le_refl) |
|
156 |
apply (erule exE, rename_tac i) |
|
157 |
apply (rule_tac x=i in exI) |
|
158 |
apply clarify |
|
159 |
apply (erule (1) lower_le.idealD3 [OF ideal_Rep_lower_pd]) |
|
160 |
done |
|
161 |
||
162 |
lemma lower_pd_minimal: "lower_principal (PDUnit compact_bot) \<sqsubseteq> ys" |
|
163 |
by (induct ys rule: lower_pd.principal_induct, simp, simp) |
|
164 |
||
165 |
instance lower_pd :: (bifinite) pcpo |
|
166 |
by (intro_classes, fast intro: lower_pd_minimal) |
|
167 |
||
168 |
lemma inst_lower_pd_pcpo: "\<bottom> = lower_principal (PDUnit compact_bot)" |
|
169 |
by (rule lower_pd_minimal [THEN UU_I, symmetric]) |
|
170 |
||
171 |
||
172 |
subsection {* Approximation *} |
|
173 |
||
26407
562a1d615336
rename class bifinite_cpo to profinite; generalize powerdomains from bifinite to profinite
huffman
parents:
26041
diff
changeset
|
174 |
instance lower_pd :: (profinite) approx .. |
25904 | 175 |
|
176 |
defs (overloaded) |
|
177 |
approx_lower_pd_def: |
|
178 |
"approx \<equiv> (\<lambda>n. lower_pd.basis_fun (\<lambda>t. lower_principal (approx_pd n t)))" |
|
179 |
||
180 |
lemma approx_lower_principal [simp]: |
|
181 |
"approx n\<cdot>(lower_principal t) = lower_principal (approx_pd n t)" |
|
182 |
unfolding approx_lower_pd_def |
|
183 |
apply (rule lower_pd.basis_fun_principal) |
|
184 |
apply (erule lower_principal_mono [OF approx_pd_lower_mono]) |
|
185 |
done |
|
186 |
||
187 |
lemma chain_approx_lower_pd: |
|
188 |
"chain (approx :: nat \<Rightarrow> 'a lower_pd \<rightarrow> 'a lower_pd)" |
|
189 |
unfolding approx_lower_pd_def |
|
190 |
by (rule lower_pd.chain_basis_fun_take) |
|
191 |
||
192 |
lemma lub_approx_lower_pd: |
|
193 |
"(\<Squnion>i. approx i\<cdot>xs) = (xs::'a lower_pd)" |
|
194 |
unfolding approx_lower_pd_def |
|
195 |
by (rule lower_pd.lub_basis_fun_take) |
|
196 |
||
197 |
lemma approx_lower_pd_idem: |
|
198 |
"approx n\<cdot>(approx n\<cdot>xs) = approx n\<cdot>(xs::'a lower_pd)" |
|
199 |
apply (induct xs rule: lower_pd.principal_induct, simp) |
|
200 |
apply (simp add: approx_pd_idem) |
|
201 |
done |
|
202 |
||
203 |
lemma approx_eq_lower_principal: |
|
204 |
"\<exists>t\<in>Rep_lower_pd xs. approx n\<cdot>xs = lower_principal (approx_pd n t)" |
|
205 |
unfolding approx_lower_pd_def |
|
206 |
by (rule lower_pd.basis_fun_take_eq_principal) |
|
207 |
||
208 |
lemma finite_fixes_approx_lower_pd: |
|
209 |
"finite {xs::'a lower_pd. approx n\<cdot>xs = xs}" |
|
210 |
unfolding approx_lower_pd_def |
|
211 |
by (rule lower_pd.finite_fixes_basis_fun_take) |
|
212 |
||
26407
562a1d615336
rename class bifinite_cpo to profinite; generalize powerdomains from bifinite to profinite
huffman
parents:
26041
diff
changeset
|
213 |
instance lower_pd :: (profinite) profinite |
25904 | 214 |
apply intro_classes |
215 |
apply (simp add: chain_approx_lower_pd) |
|
216 |
apply (rule lub_approx_lower_pd) |
|
217 |
apply (rule approx_lower_pd_idem) |
|
218 |
apply (rule finite_fixes_approx_lower_pd) |
|
219 |
done |
|
220 |
||
26407
562a1d615336
rename class bifinite_cpo to profinite; generalize powerdomains from bifinite to profinite
huffman
parents:
26041
diff
changeset
|
221 |
instance lower_pd :: (bifinite) bifinite .. |
562a1d615336
rename class bifinite_cpo to profinite; generalize powerdomains from bifinite to profinite
huffman
parents:
26041
diff
changeset
|
222 |
|
25904 | 223 |
lemma compact_imp_lower_principal: |
224 |
"compact xs \<Longrightarrow> \<exists>t. xs = lower_principal t" |
|
225 |
apply (drule bifinite_compact_eq_approx) |
|
226 |
apply (erule exE) |
|
227 |
apply (erule subst) |
|
228 |
apply (cut_tac n=i and xs=xs in approx_eq_lower_principal) |
|
229 |
apply fast |
|
230 |
done |
|
231 |
||
232 |
lemma lower_principal_induct: |
|
233 |
"\<lbrakk>adm P; \<And>t. P (lower_principal t)\<rbrakk> \<Longrightarrow> P xs" |
|
234 |
apply (erule approx_induct, rename_tac xs) |
|
235 |
apply (cut_tac n=n and xs=xs in approx_eq_lower_principal) |
|
236 |
apply (clarify, simp) |
|
237 |
done |
|
238 |
||
239 |
lemma lower_principal_induct2: |
|
240 |
"\<lbrakk>\<And>ys. adm (\<lambda>xs. P xs ys); \<And>xs. adm (\<lambda>ys. P xs ys); |
|
241 |
\<And>t u. P (lower_principal t) (lower_principal u)\<rbrakk> \<Longrightarrow> P xs ys" |
|
242 |
apply (rule_tac x=ys in spec) |
|
243 |
apply (rule_tac xs=xs in lower_principal_induct, simp) |
|
244 |
apply (rule allI, rename_tac ys) |
|
245 |
apply (rule_tac xs=ys in lower_principal_induct, simp) |
|
246 |
apply simp |
|
247 |
done |
|
248 |
||
249 |
||
250 |
subsection {* Monadic unit *} |
|
251 |
||
252 |
definition |
|
253 |
lower_unit :: "'a \<rightarrow> 'a lower_pd" where |
|
254 |
"lower_unit = compact_basis.basis_fun (\<lambda>a. lower_principal (PDUnit a))" |
|
255 |
||
256 |
lemma lower_unit_Rep_compact_basis [simp]: |
|
257 |
"lower_unit\<cdot>(Rep_compact_basis a) = lower_principal (PDUnit a)" |
|
258 |
unfolding lower_unit_def |
|
259 |
apply (rule compact_basis.basis_fun_principal) |
|
260 |
apply (rule lower_principal_mono) |
|
261 |
apply (erule PDUnit_lower_mono) |
|
262 |
done |
|
263 |
||
264 |
lemma lower_unit_strict [simp]: "lower_unit\<cdot>\<bottom> = \<bottom>" |
|
265 |
unfolding inst_lower_pd_pcpo Rep_compact_bot [symmetric] by simp |
|
266 |
||
267 |
lemma approx_lower_unit [simp]: |
|
268 |
"approx n\<cdot>(lower_unit\<cdot>x) = lower_unit\<cdot>(approx n\<cdot>x)" |
|
269 |
apply (induct x rule: compact_basis_induct, simp) |
|
270 |
apply (simp add: approx_Rep_compact_basis) |
|
271 |
done |
|
272 |
||
273 |
lemma lower_unit_less_iff [simp]: |
|
274 |
"(lower_unit\<cdot>x \<sqsubseteq> lower_unit\<cdot>y) = (x \<sqsubseteq> y)" |
|
275 |
apply (rule iffI) |
|
276 |
apply (rule bifinite_less_ext) |
|
277 |
apply (drule_tac f="approx i" in monofun_cfun_arg, simp) |
|
278 |
apply (cut_tac x="approx i\<cdot>x" in compact_imp_Rep_compact_basis, simp) |
|
279 |
apply (cut_tac x="approx i\<cdot>y" in compact_imp_Rep_compact_basis, simp) |
|
280 |
apply (clarify, simp add: compact_le_def) |
|
281 |
apply (erule monofun_cfun_arg) |
|
282 |
done |
|
283 |
||
284 |
lemma lower_unit_eq_iff [simp]: |
|
285 |
"(lower_unit\<cdot>x = lower_unit\<cdot>y) = (x = y)" |
|
286 |
unfolding po_eq_conv by simp |
|
287 |
||
288 |
lemma lower_unit_strict_iff [simp]: "(lower_unit\<cdot>x = \<bottom>) = (x = \<bottom>)" |
|
289 |
unfolding lower_unit_strict [symmetric] by (rule lower_unit_eq_iff) |
|
290 |
||
291 |
lemma compact_lower_unit_iff [simp]: |
|
292 |
"compact (lower_unit\<cdot>x) = compact x" |
|
293 |
unfolding bifinite_compact_iff by simp |
|
294 |
||
295 |
||
296 |
subsection {* Monadic plus *} |
|
297 |
||
298 |
definition |
|
299 |
lower_plus :: "'a lower_pd \<rightarrow> 'a lower_pd \<rightarrow> 'a lower_pd" where |
|
300 |
"lower_plus = lower_pd.basis_fun (\<lambda>t. lower_pd.basis_fun (\<lambda>u. |
|
301 |
lower_principal (PDPlus t u)))" |
|
302 |
||
303 |
abbreviation |
|
304 |
lower_add :: "'a lower_pd \<Rightarrow> 'a lower_pd \<Rightarrow> 'a lower_pd" |
|
305 |
(infixl "+\<flat>" 65) where |
|
306 |
"xs +\<flat> ys == lower_plus\<cdot>xs\<cdot>ys" |
|
307 |
||
308 |
lemma lower_plus_principal [simp]: |
|
309 |
"lower_plus\<cdot>(lower_principal t)\<cdot>(lower_principal u) = |
|
310 |
lower_principal (PDPlus t u)" |
|
311 |
unfolding lower_plus_def |
|
312 |
by (simp add: lower_pd.basis_fun_principal |
|
313 |
lower_pd.basis_fun_mono PDPlus_lower_mono) |
|
314 |
||
315 |
lemma approx_lower_plus [simp]: |
|
316 |
"approx n\<cdot>(lower_plus\<cdot>xs\<cdot>ys) = lower_plus\<cdot>(approx n\<cdot>xs)\<cdot>(approx n\<cdot>ys)" |
|
317 |
by (induct xs ys rule: lower_principal_induct2, simp, simp, simp) |
|
318 |
||
319 |
lemma lower_plus_commute: "lower_plus\<cdot>xs\<cdot>ys = lower_plus\<cdot>ys\<cdot>xs" |
|
320 |
apply (induct xs ys rule: lower_principal_induct2, simp, simp) |
|
321 |
apply (simp add: PDPlus_commute) |
|
322 |
done |
|
323 |
||
324 |
lemma lower_plus_assoc: |
|
325 |
"lower_plus\<cdot>(lower_plus\<cdot>xs\<cdot>ys)\<cdot>zs = lower_plus\<cdot>xs\<cdot>(lower_plus\<cdot>ys\<cdot>zs)" |
|
326 |
apply (induct xs ys arbitrary: zs rule: lower_principal_induct2, simp, simp) |
|
327 |
apply (rule_tac xs=zs in lower_principal_induct, simp) |
|
328 |
apply (simp add: PDPlus_assoc) |
|
329 |
done |
|
330 |
||
331 |
lemma lower_plus_absorb: "lower_plus\<cdot>xs\<cdot>xs = xs" |
|
332 |
apply (induct xs rule: lower_principal_induct, simp) |
|
333 |
apply (simp add: PDPlus_absorb) |
|
334 |
done |
|
335 |
||
336 |
lemma lower_plus_less1: "xs \<sqsubseteq> lower_plus\<cdot>xs\<cdot>ys" |
|
337 |
apply (induct xs ys rule: lower_principal_induct2, simp, simp) |
|
338 |
apply (simp add: PDPlus_lower_less) |
|
339 |
done |
|
340 |
||
341 |
lemma lower_plus_less2: "ys \<sqsubseteq> lower_plus\<cdot>xs\<cdot>ys" |
|
342 |
by (subst lower_plus_commute, rule lower_plus_less1) |
|
343 |
||
344 |
lemma lower_plus_least: "\<lbrakk>xs \<sqsubseteq> zs; ys \<sqsubseteq> zs\<rbrakk> \<Longrightarrow> lower_plus\<cdot>xs\<cdot>ys \<sqsubseteq> zs" |
|
345 |
apply (subst lower_plus_absorb [of zs, symmetric]) |
|
346 |
apply (erule (1) monofun_cfun [OF monofun_cfun_arg]) |
|
347 |
done |
|
348 |
||
349 |
lemma lower_plus_less_iff: |
|
350 |
"(lower_plus\<cdot>xs\<cdot>ys \<sqsubseteq> zs) = (xs \<sqsubseteq> zs \<and> ys \<sqsubseteq> zs)" |
|
351 |
apply safe |
|
352 |
apply (erule trans_less [OF lower_plus_less1]) |
|
353 |
apply (erule trans_less [OF lower_plus_less2]) |
|
354 |
apply (erule (1) lower_plus_least) |
|
355 |
done |
|
356 |
||
357 |
lemma lower_plus_strict_iff [simp]: |
|
358 |
"(lower_plus\<cdot>xs\<cdot>ys = \<bottom>) = (xs = \<bottom> \<and> ys = \<bottom>)" |
|
359 |
apply safe |
|
360 |
apply (rule UU_I, erule subst, rule lower_plus_less1) |
|
361 |
apply (rule UU_I, erule subst, rule lower_plus_less2) |
|
362 |
apply (rule lower_plus_absorb) |
|
363 |
done |
|
364 |
||
365 |
lemma lower_plus_strict1 [simp]: "lower_plus\<cdot>\<bottom>\<cdot>ys = ys" |
|
366 |
apply (rule antisym_less [OF _ lower_plus_less2]) |
|
367 |
apply (simp add: lower_plus_least) |
|
368 |
done |
|
369 |
||
370 |
lemma lower_plus_strict2 [simp]: "lower_plus\<cdot>xs\<cdot>\<bottom> = xs" |
|
371 |
apply (rule antisym_less [OF _ lower_plus_less1]) |
|
372 |
apply (simp add: lower_plus_least) |
|
373 |
done |
|
374 |
||
375 |
lemma lower_unit_less_plus_iff: |
|
376 |
"(lower_unit\<cdot>x \<sqsubseteq> lower_plus\<cdot>ys\<cdot>zs) = |
|
377 |
(lower_unit\<cdot>x \<sqsubseteq> ys \<or> lower_unit\<cdot>x \<sqsubseteq> zs)" |
|
378 |
apply (rule iffI) |
|
379 |
apply (subgoal_tac |
|
380 |
"adm (\<lambda>f. f\<cdot>(lower_unit\<cdot>x) \<sqsubseteq> f\<cdot>ys \<or> f\<cdot>(lower_unit\<cdot>x) \<sqsubseteq> f\<cdot>zs)") |
|
25925 | 381 |
apply (drule admD, rule chain_approx) |
25904 | 382 |
apply (drule_tac f="approx i" in monofun_cfun_arg) |
383 |
apply (cut_tac x="approx i\<cdot>x" in compact_imp_Rep_compact_basis, simp) |
|
384 |
apply (cut_tac xs="approx i\<cdot>ys" in compact_imp_lower_principal, simp) |
|
385 |
apply (cut_tac xs="approx i\<cdot>zs" in compact_imp_lower_principal, simp) |
|
386 |
apply (clarify, simp add: lower_le_PDUnit_PDPlus_iff) |
|
387 |
apply simp |
|
388 |
apply simp |
|
389 |
apply (erule disjE) |
|
390 |
apply (erule trans_less [OF _ lower_plus_less1]) |
|
391 |
apply (erule trans_less [OF _ lower_plus_less2]) |
|
392 |
done |
|
393 |
||
394 |
lemmas lower_pd_less_simps = |
|
395 |
lower_unit_less_iff |
|
396 |
lower_plus_less_iff |
|
397 |
lower_unit_less_plus_iff |
|
398 |
||
399 |
||
400 |
subsection {* Induction rules *} |
|
401 |
||
402 |
lemma lower_pd_induct1: |
|
403 |
assumes P: "adm P" |
|
404 |
assumes unit: "\<And>x. P (lower_unit\<cdot>x)" |
|
405 |
assumes insert: |
|
406 |
"\<And>x ys. \<lbrakk>P (lower_unit\<cdot>x); P ys\<rbrakk> \<Longrightarrow> P (lower_plus\<cdot>(lower_unit\<cdot>x)\<cdot>ys)" |
|
407 |
shows "P (xs::'a lower_pd)" |
|
408 |
apply (induct xs rule: lower_principal_induct, rule P) |
|
409 |
apply (induct_tac t rule: pd_basis_induct1) |
|
410 |
apply (simp only: lower_unit_Rep_compact_basis [symmetric]) |
|
411 |
apply (rule unit) |
|
412 |
apply (simp only: lower_unit_Rep_compact_basis [symmetric] |
|
413 |
lower_plus_principal [symmetric]) |
|
414 |
apply (erule insert [OF unit]) |
|
415 |
done |
|
416 |
||
417 |
lemma lower_pd_induct: |
|
418 |
assumes P: "adm P" |
|
419 |
assumes unit: "\<And>x. P (lower_unit\<cdot>x)" |
|
420 |
assumes plus: "\<And>xs ys. \<lbrakk>P xs; P ys\<rbrakk> \<Longrightarrow> P (lower_plus\<cdot>xs\<cdot>ys)" |
|
421 |
shows "P (xs::'a lower_pd)" |
|
422 |
apply (induct xs rule: lower_principal_induct, rule P) |
|
423 |
apply (induct_tac t rule: pd_basis_induct) |
|
424 |
apply (simp only: lower_unit_Rep_compact_basis [symmetric] unit) |
|
425 |
apply (simp only: lower_plus_principal [symmetric] plus) |
|
426 |
done |
|
427 |
||
428 |
||
429 |
subsection {* Monadic bind *} |
|
430 |
||
431 |
definition |
|
432 |
lower_bind_basis :: |
|
433 |
"'a pd_basis \<Rightarrow> ('a \<rightarrow> 'b lower_pd) \<rightarrow> 'b lower_pd" where |
|
434 |
"lower_bind_basis = fold_pd |
|
435 |
(\<lambda>a. \<Lambda> f. f\<cdot>(Rep_compact_basis a)) |
|
436 |
(\<lambda>x y. \<Lambda> f. lower_plus\<cdot>(x\<cdot>f)\<cdot>(y\<cdot>f))" |
|
437 |
||
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
|
438 |
lemma ACI_lower_bind: "ab_semigroup_idem_mult (\<lambda>x y. \<Lambda> f. lower_plus\<cdot>(x\<cdot>f)\<cdot>(y\<cdot>f))" |
25904 | 439 |
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
|
440 |
apply (simp add: lower_plus_assoc) |
25904 | 441 |
apply (simp add: lower_plus_commute) |
442 |
apply (simp add: lower_plus_absorb eta_cfun) |
|
443 |
done |
|
444 |
||
445 |
lemma lower_bind_basis_simps [simp]: |
|
446 |
"lower_bind_basis (PDUnit a) = |
|
447 |
(\<Lambda> f. f\<cdot>(Rep_compact_basis a))" |
|
448 |
"lower_bind_basis (PDPlus t u) = |
|
449 |
(\<Lambda> f. lower_plus\<cdot>(lower_bind_basis t\<cdot>f)\<cdot>(lower_bind_basis u\<cdot>f))" |
|
450 |
unfolding lower_bind_basis_def |
|
451 |
apply - |
|
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
|
452 |
apply (rule ab_semigroup_idem_mult.fold_pd_PDUnit [OF ACI_lower_bind]) |
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
|
453 |
apply (rule ab_semigroup_idem_mult.fold_pd_PDPlus [OF ACI_lower_bind]) |
25904 | 454 |
done |
455 |
||
456 |
lemma lower_bind_basis_mono: |
|
457 |
"t \<le>\<flat> u \<Longrightarrow> lower_bind_basis t \<sqsubseteq> lower_bind_basis u" |
|
458 |
unfolding expand_cfun_less |
|
459 |
apply (erule lower_le_induct, safe) |
|
460 |
apply (simp add: compact_le_def monofun_cfun) |
|
461 |
apply (simp add: rev_trans_less [OF lower_plus_less1]) |
|
462 |
apply (simp add: lower_plus_less_iff) |
|
463 |
done |
|
464 |
||
465 |
definition |
|
466 |
lower_bind :: "'a lower_pd \<rightarrow> ('a \<rightarrow> 'b lower_pd) \<rightarrow> 'b lower_pd" where |
|
467 |
"lower_bind = lower_pd.basis_fun lower_bind_basis" |
|
468 |
||
469 |
lemma lower_bind_principal [simp]: |
|
470 |
"lower_bind\<cdot>(lower_principal t) = lower_bind_basis t" |
|
471 |
unfolding lower_bind_def |
|
472 |
apply (rule lower_pd.basis_fun_principal) |
|
473 |
apply (erule lower_bind_basis_mono) |
|
474 |
done |
|
475 |
||
476 |
lemma lower_bind_unit [simp]: |
|
477 |
"lower_bind\<cdot>(lower_unit\<cdot>x)\<cdot>f = f\<cdot>x" |
|
478 |
by (induct x rule: compact_basis_induct, simp, simp) |
|
479 |
||
480 |
lemma lower_bind_plus [simp]: |
|
481 |
"lower_bind\<cdot>(lower_plus\<cdot>xs\<cdot>ys)\<cdot>f = |
|
482 |
lower_plus\<cdot>(lower_bind\<cdot>xs\<cdot>f)\<cdot>(lower_bind\<cdot>ys\<cdot>f)" |
|
483 |
by (induct xs ys rule: lower_principal_induct2, simp, simp, simp) |
|
484 |
||
485 |
lemma lower_bind_strict [simp]: "lower_bind\<cdot>\<bottom>\<cdot>f = f\<cdot>\<bottom>" |
|
486 |
unfolding lower_unit_strict [symmetric] by (rule lower_bind_unit) |
|
487 |
||
488 |
||
489 |
subsection {* Map and join *} |
|
490 |
||
491 |
definition |
|
492 |
lower_map :: "('a \<rightarrow> 'b) \<rightarrow> 'a lower_pd \<rightarrow> 'b lower_pd" where |
|
493 |
"lower_map = (\<Lambda> f xs. lower_bind\<cdot>xs\<cdot>(\<Lambda> x. lower_unit\<cdot>(f\<cdot>x)))" |
|
494 |
||
495 |
definition |
|
496 |
lower_join :: "'a lower_pd lower_pd \<rightarrow> 'a lower_pd" where |
|
497 |
"lower_join = (\<Lambda> xss. lower_bind\<cdot>xss\<cdot>(\<Lambda> xs. xs))" |
|
498 |
||
499 |
lemma lower_map_unit [simp]: |
|
500 |
"lower_map\<cdot>f\<cdot>(lower_unit\<cdot>x) = lower_unit\<cdot>(f\<cdot>x)" |
|
501 |
unfolding lower_map_def by simp |
|
502 |
||
503 |
lemma lower_map_plus [simp]: |
|
504 |
"lower_map\<cdot>f\<cdot>(lower_plus\<cdot>xs\<cdot>ys) = |
|
505 |
lower_plus\<cdot>(lower_map\<cdot>f\<cdot>xs)\<cdot>(lower_map\<cdot>f\<cdot>ys)" |
|
506 |
unfolding lower_map_def by simp |
|
507 |
||
508 |
lemma lower_join_unit [simp]: |
|
509 |
"lower_join\<cdot>(lower_unit\<cdot>xs) = xs" |
|
510 |
unfolding lower_join_def by simp |
|
511 |
||
512 |
lemma lower_join_plus [simp]: |
|
513 |
"lower_join\<cdot>(lower_plus\<cdot>xss\<cdot>yss) = |
|
514 |
lower_plus\<cdot>(lower_join\<cdot>xss)\<cdot>(lower_join\<cdot>yss)" |
|
515 |
unfolding lower_join_def by simp |
|
516 |
||
517 |
lemma lower_map_ident: "lower_map\<cdot>(\<Lambda> x. x)\<cdot>xs = xs" |
|
518 |
by (induct xs rule: lower_pd_induct, simp_all) |
|
519 |
||
520 |
lemma lower_map_map: |
|
521 |
"lower_map\<cdot>f\<cdot>(lower_map\<cdot>g\<cdot>xs) = lower_map\<cdot>(\<Lambda> x. f\<cdot>(g\<cdot>x))\<cdot>xs" |
|
522 |
by (induct xs rule: lower_pd_induct, simp_all) |
|
523 |
||
524 |
lemma lower_join_map_unit: |
|
525 |
"lower_join\<cdot>(lower_map\<cdot>lower_unit\<cdot>xs) = xs" |
|
526 |
by (induct xs rule: lower_pd_induct, simp_all) |
|
527 |
||
528 |
lemma lower_join_map_join: |
|
529 |
"lower_join\<cdot>(lower_map\<cdot>lower_join\<cdot>xsss) = lower_join\<cdot>(lower_join\<cdot>xsss)" |
|
530 |
by (induct xsss rule: lower_pd_induct, simp_all) |
|
531 |
||
532 |
lemma lower_join_map_map: |
|
533 |
"lower_join\<cdot>(lower_map\<cdot>(lower_map\<cdot>f)\<cdot>xss) = |
|
534 |
lower_map\<cdot>f\<cdot>(lower_join\<cdot>xss)" |
|
535 |
by (induct xss rule: lower_pd_induct, simp_all) |
|
536 |
||
537 |
lemma lower_map_approx: "lower_map\<cdot>(approx n)\<cdot>xs = approx n\<cdot>xs" |
|
538 |
by (induct xs rule: lower_pd_induct, simp_all) |
|
539 |
||
540 |
end |