| author | wenzelm | 
| Thu, 15 May 2008 17:37:18 +0200 | |
| changeset 26898 | 0fffc7bc3604 | 
| parent 22547 | c3290f4382e4 | 
| child 27681 | 8cedebf55539 | 
| permissions | -rw-r--r-- | 
| 13383 | 1 | (* Title: HOL/ex/Tarski.thy | 
| 7112 | 2 | ID: $Id$ | 
| 13383 | 3 | Author: Florian Kammüller, Cambridge University Computer Laboratory | 
| 4 | *) | |
| 7112 | 5 | |
| 13585 | 6 | header {* The Full Theorem of Tarski *}
 | 
| 7112 | 7 | |
| 16417 | 8 | theory Tarski imports Main FuncSet begin | 
| 7112 | 9 | |
| 13383 | 10 | text {*
 | 
| 11 | Minimal version of lattice theory plus the full theorem of Tarski: | |
| 12 | The fixedpoints of a complete lattice themselves form a complete | |
| 13 | lattice. | |
| 14 | ||
| 15 | Illustrates first-class theories, using the Sigma representation of | |
| 16 | structures. Tidied and converted to Isar by lcp. | |
| 17 | *} | |
| 18 | ||
| 19 | record 'a potype = | |
| 7112 | 20 | pset :: "'a set" | 
| 21 |   order :: "('a * 'a) set"
 | |
| 22 | ||
| 19736 | 23 | definition | 
| 21404 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
21232diff
changeset | 24 |   monotone :: "['a => 'a, 'a set, ('a *'a)set] => bool" where
 | 
| 19736 | 25 | "monotone f A r = (\<forall>x\<in>A. \<forall>y\<in>A. (x, y): r --> ((f x), (f y)) : r)" | 
| 7112 | 26 | |
| 21404 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
21232diff
changeset | 27 | definition | 
| 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
21232diff
changeset | 28 | least :: "['a => bool, 'a potype] => 'a" where | 
| 19736 | 29 | "least P po = (SOME x. x: pset po & P x & | 
| 30 | (\<forall>y \<in> pset po. P y --> (x,y): order po))" | |
| 7112 | 31 | |
| 21404 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
21232diff
changeset | 32 | definition | 
| 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
21232diff
changeset | 33 | greatest :: "['a => bool, 'a potype] => 'a" where | 
| 19736 | 34 | "greatest P po = (SOME x. x: pset po & P x & | 
| 35 | (\<forall>y \<in> pset po. P y --> (y,x): order po))" | |
| 7112 | 36 | |
| 21404 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
21232diff
changeset | 37 | definition | 
| 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
21232diff
changeset | 38 | lub :: "['a set, 'a potype] => 'a" where | 
| 19736 | 39 | "lub S po = least (%x. \<forall>y\<in>S. (y,x): order po) po" | 
| 7112 | 40 | |
| 21404 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
21232diff
changeset | 41 | definition | 
| 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
21232diff
changeset | 42 | glb :: "['a set, 'a potype] => 'a" where | 
| 19736 | 43 | "glb S po = greatest (%x. \<forall>y\<in>S. (x,y): order po) po" | 
| 7112 | 44 | |
| 21404 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
21232diff
changeset | 45 | definition | 
| 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
21232diff
changeset | 46 | isLub :: "['a set, 'a potype, 'a] => bool" where | 
| 19736 | 47 | "isLub S po = (%L. (L: pset po & (\<forall>y\<in>S. (y,L): order po) & | 
| 48 | (\<forall>z\<in>pset po. (\<forall>y\<in>S. (y,z): order po) --> (L,z): order po)))" | |
| 7112 | 49 | |
| 21404 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
21232diff
changeset | 50 | definition | 
| 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
21232diff
changeset | 51 | isGlb :: "['a set, 'a potype, 'a] => bool" where | 
| 19736 | 52 | "isGlb S po = (%G. (G: pset po & (\<forall>y\<in>S. (G,y): order po) & | 
| 53 | (\<forall>z \<in> pset po. (\<forall>y\<in>S. (z,y): order po) --> (z,G): order po)))" | |
| 7112 | 54 | |
| 21404 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
21232diff
changeset | 55 | definition | 
| 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
21232diff
changeset | 56 |   "fix"    :: "[('a => 'a), 'a set] => 'a set" where
 | 
| 19736 | 57 |   "fix f A  = {x. x: A & f x = x}"
 | 
| 7112 | 58 | |
| 21404 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
21232diff
changeset | 59 | definition | 
| 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
21232diff
changeset | 60 |   interval :: "[('a*'a) set,'a, 'a ] => 'a set" where
 | 
| 19736 | 61 |   "interval r a b = {x. (a,x): r & (x,b): r}"
 | 
| 7112 | 62 | |
| 63 | ||
| 19736 | 64 | definition | 
| 21404 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
21232diff
changeset | 65 | Bot :: "'a potype => 'a" where | 
| 19736 | 66 | "Bot po = least (%x. True) po" | 
| 7112 | 67 | |
| 21404 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
21232diff
changeset | 68 | definition | 
| 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
21232diff
changeset | 69 | Top :: "'a potype => 'a" where | 
| 19736 | 70 | "Top po = greatest (%x. True) po" | 
| 7112 | 71 | |
| 21404 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
21232diff
changeset | 72 | definition | 
| 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
21232diff
changeset | 73 |   PartialOrder :: "('a potype) set" where
 | 
| 19736 | 74 |   "PartialOrder = {P. refl (pset P) (order P) & antisym (order P) &
 | 
| 13585 | 75 | trans (order P)}" | 
| 7112 | 76 | |
| 21404 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
21232diff
changeset | 77 | definition | 
| 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
21232diff
changeset | 78 |   CompleteLattice :: "('a potype) set" where
 | 
| 19736 | 79 |   "CompleteLattice = {cl. cl: PartialOrder &
 | 
| 17841 | 80 | (\<forall>S. S \<subseteq> pset cl --> (\<exists>L. isLub S cl L)) & | 
| 81 | (\<forall>S. S \<subseteq> pset cl --> (\<exists>G. isGlb S cl G))}" | |
| 7112 | 82 | |
| 21404 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
21232diff
changeset | 83 | definition | 
| 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
21232diff
changeset | 84 |   CLF :: "('a potype * ('a => 'a)) set" where
 | 
| 19736 | 85 | "CLF = (SIGMA cl: CompleteLattice. | 
| 86 |             {f. f: pset cl -> pset cl & monotone f (pset cl) (order cl)})"
 | |
| 13383 | 87 | |
| 21404 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
21232diff
changeset | 88 | definition | 
| 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
21232diff
changeset | 89 |   induced :: "['a set, ('a * 'a) set] => ('a *'a)set" where
 | 
| 19736 | 90 |   "induced A r = {(a,b). a : A & b: A & (a,b): r}"
 | 
| 7112 | 91 | |
| 92 | ||
| 19736 | 93 | definition | 
| 21404 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
21232diff
changeset | 94 |   sublattice :: "('a potype * 'a set)set" where
 | 
| 19736 | 95 | "sublattice = | 
| 96 | (SIGMA cl: CompleteLattice. | |
| 17841 | 97 |           {S. S \<subseteq> pset cl &
 | 
| 19736 | 98 | (| pset = S, order = induced S (order cl) |): CompleteLattice})" | 
| 7112 | 99 | |
| 19736 | 100 | abbreviation | 
| 21404 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
21232diff
changeset | 101 |   sublat :: "['a set, 'a potype] => bool"  ("_ <<= _" [51,50]50) where
 | 
