| author | wenzelm | 
| Thu, 27 Mar 2008 15:32:19 +0100 | |
| changeset 26436 | dfd6947ab5c2 | 
| parent 26420 | 57a626f64875 | 
| child 27268 | 1d8c6703c7b1 | 
| permissions | -rw-r--r-- | 
| 15600 | 1 | (* Title: HOLCF/Porder.thy | 
| 243 
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
 nipkow parents: diff
changeset | 2 | ID: $Id$ | 
| 25773 | 3 | Author: Franz Regensburger and Brian Huffman | 
| 243 
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
 nipkow parents: diff
changeset | 4 | *) | 
| 
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
 nipkow parents: diff
changeset | 5 | |
| 15587 
f363e6e080e7
added subsections and text for document generation
 huffman parents: 
15577diff
changeset | 6 | header {* Partial orders *}
 | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: 
15562diff
changeset | 7 | |
| 15577 | 8 | theory Porder | 
| 24728 | 9 | imports Datatype Finite_Set | 
| 15577 | 10 | begin | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: 
15562diff
changeset | 11 | |
| 15587 
f363e6e080e7
added subsections and text for document generation
 huffman parents: 
15577diff
changeset | 12 | subsection {* Type class for partial orders *}
 | 
| 
f363e6e080e7
added subsections and text for document generation
 huffman parents: 
15577diff
changeset | 13 | |
| 23284 
07ae93e58fea
use new-style class for sq_ord; rename op << to sq_le
 huffman parents: 
21524diff
changeset | 14 | class sq_ord = type + | 
| 
07ae93e58fea
use new-style class for sq_ord; rename op << to sq_le
 huffman parents: 
21524diff
changeset | 15 | fixes sq_le :: "'a \<Rightarrow> 'a \<Rightarrow> bool" | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: 
15562diff
changeset | 16 | |
| 23284 
07ae93e58fea
use new-style class for sq_ord; rename op << to sq_le
 huffman parents: 
21524diff
changeset | 17 | notation | 
| 
07ae93e58fea
use new-style class for sq_ord; rename op << to sq_le
 huffman parents: 
21524diff
changeset | 18 | sq_le (infixl "<<" 55) | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: 
15562diff
changeset | 19 | |
| 23284 
07ae93e58fea
use new-style class for sq_ord; rename op << to sq_le
 huffman parents: 
21524diff
changeset | 20 | notation (xsymbols) | 
| 
07ae93e58fea
use new-style class for sq_ord; rename op << to sq_le
 huffman parents: 
21524diff
changeset | 21 | sq_le (infixl "\<sqsubseteq>" 55) | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: 
15562diff
changeset | 22 | |
| 26420 
57a626f64875
make preorder locale into a superclass of class po
 huffman parents: 
25922diff
changeset | 23 | class preorder = sq_ord + | 
| 25897 | 24 | assumes refl_less [iff]: "x \<sqsubseteq> x" | 
| 26420 
57a626f64875
make preorder locale into a superclass of class po
 huffman parents: 
25922diff
changeset | 25 | assumes trans_less: "\<lbrakk>x \<sqsubseteq> y; y \<sqsubseteq> z\<rbrakk> \<Longrightarrow> x \<sqsubseteq> z" | 
| 
57a626f64875
make preorder locale into a superclass of class po
 huffman parents: 
25922diff
changeset | 26 | |
| 
57a626f64875
make preorder locale into a superclass of class po
 huffman parents: 
25922diff
changeset | 27 | class po = preorder + | 
| 25897 | 28 | assumes antisym_less: "\<lbrakk>x \<sqsubseteq> y; y \<sqsubseteq> x\<rbrakk> \<Longrightarrow> x = y" | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: 
15562diff
changeset | 29 | |
| 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: 
15562diff
changeset | 30 | text {* minimal fixes least element *}
 | 
| 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: 
15562diff
changeset | 31 | |
| 17810 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 32 | lemma minimal2UU[OF allI] : "\<forall>x::'a::po. uu \<sqsubseteq> x \<Longrightarrow> uu = (THE u. \<forall>y. u \<sqsubseteq> y)" | 
| 15930 
145651bc64a8
Replaced all unnecessary uses of SOME with THE or LEAST
 huffman parents: 
15600diff
changeset | 33 | by (blast intro: theI2 antisym_less) | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: 
15562diff
changeset | 34 | |
| 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: 
15562diff
changeset | 35 | text {* the reverse law of anti-symmetry of @{term "op <<"} *}
 | 
