| author | bulwahn | 
| Sat, 24 Oct 2009 16:55:42 +0200 | |
| changeset 33124 | 5378e61add1a | 
| parent 31076 | 99fe356cbbc2 | 
| child 33585 | 8d39394fe5cf | 
| permissions | -rw-r--r-- | 
| 25904 | 1 | (* Title: HOLCF/LowerPD.thy | 
| 2 | Author: Brian Huffman | |
| 3 | *) | |
| 4 | ||
| 5 | header {* Lower powerdomain *}
 | |
| 6 | ||
| 7 | theory LowerPD | |
| 8 | imports CompactBasis | |
| 9 | begin | |
| 10 | ||
| 11 | subsection {* Basis preorder *}
 | |
| 12 | ||
| 13 | definition | |
| 14 | 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: 
26407diff
changeset | 15 | "lower_le = (\<lambda>u v. \<forall>x\<in>Rep_pd_basis u. \<exists>y\<in>Rep_pd_basis v. x \<sqsubseteq> y)" | 
| 25904 | 16 | |
| 17 | lemma lower_le_refl [simp]: "t \<le>\<flat> t" | |
| 26420 
57a626f64875
make preorder locale into a superclass of class po
 huffman parents: 
26407diff
changeset | 18 | unfolding lower_le_def by fast | 
| 25904 | 19 | |
| 20 | lemma lower_le_trans: "\<lbrakk>t \<le>\<flat> u; u \<le>\<flat> v\<rbrakk> \<Longrightarrow> t \<le>\<flat> v" | |
| 21 | unfolding lower_le_def | |
| 22 | apply (rule ballI) | |
| 23 | apply (drule (1) bspec, erule bexE) | |
| 24 | apply (drule (1) bspec, erule bexE) | |
| 25 | apply (erule rev_bexI) | |
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 26 | apply (erule (1) below_trans) | 
| 25904 | 27 | done | 
| 28 | ||
| 30729 
461ee3e49ad3
interpretation/interpret: prefixes are mandatory by default;
 wenzelm parents: 
29990diff
changeset | 29 | interpretation lower_le: preorder lower_le | 
| 25904 | 30 | by (rule preorder.intro, rule lower_le_refl, rule lower_le_trans) | 
| 31 | ||
| 32 | lemma lower_le_minimal [simp]: "PDUnit compact_bot \<le>\<flat> t" | |
| 33 | unfolding lower_le_def Rep_PDUnit | |
| 34 | by (simp, rule Rep_pd_basis_nonempty [folded ex_in_conv]) | |
| 35 | ||
| 26420 
57a626f64875
make preorder locale into a superclass of class po
 huffman parents: 
26407diff
changeset | 36 | lemma PDUnit_lower_mono: "x \<sqsubseteq> y \<Longrightarrow> PDUnit x \<le>\<flat> PDUnit y" | 
| 25904 | 37 | unfolding lower_le_def Rep_PDUnit by fast | 
| 38 | ||
| 39 | lemma PDPlus_lower_mono: "\<lbrakk>s \<le>\<flat> t; u \<le>\<flat> v\<rbrakk> \<Longrightarrow> PDPlus s u \<le>\<flat> PDPlus t v" | |
| 40 | unfolding lower_le_def Rep_PDPlus by fast | |
| 41 | ||
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 42 | lemma PDPlus_lower_le: "t \<le>\<flat> PDPlus t u" | 
| 26420 
57a626f64875
make preorder locale into a superclass of class po
 huffman parents: 
26407diff
changeset | 43 | unfolding lower_le_def Rep_PDPlus by fast | 
| 25904 | 44 | |
| 45 | lemma lower_le_PDUnit_PDUnit_iff [simp]: | |
| 26420 
57a626f64875
make preorder locale into a superclass of class po
 huffman parents: 
26407diff
changeset | 46 | "(PDUnit a \<le>\<flat> PDUnit b) = a \<sqsubseteq> b" | 
| 25904 | 47 | unfolding lower_le_def Rep_PDUnit by fast | 
| 48 | ||
| 49 | lemma lower_le_PDUnit_PDPlus_iff: | |
| 50 | "(PDUnit a \<le>\<flat> PDPlus t u) = (PDUnit a \<le>\<flat> t \<or> PDUnit a \<le>\<flat> u)" | |
| 51 | unfolding lower_le_def Rep_PDPlus Rep_PDUnit by fast | |
| 52 | ||
| 53 | lemma lower_le_PDPlus_iff: "(PDPlus t u \<le>\<flat> v) = (t \<le>\<flat> v \<and> u \<le>\<flat> v)" | |
| 54 | unfolding lower_le_def Rep_PDPlus by fast | |
| 55 | ||
| 56 | lemma lower_le_induct [induct set: lower_le]: | |
| 57 | assumes le: "t \<le>\<flat> u" | |
| 26420 
57a626f64875
make preorder locale into a superclass of class po
 huffman parents: 
