25904

1 
(* Title: HOLCF/LowerPD.thy


2 
ID: $Id$


3 
Author: Brian Huffman


4 
*)


5 


6 
header {* Lower powerdomain *}


7 


8 
theory LowerPD


9 
imports CompactBasis


10 
begin


11 


12 
subsection {* Basis preorder *}


13 


14 
definition


15 
lower_le :: "'a pd_basis \<Rightarrow> 'a pd_basis \<Rightarrow> bool" (infix "\<le>\<flat>" 50) where


16 
"lower_le = (\<lambda>u v. \<forall>x\<in>Rep_pd_basis u. \<exists>y\<in>Rep_pd_basis v. compact_le x y)"


17 


18 
lemma lower_le_refl [simp]: "t \<le>\<flat> t"


19 
unfolding lower_le_def by (fast intro: compact_le_refl)


20 


21 
lemma lower_le_trans: "\<lbrakk>t \<le>\<flat> u; u \<le>\<flat> v\<rbrakk> \<Longrightarrow> t \<le>\<flat> v"


22 
unfolding lower_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) compact_le_trans)


28 
done


29 


30 
interpretation lower_le: preorder [lower_le]


31 
by (rule preorder.intro, rule lower_le_refl, rule lower_le_trans)


32 


33 
lemma lower_le_minimal [simp]: "PDUnit compact_bot \<le>\<flat> t"


34 
unfolding lower_le_def Rep_PDUnit


35 
by (simp, rule Rep_pd_basis_nonempty [folded ex_in_conv])


36 


37 
lemma PDUnit_lower_mono: "compact_le x y \<Longrightarrow> PDUnit x \<le>\<flat> PDUnit y"


38 
unfolding lower_le_def Rep_PDUnit by fast


39 


40 
lemma PDPlus_lower_mono: "\<lbrakk>s \<le>\<flat> t; u \<le>\<flat> v\<rbrakk> \<Longrightarrow> PDPlus s u \<le>\<flat> PDPlus t v"


41 
unfolding lower_le_def Rep_PDPlus by fast


42 


43 
lemma PDPlus_lower_less: "t \<le>\<flat> PDPlus t u"


44 
unfolding lower_le_def Rep_PDPlus by (fast intro: compact_le_refl)


45 


46 
lemma lower_le_PDUnit_PDUnit_iff [simp]:


47 
"(PDUnit a \<le>\<flat> PDUnit b) = compact_le a b"


48 
unfolding lower_le_def Rep_PDUnit by fast


49 


50 
lemma lower_le_PDUnit_PDPlus_iff:


51 
"(PDUnit a \<le>\<flat> PDPlus t u) = (PDUnit a \<le>\<flat> t \<or> PDUnit a \<le>\<flat> u)"


52 
unfolding lower_le_def Rep_PDPlus Rep_PDUnit by fast


53 


54 
lemma lower_le_PDPlus_iff: "(PDPlus t u \<le>\<flat> v) = (t \<le>\<flat> v \<and> u \<le>\<flat> v)"


55 
unfolding lower_le_def Rep_PDPlus by fast


56 


57 
lemma lower_le_induct [induct set: lower_le]:


58 
assumes le: "t \<le>\<flat> u"


59 
assumes 1: "\<And>a b. compact_le a b \<Longrightarrow> P (PDUnit a) (PDUnit b)"


60 
assumes 2: "\<And>t u a. P (PDUnit a) t \<Longrightarrow> P (PDUnit a) (PDPlus t u)"


61 
assumes 3: "\<And>t u v. \<lbrakk>P t v; P u v\<rbrakk> \<Longrightarrow> P (PDPlus t u) v"


62 
shows "P t u"


63 
using le


64 
apply (induct t arbitrary: u rule: pd_basis_induct)


65 
apply (erule rev_mp)


66 
apply (induct_tac u rule: pd_basis_induct)


67 
apply (simp add: 1)


68 
apply (simp add: lower_le_PDUnit_PDPlus_iff)


69 
apply (simp add: 2)


70 
apply (subst PDPlus_commute)


71 
apply (simp add: 2)


72 
apply (simp add: lower_le_PDPlus_iff 3)


73 
done


74 


75 
lemma approx_pd_lower_mono1:


76 
"i \<le> j \<Longrightarrow> approx_pd i t \<le>\<flat> approx_pd j t"


77 
apply (induct t rule: pd_basis_induct)