| 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: 
15562diff
changeset | 36 | |
| 17810 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 37 | lemma antisym_less_inverse: "(x::'a::po) = y \<Longrightarrow> x \<sqsubseteq> y \<and> y \<sqsubseteq> x" | 
| 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 38 | by simp | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: 
15562diff
changeset | 39 | |
| 17810 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 40 | lemma box_less: "\<lbrakk>(a::'a::po) \<sqsubseteq> b; c \<sqsubseteq> a; b \<sqsubseteq> d\<rbrakk> \<Longrightarrow> c \<sqsubseteq> d" | 
| 18088 | 41 | by (rule trans_less [OF trans_less]) | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: 
15562diff
changeset | 42 | |
| 17810 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 43 | lemma po_eq_conv: "((x::'a::po) = y) = (x \<sqsubseteq> y \<and> y \<sqsubseteq> x)" | 
| 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 44 | by (fast elim!: antisym_less_inverse intro!: antisym_less) | 
| 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 45 | |
| 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 46 | lemma rev_trans_less: "\<lbrakk>(y::'a::po) \<sqsubseteq> z; x \<sqsubseteq> y\<rbrakk> \<Longrightarrow> x \<sqsubseteq> z" | 
| 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 47 | by (rule trans_less) | 
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: 
15562diff
changeset | 48 | |
| 18647 | 49 | lemma sq_ord_less_eq_trans: "\<lbrakk>a \<sqsubseteq> b; b = c\<rbrakk> \<Longrightarrow> a \<sqsubseteq> c" | 
| 50 | by (rule subst) | |
| 51 | ||
| 52 | lemma sq_ord_eq_less_trans: "\<lbrakk>a = b; b \<sqsubseteq> c\<rbrakk> \<Longrightarrow> a \<sqsubseteq> c" | |
| 53 | by (rule ssubst) | |
| 54 | ||
| 55 | lemmas HOLCF_trans_rules [trans] = | |
| 56 | trans_less | |
| 57 | antisym_less | |
| 58 | sq_ord_less_eq_trans | |
| 59 | sq_ord_eq_less_trans | |
| 60 | ||
| 25777 | 61 | subsection {* Upper bounds *}
 | 
| 18071 
940c2c0ff33a
cleaned up; chain_const and thelub_const are simp rules
 huffman parents: 
17810diff
changeset | 62 | |
| 25131 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 wenzelm parents: 
24728diff
changeset | 63 | definition | 
| 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 wenzelm parents: 
24728diff
changeset | 64 | is_ub :: "['a set, 'a::po] \<Rightarrow> bool" (infixl "<|" 55) where | 
| 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 wenzelm parents: 
24728diff
changeset | 65 | "(S <| x) = (\<forall>y. y \<in> S \<longrightarrow> y \<sqsubseteq> x)" | 
| 18071 
940c2c0ff33a
cleaned up; chain_const and thelub_const are simp rules
 huffman parents: 
17810diff
changeset | 66 | |
| 25777 | 67 | lemma is_ubI: "(\<And>x. x \<in> S \<Longrightarrow> x \<sqsubseteq> u) \<Longrightarrow> S <| u" | 
| 68 | by (simp add: is_ub_def) | |
| 69 | ||
| 70 | lemma is_ubD: "\<lbrakk>S <| u; x \<in> S\<rbrakk> \<Longrightarrow> x \<sqsubseteq> u" | |
| 71 | by (simp add: is_ub_def) | |
| 72 | ||
| 73 | lemma ub_imageI: "(\<And>x. x \<in> S \<Longrightarrow> f x \<sqsubseteq> u) \<Longrightarrow> (\<lambda>x. f x) ` S <| u" | |
| 74 | unfolding is_ub_def by fast | |
| 75 | ||
| 76 | lemma ub_imageD: "\<lbrakk>f ` S <| u; x \<in> S\<rbrakk> \<Longrightarrow> f x \<sqsubseteq> u" | |
| 77 | unfolding is_ub_def by fast | |
| 78 | ||
| 79 | lemma ub_rangeI: "(\<And>i. S i \<sqsubseteq> x) \<Longrightarrow> range S <| x" | |
| 80 | unfolding is_ub_def by fast | |
| 81 | ||
| 82 | lemma ub_rangeD: "range S <| x \<Longrightarrow> S i \<sqsubseteq> x" | |
| 83 | unfolding is_ub_def by fast | |
| 84 | ||
| 25828 
228c53fdb3b4
add new is_ub lemmas; clean up directed_finite proofs
 huffman parents: 
25813diff
changeset | 85 | lemma is_ub_empty [simp]: "{} <| u"
 | 
| 
228c53fdb3b4
add new is_ub lemmas; clean up directed_finite proofs
 huffman parents: 
25813diff
changeset | 86 | unfolding is_ub_def by fast | 
| 
228c53fdb3b4
add new is_ub lemmas; clean up directed_finite proofs
 huffman parents: 
25813diff
changeset | 87 | |
| 
228c53fdb3b4
add new is_ub lemmas; clean up directed_finite proofs
 huffman parents: 
25813diff
changeset | 88 | lemma is_ub_insert [simp]: "(insert x A) <| y = (x \<sqsubseteq> y \<and> A <| y)" | 
| 
228c53fdb3b4
add new is_ub lemmas; clean up directed_finite proofs
 huffman parents: 
25813diff
changeset | 89 | unfolding is_ub_def by fast | 
| 
228c53fdb3b4
add new is_ub lemmas; clean up directed_finite proofs
 huffman parents: 
25813diff
changeset | 90 | |
| 
228c53fdb3b4
add new is_ub lemmas; clean up directed_finite proofs
 huffman parents: 