26407diff
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 (PDUnit a) t \<Longrightarrow> P (PDUnit a) (PDPlus t u)" | 
| 60 | assumes 3: "\<And>t u v. \<lbrakk>P t v; P u v\<rbrakk> \<Longrightarrow> P (PDPlus t u) v" | |
| 61 | shows "P t u" | |
| 62 | using le | |
| 63 | apply (induct t arbitrary: u rule: pd_basis_induct) | |
| 64 | apply (erule rev_mp) | |
| 65 | apply (induct_tac u rule: pd_basis_induct) | |
| 66 | apply (simp add: 1) | |
| 67 | apply (simp add: lower_le_PDUnit_PDPlus_iff) | |
| 68 | apply (simp add: 2) | |
| 69 | apply (subst PDPlus_commute) | |
| 70 | apply (simp add: 2) | |
| 71 | apply (simp add: lower_le_PDPlus_iff 3) | |
| 72 | done | |
| 73 | ||
| 27405 | 74 | lemma pd_take_lower_chain: | 
| 75 | "pd_take n t \<le>\<flat> pd_take (Suc n) t" | |
| 25904 | 76 | apply (induct t rule: pd_basis_induct) | 
| 27289 | 77 | apply (simp add: compact_basis.take_chain) | 
| 25904 | 78 | apply (simp add: PDPlus_lower_mono) | 
| 79 | done | |
| 80 | ||
| 27405 | 81 | lemma pd_take_lower_le: "pd_take i t \<le>\<flat> t" | 
| 25904 | 82 | apply (induct t rule: pd_basis_induct) | 
| 27289 | 83 | apply (simp add: compact_basis.take_less) | 
| 25904 | 84 | apply (simp add: PDPlus_lower_mono) | 
| 85 | done | |
| 86 | ||
| 27405 | 87 | lemma pd_take_lower_mono: | 
| 88 | "t \<le>\<flat> u \<Longrightarrow> pd_take n t \<le>\<flat> pd_take n u" | |
| 25904 | 89 | apply (erule lower_le_induct) | 
| 27289 | 90 | apply (simp add: compact_basis.take_mono) | 
| 25904 | 91 | apply (simp add: lower_le_PDUnit_PDPlus_iff) | 
| 92 | apply (simp add: lower_le_PDPlus_iff) | |
| 93 | done | |
| 94 | ||
| 95 | ||
| 96 | subsection {* Type definition *}
 | |
| 97 | ||
| 27373 
5794a0e3e26c
remove cset theory; define ideal completions using typedef instead of cpodef
 huffman parents: 
27310diff
changeset | 98 | typedef (open) 'a lower_pd = | 
| 
5794a0e3e26c
remove cset theory; define ideal completions using typedef instead of cpodef
 huffman parents: 
27310diff
changeset | 99 |   "{S::'a pd_basis set. lower_le.ideal S}"
 | 
| 
5794a0e3e26c
remove cset theory; define ideal completions using typedef instead of cpodef
 huffman parents: 
27310diff
changeset | 100 | by (fast intro: lower_le.ideal_principal) | 
| 
5794a0e3e26c
remove cset theory; define ideal completions using typedef instead of cpodef
 huffman parents: 
27310diff
changeset | 101 | |
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 102 | instantiation lower_pd :: (profinite) below | 
| 27373 
5794a0e3e26c
remove cset theory; define ideal completions using typedef instead of cpodef
 huffman parents: 
27310diff
changeset | 103 | begin | 
| 
5794a0e3e26c
remove cset theory; define ideal completions using typedef instead of cpodef
 huffman parents: 
27310diff
changeset | 104 | |
| 
5794a0e3e26c
remove cset theory; define ideal completions using typedef instead of cpodef
 huffman parents: 
27310diff
changeset | 105 | definition | 
| 
5794a0e3e26c
remove cset theory; define ideal completions using typedef instead of cpodef
 huffman parents: 
27310diff
changeset | 106 | "x \<sqsubseteq> y \<longleftrightarrow> Rep_lower_pd x \<subseteq> Rep_lower_pd y" | 
| 
5794a0e3e26c
remove cset theory; define ideal completions using typedef instead of cpodef
 huffman parents: 
27310diff
changeset | 107 | |
| 
5794a0e3e26c
remove cset theory; define ideal completions using typedef instead of cpodef
 huffman parents: 
27310diff
changeset | 108 | instance .. | 
| 
5794a0e3e26c
remove cset theory; define ideal completions using typedef instead of cpodef
 huffman parents: 
27310diff
changeset | 109 | end | 
| 25904 | 110 | |
| 27373 
5794a0e3e26c
remove cset theory; define ideal completions using typedef instead of cpodef
 huffman parents: 
27310diff
changeset | 111 | instance lower_pd :: (profinite) po | 
| 
5794a0e3e26c
remove cset theory; define ideal completions using typedef instead of cpodef
 huffman parents: 
27310diff
changeset | 112 | by (rule lower_le.typedef_ideal_po | 
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 113 | [OF type_definition_lower_pd below_lower_pd_def]) | 
| 27373 
5794a0e3e26c
remove cset theory; define ideal completions using typedef instead of cpodef
 huffman parents: 
27310diff
changeset | 114 | |
| 
5794a0e3e26c
remove cset theory; define ideal completions using typedef instead of cpodef
 huffman parents: 
27310diff
changeset | 115 | instance lower_pd :: (profinite) cpo | 
| 
5794a0e3e26c
remove cset theory; define ideal completions using typedef instead of cpodef
 huffman parents: 
27310diff
changeset | 116 | by (rule lower_le.typedef_ideal_cpo | 
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 117 | [OF type_definition_lower_pd below_lower_pd_def]) | 
| 27373 
5794a0e3e26c
remove cset theory; define ideal completions using typedef instead of cpodef
 huffman parents: 