78 
apply (simp add: compact_approx_mono1)


79 
apply (simp add: PDPlus_lower_mono)


80 
done


81 


82 
lemma approx_pd_lower_le: "approx_pd i t \<le>\<flat> t"


83 
apply (induct t rule: pd_basis_induct)


84 
apply (simp add: compact_approx_le)


85 
apply (simp add: PDPlus_lower_mono)


86 
done


87 


88 
lemma approx_pd_lower_mono:


89 
"t \<le>\<flat> u \<Longrightarrow> approx_pd n t \<le>\<flat> approx_pd n u"


90 
apply (erule lower_le_induct)


91 
apply (simp add: compact_approx_mono)


92 
apply (simp add: lower_le_PDUnit_PDPlus_iff)


93 
apply (simp add: lower_le_PDPlus_iff)


94 
done


95 


96 


97 
subsection {* Type definition *}


98 


99 
cpodef (open) 'a lower_pd =


100 
"{S::'a::bifinite pd_basis set. lower_le.ideal S}"


101 
apply (simp add: lower_le.adm_ideal)


102 
apply (fast intro: lower_le.ideal_principal)


103 
done


104 


105 
lemma ideal_Rep_lower_pd: "lower_le.ideal (Rep_lower_pd x)"


106 
by (rule Rep_lower_pd [simplified])


107 


108 
lemma Rep_lower_pd_mono: "x \<sqsubseteq> y \<Longrightarrow> Rep_lower_pd x \<subseteq> Rep_lower_pd y"


109 
unfolding less_lower_pd_def less_set_def .


110 


111 


112 
subsection {* Principal ideals *}


113 


114 
definition


115 
lower_principal :: "'a pd_basis \<Rightarrow> 'a lower_pd" where


116 
"lower_principal t = Abs_lower_pd {u. u \<le>\<flat> t}"


117 


118 
lemma Rep_lower_principal:


119 
"Rep_lower_pd (lower_principal t) = {u. u \<le>\<flat> t}"


120 
unfolding lower_principal_def


121 
apply (rule Abs_lower_pd_inverse [simplified])


122 
apply (rule lower_le.ideal_principal)


123 
done


124 


125 
interpretation lower_pd:


126 
bifinite_basis [lower_le lower_principal Rep_lower_pd approx_pd]


127 
apply unfold_locales


128 
apply (rule ideal_Rep_lower_pd)


129 
apply (rule cont_Rep_lower_pd)


130 
apply (rule Rep_lower_principal)


131 
apply (simp only: less_lower_pd_def less_set_def)


132 
apply (rule approx_pd_lower_le)


133 
apply (rule approx_pd_idem)


134 
apply (erule approx_pd_lower_mono)


135 
apply (rule approx_pd_lower_mono1, simp)


136 
apply (rule finite_range_approx_pd)


137 
apply (rule ex_approx_pd_eq)


138 
done


139 


140 
lemma lower_principal_less_iff [simp]:


141 
"(lower_principal t \<sqsubseteq> lower_principal u) = (t \<le>\<flat> u)"


142 
unfolding less_lower_pd_def Rep_lower_principal less_set_def


143 
by (fast intro: lower_le_refl elim: lower_le_trans)


144 


145 
lemma lower_principal_mono:


146 
"t \<le>\<flat> u \<Longrightarrow> lower_principal t \<sqsubseteq> lower_principal u"


147 
by (rule lower_principal_less_iff [THEN iffD2])


148 


149 
lemma compact_lower_principal: "compact (lower_principal t)"


150 
apply (rule compactI2)


151 
apply (simp add: less_lower_pd_def)


152 
apply (simp add: cont2contlubE [OF cont_Rep_lower_pd])


153 
apply (simp add: Rep_lower_principal set_cpo_simps)


154 
apply (simp add: subset_def)


155 
apply (drule spec, drule mp, rule lower_le_refl)


156 
apply (erule exE, rename_tac i)


157 
apply (rule_tac x=i in exI)


158 
apply clarify


159 
apply (erule (1) lower_le.idealD3 [OF ideal_Rep_lower_pd])


160 
done


161 


162 
lemma lower_pd_minimal: "lower_principal (PDUnit compact_bot) \<sqsubseteq> ys"


163 
by (induct ys rule: lower_pd.principal_induct, simp, simp)


164 


165 
instance lower_pd :: (bifinite) pcpo