25813diff
changeset | 91 | lemma is_ub_upward: "\<lbrakk>S <| x; x \<sqsubseteq> y\<rbrakk> \<Longrightarrow> S <| y" | 
| 
228c53fdb3b4
add new is_ub lemmas; clean up directed_finite proofs
 huffman parents: 
25813diff
changeset | 92 | unfolding is_ub_def by (fast intro: trans_less) | 
| 
228c53fdb3b4
add new is_ub lemmas; clean up directed_finite proofs
 huffman parents: 
25813diff
changeset | 93 | |
| 25777 | 94 | subsection {* Least upper bounds *}
 | 
| 95 | ||
| 25131 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 wenzelm parents: 
24728diff
changeset | 96 | definition | 
| 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 wenzelm parents: 
24728diff
changeset | 97 | is_lub :: "['a set, 'a::po] \<Rightarrow> bool" (infixl "<<|" 55) where | 
| 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 wenzelm parents: 
24728diff
changeset | 98 | "(S <<| x) = (S <| x \<and> (\<forall>u. S <| u \<longrightarrow> x \<sqsubseteq> u))" | 
| 18071 
940c2c0ff33a
cleaned up; chain_const and thelub_const are simp rules
 huffman parents: 
17810diff
changeset | 99 | |
| 25131 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 wenzelm parents: 
24728diff
changeset | 100 | definition | 
| 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 wenzelm parents: 
24728diff
changeset | 101 | lub :: "'a set \<Rightarrow> 'a::po" where | 
| 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 wenzelm parents: 
24728diff
changeset | 102 | "lub S = (THE x. S <<| x)" | 
| 243 
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
 nipkow parents: diff
changeset | 103 | |
| 25777 | 104 | syntax | 
| 105 |   "_BLub" :: "[pttrn, 'a set, 'b] \<Rightarrow> 'b" ("(3LUB _:_./ _)" [0,0, 10] 10)
 | |
| 106 | ||
| 107 | syntax (xsymbols) | |
| 108 |   "_BLub" :: "[pttrn, 'a set, 'b] \<Rightarrow> 'b" ("(3\<Squnion>_\<in>_./ _)" [0,0, 10] 10)
 | |
| 109 | ||
| 110 | translations | |
| 111 | "LUB x:A. t" == "CONST lub ((%x. t) ` A)" | |
| 112 | ||
| 21524 | 113 | abbreviation | 
| 114 | Lub (binder "LUB " 10) where | |
| 115 | "LUB n. t n == lub (range t)" | |
| 2394 | 116 | |
| 21524 | 117 | notation (xsymbols) | 
| 118 | Lub (binder "\<Squnion> " 10) | |
| 243 
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
 nipkow parents: diff
changeset | 119 | |
| 25813 | 120 | text {* access to some definition as inference rule *}
 | 
| 121 | ||
| 122 | lemma is_lubD1: "S <<| x \<Longrightarrow> S <| x" | |
| 123 | unfolding is_lub_def by fast | |
| 124 | ||
| 125 | lemma is_lub_lub: "\<lbrakk>S <<| x; S <| u\<rbrakk> \<Longrightarrow> x \<sqsubseteq> u" | |
| 126 | unfolding is_lub_def by fast | |
| 127 | ||
| 128 | lemma is_lubI: "\<lbrakk>S <| x; \<And>u. S <| u \<Longrightarrow> x \<sqsubseteq> u\<rbrakk> \<Longrightarrow> S <<| x" | |
| 129 | unfolding is_lub_def by fast | |
| 130 | ||
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: 
15562diff
changeset | 131 | text {* lubs are unique *}
 | 
| 15562 | 132 | |
| 17810 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 133 | lemma unique_lub: "\<lbrakk>S <<| x; S <<| y\<rbrakk> \<Longrightarrow> x = y" | 
| 15562 | 134 | apply (unfold is_lub_def is_ub_def) | 
| 135 | apply (blast intro: antisym_less) | |
| 136 | done | |
| 137 | ||
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: 
15562diff
changeset | 138 | text {* technical lemmas about @{term lub} and @{term is_lub} *}
 | 
| 15562 | 139 | |
| 17810 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 140 | lemma lubI: "M <<| x \<Longrightarrow> M <<| lub M" | 
| 15930 
145651bc64a8
Replaced all unnecessary uses of SOME with THE or LEAST
 huffman parents: 
15600diff
changeset | 141 | apply (unfold lub_def) | 
| 17810 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 142 | apply (rule theI) | 
| 15930 
145651bc64a8
Replaced all unnecessary uses of SOME with THE or LEAST
 huffman parents: 
15600diff
changeset | 143 | apply assumption | 
| 17810 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 144 | apply (erule (1) unique_lub) | 
| 15562 | 145 | done | 
| 146 | ||
| 17810 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 147 | lemma thelubI: "M <<| l \<Longrightarrow> lub M = l" | 
| 18088 | 148 | by (rule unique_lub [OF lubI]) | 
| 15562 | 149 | |
| 25780 | 150 | lemma is_lub_singleton: "{x} <<| x"
 | 
