src/HOL/HOLCF/Pcpo.thy
changeset 62175 8ffc4d0e652d
parent 61998 b66d2ca1f907
child 67312 0d25e02759b7
equal deleted inserted replaced
62174:fae6233c5f37 62175:8ffc4d0e652d
     1 (*  Title:      HOL/HOLCF/Pcpo.thy
     1 (*  Title:      HOL/HOLCF/Pcpo.thy
     2     Author:     Franz Regensburger
     2     Author:     Franz Regensburger
     3 *)
     3 *)
     4 
     4 
     5 section {* Classes cpo and pcpo *}
     5 section \<open>Classes cpo and pcpo\<close>
     6 
     6 
     7 theory Pcpo
     7 theory Pcpo
     8 imports Porder
     8 imports Porder
     9 begin
     9 begin
    10 
    10 
    11 subsection {* Complete partial orders *}
    11 subsection \<open>Complete partial orders\<close>
    12 
    12 
    13 text {* The class cpo of chain complete partial orders *}
    13 text \<open>The class cpo of chain complete partial orders\<close>
    14 
    14 
    15 class cpo = po +
    15 class cpo = po +
    16   assumes cpo: "chain S \<Longrightarrow> \<exists>x. range S <<| x"
    16   assumes cpo: "chain S \<Longrightarrow> \<exists>x. range S <<| x"
    17 begin
    17 begin
    18 
    18 
    19 text {* in cpo's everthing equal to THE lub has lub properties for every chain *}
    19 text \<open>in cpo's everthing equal to THE lub has lub properties for every chain\<close>
    20 
    20 
    21 lemma cpo_lubI: "chain S \<Longrightarrow> range S <<| (\<Squnion>i. S i)"
    21 lemma cpo_lubI: "chain S \<Longrightarrow> range S <<| (\<Squnion>i. S i)"
    22   by (fast dest: cpo elim: is_lub_lub)
    22   by (fast dest: cpo elim: is_lub_lub)
    23 
    23 
    24 lemma thelubE: "\<lbrakk>chain S; (\<Squnion>i. S i) = l\<rbrakk> \<Longrightarrow> range S <<| l"
    24 lemma thelubE: "\<lbrakk>chain S; (\<Squnion>i. S i) = l\<rbrakk> \<Longrightarrow> range S <<| l"
    25   by (blast dest: cpo intro: is_lub_lub)
    25   by (blast dest: cpo intro: is_lub_lub)
    26 
    26 
    27 text {* Properties of the lub *}
    27 text \<open>Properties of the lub\<close>
    28 
    28 
    29 lemma is_ub_thelub: "chain S \<Longrightarrow> S x \<sqsubseteq> (\<Squnion>i. S i)"
    29 lemma is_ub_thelub: "chain S \<Longrightarrow> S x \<sqsubseteq> (\<Squnion>i. S i)"
    30   by (blast dest: cpo intro: is_lub_lub [THEN is_lub_rangeD1])
    30   by (blast dest: cpo intro: is_lub_lub [THEN is_lub_rangeD1])
    31 
    31 
    32 lemma is_lub_thelub:
    32 lemma is_lub_thelub:
    76 apply (fast elim!: chain_mono)
    76 apply (fast elim!: chain_mono)
    77 apply (drule sym)
    77 apply (drule sym)
    78 apply (force elim!: is_ub_thelub)
    78 apply (force elim!: is_ub_thelub)
    79 done
    79 done
    80 
    80 
    81 text {* the @{text "\<sqsubseteq>"} relation between two chains is preserved by their lubs *}
    81 text \<open>the \<open>\<sqsubseteq>\<close> relation between two chains is preserved by their lubs\<close>
    82 
    82 
    83 lemma lub_mono:
    83 lemma lub_mono:
    84   "\<lbrakk>chain X; chain Y; \<And>i. X i \<sqsubseteq> Y i\<rbrakk> 
    84   "\<lbrakk>chain X; chain Y; \<And>i. X i \<sqsubseteq> Y i\<rbrakk> 
    85     \<Longrightarrow> (\<Squnion>i. X i) \<sqsubseteq> (\<Squnion>i. Y i)"
    85     \<Longrightarrow> (\<Squnion>i. X i) \<sqsubseteq> (\<Squnion>i. Y i)"
    86 by (fast elim: lub_below below_lub)
    86 by (fast elim: lub_below below_lub)
    87 
    87 
    88 text {* the = relation between two chains is preserved by their lubs *}
    88 text \<open>the = relation between two chains is preserved by their lubs\<close>
    89 
    89 
    90 lemma lub_eq:
    90 lemma lub_eq:
    91   "(\<And>i. X i = Y i) \<Longrightarrow> (\<Squnion>i. X i) = (\<Squnion>i. Y i)"
    91   "(\<And>i. X i = Y i) \<Longrightarrow> (\<Squnion>i. X i) = (\<Squnion>i. Y i)"
    92   by simp
    92   by simp
    93 
    93 
   133   shows "(\<Squnion>i. \<Squnion>j. Y i j) = (\<Squnion>j. \<Squnion>i. Y i j)"
   133   shows "(\<Squnion>i. \<Squnion>j. Y i j) = (\<Squnion>j. \<Squnion>i. Y i j)"
   134   by (simp add: diag_lub 1 2)
   134   by (simp add: diag_lub 1 2)
   135 
   135 
   136 end
   136 end
   137 
   137 
   138 subsection {* Pointed cpos *}
   138 subsection \<open>Pointed cpos\<close>
   139 
   139 
   140 text {* The class pcpo of pointed cpos *}
   140 text \<open>The class pcpo of pointed cpos\<close>
   141 
   141 
   142 class pcpo = cpo +
   142 class pcpo = cpo +
   143   assumes least: "\<exists>x. \<forall>y. x \<sqsubseteq> y"
   143   assumes least: "\<exists>x. \<forall>y. x \<sqsubseteq> y"
   144 begin
   144 begin
   145 
   145 
   155 apply simp
   155 apply simp
   156 done
   156 done
   157 
   157 
   158 end
   158 end
   159 
   159 
   160 text {* Old "UU" syntax: *}
   160 text \<open>Old "UU" syntax:\<close>
   161 
   161 
   162 syntax UU :: logic
   162 syntax UU :: logic
   163 
   163 
   164 translations "UU" => "CONST bottom"
   164 translations "UU" => "CONST bottom"
   165 
   165 
   166 text {* Simproc to rewrite @{term "\<bottom> = x"} to @{term "x = \<bottom>"}. *}
   166 text \<open>Simproc to rewrite @{term "\<bottom> = x"} to @{term "x = \<bottom>"}.\<close>
   167 
   167 
   168 setup {*
   168 setup \<open>
   169   Reorient_Proc.add
   169   Reorient_Proc.add
   170     (fn Const(@{const_name bottom}, _) => true | _ => false)
   170     (fn Const(@{const_name bottom}, _) => true | _ => false)
   171 *}
   171 \<close>
   172 
   172 
   173 simproc_setup reorient_bottom ("\<bottom> = x") = Reorient_Proc.proc
   173 simproc_setup reorient_bottom ("\<bottom> = x") = Reorient_Proc.proc
   174 
   174 
   175 text {* useful lemmas about @{term \<bottom>} *}
   175 text \<open>useful lemmas about @{term \<bottom>}\<close>
   176 
   176 
   177 lemma below_bottom_iff [simp]: "(x \<sqsubseteq> \<bottom>) = (x = \<bottom>)"
   177 lemma below_bottom_iff [simp]: "(x \<sqsubseteq> \<bottom>) = (x = \<bottom>)"
   178 by (simp add: po_eq_conv)
   178 by (simp add: po_eq_conv)
   179 
   179 
   180 lemma eq_bottom_iff: "(x = \<bottom>) = (x \<sqsubseteq> \<bottom>)"
   180 lemma eq_bottom_iff: "(x = \<bottom>) = (x \<sqsubseteq> \<bottom>)"
   184 by (subst eq_bottom_iff)
   184 by (subst eq_bottom_iff)
   185 
   185 
   186 lemma lub_eq_bottom_iff: "chain Y \<Longrightarrow> (\<Squnion>i. Y i) = \<bottom> \<longleftrightarrow> (\<forall>i. Y i = \<bottom>)"
   186 lemma lub_eq_bottom_iff: "chain Y \<Longrightarrow> (\<Squnion>i. Y i) = \<bottom> \<longleftrightarrow> (\<forall>i. Y i = \<bottom>)"
   187 by (simp only: eq_bottom_iff lub_below_iff)
   187 by (simp only: eq_bottom_iff lub_below_iff)
   188 
   188 
   189 subsection {* Chain-finite and flat cpos *}
   189 subsection \<open>Chain-finite and flat cpos\<close>
   190 
   190 
   191 text {* further useful classes for HOLCF domains *}
   191 text \<open>further useful classes for HOLCF domains\<close>
   192 
   192 
   193 class chfin = po +
   193 class chfin = po +
   194   assumes chfin: "chain Y \<Longrightarrow> \<exists>n. max_in_chain n Y"
   194   assumes chfin: "chain Y \<Longrightarrow> \<exists>n. max_in_chain n Y"
   195 begin
   195 begin
   196 
   196 
   228 lemma flat_eq: "a \<noteq> \<bottom> \<Longrightarrow> a \<sqsubseteq> b = (a = b)"
   228 lemma flat_eq: "a \<noteq> \<bottom> \<Longrightarrow> a \<sqsubseteq> b = (a = b)"
   229   by (safe dest!: ax_flat)
   229   by (safe dest!: ax_flat)
   230 
   230 
   231 end
   231 end
   232 
   232 
   233 subsection {* Discrete cpos *}
   233 subsection \<open>Discrete cpos\<close>
   234 
   234 
   235 class discrete_cpo = below +
   235 class discrete_cpo = below +
   236   assumes discrete_cpo [simp]: "x \<sqsubseteq> y \<longleftrightarrow> x = y"
   236   assumes discrete_cpo [simp]: "x \<sqsubseteq> y \<longleftrightarrow> x = y"
   237 begin
   237 begin
   238 
   238 
   239 subclass po
   239 subclass po
   240 proof qed simp_all
   240 proof qed simp_all
   241 
   241 
   242 text {* In a discrete cpo, every chain is constant *}
   242 text \<open>In a discrete cpo, every chain is constant\<close>
   243 
   243 
   244 lemma discrete_chain_const:
   244 lemma discrete_chain_const:
   245   assumes S: "chain S"
   245   assumes S: "chain S"
   246   shows "\<exists>x. S = (\<lambda>i. x)"
   246   shows "\<exists>x. S = (\<lambda>i. x)"
   247 proof (intro exI ext)
   247 proof (intro exI ext)