166 
by (intro_classes, fast intro: lower_pd_minimal)


167 


168 
lemma inst_lower_pd_pcpo: "\<bottom> = lower_principal (PDUnit compact_bot)"


169 
by (rule lower_pd_minimal [THEN UU_I, symmetric])


170 


171 


172 
subsection {* Approximation *}


173 


174 
instance lower_pd :: (bifinite) approx ..


175 


176 
defs (overloaded)


177 
approx_lower_pd_def:


178 
"approx \<equiv> (\<lambda>n. lower_pd.basis_fun (\<lambda>t. lower_principal (approx_pd n t)))"


179 


180 
lemma approx_lower_principal [simp]:


181 
"approx n\<cdot>(lower_principal t) = lower_principal (approx_pd n t)"


182 
unfolding approx_lower_pd_def


183 
apply (rule lower_pd.basis_fun_principal)


184 
apply (erule lower_principal_mono [OF approx_pd_lower_mono])


185 
done


186 


187 
lemma chain_approx_lower_pd:


188 
"chain (approx :: nat \<Rightarrow> 'a lower_pd \<rightarrow> 'a lower_pd)"


189 
unfolding approx_lower_pd_def


190 
by (rule lower_pd.chain_basis_fun_take)


191 


192 
lemma lub_approx_lower_pd:


193 
"(\<Squnion>i. approx i\<cdot>xs) = (xs::'a lower_pd)"


194 
unfolding approx_lower_pd_def


195 
by (rule lower_pd.lub_basis_fun_take)


196 


197 
lemma approx_lower_pd_idem:


198 
"approx n\<cdot>(approx n\<cdot>xs) = approx n\<cdot>(xs::'a lower_pd)"


199 
apply (induct xs rule: lower_pd.principal_induct, simp)


200 
apply (simp add: approx_pd_idem)


201 
done


202 


203 
lemma approx_eq_lower_principal:


204 
"\<exists>t\<in>Rep_lower_pd xs. approx n\<cdot>xs = lower_principal (approx_pd n t)"


205 
unfolding approx_lower_pd_def


206 
by (rule lower_pd.basis_fun_take_eq_principal)


207 


208 
lemma finite_fixes_approx_lower_pd:


209 
"finite {xs::'a lower_pd. approx n\<cdot>xs = xs}"


210 
unfolding approx_lower_pd_def


211 
by (rule lower_pd.finite_fixes_basis_fun_take)


212 


213 
instance lower_pd :: (bifinite) bifinite


214 
apply intro_classes


215 
apply (simp add: chain_approx_lower_pd)


216 
apply (rule lub_approx_lower_pd)


217 
apply (rule approx_lower_pd_idem)


218 
apply (rule finite_fixes_approx_lower_pd)


219 
done


220 


221 
lemma compact_imp_lower_principal:


222 
"compact xs \<Longrightarrow> \<exists>t. xs = lower_principal t"


223 
apply (drule bifinite_compact_eq_approx)


224 
apply (erule exE)


225 
apply (erule subst)


226 
apply (cut_tac n=i and xs=xs in approx_eq_lower_principal)


227 
apply fast


228 
done


229 


230 
lemma lower_principal_induct:


231 
"\<lbrakk>adm P; \<And>t. P (lower_principal t)\<rbrakk> \<Longrightarrow> P xs"


232 
apply (erule approx_induct, rename_tac xs)


233 
apply (cut_tac n=n and xs=xs in approx_eq_lower_principal)


234 
apply (clarify, simp)


235 
done


236 


237 
lemma lower_principal_induct2:


238 
"\<lbrakk>\<And>ys. adm (\<lambda>xs. P xs ys); \<And>xs. adm (\<lambda>ys. P xs ys);


239 
\<And>t u. P (lower_principal t) (lower_principal u)\<rbrakk> \<Longrightarrow> P xs ys"


240 
apply (rule_tac x=ys in spec)


241 
apply (rule_tac xs=xs in lower_principal_induct, simp)


242 
apply (rule allI, rename_tac ys)


243 
apply (rule_tac xs=ys in lower_principal_induct, simp)


244 
apply simp


245 
done


246 


247 


248 
subsection {* Monadic unit *}


249 


250 
definition


251 
lower_unit :: "'a \<rightarrow> 'a lower_pd" where


252 
"lower_unit = compact_basis.basis_fun (\<lambda>a. lower_principal (PDUnit a))"