| 25834 | 151 | by (simp add: is_lub_def) | 
| 25780 | 152 | |
| 17810 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 153 | lemma lub_singleton [simp]: "lub {x} = x"
 | 
| 25780 | 154 | by (rule thelubI [OF is_lub_singleton]) | 
| 155 | ||
| 156 | lemma is_lub_bin: "x \<sqsubseteq> y \<Longrightarrow> {x, y} <<| y"
 | |
| 25834 | 157 | by (simp add: is_lub_def) | 
| 25780 | 158 | |
| 159 | lemma lub_bin: "x \<sqsubseteq> y \<Longrightarrow> lub {x, y} = y"
 | |
| 160 | by (rule is_lub_bin [THEN thelubI]) | |
| 15562 | 161 | |
| 25813 | 162 | lemma is_lub_maximal: "\<lbrakk>S <| x; x \<in> S\<rbrakk> \<Longrightarrow> S <<| x" | 
| 163 | by (erule is_lubI, erule (1) is_ubD) | |
| 15562 | 164 | |
| 25813 | 165 | lemma lub_maximal: "\<lbrakk>S <| x; x \<in> S\<rbrakk> \<Longrightarrow> lub S = x" | 
| 166 | by (rule is_lub_maximal [THEN thelubI]) | |
| 243 
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
 nipkow parents: diff
changeset | 167 | |
| 25695 | 168 | subsection {* Countable chains *}
 | 
| 169 | ||
| 170 | definition | |
| 171 |   -- {* Here we use countable chains and I prefer to code them as functions! *}
 | |
| 172 | chain :: "(nat \<Rightarrow> 'a::po) \<Rightarrow> bool" where | |
| 25922 
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
 huffman parents: 
25897diff
changeset | 173 | "chain Y = (\<forall>i. Y i \<sqsubseteq> Y (Suc i))" | 
| 
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
 huffman parents: 
25897diff
changeset | 174 | |
| 
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
 huffman parents: 
25897diff
changeset | 175 | lemma chainI: "(\<And>i. Y i \<sqsubseteq> Y (Suc i)) \<Longrightarrow> chain Y" | 
| 
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
 huffman parents: 
25897diff
changeset | 176 | unfolding chain_def by fast | 
| 
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
 huffman parents: 
25897diff
changeset | 177 | |
| 
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
 huffman parents: 
25897diff
changeset | 178 | lemma chainE: "chain Y \<Longrightarrow> Y i \<sqsubseteq> Y (Suc i)" | 
| 
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
 huffman parents: 
25897diff
changeset | 179 | unfolding chain_def by fast | 
| 25695 | 180 | |
| 181 | text {* chains are monotone functions *}
 | |
| 182 | ||
| 25922 
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
 huffman parents: 
25897diff
changeset | 183 | lemma chain_mono: | 
| 
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
 huffman parents: 
25897diff
changeset | 184 | assumes Y: "chain Y" | 
| 
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
 huffman parents: 
25897diff
changeset | 185 | shows "i \<le> j \<Longrightarrow> Y i \<sqsubseteq> Y j" | 
| 
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
 huffman parents: 
25897diff
changeset | 186 | apply (induct j) | 
| 25695 | 187 | apply simp | 
| 25922 
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
 huffman parents: 
25897diff
changeset | 188 | apply (erule le_SucE) | 
| 
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
 huffman parents: 
25897diff
changeset | 189 | apply (rule trans_less [OF _ chainE [OF Y]]) | 
| 
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
 huffman parents: 
25897diff
changeset | 190 | apply simp | 
| 
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
 huffman parents: 
25897diff
changeset | 191 | apply simp | 
| 25695 | 192 | done | 
| 193 | ||
| 25922 
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
 huffman parents: 
25897diff
changeset | 194 | lemma chain_mono_less: "\<lbrakk>chain Y; i < j\<rbrakk> \<Longrightarrow> Y i \<sqsubseteq> Y j" | 
| 
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
 huffman parents: 
25897diff
changeset | 195 | by (erule chain_mono, simp) | 
| 15562 | 196 | |
| 17810 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 197 | lemma chain_shift: "chain Y \<Longrightarrow> chain (\<lambda>i. Y (i + j))" | 
| 15562 | 198 | apply (rule chainI) | 
| 16318 
45b12a01382f
added theorems is_ub_range_shift and is_lub_range_shift
 huffman parents: 
16092diff
changeset | 199 | apply simp | 
| 15562 | 200 | apply (erule chainE) | 
| 201 | done | |
| 202 | ||
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: 
15562diff
changeset | 203 | text {* technical lemmas about (least) upper bounds of chains *}
 | 
| 15562 | 204 | |
| 17810 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 205 | lemma is_ub_lub: "range S <<| x \<Longrightarrow> S i \<sqsubseteq> x" | 
| 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 206 | by (rule is_lubD1 [THEN ub_rangeD]) | 
| 15562 | 207 | |
| 16318 
45b12a01382f
added theorems is_ub_range_shift and is_lub_range_shift
 huffman parents: 