| 19736 | 102 |   "S <<= cl == S : sublattice `` {cl}"
 | 
| 7112 | 103 | |
| 19736 | 104 | definition | 
| 21404 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
21232diff
changeset | 105 | dual :: "'a potype => 'a potype" where | 
| 19736 | 106 | "dual po = (| pset = pset po, order = converse (order po) |)" | 
| 7112 | 107 | |
| 13383 | 108 | locale (open) PO = | 
| 13115 | 109 | fixes cl :: "'a potype" | 
| 110 | and A :: "'a set" | |
| 111 |     and r  :: "('a * 'a) set"
 | |
| 112 | assumes cl_po: "cl : PartialOrder" | |
| 13585 | 113 | defines A_def: "A == pset cl" | 
| 114 | and r_def: "r == order cl" | |
| 7112 | 115 | |
| 13383 | 116 | locale (open) CL = PO + | 
| 13115 | 117 | assumes cl_co: "cl : CompleteLattice" | 
| 7112 | 118 | |
| 13383 | 119 | locale (open) CLF = CL + | 
| 13115 | 120 | fixes f :: "'a => 'a" | 
| 121 | and P :: "'a set" | |
| 122 |   assumes f_cl:  "(cl,f) : CLF" (*was the equivalent "f : CLF``{cl}"*)
 | |
| 123 | defines P_def: "P == fix f A" | |
| 7112 | 124 | |
| 125 | ||
| 13383 | 126 | locale (open) Tarski = CLF + | 
| 13115 | 127 | fixes Y :: "'a set" | 
| 128 | and intY1 :: "'a set" | |
| 129 | and v :: "'a" | |
| 130 | assumes | |
| 17841 | 131 | Y_ss: "Y \<subseteq> P" | 
| 13115 | 132 | defines | 
| 133 | intY1_def: "intY1 == interval r (lub Y cl) (Top cl)" | |
| 13383 | 134 |     and v_def: "v == glb {x. ((%x: intY1. f x) x, x): induced intY1 r &
 | 
| 13115 | 135 | x: intY1} | 
| 13383 | 136 | (| pset=intY1, order=induced intY1 r|)" | 
| 13115 | 137 | |
| 138 | ||
| 14569 | 139 | subsection {* Partial Order *}
 | 
| 13115 | 140 | |
| 141 | lemma (in PO) PO_imp_refl: "refl A r" | |
| 13383 | 142 | apply (insert cl_po) | 
| 13115 | 143 | apply (simp add: PartialOrder_def A_def r_def) | 
| 144 | done | |
| 145 | ||
| 146 | lemma (in PO) PO_imp_sym: "antisym r" | |
| 13383 | 147 | apply (insert cl_po) | 
| 19316 | 148 | apply (simp add: PartialOrder_def r_def) | 
| 13115 | 149 | done | 
| 150 | ||
| 151 | lemma (in PO) PO_imp_trans: "trans r" | |
| 13383 | 152 | apply (insert cl_po) | 
| 19316 | 153 | apply (simp add: PartialOrder_def r_def) | 
| 13115 | 154 | done | 
| 155 | ||
| 18705 | 156 | lemma (in PO) reflE: "x \<in> A ==> (x, x) \<in> r" | 
| 13383 | 157 | apply (insert cl_po) | 
| 18705 | 158 | apply (simp add: PartialOrder_def refl_def A_def r_def) | 
| 13115 | 159 | done | 
| 160 | ||
| 18705 | 161 | lemma (in PO) antisymE: "[| (a, b) \<in> r; (b, a) \<in> r |] ==> a = b" | 
| 13383 | 162 | apply (insert cl_po) | 
| 19316 | 163 | apply (simp add: PartialOrder_def antisym_def r_def) | 
| 13115 | 164 | done | 
| 165 | ||
| 18705 | 166 | lemma (in PO) transE: "[| (a, b) \<in> r; (b, c) \<in> r|] ==> (a,c) \<in> r" | 
| 13383 | 167 | apply (insert cl_po) | 
| 19316 | 168 | apply (simp add: PartialOrder_def r_def) | 
| 13115 | 169 | apply (unfold trans_def, fast) | 
| 170 | done | |
| 171 | ||
| 172 | lemma (in PO) monotoneE: | |
| 173 | "[| monotone f A r; x \<in> A; y \<in> A; (x, y) \<in> r |] ==> (f x, f y) \<in> r" | |
| 174 | by (simp add: monotone_def) | |
| 175 | ||
| 176 | lemma (in PO) po_subset_po: | |
| 17841 | 177 | "S \<subseteq> A ==> (| pset = S, order = induced S r |) \<in> PartialOrder" | 
| 13115 | 178 | apply (simp (no_asm) add: PartialOrder_def) | 
| 179 | apply auto | |
| 13383 | 180 | -- {* refl *}
 | 
| 13115 | 181 | apply (simp add: refl_def induced_def) | 
| 18705 | 182 | apply (blast intro: reflE) | 
| 13383 | 183 | -- {* antisym *}
 | 
| 13115 | 184 | apply (simp add: antisym_def induced_def) | 
| 18705 | 185 | apply (blast intro: antisymE) | 
| 13383 | 186 | -- {* trans *}
 | 
