src/HOLCF/CompactBasis.thy
changeset 27297 2c42b1505f25
parent 27289 c49d427867aa
child 27309 c74270fd72a8
equal deleted inserted replaced
27296:eec7a1889ca5 27297:2c42b1505f25
     4 *)
     4 *)
     5 
     5 
     6 header {* Compact bases of domains *}
     6 header {* Compact bases of domains *}
     7 
     7 
     8 theory CompactBasis
     8 theory CompactBasis
     9 imports Bifinite SetPcpo
     9 imports Bifinite Cset
    10 begin
    10 begin
    11 
    11 
    12 subsection {* Ideals over a preorder *}
    12 subsection {* Ideals over a preorder *}
    13 
    13 
    14 locale preorder =
    14 locale preorder =
    76 apply (rule_tac x="f c" in rev_bexI)
    76 apply (rule_tac x="f c" in rev_bexI)
    77 apply (erule imageI)
    77 apply (erule imageI)
    78 apply (simp add: f)
    78 apply (simp add: f)
    79 done
    79 done
    80 
    80 
    81 lemma adm_ideal: "adm (\<lambda>A. ideal A)"
    81 lemma adm_ideal: "adm (\<lambda>A. ideal (Rep_cset A))"
    82 unfolding ideal_def by (intro adm_lemmas adm_set_lemmas)
    82 unfolding ideal_def by (intro adm_lemmas adm_set_lemmas)
       
    83 
       
    84 lemma cpodef_ideal_lemma:
       
    85   "(\<exists>x. x \<in> {S. ideal (Rep_cset S)}) \<and> adm (\<lambda>x. x \<in> {S. ideal (Rep_cset S)})"
       
    86 apply (simp add: adm_ideal)
       
    87 apply (rule exI [where x="Abs_cset {x. x \<preceq> arbitrary}"])
       
    88 apply (simp add: ideal_principal)
       
    89 done
    83 
    90 
    84 lemma lub_image_principal:
    91 lemma lub_image_principal:
    85   assumes f: "\<And>x y. x \<preceq> y \<Longrightarrow> f x \<sqsubseteq> f y"
    92   assumes f: "\<And>x y. x \<preceq> y \<Longrightarrow> f x \<sqsubseteq> f y"
    86   shows "(\<Squnion>x\<in>{x. x \<preceq> y}. f x) = f y"
    93   shows "(\<Squnion>x\<in>{x. x \<preceq> y}. f x) = f y"
    87 apply (rule thelubI)
    94 apply (rule thelubI)
   148 
   155 
   149 locale ideal_completion = basis_take +
   156 locale ideal_completion = basis_take +
   150   fixes principal :: "'a::type \<Rightarrow> 'b::cpo"
   157   fixes principal :: "'a::type \<Rightarrow> 'b::cpo"
   151   fixes rep :: "'b::cpo \<Rightarrow> 'a::type set"
   158   fixes rep :: "'b::cpo \<Rightarrow> 'a::type set"
   152   assumes ideal_rep: "\<And>x. preorder.ideal r (rep x)"
   159   assumes ideal_rep: "\<And>x. preorder.ideal r (rep x)"
   153   assumes cont_rep: "cont rep"
   160   assumes rep_contlub: "\<And>Y. chain Y \<Longrightarrow> rep (\<Squnion>i. Y i) = (\<Union>i. rep (Y i))"
   154   assumes rep_principal: "\<And>a. rep (principal a) = {b. b \<preceq> a}"
   161   assumes rep_principal: "\<And>a. rep (principal a) = {b. b \<preceq> a}"
   155   assumes subset_repD: "\<And>x y. rep x \<subseteq> rep y \<Longrightarrow> x \<sqsubseteq> y"
   162   assumes subset_repD: "\<And>x y. rep x \<subseteq> rep y \<Longrightarrow> x \<sqsubseteq> y"
   156 begin
   163 begin
   157 
   164 
   158 lemma finite_take_rep: "finite (take n ` rep x)"
   165 lemma finite_take_rep: "finite (take n ` rep x)"
   214   assumes f_mono: "\<And>a b. a \<preceq> b \<Longrightarrow> f a \<sqsubseteq> f b"
   221   assumes f_mono: "\<And>a b. a \<preceq> b \<Longrightarrow> f a \<sqsubseteq> f b"
   215   shows "\<exists>u. f ` rep x <<| u"
   222   shows "\<exists>u. f ` rep x <<| u"
   216 by (rule exI, rule basis_fun_lemma2, erule f_mono)
   223 by (rule exI, rule basis_fun_lemma2, erule f_mono)
   217 
   224 
   218 lemma rep_mono: "x \<sqsubseteq> y \<Longrightarrow> rep x \<subseteq> rep y"
   225 lemma rep_mono: "x \<sqsubseteq> y \<Longrightarrow> rep x \<subseteq> rep y"
   219 apply (drule cont_rep [THEN cont2mono, THEN monofunE])
   226 apply (frule bin_chain)
   220 apply (simp add: set_cpo_simps)
   227 apply (drule rep_contlub)
   221 done
   228 apply (simp only: thelubI [OF lub_bin_chain])
   222 
   229 apply (rule subsetI, rule UN_I [where a=0], simp_all)
   223 lemma rep_contlub:
   230 done
   224   "chain Y \<Longrightarrow> rep (\<Squnion>i. Y i) = (\<Union>i. rep (Y i))"
       
   225 by (simp add: cont2contlubE [OF cont_rep] set_cpo_simps)
       
   226 
   231 
   227 lemma less_def: "x \<sqsubseteq> y \<longleftrightarrow> rep x \<subseteq> rep y"
   232 lemma less_def: "x \<sqsubseteq> y \<longleftrightarrow> rep x \<subseteq> rep y"
   228 by (rule iffI [OF rep_mono subset_repD])
   233 by (rule iffI [OF rep_mono subset_repD])
   229 
   234 
   230 lemma rep_eq: "rep x = {a. principal a \<sqsubseteq> x}"
   235 lemma rep_eq: "rep x = {a. principal a \<sqsubseteq> x}"
   535       apply (simp add: compact_le_def)
   540       apply (simp add: compact_le_def)
   536       apply (erule (1) trans_less)
   541       apply (erule (1) trans_less)
   537       done
   542       done
   538   qed
   543   qed
   539 next
   544 next
   540   show "cont compacts"
   545   fix Y :: "nat \<Rightarrow> 'a"
       
   546   assume Y: "chain Y"
       
   547   show "compacts (\<Squnion>i. Y i) = (\<Union>i. compacts (Y i))"
   541     unfolding compacts_def
   548     unfolding compacts_def
   542     apply (rule contI2)
   549     apply safe
   543     apply (rule monofunI)
   550     apply (simp add: compactD2 [OF compact_Rep_compact_basis Y])
   544     apply (simp add: set_cpo_simps)
   551     apply (erule trans_less, rule is_ub_thelub [OF Y])
   545     apply (fast intro: trans_less)
       
   546     apply (simp add: set_cpo_simps)
       
   547     apply clarify
       
   548     apply simp
       
   549     apply (erule (1) compactD2 [OF compact_Rep_compact_basis])
       
   550     done
   552     done
   551 next
   553 next
   552   fix a :: "'a compact_basis"
   554   fix a :: "'a compact_basis"
   553   show "compacts (Rep_compact_basis a) = {b. b \<sqsubseteq> a}"
   555   show "compacts (Rep_compact_basis a) = {b. b \<sqsubseteq> a}"
   554     unfolding compacts_def compact_le_def ..
   556     unfolding compacts_def compact_le_def ..