16092diff
changeset | 208 | lemma is_ub_range_shift: | 
| 
45b12a01382f
added theorems is_ub_range_shift and is_lub_range_shift
 huffman parents: 
16092diff
changeset | 209 | "chain S \<Longrightarrow> range (\<lambda>i. S (i + j)) <| x = range S <| x" | 
| 
45b12a01382f
added theorems is_ub_range_shift and is_lub_range_shift
 huffman parents: 
16092diff
changeset | 210 | apply (rule iffI) | 
| 
45b12a01382f
added theorems is_ub_range_shift and is_lub_range_shift
 huffman parents: 
16092diff
changeset | 211 | apply (rule ub_rangeI) | 
| 
45b12a01382f
added theorems is_ub_range_shift and is_lub_range_shift
 huffman parents: 
16092diff
changeset | 212 | apply (rule_tac y="S (i + j)" in trans_less) | 
| 25922 
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
 huffman parents: 
25897diff
changeset | 213 | apply (erule chain_mono) | 
| 16318 
45b12a01382f
added theorems is_ub_range_shift and is_lub_range_shift
 huffman parents: 
16092diff
changeset | 214 | apply (rule le_add1) | 
| 
45b12a01382f
added theorems is_ub_range_shift and is_lub_range_shift
 huffman parents: 
16092diff
changeset | 215 | apply (erule ub_rangeD) | 
| 
45b12a01382f
added theorems is_ub_range_shift and is_lub_range_shift
 huffman parents: 
16092diff
changeset | 216 | apply (rule ub_rangeI) | 
| 
45b12a01382f
added theorems is_ub_range_shift and is_lub_range_shift
 huffman parents: 
16092diff
changeset | 217 | apply (erule ub_rangeD) | 
| 
45b12a01382f
added theorems is_ub_range_shift and is_lub_range_shift
 huffman parents: 
16092diff
changeset | 218 | done | 
| 
45b12a01382f
added theorems is_ub_range_shift and is_lub_range_shift
 huffman parents: 
16092diff
changeset | 219 | |
| 
45b12a01382f
added theorems is_ub_range_shift and is_lub_range_shift
 huffman parents: 
16092diff
changeset | 220 | lemma is_lub_range_shift: | 
| 
45b12a01382f
added theorems is_ub_range_shift and is_lub_range_shift
 huffman parents: 
16092diff
changeset | 221 | "chain S \<Longrightarrow> range (\<lambda>i. S (i + j)) <<| x = range S <<| x" | 
| 
45b12a01382f
added theorems is_ub_range_shift and is_lub_range_shift
 huffman parents: 
16092diff
changeset | 222 | by (simp add: is_lub_def is_ub_range_shift) | 
| 
45b12a01382f
added theorems is_ub_range_shift and is_lub_range_shift
 huffman parents: 
16092diff
changeset | 223 | |
| 25695 | 224 | text {* the lub of a constant chain is the constant *}
 | 
| 225 | ||
| 226 | lemma chain_const [simp]: "chain (\<lambda>i. c)" | |
| 227 | by (simp add: chainI) | |
| 228 | ||
| 229 | lemma lub_const: "range (\<lambda>x. c) <<| c" | |
| 230 | by (blast dest: ub_rangeD intro: is_lubI ub_rangeI) | |
| 231 | ||
| 232 | lemma thelub_const [simp]: "(\<Squnion>i. c) = c" | |
| 233 | by (rule lub_const [THEN thelubI]) | |
| 234 | ||
| 235 | subsection {* Totally ordered sets *}
 | |
| 236 | ||
| 237 | definition | |
| 238 |   -- {* Arbitrary chains are total orders *}
 | |
| 239 | tord :: "'a::po set \<Rightarrow> bool" where | |
| 240 | "tord S = (\<forall>x y. x \<in> S \<and> y \<in> S \<longrightarrow> (x \<sqsubseteq> y \<or> y \<sqsubseteq> x))" | |
| 241 | ||
| 242 | text {* The range of a chain is a totally ordered *}
 | |
| 243 | ||
| 25922 
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
 huffman parents: 
25897diff
changeset | 244 | lemma chain_tord: "chain Y \<Longrightarrow> tord (range Y)" | 
| 
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
 huffman parents: 
25897diff
changeset | 245 | unfolding tord_def | 
| 
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
 huffman parents: 
25897diff
changeset | 246 | apply (clarify, rename_tac i j) | 
| 
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
 huffman parents: 
25897diff
changeset | 247 | apply (rule_tac x=i and y=j in linorder_le_cases) | 
| 25695 | 248 | apply (fast intro: chain_mono)+ | 
| 249 | done | |
| 250 | ||
| 25922 
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
 huffman parents: 
25897diff
changeset | 251 | lemma finite_tord_has_max: | 
| 
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
 huffman parents: 
25897diff
changeset | 252 |   "\<lbrakk>finite S; S \<noteq> {}; tord S\<rbrakk> \<Longrightarrow> \<exists>y\<in>S. \<forall>x\<in>S. x \<sqsubseteq> y"
 | 
| 
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
 huffman parents: 
25897diff
changeset | 253 | apply (induct S rule: finite_ne_induct) | 
| 
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
 huffman parents: 