| 13115 | 187 | apply (simp add: trans_def induced_def) | 
| 18705 | 188 | apply (blast intro: transE) | 
| 13115 | 189 | done | 
| 190 | ||
| 17841 | 191 | lemma (in PO) indE: "[| (x, y) \<in> induced S r; S \<subseteq> A |] ==> (x, y) \<in> r" | 
| 13115 | 192 | by (simp add: add: induced_def) | 
| 193 | ||
| 194 | lemma (in PO) indI: "[| (x, y) \<in> r; x \<in> S; y \<in> S |] ==> (x, y) \<in> induced S r" | |
| 195 | by (simp add: add: induced_def) | |
| 196 | ||
| 17841 | 197 | lemma (in CL) CL_imp_ex_isLub: "S \<subseteq> A ==> \<exists>L. isLub S cl L" | 
| 13383 | 198 | apply (insert cl_co) | 
| 13115 | 199 | apply (simp add: CompleteLattice_def A_def) | 
| 200 | done | |
| 201 | ||
| 202 | declare (in CL) cl_co [simp] | |
| 203 | ||
| 204 | lemma isLub_lub: "(\<exists>L. isLub S cl L) = isLub S cl (lub S cl)" | |
| 205 | by (simp add: lub_def least_def isLub_def some_eq_ex [symmetric]) | |
| 206 | ||
| 207 | lemma isGlb_glb: "(\<exists>G. isGlb S cl G) = isGlb S cl (glb S cl)" | |
| 208 | by (simp add: glb_def greatest_def isGlb_def some_eq_ex [symmetric]) | |
| 209 | ||
| 210 | lemma isGlb_dual_isLub: "isGlb S cl = isLub S (dual cl)" | |
| 211 | by (simp add: isLub_def isGlb_def dual_def converse_def) | |
| 212 | ||
| 213 | lemma isLub_dual_isGlb: "isLub S cl = isGlb S (dual cl)" | |
| 214 | by (simp add: isLub_def isGlb_def dual_def converse_def) | |
| 215 | ||
| 216 | lemma (in PO) dualPO: "dual cl \<in> PartialOrder" | |
| 13383 | 217 | apply (insert cl_po) | 
| 218 | apply (simp add: PartialOrder_def dual_def refl_converse | |
| 13115 | 219 | trans_converse antisym_converse) | 
| 220 | done | |
| 221 | ||
| 222 | lemma Rdual: | |
| 17841 | 223 | "\<forall>S. (S \<subseteq> A -->( \<exists>L. isLub S (| pset = A, order = r|) L)) | 
| 224 | ==> \<forall>S. (S \<subseteq> A --> (\<exists>G. isGlb S (| pset = A, order = r|) G))" | |
| 13115 | 225 | apply safe | 
| 226 | apply (rule_tac x = "lub {y. y \<in> A & (\<forall>k \<in> S. (y, k) \<in> r)}
 | |
| 227 | (|pset = A, order = r|) " in exI) | |
| 228 | apply (drule_tac x = "{y. y \<in> A & (\<forall>k \<in> S. (y,k) \<in> r) }" in spec)
 | |
| 229 | apply (drule mp, fast) | |
| 230 | apply (simp add: isLub_lub isGlb_def) | |
| 231 | apply (simp add: isLub_def, blast) | |
| 232 | done | |
| 233 | ||
| 234 | lemma lub_dual_glb: "lub S cl = glb S (dual cl)" | |
| 235 | by (simp add: lub_def glb_def least_def greatest_def dual_def converse_def) | |
| 236 | ||
| 237 | lemma glb_dual_lub: "glb S cl = lub S (dual cl)" | |
| 238 | by (simp add: lub_def glb_def least_def greatest_def dual_def converse_def) | |
| 239 | ||
| 17841 | 240 | lemma CL_subset_PO: "CompleteLattice \<subseteq> PartialOrder" | 
| 13115 | 241 | by (simp add: PartialOrder_def CompleteLattice_def, fast) | 
| 242 | ||
| 243 | lemmas CL_imp_PO = CL_subset_PO [THEN subsetD] | |
| 244 | ||
| 21232 | 245 | declare CL_imp_PO [THEN PO.PO_imp_refl, simp] | 
| 246 | declare CL_imp_PO [THEN PO.PO_imp_sym, simp] | |
| 247 | declare CL_imp_PO [THEN PO.PO_imp_trans, simp] | |
| 13115 | 248 | |
| 249 | lemma (in CL) CO_refl: "refl A r" | |
| 250 | by (rule PO_imp_refl) | |
| 251 | ||
| 252 | lemma (in CL) CO_antisym: "antisym r" | |
| 253 | by (rule PO_imp_sym) | |
| 254 | ||
| 255 | lemma (in CL) CO_trans: "trans r" | |
| 256 | by (rule PO_imp_trans) | |
| 257 | ||
| 258 | lemma CompleteLatticeI: | |
| 17841 | 259 | "[| po \<in> PartialOrder; (\<forall>S. S \<subseteq> pset po --> (\<exists>L. isLub S po L)); | 
| 260 | (\<forall>S. S \<subseteq> pset po --> (\<exists>G. isGlb S po G))|] | |
| 13115 | 261 | ==> po \<in> CompleteLattice" | 
| 13383 | 262 | apply (unfold CompleteLattice_def, blast) | 
| 13115 | 263 | done | 
| 264 | ||
| 265 | lemma (in CL) CL_dualCL: "dual cl \<in> CompleteLattice" | |
| 13383 | 266 | apply (insert cl_co) | 
| 13115 | 267 | apply (simp add: CompleteLattice_def dual_def) | 
| 13383 | 268 | apply (fold dual_def) | 
| 269 | apply (simp add: isLub_dual_isGlb [symmetric] isGlb_dual_isLub [symmetric] | |
| 13115 | 270 | dualPO) | 
| 271 | done | |
| 272 | ||
| 13585 | 273 | lemma (in PO) dualA_iff: "pset (dual cl) = pset cl" | 
| 13115 | 274 | by (simp add: dual_def) | 
| 275 | ||
| 13585 | 276 | lemma (in PO) dualr_iff: "((x, y) \<in> (order(dual cl))) = ((y, x) \<in> order cl)" | 
| 13115 | 277 | by (simp add: dual_def) | 
| 278 | ||
| 279 | lemma (in PO) monotone_dual: | |
| 13585 | 280 | "monotone f (pset cl) (order cl) | 
| 281 | ==> monotone f (pset (dual cl)) (order(dual cl))" | |
| 282 | by (simp add: monotone_def dualA_iff dualr_iff) | |
| 13115 | 283 | |
| 284 | lemma (in PO) interval_dual: | |
| 13585 | 285 | "[| x \<in> A; y \<in> A|] ==> interval r x y = interval (order(dual cl)) y x" | 
| 13115 | 286 | apply (simp add: interval_def dualr_iff) | 
| 287 | apply (fold r_def, fast) | |
| 288 | done | |
| 289 | ||
| 290 | lemma (in PO) interval_not_empty: | |
| 291 |      "[| trans r; interval r a b \<noteq> {} |] ==> (a, b) \<in> r"
 | |
| 292 | apply (simp add: interval_def) | |
| 293 | apply (unfold trans_def, blast) | |
| 294 | done | |
| 295 | ||
| 296 | lemma (in PO) interval_imp_mem: "x \<in> interval r a b ==> (a, x) \<in> r" | |
| 297 | by (simp add: interval_def) | |
| 298 | ||
| 299 | lemma (in PO) left_in_interval: | |
| 300 |      "[| a \<in> A; b \<in> A; interval r a b \<noteq> {} |] ==> a \<in> interval r a b"
 | |
| 301 | apply (simp (no_asm_simp) add: interval_def) | |
| 302 | apply (simp add: PO_imp_trans interval_not_empty) | |
| 18705 | 303 | apply (simp add: reflE) | 
| 13115 | 304 | done | 
| 305 | ||
| 306 | lemma (in PO) right_in_interval: | |
| 307 |      "[| a \<in> A; b \<in> A; interval r a b \<noteq> {} |] ==> b \<in> interval r a b"
 | |
| 308 | apply (simp (no_asm_simp) add: interval_def) | |
| 309 | apply (simp add: PO_imp_trans interval_not_empty) | |
| 18705 | 310 | apply (simp add: reflE) | 
| 13115 | 311 | done | 
| 312 | ||
| 13383 | 313 | |
| 14569 | 314 | subsection {* sublattice *}
 | 
| 13383 | 315 | |
| 13115 | 316 | lemma (in PO) sublattice_imp_CL: | 
| 18750 | 317 | "S <<= cl ==> (| pset = S, order = induced S r |) \<in> CompleteLattice" | 
| 19316 | 318 | by (simp add: sublattice_def CompleteLattice_def r_def) | 
| 13115 | 319 | |
| 320 | lemma (in CL) sublatticeI: | |
| 17841 | 321 | "[| S \<subseteq> A; (| pset = S, order = induced S r |) \<in> CompleteLattice |] | 
| 18750 | 322 | ==> S <<= cl" | 
| 13115 | 323 | by (simp add: sublattice_def A_def r_def) | 
| 324 | ||
| 13383 | 325 | |
| 14569 | 326 | subsection {* lub *}
 | 