253 


254 
lemma lower_unit_Rep_compact_basis [simp]:


255 
"lower_unit\<cdot>(Rep_compact_basis a) = lower_principal (PDUnit a)"


256 
unfolding lower_unit_def


257 
apply (rule compact_basis.basis_fun_principal)


258 
apply (rule lower_principal_mono)


259 
apply (erule PDUnit_lower_mono)


260 
done


261 


262 
lemma lower_unit_strict [simp]: "lower_unit\<cdot>\<bottom> = \<bottom>"


263 
unfolding inst_lower_pd_pcpo Rep_compact_bot [symmetric] by simp


264 


265 
lemma approx_lower_unit [simp]:


266 
"approx n\<cdot>(lower_unit\<cdot>x) = lower_unit\<cdot>(approx n\<cdot>x)"


267 
apply (induct x rule: compact_basis_induct, simp)


268 
apply (simp add: approx_Rep_compact_basis)


269 
done


270 


271 
lemma lower_unit_less_iff [simp]:


272 
"(lower_unit\<cdot>x \<sqsubseteq> lower_unit\<cdot>y) = (x \<sqsubseteq> y)"


273 
apply (rule iffI)


274 
apply (rule bifinite_less_ext)


275 
apply (drule_tac f="approx i" in monofun_cfun_arg, simp)


276 
apply (cut_tac x="approx i\<cdot>x" in compact_imp_Rep_compact_basis, simp)


277 
apply (cut_tac x="approx i\<cdot>y" in compact_imp_Rep_compact_basis, simp)


278 
apply (clarify, simp add: compact_le_def)


279 
apply (erule monofun_cfun_arg)


280 
done


281 


282 
lemma lower_unit_eq_iff [simp]:


283 
"(lower_unit\<cdot>x = lower_unit\<cdot>y) = (x = y)"


284 
unfolding po_eq_conv by simp


285 


286 
lemma lower_unit_strict_iff [simp]: "(lower_unit\<cdot>x = \<bottom>) = (x = \<bottom>)"


287 
unfolding lower_unit_strict [symmetric] by (rule lower_unit_eq_iff)


288 


289 
lemma compact_lower_unit_iff [simp]:


290 
"compact (lower_unit\<cdot>x) = compact x"


291 
unfolding bifinite_compact_iff by simp


292 


293 


294 
subsection {* Monadic plus *}


295 


296 
definition


297 
lower_plus :: "'a lower_pd \<rightarrow> 'a lower_pd \<rightarrow> 'a lower_pd" where


298 
"lower_plus = lower_pd.basis_fun (\<lambda>t. lower_pd.basis_fun (\<lambda>u.


299 
lower_principal (PDPlus t u)))"


300 


301 
abbreviation


302 
lower_add :: "'a lower_pd \<Rightarrow> 'a lower_pd \<Rightarrow> 'a lower_pd"


303 
(infixl "+\<flat>" 65) where


304 
"xs +\<flat> ys == lower_plus\<cdot>xs\<cdot>ys"


305 


306 
lemma lower_plus_principal [simp]:


307 
"lower_plus\<cdot>(lower_principal t)\<cdot>(lower_principal u) =


308 
lower_principal (PDPlus t u)"


309 
unfolding lower_plus_def


310 
by (simp add: lower_pd.basis_fun_principal


311 
lower_pd.basis_fun_mono PDPlus_lower_mono)


312 


313 
lemma approx_lower_plus [simp]:


314 
"approx n\<cdot>(lower_plus\<cdot>xs\<cdot>ys) = lower_plus\<cdot>(approx n\<cdot>xs)\<cdot>(approx n\<cdot>ys)"


315 
by (induct xs ys rule: lower_principal_induct2, simp, simp, simp)


316 


317 
lemma lower_plus_commute: "lower_plus\<cdot>xs\<cdot>ys = lower_plus\<cdot>ys\<cdot>xs"


318 
apply (induct xs ys rule: lower_principal_induct2, simp, simp)


319 
apply (simp add: PDPlus_commute)


320 
done


321 


322 
lemma lower_plus_assoc:


323 
"lower_plus\<cdot>(lower_plus\<cdot>xs\<cdot>ys)\<cdot>zs = lower_plus\<cdot>xs\<cdot>(lower_plus\<cdot>ys\<cdot>zs)"


324 
apply (induct xs ys arbitrary: zs rule: lower_principal_induct2, simp, simp)