25897diff
changeset | 254 | apply simp | 
| 
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
 huffman parents: 
25897diff
changeset | 255 | apply (drule meta_mp, simp add: tord_def) | 
| 25695 | 256 | apply (erule bexE, rename_tac z) | 
| 25922 
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
 huffman parents: 
25897diff
changeset | 257 | apply (subgoal_tac "x \<sqsubseteq> z \<or> z \<sqsubseteq> x") | 
| 25695 | 258 | apply (erule disjE) | 
| 259 | apply (rule_tac x="z" in bexI, simp, simp) | |
| 25922 
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
 huffman parents: 
25897diff
changeset | 260 | apply (rule_tac x="x" in bexI) | 
| 25695 | 261 | apply (clarsimp elim!: rev_trans_less) | 
| 262 | apply simp | |
| 263 | apply (simp add: tord_def) | |
| 264 | done | |
| 265 | ||
| 266 | subsection {* Finite chains *}
 | |
| 267 | ||
| 268 | definition | |
| 269 |   -- {* finite chains, needed for monotony of continuous functions *}
 | |
| 270 | max_in_chain :: "[nat, nat \<Rightarrow> 'a::po] \<Rightarrow> bool" where | |
| 271 | "max_in_chain i C = (\<forall>j. i \<le> j \<longrightarrow> C i = C j)" | |
| 272 | ||
| 273 | definition | |
| 274 | finite_chain :: "(nat \<Rightarrow> 'a::po) \<Rightarrow> bool" where | |
| 275 | "finite_chain C = (chain C \<and> (\<exists>i. max_in_chain i C))" | |
| 276 | ||
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: 
15562diff
changeset | 277 | text {* results about finite chains *}
 | 
| 15562 | 278 | |
| 25878 | 279 | lemma max_in_chainI: "(\<And>j. i \<le> j \<Longrightarrow> Y i = Y j) \<Longrightarrow> max_in_chain i Y" | 
| 280 | unfolding max_in_chain_def by fast | |
| 281 | ||
| 282 | lemma max_in_chainD: "\<lbrakk>max_in_chain i Y; i \<le> j\<rbrakk> \<Longrightarrow> Y i = Y j" | |
| 283 | unfolding max_in_chain_def by fast | |
| 284 | ||
| 17810 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 285 | lemma lub_finch1: "\<lbrakk>chain C; max_in_chain i C\<rbrakk> \<Longrightarrow> range C <<| C i" | 
| 15562 | 286 | apply (rule is_lubI) | 
| 17810 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 287 | apply (rule ub_rangeI, rename_tac j) | 
| 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 288 | apply (rule_tac x=i and y=j in linorder_le_cases) | 
| 25878 | 289 | apply (drule (1) max_in_chainD, simp) | 
| 25922 
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
 huffman parents: 
25897diff
changeset | 290 | apply (erule (1) chain_mono) | 
| 15562 | 291 | apply (erule ub_rangeD) | 
| 292 | done | |
| 293 | ||
| 25131 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 wenzelm parents: 
24728diff
changeset | 294 | lemma lub_finch2: | 
| 17810 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 295 | "finite_chain C \<Longrightarrow> range C <<| C (LEAST i. max_in_chain i C)" | 
| 15562 | 296 | apply (unfold finite_chain_def) | 
| 17810 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 297 | apply (erule conjE) | 
| 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 298 | apply (erule LeastI2_ex) | 
| 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 299 | apply (erule (1) lub_finch1) | 
| 15562 | 300 | done | 
| 301 | ||
| 19621 | 302 | lemma finch_imp_finite_range: "finite_chain Y \<Longrightarrow> finite (range Y)" | 
| 303 | apply (unfold finite_chain_def, clarify) | |
| 304 | apply (rule_tac f="Y" and n="Suc i" in nat_seg_image_imp_finite) | |
| 305 | apply (rule equalityI) | |
| 306 | apply (rule subsetI) | |
| 307 | apply (erule rangeE, rename_tac j) | |
| 308 | apply (rule_tac x=i and y=j in linorder_le_cases) | |
| 309 | apply (subgoal_tac "Y j = Y i", simp) | |
| 310 | apply (simp add: max_in_chain_def) | |
| 311 | apply simp | |
| 312 | apply fast | |
| 313 | done | |
| 314 | ||
| 315 | lemma finite_range_imp_finch: | |
| 316 | "\<lbrakk>chain Y; finite (range Y)\<rbrakk> \<Longrightarrow> finite_chain Y" | |
| 317 | apply (subgoal_tac "\<exists>y\<in>range Y. \<forall>x\<in>range Y. x \<sqsubseteq> y") | |
| 318 | apply (clarsimp, rename_tac i) | |
| 319 | apply (subgoal_tac "max_in_chain i Y") | |
| 320 | apply (simp add: finite_chain_def exI) | |
| 25922 
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
 huffman parents: 