| 13383 | 327 | |
| 17841 | 328 | lemma (in CL) lub_unique: "[| S \<subseteq> A; isLub S cl x; isLub S cl L|] ==> x = L" | 
| 13115 | 329 | apply (rule antisymE) | 
| 330 | apply (auto simp add: isLub_def r_def) | |
| 331 | done | |
| 332 | ||
| 17841 | 333 | lemma (in CL) lub_upper: "[|S \<subseteq> A; x \<in> S|] ==> (x, lub S cl) \<in> r" | 
| 13115 | 334 | apply (rule CL_imp_ex_isLub [THEN exE], assumption) | 
| 335 | apply (unfold lub_def least_def) | |
| 336 | apply (rule some_equality [THEN ssubst]) | |
| 337 | apply (simp add: isLub_def) | |
| 13383 | 338 | apply (simp add: lub_unique A_def isLub_def) | 
| 13115 | 339 | apply (simp add: isLub_def r_def) | 
| 340 | done | |
| 341 | ||
| 342 | lemma (in CL) lub_least: | |
| 17841 | 343 | "[| S \<subseteq> A; L \<in> A; \<forall>x \<in> S. (x,L) \<in> r |] ==> (lub S cl, L) \<in> r" | 
| 13115 | 344 | apply (rule CL_imp_ex_isLub [THEN exE], assumption) | 
| 345 | apply (unfold lub_def least_def) | |
| 346 | apply (rule_tac s=x in some_equality [THEN ssubst]) | |
| 347 | apply (simp add: isLub_def) | |
| 13383 | 348 | apply (simp add: lub_unique A_def isLub_def) | 
| 13115 | 349 | apply (simp add: isLub_def r_def A_def) | 
| 350 | done | |
| 351 | ||
| 17841 | 352 | lemma (in CL) lub_in_lattice: "S \<subseteq> A ==> lub S cl \<in> A" | 
| 13115 | 353 | apply (rule CL_imp_ex_isLub [THEN exE], assumption) | 
| 354 | apply (unfold lub_def least_def) | |
| 355 | apply (subst some_equality) | |
| 356 | apply (simp add: isLub_def) | |
| 357 | prefer 2 apply (simp add: isLub_def A_def) | |
| 13383 | 358 | apply (simp add: lub_unique A_def isLub_def) | 
| 13115 | 359 | done | 
| 360 | ||
| 361 | lemma (in CL) lubI: | |
| 17841 | 362 | "[| S \<subseteq> A; L \<in> A; \<forall>x \<in> S. (x,L) \<in> r; | 
| 13115 | 363 | \<forall>z \<in> A. (\<forall>y \<in> S. (y,z) \<in> r) --> (L,z) \<in> r |] ==> L = lub S cl" | 
| 364 | apply (rule lub_unique, assumption) | |
| 365 | apply (simp add: isLub_def A_def r_def) | |
| 366 | apply (unfold isLub_def) | |
| 367 | apply (rule conjI) | |
| 368 | apply (fold A_def r_def) | |
| 369 | apply (rule lub_in_lattice, assumption) | |
| 370 | apply (simp add: lub_upper lub_least) | |
| 371 | done | |
| 372 | ||
| 17841 | 373 | lemma (in CL) lubIa: "[| S \<subseteq> A; isLub S cl L |] ==> L = lub S cl" | 
| 13115 | 374 | by (simp add: lubI isLub_def A_def r_def) | 
| 375 | ||
| 376 | lemma (in CL) isLub_in_lattice: "isLub S cl L ==> L \<in> A" | |
| 377 | by (simp add: isLub_def A_def) | |
| 378 | ||
| 379 | lemma (in CL) isLub_upper: "[|isLub S cl L; y \<in> S|] ==> (y, L) \<in> r" | |
| 380 | by (simp add: isLub_def r_def) | |
| 381 | ||
| 382 | lemma (in CL) isLub_least: | |
| 383 | "[| isLub S cl L; z \<in> A; \<forall>y \<in> S. (y, z) \<in> r|] ==> (L, z) \<in> r" | |
| 384 | by (simp add: isLub_def A_def r_def) | |
| 385 | ||
| 386 | lemma (in CL) isLubI: | |
| 13383 | 387 | "[| L \<in> A; \<forall>y \<in> S. (y, L) \<in> r; | 
| 13115 | 388 | (\<forall>z \<in> A. (\<forall>y \<in> S. (y, z):r) --> (L, z) \<in> r)|] ==> isLub S cl L" | 
| 389 | by (simp add: isLub_def A_def r_def) | |
| 390 | ||
| 13383 | 391 | |
| 14569 | 392 | subsection {* glb *}
 | 
| 13383 | 393 | |
| 17841 | 394 | lemma (in CL) glb_in_lattice: "S \<subseteq> A ==> glb S cl \<in> A" | 
| 13115 | 395 | apply (subst glb_dual_lub) | 
| 396 | apply (simp add: A_def) | |
| 397 | apply (rule dualA_iff [THEN subst]) | |
| 21232 | 398 | apply (rule CL.lub_in_lattice) | 
| 13383 | 399 | apply (rule dualPO) | 
| 13115 | 400 | apply (rule CL_dualCL) | 
| 401 | apply (simp add: dualA_iff) | |
| 402 | done | |
| 403 | ||
| 17841 | 404 | lemma (in CL) glb_lower: "[|S \<subseteq> A; x \<in> S|] ==> (glb S cl, x) \<in> r" | 
| 13115 | 405 | apply (subst glb_dual_lub) | 
| 406 | apply (simp add: r_def) | |
| 407 | apply (rule dualr_iff [THEN subst]) | |
| 21232 | 408 | apply (rule CL.lub_upper) | 
| 13383 | 409 | apply (rule dualPO) | 
| 13115 | 410 | apply (rule CL_dualCL) | 
| 411 | apply (simp add: dualA_iff A_def, assumption) | |
| 412 | done | |
| 413 | ||
| 13383 | 414 | text {*
 | 
| 415 | Reduce the sublattice property by using substructural properties; | |
| 416 |   abandoned see @{text "Tarski_4.ML"}.
 | |
| 417 | *} | |
| 13115 | 418 | |
| 419 | lemma (in CLF) [simp]: | |
| 13585 | 420 | "f: pset cl -> pset cl & monotone f (pset cl) (order cl)" | 
| 13383 | 421 | apply (insert f_cl) | 
| 422 | apply (simp add: CLF_def) | |
| 13115 | 423 | done | 
| 424 | ||
| 425 | declare (in CLF) f_cl [simp] | |
| 426 | ||
| 427 | ||
| 13585 | 428 | lemma (in CLF) f_in_funcset: "f \<in> A -> A" | 
| 13115 | 429 | by (simp add: A_def) | 
| 430 | ||
| 431 | lemma (in CLF) monotone_f: "monotone f A r" | |
| 432 | by (simp add: A_def r_def) | |
| 433 | ||
| 22547 | 434 | lemma (in CLF) CLF_dual: "(dual cl, f) \<in> CLF" | 
| 13115 | 435 | apply (simp add: CLF_def CL_dualCL monotone_dual) | 
| 436 | apply (simp add: dualA_iff) | |
| 437 | done | |
| 438 | ||
| 13383 | 439 | |
| 14569 | 440 | subsection {* fixed points *}
 | 
| 13383 | 441 | |
| 17841 | 442 | lemma fix_subset: "fix f A \<subseteq> A" | 
| 13115 | 443 | by (simp add: fix_def, fast) | 
| 444 | ||
| 445 | lemma fix_imp_eq: "x \<in> fix f A ==> f x = x" | |
| 446 | by (simp add: fix_def) | |
| 447 | ||
| 448 | lemma fixf_subset: | |
| 17841 | 449 | "[| A \<subseteq> B; x \<in> fix (%y: A. f y) A |] ==> x \<in> fix f B" | 
| 450 | by (simp add: fix_def, auto) | |
| 13115 | 451 | |
| 13383 | 452 | |
| 14569 | 453 | subsection {* lemmas for Tarski, lub *}
 | 