27310diff
changeset | 118 | |
| 
5794a0e3e26c
remove cset theory; define ideal completions using typedef instead of cpodef
 huffman parents: 
27310diff
changeset | 119 | lemma Rep_lower_pd_lub: | 
| 
5794a0e3e26c
remove cset theory; define ideal completions using typedef instead of cpodef
 huffman parents: 
27310diff
changeset | 120 | "chain Y \<Longrightarrow> Rep_lower_pd (\<Squnion>i. Y i) = (\<Union>i. Rep_lower_pd (Y i))" | 
| 
5794a0e3e26c
remove cset theory; define ideal completions using typedef instead of cpodef
 huffman parents: 
27310diff
changeset | 121 | by (rule lower_le.typedef_ideal_rep_contlub | 
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 122 | [OF type_definition_lower_pd below_lower_pd_def]) | 
| 27373 
5794a0e3e26c
remove cset theory; define ideal completions using typedef instead of cpodef
 huffman parents: 
27310diff
changeset | 123 | |
| 
5794a0e3e26c
remove cset theory; define ideal completions using typedef instead of cpodef
 huffman parents: 
27310diff
changeset | 124 | lemma ideal_Rep_lower_pd: "lower_le.ideal (Rep_lower_pd xs)" | 
| 26927 | 125 | by (rule Rep_lower_pd [unfolded mem_Collect_eq]) | 
| 25904 | 126 | |
| 127 | definition | |
| 128 | lower_principal :: "'a pd_basis \<Rightarrow> 'a lower_pd" where | |
| 27373 
5794a0e3e26c
remove cset theory; define ideal completions using typedef instead of cpodef
 huffman parents: 
27310diff
changeset | 129 |   "lower_principal t = Abs_lower_pd {u. u \<le>\<flat> t}"
 | 
| 25904 | 130 | |
| 131 | lemma Rep_lower_principal: | |
| 27373 
5794a0e3e26c
remove cset theory; define ideal completions using typedef instead of cpodef
 huffman parents: 
27310diff
changeset | 132 |   "Rep_lower_pd (lower_principal t) = {u. u \<le>\<flat> t}"
 | 
| 25904 | 133 | unfolding lower_principal_def | 
| 27297 
2c42b1505f25
removed SetPcpo.thy and cpo instance for type bool;
 huffman parents: 
27289diff
changeset | 134 | by (simp add: Abs_lower_pd_inverse lower_le.ideal_principal) | 
| 25904 | 135 | |
| 30729 
461ee3e49ad3
interpretation/interpret: prefixes are mandatory by default;
 wenzelm parents: 
29990diff
changeset | 136 | interpretation lower_pd: | 
| 29237 | 137 | ideal_completion lower_le pd_take lower_principal Rep_lower_pd | 
| 25904 | 138 | apply unfold_locales | 
| 27405 | 139 | apply (rule pd_take_lower_le) | 
| 140 | apply (rule pd_take_idem) | |
| 141 | apply (erule pd_take_lower_mono) | |
| 142 | apply (rule pd_take_lower_chain) | |
| 143 | apply (rule finite_range_pd_take) | |
| 144 | apply (rule pd_take_covers) | |
| 26420 
57a626f64875
make preorder locale into a superclass of class po
 huffman parents: 
26407diff
changeset | 145 | apply (rule ideal_Rep_lower_pd) | 
| 27373 
5794a0e3e26c
remove cset theory; define ideal completions using typedef instead of cpodef
 huffman parents: 
27310diff
changeset | 146 | apply (erule Rep_lower_pd_lub) | 
| 26420 
57a626f64875
make preorder locale into a superclass of class po
 huffman parents: 
26407diff
changeset | 147 | apply (rule Rep_lower_principal) | 
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 148 | apply (simp only: below_lower_pd_def) | 
| 25904 | 149 | done | 
| 150 | ||
| 27289 | 151 | text {* Lower powerdomain is pointed *}
 | 
| 25904 | 152 | |
| 153 | lemma lower_pd_minimal: "lower_principal (PDUnit compact_bot) \<sqsubseteq> ys" | |
| 154 | by (induct ys rule: lower_pd.principal_induct, simp, simp) | |
| 155 | ||
| 156 | instance lower_pd :: (bifinite) pcpo | |
| 26927 | 157 | by intro_classes (fast intro: lower_pd_minimal) | 
| 25904 | 158 | |
| 159 | lemma inst_lower_pd_pcpo: "\<bottom> = lower_principal (PDUnit compact_bot)" | |
| 160 | by (rule lower_pd_minimal [THEN UU_I, symmetric]) | |
| 161 | ||
| 27289 | 162 | text {* Lower powerdomain is profinite *}
 | 
| 25904 | 163 | |
| 26962 
c8b20f615d6c
use new class package for classes profinite, bifinite; remove approx class
 huffman parents: 
26927diff
changeset | 164 | instantiation lower_pd :: (profinite) profinite | 
| 
c8b20f615d6c
use new class package for classes profinite, bifinite; remove approx class
 huffman parents: 
26927diff
changeset | 165 | begin | 
| 25904 | 166 | |
| 26962 
c8b20f615d6c
use new class package for classes profinite, bifinite; remove approx class
 huffman parents: 
26927diff
changeset | 167 | definition | 
| 
c8b20f615d6c
use new class package for classes profinite, bifinite; remove approx class
 huffman parents: 
