author | huffman |
Fri, 16 May 2008 23:25:37 +0200 | |
changeset 26927 | 8684b5240f11 |
parent 26806 | 40b411ec05aa |
child 26962 | c8b20f615d6c |
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 |
|
26420
57a626f64875
make preorder locale into a superclass of class po
huffman
parents:
26407
diff
changeset
|
16 |
"lower_le = (\<lambda>u v. \<forall>x\<in>Rep_pd_basis u. \<exists>y\<in>Rep_pd_basis v. x \<sqsubseteq> y)" |
25904 | 17 |
|
18 |
lemma lower_le_refl [simp]: "t \<le>\<flat> t" |
|
26420
57a626f64875
make preorder locale into a superclass of class po
huffman
parents:
26407
diff
changeset
|
19 |
unfolding lower_le_def by fast |
25904 | 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) |
|
26420
57a626f64875
make preorder locale into a superclass of class po
huffman
parents:
26407
diff
changeset
|
27 |
apply (erule (1) trans_less) |
25904 | 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 |
||
26420
57a626f64875
make preorder locale into a superclass of class po
huffman
parents:
26407
diff
changeset
|
37 |
lemma PDUnit_lower_mono: "x \<sqsubseteq> y \<Longrightarrow> PDUnit x \<le>\<flat> PDUnit y" |
25904 | 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" |
|
26420
57a626f64875
make preorder locale into a superclass of class po
huffman
parents:
26407
diff
changeset
|
44 |
unfolding lower_le_def Rep_PDPlus by fast |
25904 | 45 |
|
46 |
lemma lower_le_PDUnit_PDUnit_iff [simp]: |
|
26420
57a626f64875
make preorder locale into a superclass of class po
huffman
parents:
26407
diff
changeset
|
47 |
"(PDUnit a \<le>\<flat> PDUnit b) = a \<sqsubseteq> b" |
25904 | 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" |
|
26420
57a626f64875
make preorder locale into a superclass of class po
huffman
parents:
26407
diff
changeset
|
59 |
assumes 1: "\<And>a b. a \<sqsubseteq> b \<Longrightarrow> P (PDUnit a) (PDUnit b)" |
25904 | 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)" |
|
26927 | 106 |
by (rule Rep_lower_pd [unfolded mem_Collect_eq]) |
25904 | 107 |
|
108 |
definition |
|
109 |
lower_principal :: "'a pd_basis \<Rightarrow> 'a lower_pd" where |
|
110 |
"lower_principal t = Abs_lower_pd {u. u \<le>\<flat> t}" |
|
111 |
||
112 |
lemma Rep_lower_principal: |
|
113 |
"Rep_lower_pd (lower_principal t) = {u. u \<le>\<flat> t}" |
|
114 |
unfolding lower_principal_def |
|
115 |
apply (rule Abs_lower_pd_inverse [simplified]) |
|
116 |
apply (rule lower_le.ideal_principal) |
|
117 |
done |
|
118 |
||
119 |
interpretation lower_pd: |
|
26927 | 120 |
ideal_completion [lower_le approx_pd lower_principal Rep_lower_pd] |
25904 | 121 |
apply unfold_locales |
122 |
apply (rule approx_pd_lower_le) |
|
123 |
apply (rule approx_pd_idem) |
|
124 |
apply (erule approx_pd_lower_mono) |
|
125 |
apply (rule approx_pd_lower_mono1, simp) |
|
126 |
apply (rule finite_range_approx_pd) |
|
127 |
apply (rule ex_approx_pd_eq) |
|
26420
57a626f64875
make preorder locale into a superclass of class po
huffman
parents:
26407
diff
changeset
|
128 |
apply (rule ideal_Rep_lower_pd) |
57a626f64875
make preorder locale into a superclass of class po
huffman
parents:
26407
diff
changeset
|
129 |
apply (rule cont_Rep_lower_pd) |
57a626f64875
make preorder locale into a superclass of class po
huffman
parents:
26407
diff
changeset
|
130 |
apply (rule Rep_lower_principal) |
26806 | 131 |
apply (simp only: less_lower_pd_def less_set_eq) |
25904 | 132 |
done |
133 |
||
134 |
lemma lower_principal_less_iff [simp]: |
|
26927 | 135 |
"lower_principal t \<sqsubseteq> lower_principal u \<longleftrightarrow> t \<le>\<flat> u" |
136 |
by (rule lower_pd.principal_less_iff) |
|
137 |
||
138 |
lemma lower_principal_eq_iff: |
|
139 |
"lower_principal t = lower_principal u \<longleftrightarrow> t \<le>\<flat> u \<and> u \<le>\<flat> t" |
|
140 |
by (rule lower_pd.principal_eq_iff) |
|
25904 | 141 |
|
142 |
lemma lower_principal_mono: |
|
143 |
"t \<le>\<flat> u \<Longrightarrow> lower_principal t \<sqsubseteq> lower_principal u" |
|
26927 | 144 |
by (rule lower_pd.principal_mono) |
25904 | 145 |
|
146 |
lemma compact_lower_principal: "compact (lower_principal t)" |
|
26927 | 147 |
by (rule lower_pd.compact_principal) |
25904 | 148 |
|
149 |
lemma lower_pd_minimal: "lower_principal (PDUnit compact_bot) \<sqsubseteq> ys" |
|
150 |
by (induct ys rule: lower_pd.principal_induct, simp, simp) |
|
151 |
||
152 |
instance lower_pd :: (bifinite) pcpo |
|
26927 | 153 |
by intro_classes (fast intro: lower_pd_minimal) |
25904 | 154 |
|
155 |
lemma inst_lower_pd_pcpo: "\<bottom> = lower_principal (PDUnit compact_bot)" |
|
156 |
by (rule lower_pd_minimal [THEN UU_I, symmetric]) |
|
157 |
||
158 |
||
159 |
subsection {* Approximation *} |
|
160 |
||
26407
562a1d615336
rename class bifinite_cpo to profinite; generalize powerdomains from bifinite to profinite
huffman
parents:
26041
diff
changeset
|
161 |
instance lower_pd :: (profinite) approx .. |
25904 | 162 |
|
163 |
defs (overloaded) |
|
26927 | 164 |
approx_lower_pd_def: "approx \<equiv> lower_pd.completion_approx" |
165 |
||
166 |
instance lower_pd :: (profinite) profinite |
|
167 |
apply (intro_classes, unfold approx_lower_pd_def) |
|
168 |
apply (simp add: lower_pd.chain_completion_approx) |
|
169 |
apply (rule lower_pd.lub_completion_approx) |
|
170 |
apply (rule lower_pd.completion_approx_idem) |
|
171 |
apply (rule lower_pd.finite_fixes_completion_approx) |
|
172 |
done |
|
173 |
||
174 |
instance lower_pd :: (bifinite) bifinite .. |
|
25904 | 175 |
|
176 |
lemma approx_lower_principal [simp]: |
|
177 |
"approx n\<cdot>(lower_principal t) = lower_principal (approx_pd n t)" |
|
178 |
unfolding approx_lower_pd_def |
|
26927 | 179 |
by (rule lower_pd.completion_approx_principal) |
25904 | 180 |
|
181 |
lemma approx_eq_lower_principal: |
|
182 |
"\<exists>t\<in>Rep_lower_pd xs. approx n\<cdot>xs = lower_principal (approx_pd n t)" |
|
183 |
unfolding approx_lower_pd_def |
|
26927 | 184 |
by (rule lower_pd.completion_approx_eq_principal) |
26407
562a1d615336
rename class bifinite_cpo to profinite; generalize powerdomains from bifinite to profinite
huffman
parents:
26041
diff
changeset
|
185 |
|
25904 | 186 |
lemma compact_imp_lower_principal: |
187 |
"compact xs \<Longrightarrow> \<exists>t. xs = lower_principal t" |
|
188 |
apply (drule bifinite_compact_eq_approx) |
|
189 |
apply (erule exE) |
|
190 |
apply (erule subst) |
|
191 |
apply (cut_tac n=i and xs=xs in approx_eq_lower_principal) |
|
192 |
apply fast |
|
193 |
done |
|
194 |
||
195 |
lemma lower_principal_induct: |
|
196 |
"\<lbrakk>adm P; \<And>t. P (lower_principal t)\<rbrakk> \<Longrightarrow> P xs" |
|
26927 | 197 |
by (rule lower_pd.principal_induct) |
25904 | 198 |
|
199 |
lemma lower_principal_induct2: |
|
200 |
"\<lbrakk>\<And>ys. adm (\<lambda>xs. P xs ys); \<And>xs. adm (\<lambda>ys. P xs ys); |
|
201 |
\<And>t u. P (lower_principal t) (lower_principal u)\<rbrakk> \<Longrightarrow> P xs ys" |
|
202 |
apply (rule_tac x=ys in spec) |
|
203 |
apply (rule_tac xs=xs in lower_principal_induct, simp) |
|
204 |
apply (rule allI, rename_tac ys) |
|
205 |
apply (rule_tac xs=ys in lower_principal_induct, simp) |
|
206 |
apply simp |
|
207 |
done |
|
208 |
||
209 |
||
26927 | 210 |
subsection {* Monadic unit and plus *} |
25904 | 211 |
|
212 |
definition |
|
213 |
lower_unit :: "'a \<rightarrow> 'a lower_pd" where |
|
214 |
"lower_unit = compact_basis.basis_fun (\<lambda>a. lower_principal (PDUnit a))" |
|
215 |
||
216 |
definition |
|
217 |
lower_plus :: "'a lower_pd \<rightarrow> 'a lower_pd \<rightarrow> 'a lower_pd" where |
|
218 |
"lower_plus = lower_pd.basis_fun (\<lambda>t. lower_pd.basis_fun (\<lambda>u. |
|
219 |
lower_principal (PDPlus t u)))" |
|
220 |
||
221 |
abbreviation |
|
222 |
lower_add :: "'a lower_pd \<Rightarrow> 'a lower_pd \<Rightarrow> 'a lower_pd" |
|
223 |
(infixl "+\<flat>" 65) where |
|
224 |
"xs +\<flat> ys == lower_plus\<cdot>xs\<cdot>ys" |
|
225 |
||
26927 | 226 |
syntax |
227 |
"_lower_pd" :: "args \<Rightarrow> 'a lower_pd" ("{_}\<flat>") |
|
228 |
||
229 |
translations |
|
230 |
"{x,xs}\<flat>" == "{x}\<flat> +\<flat> {xs}\<flat>" |
|
231 |
"{x}\<flat>" == "CONST lower_unit\<cdot>x" |
|
232 |
||
233 |
lemma lower_unit_Rep_compact_basis [simp]: |
|
234 |
"{Rep_compact_basis a}\<flat> = lower_principal (PDUnit a)" |
|
235 |
unfolding lower_unit_def |
|
236 |
by (simp add: compact_basis.basis_fun_principal |
|
237 |
lower_principal_mono PDUnit_lower_mono) |
|
238 |
||
25904 | 239 |
lemma lower_plus_principal [simp]: |
26927 | 240 |
"lower_principal t +\<flat> lower_principal u = lower_principal (PDPlus t u)" |
25904 | 241 |
unfolding lower_plus_def |
242 |
by (simp add: lower_pd.basis_fun_principal |
|
243 |
lower_pd.basis_fun_mono PDPlus_lower_mono) |
|
244 |
||
26927 | 245 |
lemma approx_lower_unit [simp]: |
246 |
"approx n\<cdot>{x}\<flat> = {approx n\<cdot>x}\<flat>" |
|
247 |
apply (induct x rule: compact_basis_induct, simp) |
|
248 |
apply (simp add: approx_Rep_compact_basis) |
|
249 |
done |
|
250 |
||
25904 | 251 |
lemma approx_lower_plus [simp]: |
26927 | 252 |
"approx n\<cdot>(xs +\<flat> ys) = (approx n\<cdot>xs) +\<flat> (approx n\<cdot>ys)" |
25904 | 253 |
by (induct xs ys rule: lower_principal_induct2, simp, simp, simp) |
254 |
||
26927 | 255 |
lemma lower_plus_assoc: "(xs +\<flat> ys) +\<flat> zs = xs +\<flat> (ys +\<flat> zs)" |
25904 | 256 |
apply (induct xs ys arbitrary: zs rule: lower_principal_induct2, simp, simp) |
257 |
apply (rule_tac xs=zs in lower_principal_induct, simp) |
|
258 |
apply (simp add: PDPlus_assoc) |
|
259 |
done |
|
260 |
||
26927 | 261 |
lemma lower_plus_commute: "xs +\<flat> ys = ys +\<flat> xs" |
262 |
apply (induct xs ys rule: lower_principal_induct2, simp, simp) |
|
263 |
apply (simp add: PDPlus_commute) |
|
264 |
done |
|
265 |
||
266 |
lemma lower_plus_absorb: "xs +\<flat> xs = xs" |
|
25904 | 267 |
apply (induct xs rule: lower_principal_induct, simp) |
268 |
apply (simp add: PDPlus_absorb) |
|
269 |
done |
|
270 |
||
26927 | 271 |
interpretation aci_lower_plus: ab_semigroup_idem_mult ["op +\<flat>"] |
272 |
by unfold_locales |
|
273 |
(rule lower_plus_assoc lower_plus_commute lower_plus_absorb)+ |
|
274 |
||
275 |
lemma lower_plus_left_commute: "xs +\<flat> (ys +\<flat> zs) = ys +\<flat> (xs +\<flat> zs)" |
|
276 |
by (rule aci_lower_plus.mult_left_commute) |
|
277 |
||
278 |
lemma lower_plus_left_absorb: "xs +\<flat> (xs +\<flat> ys) = xs +\<flat> ys" |
|
279 |
by (rule aci_lower_plus.mult_left_idem) |
|
280 |
||
281 |
lemmas lower_plus_aci = aci_lower_plus.mult_ac_idem |
|
282 |
||
283 |
lemma lower_plus_less1: "xs \<sqsubseteq> xs +\<flat> ys" |
|
25904 | 284 |
apply (induct xs ys rule: lower_principal_induct2, simp, simp) |
285 |
apply (simp add: PDPlus_lower_less) |
|
286 |
done |
|
287 |
||
26927 | 288 |
lemma lower_plus_less2: "ys \<sqsubseteq> xs +\<flat> ys" |
25904 | 289 |
by (subst lower_plus_commute, rule lower_plus_less1) |
290 |
||
26927 | 291 |
lemma lower_plus_least: "\<lbrakk>xs \<sqsubseteq> zs; ys \<sqsubseteq> zs\<rbrakk> \<Longrightarrow> xs +\<flat> ys \<sqsubseteq> zs" |
25904 | 292 |
apply (subst lower_plus_absorb [of zs, symmetric]) |
293 |
apply (erule (1) monofun_cfun [OF monofun_cfun_arg]) |
|
294 |
done |
|
295 |
||
296 |
lemma lower_plus_less_iff: |
|
26927 | 297 |
"xs +\<flat> ys \<sqsubseteq> zs \<longleftrightarrow> xs \<sqsubseteq> zs \<and> ys \<sqsubseteq> zs" |
25904 | 298 |
apply safe |
299 |
apply (erule trans_less [OF lower_plus_less1]) |
|
300 |
apply (erule trans_less [OF lower_plus_less2]) |
|
301 |
apply (erule (1) lower_plus_least) |
|
302 |
done |
|
303 |
||
304 |
lemma lower_unit_less_plus_iff: |
|
26927 | 305 |
"{x}\<flat> \<sqsubseteq> ys +\<flat> zs \<longleftrightarrow> {x}\<flat> \<sqsubseteq> ys \<or> {x}\<flat> \<sqsubseteq> zs" |
25904 | 306 |
apply (rule iffI) |
307 |
apply (subgoal_tac |
|
26927 | 308 |
"adm (\<lambda>f. f\<cdot>{x}\<flat> \<sqsubseteq> f\<cdot>ys \<or> f\<cdot>{x}\<flat> \<sqsubseteq> f\<cdot>zs)") |
25925 | 309 |
apply (drule admD, rule chain_approx) |
25904 | 310 |
apply (drule_tac f="approx i" in monofun_cfun_arg) |
311 |
apply (cut_tac x="approx i\<cdot>x" in compact_imp_Rep_compact_basis, simp) |
|
312 |
apply (cut_tac xs="approx i\<cdot>ys" in compact_imp_lower_principal, simp) |
|
313 |
apply (cut_tac xs="approx i\<cdot>zs" in compact_imp_lower_principal, simp) |
|
314 |
apply (clarify, simp add: lower_le_PDUnit_PDPlus_iff) |
|
315 |
apply simp |
|
316 |
apply simp |
|
317 |
apply (erule disjE) |
|
318 |
apply (erule trans_less [OF _ lower_plus_less1]) |
|
319 |
apply (erule trans_less [OF _ lower_plus_less2]) |
|
320 |
done |
|
321 |
||
26927 | 322 |
lemma lower_unit_less_iff [simp]: "{x}\<flat> \<sqsubseteq> {y}\<flat> \<longleftrightarrow> x \<sqsubseteq> y" |
323 |
apply (rule iffI) |
|
324 |
apply (rule bifinite_less_ext) |
|
325 |
apply (drule_tac f="approx i" in monofun_cfun_arg, simp) |
|
326 |
apply (cut_tac x="approx i\<cdot>x" in compact_imp_Rep_compact_basis, simp) |
|
327 |
apply (cut_tac x="approx i\<cdot>y" in compact_imp_Rep_compact_basis, simp) |
|
328 |
apply (clarify, simp add: compact_le_def) |
|
329 |
apply (erule monofun_cfun_arg) |
|
330 |
done |
|
331 |
||
25904 | 332 |
lemmas lower_pd_less_simps = |
333 |
lower_unit_less_iff |
|
334 |
lower_plus_less_iff |
|
335 |
lower_unit_less_plus_iff |
|
336 |
||
26927 | 337 |
lemma lower_unit_eq_iff [simp]: "{x}\<flat> = {y}\<flat> \<longleftrightarrow> x = y" |
338 |
unfolding po_eq_conv by simp |
|
339 |
||
340 |
lemma lower_unit_strict [simp]: "{\<bottom>}\<flat> = \<bottom>" |
|
341 |
unfolding inst_lower_pd_pcpo Rep_compact_bot [symmetric] by simp |
|
342 |
||
343 |
lemma lower_unit_strict_iff [simp]: "{x}\<flat> = \<bottom> \<longleftrightarrow> x = \<bottom>" |
|
344 |
unfolding lower_unit_strict [symmetric] by (rule lower_unit_eq_iff) |
|
345 |
||
346 |
lemma lower_plus_strict_iff [simp]: |
|
347 |
"xs +\<flat> ys = \<bottom> \<longleftrightarrow> xs = \<bottom> \<and> ys = \<bottom>" |
|
348 |
apply safe |
|
349 |
apply (rule UU_I, erule subst, rule lower_plus_less1) |
|
350 |
apply (rule UU_I, erule subst, rule lower_plus_less2) |
|
351 |
apply (rule lower_plus_absorb) |
|
352 |
done |
|
353 |
||
354 |
lemma lower_plus_strict1 [simp]: "\<bottom> +\<flat> ys = ys" |
|
355 |
apply (rule antisym_less [OF _ lower_plus_less2]) |
|
356 |
apply (simp add: lower_plus_least) |
|
357 |
done |
|
358 |
||
359 |
lemma lower_plus_strict2 [simp]: "xs +\<flat> \<bottom> = xs" |
|
360 |
apply (rule antisym_less [OF _ lower_plus_less1]) |
|
361 |
apply (simp add: lower_plus_least) |
|
362 |
done |
|
363 |
||
364 |
lemma compact_lower_unit_iff [simp]: "compact {x}\<flat> \<longleftrightarrow> compact x" |
|
365 |
unfolding bifinite_compact_iff by simp |
|
366 |
||
367 |
lemma compact_lower_plus [simp]: |
|
368 |
"\<lbrakk>compact xs; compact ys\<rbrakk> \<Longrightarrow> compact (xs +\<flat> ys)" |
|
369 |
apply (drule compact_imp_lower_principal)+ |
|
370 |
apply (auto simp add: compact_lower_principal) |
|
371 |
done |
|
372 |
||
25904 | 373 |
|
374 |
subsection {* Induction rules *} |
|
375 |
||
376 |
lemma lower_pd_induct1: |
|
377 |
assumes P: "adm P" |
|
26927 | 378 |
assumes unit: "\<And>x. P {x}\<flat>" |
25904 | 379 |
assumes insert: |
26927 | 380 |
"\<And>x ys. \<lbrakk>P {x}\<flat>; P ys\<rbrakk> \<Longrightarrow> P ({x}\<flat> +\<flat> ys)" |
25904 | 381 |
shows "P (xs::'a lower_pd)" |
382 |
apply (induct xs rule: lower_principal_induct, rule P) |
|
383 |
apply (induct_tac t rule: pd_basis_induct1) |
|
384 |
apply (simp only: lower_unit_Rep_compact_basis [symmetric]) |
|
385 |
apply (rule unit) |
|
386 |
apply (simp only: lower_unit_Rep_compact_basis [symmetric] |
|
387 |
lower_plus_principal [symmetric]) |
|
388 |
apply (erule insert [OF unit]) |
|
389 |
done |
|
390 |
||
391 |
lemma lower_pd_induct: |
|
392 |
assumes P: "adm P" |
|
26927 | 393 |
assumes unit: "\<And>x. P {x}\<flat>" |
394 |
assumes plus: "\<And>xs ys. \<lbrakk>P xs; P ys\<rbrakk> \<Longrightarrow> P (xs +\<flat> ys)" |
|
25904 | 395 |
shows "P (xs::'a lower_pd)" |
396 |
apply (induct xs rule: lower_principal_induct, rule P) |
|
397 |
apply (induct_tac t rule: pd_basis_induct) |
|
398 |
apply (simp only: lower_unit_Rep_compact_basis [symmetric] unit) |
|
399 |
apply (simp only: lower_plus_principal [symmetric] plus) |
|
400 |
done |
|
401 |
||
402 |
||
403 |
subsection {* Monadic bind *} |
|
404 |
||
405 |
definition |
|
406 |
lower_bind_basis :: |
|
407 |
"'a pd_basis \<Rightarrow> ('a \<rightarrow> 'b lower_pd) \<rightarrow> 'b lower_pd" where |
|
408 |
"lower_bind_basis = fold_pd |
|
409 |
(\<lambda>a. \<Lambda> f. f\<cdot>(Rep_compact_basis a)) |
|
26927 | 410 |
(\<lambda>x y. \<Lambda> f. x\<cdot>f +\<flat> y\<cdot>f)" |
25904 | 411 |
|
26927 | 412 |
lemma ACI_lower_bind: |
413 |
"ab_semigroup_idem_mult (\<lambda>x y. \<Lambda> f. x\<cdot>f +\<flat> y\<cdot>f)" |
|
25904 | 414 |
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
|
415 |
apply (simp add: lower_plus_assoc) |
25904 | 416 |
apply (simp add: lower_plus_commute) |
417 |
apply (simp add: lower_plus_absorb eta_cfun) |
|
418 |
done |
|
419 |
||
420 |
lemma lower_bind_basis_simps [simp]: |
|
421 |
"lower_bind_basis (PDUnit a) = |
|
422 |
(\<Lambda> f. f\<cdot>(Rep_compact_basis a))" |
|
423 |
"lower_bind_basis (PDPlus t u) = |
|
26927 | 424 |
(\<Lambda> f. lower_bind_basis t\<cdot>f +\<flat> lower_bind_basis u\<cdot>f)" |
25904 | 425 |
unfolding lower_bind_basis_def |
426 |
apply - |
|
26927 | 427 |
apply (rule fold_pd_PDUnit [OF ACI_lower_bind]) |
428 |
apply (rule fold_pd_PDPlus [OF ACI_lower_bind]) |
|
25904 | 429 |
done |
430 |
||
431 |
lemma lower_bind_basis_mono: |
|
432 |
"t \<le>\<flat> u \<Longrightarrow> lower_bind_basis t \<sqsubseteq> lower_bind_basis u" |
|
433 |
unfolding expand_cfun_less |
|
434 |
apply (erule lower_le_induct, safe) |
|
435 |
apply (simp add: compact_le_def monofun_cfun) |
|
436 |
apply (simp add: rev_trans_less [OF lower_plus_less1]) |
|
437 |
apply (simp add: lower_plus_less_iff) |
|
438 |
done |
|
439 |
||
440 |
definition |
|
441 |
lower_bind :: "'a lower_pd \<rightarrow> ('a \<rightarrow> 'b lower_pd) \<rightarrow> 'b lower_pd" where |
|
442 |
"lower_bind = lower_pd.basis_fun lower_bind_basis" |
|
443 |
||
444 |
lemma lower_bind_principal [simp]: |
|
445 |
"lower_bind\<cdot>(lower_principal t) = lower_bind_basis t" |
|
446 |
unfolding lower_bind_def |
|
447 |
apply (rule lower_pd.basis_fun_principal) |
|
448 |
apply (erule lower_bind_basis_mono) |
|
449 |
done |
|
450 |
||
451 |
lemma lower_bind_unit [simp]: |
|
26927 | 452 |
"lower_bind\<cdot>{x}\<flat>\<cdot>f = f\<cdot>x" |
25904 | 453 |
by (induct x rule: compact_basis_induct, simp, simp) |
454 |
||
455 |
lemma lower_bind_plus [simp]: |
|
26927 | 456 |
"lower_bind\<cdot>(xs +\<flat> ys)\<cdot>f = lower_bind\<cdot>xs\<cdot>f +\<flat> lower_bind\<cdot>ys\<cdot>f" |
25904 | 457 |
by (induct xs ys rule: lower_principal_induct2, simp, simp, simp) |
458 |
||
459 |
lemma lower_bind_strict [simp]: "lower_bind\<cdot>\<bottom>\<cdot>f = f\<cdot>\<bottom>" |
|
460 |
unfolding lower_unit_strict [symmetric] by (rule lower_bind_unit) |
|
461 |
||
462 |
||
463 |
subsection {* Map and join *} |
|
464 |
||
465 |
definition |
|
466 |
lower_map :: "('a \<rightarrow> 'b) \<rightarrow> 'a lower_pd \<rightarrow> 'b lower_pd" where |
|
26927 | 467 |
"lower_map = (\<Lambda> f xs. lower_bind\<cdot>xs\<cdot>(\<Lambda> x. {f\<cdot>x}\<flat>))" |
25904 | 468 |
|
469 |
definition |
|
470 |
lower_join :: "'a lower_pd lower_pd \<rightarrow> 'a lower_pd" where |
|
471 |
"lower_join = (\<Lambda> xss. lower_bind\<cdot>xss\<cdot>(\<Lambda> xs. xs))" |
|
472 |
||
473 |
lemma lower_map_unit [simp]: |
|
26927 | 474 |
"lower_map\<cdot>f\<cdot>{x}\<flat> = {f\<cdot>x}\<flat>" |
25904 | 475 |
unfolding lower_map_def by simp |
476 |
||
477 |
lemma lower_map_plus [simp]: |
|
26927 | 478 |
"lower_map\<cdot>f\<cdot>(xs +\<flat> ys) = lower_map\<cdot>f\<cdot>xs +\<flat> lower_map\<cdot>f\<cdot>ys" |
25904 | 479 |
unfolding lower_map_def by simp |
480 |
||
481 |
lemma lower_join_unit [simp]: |
|
26927 | 482 |
"lower_join\<cdot>{xs}\<flat> = xs" |
25904 | 483 |
unfolding lower_join_def by simp |
484 |
||
485 |
lemma lower_join_plus [simp]: |
|
26927 | 486 |
"lower_join\<cdot>(xss +\<flat> yss) = lower_join\<cdot>xss +\<flat> lower_join\<cdot>yss" |
25904 | 487 |
unfolding lower_join_def by simp |
488 |
||
489 |
lemma lower_map_ident: "lower_map\<cdot>(\<Lambda> x. x)\<cdot>xs = xs" |
|
490 |
by (induct xs rule: lower_pd_induct, simp_all) |
|
491 |
||
492 |
lemma lower_map_map: |
|
493 |
"lower_map\<cdot>f\<cdot>(lower_map\<cdot>g\<cdot>xs) = lower_map\<cdot>(\<Lambda> x. f\<cdot>(g\<cdot>x))\<cdot>xs" |
|
494 |
by (induct xs rule: lower_pd_induct, simp_all) |
|
495 |
||
496 |
lemma lower_join_map_unit: |
|
497 |
"lower_join\<cdot>(lower_map\<cdot>lower_unit\<cdot>xs) = xs" |
|
498 |
by (induct xs rule: lower_pd_induct, simp_all) |
|
499 |
||
500 |
lemma lower_join_map_join: |
|
501 |
"lower_join\<cdot>(lower_map\<cdot>lower_join\<cdot>xsss) = lower_join\<cdot>(lower_join\<cdot>xsss)" |
|
502 |
by (induct xsss rule: lower_pd_induct, simp_all) |
|
503 |
||
504 |
lemma lower_join_map_map: |
|
505 |
"lower_join\<cdot>(lower_map\<cdot>(lower_map\<cdot>f)\<cdot>xss) = |
|
506 |
lower_map\<cdot>f\<cdot>(lower_join\<cdot>xss)" |
|
507 |
by (induct xss rule: lower_pd_induct, simp_all) |
|
508 |
||
509 |
lemma lower_map_approx: "lower_map\<cdot>(approx n)\<cdot>xs = approx n\<cdot>xs" |
|
510 |
by (induct xs rule: lower_pd_induct, simp_all) |
|
511 |
||
512 |
end |