| 13115 | 454 | lemma (in CLF) lubH_le_flubH: | 
| 455 |      "H = {x. (x, f x) \<in> r & x \<in> A} ==> (lub H cl, f (lub H cl)) \<in> r"
 | |
| 456 | apply (rule lub_least, fast) | |
| 457 | apply (rule f_in_funcset [THEN funcset_mem]) | |
| 458 | apply (rule lub_in_lattice, fast) | |
| 13383 | 459 | -- {* @{text "\<forall>x:H. (x, f (lub H r)) \<in> r"} *}
 | 
| 13115 | 460 | apply (rule ballI) | 
| 461 | apply (rule transE) | |
| 13585 | 462 | -- {* instantiates @{text "(x, ???z) \<in> order cl to (x, f x)"}, *}
 | 
| 13383 | 463 | -- {* because of the def of @{text H} *}
 | 
| 13115 | 464 | apply fast | 
| 13383 | 465 | -- {* so it remains to show @{text "(f x, f (lub H cl)) \<in> r"} *}
 | 
| 13115 | 466 | apply (rule_tac f = "f" in monotoneE) | 
| 467 | apply (rule monotone_f, fast) | |
| 468 | apply (rule lub_in_lattice, fast) | |
| 469 | apply (rule lub_upper, fast) | |
| 470 | apply assumption | |
| 471 | done | |
| 472 | ||
| 473 | lemma (in CLF) flubH_le_lubH: | |
| 474 |      "[|  H = {x. (x, f x) \<in> r & x \<in> A} |] ==> (f (lub H cl), lub H cl) \<in> r"
 | |
| 475 | apply (rule lub_upper, fast) | |
| 476 | apply (rule_tac t = "H" in ssubst, assumption) | |
| 477 | apply (rule CollectI) | |
| 478 | apply (rule conjI) | |
| 479 | apply (rule_tac [2] f_in_funcset [THEN funcset_mem]) | |
| 480 | apply (rule_tac [2] lub_in_lattice) | |
| 481 | prefer 2 apply fast | |
| 482 | apply (rule_tac f = "f" in monotoneE) | |
| 483 | apply (rule monotone_f) | |
| 13383 | 484 | apply (blast intro: lub_in_lattice) | 
| 485 | apply (blast intro: lub_in_lattice f_in_funcset [THEN funcset_mem]) | |
| 13115 | 486 | apply (simp add: lubH_le_flubH) | 
| 487 | done | |
| 488 | ||
| 489 | lemma (in CLF) lubH_is_fixp: | |
| 490 |      "H = {x. (x, f x) \<in> r & x \<in> A} ==> lub H cl \<in> fix f A"
 | |
| 491 | apply (simp add: fix_def) | |
| 492 | apply (rule conjI) | |
| 493 | apply (rule lub_in_lattice, fast) | |
| 494 | apply (rule antisymE) | |
| 495 | apply (simp add: flubH_le_lubH) | |
| 496 | apply (simp add: lubH_le_flubH) | |
| 497 | done | |
| 498 | ||
| 499 | lemma (in CLF) fix_in_H: | |
| 500 |      "[| H = {x. (x, f x) \<in> r & x \<in> A};  x \<in> P |] ==> x \<in> H"
 | |
| 13383 | 501 | by (simp add: P_def fix_imp_eq [of _ f A] reflE CO_refl | 
| 502 | fix_subset [of f A, THEN subsetD]) | |
| 13115 | 503 | |
| 504 | lemma (in CLF) fixf_le_lubH: | |
| 505 |      "H = {x. (x, f x) \<in> r & x \<in> A} ==> \<forall>x \<in> fix f A. (x, lub H cl) \<in> r"
 | |
| 506 | apply (rule ballI) | |
| 507 | apply (rule lub_upper, fast) | |
| 508 | apply (rule fix_in_H) | |
| 13383 | 509 | apply (simp_all add: P_def) | 
| 13115 | 510 | done | 
| 511 | ||
| 512 | lemma (in CLF) lubH_least_fixf: | |
| 13383 | 513 |      "H = {x. (x, f x) \<in> r & x \<in> A}
 | 
| 13115 | 514 | ==> \<forall>L. (\<forall>y \<in> fix f A. (y,L) \<in> r) --> (lub H cl, L) \<in> r" | 
| 515 | apply (rule allI) | |
| 516 | apply (rule impI) | |
| 517 | apply (erule bspec) | |
| 518 | apply (rule lubH_is_fixp, assumption) | |
| 519 | done | |
| 520 | ||
| 14569 | 521 | subsection {* Tarski fixpoint theorem 1, first part *}
 | 
| 13115 | 522 | lemma (in CLF) T_thm_1_lub: "lub P cl = lub {x. (x, f x) \<in> r & x \<in> A} cl"
 | 
| 523 | apply (rule sym) | |
| 13383 | 524 | apply (simp add: P_def) | 
| 13115 | 525 | apply (rule lubI) | 
| 526 | apply (rule fix_subset) | |
| 527 | apply (rule lub_in_lattice, fast) | |
| 528 | apply (simp add: fixf_le_lubH) | |
| 529 | apply (simp add: lubH_least_fixf) | |
| 530 | done | |
| 531 | ||
| 532 | lemma (in CLF) glbH_is_fixp: "H = {x. (f x, x) \<in> r & x \<in> A} ==> glb H cl \<in> P"
 | |
| 13383 | 533 |   -- {* Tarski for glb *}
 | 
| 13115 | 534 | apply (simp add: glb_dual_lub P_def A_def r_def) | 
| 535 | apply (rule dualA_iff [THEN subst]) | |
| 21232 | 536 | apply (rule CLF.lubH_is_fixp) | 
| 13383 | 537 | apply (rule dualPO) | 
| 13115 | 538 | apply (rule CL_dualCL) | 
| 22547 | 539 | apply (rule CLF_dual) | 
| 13115 | 540 | apply (simp add: dualr_iff dualA_iff) | 
| 541 | done | |
| 542 | ||
| 543 | lemma (in CLF) T_thm_1_glb: "glb P cl = glb {x. (f x, x) \<in> r & x \<in> A} cl"
 | |
| 544 | apply (simp add: glb_dual_lub P_def A_def r_def) | |
| 545 | apply (rule dualA_iff [THEN subst]) | |
| 21232 | 546 | apply (simp add: CLF.T_thm_1_lub [of _ f, OF dualPO CL_dualCL] | 
| 13115 | 547 | dualPO CL_dualCL CLF_dual dualr_iff) | 
| 548 | done | |
| 549 | ||
| 14569 | 550 | subsection {* interval *}
 | 
