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