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