| 13383 | 551 | |
| 13115 | 552 | lemma (in CLF) rel_imp_elem: "(x, y) \<in> r ==> x \<in> A" | 
| 13383 | 553 | apply (insert CO_refl) | 
| 554 | apply (simp add: refl_def, blast) | |
| 13115 | 555 | done | 
| 556 | ||
| 17841 | 557 | lemma (in CLF) interval_subset: "[| a \<in> A; b \<in> A |] ==> interval r a b \<subseteq> A" | 
| 13115 | 558 | apply (simp add: interval_def) | 
| 559 | apply (blast intro: rel_imp_elem) | |
| 560 | done | |
| 561 | ||
| 562 | lemma (in CLF) intervalI: | |
| 563 | "[| (a, x) \<in> r; (x, b) \<in> r |] ==> x \<in> interval r a b" | |
| 17841 | 564 | by (simp add: interval_def) | 
| 13115 | 565 | |
| 566 | lemma (in CLF) interval_lemma1: | |
| 17841 | 567 | "[| S \<subseteq> interval r a b; x \<in> S |] ==> (a, x) \<in> r" | 
| 568 | by (unfold interval_def, fast) | |
| 13115 | 569 | |
| 570 | lemma (in CLF) interval_lemma2: | |
| 17841 | 571 | "[| S \<subseteq> interval r a b; x \<in> S |] ==> (x, b) \<in> r" | 
| 572 | by (unfold interval_def, fast) | |
| 13115 | 573 | |
| 574 | lemma (in CLF) a_less_lub: | |
| 17841 | 575 |      "[| S \<subseteq> A; S \<noteq> {};
 | 
| 13115 | 576 | \<forall>x \<in> S. (a,x) \<in> r; \<forall>y \<in> S. (y, L) \<in> r |] ==> (a,L) \<in> r" | 
| 18705 | 577 | by (blast intro: transE) | 
| 13115 | 578 | |
| 579 | lemma (in CLF) glb_less_b: | |
| 17841 | 580 |      "[| S \<subseteq> A; S \<noteq> {};
 | 
| 13115 | 581 | \<forall>x \<in> S. (x,b) \<in> r; \<forall>y \<in> S. (G, y) \<in> r |] ==> (G,b) \<in> r" | 
| 18705 | 582 | by (blast intro: transE) | 
| 13115 | 583 | |
| 584 | lemma (in CLF) S_intv_cl: | |
| 17841 | 585 | "[| a \<in> A; b \<in> A; S \<subseteq> interval r a b |]==> S \<subseteq> A" | 
| 13115 | 586 | by (simp add: subset_trans [OF _ interval_subset]) | 
| 587 | ||
| 588 | lemma (in CLF) L_in_interval: | |
| 17841 | 589 | "[| a \<in> A; b \<in> A; S \<subseteq> interval r a b; | 
| 13115 | 590 |          S \<noteq> {}; isLub S cl L; interval r a b \<noteq> {} |] ==> L \<in> interval r a b"
 | 
| 591 | apply (rule intervalI) | |
| 592 | apply (rule a_less_lub) | |
| 593 | prefer 2 apply assumption | |
| 594 | apply (simp add: S_intv_cl) | |
| 595 | apply (rule ballI) | |
| 596 | apply (simp add: interval_lemma1) | |
| 597 | apply (simp add: isLub_upper) | |
| 13383 | 598 | -- {* @{text "(L, b) \<in> r"} *}
 | 
| 13115 | 599 | apply (simp add: isLub_least interval_lemma2) | 
| 600 | done | |
| 601 | ||
| 602 | lemma (in CLF) G_in_interval: | |
| 17841 | 603 |      "[| a \<in> A; b \<in> A; interval r a b \<noteq> {}; S \<subseteq> interval r a b; isGlb S cl G;
 | 
| 13115 | 604 |          S \<noteq> {} |] ==> G \<in> interval r a b"
 | 
| 605 | apply (simp add: interval_dual) | |
| 21232 | 606 | apply (simp add: CLF.L_in_interval [of _ f] | 
| 13115 | 607 | dualA_iff A_def dualPO CL_dualCL CLF_dual isGlb_dual_isLub) | 
| 608 | done | |
| 609 | ||
| 610 | lemma (in CLF) intervalPO: | |
| 13383 | 611 |      "[| a \<in> A; b \<in> A; interval r a b \<noteq> {} |]
 | 
| 13115 | 612 | ==> (| pset = interval r a b, order = induced (interval r a b) r |) | 
| 613 | \<in> PartialOrder" | |
| 614 | apply (rule po_subset_po) | |
| 615 | apply (simp add: interval_subset) | |
| 616 | done | |
| 617 | ||
| 618 | lemma (in CLF) intv_CL_lub: | |
| 13383 | 619 |  "[| a \<in> A; b \<in> A; interval r a b \<noteq> {} |]
 | 
| 17841 | 620 | ==> \<forall>S. S \<subseteq> interval r a b --> | 
| 13383 | 621 | (\<exists>L. isLub S (| pset = interval r a b, | 
| 13115 | 622 | order = induced (interval r a b) r |) L)" | 
| 623 | apply (intro strip) | |
| 624 | apply (frule S_intv_cl [THEN CL_imp_ex_isLub]) | |
| 625 | prefer 2 apply assumption | |
| 626 | apply assumption | |
| 627 | apply (erule exE) | |
| 13383 | 628 | -- {* define the lub for the interval as *}
 | 
| 13115 | 629 | apply (rule_tac x = "if S = {} then a else L" in exI)
 | 
| 630 | apply (simp (no_asm_simp) add: isLub_def split del: split_if) | |
| 13383 | 631 | apply (intro impI conjI) | 
| 632 | -- {* @{text "(if S = {} then a else L) \<in> interval r a b"} *}
 | |
| 13115 | 633 | apply (simp add: CL_imp_PO L_in_interval) | 
| 634 | apply (simp add: left_in_interval) | |
| 13383 | 635 | -- {* lub prop 1 *}
 | 
| 13115 | 636 | apply (case_tac "S = {}")
 | 
| 13383 | 637 | -- {* @{text "S = {}, y \<in> S = False => everything"} *}
 | 
| 13115 | 638 | apply fast | 
| 13383 | 639 | -- {* @{text "S \<noteq> {}"} *}
 | 
| 13115 | 640 | apply simp | 
| 13383 | 641 | -- {* @{text "\<forall>y:S. (y, L) \<in> induced (interval r a b) r"} *}
 | 
| 13115 | 642 | apply (rule ballI) | 
| 643 | apply (simp add: induced_def L_in_interval) | |
| 644 | apply (rule conjI) | |
| 645 | apply (rule subsetD) | |
| 646 | apply (simp add: S_intv_cl, assumption) | |
| 647 | apply (simp add: isLub_upper) | |
| 13383 | 648 | -- {* @{text "\<forall>z:interval r a b. (\<forall>y:S. (y, z) \<in> induced (interval r a b) r \<longrightarrow> (if S = {} then a else L, z) \<in> induced (interval r a b) r"} *}
 | 
| 13115 | 649 | apply (rule ballI) | 
| 650 | apply (rule impI) | |
| 651 | apply (case_tac "S = {}")
 | |
| 13383 | 652 | -- {* @{text "S = {}"} *}
 | 
| 13115 | 653 | apply simp | 
| 654 | apply (simp add: induced_def interval_def) | |
| 655 | apply (rule conjI) | |
| 18705 | 656 | apply (rule reflE, assumption) | 
| 13115 | 657 | apply (rule interval_not_empty) | 
| 658 | apply (rule CO_trans) | |
| 659 | apply (simp add: interval_def) | |
| 13383 | 660 | -- {* @{text "S \<noteq> {}"} *}
 | 
| 13115 | 661 | apply simp | 
| 662 | apply (simp add: induced_def L_in_interval) | |
| 663 | apply (rule isLub_least, assumption) | |
| 664 | apply (rule subsetD) | |
| 665 | prefer 2 apply assumption | |
| 666 | apply (simp add: S_intv_cl, fast) | |
| 667 | done | |
| 668 | ||
| 669 | lemmas (in CLF) intv_CL_glb = intv_CL_lub [THEN Rdual] | |
| 670 | ||
| 671 | lemma (in CLF) interval_is_sublattice: | |
| 13383 | 672 |      "[| a \<in> A; b \<in> A; interval r a b \<noteq> {} |]
 | 