325 
apply (rule_tac xs=zs in lower_principal_induct, simp)


326 
apply (simp add: PDPlus_assoc)


327 
done


328 


329 
lemma lower_plus_absorb: "lower_plus\<cdot>xs\<cdot>xs = xs"


330 
apply (induct xs rule: lower_principal_induct, simp)


331 
apply (simp add: PDPlus_absorb)


332 
done


333 


334 
lemma lower_plus_less1: "xs \<sqsubseteq> lower_plus\<cdot>xs\<cdot>ys"


335 
apply (induct xs ys rule: lower_principal_induct2, simp, simp)


336 
apply (simp add: PDPlus_lower_less)


337 
done


338 


339 
lemma lower_plus_less2: "ys \<sqsubseteq> lower_plus\<cdot>xs\<cdot>ys"


340 
by (subst lower_plus_commute, rule lower_plus_less1)


341 


342 
lemma lower_plus_least: "\<lbrakk>xs \<sqsubseteq> zs; ys \<sqsubseteq> zs\<rbrakk> \<Longrightarrow> lower_plus\<cdot>xs\<cdot>ys \<sqsubseteq> zs"


343 
apply (subst lower_plus_absorb [of zs, symmetric])


344 
apply (erule (1) monofun_cfun [OF monofun_cfun_arg])


345 
done


346 


347 
lemma lower_plus_less_iff:


348 
"(lower_plus\<cdot>xs\<cdot>ys \<sqsubseteq> zs) = (xs \<sqsubseteq> zs \<and> ys \<sqsubseteq> zs)"


349 
apply safe


350 
apply (erule trans_less [OF lower_plus_less1])


351 
apply (erule trans_less [OF lower_plus_less2])


352 
apply (erule (1) lower_plus_least)


353 
done


354 


355 
lemma lower_plus_strict_iff [simp]:


356 
"(lower_plus\<cdot>xs\<cdot>ys = \<bottom>) = (xs = \<bottom> \<and> ys = \<bottom>)"


357 
apply safe


358 
apply (rule UU_I, erule subst, rule lower_plus_less1)


359 
apply (rule UU_I, erule subst, rule lower_plus_less2)


360 
apply (rule lower_plus_absorb)


361 
done


362 


363 
lemma lower_plus_strict1 [simp]: "lower_plus\<cdot>\<bottom>\<cdot>ys = ys"


364 
apply (rule antisym_less [OF _ lower_plus_less2])


365 
apply (simp add: lower_plus_least)


366 
done


367 


368 
lemma lower_plus_strict2 [simp]: "lower_plus\<cdot>xs\<cdot>\<bottom> = xs"


369 
apply (rule antisym_less [OF _ lower_plus_less1])


370 
apply (simp add: lower_plus_least)


371 
done


372 


373 
lemma lower_unit_less_plus_iff:


374 
"(lower_unit\<cdot>x \<sqsubseteq> lower_plus\<cdot>ys\<cdot>zs) =


375 
(lower_unit\<cdot>x \<sqsubseteq> ys \<or> lower_unit\<cdot>x \<sqsubseteq> zs)"


376 
apply (rule iffI)


377 
apply (subgoal_tac


378 
"adm (\<lambda>f. f\<cdot>(lower_unit\<cdot>x) \<sqsubseteq> f\<cdot>ys \<or> f\<cdot>(lower_unit\<cdot>x) \<sqsubseteq> f\<cdot>zs)")


379 
apply (drule admD [rule_format], rule chain_approx)


380 
apply (drule_tac f="approx i" in monofun_cfun_arg)


381 
apply (cut_tac x="approx i\<cdot>x" in compact_imp_Rep_compact_basis, simp)


382 
apply (cut_tac xs="approx i\<cdot>ys" in compact_imp_lower_principal, simp)


383 
apply (cut_tac xs="approx i\<cdot>zs" in compact_imp_lower_principal, simp)


384 
apply (clarify, simp add: lower_le_PDUnit_PDPlus_iff)


385 
apply simp


386 
apply simp


387 
apply (erule disjE)


388 
apply (erule trans_less [OF _ lower_plus_less1])


389 
apply (erule trans_less [OF _ lower_plus_less2])


390 
done


391 


392 
lemmas lower_pd_less_simps =


393 
lower_unit_less_iff


394 
lower_plus_less_iff


395 
lower_unit_less_plus_iff


