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