| 18750 | 673 | ==> interval r a b <<= cl" | 
| 13115 | 674 | apply (rule sublatticeI) | 
| 675 | apply (simp add: interval_subset) | |
| 676 | apply (rule CompleteLatticeI) | |
| 677 | apply (simp add: intervalPO) | |
| 678 | apply (simp add: intv_CL_lub) | |
| 679 | apply (simp add: intv_CL_glb) | |
| 680 | done | |
| 681 | ||
| 13383 | 682 | lemmas (in CLF) interv_is_compl_latt = | 
| 13115 | 683 | interval_is_sublattice [THEN sublattice_imp_CL] | 
| 684 | ||
| 13383 | 685 | |
| 14569 | 686 | subsection {* Top and Bottom *}
 | 
| 13115 | 687 | lemma (in CLF) Top_dual_Bot: "Top cl = Bot (dual cl)" | 
| 688 | by (simp add: Top_def Bot_def least_def greatest_def dualA_iff dualr_iff) | |
| 689 | ||
| 690 | lemma (in CLF) Bot_dual_Top: "Bot cl = Top (dual cl)" | |
| 691 | by (simp add: Top_def Bot_def least_def greatest_def dualA_iff dualr_iff) | |
| 692 | ||
| 693 | lemma (in CLF) Bot_in_lattice: "Bot cl \<in> A" | |
| 694 | apply (simp add: Bot_def least_def) | |
| 17841 | 695 | apply (rule_tac a="glb A cl" in someI2) | 
| 696 | apply (simp_all add: glb_in_lattice glb_lower | |
| 697 | r_def [symmetric] A_def [symmetric]) | |
| 13115 | 698 | done | 
| 699 | ||
| 700 | lemma (in CLF) Top_in_lattice: "Top cl \<in> A" | |
| 701 | apply (simp add: Top_dual_Bot A_def) | |
| 13383 | 702 | apply (rule dualA_iff [THEN subst]) | 
| 22547 | 703 | apply (blast intro!: CLF.Bot_in_lattice dualPO CL_dualCL CLF_dual) | 
| 13115 | 704 | done | 
| 705 | ||
| 706 | lemma (in CLF) Top_prop: "x \<in> A ==> (x, Top cl) \<in> r" | |
| 707 | apply (simp add: Top_def greatest_def) | |
| 17841 | 708 | apply (rule_tac a="lub A cl" in someI2) | 
| 13115 | 709 | apply (rule someI2) | 
| 17841 | 710 | apply (simp_all add: lub_in_lattice lub_upper | 
| 711 | r_def [symmetric] A_def [symmetric]) | |
| 13115 | 712 | done | 
| 713 | ||
| 714 | lemma (in CLF) Bot_prop: "x \<in> A ==> (Bot cl, x) \<in> r" | |
| 715 | apply (simp add: Bot_dual_Top r_def) | |
| 716 | apply (rule dualr_iff [THEN subst]) | |
| 21232 | 717 | apply (simp add: CLF.Top_prop [of _ f] | 
| 13115 | 718 | dualA_iff A_def dualPO CL_dualCL CLF_dual) | 
| 719 | done | |
| 720 | ||
| 721 | lemma (in CLF) Top_intv_not_empty: "x \<in> A  ==> interval r x (Top cl) \<noteq> {}"
 | |
| 722 | apply (rule notI) | |
| 723 | apply (drule_tac a = "Top cl" in equals0D) | |
| 724 | apply (simp add: interval_def) | |
| 725 | apply (simp add: refl_def Top_in_lattice Top_prop) | |
| 726 | done | |
| 727 | ||
| 728 | lemma (in CLF) Bot_intv_not_empty: "x \<in> A ==> interval r (Bot cl) x \<noteq> {}"
 | |
| 729 | apply (simp add: Bot_dual_Top) | |
| 730 | apply (subst interval_dual) | |
| 731 | prefer 2 apply assumption | |
| 732 | apply (simp add: A_def) | |
| 733 | apply (rule dualA_iff [THEN subst]) | |
| 22547 | 734 | apply (blast intro!: CLF.Top_in_lattice dualPO CL_dualCL CLF_dual) | 
| 21232 | 735 | apply (simp add: CLF.Top_intv_not_empty [of _ f] | 
| 13115 | 736 | dualA_iff A_def dualPO CL_dualCL CLF_dual) | 
| 737 | done | |
| 738 | ||
| 14569 | 739 | subsection {* fixed points form a partial order *}
 | 
| 13383 | 740 | |
| 13115 | 741 | lemma (in CLF) fixf_po: "(| pset = P, order = induced P r|) \<in> PartialOrder" | 
| 742 | by (simp add: P_def fix_subset po_subset_po) | |
| 743 | ||
| 17841 | 744 | lemma (in Tarski) Y_subset_A: "Y \<subseteq> A" | 
| 13115 | 745 | apply (rule subset_trans [OF _ fix_subset]) | 
| 746 | apply (rule Y_ss [simplified P_def]) | |
| 747 | done | |
| 748 | ||
| 749 | lemma (in Tarski) lubY_in_A: "lub Y cl \<in> A" | |
| 18750 | 750 | by (rule Y_subset_A [THEN lub_in_lattice]) | 
| 13115 | 751 | |
| 752 | lemma (in Tarski) lubY_le_flubY: "(lub Y cl, f (lub Y cl)) \<in> r" | |
| 753 | apply (rule lub_least) | |
| 754 | apply (rule Y_subset_A) | |
| 755 | apply (rule f_in_funcset [THEN funcset_mem]) | |
| 756 | apply (rule lubY_in_A) | |
| 17841 | 757 | -- {* @{text "Y \<subseteq> P ==> f x = x"} *}
 | 
| 13115 | 758 | apply (rule ballI) | 
| 759 | apply (rule_tac t = "x" in fix_imp_eq [THEN subst]) | |
| 760 | apply (erule Y_ss [simplified P_def, THEN subsetD]) | |
| 13383 | 761 | -- {* @{text "reduce (f x, f (lub Y cl)) \<in> r to (x, lub Y cl) \<in> r"} by monotonicity *}
 | 
| 13115 | 762 | apply (rule_tac f = "f" in monotoneE) | 
| 763 | apply (rule monotone_f) | |
| 764 | apply (simp add: Y_subset_A [THEN subsetD]) | |
| 765 | apply (rule lubY_in_A) | |
| 766 | apply (simp add: lub_upper Y_subset_A) | |
| 767 | done | |
| 768 | ||
| 17841 | 769 | lemma (in Tarski) intY1_subset: "intY1 \<subseteq> A" | 
| 13115 | 770 | apply (unfold intY1_def) | 
| 771 | apply (rule interval_subset) | |
| 772 | apply (rule lubY_in_A) | |
| 773 | apply (rule Top_in_lattice) | |
| 774 | done | |
| 775 | ||
| 776 | lemmas (in Tarski) intY1_elem = intY1_subset [THEN subsetD] | |
| 777 | ||
| 778 | lemma (in Tarski) intY1_f_closed: "x \<in> intY1 \<Longrightarrow> f x \<in> intY1" | |
| 779 | apply (simp add: intY1_def interval_def) | |
| 780 | apply (rule conjI) | |
| 781 | apply (rule transE) | |
| 782 | apply (rule lubY_le_flubY) | |
| 13383 | 783 | -- {* @{text "(f (lub Y cl), f x) \<in> r"} *}
 | 