25897diff
changeset | 321 | apply (simp add: max_in_chain_def po_eq_conv chain_mono) | 
| 19621 | 322 | apply (erule finite_tord_has_max, simp) | 
| 323 | apply (erule chain_tord) | |
| 324 | done | |
| 325 | ||
| 17810 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 326 | lemma bin_chain: "x \<sqsubseteq> y \<Longrightarrow> chain (\<lambda>i. if i=0 then x else y)" | 
| 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 327 | by (rule chainI, simp) | 
| 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 328 | |
| 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 329 | lemma bin_chainmax: | 
| 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 330 | "x \<sqsubseteq> y \<Longrightarrow> max_in_chain (Suc 0) (\<lambda>i. if i=0 then x else y)" | 
| 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 331 | by (unfold max_in_chain_def, simp) | 
| 15562 | 332 | |
| 17810 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 333 | lemma lub_bin_chain: | 
| 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 334 | "x \<sqsubseteq> y \<Longrightarrow> range (\<lambda>i::nat. if i=0 then x else y) <<| y" | 
| 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 335 | apply (frule bin_chain) | 
| 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 336 | apply (drule bin_chainmax) | 
| 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 337 | apply (drule (1) lub_finch1) | 
| 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 338 | apply simp | 
| 15562 | 339 | done | 
| 340 | ||
| 15576 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 huffman parents: 
15562diff
changeset | 341 | text {* the maximal element in a chain is its lub *}
 | 
| 15562 | 342 | |
| 17810 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 343 | lemma lub_chain_maxelem: "\<lbrakk>Y i = c; \<forall>i. Y i \<sqsubseteq> c\<rbrakk> \<Longrightarrow> lub (range Y) = c" | 
| 
3bdf516d93d8
cleaned up; renamed "Porder.op <<" to "Porder.<<"
 huffman parents: 
17372diff
changeset | 344 | by (blast dest: ub_rangeD intro: thelubI is_lubI ub_rangeI) | 
| 15562 | 345 | |
| 25773 | 346 | subsection {* Directed sets *}
 | 
| 347 | ||
| 348 | definition | |
| 349 | directed :: "'a::po set \<Rightarrow> bool" where | |
| 350 | "directed S = ((\<exists>x. x \<in> S) \<and> (\<forall>x\<in>S. \<forall>y\<in>S. \<exists>z\<in>S. x \<sqsubseteq> z \<and> y \<sqsubseteq> z))" | |
| 351 | ||
| 352 | lemma directedI: | |
| 353 | assumes 1: "\<exists>z. z \<in> S" | |
| 354 | assumes 2: "\<And>x y. \<lbrakk>x \<in> S; y \<in> S\<rbrakk> \<Longrightarrow> \<exists>z\<in>S. x \<sqsubseteq> z \<and> y \<sqsubseteq> z" | |
| 355 | shows "directed S" | |
| 356 | unfolding directed_def using prems by fast | |
| 357 | ||
| 358 | lemma directedD1: "directed S \<Longrightarrow> \<exists>z. z \<in> S" | |
| 359 | unfolding directed_def by fast | |
| 360 | ||
| 361 | lemma directedD2: "\<lbrakk>directed S; x \<in> S; y \<in> S\<rbrakk> \<Longrightarrow> \<exists>z\<in>S. x \<sqsubseteq> z \<and> y \<sqsubseteq> z" | |
| 362 | unfolding directed_def by fast | |
| 363 | ||
| 25780 | 364 | lemma directedE1: | 
| 365 | assumes S: "directed S" | |
| 366 | obtains z where "z \<in> S" | |
| 367 | by (insert directedD1 [OF S], fast) | |
| 368 | ||
| 369 | lemma directedE2: | |
| 370 | assumes S: "directed S" | |
| 371 | assumes x: "x \<in> S" and y: "y \<in> S" | |
| 372 | obtains z where "z \<in> S" "x \<sqsubseteq> z" "y \<sqsubseteq> z" | |
| 373 | by (insert directedD2 [OF S x y], fast) | |
| 374 | ||
| 25773 | 375 | lemma directed_finiteI: | 
| 25828 
228c53fdb3b4
add new is_ub lemmas; clean up directed_finite proofs
 huffman parents: 
25813diff
changeset | 376 | assumes U: "\<And>U. \<lbrakk>finite U; U \<subseteq> S\<rbrakk> \<Longrightarrow> \<exists>z\<in>S. U <| z" | 
| 25773 | 377 | shows "directed S" | 
| 378 | proof (rule directedI) | |
| 379 |   have "finite {}" and "{} \<subseteq> S" by simp_all
 | |
| 25828 
228c53fdb3b4
add new is_ub lemmas; clean up directed_finite proofs
 huffman parents: 
25813diff
changeset | 380 |   hence "\<exists>z\<in>S. {} <| z" by (rule U)
 | 
| 25773 | 381 | thus "\<exists>z. z \<in> S" by simp | 
| 382 | next | |
| 383 | fix x y | |
| 384 | assume "x \<in> S" and "y \<in> S" | |
| 385 |   hence "finite {x, y}" and "{x, y} \<subseteq> S" by simp_all
 | |
| 25828 
228c53fdb3b4
add new is_ub lemmas; clean up directed_finite proofs
 huffman parents: 