26927diff
changeset | 168 | approx_lower_pd_def: "approx = lower_pd.completion_approx" | 
| 26927 | 169 | |
| 26962 
c8b20f615d6c
use new class package for classes profinite, bifinite; remove approx class
 huffman parents: 
26927diff
changeset | 170 | instance | 
| 26927 | 171 | apply (intro_classes, unfold approx_lower_pd_def) | 
| 27310 | 172 | apply (rule lower_pd.chain_completion_approx) | 
| 26927 | 173 | apply (rule lower_pd.lub_completion_approx) | 
| 174 | apply (rule lower_pd.completion_approx_idem) | |
| 175 | apply (rule lower_pd.finite_fixes_completion_approx) | |
| 176 | done | |
| 177 | ||
| 26962 
c8b20f615d6c
use new class package for classes profinite, bifinite; remove approx class
 huffman parents: 
26927diff
changeset | 178 | end | 
| 
c8b20f615d6c
use new class package for classes profinite, bifinite; remove approx class
 huffman parents: 
26927diff
changeset | 179 | |
| 26927 | 180 | instance lower_pd :: (bifinite) bifinite .. | 
| 25904 | 181 | |
| 182 | lemma approx_lower_principal [simp]: | |
| 27405 | 183 | "approx n\<cdot>(lower_principal t) = lower_principal (pd_take n t)" | 
| 25904 | 184 | unfolding approx_lower_pd_def | 
| 26927 | 185 | by (rule lower_pd.completion_approx_principal) | 
| 25904 | 186 | |
| 187 | lemma approx_eq_lower_principal: | |
| 27405 | 188 | "\<exists>t\<in>Rep_lower_pd xs. approx n\<cdot>xs = lower_principal (pd_take n t)" | 
| 25904 | 189 | unfolding approx_lower_pd_def | 
| 26927 | 190 | by (rule lower_pd.completion_approx_eq_principal) | 
| 26407 
562a1d615336
rename class bifinite_cpo to profinite; generalize powerdomains from bifinite to profinite
 huffman parents: 
26041diff
changeset | 191 | |
| 25904 | 192 | |
| 26927 | 193 | subsection {* Monadic unit and plus *}
 | 
| 25904 | 194 | |
| 195 | definition | |
| 196 | lower_unit :: "'a \<rightarrow> 'a lower_pd" where | |
| 197 | "lower_unit = compact_basis.basis_fun (\<lambda>a. lower_principal (PDUnit a))" | |
| 198 | ||
| 199 | definition | |
| 200 | lower_plus :: "'a lower_pd \<rightarrow> 'a lower_pd \<rightarrow> 'a lower_pd" where | |
| 201 | "lower_plus = lower_pd.basis_fun (\<lambda>t. lower_pd.basis_fun (\<lambda>u. | |
| 202 | lower_principal (PDPlus t u)))" | |
| 203 | ||
| 204 | abbreviation | |
| 205 | lower_add :: "'a lower_pd \<Rightarrow> 'a lower_pd \<Rightarrow> 'a lower_pd" | |
| 206 | (infixl "+\<flat>" 65) where | |
| 207 | "xs +\<flat> ys == lower_plus\<cdot>xs\<cdot>ys" | |
| 208 | ||
| 26927 | 209 | syntax | 
| 210 |   "_lower_pd" :: "args \<Rightarrow> 'a lower_pd" ("{_}\<flat>")
 | |
| 211 | ||
| 212 | translations | |
| 213 |   "{x,xs}\<flat>" == "{x}\<flat> +\<flat> {xs}\<flat>"
 | |
| 214 |   "{x}\<flat>" == "CONST lower_unit\<cdot>x"
 | |
| 215 | ||
| 216 | lemma lower_unit_Rep_compact_basis [simp]: | |
| 217 |   "{Rep_compact_basis a}\<flat> = lower_principal (PDUnit a)"
 | |
| 218 | unfolding lower_unit_def | |
| 27289 | 219 | by (simp add: compact_basis.basis_fun_principal PDUnit_lower_mono) | 
| 26927 | 220 | |
| 25904 | 221 | lemma lower_plus_principal [simp]: | 
| 26927 | 222 | "lower_principal t +\<flat> lower_principal u = lower_principal (PDPlus t u)" | 
| 25904 | 223 | unfolding lower_plus_def | 
| 224 | by (simp add: lower_pd.basis_fun_principal | |
| 225 | lower_pd.basis_fun_mono PDPlus_lower_mono) | |
| 226 | ||
| 26927 | 227 | lemma approx_lower_unit [simp]: | 
| 228 |   "approx n\<cdot>{x}\<flat> = {approx n\<cdot>x}\<flat>"
 | |