396 


397 


398 
subsection {* Induction rules *}


399 


400 
lemma lower_pd_induct1:


401 
assumes P: "adm P"


402 
assumes unit: "\<And>x. P (lower_unit\<cdot>x)"


403 
assumes insert:


404 
"\<And>x ys. \<lbrakk>P (lower_unit\<cdot>x); P ys\<rbrakk> \<Longrightarrow> P (lower_plus\<cdot>(lower_unit\<cdot>x)\<cdot>ys)"


405 
shows "P (xs::'a lower_pd)"


406 
apply (induct xs rule: lower_principal_induct, rule P)


407 
apply (induct_tac t rule: pd_basis_induct1)


408 
apply (simp only: lower_unit_Rep_compact_basis [symmetric])


409 
apply (rule unit)


410 
apply (simp only: lower_unit_Rep_compact_basis [symmetric]


411 
lower_plus_principal [symmetric])


412 
apply (erule insert [OF unit])


413 
done


414 


415 
lemma lower_pd_induct:


416 
assumes P: "adm P"


417 
assumes unit: "\<And>x. P (lower_unit\<cdot>x)"


418 
assumes plus: "\<And>xs ys. \<lbrakk>P xs; P ys\<rbrakk> \<Longrightarrow> P (lower_plus\<cdot>xs\<cdot>ys)"


419 
shows "P (xs::'a lower_pd)"


420 
apply (induct xs rule: lower_principal_induct, rule P)


421 
apply (induct_tac t rule: pd_basis_induct)


422 
apply (simp only: lower_unit_Rep_compact_basis [symmetric] unit)


423 
apply (simp only: lower_plus_principal [symmetric] plus)


424 
done


425 


426 


427 
subsection {* Monadic bind *}


428 


429 
definition


430 
lower_bind_basis ::


431 
"'a pd_basis \<Rightarrow> ('a \<rightarrow> 'b lower_pd) \<rightarrow> 'b lower_pd" where


432 
"lower_bind_basis = fold_pd


433 
(\<lambda>a. \<Lambda> f. f\<cdot>(Rep_compact_basis a))


434 
(\<lambda>x y. \<Lambda> f. lower_plus\<cdot>(x\<cdot>f)\<cdot>(y\<cdot>f))"


435 


436 
lemma ACI_lower_bind: "ACIf (\<lambda>x y. \<Lambda> f. lower_plus\<cdot>(x\<cdot>f)\<cdot>(y\<cdot>f))"


437 
apply unfold_locales


438 
apply (simp add: lower_plus_commute)


439 
apply (simp add: lower_plus_assoc)


440 
apply (simp add: lower_plus_absorb eta_cfun)


441 
done


442 


443 
lemma lower_bind_basis_simps [simp]:


444 
"lower_bind_basis (PDUnit a) =


445 
(\<Lambda> f. f\<cdot>(Rep_compact_basis a))"


446 
"lower_bind_basis (PDPlus t u) =


447 
(\<Lambda> f. lower_plus\<cdot>(lower_bind_basis t\<cdot>f)\<cdot>(lower_bind_basis u\<cdot>f))"


448 
unfolding lower_bind_basis_def


449 
apply 


450 
apply (rule ACIf.fold_pd_PDUnit [OF ACI_lower_bind])


451 
apply (rule ACIf.fold_pd_PDPlus [OF ACI_lower_bind])


452 
done


453 


454 
lemma lower_bind_basis_mono:


455 
"t \<le>\<flat> u \<Longrightarrow> lower_bind_basis t \<sqsubseteq> lower_bind_basis u"


456 
unfolding expand_cfun_less


457 
apply (erule lower_le_induct, safe)


458 
apply (simp add: compact_le_def monofun_cfun)


459 
apply (simp add: rev_trans_less [OF lower_plus_less1])


460 
apply (simp add: lower_plus_less_iff)


461 
done


462 


463 
definition


464 
lower_bind :: "'a lower_pd \<rightarrow> ('a \<rightarrow> 'b lower_pd) \<rightarrow> 'b lower_pd" where


465 
"lower_bind = lower_pd.basis_fun lower_bind_basis"


466 


467 
lemma lower_bind_principal [simp]:


468 
"lower_bind\<cdot>(lower_principal t) = lower_bind_basis t"


469 
unfolding lower_bind_def


470 
apply (rule lower_pd.basis_fun_principal)


