author | wenzelm |
Thu, 19 Jun 2008 20:48:01 +0200 | |
changeset 27277 | 7b7ce2d7fafe |
parent 27267 | 5ebfb7f25ebb |
child 27289 | c49d427867aa |
permissions | -rw-r--r-- |
25904 | 1 |
(* Title: HOLCF/UpperPD.thy |
2 |
ID: $Id$ |
|
3 |
Author: Brian Huffman |
|
4 |
*) |
|
5 |
||
6 |
header {* Upper powerdomain *} |
|
7 |
||
8 |
theory UpperPD |
|
9 |
imports CompactBasis |
|
10 |
begin |
|
11 |
||
12 |
subsection {* Basis preorder *} |
|
13 |
||
14 |
definition |
|
15 |
upper_le :: "'a pd_basis \<Rightarrow> 'a pd_basis \<Rightarrow> bool" (infix "\<le>\<sharp>" 50) where |
|
26420
57a626f64875
make preorder locale into a superclass of class po
huffman
parents:
26407
diff
changeset
|
16 |
"upper_le = (\<lambda>u v. \<forall>y\<in>Rep_pd_basis v. \<exists>x\<in>Rep_pd_basis u. x \<sqsubseteq> y)" |
25904 | 17 |
|
18 |
lemma upper_le_refl [simp]: "t \<le>\<sharp> t" |
|
26420
57a626f64875
make preorder locale into a superclass of class po
huffman
parents:
26407
diff
changeset
|
19 |
unfolding upper_le_def by fast |
25904 | 20 |
|
21 |
lemma upper_le_trans: "\<lbrakk>t \<le>\<sharp> u; u \<le>\<sharp> v\<rbrakk> \<Longrightarrow> t \<le>\<sharp> v" |
|
22 |
unfolding upper_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 upper_le: preorder [upper_le] |
|
31 |
by (rule preorder.intro, rule upper_le_refl, rule upper_le_trans) |
|
32 |
||
33 |
lemma upper_le_minimal [simp]: "PDUnit compact_bot \<le>\<sharp> t" |
|
34 |
unfolding upper_le_def Rep_PDUnit by simp |
|
35 |
||
26420
57a626f64875
make preorder locale into a superclass of class po
huffman
parents:
26407
diff
changeset
|
36 |
lemma PDUnit_upper_mono: "x \<sqsubseteq> y \<Longrightarrow> PDUnit x \<le>\<sharp> PDUnit y" |
25904 | 37 |
unfolding upper_le_def Rep_PDUnit by simp |
38 |
||
39 |
lemma PDPlus_upper_mono: "\<lbrakk>s \<le>\<sharp> t; u \<le>\<sharp> v\<rbrakk> \<Longrightarrow> PDPlus s u \<le>\<sharp> PDPlus t v" |
|
40 |
unfolding upper_le_def Rep_PDPlus by fast |
|
41 |
||
42 |
lemma PDPlus_upper_less: "PDPlus t u \<le>\<sharp> t" |
|
26420
57a626f64875
make preorder locale into a superclass of class po
huffman
parents:
26407
diff
changeset
|
43 |
unfolding upper_le_def Rep_PDPlus by fast |
25904 | 44 |
|
45 |
lemma upper_le_PDUnit_PDUnit_iff [simp]: |
|
26420
57a626f64875
make preorder locale into a superclass of class po
huffman
parents:
26407
diff
changeset
|
46 |
"(PDUnit a \<le>\<sharp> PDUnit b) = a \<sqsubseteq> b" |
25904 | 47 |
unfolding upper_le_def Rep_PDUnit by fast |
48 |
||
49 |
lemma upper_le_PDPlus_PDUnit_iff: |
|
50 |
"(PDPlus t u \<le>\<sharp> PDUnit a) = (t \<le>\<sharp> PDUnit a \<or> u \<le>\<sharp> PDUnit a)" |
|
51 |
unfolding upper_le_def Rep_PDPlus Rep_PDUnit by fast |
|
52 |
||
53 |
lemma upper_le_PDPlus_iff: "(t \<le>\<sharp> PDPlus u v) = (t \<le>\<sharp> u \<and> t \<le>\<sharp> v)" |
|
54 |
unfolding upper_le_def Rep_PDPlus by fast |
|
55 |
||
56 |
lemma upper_le_induct [induct set: upper_le]: |
|
57 |
assumes le: "t \<le>\<sharp> u" |
|
26420
57a626f64875
make preorder locale into a superclass of class po
huffman
parents:
26407
diff
changeset
|
58 |
assumes 1: "\<And>a b. a \<sqsubseteq> b \<Longrightarrow> P (PDUnit a) (PDUnit b)" |
25904 | 59 |
assumes 2: "\<And>t u a. P t (PDUnit a) \<Longrightarrow> P (PDPlus t u) (PDUnit a)" |
60 |
assumes 3: "\<And>t u v. \<lbrakk>P t u; P t v\<rbrakk> \<Longrightarrow> P t (PDPlus u v)" |
|
61 |
shows "P t u" |
|
62 |
using le apply (induct u arbitrary: t rule: pd_basis_induct) |
|
63 |
apply (erule rev_mp) |
|
64 |
apply (induct_tac t rule: pd_basis_induct) |
|
65 |
apply (simp add: 1) |
|
66 |
apply (simp add: upper_le_PDPlus_PDUnit_iff) |
|
67 |
apply (simp add: 2) |
|
68 |
apply (subst PDPlus_commute) |
|
69 |
apply (simp add: 2) |
|
70 |
apply (simp add: upper_le_PDPlus_iff 3) |
|
71 |
done |
|
72 |
||
73 |
lemma approx_pd_upper_mono1: |
|
74 |
"i \<le> j \<Longrightarrow> approx_pd i t \<le>\<sharp> approx_pd j t" |
|
75 |
apply (induct t rule: pd_basis_induct) |
|
76 |
apply (simp add: compact_approx_mono1) |
|
77 |
apply (simp add: PDPlus_upper_mono) |
|
78 |
done |
|
79 |
||
80 |
lemma approx_pd_upper_le: "approx_pd i t \<le>\<sharp> t" |
|
81 |
apply (induct t rule: pd_basis_induct) |
|
82 |
apply (simp add: compact_approx_le) |
|
83 |
apply (simp add: PDPlus_upper_mono) |
|
84 |
done |
|
85 |
||
86 |
lemma approx_pd_upper_mono: |
|
87 |
"t \<le>\<sharp> u \<Longrightarrow> approx_pd n t \<le>\<sharp> approx_pd n u" |
|
88 |
apply (erule upper_le_induct) |
|
89 |
apply (simp add: compact_approx_mono) |
|
90 |
apply (simp add: upper_le_PDPlus_PDUnit_iff) |
|
91 |
apply (simp add: upper_le_PDPlus_iff) |
|
92 |
done |
|
93 |
||
94 |
||
95 |
subsection {* Type definition *} |
|
96 |
||
97 |
cpodef (open) 'a upper_pd = |
|
26407
562a1d615336
rename class bifinite_cpo to profinite; generalize powerdomains from bifinite to profinite
huffman
parents:
26041
diff
changeset
|
98 |
"{S::'a::profinite pd_basis set. upper_le.ideal S}" |
25904 | 99 |
apply (simp add: upper_le.adm_ideal) |
100 |
apply (fast intro: upper_le.ideal_principal) |
|
101 |
done |
|
102 |
||
103 |
lemma ideal_Rep_upper_pd: "upper_le.ideal (Rep_upper_pd x)" |
|
26927 | 104 |
by (rule Rep_upper_pd [unfolded mem_Collect_eq]) |
25904 | 105 |
|
106 |
definition |
|
107 |
upper_principal :: "'a pd_basis \<Rightarrow> 'a upper_pd" where |
|
108 |
"upper_principal t = Abs_upper_pd {u. u \<le>\<sharp> t}" |
|
109 |
||
110 |
lemma Rep_upper_principal: |
|
111 |
"Rep_upper_pd (upper_principal t) = {u. u \<le>\<sharp> t}" |
|
112 |
unfolding upper_principal_def |
|
26927 | 113 |
apply (rule Abs_upper_pd_inverse [unfolded mem_Collect_eq]) |
25904 | 114 |
apply (rule upper_le.ideal_principal) |
115 |
done |
|
116 |
||
117 |
interpretation upper_pd: |
|
26927 | 118 |
ideal_completion [upper_le approx_pd upper_principal Rep_upper_pd] |
25904 | 119 |
apply unfold_locales |
120 |
apply (rule approx_pd_upper_le) |
|
121 |
apply (rule approx_pd_idem) |
|
122 |
apply (erule approx_pd_upper_mono) |
|
123 |
apply (rule approx_pd_upper_mono1, simp) |
|
124 |
apply (rule finite_range_approx_pd) |
|
125 |
apply (rule ex_approx_pd_eq) |
|
26420
57a626f64875
make preorder locale into a superclass of class po
huffman
parents:
26407
diff
changeset
|
126 |
apply (rule ideal_Rep_upper_pd) |
57a626f64875
make preorder locale into a superclass of class po
huffman
parents:
26407
diff
changeset
|
127 |
apply (rule cont_Rep_upper_pd) |
57a626f64875
make preorder locale into a superclass of class po
huffman
parents:
26407
diff
changeset
|
128 |
apply (rule Rep_upper_principal) |
26806 | 129 |
apply (simp only: less_upper_pd_def less_set_eq) |
25904 | 130 |
done |
131 |
||
132 |
lemma upper_principal_less_iff [simp]: |
|
26927 | 133 |
"upper_principal t \<sqsubseteq> upper_principal u \<longleftrightarrow> t \<le>\<sharp> u" |
134 |
by (rule upper_pd.principal_less_iff) |
|
135 |
||
136 |
lemma upper_principal_eq_iff: |
|
137 |
"upper_principal t = upper_principal u \<longleftrightarrow> t \<le>\<sharp> u \<and> u \<le>\<sharp> t" |
|
138 |
by (rule upper_pd.principal_eq_iff) |
|
25904 | 139 |
|
140 |
lemma upper_principal_mono: |
|
141 |
"t \<le>\<sharp> u \<Longrightarrow> upper_principal t \<sqsubseteq> upper_principal u" |
|
142 |
by (rule upper_pd.principal_mono) |
|
143 |
||
144 |
lemma compact_upper_principal: "compact (upper_principal t)" |
|
145 |
by (rule upper_pd.compact_principal) |
|
146 |
||
147 |
lemma upper_pd_minimal: "upper_principal (PDUnit compact_bot) \<sqsubseteq> ys" |
|
148 |
by (induct ys rule: upper_pd.principal_induct, simp, simp) |
|
149 |
||
150 |
instance upper_pd :: (bifinite) pcpo |
|
26927 | 151 |
by intro_classes (fast intro: upper_pd_minimal) |
25904 | 152 |
|
153 |
lemma inst_upper_pd_pcpo: "\<bottom> = upper_principal (PDUnit compact_bot)" |
|
154 |
by (rule upper_pd_minimal [THEN UU_I, symmetric]) |
|
155 |
||
156 |
||
157 |
subsection {* Approximation *} |
|
158 |
||
26962
c8b20f615d6c
use new class package for classes profinite, bifinite; remove approx class
huffman
parents:
26927
diff
changeset
|
159 |
instantiation upper_pd :: (profinite) profinite |
c8b20f615d6c
use new class package for classes profinite, bifinite; remove approx class
huffman
parents:
26927
diff
changeset
|
160 |
begin |
25904 | 161 |
|
26962
c8b20f615d6c
use new class package for classes profinite, bifinite; remove approx class
huffman
parents:
26927
diff
changeset
|
162 |
definition |
c8b20f615d6c
use new class package for classes profinite, bifinite; remove approx class
huffman
parents:
26927
diff
changeset
|
163 |
approx_upper_pd_def: "approx = upper_pd.completion_approx" |
26927 | 164 |
|
26962
c8b20f615d6c
use new class package for classes profinite, bifinite; remove approx class
huffman
parents:
26927
diff
changeset
|
165 |
instance |
26927 | 166 |
apply (intro_classes, unfold approx_upper_pd_def) |
167 |
apply (simp add: upper_pd.chain_completion_approx) |
|
168 |
apply (rule upper_pd.lub_completion_approx) |
|
169 |
apply (rule upper_pd.completion_approx_idem) |
|
170 |
apply (rule upper_pd.finite_fixes_completion_approx) |
|
171 |
done |
|
172 |
||
26962
c8b20f615d6c
use new class package for classes profinite, bifinite; remove approx class
huffman
parents:
26927
diff
changeset
|
173 |
end |
c8b20f615d6c
use new class package for classes profinite, bifinite; remove approx class
huffman
parents:
26927
diff
changeset
|
174 |
|
26927 | 175 |
instance upper_pd :: (bifinite) bifinite .. |
25904 | 176 |
|
177 |
lemma approx_upper_principal [simp]: |
|
178 |
"approx n\<cdot>(upper_principal t) = upper_principal (approx_pd n t)" |
|
179 |
unfolding approx_upper_pd_def |
|
26927 | 180 |
by (rule upper_pd.completion_approx_principal) |
25904 | 181 |
|
182 |
lemma approx_eq_upper_principal: |
|
183 |
"\<exists>t\<in>Rep_upper_pd xs. approx n\<cdot>xs = upper_principal (approx_pd n t)" |
|
184 |
unfolding approx_upper_pd_def |
|
26927 | 185 |
by (rule upper_pd.completion_approx_eq_principal) |
26407
562a1d615336
rename class bifinite_cpo to profinite; generalize powerdomains from bifinite to profinite
huffman
parents:
26041
diff
changeset
|
186 |
|
25904 | 187 |
lemma compact_imp_upper_principal: |
188 |
"compact xs \<Longrightarrow> \<exists>t. xs = upper_principal t" |
|
27267
5ebfb7f25ebb
add lemma compact_imp_principal to locale ideal_completion
huffman
parents:
26962
diff
changeset
|
189 |
by (rule upper_pd.compact_imp_principal) |
25904 | 190 |
|
191 |
lemma upper_principal_induct: |
|
192 |
"\<lbrakk>adm P; \<And>t. P (upper_principal t)\<rbrakk> \<Longrightarrow> P xs" |
|
26927 | 193 |
by (rule upper_pd.principal_induct) |
25904 | 194 |
|
195 |
lemma upper_principal_induct2: |
|
196 |
"\<lbrakk>\<And>ys. adm (\<lambda>xs. P xs ys); \<And>xs. adm (\<lambda>ys. P xs ys); |
|
197 |
\<And>t u. P (upper_principal t) (upper_principal u)\<rbrakk> \<Longrightarrow> P xs ys" |
|
198 |
apply (rule_tac x=ys in spec) |
|
199 |
apply (rule_tac xs=xs in upper_principal_induct, simp) |
|
200 |
apply (rule allI, rename_tac ys) |
|
201 |
apply (rule_tac xs=ys in upper_principal_induct, simp) |
|
202 |
apply simp |
|
203 |
done |
|
204 |
||
205 |
||
26927 | 206 |
subsection {* Monadic unit and plus *} |
25904 | 207 |
|
208 |
definition |
|
209 |
upper_unit :: "'a \<rightarrow> 'a upper_pd" where |
|
210 |
"upper_unit = compact_basis.basis_fun (\<lambda>a. upper_principal (PDUnit a))" |
|
211 |
||
212 |
definition |
|
213 |
upper_plus :: "'a upper_pd \<rightarrow> 'a upper_pd \<rightarrow> 'a upper_pd" where |
|
214 |
"upper_plus = upper_pd.basis_fun (\<lambda>t. upper_pd.basis_fun (\<lambda>u. |
|
215 |
upper_principal (PDPlus t u)))" |
|
216 |
||
217 |
abbreviation |
|
218 |
upper_add :: "'a upper_pd \<Rightarrow> 'a upper_pd \<Rightarrow> 'a upper_pd" |
|
219 |
(infixl "+\<sharp>" 65) where |
|
220 |
"xs +\<sharp> ys == upper_plus\<cdot>xs\<cdot>ys" |
|
221 |
||
26927 | 222 |
syntax |
223 |
"_upper_pd" :: "args \<Rightarrow> 'a upper_pd" ("{_}\<sharp>") |
|
224 |
||
225 |
translations |
|
226 |
"{x,xs}\<sharp>" == "{x}\<sharp> +\<sharp> {xs}\<sharp>" |
|
227 |
"{x}\<sharp>" == "CONST upper_unit\<cdot>x" |
|
228 |
||
229 |
lemma upper_unit_Rep_compact_basis [simp]: |
|
230 |
"{Rep_compact_basis a}\<sharp> = upper_principal (PDUnit a)" |
|
231 |
unfolding upper_unit_def |
|
232 |
by (simp add: compact_basis.basis_fun_principal |
|
233 |
upper_principal_mono PDUnit_upper_mono) |
|
234 |
||
25904 | 235 |
lemma upper_plus_principal [simp]: |
26927 | 236 |
"upper_principal t +\<sharp> upper_principal u = upper_principal (PDPlus t u)" |
25904 | 237 |
unfolding upper_plus_def |
238 |
by (simp add: upper_pd.basis_fun_principal |
|
239 |
upper_pd.basis_fun_mono PDPlus_upper_mono) |
|
240 |
||
26927 | 241 |
lemma approx_upper_unit [simp]: |
242 |
"approx n\<cdot>{x}\<sharp> = {approx n\<cdot>x}\<sharp>" |
|
243 |
apply (induct x rule: compact_basis_induct, simp) |
|
244 |
apply (simp add: approx_Rep_compact_basis) |
|
245 |
done |
|
246 |
||
25904 | 247 |
lemma approx_upper_plus [simp]: |
26927 | 248 |
"approx n\<cdot>(xs +\<sharp> ys) = (approx n\<cdot>xs) +\<sharp> (approx n\<cdot>ys)" |
25904 | 249 |
by (induct xs ys rule: upper_principal_induct2, simp, simp, simp) |
250 |
||
26927 | 251 |
lemma upper_plus_assoc: "(xs +\<sharp> ys) +\<sharp> zs = xs +\<sharp> (ys +\<sharp> zs)" |
25904 | 252 |
apply (induct xs ys arbitrary: zs rule: upper_principal_induct2, simp, simp) |
253 |
apply (rule_tac xs=zs in upper_principal_induct, simp) |
|
254 |
apply (simp add: PDPlus_assoc) |
|
255 |
done |
|
256 |
||
26927 | 257 |
lemma upper_plus_commute: "xs +\<sharp> ys = ys +\<sharp> xs" |
258 |
apply (induct xs ys rule: upper_principal_induct2, simp, simp) |
|
259 |
apply (simp add: PDPlus_commute) |
|
260 |
done |
|
261 |
||
262 |
lemma upper_plus_absorb: "xs +\<sharp> xs = xs" |
|
25904 | 263 |
apply (induct xs rule: upper_principal_induct, simp) |
264 |
apply (simp add: PDPlus_absorb) |
|
265 |
done |
|
266 |
||
26927 | 267 |
interpretation aci_upper_plus: ab_semigroup_idem_mult ["op +\<sharp>"] |
268 |
by unfold_locales |
|
269 |
(rule upper_plus_assoc upper_plus_commute upper_plus_absorb)+ |
|
270 |
||
271 |
lemma upper_plus_left_commute: "xs +\<sharp> (ys +\<sharp> zs) = ys +\<sharp> (xs +\<sharp> zs)" |
|
272 |
by (rule aci_upper_plus.mult_left_commute) |
|
273 |
||
274 |
lemma upper_plus_left_absorb: "xs +\<sharp> (xs +\<sharp> ys) = xs +\<sharp> ys" |
|
275 |
by (rule aci_upper_plus.mult_left_idem) |
|
276 |
||
277 |
lemmas upper_plus_aci = aci_upper_plus.mult_ac_idem |
|
278 |
||
279 |
lemma upper_plus_less1: "xs +\<sharp> ys \<sqsubseteq> xs" |
|
25904 | 280 |
apply (induct xs ys rule: upper_principal_induct2, simp, simp) |
281 |
apply (simp add: PDPlus_upper_less) |
|
282 |
done |
|
283 |
||
26927 | 284 |
lemma upper_plus_less2: "xs +\<sharp> ys \<sqsubseteq> ys" |
25904 | 285 |
by (subst upper_plus_commute, rule upper_plus_less1) |
286 |
||
26927 | 287 |
lemma upper_plus_greatest: "\<lbrakk>xs \<sqsubseteq> ys; xs \<sqsubseteq> zs\<rbrakk> \<Longrightarrow> xs \<sqsubseteq> ys +\<sharp> zs" |
25904 | 288 |
apply (subst upper_plus_absorb [of xs, symmetric]) |
289 |
apply (erule (1) monofun_cfun [OF monofun_cfun_arg]) |
|
290 |
done |
|
291 |
||
292 |
lemma upper_less_plus_iff: |
|
26927 | 293 |
"xs \<sqsubseteq> ys +\<sharp> zs \<longleftrightarrow> xs \<sqsubseteq> ys \<and> xs \<sqsubseteq> zs" |
25904 | 294 |
apply safe |
295 |
apply (erule trans_less [OF _ upper_plus_less1]) |
|
296 |
apply (erule trans_less [OF _ upper_plus_less2]) |
|
297 |
apply (erule (1) upper_plus_greatest) |
|
298 |
done |
|
299 |
||
300 |
lemma upper_plus_less_unit_iff: |
|
26927 | 301 |
"xs +\<sharp> ys \<sqsubseteq> {z}\<sharp> \<longleftrightarrow> xs \<sqsubseteq> {z}\<sharp> \<or> ys \<sqsubseteq> {z}\<sharp>" |
25904 | 302 |
apply (rule iffI) |
303 |
apply (subgoal_tac |
|
26927 | 304 |
"adm (\<lambda>f. f\<cdot>xs \<sqsubseteq> f\<cdot>{z}\<sharp> \<or> f\<cdot>ys \<sqsubseteq> f\<cdot>{z}\<sharp>)") |
25925 | 305 |
apply (drule admD, rule chain_approx) |
25904 | 306 |
apply (drule_tac f="approx i" in monofun_cfun_arg) |
307 |
apply (cut_tac xs="approx i\<cdot>xs" in compact_imp_upper_principal, simp) |
|
308 |
apply (cut_tac xs="approx i\<cdot>ys" in compact_imp_upper_principal, simp) |
|
309 |
apply (cut_tac x="approx i\<cdot>z" in compact_imp_Rep_compact_basis, simp) |
|
310 |
apply (clarify, simp add: upper_le_PDPlus_PDUnit_iff) |
|
311 |
apply simp |
|
312 |
apply simp |
|
313 |
apply (erule disjE) |
|
314 |
apply (erule trans_less [OF upper_plus_less1]) |
|
315 |
apply (erule trans_less [OF upper_plus_less2]) |
|
316 |
done |
|
317 |
||
26927 | 318 |
lemma upper_unit_less_iff [simp]: "{x}\<sharp> \<sqsubseteq> {y}\<sharp> \<longleftrightarrow> x \<sqsubseteq> y" |
319 |
apply (rule iffI) |
|
320 |
apply (rule bifinite_less_ext) |
|
321 |
apply (drule_tac f="approx i" in monofun_cfun_arg, simp) |
|
322 |
apply (cut_tac x="approx i\<cdot>x" in compact_imp_Rep_compact_basis, simp) |
|
323 |
apply (cut_tac x="approx i\<cdot>y" in compact_imp_Rep_compact_basis, simp) |
|
324 |
apply (clarify, simp add: compact_le_def) |
|
325 |
apply (erule monofun_cfun_arg) |
|
326 |
done |
|
327 |
||
25904 | 328 |
lemmas upper_pd_less_simps = |
329 |
upper_unit_less_iff |
|
330 |
upper_less_plus_iff |
|
331 |
upper_plus_less_unit_iff |
|
332 |
||
26927 | 333 |
lemma upper_unit_eq_iff [simp]: "{x}\<sharp> = {y}\<sharp> \<longleftrightarrow> x = y" |
334 |
unfolding po_eq_conv by simp |
|
335 |
||
336 |
lemma upper_unit_strict [simp]: "{\<bottom>}\<sharp> = \<bottom>" |
|
337 |
unfolding inst_upper_pd_pcpo Rep_compact_bot [symmetric] by simp |
|
338 |
||
339 |
lemma upper_plus_strict1 [simp]: "\<bottom> +\<sharp> ys = \<bottom>" |
|
340 |
by (rule UU_I, rule upper_plus_less1) |
|
341 |
||
342 |
lemma upper_plus_strict2 [simp]: "xs +\<sharp> \<bottom> = \<bottom>" |
|
343 |
by (rule UU_I, rule upper_plus_less2) |
|
344 |
||
345 |
lemma upper_unit_strict_iff [simp]: "{x}\<sharp> = \<bottom> \<longleftrightarrow> x = \<bottom>" |
|
346 |
unfolding upper_unit_strict [symmetric] by (rule upper_unit_eq_iff) |
|
347 |
||
348 |
lemma upper_plus_strict_iff [simp]: |
|
349 |
"xs +\<sharp> ys = \<bottom> \<longleftrightarrow> xs = \<bottom> \<or> ys = \<bottom>" |
|
350 |
apply (rule iffI) |
|
351 |
apply (erule rev_mp) |
|
352 |
apply (rule upper_principal_induct2 [where xs=xs and ys=ys], simp, simp) |
|
353 |
apply (simp add: inst_upper_pd_pcpo upper_principal_eq_iff |
|
354 |
upper_le_PDPlus_PDUnit_iff) |
|
355 |
apply auto |
|
356 |
done |
|
357 |
||
358 |
lemma compact_upper_unit_iff [simp]: "compact {x}\<sharp> \<longleftrightarrow> compact x" |
|
359 |
unfolding bifinite_compact_iff by simp |
|
360 |
||
361 |
lemma compact_upper_plus [simp]: |
|
362 |
"\<lbrakk>compact xs; compact ys\<rbrakk> \<Longrightarrow> compact (xs +\<sharp> ys)" |
|
363 |
apply (drule compact_imp_upper_principal)+ |
|
364 |
apply (auto simp add: compact_upper_principal) |
|
365 |
done |
|
366 |
||
25904 | 367 |
|
368 |
subsection {* Induction rules *} |
|
369 |
||
370 |
lemma upper_pd_induct1: |
|
371 |
assumes P: "adm P" |
|
26927 | 372 |
assumes unit: "\<And>x. P {x}\<sharp>" |
373 |
assumes insert: "\<And>x ys. \<lbrakk>P {x}\<sharp>; P ys\<rbrakk> \<Longrightarrow> P ({x}\<sharp> +\<sharp> ys)" |
|
25904 | 374 |
shows "P (xs::'a upper_pd)" |
375 |
apply (induct xs rule: upper_principal_induct, rule P) |
|
376 |
apply (induct_tac t rule: pd_basis_induct1) |
|
377 |
apply (simp only: upper_unit_Rep_compact_basis [symmetric]) |
|
378 |
apply (rule unit) |
|
379 |
apply (simp only: upper_unit_Rep_compact_basis [symmetric] |
|
380 |
upper_plus_principal [symmetric]) |
|
381 |
apply (erule insert [OF unit]) |
|
382 |
done |
|
383 |
||
384 |
lemma upper_pd_induct: |
|
385 |
assumes P: "adm P" |
|
26927 | 386 |
assumes unit: "\<And>x. P {x}\<sharp>" |
387 |
assumes plus: "\<And>xs ys. \<lbrakk>P xs; P ys\<rbrakk> \<Longrightarrow> P (xs +\<sharp> ys)" |
|
25904 | 388 |
shows "P (xs::'a upper_pd)" |
389 |
apply (induct xs rule: upper_principal_induct, rule P) |
|
390 |
apply (induct_tac t rule: pd_basis_induct) |
|
391 |
apply (simp only: upper_unit_Rep_compact_basis [symmetric] unit) |
|
392 |
apply (simp only: upper_plus_principal [symmetric] plus) |
|
393 |
done |
|
394 |
||
395 |
||
396 |
subsection {* Monadic bind *} |
|
397 |
||
398 |
definition |
|
399 |
upper_bind_basis :: |
|
400 |
"'a pd_basis \<Rightarrow> ('a \<rightarrow> 'b upper_pd) \<rightarrow> 'b upper_pd" where |
|
401 |
"upper_bind_basis = fold_pd |
|
402 |
(\<lambda>a. \<Lambda> f. f\<cdot>(Rep_compact_basis a)) |
|
26927 | 403 |
(\<lambda>x y. \<Lambda> f. x\<cdot>f +\<sharp> y\<cdot>f)" |
25904 | 404 |
|
26927 | 405 |
lemma ACI_upper_bind: |
406 |
"ab_semigroup_idem_mult (\<lambda>x y. \<Lambda> f. x\<cdot>f +\<sharp> y\<cdot>f)" |
|
25904 | 407 |
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
|
408 |
apply (simp add: upper_plus_assoc) |
25904 | 409 |
apply (simp add: upper_plus_commute) |
410 |
apply (simp add: upper_plus_absorb eta_cfun) |
|
411 |
done |
|
412 |
||
413 |
lemma upper_bind_basis_simps [simp]: |
|
414 |
"upper_bind_basis (PDUnit a) = |
|
415 |
(\<Lambda> f. f\<cdot>(Rep_compact_basis a))" |
|
416 |
"upper_bind_basis (PDPlus t u) = |
|
26927 | 417 |
(\<Lambda> f. upper_bind_basis t\<cdot>f +\<sharp> upper_bind_basis u\<cdot>f)" |
25904 | 418 |
unfolding upper_bind_basis_def |
419 |
apply - |
|
26927 | 420 |
apply (rule fold_pd_PDUnit [OF ACI_upper_bind]) |
421 |
apply (rule fold_pd_PDPlus [OF ACI_upper_bind]) |
|
25904 | 422 |
done |
423 |
||
424 |
lemma upper_bind_basis_mono: |
|
425 |
"t \<le>\<sharp> u \<Longrightarrow> upper_bind_basis t \<sqsubseteq> upper_bind_basis u" |
|
426 |
unfolding expand_cfun_less |
|
427 |
apply (erule upper_le_induct, safe) |
|
428 |
apply (simp add: compact_le_def monofun_cfun) |
|
429 |
apply (simp add: trans_less [OF upper_plus_less1]) |
|
430 |
apply (simp add: upper_less_plus_iff) |
|
431 |
done |
|
432 |
||
433 |
definition |
|
434 |
upper_bind :: "'a upper_pd \<rightarrow> ('a \<rightarrow> 'b upper_pd) \<rightarrow> 'b upper_pd" where |
|
435 |
"upper_bind = upper_pd.basis_fun upper_bind_basis" |
|
436 |
||
437 |
lemma upper_bind_principal [simp]: |
|
438 |
"upper_bind\<cdot>(upper_principal t) = upper_bind_basis t" |
|
439 |
unfolding upper_bind_def |
|
440 |
apply (rule upper_pd.basis_fun_principal) |
|
441 |
apply (erule upper_bind_basis_mono) |
|
442 |
done |
|
443 |
||
444 |
lemma upper_bind_unit [simp]: |
|
26927 | 445 |
"upper_bind\<cdot>{x}\<sharp>\<cdot>f = f\<cdot>x" |
25904 | 446 |
by (induct x rule: compact_basis_induct, simp, simp) |
447 |
||
448 |
lemma upper_bind_plus [simp]: |
|
26927 | 449 |
"upper_bind\<cdot>(xs +\<sharp> ys)\<cdot>f = upper_bind\<cdot>xs\<cdot>f +\<sharp> upper_bind\<cdot>ys\<cdot>f" |
25904 | 450 |
by (induct xs ys rule: upper_principal_induct2, simp, simp, simp) |
451 |
||
452 |
lemma upper_bind_strict [simp]: "upper_bind\<cdot>\<bottom>\<cdot>f = f\<cdot>\<bottom>" |
|
453 |
unfolding upper_unit_strict [symmetric] by (rule upper_bind_unit) |
|
454 |
||
455 |
||
456 |
subsection {* Map and join *} |
|
457 |
||
458 |
definition |
|
459 |
upper_map :: "('a \<rightarrow> 'b) \<rightarrow> 'a upper_pd \<rightarrow> 'b upper_pd" where |
|
26927 | 460 |
"upper_map = (\<Lambda> f xs. upper_bind\<cdot>xs\<cdot>(\<Lambda> x. {f\<cdot>x}\<sharp>))" |
25904 | 461 |
|
462 |
definition |
|
463 |
upper_join :: "'a upper_pd upper_pd \<rightarrow> 'a upper_pd" where |
|
464 |
"upper_join = (\<Lambda> xss. upper_bind\<cdot>xss\<cdot>(\<Lambda> xs. xs))" |
|
465 |
||
466 |
lemma upper_map_unit [simp]: |
|
26927 | 467 |
"upper_map\<cdot>f\<cdot>{x}\<sharp> = {f\<cdot>x}\<sharp>" |
25904 | 468 |
unfolding upper_map_def by simp |
469 |
||
470 |
lemma upper_map_plus [simp]: |
|
26927 | 471 |
"upper_map\<cdot>f\<cdot>(xs +\<sharp> ys) = upper_map\<cdot>f\<cdot>xs +\<sharp> upper_map\<cdot>f\<cdot>ys" |
25904 | 472 |
unfolding upper_map_def by simp |
473 |
||
474 |
lemma upper_join_unit [simp]: |
|
26927 | 475 |
"upper_join\<cdot>{xs}\<sharp> = xs" |
25904 | 476 |
unfolding upper_join_def by simp |
477 |
||
478 |
lemma upper_join_plus [simp]: |
|
26927 | 479 |
"upper_join\<cdot>(xss +\<sharp> yss) = upper_join\<cdot>xss +\<sharp> upper_join\<cdot>yss" |
25904 | 480 |
unfolding upper_join_def by simp |
481 |
||
482 |
lemma upper_map_ident: "upper_map\<cdot>(\<Lambda> x. x)\<cdot>xs = xs" |
|
483 |
by (induct xs rule: upper_pd_induct, simp_all) |
|
484 |
||
485 |
lemma upper_map_map: |
|
486 |
"upper_map\<cdot>f\<cdot>(upper_map\<cdot>g\<cdot>xs) = upper_map\<cdot>(\<Lambda> x. f\<cdot>(g\<cdot>x))\<cdot>xs" |
|
487 |
by (induct xs rule: upper_pd_induct, simp_all) |
|
488 |
||
489 |
lemma upper_join_map_unit: |
|
490 |
"upper_join\<cdot>(upper_map\<cdot>upper_unit\<cdot>xs) = xs" |
|
491 |
by (induct xs rule: upper_pd_induct, simp_all) |
|
492 |
||
493 |
lemma upper_join_map_join: |
|
494 |
"upper_join\<cdot>(upper_map\<cdot>upper_join\<cdot>xsss) = upper_join\<cdot>(upper_join\<cdot>xsss)" |
|
495 |
by (induct xsss rule: upper_pd_induct, simp_all) |
|
496 |
||
497 |
lemma upper_join_map_map: |
|
498 |
"upper_join\<cdot>(upper_map\<cdot>(upper_map\<cdot>f)\<cdot>xss) = |
|
499 |
upper_map\<cdot>f\<cdot>(upper_join\<cdot>xss)" |
|
500 |
by (induct xss rule: upper_pd_induct, simp_all) |
|
501 |
||
502 |
lemma upper_map_approx: "upper_map\<cdot>(approx n)\<cdot>xs = approx n\<cdot>xs" |
|
503 |
by (induct xs rule: upper_pd_induct, simp_all) |
|
504 |
||
505 |
end |