| 27289 | 229 | apply (induct x rule: compact_basis.principal_induct, simp) | 
| 26927 | 230 | apply (simp add: approx_Rep_compact_basis) | 
| 231 | done | |
| 232 | ||
| 25904 | 233 | lemma approx_lower_plus [simp]: | 
| 26927 | 234 | "approx n\<cdot>(xs +\<flat> ys) = (approx n\<cdot>xs) +\<flat> (approx n\<cdot>ys)" | 
| 27289 | 235 | by (induct xs ys rule: lower_pd.principal_induct2, simp, simp, simp) | 
| 25904 | 236 | |
| 26927 | 237 | lemma lower_plus_assoc: "(xs +\<flat> ys) +\<flat> zs = xs +\<flat> (ys +\<flat> zs)" | 
| 27289 | 238 | apply (induct xs ys arbitrary: zs rule: lower_pd.principal_induct2, simp, simp) | 
| 239 | apply (rule_tac x=zs in lower_pd.principal_induct, simp) | |
| 25904 | 240 | apply (simp add: PDPlus_assoc) | 
| 241 | done | |
| 242 | ||
| 26927 | 243 | lemma lower_plus_commute: "xs +\<flat> ys = ys +\<flat> xs" | 
| 27289 | 244 | apply (induct xs ys rule: lower_pd.principal_induct2, simp, simp) | 
| 26927 | 245 | apply (simp add: PDPlus_commute) | 
| 246 | done | |
| 247 | ||
| 29990 
b11793ea15a3
avoid using ab_semigroup_idem_mult locale for powerdomains
 huffman parents: 
29672diff
changeset | 248 | lemma lower_plus_absorb [simp]: "xs +\<flat> xs = xs" | 
| 27289 | 249 | apply (induct xs rule: lower_pd.principal_induct, simp) | 
| 25904 | 250 | apply (simp add: PDPlus_absorb) | 
| 251 | done | |
| 252 | ||
| 29990 
b11793ea15a3
avoid using ab_semigroup_idem_mult locale for powerdomains
 huffman parents: 
29672diff
changeset | 253 | lemma lower_plus_left_commute: "xs +\<flat> (ys +\<flat> zs) = ys +\<flat> (xs +\<flat> zs)" | 
| 
b11793ea15a3
avoid using ab_semigroup_idem_mult locale for powerdomains
 huffman parents: 
29672diff
changeset | 254 | by (rule mk_left_commute [of "op +\<flat>", OF lower_plus_assoc lower_plus_commute]) | 
| 26927 | 255 | |
| 29990 
b11793ea15a3
avoid using ab_semigroup_idem_mult locale for powerdomains
 huffman parents: 
29672diff
changeset | 256 | lemma lower_plus_left_absorb [simp]: "xs +\<flat> (xs +\<flat> ys) = xs +\<flat> ys" | 
| 
b11793ea15a3
avoid using ab_semigroup_idem_mult locale for powerdomains
 huffman parents: 
29672diff
changeset | 257 | by (simp only: lower_plus_assoc [symmetric] lower_plus_absorb) | 
| 26927 | 258 | |
| 29990 
b11793ea15a3
avoid using ab_semigroup_idem_mult locale for powerdomains
 huffman parents: 
29672diff
changeset | 259 | text {* Useful for @{text "simp add: lower_plus_ac"} *}
 | 
| 
b11793ea15a3
avoid using ab_semigroup_idem_mult locale for powerdomains
 huffman parents: 
29672diff
changeset | 260 | lemmas lower_plus_ac = | 
| 
b11793ea15a3
avoid using ab_semigroup_idem_mult locale for powerdomains
 huffman parents: 
29672diff
changeset | 261 | lower_plus_assoc lower_plus_commute lower_plus_left_commute | 
| 
b11793ea15a3
avoid using ab_semigroup_idem_mult locale for powerdomains
 huffman parents: 
29672diff
changeset | 262 | |
| 
b11793ea15a3
avoid using ab_semigroup_idem_mult locale for powerdomains
 huffman parents: 
29672diff
changeset | 263 | text {* Useful for @{text "simp only: lower_plus_aci"} *}
 | 
| 
b11793ea15a3
avoid using ab_semigroup_idem_mult locale for powerdomains
 huffman parents: 
29672diff
changeset | 264 | lemmas lower_plus_aci = | 
| 
b11793ea15a3
avoid using ab_semigroup_idem_mult locale for powerdomains
 huffman parents: 
29672diff
changeset | 265 | lower_plus_ac lower_plus_absorb lower_plus_left_absorb | 
| 
b11793ea15a3
avoid using ab_semigroup_idem_mult locale for powerdomains
 huffman parents: 
29672diff
changeset | 266 | |
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 267 | lemma lower_plus_below1: "xs \<sqsubseteq> xs +\<flat> ys" | 
| 27289 | 268 | apply (induct xs ys rule: lower_pd.principal_induct2, simp, simp) | 
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 269 | apply (simp add: PDPlus_lower_le) | 
| 25904 | 270 | done | 
| 271 | ||
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 272 | lemma lower_plus_below2: "ys \<sqsubseteq> xs +\<flat> ys" | 
| 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 273 | by (subst lower_plus_commute, rule lower_plus_below1) | 
| 25904 | 274 | |
| 26927 | 275 | lemma lower_plus_least: "\<lbrakk>xs \<sqsubseteq> zs; ys \<sqsubseteq> zs\<rbrakk> \<Longrightarrow> xs +\<flat> ys \<sqsubseteq> zs" | 
| 25904 | 276 | apply (subst lower_plus_absorb [of zs, symmetric]) | 
| 277 | apply (erule (1) monofun_cfun [OF monofun_cfun_arg]) | |
| 278 | done | |
| 279 | ||
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 280 | lemma lower_plus_below_iff: | 
| 26927 | 281 | "xs +\<flat> ys \<sqsubseteq> zs \<longleftrightarrow> xs \<sqsubseteq> zs \<and> ys \<sqsubseteq> zs" | 
| 25904 | 282 | apply safe | 
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 283 | apply (erule below_trans [OF lower_plus_below1]) | 
| 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 284 | apply (erule below_trans [OF lower_plus_below2]) | 
| 25904 | 285 | apply (erule (1) lower_plus_least) | 
| 286 | done | |
| 287 | ||
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 288 | lemma lower_unit_below_plus_iff: | 
| 26927 | 289 |   "{x}\<flat> \<sqsubseteq> ys +\<flat> zs \<longleftrightarrow> {x}\<flat> \<sqsubseteq> ys \<or> {x}\<flat> \<sqsubseteq> zs"
 | 
