src/HOLCF/UpperPD.thy
author huffman
Mon May 19 23:49:20 2008 +0200 (2008-05-19)
changeset 26962 c8b20f615d6c
parent 26927 8684b5240f11
child 27267 5ebfb7f25ebb
permissions -rw-r--r--
use new class package for classes profinite, bifinite; remove approx class
     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
    16   "upper_le = (\<lambda>u v. \<forall>y\<in>Rep_pd_basis v. \<exists>x\<in>Rep_pd_basis u. x \<sqsubseteq> y)"
    17 
    18 lemma upper_le_refl [simp]: "t \<le>\<sharp> t"
    19 unfolding upper_le_def by fast
    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)
    27 apply (erule (1) trans_less)
    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 
    36 lemma PDUnit_upper_mono: "x \<sqsubseteq> y \<Longrightarrow> PDUnit x \<le>\<sharp> PDUnit y"
    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"
    43 unfolding upper_le_def Rep_PDPlus by fast
    44 
    45 lemma upper_le_PDUnit_PDUnit_iff [simp]:
    46   "(PDUnit a \<le>\<sharp> PDUnit b) = a \<sqsubseteq> b"
    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"
    58   assumes 1: "\<And>a b. a \<sqsubseteq> b \<Longrightarrow> P (PDUnit a) (PDUnit b)"
    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 =
    98   "{S::'a::profinite pd_basis set. upper_le.ideal S}"
    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)"
   104 by (rule Rep_upper_pd [unfolded mem_Collect_eq])
   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
   113 apply (rule Abs_upper_pd_inverse [unfolded mem_Collect_eq])
   114 apply (rule upper_le.ideal_principal)
   115 done
   116 
   117 interpretation upper_pd:
   118   ideal_completion [upper_le approx_pd upper_principal Rep_upper_pd]
   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)
   126 apply (rule ideal_Rep_upper_pd)
   127 apply (rule cont_Rep_upper_pd)
   128 apply (rule Rep_upper_principal)
   129 apply (simp only: less_upper_pd_def less_set_eq)
   130 done
   131 
   132 lemma upper_principal_less_iff [simp]:
   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)
   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
   151 by intro_classes (fast intro: upper_pd_minimal)
   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 
   159 instantiation upper_pd :: (profinite) profinite
   160 begin
   161 
   162 definition
   163   approx_upper_pd_def: "approx = upper_pd.completion_approx"
   164 
   165 instance
   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 
   173 end
   174 
   175 instance upper_pd :: (bifinite) bifinite ..
   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
   180 by (rule upper_pd.completion_approx_principal)
   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
   185 by (rule upper_pd.completion_approx_eq_principal)
   186 
   187 lemma compact_imp_upper_principal:
   188   "compact xs \<Longrightarrow> \<exists>t. xs = upper_principal t"
   189 apply (drule bifinite_compact_eq_approx)
   190 apply (erule exE)
   191 apply (erule subst)
   192 apply (cut_tac n=i and xs=xs in approx_eq_upper_principal)
   193 apply fast
   194 done
   195 
   196 lemma upper_principal_induct:
   197   "\<lbrakk>adm P; \<And>t. P (upper_principal t)\<rbrakk> \<Longrightarrow> P xs"
   198 by (rule upper_pd.principal_induct)
   199 
   200 lemma upper_principal_induct2:
   201   "\<lbrakk>\<And>ys. adm (\<lambda>xs. P xs ys); \<And>xs. adm (\<lambda>ys. P xs ys);
   202     \<And>t u. P (upper_principal t) (upper_principal u)\<rbrakk> \<Longrightarrow> P xs ys"
   203 apply (rule_tac x=ys in spec)
   204 apply (rule_tac xs=xs in upper_principal_induct, simp)
   205 apply (rule allI, rename_tac ys)
   206 apply (rule_tac xs=ys in upper_principal_induct, simp)
   207 apply simp
   208 done
   209 
   210 
   211 subsection {* Monadic unit and plus *}
   212 
   213 definition
   214   upper_unit :: "'a \<rightarrow> 'a upper_pd" where
   215   "upper_unit = compact_basis.basis_fun (\<lambda>a. upper_principal (PDUnit a))"
   216 
   217 definition
   218   upper_plus :: "'a upper_pd \<rightarrow> 'a upper_pd \<rightarrow> 'a upper_pd" where
   219   "upper_plus = upper_pd.basis_fun (\<lambda>t. upper_pd.basis_fun (\<lambda>u.
   220       upper_principal (PDPlus t u)))"
   221 
   222 abbreviation
   223   upper_add :: "'a upper_pd \<Rightarrow> 'a upper_pd \<Rightarrow> 'a upper_pd"
   224     (infixl "+\<sharp>" 65) where
   225   "xs +\<sharp> ys == upper_plus\<cdot>xs\<cdot>ys"
   226 
   227 syntax
   228   "_upper_pd" :: "args \<Rightarrow> 'a upper_pd" ("{_}\<sharp>")
   229 
   230 translations
   231   "{x,xs}\<sharp>" == "{x}\<sharp> +\<sharp> {xs}\<sharp>"
   232   "{x}\<sharp>" == "CONST upper_unit\<cdot>x"
   233 
   234 lemma upper_unit_Rep_compact_basis [simp]:
   235   "{Rep_compact_basis a}\<sharp> = upper_principal (PDUnit a)"
   236 unfolding upper_unit_def
   237 by (simp add: compact_basis.basis_fun_principal
   238     upper_principal_mono PDUnit_upper_mono)
   239 
   240 lemma upper_plus_principal [simp]:
   241   "upper_principal t +\<sharp> upper_principal u = upper_principal (PDPlus t u)"
   242 unfolding upper_plus_def
   243 by (simp add: upper_pd.basis_fun_principal
   244     upper_pd.basis_fun_mono PDPlus_upper_mono)
   245 
   246 lemma approx_upper_unit [simp]:
   247   "approx n\<cdot>{x}\<sharp> = {approx n\<cdot>x}\<sharp>"
   248 apply (induct x rule: compact_basis_induct, simp)
   249 apply (simp add: approx_Rep_compact_basis)
   250 done
   251 
   252 lemma approx_upper_plus [simp]:
   253   "approx n\<cdot>(xs +\<sharp> ys) = (approx n\<cdot>xs) +\<sharp> (approx n\<cdot>ys)"
   254 by (induct xs ys rule: upper_principal_induct2, simp, simp, simp)
   255 
   256 lemma upper_plus_assoc: "(xs +\<sharp> ys) +\<sharp> zs = xs +\<sharp> (ys +\<sharp> zs)"
   257 apply (induct xs ys arbitrary: zs rule: upper_principal_induct2, simp, simp)
   258 apply (rule_tac xs=zs in upper_principal_induct, simp)
   259 apply (simp add: PDPlus_assoc)
   260 done
   261 
   262 lemma upper_plus_commute: "xs +\<sharp> ys = ys +\<sharp> xs"
   263 apply (induct xs ys rule: upper_principal_induct2, simp, simp)
   264 apply (simp add: PDPlus_commute)
   265 done
   266 
   267 lemma upper_plus_absorb: "xs +\<sharp> xs = xs"
   268 apply (induct xs rule: upper_principal_induct, simp)
   269 apply (simp add: PDPlus_absorb)
   270 done
   271 
   272 interpretation aci_upper_plus: ab_semigroup_idem_mult ["op +\<sharp>"]
   273   by unfold_locales
   274     (rule upper_plus_assoc upper_plus_commute upper_plus_absorb)+
   275 
   276 lemma upper_plus_left_commute: "xs +\<sharp> (ys +\<sharp> zs) = ys +\<sharp> (xs +\<sharp> zs)"
   277 by (rule aci_upper_plus.mult_left_commute)
   278 
   279 lemma upper_plus_left_absorb: "xs +\<sharp> (xs +\<sharp> ys) = xs +\<sharp> ys"
   280 by (rule aci_upper_plus.mult_left_idem)
   281 
   282 lemmas upper_plus_aci = aci_upper_plus.mult_ac_idem
   283 
   284 lemma upper_plus_less1: "xs +\<sharp> ys \<sqsubseteq> xs"
   285 apply (induct xs ys rule: upper_principal_induct2, simp, simp)
   286 apply (simp add: PDPlus_upper_less)
   287 done
   288 
   289 lemma upper_plus_less2: "xs +\<sharp> ys \<sqsubseteq> ys"
   290 by (subst upper_plus_commute, rule upper_plus_less1)
   291 
   292 lemma upper_plus_greatest: "\<lbrakk>xs \<sqsubseteq> ys; xs \<sqsubseteq> zs\<rbrakk> \<Longrightarrow> xs \<sqsubseteq> ys +\<sharp> zs"
   293 apply (subst upper_plus_absorb [of xs, symmetric])
   294 apply (erule (1) monofun_cfun [OF monofun_cfun_arg])
   295 done
   296 
   297 lemma upper_less_plus_iff:
   298   "xs \<sqsubseteq> ys +\<sharp> zs \<longleftrightarrow> xs \<sqsubseteq> ys \<and> xs \<sqsubseteq> zs"
   299 apply safe
   300 apply (erule trans_less [OF _ upper_plus_less1])
   301 apply (erule trans_less [OF _ upper_plus_less2])
   302 apply (erule (1) upper_plus_greatest)
   303 done
   304 
   305 lemma upper_plus_less_unit_iff:
   306   "xs +\<sharp> ys \<sqsubseteq> {z}\<sharp> \<longleftrightarrow> xs \<sqsubseteq> {z}\<sharp> \<or> ys \<sqsubseteq> {z}\<sharp>"
   307  apply (rule iffI)
   308   apply (subgoal_tac
   309     "adm (\<lambda>f. f\<cdot>xs \<sqsubseteq> f\<cdot>{z}\<sharp> \<or> f\<cdot>ys \<sqsubseteq> f\<cdot>{z}\<sharp>)")
   310    apply (drule admD, rule chain_approx)
   311     apply (drule_tac f="approx i" in monofun_cfun_arg)
   312     apply (cut_tac xs="approx i\<cdot>xs" in compact_imp_upper_principal, simp)
   313     apply (cut_tac xs="approx i\<cdot>ys" in compact_imp_upper_principal, simp)
   314     apply (cut_tac x="approx i\<cdot>z" in compact_imp_Rep_compact_basis, simp)
   315     apply (clarify, simp add: upper_le_PDPlus_PDUnit_iff)
   316    apply simp
   317   apply simp
   318  apply (erule disjE)
   319   apply (erule trans_less [OF upper_plus_less1])
   320  apply (erule trans_less [OF upper_plus_less2])
   321 done
   322 
   323 lemma upper_unit_less_iff [simp]: "{x}\<sharp> \<sqsubseteq> {y}\<sharp> \<longleftrightarrow> x \<sqsubseteq> y"
   324  apply (rule iffI)
   325   apply (rule bifinite_less_ext)
   326   apply (drule_tac f="approx i" in monofun_cfun_arg, simp)
   327   apply (cut_tac x="approx i\<cdot>x" in compact_imp_Rep_compact_basis, simp)
   328   apply (cut_tac x="approx i\<cdot>y" in compact_imp_Rep_compact_basis, simp)
   329   apply (clarify, simp add: compact_le_def)
   330  apply (erule monofun_cfun_arg)
   331 done
   332 
   333 lemmas upper_pd_less_simps =
   334   upper_unit_less_iff
   335   upper_less_plus_iff
   336   upper_plus_less_unit_iff
   337 
   338 lemma upper_unit_eq_iff [simp]: "{x}\<sharp> = {y}\<sharp> \<longleftrightarrow> x = y"
   339 unfolding po_eq_conv by simp
   340 
   341 lemma upper_unit_strict [simp]: "{\<bottom>}\<sharp> = \<bottom>"
   342 unfolding inst_upper_pd_pcpo Rep_compact_bot [symmetric] by simp
   343 
   344 lemma upper_plus_strict1 [simp]: "\<bottom> +\<sharp> ys = \<bottom>"
   345 by (rule UU_I, rule upper_plus_less1)
   346 
   347 lemma upper_plus_strict2 [simp]: "xs +\<sharp> \<bottom> = \<bottom>"
   348 by (rule UU_I, rule upper_plus_less2)
   349 
   350 lemma upper_unit_strict_iff [simp]: "{x}\<sharp> = \<bottom> \<longleftrightarrow> x = \<bottom>"
   351 unfolding upper_unit_strict [symmetric] by (rule upper_unit_eq_iff)
   352 
   353 lemma upper_plus_strict_iff [simp]:
   354   "xs +\<sharp> ys = \<bottom> \<longleftrightarrow> xs = \<bottom> \<or> ys = \<bottom>"
   355 apply (rule iffI)
   356 apply (erule rev_mp)
   357 apply (rule upper_principal_induct2 [where xs=xs and ys=ys], simp, simp)
   358 apply (simp add: inst_upper_pd_pcpo upper_principal_eq_iff
   359                  upper_le_PDPlus_PDUnit_iff)
   360 apply auto
   361 done
   362 
   363 lemma compact_upper_unit_iff [simp]: "compact {x}\<sharp> \<longleftrightarrow> compact x"
   364 unfolding bifinite_compact_iff by simp
   365 
   366 lemma compact_upper_plus [simp]:
   367   "\<lbrakk>compact xs; compact ys\<rbrakk> \<Longrightarrow> compact (xs +\<sharp> ys)"
   368 apply (drule compact_imp_upper_principal)+
   369 apply (auto simp add: compact_upper_principal)
   370 done
   371 
   372 
   373 subsection {* Induction rules *}
   374 
   375 lemma upper_pd_induct1:
   376   assumes P: "adm P"
   377   assumes unit: "\<And>x. P {x}\<sharp>"
   378   assumes insert: "\<And>x ys. \<lbrakk>P {x}\<sharp>; P ys\<rbrakk> \<Longrightarrow> P ({x}\<sharp> +\<sharp> ys)"
   379   shows "P (xs::'a upper_pd)"
   380 apply (induct xs rule: upper_principal_induct, rule P)
   381 apply (induct_tac t rule: pd_basis_induct1)
   382 apply (simp only: upper_unit_Rep_compact_basis [symmetric])
   383 apply (rule unit)
   384 apply (simp only: upper_unit_Rep_compact_basis [symmetric]
   385                   upper_plus_principal [symmetric])
   386 apply (erule insert [OF unit])
   387 done
   388 
   389 lemma upper_pd_induct:
   390   assumes P: "adm P"
   391   assumes unit: "\<And>x. P {x}\<sharp>"
   392   assumes plus: "\<And>xs ys. \<lbrakk>P xs; P ys\<rbrakk> \<Longrightarrow> P (xs +\<sharp> ys)"
   393   shows "P (xs::'a upper_pd)"
   394 apply (induct xs rule: upper_principal_induct, rule P)
   395 apply (induct_tac t rule: pd_basis_induct)
   396 apply (simp only: upper_unit_Rep_compact_basis [symmetric] unit)
   397 apply (simp only: upper_plus_principal [symmetric] plus)
   398 done
   399 
   400 
   401 subsection {* Monadic bind *}
   402 
   403 definition
   404   upper_bind_basis ::
   405   "'a pd_basis \<Rightarrow> ('a \<rightarrow> 'b upper_pd) \<rightarrow> 'b upper_pd" where
   406   "upper_bind_basis = fold_pd
   407     (\<lambda>a. \<Lambda> f. f\<cdot>(Rep_compact_basis a))
   408     (\<lambda>x y. \<Lambda> f. x\<cdot>f +\<sharp> y\<cdot>f)"
   409 
   410 lemma ACI_upper_bind:
   411   "ab_semigroup_idem_mult (\<lambda>x y. \<Lambda> f. x\<cdot>f +\<sharp> y\<cdot>f)"
   412 apply unfold_locales
   413 apply (simp add: upper_plus_assoc)
   414 apply (simp add: upper_plus_commute)
   415 apply (simp add: upper_plus_absorb eta_cfun)
   416 done
   417 
   418 lemma upper_bind_basis_simps [simp]:
   419   "upper_bind_basis (PDUnit a) =
   420     (\<Lambda> f. f\<cdot>(Rep_compact_basis a))"
   421   "upper_bind_basis (PDPlus t u) =
   422     (\<Lambda> f. upper_bind_basis t\<cdot>f +\<sharp> upper_bind_basis u\<cdot>f)"
   423 unfolding upper_bind_basis_def
   424 apply -
   425 apply (rule fold_pd_PDUnit [OF ACI_upper_bind])
   426 apply (rule fold_pd_PDPlus [OF ACI_upper_bind])
   427 done
   428 
   429 lemma upper_bind_basis_mono:
   430   "t \<le>\<sharp> u \<Longrightarrow> upper_bind_basis t \<sqsubseteq> upper_bind_basis u"
   431 unfolding expand_cfun_less
   432 apply (erule upper_le_induct, safe)
   433 apply (simp add: compact_le_def monofun_cfun)
   434 apply (simp add: trans_less [OF upper_plus_less1])
   435 apply (simp add: upper_less_plus_iff)
   436 done
   437 
   438 definition
   439   upper_bind :: "'a upper_pd \<rightarrow> ('a \<rightarrow> 'b upper_pd) \<rightarrow> 'b upper_pd" where
   440   "upper_bind = upper_pd.basis_fun upper_bind_basis"
   441 
   442 lemma upper_bind_principal [simp]:
   443   "upper_bind\<cdot>(upper_principal t) = upper_bind_basis t"
   444 unfolding upper_bind_def
   445 apply (rule upper_pd.basis_fun_principal)
   446 apply (erule upper_bind_basis_mono)
   447 done
   448 
   449 lemma upper_bind_unit [simp]:
   450   "upper_bind\<cdot>{x}\<sharp>\<cdot>f = f\<cdot>x"
   451 by (induct x rule: compact_basis_induct, simp, simp)
   452 
   453 lemma upper_bind_plus [simp]:
   454   "upper_bind\<cdot>(xs +\<sharp> ys)\<cdot>f = upper_bind\<cdot>xs\<cdot>f +\<sharp> upper_bind\<cdot>ys\<cdot>f"
   455 by (induct xs ys rule: upper_principal_induct2, simp, simp, simp)
   456 
   457 lemma upper_bind_strict [simp]: "upper_bind\<cdot>\<bottom>\<cdot>f = f\<cdot>\<bottom>"
   458 unfolding upper_unit_strict [symmetric] by (rule upper_bind_unit)
   459 
   460 
   461 subsection {* Map and join *}
   462 
   463 definition
   464   upper_map :: "('a \<rightarrow> 'b) \<rightarrow> 'a upper_pd \<rightarrow> 'b upper_pd" where
   465   "upper_map = (\<Lambda> f xs. upper_bind\<cdot>xs\<cdot>(\<Lambda> x. {f\<cdot>x}\<sharp>))"
   466 
   467 definition
   468   upper_join :: "'a upper_pd upper_pd \<rightarrow> 'a upper_pd" where
   469   "upper_join = (\<Lambda> xss. upper_bind\<cdot>xss\<cdot>(\<Lambda> xs. xs))"
   470 
   471 lemma upper_map_unit [simp]:
   472   "upper_map\<cdot>f\<cdot>{x}\<sharp> = {f\<cdot>x}\<sharp>"
   473 unfolding upper_map_def by simp
   474 
   475 lemma upper_map_plus [simp]:
   476   "upper_map\<cdot>f\<cdot>(xs +\<sharp> ys) = upper_map\<cdot>f\<cdot>xs +\<sharp> upper_map\<cdot>f\<cdot>ys"
   477 unfolding upper_map_def by simp
   478 
   479 lemma upper_join_unit [simp]:
   480   "upper_join\<cdot>{xs}\<sharp> = xs"
   481 unfolding upper_join_def by simp
   482 
   483 lemma upper_join_plus [simp]:
   484   "upper_join\<cdot>(xss +\<sharp> yss) = upper_join\<cdot>xss +\<sharp> upper_join\<cdot>yss"
   485 unfolding upper_join_def by simp
   486 
   487 lemma upper_map_ident: "upper_map\<cdot>(\<Lambda> x. x)\<cdot>xs = xs"
   488 by (induct xs rule: upper_pd_induct, simp_all)
   489 
   490 lemma upper_map_map:
   491   "upper_map\<cdot>f\<cdot>(upper_map\<cdot>g\<cdot>xs) = upper_map\<cdot>(\<Lambda> x. f\<cdot>(g\<cdot>x))\<cdot>xs"
   492 by (induct xs rule: upper_pd_induct, simp_all)
   493 
   494 lemma upper_join_map_unit:
   495   "upper_join\<cdot>(upper_map\<cdot>upper_unit\<cdot>xs) = xs"
   496 by (induct xs rule: upper_pd_induct, simp_all)
   497 
   498 lemma upper_join_map_join:
   499   "upper_join\<cdot>(upper_map\<cdot>upper_join\<cdot>xsss) = upper_join\<cdot>(upper_join\<cdot>xsss)"
   500 by (induct xsss rule: upper_pd_induct, simp_all)
   501 
   502 lemma upper_join_map_map:
   503   "upper_join\<cdot>(upper_map\<cdot>(upper_map\<cdot>f)\<cdot>xss) =
   504    upper_map\<cdot>f\<cdot>(upper_join\<cdot>xss)"
   505 by (induct xss rule: upper_pd_induct, simp_all)
   506 
   507 lemma upper_map_approx: "upper_map\<cdot>(approx n)\<cdot>xs = approx n\<cdot>xs"
   508 by (induct xs rule: upper_pd_induct, simp_all)
   509 
   510 end