25813diff
changeset | 386 |   hence "\<exists>z\<in>S. {x, y} <| z" by (rule U)
 | 
| 25773 | 387 | thus "\<exists>z\<in>S. x \<sqsubseteq> z \<and> y \<sqsubseteq> z" by simp | 
| 388 | qed | |
| 389 | ||
| 390 | lemma directed_finiteD: | |
| 391 | assumes S: "directed S" | |
| 25828 
228c53fdb3b4
add new is_ub lemmas; clean up directed_finite proofs
 huffman parents: 
25813diff
changeset | 392 | shows "\<lbrakk>finite U; U \<subseteq> S\<rbrakk> \<Longrightarrow> \<exists>z\<in>S. U <| z" | 
| 
228c53fdb3b4
add new is_ub lemmas; clean up directed_finite proofs
 huffman parents: 
25813diff
changeset | 393 | proof (induct U set: finite) | 
| 
228c53fdb3b4
add new is_ub lemmas; clean up directed_finite proofs
 huffman parents: 
25813diff
changeset | 394 | case empty | 
| 
228c53fdb3b4
add new is_ub lemmas; clean up directed_finite proofs
 huffman parents: 
25813diff
changeset | 395 | from S have "\<exists>z. z \<in> S" by (rule directedD1) | 
| 
228c53fdb3b4
add new is_ub lemmas; clean up directed_finite proofs
 huffman parents: 
25813diff
changeset | 396 |   thus "\<exists>z\<in>S. {} <| z" by simp
 | 
| 
228c53fdb3b4
add new is_ub lemmas; clean up directed_finite proofs
 huffman parents: 
25813diff
changeset | 397 | next | 
| 
228c53fdb3b4
add new is_ub lemmas; clean up directed_finite proofs
 huffman parents: 
25813diff
changeset | 398 | case (insert x F) | 
| 
228c53fdb3b4
add new is_ub lemmas; clean up directed_finite proofs
 huffman parents: 
25813diff
changeset | 399 | from `insert x F \<subseteq> S` | 
| 
228c53fdb3b4
add new is_ub lemmas; clean up directed_finite proofs
 huffman parents: 
25813diff
changeset | 400 | have xS: "x \<in> S" and FS: "F \<subseteq> S" by simp_all | 
| 
228c53fdb3b4
add new is_ub lemmas; clean up directed_finite proofs
 huffman parents: 
25813diff
changeset | 401 | from FS have "\<exists>y\<in>S. F <| y" by fact | 
| 
228c53fdb3b4
add new is_ub lemmas; clean up directed_finite proofs
 huffman parents: 
25813diff
changeset | 402 | then obtain y where yS: "y \<in> S" and Fy: "F <| y" .. | 
| 
228c53fdb3b4
add new is_ub lemmas; clean up directed_finite proofs
 huffman parents: 
25813diff
changeset | 403 | obtain z where zS: "z \<in> S" and xz: "x \<sqsubseteq> z" and yz: "y \<sqsubseteq> z" | 
| 
228c53fdb3b4
add new is_ub lemmas; clean up directed_finite proofs
 huffman parents: 
25813diff
changeset | 404 | using S xS yS by (rule directedE2) | 
| 
228c53fdb3b4
add new is_ub lemmas; clean up directed_finite proofs
 huffman parents: 
25813diff
changeset | 405 | from Fy yz have "F <| z" by (rule is_ub_upward) | 
| 
228c53fdb3b4
add new is_ub lemmas; clean up directed_finite proofs
 huffman parents: 
25813diff
changeset | 406 | with xz have "insert x F <| z" by simp | 
| 
228c53fdb3b4
add new is_ub lemmas; clean up directed_finite proofs
 huffman parents: 
25813diff
changeset | 407 | with zS show "\<exists>z\<in>S. insert x F <| z" .. | 
| 25773 | 408 | qed | 
| 409 | ||
| 25813 | 410 | lemma not_directed_empty [simp]: "\<not> directed {}"
 | 
| 25773 | 411 | by (rule notI, drule directedD1, simp) | 
| 412 | ||
| 413 | lemma directed_singleton: "directed {x}"
 | |
| 414 | by (rule directedI, auto) | |
| 415 | ||
| 416 | lemma directed_bin: "x \<sqsubseteq> y \<Longrightarrow> directed {x, y}"
 | |
| 417 | by (rule directedI, auto) | |
| 418 | ||
| 419 | lemma directed_chain: "chain S \<Longrightarrow> directed (range S)" | |
| 420 | apply (rule directedI) | |
| 421 | apply (rule_tac x="S 0" in exI, simp) | |
| 422 | apply (clarify, rename_tac m n) | |
| 423 | apply (rule_tac x="S (max m n)" in bexI) | |
| 25922 
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
 huffman parents: 
25897diff
changeset | 424 | apply (simp add: chain_mono) | 
| 25773 | 425 | apply simp | 
| 426 | done | |
| 427 | ||
| 18071 
940c2c0ff33a
cleaned up; chain_const and thelub_const are simp rules
 huffman parents: 
17810diff
changeset | 428 | end |