| 25904 | 290 | apply (rule iffI) | 
| 291 | apply (subgoal_tac | |
| 26927 | 292 |     "adm (\<lambda>f. f\<cdot>{x}\<flat> \<sqsubseteq> f\<cdot>ys \<or> f\<cdot>{x}\<flat> \<sqsubseteq> f\<cdot>zs)")
 | 
| 25925 | 293 | apply (drule admD, rule chain_approx) | 
| 25904 | 294 | apply (drule_tac f="approx i" in monofun_cfun_arg) | 
| 27289 | 295 | apply (cut_tac x="approx i\<cdot>x" in compact_basis.compact_imp_principal, simp) | 
| 296 | apply (cut_tac x="approx i\<cdot>ys" in lower_pd.compact_imp_principal, simp) | |
| 297 | apply (cut_tac x="approx i\<cdot>zs" in lower_pd.compact_imp_principal, simp) | |
| 25904 | 298 | apply (clarify, simp add: lower_le_PDUnit_PDPlus_iff) | 
| 299 | apply simp | |
| 300 | apply simp | |
| 301 | apply (erule disjE) | |
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 302 | apply (erule below_trans [OF _ lower_plus_below1]) | 
| 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 303 | apply (erule below_trans [OF _ lower_plus_below2]) | 
| 25904 | 304 | done | 
| 305 | ||
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 306 | lemma lower_unit_below_iff [simp]: "{x}\<flat> \<sqsubseteq> {y}\<flat> \<longleftrightarrow> x \<sqsubseteq> y"
 | 
| 26927 | 307 | apply (rule iffI) | 
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 308 | apply (rule profinite_below_ext) | 
| 26927 | 309 | apply (drule_tac f="approx i" in monofun_cfun_arg, simp) | 
| 27289 | 310 | apply (cut_tac x="approx i\<cdot>x" in compact_basis.compact_imp_principal, simp) | 
| 311 | apply (cut_tac x="approx i\<cdot>y" in compact_basis.compact_imp_principal, simp) | |
| 312 | apply clarsimp | |
| 26927 | 313 | apply (erule monofun_cfun_arg) | 
| 314 | done | |
| 315 | ||
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 316 | lemmas lower_pd_below_simps = | 
| 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 317 | lower_unit_below_iff | 
| 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 318 | lower_plus_below_iff | 
| 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 319 | lower_unit_below_plus_iff | 
| 25904 | 320 | |
| 26927 | 321 | lemma lower_unit_eq_iff [simp]: "{x}\<flat> = {y}\<flat> \<longleftrightarrow> x = y"
 | 
| 29990 
b11793ea15a3
avoid using ab_semigroup_idem_mult locale for powerdomains
 huffman parents: 
29672diff
changeset | 322 | by (simp add: po_eq_conv) | 
| 26927 | 323 | |
| 324 | lemma lower_unit_strict [simp]: "{\<bottom>}\<flat> = \<bottom>"
 | |
| 325 | unfolding inst_lower_pd_pcpo Rep_compact_bot [symmetric] by simp | |
| 326 | ||
| 327 | lemma lower_unit_strict_iff [simp]: "{x}\<flat> = \<bottom> \<longleftrightarrow> x = \<bottom>"
 | |
| 328 | unfolding lower_unit_strict [symmetric] by (rule lower_unit_eq_iff) | |
| 329 | ||
| 330 | lemma lower_plus_strict_iff [simp]: | |
| 331 | "xs +\<flat> ys = \<bottom> \<longleftrightarrow> xs = \<bottom> \<and> ys = \<bottom>" | |
| 332 | apply safe | |
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 333 | apply (rule UU_I, erule subst, rule lower_plus_below1) | 
| 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 334 | apply (rule UU_I, erule subst, rule lower_plus_below2) | 
| 26927 | 335 | apply (rule lower_plus_absorb) | 
| 336 | done | |
| 337 | ||
| 338 | lemma lower_plus_strict1 [simp]: "\<bottom> +\<flat> ys = ys" | |
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 339 | apply (rule below_antisym [OF _ lower_plus_below2]) | 
| 26927 | 340 | apply (simp add: lower_plus_least) | 
| 341 | done | |
| 342 | ||
| 343 | lemma lower_plus_strict2 [simp]: "xs +\<flat> \<bottom> = xs" | |
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 344 | apply (rule below_antisym [OF _ lower_plus_below1]) | 
| 26927 | 345 | apply (simp add: lower_plus_least) | 
| 346 | done | |
| 347 | ||
| 348 | lemma compact_lower_unit_iff [simp]: "compact {x}\<flat> \<longleftrightarrow> compact x"
 | |