471 
apply (erule lower_bind_basis_mono)


472 
done


473 


474 
lemma lower_bind_unit [simp]:


475 
"lower_bind\<cdot>(lower_unit\<cdot>x)\<cdot>f = f\<cdot>x"


476 
by (induct x rule: compact_basis_induct, simp, simp)


477 


478 
lemma lower_bind_plus [simp]:


479 
"lower_bind\<cdot>(lower_plus\<cdot>xs\<cdot>ys)\<cdot>f =


480 
lower_plus\<cdot>(lower_bind\<cdot>xs\<cdot>f)\<cdot>(lower_bind\<cdot>ys\<cdot>f)"


481 
by (induct xs ys rule: lower_principal_induct2, simp, simp, simp)


482 


483 
lemma lower_bind_strict [simp]: "lower_bind\<cdot>\<bottom>\<cdot>f = f\<cdot>\<bottom>"


484 
unfolding lower_unit_strict [symmetric] by (rule lower_bind_unit)


485 


486 


487 
subsection {* Map and join *}


488 


489 
definition


490 
lower_map :: "('a \<rightarrow> 'b) \<rightarrow> 'a lower_pd \<rightarrow> 'b lower_pd" where


491 
"lower_map = (\<Lambda> f xs. lower_bind\<cdot>xs\<cdot>(\<Lambda> x. lower_unit\<cdot>(f\<cdot>x)))"


492 


493 
definition


494 
lower_join :: "'a lower_pd lower_pd \<rightarrow> 'a lower_pd" where


495 
"lower_join = (\<Lambda> xss. lower_bind\<cdot>xss\<cdot>(\<Lambda> xs. xs))"


496 


497 
lemma lower_map_unit [simp]:


498 
"lower_map\<cdot>f\<cdot>(lower_unit\<cdot>x) = lower_unit\<cdot>(f\<cdot>x)"


499 
unfolding lower_map_def by simp


500 


501 
lemma lower_map_plus [simp]:


502 
"lower_map\<cdot>f\<cdot>(lower_plus\<cdot>xs\<cdot>ys) =


503 
lower_plus\<cdot>(lower_map\<cdot>f\<cdot>xs)\<cdot>(lower_map\<cdot>f\<cdot>ys)"


504 
unfolding lower_map_def by simp


505 


506 
lemma lower_join_unit [simp]:


507 
"lower_join\<cdot>(lower_unit\<cdot>xs) = xs"


508 
unfolding lower_join_def by simp


509 


510 
lemma lower_join_plus [simp]:


511 
"lower_join\<cdot>(lower_plus\<cdot>xss\<cdot>yss) =


512 
lower_plus\<cdot>(lower_join\<cdot>xss)\<cdot>(lower_join\<cdot>yss)"


513 
unfolding lower_join_def by simp


514 


515 
lemma lower_map_ident: "lower_map\<cdot>(\<Lambda> x. x)\<cdot>xs = xs"


516 
by (induct xs rule: lower_pd_induct, simp_all)


517 


518 
lemma lower_map_map:


519 
"lower_map\<cdot>f\<cdot>(lower_map\<cdot>g\<cdot>xs) = lower_map\<cdot>(\<Lambda> x. f\<cdot>(g\<cdot>x))\<cdot>xs"


520 
by (induct xs rule: lower_pd_induct, simp_all)


521 


522 
lemma lower_join_map_unit:


523 
"lower_join\<cdot>(lower_map\<cdot>lower_unit\<cdot>xs) = xs"


524 
by (induct xs rule: lower_pd_induct, simp_all)


525 


526 
lemma lower_join_map_join:


527 
"lower_join\<cdot>(lower_map\<cdot>lower_join\<cdot>xsss) = lower_join\<cdot>(lower_join\<cdot>xsss)"


528 
by (induct xsss rule: lower_pd_induct, simp_all)


529 


530 
lemma lower_join_map_map:


531 
"lower_join\<cdot>(lower_map\<cdot>(lower_map\<cdot>f)\<cdot>xss) =


532 
lower_map\<cdot>f\<cdot>(lower_join\<cdot>xss)"


533 
by (induct xss rule: lower_pd_induct, simp_all)


534 


535 
lemma lower_map_approx: "lower_map\<cdot>(approx n)\<cdot>xs = approx n\<cdot>xs"


536 
by (induct xs rule: lower_pd_induct, simp_all)


537 


538 
end