| 13115 | 784 | apply (rule_tac f=f in monotoneE) | 
| 785 | apply (rule monotone_f) | |
| 786 | apply (rule lubY_in_A) | |
| 787 | apply (simp add: intY1_def interval_def intY1_elem) | |
| 788 | apply (simp add: intY1_def interval_def) | |
| 13383 | 789 | -- {* @{text "(f x, Top cl) \<in> r"} *}
 | 
| 13115 | 790 | apply (rule Top_prop) | 
| 791 | apply (rule f_in_funcset [THEN funcset_mem]) | |
| 792 | apply (simp add: intY1_def interval_def intY1_elem) | |
| 793 | done | |
| 794 | ||
| 13585 | 795 | lemma (in Tarski) intY1_func: "(%x: intY1. f x) \<in> intY1 -> intY1" | 
| 13115 | 796 | apply (rule restrictI) | 
| 797 | apply (erule intY1_f_closed) | |
| 798 | done | |
| 799 | ||
| 800 | lemma (in Tarski) intY1_mono: | |
| 801 | "monotone (%x: intY1. f x) intY1 (induced intY1 r)" | |
| 802 | apply (auto simp add: monotone_def induced_def intY1_f_closed) | |
| 803 | apply (blast intro: intY1_elem monotone_f [THEN monotoneE]) | |
| 804 | done | |
| 805 | ||
| 13383 | 806 | lemma (in Tarski) intY1_is_cl: | 
| 13115 | 807 | "(| pset = intY1, order = induced intY1 r |) \<in> CompleteLattice" | 
| 808 | apply (unfold intY1_def) | |
| 809 | apply (rule interv_is_compl_latt) | |
| 810 | apply (rule lubY_in_A) | |
| 811 | apply (rule Top_in_lattice) | |
| 812 | apply (rule Top_intv_not_empty) | |
| 813 | apply (rule lubY_in_A) | |
| 814 | done | |
| 815 | ||
| 816 | lemma (in Tarski) v_in_P: "v \<in> P" | |
| 817 | apply (unfold P_def) | |
| 818 | apply (rule_tac A = "intY1" in fixf_subset) | |
| 819 | apply (rule intY1_subset) | |
| 21232 | 820 | apply (simp add: CLF.glbH_is_fixp [OF _ intY1_is_cl, simplified] | 
| 13115 | 821 | v_def CL_imp_PO intY1_is_cl CLF_def intY1_func intY1_mono) | 
| 822 | done | |
| 823 | ||
| 13383 | 824 | lemma (in Tarski) z_in_interval: | 
| 13115 | 825 | "[| z \<in> P; \<forall>y\<in>Y. (y, z) \<in> induced P r |] ==> z \<in> intY1" | 
| 826 | apply (unfold intY1_def P_def) | |
| 827 | apply (rule intervalI) | |
| 13383 | 828 | prefer 2 | 
| 13115 | 829 | apply (erule fix_subset [THEN subsetD, THEN Top_prop]) | 
| 830 | apply (rule lub_least) | |
| 831 | apply (rule Y_subset_A) | |
| 832 | apply (fast elim!: fix_subset [THEN subsetD]) | |
| 833 | apply (simp add: induced_def) | |
| 834 | done | |
| 835 | ||
| 13383 | 836 | lemma (in Tarski) f'z_in_int_rel: "[| z \<in> P; \<forall>y\<in>Y. (y, z) \<in> induced P r |] | 
| 13115 | 837 | ==> ((%x: intY1. f x) z, z) \<in> induced intY1 r" | 
| 838 | apply (simp add: induced_def intY1_f_closed z_in_interval P_def) | |
| 13383 | 839 | apply (simp add: fix_imp_eq [of _ f A] fix_subset [of f A, THEN subsetD] | 
| 18705 | 840 | reflE) | 
| 13115 | 841 | done | 
| 842 | ||
| 843 | lemma (in Tarski) tarski_full_lemma: | |
| 844 | "\<exists>L. isLub Y (| pset = P, order = induced P r |) L" | |
| 845 | apply (rule_tac x = "v" in exI) | |
| 846 | apply (simp add: isLub_def) | |
| 13383 | 847 | -- {* @{text "v \<in> P"} *}
 | 
| 13115 | 848 | apply (simp add: v_in_P) | 
| 849 | apply (rule conjI) | |
| 13383 | 850 | -- {* @{text v} is lub *}
 | 
| 851 | -- {* @{text "1. \<forall>y:Y. (y, v) \<in> induced P r"} *}
 | |
| 13115 | 852 | apply (rule ballI) | 
| 853 | apply (simp add: induced_def subsetD v_in_P) | |
| 854 | apply (rule conjI) | |
| 855 | apply (erule Y_ss [THEN subsetD]) | |
| 856 | apply (rule_tac b = "lub Y cl" in transE) | |
| 857 | apply (rule lub_upper) | |
| 858 | apply (rule Y_subset_A, assumption) | |
| 859 | apply (rule_tac b = "Top cl" in interval_imp_mem) | |
| 860 | apply (simp add: v_def) | |
| 861 | apply (fold intY1_def) | |
| 21232 | 862 | apply (rule CL.glb_in_lattice [OF _ intY1_is_cl, simplified]) | 
| 13115 | 863 | apply (simp add: CL_imp_PO intY1_is_cl, force) | 
| 13383 | 864 | -- {* @{text v} is LEAST ub *}
 | 
| 13115 | 865 | apply clarify | 
| 866 | apply (rule indI) | |
| 867 | prefer 3 apply assumption | |
| 868 | prefer 2 apply (simp add: v_in_P) | |
| 869 | apply (unfold v_def) | |
| 870 | apply (rule indE) | |
| 871 | apply (rule_tac [2] intY1_subset) | |
| 21232 | 872 | apply (rule CL.glb_lower [OF _ intY1_is_cl, simplified]) | 
| 13383 | 873 | apply (simp add: CL_imp_PO intY1_is_cl) | 
| 13115 | 874 | apply force | 
| 875 | apply (simp add: induced_def intY1_f_closed z_in_interval) | |
| 18705 | 876 | apply (simp add: P_def fix_imp_eq [of _ f A] reflE | 
| 877 | fix_subset [of f A, THEN subsetD]) | |
| 13115 | 878 | done | 
| 879 | ||
| 880 | lemma CompleteLatticeI_simp: | |
| 13383 | 881 | "[| (| pset = A, order = r |) \<in> PartialOrder; | 
| 17841 | 882 | \<forall>S. S \<subseteq> A --> (\<exists>L. isLub S (| pset = A, order = r |) L) |] | 
| 13115 | 883 | ==> (| pset = A, order = r |) \<in> CompleteLattice" | 
| 884 | by (simp add: CompleteLatticeI Rdual) | |
| 885 | ||
| 886 | theorem (in CLF) Tarski_full: | |
| 887 | "(| pset = P, order = induced P r|) \<in> CompleteLattice" | |
| 888 | apply (rule CompleteLatticeI_simp) | |
| 889 | apply (rule fixf_po, clarify) | |
| 13383 | 890 | apply (simp add: P_def A_def r_def) | 
| 891 | apply (blast intro!: Tarski.tarski_full_lemma cl_po cl_co f_cl) | |
| 13115 | 892 | done | 
| 7112 | 893 | |
| 894 | end |