| 27309 | 349 | unfolding profinite_compact_iff by simp | 
| 26927 | 350 | |
| 351 | lemma compact_lower_plus [simp]: | |
| 352 | "\<lbrakk>compact xs; compact ys\<rbrakk> \<Longrightarrow> compact (xs +\<flat> ys)" | |
| 27289 | 353 | by (auto dest!: lower_pd.compact_imp_principal) | 
| 26927 | 354 | |
| 25904 | 355 | |
| 356 | subsection {* Induction rules *}
 | |
| 357 | ||
| 358 | lemma lower_pd_induct1: | |
| 359 | assumes P: "adm P" | |
| 26927 | 360 |   assumes unit: "\<And>x. P {x}\<flat>"
 | 
| 25904 | 361 | assumes insert: | 
| 26927 | 362 |     "\<And>x ys. \<lbrakk>P {x}\<flat>; P ys\<rbrakk> \<Longrightarrow> P ({x}\<flat> +\<flat> ys)"
 | 
| 25904 | 363 | shows "P (xs::'a lower_pd)" | 
| 27289 | 364 | apply (induct xs rule: lower_pd.principal_induct, rule P) | 
| 365 | apply (induct_tac a rule: pd_basis_induct1) | |
| 25904 | 366 | apply (simp only: lower_unit_Rep_compact_basis [symmetric]) | 
| 367 | apply (rule unit) | |
| 368 | apply (simp only: lower_unit_Rep_compact_basis [symmetric] | |
| 369 | lower_plus_principal [symmetric]) | |
| 370 | apply (erule insert [OF unit]) | |
| 371 | done | |
| 372 | ||
| 373 | lemma lower_pd_induct: | |
| 374 | assumes P: "adm P" | |
| 26927 | 375 |   assumes unit: "\<And>x. P {x}\<flat>"
 | 
| 376 | assumes plus: "\<And>xs ys. \<lbrakk>P xs; P ys\<rbrakk> \<Longrightarrow> P (xs +\<flat> ys)" | |
| 25904 | 377 | shows "P (xs::'a lower_pd)" | 
| 27289 | 378 | apply (induct xs rule: lower_pd.principal_induct, rule P) | 
| 379 | apply (induct_tac a rule: pd_basis_induct) | |
| 25904 | 380 | apply (simp only: lower_unit_Rep_compact_basis [symmetric] unit) | 
| 381 | apply (simp only: lower_plus_principal [symmetric] plus) | |
| 382 | done | |
| 383 | ||
| 384 | ||
| 385 | subsection {* Monadic bind *}
 | |
| 386 | ||
| 387 | definition | |
| 388 | lower_bind_basis :: | |
| 389 |   "'a pd_basis \<Rightarrow> ('a \<rightarrow> 'b lower_pd) \<rightarrow> 'b lower_pd" where
 | |
| 390 | "lower_bind_basis = fold_pd | |
| 391 | (\<lambda>a. \<Lambda> f. f\<cdot>(Rep_compact_basis a)) | |
| 26927 | 392 | (\<lambda>x y. \<Lambda> f. x\<cdot>f +\<flat> y\<cdot>f)" | 
| 25904 | 393 | |
| 26927 | 394 | lemma ACI_lower_bind: | 
| 395 | "ab_semigroup_idem_mult (\<lambda>x y. \<Lambda> f. x\<cdot>f +\<flat> y\<cdot>f)" | |
| 25904 | 396 | 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: 
25925diff
changeset | 397 | apply (simp add: lower_plus_assoc) | 
| 25904 | 398 | apply (simp add: lower_plus_commute) | 
| 29990 
b11793ea15a3
avoid using ab_semigroup_idem_mult locale for powerdomains
 huffman parents: 
29672diff
changeset | 399 | apply (simp add: eta_cfun) | 
| 25904 | 400 | done | 
| 401 | ||
| 402 | lemma lower_bind_basis_simps [simp]: | |
| 403 | "lower_bind_basis (PDUnit a) = | |
| 404 | (\<Lambda> f. f\<cdot>(Rep_compact_basis a))" | |
| 405 | "lower_bind_basis (PDPlus t u) = | |
| 26927 | 406 | (\<Lambda> f. lower_bind_basis t\<cdot>f +\<flat> lower_bind_basis u\<cdot>f)" | 
| 25904 | 407 | unfolding lower_bind_basis_def | 
| 408 | apply - | |
| 26927 | 409 | apply (rule fold_pd_PDUnit [OF ACI_lower_bind]) | 
| 410 | apply (rule fold_pd_PDPlus [OF ACI_lower_bind]) | |
| 25904 | 411 | done | 
| 412 | ||
| 413 | lemma lower_bind_basis_mono: | |
| 414 | "t \<le>\<flat> u \<Longrightarrow> lower_bind_basis t \<sqsubseteq> lower_bind_basis u" | |
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 415 | unfolding expand_cfun_below | 
| 25904 | 416 | apply (erule lower_le_induct, safe) | 
| 27289 | 417 | apply (simp add: monofun_cfun) | 
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 418 | apply (simp add: rev_below_trans [OF lower_plus_below1]) | 
| 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
30729diff
changeset | 419 | apply (simp add: lower_plus_below_iff) | 
| 25904 | 420 | done | 
| 421 | ||
| 422 | definition | |
| 423 |   lower_bind :: "'a lower_pd \<rightarrow> ('a \<rightarrow> 'b lower_pd) \<rightarrow> 'b lower_pd" where
 | |
