| author | blanchet | 
| Wed, 14 Apr 2010 18:23:51 +0200 | |
| changeset 36142 | f5e15e9aae10 | 
| parent 35492 | 5d200f2d7a4f | 
| child 39199 | 720112792ba0 | 
| permissions | -rw-r--r-- | 
| 2640 | 1 | (* Title: HOLCF/Pcpo.thy | 
| 2 | Author: Franz Regensburger | |
| 3 | *) | |
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: 
15563diff
changeset | 4 | |
| 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: 
15563diff
changeset | 5 | header {* Classes cpo and pcpo *}
 | 
| 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: 
15563diff
changeset | 6 | |
| 15577 | 7 | theory Pcpo | 
| 8 | imports Porder | |
| 9 | begin | |
| 243 
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
 nipkow parents: diff
changeset | 10 | |
| 15588 
14e3228f18cc
arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 11 | subsection {* Complete partial orders *}
 | 
| 
14e3228f18cc
arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 12 | |
| 
14e3228f18cc
arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 13 | text {* The class cpo of chain complete partial orders *}
 | 
| 
14e3228f18cc
arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 14 | |
| 29614 
1f7b1b0df292
simplified handling of base sort, dropped axclass
 haftmann parents: 
29138diff
changeset | 15 | class cpo = po + | 
| 31071 | 16 | assumes cpo: "chain S \<Longrightarrow> \<exists>x. range S <<| x" | 
| 17 | begin | |
| 2394 | 18 | |
| 15588 
14e3228f18cc
arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 19 | text {* in cpo's everthing equal to THE lub has lub properties for every chain *}
 | 
| 15563 | 20 | |
| 31071 | 21 | lemma cpo_lubI: "chain S \<Longrightarrow> range S <<| (\<Squnion>i. S i)" | 
| 22 | by (fast dest: cpo elim: lubI) | |
| 26026 | 23 | |
| 31071 | 24 | lemma thelubE: "\<lbrakk>chain S; (\<Squnion>i. S i) = l\<rbrakk> \<Longrightarrow> range S <<| l" | 
| 25 | by (blast dest: cpo intro: lubI) | |
| 15563 | 26 | |
| 15588 
14e3228f18cc
arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 27 | text {* Properties of the lub *}
 | 
| 15563 | 28 | |
| 31071 | 29 | lemma is_ub_thelub: "chain S \<Longrightarrow> S x \<sqsubseteq> (\<Squnion>i. S i)" | 
| 30 | by (blast dest: cpo intro: lubI [THEN is_ub_lub]) | |
| 15563 | 31 | |
| 16626 | 32 | lemma is_lub_thelub: | 
| 31071 | 33 | "\<lbrakk>chain S; range S <| x\<rbrakk> \<Longrightarrow> (\<Squnion>i. S i) \<sqsubseteq> x" | 
| 34 | by (blast dest: cpo intro: lubI [THEN is_lub_lub]) | |
| 15563 | 35 | |
| 16626 | 36 | lemma lub_range_mono: | 
| 31071 | 37 | "\<lbrakk>range X \<subseteq> range Y; chain Y; chain X\<rbrakk> | 
| 16626 | 38 | \<Longrightarrow> (\<Squnion>i. X i) \<sqsubseteq> (\<Squnion>i. Y i)" | 
| 15563 | 39 | apply (erule is_lub_thelub) | 
| 40 | apply (rule ub_rangeI) | |
| 16626 | 41 | apply (subgoal_tac "\<exists>j. X i = Y j") | 
| 15563 | 42 | apply clarsimp | 
| 43 | apply (erule is_ub_thelub) | |
| 44 | apply auto | |
| 45 | done | |
| 46 | ||
| 16626 | 47 | lemma lub_range_shift: | 
| 31071 | 48 | "chain Y \<Longrightarrow> (\<Squnion>i. Y (i + j)) = (\<Squnion>i. Y i)" | 
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
31071diff
changeset | 49 | apply (rule below_antisym) | 
| 15563 | 50 | apply (rule lub_range_mono) | 
| 51 | apply fast | |
| 52 | apply assumption | |
| 53 | apply (erule chain_shift) | |
| 54 | apply (rule is_lub_thelub) | |
| 55 | apply assumption | |
| 56 | apply (rule ub_rangeI) | |
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
31071diff
changeset | 57 | apply (rule_tac y="Y (i + j)" in below_trans) | 
| 25922 
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
 huffman parents: 
25921diff
changeset | 58 | apply (erule chain_mono) | 
| 15563 | 59 | apply (rule le_add1) | 
| 17813 | 60 | apply (rule is_ub_thelub) | 
| 61 | apply (erule chain_shift) | |
| 15563 | 62 | done | 
| 63 | ||
| 16626 | 64 | lemma maxinch_is_thelub: | 
| 31071 | 65 | "chain Y \<Longrightarrow> max_in_chain i Y = ((\<Squnion>i. Y i) = Y i)" | 
| 15563 | 66 | apply (rule iffI) | 
| 67 | apply (fast intro!: thelubI lub_finch1) | |
| 68 | apply (unfold max_in_chain_def) | |
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
31071diff
changeset | 69 | apply (safe intro!: below_antisym) | 
| 25922 
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
 huffman parents: 
25921diff
changeset | 70 | apply (fast elim!: chain_mono) | 
| 15563 | 71 | apply (drule sym) | 
| 72 | apply (force elim!: is_ub_thelub) | |
| 73 | done | |
| 74 | ||
| 16626 | 75 | text {* the @{text "\<sqsubseteq>"} relation between two chains is preserved by their lubs *}
 | 
| 15563 | 76 | |
| 16626 | 77 | lemma lub_mono: | 
| 31071 | 78 | "\<lbrakk>chain X; chain Y; \<And>i. X i \<sqsubseteq> Y i\<rbrakk> | 
| 16626 | 79 | \<Longrightarrow> (\<Squnion>i. X i) \<sqsubseteq> (\<Squnion>i. Y i)" | 
| 15563 | 80 | apply (erule is_lub_thelub) | 
| 81 | apply (rule ub_rangeI) | |
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
31071diff
changeset | 82 | apply (rule below_trans) | 
| 25923 | 83 | apply (erule meta_spec) | 
| 15563 | 84 | apply (erule is_ub_thelub) | 
| 85 | done | |
| 86 | ||
| 15588 
14e3228f18cc
arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 87 | text {* the = relation between two chains is preserved by their lubs *}
 | 
| 15563 | 88 | |
| 16626 | 89 | lemma lub_equal: | 
| 31071 | 90 | "\<lbrakk>chain X; chain Y; \<forall>k. X k = Y k\<rbrakk> | 
| 16626 | 91 | \<Longrightarrow> (\<Squnion>i. X i) = (\<Squnion>i. Y i)" | 
| 31071 | 92 | by (simp only: expand_fun_eq [symmetric]) | 
| 15563 | 93 | |
| 35492 | 94 | lemma lub_eq: | 
| 95 | "(\<And>i. X i = Y i) \<Longrightarrow> (\<Squnion>i. X i) = (\<Squnion>i. Y i)" | |
| 96 | by simp | |
| 97 | ||
| 15588 
14e3228f18cc
arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 98 | text {* more results about mono and = of lubs of chains *}
 | 
| 3326 | 99 | |
| 16626 | 100 | lemma lub_mono2: | 
| 31071 | 101 | "\<lbrakk>\<exists>j. \<forall>i>j. X i = Y i; chain X; chain Y\<rbrakk> | 
| 16626 | 102 | \<Longrightarrow> (\<Squnion>i. X i) \<sqsubseteq> (\<Squnion>i. Y i)" | 
| 15563 | 103 | apply (erule exE) | 
| 17813 | 104 | apply (subgoal_tac "(\<Squnion>i. X (i + Suc j)) \<sqsubseteq> (\<Squnion>i. Y (i + Suc j))") | 
| 105 | apply (thin_tac "\<forall>i>j. X i = Y i") | |
| 106 | apply (simp only: lub_range_shift) | |
| 16626 | 107 | apply simp | 
| 15563 | 108 | done | 
| 109 | ||
| 16626 | 110 | lemma lub_equal2: | 
| 31071 | 111 | "\<lbrakk>\<exists>j. \<forall>i>j. X i = Y i; chain X; chain Y\<rbrakk> | 
| 16626 | 112 | \<Longrightarrow> (\<Squnion>i. X i) = (\<Squnion>i. Y i)" | 
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
31071diff
changeset | 113 | by (blast intro: below_antisym lub_mono2 sym) | 
| 15563 | 114 | |
| 16626 | 115 | lemma lub_mono3: | 
| 31071 | 116 | "\<lbrakk>chain Y; chain X; \<forall>i. \<exists>j. Y i \<sqsubseteq> X j\<rbrakk> | 
| 16626 | 117 | \<Longrightarrow> (\<Squnion>i. Y i) \<sqsubseteq> (\<Squnion>i. X i)" | 
| 17813 | 118 | apply (erule is_lub_thelub) | 
| 15563 | 119 | apply (rule ub_rangeI) | 
| 120 | apply (erule allE) | |
| 121 | apply (erule exE) | |
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
31071diff
changeset | 122 | apply (erule below_trans) | 
| 16626 | 123 | apply (erule is_ub_thelub) | 
| 15563 | 124 | done | 
| 125 | ||
| 16203 | 126 | lemma ch2ch_lub: | 
| 127 | assumes 1: "\<And>j. chain (\<lambda>i. Y i j)" | |
| 128 | assumes 2: "\<And>i. chain (\<lambda>j. Y i j)" | |
| 129 | shows "chain (\<lambda>i. \<Squnion>j. Y i j)" | |
| 130 | apply (rule chainI) | |
| 25923 | 131 | apply (rule lub_mono [OF 2 2]) | 
| 16203 | 132 | apply (rule chainE [OF 1]) | 
| 133 | done | |
| 134 | ||
| 16201 | 135 | lemma diag_lub: | 
| 136 | assumes 1: "\<And>j. chain (\<lambda>i. Y i j)" | |
| 137 | assumes 2: "\<And>i. chain (\<lambda>j. Y i j)" | |
| 138 | shows "(\<Squnion>i. \<Squnion>j. Y i j) = (\<Squnion>i. Y i i)" | |
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
31071diff
changeset | 139 | proof (rule below_antisym) | 
| 16201 | 140 | have 3: "chain (\<lambda>i. Y i i)" | 
| 141 | apply (rule chainI) | |
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
31071diff
changeset | 142 | apply (rule below_trans) | 
| 16201 | 143 | apply (rule chainE [OF 1]) | 
| 144 | apply (rule chainE [OF 2]) | |
| 145 | done | |
| 146 | have 4: "chain (\<lambda>i. \<Squnion>j. Y i j)" | |
| 16203 | 147 | by (rule ch2ch_lub [OF 1 2]) | 
| 16201 | 148 | show "(\<Squnion>i. \<Squnion>j. Y i j) \<sqsubseteq> (\<Squnion>i. Y i i)" | 
| 149 | apply (rule is_lub_thelub [OF 4]) | |
| 150 | apply (rule ub_rangeI) | |
| 16203 | 151 | apply (rule lub_mono3 [rule_format, OF 2 3]) | 
| 16201 | 152 | apply (rule exI) | 
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
31071diff
changeset | 153 | apply (rule below_trans) | 
| 25922 
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
 huffman parents: 
25921diff
changeset | 154 | apply (rule chain_mono [OF 1 le_maxI1]) | 
| 
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
 huffman parents: 
25921diff
changeset | 155 | apply (rule chain_mono [OF 2 le_maxI2]) | 
| 16201 | 156 | done | 
| 157 | show "(\<Squnion>i. Y i i) \<sqsubseteq> (\<Squnion>i. \<Squnion>j. Y i j)" | |
| 25923 | 158 | apply (rule lub_mono [OF 3 4]) | 
| 16201 | 159 | apply (rule is_ub_thelub [OF 2]) | 
| 160 | done | |
| 161 | qed | |
| 162 | ||
| 163 | lemma ex_lub: | |
| 164 | assumes 1: "\<And>j. chain (\<lambda>i. Y i j)" | |
| 165 | assumes 2: "\<And>i. chain (\<lambda>j. Y i j)" | |
| 166 | shows "(\<Squnion>i. \<Squnion>j. Y i j) = (\<Squnion>j. \<Squnion>i. Y i j)" | |
| 31071 | 167 | by (simp add: diag_lub 1 2) | 
| 16201 | 168 | |
| 31071 | 169 | end | 
| 16201 | 170 | |
| 15588 
14e3228f18cc
arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 171 | subsection {* Pointed cpos *}
 | 
| 
14e3228f18cc
arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 172 | |
| 
14e3228f18cc
arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 173 | text {* The class pcpo of pointed cpos *}
 | 
| 
14e3228f18cc
arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 174 | |
| 29614 
1f7b1b0df292
simplified handling of base sort, dropped axclass
 haftmann parents: 
29138diff
changeset | 175 | class pcpo = cpo + | 
| 
1f7b1b0df292
simplified handling of base sort, dropped axclass
 haftmann parents: 
29138diff
changeset | 176 | assumes least: "\<exists>x. \<forall>y. x \<sqsubseteq> y" | 
| 31071 | 177 | begin | 
| 25723 | 178 | |
| 31071 | 179 | definition UU :: 'a where | 
| 25723 | 180 | "UU = (THE x. \<forall>y. x \<sqsubseteq> y)" | 
| 181 | ||
| 182 | notation (xsymbols) | |
| 183 |   UU  ("\<bottom>")
 | |
| 184 | ||
| 185 | text {* derive the old rule minimal *}
 | |
| 186 | ||
| 187 | lemma UU_least: "\<forall>z. \<bottom> \<sqsubseteq> z" | |
| 188 | apply (unfold UU_def) | |
| 189 | apply (rule theI') | |
| 190 | apply (rule ex_ex1I) | |
| 191 | apply (rule least) | |
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
31071diff
changeset | 192 | apply (blast intro: below_antisym) | 
| 25723 | 193 | done | 
| 194 | ||
| 195 | lemma minimal [iff]: "\<bottom> \<sqsubseteq> x" | |
| 196 | by (rule UU_least [THEN spec]) | |
| 197 | ||
| 31071 | 198 | end | 
| 199 | ||
| 31024 
0fdf666e08bf
reimplement reorientation simproc using theory data
 huffman parents: 
29634diff
changeset | 200 | text {* Simproc to rewrite @{term "\<bottom> = x"} to @{term "x = \<bottom>"}. *}
 | 
| 16739 | 201 | |
| 31024 
0fdf666e08bf
reimplement reorientation simproc using theory data
 huffman parents: 
29634diff
changeset | 202 | setup {*
 | 
| 33523 | 203 | Reorient_Proc.add | 
| 31024 
0fdf666e08bf
reimplement reorientation simproc using theory data
 huffman parents: 
29634diff
changeset | 204 |     (fn Const(@{const_name UU}, _) => true | _ => false)
 | 
| 
0fdf666e08bf
reimplement reorientation simproc using theory data
 huffman parents: 
29634diff
changeset | 205 | *} | 
| 25723 | 206 | |
| 33523 | 207 | simproc_setup reorient_bottom ("\<bottom> = x") = Reorient_Proc.proc
 | 
| 25723 | 208 | |
| 31071 | 209 | context pcpo | 
| 210 | begin | |
| 211 | ||
| 25723 | 212 | text {* useful lemmas about @{term \<bottom>} *}
 | 
| 213 | ||
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
31071diff
changeset | 214 | lemma below_UU_iff [simp]: "(x \<sqsubseteq> \<bottom>) = (x = \<bottom>)" | 
| 25723 | 215 | by (simp add: po_eq_conv) | 
| 216 | ||
| 217 | lemma eq_UU_iff: "(x = \<bottom>) = (x \<sqsubseteq> \<bottom>)" | |
| 218 | by simp | |
| 219 | ||
| 220 | lemma UU_I: "x \<sqsubseteq> \<bottom> \<Longrightarrow> x = \<bottom>" | |
| 221 | by (subst eq_UU_iff) | |
| 222 | ||
| 223 | lemma chain_UU_I: "\<lbrakk>chain Y; (\<Squnion>i. Y i) = \<bottom>\<rbrakk> \<Longrightarrow> \<forall>i. Y i = \<bottom>" | |
| 15563 | 224 | apply (rule allI) | 
| 16626 | 225 | apply (rule UU_I) | 
| 15563 | 226 | apply (erule subst) | 
| 227 | apply (erule is_ub_thelub) | |
| 228 | done | |
| 229 | ||
| 16626 | 230 | lemma chain_UU_I_inverse: "\<forall>i::nat. Y i = \<bottom> \<Longrightarrow> (\<Squnion>i. Y i) = \<bottom>" | 
| 15563 | 231 | apply (rule lub_chain_maxelem) | 
| 232 | apply (erule spec) | |
| 15588 
14e3228f18cc
arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 233 | apply simp | 
| 15563 | 234 | done | 
| 235 | ||
| 16626 | 236 | lemma chain_UU_I_inverse2: "(\<Squnion>i. Y i) \<noteq> \<bottom> \<Longrightarrow> \<exists>i::nat. Y i \<noteq> \<bottom>" | 
| 31071 | 237 | by (blast intro: chain_UU_I_inverse) | 
| 15563 | 238 | |
| 16626 | 239 | lemma notUU_I: "\<lbrakk>x \<sqsubseteq> y; x \<noteq> \<bottom>\<rbrakk> \<Longrightarrow> y \<noteq> \<bottom>" | 
| 31071 | 240 | by (blast intro: UU_I) | 
| 15563 | 241 | |
| 16627 | 242 | lemma chain_mono2: "\<lbrakk>\<exists>j. Y j \<noteq> \<bottom>; chain Y\<rbrakk> \<Longrightarrow> \<exists>j. \<forall>i>j. Y i \<noteq> \<bottom>" | 
| 31071 | 243 | by (blast dest: notUU_I chain_mono_less) | 
| 244 | ||
| 245 | end | |
| 15588 
14e3228f18cc
arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 246 | |
| 
14e3228f18cc
arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 247 | subsection {* Chain-finite and flat cpos *}
 | 
| 15563 | 248 | |
| 15588 
14e3228f18cc
arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 249 | text {* further useful classes for HOLCF domains *}
 | 
| 
14e3228f18cc
arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 250 | |
| 31071 | 251 | class chfin = po + | 
| 252 | assumes chfin: "chain Y \<Longrightarrow> \<exists>n. max_in_chain n Y" | |
| 253 | begin | |
| 25814 | 254 | |
| 31071 | 255 | subclass cpo | 
| 256 | apply default | |
| 257 | apply (frule chfin) | |
| 258 | apply (blast intro: lub_finch1) | |
| 259 | done | |
| 15563 | 260 | |
| 31071 | 261 | lemma chfin2finch: "chain Y \<Longrightarrow> finite_chain Y" | 
| 262 | by (simp add: chfin finite_chain_def) | |
| 263 | ||
| 264 | end | |
| 15588 
14e3228f18cc
arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 265 | |
| 31071 | 266 | class finite_po = finite + po | 
| 267 | begin | |
| 25814 | 268 | |
| 31071 | 269 | subclass chfin | 
| 270 | apply default | |
| 25814 | 271 | apply (drule finite_range_imp_finch) | 
| 272 | apply (rule finite) | |
| 273 | apply (simp add: finite_chain_def) | |
| 274 | done | |
| 275 | ||
| 31071 | 276 | end | 
| 15640 
2d1d6ea579a1
chfin now a subclass of po, proved instance chfin < cpo
 huffman parents: 
15588diff
changeset | 277 | |
| 31071 | 278 | class flat = pcpo + | 
| 279 | assumes ax_flat: "x \<sqsubseteq> y \<Longrightarrow> x = \<bottom> \<or> x = y" | |
| 280 | begin | |
| 15640 
2d1d6ea579a1
chfin now a subclass of po, proved instance chfin < cpo
 huffman parents: 
15588diff
changeset | 281 | |
| 31071 | 282 | subclass chfin | 
| 283 | apply default | |
| 15563 | 284 | apply (unfold max_in_chain_def) | 
| 16626 | 285 | apply (case_tac "\<forall>i. Y i = \<bottom>") | 
| 15588 
14e3228f18cc
arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 286 | apply simp | 
| 15563 | 287 | apply simp | 
| 288 | apply (erule exE) | |
| 16626 | 289 | apply (rule_tac x="i" in exI) | 
| 15588 
14e3228f18cc
arranged for document generation, cleaned up some proofs
 huffman parents: 
15577diff
changeset | 290 | apply clarify | 
| 25922 
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
 huffman parents: 
25921diff
changeset | 291 | apply (blast dest: chain_mono ax_flat) | 
| 15563 | 292 | done | 
| 293 | ||
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
31071diff
changeset | 294 | lemma flat_below_iff: | 
| 25826 | 295 | shows "(x \<sqsubseteq> y) = (x = \<bottom> \<or> x = y)" | 
| 31071 | 296 | by (safe dest!: ax_flat) | 
| 25826 | 297 | |
| 31071 | 298 | lemma flat_eq: "a \<noteq> \<bottom> \<Longrightarrow> a \<sqsubseteq> b = (a = b)" | 
| 299 | by (safe dest!: ax_flat) | |
| 15563 | 300 | |
| 31071 | 301 | end | 
| 15563 | 302 | |
| 26023 | 303 | text {* Discrete cpos *}
 | 
| 304 | ||
| 31076 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 huffman parents: 
31071diff
changeset | 305 | class discrete_cpo = below + | 
| 29614 
1f7b1b0df292
simplified handling of base sort, dropped axclass
 haftmann parents: 
29138diff
changeset | 306 | assumes discrete_cpo [simp]: "x \<sqsubseteq> y \<longleftrightarrow> x = y" | 
| 31071 | 307 | begin | 
| 26023 | 308 | |
| 31071 | 309 | subclass po | 
| 29614 
1f7b1b0df292
simplified handling of base sort, dropped axclass
 haftmann parents: 
29138diff
changeset | 310 | proof qed simp_all | 
| 26023 | 311 | |
| 312 | text {* In a discrete cpo, every chain is constant *}
 | |
| 313 | ||
| 314 | lemma discrete_chain_const: | |
| 31071 | 315 | assumes S: "chain S" | 
| 26023 | 316 | shows "\<exists>x. S = (\<lambda>i. x)" | 
| 317 | proof (intro exI ext) | |
| 318 | fix i :: nat | |
| 319 | have "S 0 \<sqsubseteq> S i" using S le0 by (rule chain_mono) | |
| 320 | hence "S 0 = S i" by simp | |
| 321 | thus "S i = S 0" by (rule sym) | |
| 322 | qed | |
| 323 | ||
| 31071 | 324 | subclass cpo | 
| 26023 | 325 | proof | 
| 326 | fix S :: "nat \<Rightarrow> 'a" | |
| 327 | assume S: "chain S" | |
| 328 | hence "\<exists>x. S = (\<lambda>i. x)" | |
| 329 | by (rule discrete_chain_const) | |
| 330 | thus "\<exists>x. range S <<| x" | |
| 331 | by (fast intro: lub_const) | |
| 332 | qed | |
| 333 | ||
| 31071 | 334 | end | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: 
15563diff
changeset | 335 | |
| 16626 | 336 | end |