src/HOLCF/LowerPD.thy
changeset 26927 8684b5240f11
parent 26806 40b411ec05aa
child 26962 c8b20f615d6c
     1.1 --- a/src/HOLCF/LowerPD.thy	Fri May 16 22:35:25 2008 +0200
     1.2 +++ b/src/HOLCF/LowerPD.thy	Fri May 16 23:25:37 2008 +0200
     1.3 @@ -103,13 +103,7 @@
     1.4  done
     1.5  
     1.6  lemma ideal_Rep_lower_pd: "lower_le.ideal (Rep_lower_pd x)"
     1.7 -by (rule Rep_lower_pd [simplified])
     1.8 -
     1.9 -lemma Rep_lower_pd_mono: "x \<sqsubseteq> y \<Longrightarrow> Rep_lower_pd x \<subseteq> Rep_lower_pd y"
    1.10 -unfolding less_lower_pd_def less_set_eq .
    1.11 -
    1.12 -
    1.13 -subsection {* Principal ideals *}
    1.14 +by (rule Rep_lower_pd [unfolded mem_Collect_eq])
    1.15  
    1.16  definition
    1.17    lower_principal :: "'a pd_basis \<Rightarrow> 'a lower_pd" where
    1.18 @@ -123,7 +117,7 @@
    1.19  done
    1.20  
    1.21  interpretation lower_pd:
    1.22 -  bifinite_basis [lower_le approx_pd lower_principal Rep_lower_pd]
    1.23 +  ideal_completion [lower_le approx_pd lower_principal Rep_lower_pd]
    1.24  apply unfold_locales
    1.25  apply (rule approx_pd_lower_le)
    1.26  apply (rule approx_pd_idem)
    1.27 @@ -138,32 +132,25 @@
    1.28  done
    1.29  
    1.30  lemma lower_principal_less_iff [simp]:
    1.31 -  "(lower_principal t \<sqsubseteq> lower_principal u) = (t \<le>\<flat> u)"
    1.32 -unfolding less_lower_pd_def Rep_lower_principal less_set_eq
    1.33 -by (fast intro: lower_le_refl elim: lower_le_trans)
    1.34 +  "lower_principal t \<sqsubseteq> lower_principal u \<longleftrightarrow> t \<le>\<flat> u"
    1.35 +by (rule lower_pd.principal_less_iff)
    1.36 +
    1.37 +lemma lower_principal_eq_iff:
    1.38 +  "lower_principal t = lower_principal u \<longleftrightarrow> t \<le>\<flat> u \<and> u \<le>\<flat> t"
    1.39 +by (rule lower_pd.principal_eq_iff)
    1.40  
    1.41  lemma lower_principal_mono:
    1.42    "t \<le>\<flat> u \<Longrightarrow> lower_principal t \<sqsubseteq> lower_principal u"
    1.43 -by (rule lower_principal_less_iff [THEN iffD2])
    1.44 +by (rule lower_pd.principal_mono)
    1.45  
    1.46  lemma compact_lower_principal: "compact (lower_principal t)"
    1.47 -apply (rule compactI2)
    1.48 -apply (simp add: less_lower_pd_def)
    1.49 -apply (simp add: cont2contlubE [OF cont_Rep_lower_pd])
    1.50 -apply (simp add: Rep_lower_principal set_cpo_simps)
    1.51 -apply (simp add: subset_eq)
    1.52 -apply (drule spec, drule mp, rule lower_le_refl)
    1.53 -apply (erule exE, rename_tac i)
    1.54 -apply (rule_tac x=i in exI)
    1.55 -apply clarify
    1.56 -apply (erule (1) lower_le.idealD3 [OF ideal_Rep_lower_pd])
    1.57 -done
    1.58 +by (rule lower_pd.compact_principal)
    1.59  
    1.60  lemma lower_pd_minimal: "lower_principal (PDUnit compact_bot) \<sqsubseteq> ys"
    1.61  by (induct ys rule: lower_pd.principal_induct, simp, simp)
    1.62  
    1.63  instance lower_pd :: (bifinite) pcpo
    1.64 -by (intro_classes, fast intro: lower_pd_minimal)
    1.65 +by intro_classes (fast intro: lower_pd_minimal)
    1.66  
    1.67  lemma inst_lower_pd_pcpo: "\<bottom> = lower_principal (PDUnit compact_bot)"
    1.68  by (rule lower_pd_minimal [THEN UU_I, symmetric])
    1.69 @@ -174,51 +161,27 @@
    1.70  instance lower_pd :: (profinite) approx ..
    1.71  
    1.72  defs (overloaded)
    1.73 -  approx_lower_pd_def:
    1.74 -    "approx \<equiv> (\<lambda>n. lower_pd.basis_fun (\<lambda>t. lower_principal (approx_pd n t)))"
    1.75 +  approx_lower_pd_def: "approx \<equiv> lower_pd.completion_approx"
    1.76 +
    1.77 +instance lower_pd :: (profinite) profinite
    1.78 +apply (intro_classes, unfold approx_lower_pd_def)
    1.79 +apply (simp add: lower_pd.chain_completion_approx)
    1.80 +apply (rule lower_pd.lub_completion_approx)
    1.81 +apply (rule lower_pd.completion_approx_idem)
    1.82 +apply (rule lower_pd.finite_fixes_completion_approx)
    1.83 +done
    1.84 +
    1.85 +instance lower_pd :: (bifinite) bifinite ..
    1.86  
    1.87  lemma approx_lower_principal [simp]:
    1.88    "approx n\<cdot>(lower_principal t) = lower_principal (approx_pd n t)"
    1.89  unfolding approx_lower_pd_def
    1.90 -apply (rule lower_pd.basis_fun_principal)
    1.91 -apply (erule lower_principal_mono [OF approx_pd_lower_mono])
    1.92 -done
    1.93 -
    1.94 -lemma chain_approx_lower_pd:
    1.95 -  "chain (approx :: nat \<Rightarrow> 'a lower_pd \<rightarrow> 'a lower_pd)"
    1.96 -unfolding approx_lower_pd_def
    1.97 -by (rule lower_pd.chain_basis_fun_take)
    1.98 -
    1.99 -lemma lub_approx_lower_pd:
   1.100 -  "(\<Squnion>i. approx i\<cdot>xs) = (xs::'a lower_pd)"
   1.101 -unfolding approx_lower_pd_def
   1.102 -by (rule lower_pd.lub_basis_fun_take)
   1.103 -
   1.104 -lemma approx_lower_pd_idem:
   1.105 -  "approx n\<cdot>(approx n\<cdot>xs) = approx n\<cdot>(xs::'a lower_pd)"
   1.106 -apply (induct xs rule: lower_pd.principal_induct, simp)
   1.107 -apply (simp add: approx_pd_idem)
   1.108 -done
   1.109 +by (rule lower_pd.completion_approx_principal)
   1.110  
   1.111  lemma approx_eq_lower_principal:
   1.112    "\<exists>t\<in>Rep_lower_pd xs. approx n\<cdot>xs = lower_principal (approx_pd n t)"
   1.113  unfolding approx_lower_pd_def
   1.114 -by (rule lower_pd.basis_fun_take_eq_principal)
   1.115 -
   1.116 -lemma finite_fixes_approx_lower_pd:
   1.117 -  "finite {xs::'a lower_pd. approx n\<cdot>xs = xs}"
   1.118 -unfolding approx_lower_pd_def
   1.119 -by (rule lower_pd.finite_fixes_basis_fun_take)
   1.120 -
   1.121 -instance lower_pd :: (profinite) profinite
   1.122 -apply intro_classes
   1.123 -apply (simp add: chain_approx_lower_pd)
   1.124 -apply (rule lub_approx_lower_pd)
   1.125 -apply (rule approx_lower_pd_idem)
   1.126 -apply (rule finite_fixes_approx_lower_pd)
   1.127 -done
   1.128 -
   1.129 -instance lower_pd :: (bifinite) bifinite ..
   1.130 +by (rule lower_pd.completion_approx_eq_principal)
   1.131  
   1.132  lemma compact_imp_lower_principal:
   1.133    "compact xs \<Longrightarrow> \<exists>t. xs = lower_principal t"
   1.134 @@ -231,10 +194,7 @@
   1.135  
   1.136  lemma lower_principal_induct:
   1.137    "\<lbrakk>adm P; \<And>t. P (lower_principal t)\<rbrakk> \<Longrightarrow> P xs"
   1.138 -apply (erule approx_induct, rename_tac xs)
   1.139 -apply (cut_tac n=n and xs=xs in approx_eq_lower_principal)
   1.140 -apply (clarify, simp)
   1.141 -done
   1.142 +by (rule lower_pd.principal_induct)
   1.143  
   1.144  lemma lower_principal_induct2:
   1.145    "\<lbrakk>\<And>ys. adm (\<lambda>xs. P xs ys); \<And>xs. adm (\<lambda>ys. P xs ys);
   1.146 @@ -247,54 +207,12 @@
   1.147  done
   1.148  
   1.149  
   1.150 -subsection {* Monadic unit *}
   1.151 +subsection {* Monadic unit and plus *}
   1.152  
   1.153  definition
   1.154    lower_unit :: "'a \<rightarrow> 'a lower_pd" where
   1.155    "lower_unit = compact_basis.basis_fun (\<lambda>a. lower_principal (PDUnit a))"
   1.156  
   1.157 -lemma lower_unit_Rep_compact_basis [simp]:
   1.158 -  "lower_unit\<cdot>(Rep_compact_basis a) = lower_principal (PDUnit a)"
   1.159 -unfolding lower_unit_def
   1.160 -apply (rule compact_basis.basis_fun_principal)
   1.161 -apply (rule lower_principal_mono)
   1.162 -apply (erule PDUnit_lower_mono)
   1.163 -done
   1.164 -
   1.165 -lemma lower_unit_strict [simp]: "lower_unit\<cdot>\<bottom> = \<bottom>"
   1.166 -unfolding inst_lower_pd_pcpo Rep_compact_bot [symmetric] by simp
   1.167 -
   1.168 -lemma approx_lower_unit [simp]:
   1.169 -  "approx n\<cdot>(lower_unit\<cdot>x) = lower_unit\<cdot>(approx n\<cdot>x)"
   1.170 -apply (induct x rule: compact_basis_induct, simp)
   1.171 -apply (simp add: approx_Rep_compact_basis)
   1.172 -done
   1.173 -
   1.174 -lemma lower_unit_less_iff [simp]:
   1.175 -  "(lower_unit\<cdot>x \<sqsubseteq> lower_unit\<cdot>y) = (x \<sqsubseteq> y)"
   1.176 - apply (rule iffI)
   1.177 -  apply (rule bifinite_less_ext)
   1.178 -  apply (drule_tac f="approx i" in monofun_cfun_arg, simp)
   1.179 -  apply (cut_tac x="approx i\<cdot>x" in compact_imp_Rep_compact_basis, simp)
   1.180 -  apply (cut_tac x="approx i\<cdot>y" in compact_imp_Rep_compact_basis, simp)
   1.181 -  apply (clarify, simp add: compact_le_def)
   1.182 - apply (erule monofun_cfun_arg)
   1.183 -done
   1.184 -
   1.185 -lemma lower_unit_eq_iff [simp]:
   1.186 -  "(lower_unit\<cdot>x = lower_unit\<cdot>y) = (x = y)"
   1.187 -unfolding po_eq_conv by simp
   1.188 -
   1.189 -lemma lower_unit_strict_iff [simp]: "(lower_unit\<cdot>x = \<bottom>) = (x = \<bottom>)"
   1.190 -unfolding lower_unit_strict [symmetric] by (rule lower_unit_eq_iff)
   1.191 -
   1.192 -lemma compact_lower_unit_iff [simp]:
   1.193 -  "compact (lower_unit\<cdot>x) = compact x"
   1.194 -unfolding bifinite_compact_iff by simp
   1.195 -
   1.196 -
   1.197 -subsection {* Monadic plus *}
   1.198 -
   1.199  definition
   1.200    lower_plus :: "'a lower_pd \<rightarrow> 'a lower_pd \<rightarrow> 'a lower_pd" where
   1.201    "lower_plus = lower_pd.basis_fun (\<lambda>t. lower_pd.basis_fun (\<lambda>u.
   1.202 @@ -305,79 +223,89 @@
   1.203      (infixl "+\<flat>" 65) where
   1.204    "xs +\<flat> ys == lower_plus\<cdot>xs\<cdot>ys"
   1.205  
   1.206 +syntax
   1.207 +  "_lower_pd" :: "args \<Rightarrow> 'a lower_pd" ("{_}\<flat>")
   1.208 +
   1.209 +translations
   1.210 +  "{x,xs}\<flat>" == "{x}\<flat> +\<flat> {xs}\<flat>"
   1.211 +  "{x}\<flat>" == "CONST lower_unit\<cdot>x"
   1.212 +
   1.213 +lemma lower_unit_Rep_compact_basis [simp]:
   1.214 +  "{Rep_compact_basis a}\<flat> = lower_principal (PDUnit a)"
   1.215 +unfolding lower_unit_def
   1.216 +by (simp add: compact_basis.basis_fun_principal
   1.217 +    lower_principal_mono PDUnit_lower_mono)
   1.218 +
   1.219  lemma lower_plus_principal [simp]:
   1.220 -  "lower_plus\<cdot>(lower_principal t)\<cdot>(lower_principal u) =
   1.221 -   lower_principal (PDPlus t u)"
   1.222 +  "lower_principal t +\<flat> lower_principal u = lower_principal (PDPlus t u)"
   1.223  unfolding lower_plus_def
   1.224  by (simp add: lower_pd.basis_fun_principal
   1.225      lower_pd.basis_fun_mono PDPlus_lower_mono)
   1.226  
   1.227 +lemma approx_lower_unit [simp]:
   1.228 +  "approx n\<cdot>{x}\<flat> = {approx n\<cdot>x}\<flat>"
   1.229 +apply (induct x rule: compact_basis_induct, simp)
   1.230 +apply (simp add: approx_Rep_compact_basis)
   1.231 +done
   1.232 +
   1.233  lemma approx_lower_plus [simp]:
   1.234 -  "approx n\<cdot>(lower_plus\<cdot>xs\<cdot>ys) = lower_plus\<cdot>(approx n\<cdot>xs)\<cdot>(approx n\<cdot>ys)"
   1.235 +  "approx n\<cdot>(xs +\<flat> ys) = (approx n\<cdot>xs) +\<flat> (approx n\<cdot>ys)"
   1.236  by (induct xs ys rule: lower_principal_induct2, simp, simp, simp)
   1.237  
   1.238 -lemma lower_plus_commute: "lower_plus\<cdot>xs\<cdot>ys = lower_plus\<cdot>ys\<cdot>xs"
   1.239 -apply (induct xs ys rule: lower_principal_induct2, simp, simp)
   1.240 -apply (simp add: PDPlus_commute)
   1.241 -done
   1.242 -
   1.243 -lemma lower_plus_assoc:
   1.244 -  "lower_plus\<cdot>(lower_plus\<cdot>xs\<cdot>ys)\<cdot>zs = lower_plus\<cdot>xs\<cdot>(lower_plus\<cdot>ys\<cdot>zs)"
   1.245 +lemma lower_plus_assoc: "(xs +\<flat> ys) +\<flat> zs = xs +\<flat> (ys +\<flat> zs)"
   1.246  apply (induct xs ys arbitrary: zs rule: lower_principal_induct2, simp, simp)
   1.247  apply (rule_tac xs=zs in lower_principal_induct, simp)
   1.248  apply (simp add: PDPlus_assoc)
   1.249  done
   1.250  
   1.251 -lemma lower_plus_absorb: "lower_plus\<cdot>xs\<cdot>xs = xs"
   1.252 +lemma lower_plus_commute: "xs +\<flat> ys = ys +\<flat> xs"
   1.253 +apply (induct xs ys rule: lower_principal_induct2, simp, simp)
   1.254 +apply (simp add: PDPlus_commute)
   1.255 +done
   1.256 +
   1.257 +lemma lower_plus_absorb: "xs +\<flat> xs = xs"
   1.258  apply (induct xs rule: lower_principal_induct, simp)
   1.259  apply (simp add: PDPlus_absorb)
   1.260  done
   1.261  
   1.262 -lemma lower_plus_less1: "xs \<sqsubseteq> lower_plus\<cdot>xs\<cdot>ys"
   1.263 +interpretation aci_lower_plus: ab_semigroup_idem_mult ["op +\<flat>"]
   1.264 +  by unfold_locales
   1.265 +    (rule lower_plus_assoc lower_plus_commute lower_plus_absorb)+
   1.266 +
   1.267 +lemma lower_plus_left_commute: "xs +\<flat> (ys +\<flat> zs) = ys +\<flat> (xs +\<flat> zs)"
   1.268 +by (rule aci_lower_plus.mult_left_commute)
   1.269 +
   1.270 +lemma lower_plus_left_absorb: "xs +\<flat> (xs +\<flat> ys) = xs +\<flat> ys"
   1.271 +by (rule aci_lower_plus.mult_left_idem)
   1.272 +
   1.273 +lemmas lower_plus_aci = aci_lower_plus.mult_ac_idem
   1.274 +
   1.275 +lemma lower_plus_less1: "xs \<sqsubseteq> xs +\<flat> ys"
   1.276  apply (induct xs ys rule: lower_principal_induct2, simp, simp)
   1.277  apply (simp add: PDPlus_lower_less)
   1.278  done
   1.279  
   1.280 -lemma lower_plus_less2: "ys \<sqsubseteq> lower_plus\<cdot>xs\<cdot>ys"
   1.281 +lemma lower_plus_less2: "ys \<sqsubseteq> xs +\<flat> ys"
   1.282  by (subst lower_plus_commute, rule lower_plus_less1)
   1.283  
   1.284 -lemma lower_plus_least: "\<lbrakk>xs \<sqsubseteq> zs; ys \<sqsubseteq> zs\<rbrakk> \<Longrightarrow> lower_plus\<cdot>xs\<cdot>ys \<sqsubseteq> zs"
   1.285 +lemma lower_plus_least: "\<lbrakk>xs \<sqsubseteq> zs; ys \<sqsubseteq> zs\<rbrakk> \<Longrightarrow> xs +\<flat> ys \<sqsubseteq> zs"
   1.286  apply (subst lower_plus_absorb [of zs, symmetric])
   1.287  apply (erule (1) monofun_cfun [OF monofun_cfun_arg])
   1.288  done
   1.289  
   1.290  lemma lower_plus_less_iff:
   1.291 -  "(lower_plus\<cdot>xs\<cdot>ys \<sqsubseteq> zs) = (xs \<sqsubseteq> zs \<and> ys \<sqsubseteq> zs)"
   1.292 +  "xs +\<flat> ys \<sqsubseteq> zs \<longleftrightarrow> xs \<sqsubseteq> zs \<and> ys \<sqsubseteq> zs"
   1.293  apply safe
   1.294  apply (erule trans_less [OF lower_plus_less1])
   1.295  apply (erule trans_less [OF lower_plus_less2])
   1.296  apply (erule (1) lower_plus_least)
   1.297  done
   1.298  
   1.299 -lemma lower_plus_strict_iff [simp]:
   1.300 -  "(lower_plus\<cdot>xs\<cdot>ys = \<bottom>) = (xs = \<bottom> \<and> ys = \<bottom>)"
   1.301 -apply safe
   1.302 -apply (rule UU_I, erule subst, rule lower_plus_less1)
   1.303 -apply (rule UU_I, erule subst, rule lower_plus_less2)
   1.304 -apply (rule lower_plus_absorb)
   1.305 -done
   1.306 -
   1.307 -lemma lower_plus_strict1 [simp]: "lower_plus\<cdot>\<bottom>\<cdot>ys = ys"
   1.308 -apply (rule antisym_less [OF _ lower_plus_less2])
   1.309 -apply (simp add: lower_plus_least)
   1.310 -done
   1.311 -
   1.312 -lemma lower_plus_strict2 [simp]: "lower_plus\<cdot>xs\<cdot>\<bottom> = xs"
   1.313 -apply (rule antisym_less [OF _ lower_plus_less1])
   1.314 -apply (simp add: lower_plus_least)
   1.315 -done
   1.316 -
   1.317  lemma lower_unit_less_plus_iff:
   1.318 -  "(lower_unit\<cdot>x \<sqsubseteq> lower_plus\<cdot>ys\<cdot>zs) =
   1.319 -    (lower_unit\<cdot>x \<sqsubseteq> ys \<or> lower_unit\<cdot>x \<sqsubseteq> zs)"
   1.320 +  "{x}\<flat> \<sqsubseteq> ys +\<flat> zs \<longleftrightarrow> {x}\<flat> \<sqsubseteq> ys \<or> {x}\<flat> \<sqsubseteq> zs"
   1.321   apply (rule iffI)
   1.322    apply (subgoal_tac
   1.323 -    "adm (\<lambda>f. f\<cdot>(lower_unit\<cdot>x) \<sqsubseteq> f\<cdot>ys \<or> f\<cdot>(lower_unit\<cdot>x) \<sqsubseteq> f\<cdot>zs)")
   1.324 +    "adm (\<lambda>f. f\<cdot>{x}\<flat> \<sqsubseteq> f\<cdot>ys \<or> f\<cdot>{x}\<flat> \<sqsubseteq> f\<cdot>zs)")
   1.325     apply (drule admD, rule chain_approx)
   1.326      apply (drule_tac f="approx i" in monofun_cfun_arg)
   1.327      apply (cut_tac x="approx i\<cdot>x" in compact_imp_Rep_compact_basis, simp)
   1.328 @@ -391,19 +319,65 @@
   1.329   apply (erule trans_less [OF _ lower_plus_less2])
   1.330  done
   1.331  
   1.332 +lemma lower_unit_less_iff [simp]: "{x}\<flat> \<sqsubseteq> {y}\<flat> \<longleftrightarrow> x \<sqsubseteq> y"
   1.333 + apply (rule iffI)
   1.334 +  apply (rule bifinite_less_ext)
   1.335 +  apply (drule_tac f="approx i" in monofun_cfun_arg, simp)
   1.336 +  apply (cut_tac x="approx i\<cdot>x" in compact_imp_Rep_compact_basis, simp)
   1.337 +  apply (cut_tac x="approx i\<cdot>y" in compact_imp_Rep_compact_basis, simp)
   1.338 +  apply (clarify, simp add: compact_le_def)
   1.339 + apply (erule monofun_cfun_arg)
   1.340 +done
   1.341 +
   1.342  lemmas lower_pd_less_simps =
   1.343    lower_unit_less_iff
   1.344    lower_plus_less_iff
   1.345    lower_unit_less_plus_iff
   1.346  
   1.347 +lemma lower_unit_eq_iff [simp]: "{x}\<flat> = {y}\<flat> \<longleftrightarrow> x = y"
   1.348 +unfolding po_eq_conv by simp
   1.349 +
   1.350 +lemma lower_unit_strict [simp]: "{\<bottom>}\<flat> = \<bottom>"
   1.351 +unfolding inst_lower_pd_pcpo Rep_compact_bot [symmetric] by simp
   1.352 +
   1.353 +lemma lower_unit_strict_iff [simp]: "{x}\<flat> = \<bottom> \<longleftrightarrow> x = \<bottom>"
   1.354 +unfolding lower_unit_strict [symmetric] by (rule lower_unit_eq_iff)
   1.355 +
   1.356 +lemma lower_plus_strict_iff [simp]:
   1.357 +  "xs +\<flat> ys = \<bottom> \<longleftrightarrow> xs = \<bottom> \<and> ys = \<bottom>"
   1.358 +apply safe
   1.359 +apply (rule UU_I, erule subst, rule lower_plus_less1)
   1.360 +apply (rule UU_I, erule subst, rule lower_plus_less2)
   1.361 +apply (rule lower_plus_absorb)
   1.362 +done
   1.363 +
   1.364 +lemma lower_plus_strict1 [simp]: "\<bottom> +\<flat> ys = ys"
   1.365 +apply (rule antisym_less [OF _ lower_plus_less2])
   1.366 +apply (simp add: lower_plus_least)
   1.367 +done
   1.368 +
   1.369 +lemma lower_plus_strict2 [simp]: "xs +\<flat> \<bottom> = xs"
   1.370 +apply (rule antisym_less [OF _ lower_plus_less1])
   1.371 +apply (simp add: lower_plus_least)
   1.372 +done
   1.373 +
   1.374 +lemma compact_lower_unit_iff [simp]: "compact {x}\<flat> \<longleftrightarrow> compact x"
   1.375 +unfolding bifinite_compact_iff by simp
   1.376 +
   1.377 +lemma compact_lower_plus [simp]:
   1.378 +  "\<lbrakk>compact xs; compact ys\<rbrakk> \<Longrightarrow> compact (xs +\<flat> ys)"
   1.379 +apply (drule compact_imp_lower_principal)+
   1.380 +apply (auto simp add: compact_lower_principal)
   1.381 +done
   1.382 +
   1.383  
   1.384  subsection {* Induction rules *}
   1.385  
   1.386  lemma lower_pd_induct1:
   1.387    assumes P: "adm P"
   1.388 -  assumes unit: "\<And>x. P (lower_unit\<cdot>x)"
   1.389 +  assumes unit: "\<And>x. P {x}\<flat>"
   1.390    assumes insert:
   1.391 -    "\<And>x ys. \<lbrakk>P (lower_unit\<cdot>x); P ys\<rbrakk> \<Longrightarrow> P (lower_plus\<cdot>(lower_unit\<cdot>x)\<cdot>ys)"
   1.392 +    "\<And>x ys. \<lbrakk>P {x}\<flat>; P ys\<rbrakk> \<Longrightarrow> P ({x}\<flat> +\<flat> ys)"
   1.393    shows "P (xs::'a lower_pd)"
   1.394  apply (induct xs rule: lower_principal_induct, rule P)
   1.395  apply (induct_tac t rule: pd_basis_induct1)
   1.396 @@ -416,8 +390,8 @@
   1.397  
   1.398  lemma lower_pd_induct:
   1.399    assumes P: "adm P"
   1.400 -  assumes unit: "\<And>x. P (lower_unit\<cdot>x)"
   1.401 -  assumes plus: "\<And>xs ys. \<lbrakk>P xs; P ys\<rbrakk> \<Longrightarrow> P (lower_plus\<cdot>xs\<cdot>ys)"
   1.402 +  assumes unit: "\<And>x. P {x}\<flat>"
   1.403 +  assumes plus: "\<And>xs ys. \<lbrakk>P xs; P ys\<rbrakk> \<Longrightarrow> P (xs +\<flat> ys)"
   1.404    shows "P (xs::'a lower_pd)"
   1.405  apply (induct xs rule: lower_principal_induct, rule P)
   1.406  apply (induct_tac t rule: pd_basis_induct)
   1.407 @@ -433,9 +407,10 @@
   1.408    "'a pd_basis \<Rightarrow> ('a \<rightarrow> 'b lower_pd) \<rightarrow> 'b lower_pd" where
   1.409    "lower_bind_basis = fold_pd
   1.410      (\<lambda>a. \<Lambda> f. f\<cdot>(Rep_compact_basis a))
   1.411 -    (\<lambda>x y. \<Lambda> f. lower_plus\<cdot>(x\<cdot>f)\<cdot>(y\<cdot>f))"
   1.412 +    (\<lambda>x y. \<Lambda> f. x\<cdot>f +\<flat> y\<cdot>f)"
   1.413  
   1.414 -lemma ACI_lower_bind: "ab_semigroup_idem_mult (\<lambda>x y. \<Lambda> f. lower_plus\<cdot>(x\<cdot>f)\<cdot>(y\<cdot>f))"
   1.415 +lemma ACI_lower_bind:
   1.416 +  "ab_semigroup_idem_mult (\<lambda>x y. \<Lambda> f. x\<cdot>f +\<flat> y\<cdot>f)"
   1.417  apply unfold_locales
   1.418  apply (simp add: lower_plus_assoc)
   1.419  apply (simp add: lower_plus_commute)
   1.420 @@ -446,11 +421,11 @@
   1.421    "lower_bind_basis (PDUnit a) =
   1.422      (\<Lambda> f. f\<cdot>(Rep_compact_basis a))"
   1.423    "lower_bind_basis (PDPlus t u) =
   1.424 -    (\<Lambda> f. lower_plus\<cdot>(lower_bind_basis t\<cdot>f)\<cdot>(lower_bind_basis u\<cdot>f))"
   1.425 +    (\<Lambda> f. lower_bind_basis t\<cdot>f +\<flat> lower_bind_basis u\<cdot>f)"
   1.426  unfolding lower_bind_basis_def
   1.427  apply -
   1.428 -apply (rule ab_semigroup_idem_mult.fold_pd_PDUnit [OF ACI_lower_bind])
   1.429 -apply (rule ab_semigroup_idem_mult.fold_pd_PDPlus [OF ACI_lower_bind])
   1.430 +apply (rule fold_pd_PDUnit [OF ACI_lower_bind])
   1.431 +apply (rule fold_pd_PDPlus [OF ACI_lower_bind])
   1.432  done
   1.433  
   1.434  lemma lower_bind_basis_mono:
   1.435 @@ -474,12 +449,11 @@
   1.436  done
   1.437  
   1.438  lemma lower_bind_unit [simp]:
   1.439 -  "lower_bind\<cdot>(lower_unit\<cdot>x)\<cdot>f = f\<cdot>x"
   1.440 +  "lower_bind\<cdot>{x}\<flat>\<cdot>f = f\<cdot>x"
   1.441  by (induct x rule: compact_basis_induct, simp, simp)
   1.442  
   1.443  lemma lower_bind_plus [simp]:
   1.444 -  "lower_bind\<cdot>(lower_plus\<cdot>xs\<cdot>ys)\<cdot>f =
   1.445 -   lower_plus\<cdot>(lower_bind\<cdot>xs\<cdot>f)\<cdot>(lower_bind\<cdot>ys\<cdot>f)"
   1.446 +  "lower_bind\<cdot>(xs +\<flat> ys)\<cdot>f = lower_bind\<cdot>xs\<cdot>f +\<flat> lower_bind\<cdot>ys\<cdot>f"
   1.447  by (induct xs ys rule: lower_principal_induct2, simp, simp, simp)
   1.448  
   1.449  lemma lower_bind_strict [simp]: "lower_bind\<cdot>\<bottom>\<cdot>f = f\<cdot>\<bottom>"
   1.450 @@ -490,28 +464,26 @@
   1.451  
   1.452  definition
   1.453    lower_map :: "('a \<rightarrow> 'b) \<rightarrow> 'a lower_pd \<rightarrow> 'b lower_pd" where
   1.454 -  "lower_map = (\<Lambda> f xs. lower_bind\<cdot>xs\<cdot>(\<Lambda> x. lower_unit\<cdot>(f\<cdot>x)))"
   1.455 +  "lower_map = (\<Lambda> f xs. lower_bind\<cdot>xs\<cdot>(\<Lambda> x. {f\<cdot>x}\<flat>))"
   1.456  
   1.457  definition
   1.458    lower_join :: "'a lower_pd lower_pd \<rightarrow> 'a lower_pd" where
   1.459    "lower_join = (\<Lambda> xss. lower_bind\<cdot>xss\<cdot>(\<Lambda> xs. xs))"
   1.460  
   1.461  lemma lower_map_unit [simp]:
   1.462 -  "lower_map\<cdot>f\<cdot>(lower_unit\<cdot>x) = lower_unit\<cdot>(f\<cdot>x)"
   1.463 +  "lower_map\<cdot>f\<cdot>{x}\<flat> = {f\<cdot>x}\<flat>"
   1.464  unfolding lower_map_def by simp
   1.465  
   1.466  lemma lower_map_plus [simp]:
   1.467 -  "lower_map\<cdot>f\<cdot>(lower_plus\<cdot>xs\<cdot>ys) =
   1.468 -   lower_plus\<cdot>(lower_map\<cdot>f\<cdot>xs)\<cdot>(lower_map\<cdot>f\<cdot>ys)"
   1.469 +  "lower_map\<cdot>f\<cdot>(xs +\<flat> ys) = lower_map\<cdot>f\<cdot>xs +\<flat> lower_map\<cdot>f\<cdot>ys"
   1.470  unfolding lower_map_def by simp
   1.471  
   1.472  lemma lower_join_unit [simp]:
   1.473 -  "lower_join\<cdot>(lower_unit\<cdot>xs) = xs"
   1.474 +  "lower_join\<cdot>{xs}\<flat> = xs"
   1.475  unfolding lower_join_def by simp
   1.476  
   1.477  lemma lower_join_plus [simp]:
   1.478 -  "lower_join\<cdot>(lower_plus\<cdot>xss\<cdot>yss) =
   1.479 -   lower_plus\<cdot>(lower_join\<cdot>xss)\<cdot>(lower_join\<cdot>yss)"
   1.480 +  "lower_join\<cdot>(xss +\<flat> yss) = lower_join\<cdot>xss +\<flat> lower_join\<cdot>yss"
   1.481  unfolding lower_join_def by simp
   1.482  
   1.483  lemma lower_map_ident: "lower_map\<cdot>(\<Lambda> x. x)\<cdot>xs = xs"