| 424 | "lower_bind = lower_pd.basis_fun lower_bind_basis" | |
| 425 | ||
| 426 | lemma lower_bind_principal [simp]: | |
| 427 | "lower_bind\<cdot>(lower_principal t) = lower_bind_basis t" | |
| 428 | unfolding lower_bind_def | |
| 429 | apply (rule lower_pd.basis_fun_principal) | |
| 430 | apply (erule lower_bind_basis_mono) | |
| 431 | done | |
| 432 | ||
| 433 | lemma lower_bind_unit [simp]: | |
| 26927 | 434 |   "lower_bind\<cdot>{x}\<flat>\<cdot>f = f\<cdot>x"
 | 
| 27289 | 435 | by (induct x rule: compact_basis.principal_induct, simp, simp) | 
| 25904 | 436 | |
| 437 | lemma lower_bind_plus [simp]: | |
| 26927 | 438 | "lower_bind\<cdot>(xs +\<flat> ys)\<cdot>f = lower_bind\<cdot>xs\<cdot>f +\<flat> lower_bind\<cdot>ys\<cdot>f" | 
| 27289 | 439 | by (induct xs ys rule: lower_pd.principal_induct2, simp, simp, simp) | 
| 25904 | 440 | |
| 441 | lemma lower_bind_strict [simp]: "lower_bind\<cdot>\<bottom>\<cdot>f = f\<cdot>\<bottom>" | |
| 442 | unfolding lower_unit_strict [symmetric] by (rule lower_bind_unit) | |
| 443 | ||
| 444 | ||
| 445 | subsection {* Map and join *}
 | |
| 446 | ||
| 447 | definition | |
| 448 |   lower_map :: "('a \<rightarrow> 'b) \<rightarrow> 'a lower_pd \<rightarrow> 'b lower_pd" where
 | |
| 26927 | 449 |   "lower_map = (\<Lambda> f xs. lower_bind\<cdot>xs\<cdot>(\<Lambda> x. {f\<cdot>x}\<flat>))"
 | 
| 25904 | 450 | |
| 451 | definition | |
| 452 | lower_join :: "'a lower_pd lower_pd \<rightarrow> 'a lower_pd" where | |
| 453 | "lower_join = (\<Lambda> xss. lower_bind\<cdot>xss\<cdot>(\<Lambda> xs. xs))" | |
| 454 | ||
| 455 | lemma lower_map_unit [simp]: | |
| 26927 | 456 |   "lower_map\<cdot>f\<cdot>{x}\<flat> = {f\<cdot>x}\<flat>"
 | 
| 25904 | 457 | unfolding lower_map_def by simp | 
| 458 | ||
| 459 | lemma lower_map_plus [simp]: | |
| 26927 | 460 | "lower_map\<cdot>f\<cdot>(xs +\<flat> ys) = lower_map\<cdot>f\<cdot>xs +\<flat> lower_map\<cdot>f\<cdot>ys" | 
| 25904 | 461 | unfolding lower_map_def by simp | 
| 462 | ||
| 463 | lemma lower_join_unit [simp]: | |
| 26927 | 464 |   "lower_join\<cdot>{xs}\<flat> = xs"
 | 
| 25904 | 465 | unfolding lower_join_def by simp | 
| 466 | ||
| 467 | lemma lower_join_plus [simp]: | |
| 26927 | 468 | "lower_join\<cdot>(xss +\<flat> yss) = lower_join\<cdot>xss +\<flat> lower_join\<cdot>yss" | 
| 25904 | 469 | unfolding lower_join_def by simp | 
| 470 | ||
| 471 | lemma lower_map_ident: "lower_map\<cdot>(\<Lambda> x. x)\<cdot>xs = xs" | |
| 472 | by (induct xs rule: lower_pd_induct, simp_all) | |
| 473 | ||
| 474 | lemma lower_map_map: | |
| 475 | "lower_map\<cdot>f\<cdot>(lower_map\<cdot>g\<cdot>xs) = lower_map\<cdot>(\<Lambda> x. f\<cdot>(g\<cdot>x))\<cdot>xs" | |
| 476 | by (induct xs rule: lower_pd_induct, simp_all) | |
| 477 | ||
| 478 | lemma lower_join_map_unit: | |
| 479 | "lower_join\<cdot>(lower_map\<cdot>lower_unit\<cdot>xs) = xs" | |
| 480 | by (induct xs rule: lower_pd_induct, simp_all) | |
| 481 | ||
| 482 | lemma lower_join_map_join: | |
| 483 | "lower_join\<cdot>(lower_map\<cdot>lower_join\<cdot>xsss) = lower_join\<cdot>(lower_join\<cdot>xsss)" | |
| 484 | by (induct xsss rule: lower_pd_induct, simp_all) | |
| 485 | ||
| 486 | lemma lower_join_map_map: | |
| 487 | "lower_join\<cdot>(lower_map\<cdot>(lower_map\<cdot>f)\<cdot>xss) = | |
| 488 | lower_map\<cdot>f\<cdot>(lower_join\<cdot>xss)" | |
| 489 | by (induct xss rule: lower_pd_induct, simp_all) | |
| 490 | ||
| 491 | lemma lower_map_approx: "lower_map\<cdot>(approx n)\<cdot>xs = approx n\<cdot>xs" | |
| 492 | by (induct xs rule: lower_pd_induct, simp_all) | |
| 493 | ||
| 494 | end |