src/HOL/Metis_Examples/Tarski.thy
 author wenzelm Wed Dec 29 17:34:41 2010 +0100 (2010-12-29) changeset 41413 64cd30d6b0b8 parent 41144 509e51b7509a child 42103 6066a35f6678 permissions -rw-r--r--
explicit file specifications -- avoid secondary load path;
```     1 (*  Title:      HOL/Metis_Examples/Tarski.thy
```
```     2     Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
```
```     3     Author:     Jasmin Blanchette, TU Muenchen
```
```     4
```
```     5 Testing Metis.
```
```     6 *)
```
```     7
```
```     8 header {* The Full Theorem of Tarski *}
```
```     9
```
```    10 theory Tarski
```
```    11 imports Main "~~/src/HOL/Library/FuncSet"
```
```    12 begin
```
```    13
```
```    14 (*Many of these higher-order problems appear to be impossible using the
```
```    15 current linkup. They often seem to need either higher-order unification
```
```    16 or explicit reasoning about connectives such as conjunction. The numerous
```
```    17 set comprehensions are to blame.*)
```
```    18
```
```    19
```
```    20 record 'a potype =
```
```    21   pset  :: "'a set"
```
```    22   order :: "('a * 'a) set"
```
```    23
```
```    24 definition monotone :: "['a => 'a, 'a set, ('a *'a)set] => bool" where
```
```    25   "monotone f A r == \<forall>x\<in>A. \<forall>y\<in>A. (x, y): r --> ((f x), (f y)) : r"
```
```    26
```
```    27 definition least :: "['a => bool, 'a potype] => 'a" where
```
```    28   "least P po == @ x. x: pset po & P x &
```
```    29                        (\<forall>y \<in> pset po. P y --> (x,y): order po)"
```
```    30
```
```    31 definition greatest :: "['a => bool, 'a potype] => 'a" where
```
```    32   "greatest P po == @ x. x: pset po & P x &
```
```    33                           (\<forall>y \<in> pset po. P y --> (y,x): order po)"
```
```    34
```
```    35 definition lub  :: "['a set, 'a potype] => 'a" where
```
```    36   "lub S po == least (%x. \<forall>y\<in>S. (y,x): order po) po"
```
```    37
```
```    38 definition glb  :: "['a set, 'a potype] => 'a" where
```
```    39   "glb S po == greatest (%x. \<forall>y\<in>S. (x,y): order po) po"
```
```    40
```
```    41 definition isLub :: "['a set, 'a potype, 'a] => bool" where
```
```    42   "isLub S po == %L. (L: pset po & (\<forall>y\<in>S. (y,L): order po) &
```
```    43                    (\<forall>z\<in>pset po. (\<forall>y\<in>S. (y,z): order po) --> (L,z): order po))"
```
```    44
```
```    45 definition isGlb :: "['a set, 'a potype, 'a] => bool" where
```
```    46   "isGlb S po == %G. (G: pset po & (\<forall>y\<in>S. (G,y): order po) &
```
```    47                  (\<forall>z \<in> pset po. (\<forall>y\<in>S. (z,y): order po) --> (z,G): order po))"
```
```    48
```
```    49 definition "fix"    :: "[('a => 'a), 'a set] => 'a set" where
```
```    50   "fix f A  == {x. x: A & f x = x}"
```
```    51
```
```    52 definition interval :: "[('a*'a) set,'a, 'a ] => 'a set" where
```
```    53   "interval r a b == {x. (a,x): r & (x,b): r}"
```
```    54
```
```    55 definition Bot :: "'a potype => 'a" where
```
```    56   "Bot po == least (%x. True) po"
```
```    57
```
```    58 definition Top :: "'a potype => 'a" where
```
```    59   "Top po == greatest (%x. True) po"
```
```    60
```
```    61 definition PartialOrder :: "('a potype) set" where
```
```    62   "PartialOrder == {P. refl_on (pset P) (order P) & antisym (order P) &
```
```    63                        trans (order P)}"
```
```    64
```
```    65 definition CompleteLattice :: "('a potype) set" where
```
```    66   "CompleteLattice == {cl. cl: PartialOrder &
```
```    67                         (\<forall>S. S \<subseteq> pset cl --> (\<exists>L. isLub S cl L)) &
```
```    68                         (\<forall>S. S \<subseteq> pset cl --> (\<exists>G. isGlb S cl G))}"
```
```    69
```
```    70 definition induced :: "['a set, ('a * 'a) set] => ('a *'a)set" where
```
```    71   "induced A r == {(a,b). a : A & b: A & (a,b): r}"
```
```    72
```
```    73 definition sublattice :: "('a potype * 'a set)set" where
```
```    74   "sublattice ==
```
```    75       SIGMA cl: CompleteLattice.
```
```    76           {S. S \<subseteq> pset cl &
```
```    77            (| pset = S, order = induced S (order cl) |): CompleteLattice }"
```
```    78
```
```    79 abbreviation
```
```    80   sublattice_syntax :: "['a set, 'a potype] => bool" ("_ <<= _" [51, 50] 50)
```
```    81   where "S <<= cl \<equiv> S : sublattice `` {cl}"
```
```    82
```
```    83 definition dual :: "'a potype => 'a potype" where
```
```    84   "dual po == (| pset = pset po, order = converse (order po) |)"
```
```    85
```
```    86 locale PO =
```
```    87   fixes cl :: "'a potype"
```
```    88     and A  :: "'a set"
```
```    89     and r  :: "('a * 'a) set"
```
```    90   assumes cl_po:  "cl : PartialOrder"
```
```    91   defines A_def: "A == pset cl"
```
```    92      and  r_def: "r == order cl"
```
```    93
```
```    94 locale CL = PO +
```
```    95   assumes cl_co:  "cl : CompleteLattice"
```
```    96
```
```    97 definition CLF_set :: "('a potype * ('a => 'a)) set" where
```
```    98   "CLF_set = (SIGMA cl: CompleteLattice.
```
```    99             {f. f: pset cl -> pset cl & monotone f (pset cl) (order cl)})"
```
```   100
```
```   101 locale CLF = CL +
```
```   102   fixes f :: "'a => 'a"
```
```   103     and P :: "'a set"
```
```   104   assumes f_cl:  "(cl,f) : CLF_set" (*was the equivalent "f : CLF``{cl}"*)
```
```   105   defines P_def: "P == fix f A"
```
```   106
```
```   107
```
```   108 locale Tarski = CLF +
```
```   109   fixes Y     :: "'a set"
```
```   110     and intY1 :: "'a set"
```
```   111     and v     :: "'a"
```
```   112   assumes
```
```   113     Y_ss: "Y \<subseteq> P"
```
```   114   defines
```
```   115     intY1_def: "intY1 == interval r (lub Y cl) (Top cl)"
```
```   116     and v_def: "v == glb {x. ((%x: intY1. f x) x, x): induced intY1 r &
```
```   117                              x: intY1}
```
```   118                       (| pset=intY1, order=induced intY1 r|)"
```
```   119
```
```   120
```
```   121 subsection {* Partial Order *}
```
```   122
```
```   123 lemma (in PO) PO_imp_refl_on: "refl_on A r"
```
```   124 apply (insert cl_po)
```
```   125 apply (simp add: PartialOrder_def A_def r_def)
```
```   126 done
```
```   127
```
```   128 lemma (in PO) PO_imp_sym: "antisym r"
```
```   129 apply (insert cl_po)
```
```   130 apply (simp add: PartialOrder_def r_def)
```
```   131 done
```
```   132
```
```   133 lemma (in PO) PO_imp_trans: "trans r"
```
```   134 apply (insert cl_po)
```
```   135 apply (simp add: PartialOrder_def r_def)
```
```   136 done
```
```   137
```
```   138 lemma (in PO) reflE: "x \<in> A ==> (x, x) \<in> r"
```
```   139 apply (insert cl_po)
```
```   140 apply (simp add: PartialOrder_def refl_on_def A_def r_def)
```
```   141 done
```
```   142
```
```   143 lemma (in PO) antisymE: "[| (a, b) \<in> r; (b, a) \<in> r |] ==> a = b"
```
```   144 apply (insert cl_po)
```
```   145 apply (simp add: PartialOrder_def antisym_def r_def)
```
```   146 done
```
```   147
```
```   148 lemma (in PO) transE: "[| (a, b) \<in> r; (b, c) \<in> r|] ==> (a,c) \<in> r"
```
```   149 apply (insert cl_po)
```
```   150 apply (simp add: PartialOrder_def r_def)
```
```   151 apply (unfold trans_def, fast)
```
```   152 done
```
```   153
```
```   154 lemma (in PO) monotoneE:
```
```   155      "[| monotone f A r;  x \<in> A; y \<in> A; (x, y) \<in> r |] ==> (f x, f y) \<in> r"
```
```   156 by (simp add: monotone_def)
```
```   157
```
```   158 lemma (in PO) po_subset_po:
```
```   159      "S \<subseteq> A ==> (| pset = S, order = induced S r |) \<in> PartialOrder"
```
```   160 apply (simp (no_asm) add: PartialOrder_def)
```
```   161 apply auto
```
```   162 -- {* refl *}
```
```   163 apply (simp add: refl_on_def induced_def)
```
```   164 apply (blast intro: reflE)
```
```   165 -- {* antisym *}
```
```   166 apply (simp add: antisym_def induced_def)
```
```   167 apply (blast intro: antisymE)
```
```   168 -- {* trans *}
```
```   169 apply (simp add: trans_def induced_def)
```
```   170 apply (blast intro: transE)
```
```   171 done
```
```   172
```
```   173 lemma (in PO) indE: "[| (x, y) \<in> induced S r; S \<subseteq> A |] ==> (x, y) \<in> r"
```
```   174 by (simp add: add: induced_def)
```
```   175
```
```   176 lemma (in PO) indI: "[| (x, y) \<in> r; x \<in> S; y \<in> S |] ==> (x, y) \<in> induced S r"
```
```   177 by (simp add: add: induced_def)
```
```   178
```
```   179 lemma (in CL) CL_imp_ex_isLub: "S \<subseteq> A ==> \<exists>L. isLub S cl L"
```
```   180 apply (insert cl_co)
```
```   181 apply (simp add: CompleteLattice_def A_def)
```
```   182 done
```
```   183
```
```   184 declare (in CL) cl_co [simp]
```
```   185
```
```   186 lemma isLub_lub: "(\<exists>L. isLub S cl L) = isLub S cl (lub S cl)"
```
```   187 by (simp add: lub_def least_def isLub_def some_eq_ex [symmetric])
```
```   188
```
```   189 lemma isGlb_glb: "(\<exists>G. isGlb S cl G) = isGlb S cl (glb S cl)"
```
```   190 by (simp add: glb_def greatest_def isGlb_def some_eq_ex [symmetric])
```
```   191
```
```   192 lemma isGlb_dual_isLub: "isGlb S cl = isLub S (dual cl)"
```
```   193 by (simp add: isLub_def isGlb_def dual_def converse_def)
```
```   194
```
```   195 lemma isLub_dual_isGlb: "isLub S cl = isGlb S (dual cl)"
```
```   196 by (simp add: isLub_def isGlb_def dual_def converse_def)
```
```   197
```
```   198 lemma (in PO) dualPO: "dual cl \<in> PartialOrder"
```
```   199 apply (insert cl_po)
```
```   200 apply (simp add: PartialOrder_def dual_def refl_on_converse
```
```   201                  trans_converse antisym_converse)
```
```   202 done
```
```   203
```
```   204 lemma Rdual:
```
```   205      "\<forall>S. (S \<subseteq> A -->( \<exists>L. isLub S (| pset = A, order = r|) L))
```
```   206       ==> \<forall>S. (S \<subseteq> A --> (\<exists>G. isGlb S (| pset = A, order = r|) G))"
```
```   207 apply safe
```
```   208 apply (rule_tac x = "lub {y. y \<in> A & (\<forall>k \<in> S. (y, k) \<in> r)}
```
```   209                       (|pset = A, order = r|) " in exI)
```
```   210 apply (drule_tac x = "{y. y \<in> A & (\<forall>k \<in> S. (y,k) \<in> r) }" in spec)
```
```   211 apply (drule mp, fast)
```
```   212 apply (simp add: isLub_lub isGlb_def)
```
```   213 apply (simp add: isLub_def, blast)
```
```   214 done
```
```   215
```
```   216 lemma lub_dual_glb: "lub S cl = glb S (dual cl)"
```
```   217 by (simp add: lub_def glb_def least_def greatest_def dual_def converse_def)
```
```   218
```
```   219 lemma glb_dual_lub: "glb S cl = lub S (dual cl)"
```
```   220 by (simp add: lub_def glb_def least_def greatest_def dual_def converse_def)
```
```   221
```
```   222 lemma CL_subset_PO: "CompleteLattice \<subseteq> PartialOrder"
```
```   223 by (simp add: PartialOrder_def CompleteLattice_def, fast)
```
```   224
```
```   225 lemmas CL_imp_PO = CL_subset_PO [THEN subsetD]
```
```   226
```
```   227 declare PO.PO_imp_refl_on  [OF PO.intro [OF CL_imp_PO], simp]
```
```   228 declare PO.PO_imp_sym   [OF PO.intro [OF CL_imp_PO], simp]
```
```   229 declare PO.PO_imp_trans [OF PO.intro [OF CL_imp_PO], simp]
```
```   230
```
```   231 lemma (in CL) CO_refl_on: "refl_on A r"
```
```   232 by (rule PO_imp_refl_on)
```
```   233
```
```   234 lemma (in CL) CO_antisym: "antisym r"
```
```   235 by (rule PO_imp_sym)
```
```   236
```
```   237 lemma (in CL) CO_trans: "trans r"
```
```   238 by (rule PO_imp_trans)
```
```   239
```
```   240 lemma CompleteLatticeI:
```
```   241      "[| po \<in> PartialOrder; (\<forall>S. S \<subseteq> pset po --> (\<exists>L. isLub S po L));
```
```   242          (\<forall>S. S \<subseteq> pset po --> (\<exists>G. isGlb S po G))|]
```
```   243       ==> po \<in> CompleteLattice"
```
```   244 apply (unfold CompleteLattice_def, blast)
```
```   245 done
```
```   246
```
```   247 lemma (in CL) CL_dualCL: "dual cl \<in> CompleteLattice"
```
```   248 apply (insert cl_co)
```
```   249 apply (simp add: CompleteLattice_def dual_def)
```
```   250 apply (fold dual_def)
```
```   251 apply (simp add: isLub_dual_isGlb [symmetric] isGlb_dual_isLub [symmetric]
```
```   252                  dualPO)
```
```   253 done
```
```   254
```
```   255 lemma (in PO) dualA_iff: "pset (dual cl) = pset cl"
```
```   256 by (simp add: dual_def)
```
```   257
```
```   258 lemma (in PO) dualr_iff: "((x, y) \<in> (order(dual cl))) = ((y, x) \<in> order cl)"
```
```   259 by (simp add: dual_def)
```
```   260
```
```   261 lemma (in PO) monotone_dual:
```
```   262      "monotone f (pset cl) (order cl)
```
```   263      ==> monotone f (pset (dual cl)) (order(dual cl))"
```
```   264 by (simp add: monotone_def dualA_iff dualr_iff)
```
```   265
```
```   266 lemma (in PO) interval_dual:
```
```   267      "[| x \<in> A; y \<in> A|] ==> interval r x y = interval (order(dual cl)) y x"
```
```   268 apply (simp add: interval_def dualr_iff)
```
```   269 apply (fold r_def, fast)
```
```   270 done
```
```   271
```
```   272 lemma (in PO) interval_not_empty:
```
```   273      "[| trans r; interval r a b \<noteq> {} |] ==> (a, b) \<in> r"
```
```   274 apply (simp add: interval_def)
```
```   275 apply (unfold trans_def, blast)
```
```   276 done
```
```   277
```
```   278 lemma (in PO) interval_imp_mem: "x \<in> interval r a b ==> (a, x) \<in> r"
```
```   279 by (simp add: interval_def)
```
```   280
```
```   281 lemma (in PO) left_in_interval:
```
```   282      "[| a \<in> A; b \<in> A; interval r a b \<noteq> {} |] ==> a \<in> interval r a b"
```
```   283 apply (simp (no_asm_simp) add: interval_def)
```
```   284 apply (simp add: PO_imp_trans interval_not_empty)
```
```   285 apply (simp add: reflE)
```
```   286 done
```
```   287
```
```   288 lemma (in PO) right_in_interval:
```
```   289      "[| a \<in> A; b \<in> A; interval r a b \<noteq> {} |] ==> b \<in> interval r a b"
```
```   290 apply (simp (no_asm_simp) add: interval_def)
```
```   291 apply (simp add: PO_imp_trans interval_not_empty)
```
```   292 apply (simp add: reflE)
```
```   293 done
```
```   294
```
```   295
```
```   296 subsection {* sublattice *}
```
```   297
```
```   298 lemma (in PO) sublattice_imp_CL:
```
```   299      "S <<= cl  ==> (| pset = S, order = induced S r |) \<in> CompleteLattice"
```
```   300 by (simp add: sublattice_def CompleteLattice_def A_def r_def)
```
```   301
```
```   302 lemma (in CL) sublatticeI:
```
```   303      "[| S \<subseteq> A; (| pset = S, order = induced S r |) \<in> CompleteLattice |]
```
```   304       ==> S <<= cl"
```
```   305 by (simp add: sublattice_def A_def r_def)
```
```   306
```
```   307
```
```   308 subsection {* lub *}
```
```   309
```
```   310 lemma (in CL) lub_unique: "[| S \<subseteq> A; isLub S cl x; isLub S cl L|] ==> x = L"
```
```   311 apply (rule antisymE)
```
```   312 apply (auto simp add: isLub_def r_def)
```
```   313 done
```
```   314
```
```   315 lemma (in CL) lub_upper: "[|S \<subseteq> A; x \<in> S|] ==> (x, lub S cl) \<in> r"
```
```   316 apply (rule CL_imp_ex_isLub [THEN exE], assumption)
```
```   317 apply (unfold lub_def least_def)
```
```   318 apply (rule some_equality [THEN ssubst])
```
```   319   apply (simp add: isLub_def)
```
```   320  apply (simp add: lub_unique A_def isLub_def)
```
```   321 apply (simp add: isLub_def r_def)
```
```   322 done
```
```   323
```
```   324 lemma (in CL) lub_least:
```
```   325      "[| S \<subseteq> A; L \<in> A; \<forall>x \<in> S. (x,L) \<in> r |] ==> (lub S cl, L) \<in> r"
```
```   326 apply (rule CL_imp_ex_isLub [THEN exE], assumption)
```
```   327 apply (unfold lub_def least_def)
```
```   328 apply (rule_tac s=x in some_equality [THEN ssubst])
```
```   329   apply (simp add: isLub_def)
```
```   330  apply (simp add: lub_unique A_def isLub_def)
```
```   331 apply (simp add: isLub_def r_def A_def)
```
```   332 done
```
```   333
```
```   334 lemma (in CL) lub_in_lattice: "S \<subseteq> A ==> lub S cl \<in> A"
```
```   335 apply (rule CL_imp_ex_isLub [THEN exE], assumption)
```
```   336 apply (unfold lub_def least_def)
```
```   337 apply (subst some_equality)
```
```   338 apply (simp add: isLub_def)
```
```   339 prefer 2 apply (simp add: isLub_def A_def)
```
```   340 apply (simp add: lub_unique A_def isLub_def)
```
```   341 done
```
```   342
```
```   343 lemma (in CL) lubI:
```
```   344      "[| S \<subseteq> A; L \<in> A; \<forall>x \<in> S. (x,L) \<in> r;
```
```   345          \<forall>z \<in> A. (\<forall>y \<in> S. (y,z) \<in> r) --> (L,z) \<in> r |] ==> L = lub S cl"
```
```   346 apply (rule lub_unique, assumption)
```
```   347 apply (simp add: isLub_def A_def r_def)
```
```   348 apply (unfold isLub_def)
```
```   349 apply (rule conjI)
```
```   350 apply (fold A_def r_def)
```
```   351 apply (rule lub_in_lattice, assumption)
```
```   352 apply (simp add: lub_upper lub_least)
```
```   353 done
```
```   354
```
```   355 lemma (in CL) lubIa: "[| S \<subseteq> A; isLub S cl L |] ==> L = lub S cl"
```
```   356 by (simp add: lubI isLub_def A_def r_def)
```
```   357
```
```   358 lemma (in CL) isLub_in_lattice: "isLub S cl L ==> L \<in> A"
```
```   359 by (simp add: isLub_def  A_def)
```
```   360
```
```   361 lemma (in CL) isLub_upper: "[|isLub S cl L; y \<in> S|] ==> (y, L) \<in> r"
```
```   362 by (simp add: isLub_def r_def)
```
```   363
```
```   364 lemma (in CL) isLub_least:
```
```   365      "[| isLub S cl L; z \<in> A; \<forall>y \<in> S. (y, z) \<in> r|] ==> (L, z) \<in> r"
```
```   366 by (simp add: isLub_def A_def r_def)
```
```   367
```
```   368 lemma (in CL) isLubI:
```
```   369      "[| L \<in> A; \<forall>y \<in> S. (y, L) \<in> r;
```
```   370          (\<forall>z \<in> A. (\<forall>y \<in> S. (y, z):r) --> (L, z) \<in> r)|] ==> isLub S cl L"
```
```   371 by (simp add: isLub_def A_def r_def)
```
```   372
```
```   373
```
```   374
```
```   375 subsection {* glb *}
```
```   376
```
```   377 lemma (in CL) glb_in_lattice: "S \<subseteq> A ==> glb S cl \<in> A"
```
```   378 apply (subst glb_dual_lub)
```
```   379 apply (simp add: A_def)
```
```   380 apply (rule dualA_iff [THEN subst])
```
```   381 apply (rule CL.lub_in_lattice)
```
```   382 apply (rule CL.intro)
```
```   383 apply (rule PO.intro)
```
```   384 apply (rule dualPO)
```
```   385 apply (rule CL_axioms.intro)
```
```   386 apply (rule CL_dualCL)
```
```   387 apply (simp add: dualA_iff)
```
```   388 done
```
```   389
```
```   390 lemma (in CL) glb_lower: "[|S \<subseteq> A; x \<in> S|] ==> (glb S cl, x) \<in> r"
```
```   391 apply (subst glb_dual_lub)
```
```   392 apply (simp add: r_def)
```
```   393 apply (rule dualr_iff [THEN subst])
```
```   394 apply (rule CL.lub_upper)
```
```   395 apply (rule CL.intro)
```
```   396 apply (rule PO.intro)
```
```   397 apply (rule dualPO)
```
```   398 apply (rule CL_axioms.intro)
```
```   399 apply (rule CL_dualCL)
```
```   400 apply (simp add: dualA_iff A_def, assumption)
```
```   401 done
```
```   402
```
```   403 text {*
```
```   404   Reduce the sublattice property by using substructural properties;
```
```   405   abandoned see @{text "Tarski_4.ML"}.
```
```   406 *}
```
```   407
```
```   408 declare (in CLF) f_cl [simp]
```
```   409
```
```   410 (*never proved, 2007-01-22: Tarski__CLF_unnamed_lemma
```
```   411   NOT PROVABLE because of the conjunction used in the definition: we don't
```
```   412   allow reasoning with rules like conjE, which is essential here.*)
```
```   413 declare [[ sledgehammer_problem_prefix = "Tarski__CLF_unnamed_lemma" ]]
```
```   414 lemma (in CLF) [simp]:
```
```   415     "f: pset cl -> pset cl & monotone f (pset cl) (order cl)"
```
```   416 apply (insert f_cl)
```
```   417 apply (unfold CLF_set_def)
```
```   418 apply (erule SigmaE2)
```
```   419 apply (erule CollectE)
```
```   420 apply assumption
```
```   421 done
```
```   422
```
```   423 lemma (in CLF) f_in_funcset: "f \<in> A -> A"
```
```   424 by (simp add: A_def)
```
```   425
```
```   426 lemma (in CLF) monotone_f: "monotone f A r"
```
```   427 by (simp add: A_def r_def)
```
```   428
```
```   429 (*never proved, 2007-01-22*)
```
```   430 declare [[ sledgehammer_problem_prefix = "Tarski__CLF_CLF_dual" ]]
```
```   431 declare (in CLF) CLF_set_def [simp] CL_dualCL [simp] monotone_dual [simp] dualA_iff [simp]
```
```   432
```
```   433 lemma (in CLF) CLF_dual: "(dual cl, f) \<in> CLF_set"
```
```   434 apply (simp del: dualA_iff)
```
```   435 apply (simp)
```
```   436 done
```
```   437
```
```   438 declare (in CLF) CLF_set_def[simp del] CL_dualCL[simp del] monotone_dual[simp del]
```
```   439           dualA_iff[simp del]
```
```   440
```
```   441
```
```   442 subsection {* fixed points *}
```
```   443
```
```   444 lemma fix_subset: "fix f A \<subseteq> A"
```
```   445 by (simp add: fix_def, fast)
```
```   446
```
```   447 lemma fix_imp_eq: "x \<in> fix f A ==> f x = x"
```
```   448 by (simp add: fix_def)
```
```   449
```
```   450 lemma fixf_subset:
```
```   451      "[| A \<subseteq> B; x \<in> fix (%y: A. f y) A |] ==> x \<in> fix f B"
```
```   452 by (simp add: fix_def, auto)
```
```   453
```
```   454
```
```   455 subsection {* lemmas for Tarski, lub *}
```
```   456
```
```   457 (*never proved, 2007-01-22*)
```
```   458 declare [[ sledgehammer_problem_prefix = "Tarski__CLF_lubH_le_flubH" ]]
```
```   459   declare CL.lub_least[intro] CLF.f_in_funcset[intro] funcset_mem[intro] CL.lub_in_lattice[intro] PO.transE[intro] PO.monotoneE[intro] CLF.monotone_f[intro] CL.lub_upper[intro]
```
```   460 lemma (in CLF) lubH_le_flubH:
```
```   461      "H = {x. (x, f x) \<in> r & x \<in> A} ==> (lub H cl, f (lub H cl)) \<in> r"
```
```   462 apply (rule lub_least, fast)
```
```   463 apply (rule f_in_funcset [THEN funcset_mem])
```
```   464 apply (rule lub_in_lattice, fast)
```
```   465 -- {* @{text "\<forall>x:H. (x, f (lub H r)) \<in> r"} *}
```
```   466 apply (rule ballI)
```
```   467 (*never proved, 2007-01-22*)
```
```   468 using [[ sledgehammer_problem_prefix = "Tarski__CLF_lubH_le_flubH_simpler" ]]
```
```   469 apply (rule transE)
```
```   470 -- {* instantiates @{text "(x, ?z) \<in> order cl to (x, f x)"}, *}
```
```   471 -- {* because of the def of @{text H} *}
```
```   472 apply fast
```
```   473 -- {* so it remains to show @{text "(f x, f (lub H cl)) \<in> r"} *}
```
```   474 apply (rule_tac f = "f" in monotoneE)
```
```   475 apply (rule monotone_f, fast)
```
```   476 apply (rule lub_in_lattice, fast)
```
```   477 apply (rule lub_upper, fast)
```
```   478 apply assumption
```
```   479 done
```
```   480   declare CL.lub_least[rule del] CLF.f_in_funcset[rule del]
```
```   481           funcset_mem[rule del] CL.lub_in_lattice[rule del]
```
```   482           PO.transE[rule del] PO.monotoneE[rule del]
```
```   483           CLF.monotone_f[rule del] CL.lub_upper[rule del]
```
```   484
```
```   485 (*never proved, 2007-01-22*)
```
```   486 declare [[ sledgehammer_problem_prefix = "Tarski__CLF_flubH_le_lubH" ]]
```
```   487   declare CLF.f_in_funcset[intro] funcset_mem[intro] CL.lub_in_lattice[intro]
```
```   488        PO.monotoneE[intro] CLF.monotone_f[intro] CL.lub_upper[intro]
```
```   489        CLF.lubH_le_flubH[simp]
```
```   490 lemma (in CLF) flubH_le_lubH:
```
```   491      "[|  H = {x. (x, f x) \<in> r & x \<in> A} |] ==> (f (lub H cl), lub H cl) \<in> r"
```
```   492 apply (rule lub_upper, fast)
```
```   493 apply (rule_tac t = "H" in ssubst, assumption)
```
```   494 apply (rule CollectI)
```
```   495 apply (rule conjI)
```
```   496 using [[ sledgehammer_problem_prefix = "Tarski__CLF_flubH_le_lubH_simpler" ]]
```
```   497 (*??no longer terminates, with combinators
```
```   498 apply (metis CO_refl_on lubH_le_flubH monotone_def monotone_f reflD1 reflD2)
```
```   499 *)
```
```   500 apply (metis CO_refl_on lubH_le_flubH monotoneE [OF monotone_f] refl_onD1 refl_onD2)
```
```   501 apply (metis CO_refl_on lubH_le_flubH refl_onD2)
```
```   502 done
```
```   503   declare CLF.f_in_funcset[rule del] funcset_mem[rule del]
```
```   504           CL.lub_in_lattice[rule del] PO.monotoneE[rule del]
```
```   505           CLF.monotone_f[rule del] CL.lub_upper[rule del]
```
```   506           CLF.lubH_le_flubH[simp del]
```
```   507
```
```   508
```
```   509 (*never proved, 2007-01-22*)
```
```   510 declare [[ sledgehammer_problem_prefix = "Tarski__CLF_lubH_is_fixp" ]]
```
```   511 (* Single-step version fails. The conjecture clauses refer to local abstraction
```
```   512 functions (Frees). *)
```
```   513 lemma (in CLF) lubH_is_fixp:
```
```   514      "H = {x. (x, f x) \<in> r & x \<in> A} ==> lub H cl \<in> fix f A"
```
```   515 apply (simp add: fix_def)
```
```   516 apply (rule conjI)
```
```   517 proof -
```
```   518   assume A1: "H = {x. (x, f x) \<in> r \<and> x \<in> A}"
```
```   519   have F1: "\<forall>x\<^isub>2. (\<lambda>R. R \<in> x\<^isub>2) = x\<^isub>2" by (metis Collect_def Collect_mem_eq)
```
```   520   have F2: "\<forall>x\<^isub>1 x\<^isub>2. (\<lambda>R. x\<^isub>2 (x\<^isub>1 R)) = x\<^isub>1 -` x\<^isub>2"
```
```   521     by (metis Collect_def vimage_Collect_eq)
```
```   522   have F3: "\<forall>x\<^isub>2 x\<^isub>1. (\<lambda>R. x\<^isub>1 R \<in> x\<^isub>2) = x\<^isub>1 -` x\<^isub>2"
```
```   523     by (metis Collect_def vimage_def)
```
```   524   have F4: "\<forall>x\<^isub>3 x\<^isub>1. (\<lambda>R. x\<^isub>1 R \<and> x\<^isub>3 R) = x\<^isub>1 \<inter> x\<^isub>3"
```
```   525     by (metis Collect_def Collect_conj_eq)
```
```   526   have F5: "(\<lambda>R. (R, f R) \<in> r \<and> R \<in> A) = H" using A1 by (metis Collect_def)
```
```   527   have F6: "\<forall>x\<^isub>1\<subseteq>A. glb x\<^isub>1 (dual cl) \<in> A" by (metis lub_dual_glb lub_in_lattice)
```
```   528   have F7: "\<forall>x\<^isub>2 x\<^isub>1. (\<lambda>R. x\<^isub>1 R \<in> x\<^isub>2) = (\<lambda>R. x\<^isub>2 (x\<^isub>1 R))" by (metis F2 F3)
```
```   529   have "(\<lambda>R. (R, f R) \<in> r \<and> A R) = H" by (metis F1 F5)
```
```   530   hence "A \<inter> (\<lambda>R. r (R, f R)) = H" by (metis F4 F7 Int_commute)
```
```   531   hence "H \<subseteq> A" by (metis Int_lower1)
```
```   532   hence "H \<subseteq> A" by metis
```
```   533   hence "glb H (dual cl) \<in> A" using F6 by metis
```
```   534   hence "glb (\<lambda>R. (R, f R) \<in> r \<and> R \<in> A) (dual cl) \<in> A" using F5 by metis
```
```   535   hence "lub (\<lambda>R. (R, f R) \<in> r \<and> R \<in> A) cl \<in> A" by (metis lub_dual_glb)
```
```   536   thus "lub {x. (x, f x) \<in> r \<and> x \<in> A} cl \<in> A" by (metis Collect_def)
```
```   537 next
```
```   538   assume A1: "H = {x. (x, f x) \<in> r \<and> x \<in> A}"
```
```   539   have F1: "\<forall>v. (\<lambda>R. R \<in> v) = v" by (metis Collect_mem_eq Collect_def)
```
```   540   have F2: "\<forall>w u. (\<lambda>R. u R \<and> w R) = u \<inter> w"
```
```   541     by (metis Collect_conj_eq Collect_def)
```
```   542   have F3: "\<forall>x v. (\<lambda>R. v R \<in> x) = v -` x" by (metis vimage_def Collect_def)
```
```   543   hence F4: "A \<inter> (\<lambda>R. (R, f R)) -` r = H" using A1 by auto
```
```   544   hence F5: "(f (lub H cl), lub H cl) \<in> r"
```
```   545     by (metis F1 F3 F2 Int_commute flubH_le_lubH Collect_def)
```
```   546   have F6: "(lub H cl, f (lub H cl)) \<in> r"
```
```   547     by (metis F1 F3 F2 F4 Int_commute lubH_le_flubH Collect_def)
```
```   548   have "(lub H cl, f (lub H cl)) \<in> r \<longrightarrow> f (lub H cl) = lub H cl"
```
```   549     using F5 by (metis antisymE)
```
```   550   hence "f (lub H cl) = lub H cl" using F6 by metis
```
```   551   thus "H = {x. (x, f x) \<in> r \<and> x \<in> A}
```
```   552         \<Longrightarrow> f (lub {x. (x, f x) \<in> r \<and> x \<in> A} cl) =
```
```   553            lub {x. (x, f x) \<in> r \<and> x \<in> A} cl"
```
```   554     by (metis F4 F2 F3 F1 Collect_def Int_commute)
```
```   555 qed
```
```   556
```
```   557 lemma (in CLF) (*lubH_is_fixp:*)
```
```   558      "H = {x. (x, f x) \<in> r & x \<in> A} ==> lub H cl \<in> fix f A"
```
```   559 apply (simp add: fix_def)
```
```   560 apply (rule conjI)
```
```   561 using [[ sledgehammer_problem_prefix = "Tarski__CLF_lubH_is_fixp_simpler" ]]
```
```   562 apply (metis CO_refl_on lubH_le_flubH refl_onD1)
```
```   563 apply (metis antisymE flubH_le_lubH lubH_le_flubH)
```
```   564 done
```
```   565
```
```   566 lemma (in CLF) fix_in_H:
```
```   567      "[| H = {x. (x, f x) \<in> r & x \<in> A};  x \<in> P |] ==> x \<in> H"
```
```   568 by (simp add: P_def fix_imp_eq [of _ f A] reflE CO_refl_on
```
```   569                     fix_subset [of f A, THEN subsetD])
```
```   570
```
```   571
```
```   572 lemma (in CLF) fixf_le_lubH:
```
```   573      "H = {x. (x, f x) \<in> r & x \<in> A} ==> \<forall>x \<in> fix f A. (x, lub H cl) \<in> r"
```
```   574 apply (rule ballI)
```
```   575 apply (rule lub_upper, fast)
```
```   576 apply (rule fix_in_H)
```
```   577 apply (simp_all add: P_def)
```
```   578 done
```
```   579
```
```   580 declare [[ sledgehammer_problem_prefix = "Tarski__CLF_lubH_least_fixf" ]]
```
```   581 lemma (in CLF) lubH_least_fixf:
```
```   582      "H = {x. (x, f x) \<in> r & x \<in> A}
```
```   583       ==> \<forall>L. (\<forall>y \<in> fix f A. (y,L) \<in> r) --> (lub H cl, L) \<in> r"
```
```   584 apply (metis P_def lubH_is_fixp)
```
```   585 done
```
```   586
```
```   587 subsection {* Tarski fixpoint theorem 1, first part *}
```
```   588 declare [[ sledgehammer_problem_prefix = "Tarski__CLF_T_thm_1_lub" ]]
```
```   589   declare CL.lubI[intro] fix_subset[intro] CL.lub_in_lattice[intro]
```
```   590           CLF.fixf_le_lubH[simp] CLF.lubH_least_fixf[simp]
```
```   591 lemma (in CLF) T_thm_1_lub: "lub P cl = lub {x. (x, f x) \<in> r & x \<in> A} cl"
```
```   592 (*sledgehammer;*)
```
```   593 apply (rule sym)
```
```   594 apply (simp add: P_def)
```
```   595 apply (rule lubI)
```
```   596 using [[ sledgehammer_problem_prefix = "Tarski__CLF_T_thm_1_lub_simpler" ]]
```
```   597 apply (metis P_def fix_subset)
```
```   598 apply (metis Collect_conj_eq Collect_mem_eq Int_commute Int_lower1 lub_in_lattice vimage_def)
```
```   599 (*??no longer terminates, with combinators
```
```   600 apply (metis P_def fix_def fixf_le_lubH)
```
```   601 apply (metis P_def fix_def lubH_least_fixf)
```
```   602 *)
```
```   603 apply (simp add: fixf_le_lubH)
```
```   604 apply (simp add: lubH_least_fixf)
```
```   605 done
```
```   606   declare CL.lubI[rule del] fix_subset[rule del] CL.lub_in_lattice[rule del]
```
```   607           CLF.fixf_le_lubH[simp del] CLF.lubH_least_fixf[simp del]
```
```   608
```
```   609
```
```   610 (*never proved, 2007-01-22*)
```
```   611 declare [[ sledgehammer_problem_prefix = "Tarski__CLF_glbH_is_fixp" ]]
```
```   612   declare glb_dual_lub[simp] PO.dualA_iff[intro] CLF.lubH_is_fixp[intro]
```
```   613           PO.dualPO[intro] CL.CL_dualCL[intro] PO.dualr_iff[simp]
```
```   614 lemma (in CLF) glbH_is_fixp: "H = {x. (f x, x) \<in> r & x \<in> A} ==> glb H cl \<in> P"
```
```   615   -- {* Tarski for glb *}
```
```   616 (*sledgehammer;*)
```
```   617 apply (simp add: glb_dual_lub P_def A_def r_def)
```
```   618 apply (rule dualA_iff [THEN subst])
```
```   619 apply (rule CLF.lubH_is_fixp)
```
```   620 apply (rule CLF.intro)
```
```   621 apply (rule CL.intro)
```
```   622 apply (rule PO.intro)
```
```   623 apply (rule dualPO)
```
```   624 apply (rule CL_axioms.intro)
```
```   625 apply (rule CL_dualCL)
```
```   626 apply (rule CLF_axioms.intro)
```
```   627 apply (rule CLF_dual)
```
```   628 apply (simp add: dualr_iff dualA_iff)
```
```   629 done
```
```   630   declare glb_dual_lub[simp del] PO.dualA_iff[rule del] CLF.lubH_is_fixp[rule del]
```
```   631           PO.dualPO[rule del] CL.CL_dualCL[rule del] PO.dualr_iff[simp del]
```
```   632
```
```   633
```
```   634 (*never proved, 2007-01-22*)
```
```   635 declare [[ sledgehammer_problem_prefix = "Tarski__T_thm_1_glb" ]]  (*ALL THEOREMS*)
```
```   636 lemma (in CLF) T_thm_1_glb: "glb P cl = glb {x. (f x, x) \<in> r & x \<in> A} cl"
```
```   637 (*sledgehammer;*)
```
```   638 apply (simp add: glb_dual_lub P_def A_def r_def)
```
```   639 apply (rule dualA_iff [THEN subst])
```
```   640 (*never proved, 2007-01-22*)
```
```   641 using [[ sledgehammer_problem_prefix = "Tarski__T_thm_1_glb_simpler" ]]  (*ALL THEOREMS*)
```
```   642 (*sledgehammer;*)
```
```   643 apply (simp add: CLF.T_thm_1_lub [of _ f, OF CLF.intro, OF CL.intro CLF_axioms.intro, OF PO.intro CL_axioms.intro,
```
```   644   OF dualPO CL_dualCL] dualPO CL_dualCL CLF_dual dualr_iff)
```
```   645 done
```
```   646
```
```   647 subsection {* interval *}
```
```   648
```
```   649
```
```   650 declare [[ sledgehammer_problem_prefix = "Tarski__rel_imp_elem" ]]
```
```   651   declare (in CLF) CO_refl_on[simp] refl_on_def [simp]
```
```   652 lemma (in CLF) rel_imp_elem: "(x, y) \<in> r ==> x \<in> A"
```
```   653 by (metis CO_refl_on refl_onD1)
```
```   654   declare (in CLF) CO_refl_on[simp del]  refl_on_def [simp del]
```
```   655
```
```   656 declare [[ sledgehammer_problem_prefix = "Tarski__interval_subset" ]]
```
```   657   declare (in CLF) rel_imp_elem[intro]
```
```   658   declare interval_def [simp]
```
```   659 lemma (in CLF) interval_subset: "[| a \<in> A; b \<in> A |] ==> interval r a b \<subseteq> A"
```
```   660 by (metis CO_refl_on interval_imp_mem refl_onD refl_onD2 rel_imp_elem subset_eq)
```
```   661   declare (in CLF) rel_imp_elem[rule del]
```
```   662   declare interval_def [simp del]
```
```   663
```
```   664
```
```   665 lemma (in CLF) intervalI:
```
```   666      "[| (a, x) \<in> r; (x, b) \<in> r |] ==> x \<in> interval r a b"
```
```   667 by (simp add: interval_def)
```
```   668
```
```   669 lemma (in CLF) interval_lemma1:
```
```   670      "[| S \<subseteq> interval r a b; x \<in> S |] ==> (a, x) \<in> r"
```
```   671 by (unfold interval_def, fast)
```
```   672
```
```   673 lemma (in CLF) interval_lemma2:
```
```   674      "[| S \<subseteq> interval r a b; x \<in> S |] ==> (x, b) \<in> r"
```
```   675 by (unfold interval_def, fast)
```
```   676
```
```   677 lemma (in CLF) a_less_lub:
```
```   678      "[| S \<subseteq> A; S \<noteq> {};
```
```   679          \<forall>x \<in> S. (a,x) \<in> r; \<forall>y \<in> S. (y, L) \<in> r |] ==> (a,L) \<in> r"
```
```   680 by (blast intro: transE)
```
```   681
```
```   682 lemma (in CLF) glb_less_b:
```
```   683      "[| S \<subseteq> A; S \<noteq> {};
```
```   684          \<forall>x \<in> S. (x,b) \<in> r; \<forall>y \<in> S. (G, y) \<in> r |] ==> (G,b) \<in> r"
```
```   685 by (blast intro: transE)
```
```   686
```
```   687 lemma (in CLF) S_intv_cl:
```
```   688      "[| a \<in> A; b \<in> A; S \<subseteq> interval r a b |]==> S \<subseteq> A"
```
```   689 by (simp add: subset_trans [OF _ interval_subset])
```
```   690
```
```   691 declare [[ sledgehammer_problem_prefix = "Tarski__L_in_interval" ]]  (*ALL THEOREMS*)
```
```   692 lemma (in CLF) L_in_interval:
```
```   693      "[| a \<in> A; b \<in> A; S \<subseteq> interval r a b;
```
```   694          S \<noteq> {}; isLub S cl L; interval r a b \<noteq> {} |] ==> L \<in> interval r a b"
```
```   695 (*WON'T TERMINATE
```
```   696 apply (metis CO_trans intervalI interval_lemma1 interval_lemma2 isLub_least isLub_upper subset_empty subset_iff trans_def)
```
```   697 *)
```
```   698 apply (rule intervalI)
```
```   699 apply (rule a_less_lub)
```
```   700 prefer 2 apply assumption
```
```   701 apply (simp add: S_intv_cl)
```
```   702 apply (rule ballI)
```
```   703 apply (simp add: interval_lemma1)
```
```   704 apply (simp add: isLub_upper)
```
```   705 -- {* @{text "(L, b) \<in> r"} *}
```
```   706 apply (simp add: isLub_least interval_lemma2)
```
```   707 done
```
```   708
```
```   709 (*never proved, 2007-01-22*)
```
```   710 declare [[ sledgehammer_problem_prefix = "Tarski__G_in_interval" ]]  (*ALL THEOREMS*)
```
```   711 lemma (in CLF) G_in_interval:
```
```   712      "[| a \<in> A; b \<in> A; interval r a b \<noteq> {}; S \<subseteq> interval r a b; isGlb S cl G;
```
```   713          S \<noteq> {} |] ==> G \<in> interval r a b"
```
```   714 apply (simp add: interval_dual)
```
```   715 apply (simp add: CLF.L_in_interval [of _ f, OF CLF.intro, OF CL.intro CLF_axioms.intro, OF PO.intro CL_axioms.intro]
```
```   716                  dualA_iff A_def dualPO CL_dualCL CLF_dual isGlb_dual_isLub)
```
```   717 done
```
```   718
```
```   719 declare [[ sledgehammer_problem_prefix = "Tarski__intervalPO" ]]  (*ALL THEOREMS*)
```
```   720 lemma (in CLF) intervalPO:
```
```   721      "[| a \<in> A; b \<in> A; interval r a b \<noteq> {} |]
```
```   722       ==> (| pset = interval r a b, order = induced (interval r a b) r |)
```
```   723           \<in> PartialOrder"
```
```   724 proof -
```
```   725   assume A1: "a \<in> A"
```
```   726   assume "b \<in> A"
```
```   727   hence "\<forall>u. u \<in> A \<longrightarrow> interval r u b \<subseteq> A" by (metis interval_subset)
```
```   728   hence "interval r a b \<subseteq> A" using A1 by metis
```
```   729   hence "interval r a b \<subseteq> A" by metis
```
```   730   thus ?thesis by (metis po_subset_po)
```
```   731 qed
```
```   732
```
```   733 lemma (in CLF) intv_CL_lub:
```
```   734  "[| a \<in> A; b \<in> A; interval r a b \<noteq> {} |]
```
```   735   ==> \<forall>S. S \<subseteq> interval r a b -->
```
```   736           (\<exists>L. isLub S (| pset = interval r a b,
```
```   737                           order = induced (interval r a b) r |)  L)"
```
```   738 apply (intro strip)
```
```   739 apply (frule S_intv_cl [THEN CL_imp_ex_isLub])
```
```   740 prefer 2 apply assumption
```
```   741 apply assumption
```
```   742 apply (erule exE)
```
```   743 -- {* define the lub for the interval as *}
```
```   744 apply (rule_tac x = "if S = {} then a else L" in exI)
```
```   745 apply (simp (no_asm_simp) add: isLub_def split del: split_if)
```
```   746 apply (intro impI conjI)
```
```   747 -- {* @{text "(if S = {} then a else L) \<in> interval r a b"} *}
```
```   748 apply (simp add: CL_imp_PO L_in_interval)
```
```   749 apply (simp add: left_in_interval)
```
```   750 -- {* lub prop 1 *}
```
```   751 apply (case_tac "S = {}")
```
```   752 -- {* @{text "S = {}, y \<in> S = False => everything"} *}
```
```   753 apply fast
```
```   754 -- {* @{text "S \<noteq> {}"} *}
```
```   755 apply simp
```
```   756 -- {* @{text "\<forall>y:S. (y, L) \<in> induced (interval r a b) r"} *}
```
```   757 apply (rule ballI)
```
```   758 apply (simp add: induced_def  L_in_interval)
```
```   759 apply (rule conjI)
```
```   760 apply (rule subsetD)
```
```   761 apply (simp add: S_intv_cl, assumption)
```
```   762 apply (simp add: isLub_upper)
```
```   763 -- {* @{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"} *}
```
```   764 apply (rule ballI)
```
```   765 apply (rule impI)
```
```   766 apply (case_tac "S = {}")
```
```   767 -- {* @{text "S = {}"} *}
```
```   768 apply simp
```
```   769 apply (simp add: induced_def  interval_def)
```
```   770 apply (rule conjI)
```
```   771 apply (rule reflE, assumption)
```
```   772 apply (rule interval_not_empty)
```
```   773 apply (rule CO_trans)
```
```   774 apply (simp add: interval_def)
```
```   775 -- {* @{text "S \<noteq> {}"} *}
```
```   776 apply simp
```
```   777 apply (simp add: induced_def  L_in_interval)
```
```   778 apply (rule isLub_least, assumption)
```
```   779 apply (rule subsetD)
```
```   780 prefer 2 apply assumption
```
```   781 apply (simp add: S_intv_cl, fast)
```
```   782 done
```
```   783
```
```   784 lemmas (in CLF) intv_CL_glb = intv_CL_lub [THEN Rdual]
```
```   785
```
```   786 (*never proved, 2007-01-22*)
```
```   787 declare [[ sledgehammer_problem_prefix = "Tarski__interval_is_sublattice" ]]  (*ALL THEOREMS*)
```
```   788 lemma (in CLF) interval_is_sublattice:
```
```   789      "[| a \<in> A; b \<in> A; interval r a b \<noteq> {} |]
```
```   790         ==> interval r a b <<= cl"
```
```   791 (*sledgehammer *)
```
```   792 apply (rule sublatticeI)
```
```   793 apply (simp add: interval_subset)
```
```   794 (*never proved, 2007-01-22*)
```
```   795 using [[ sledgehammer_problem_prefix = "Tarski__interval_is_sublattice_simpler" ]]
```
```   796 (*sledgehammer *)
```
```   797 apply (rule CompleteLatticeI)
```
```   798 apply (simp add: intervalPO)
```
```   799  apply (simp add: intv_CL_lub)
```
```   800 apply (simp add: intv_CL_glb)
```
```   801 done
```
```   802
```
```   803 lemmas (in CLF) interv_is_compl_latt =
```
```   804     interval_is_sublattice [THEN sublattice_imp_CL]
```
```   805
```
```   806
```
```   807 subsection {* Top and Bottom *}
```
```   808 lemma (in CLF) Top_dual_Bot: "Top cl = Bot (dual cl)"
```
```   809 by (simp add: Top_def Bot_def least_def greatest_def dualA_iff dualr_iff)
```
```   810
```
```   811 lemma (in CLF) Bot_dual_Top: "Bot cl = Top (dual cl)"
```
```   812 by (simp add: Top_def Bot_def least_def greatest_def dualA_iff dualr_iff)
```
```   813
```
```   814 declare [[ sledgehammer_problem_prefix = "Tarski__Bot_in_lattice" ]]  (*ALL THEOREMS*)
```
```   815 lemma (in CLF) Bot_in_lattice: "Bot cl \<in> A"
```
```   816 (*sledgehammer; *)
```
```   817 apply (simp add: Bot_def least_def)
```
```   818 apply (rule_tac a="glb A cl" in someI2)
```
```   819 apply (simp_all add: glb_in_lattice glb_lower
```
```   820                      r_def [symmetric] A_def [symmetric])
```
```   821 done
```
```   822
```
```   823 (*first proved 2007-01-25 after relaxing relevance*)
```
```   824 declare [[ sledgehammer_problem_prefix = "Tarski__Top_in_lattice" ]]  (*ALL THEOREMS*)
```
```   825 lemma (in CLF) Top_in_lattice: "Top cl \<in> A"
```
```   826 (*sledgehammer;*)
```
```   827 apply (simp add: Top_dual_Bot A_def)
```
```   828 (*first proved 2007-01-25 after relaxing relevance*)
```
```   829 using [[ sledgehammer_problem_prefix = "Tarski__Top_in_lattice_simpler" ]]  (*ALL THEOREMS*)
```
```   830 (*sledgehammer*)
```
```   831 apply (rule dualA_iff [THEN subst])
```
```   832 apply (blast intro!: CLF.Bot_in_lattice [OF CLF.intro, OF CL.intro CLF_axioms.intro, OF PO.intro CL_axioms.intro] dualPO CL_dualCL CLF_dual)
```
```   833 done
```
```   834
```
```   835 lemma (in CLF) Top_prop: "x \<in> A ==> (x, Top cl) \<in> r"
```
```   836 apply (simp add: Top_def greatest_def)
```
```   837 apply (rule_tac a="lub A cl" in someI2)
```
```   838 apply (rule someI2)
```
```   839 apply (simp_all add: lub_in_lattice lub_upper
```
```   840                      r_def [symmetric] A_def [symmetric])
```
```   841 done
```
```   842
```
```   843 (*never proved, 2007-01-22*)
```
```   844 declare [[ sledgehammer_problem_prefix = "Tarski__Bot_prop" ]]  (*ALL THEOREMS*)
```
```   845 lemma (in CLF) Bot_prop: "x \<in> A ==> (Bot cl, x) \<in> r"
```
```   846 (*sledgehammer*)
```
```   847 apply (simp add: Bot_dual_Top r_def)
```
```   848 apply (rule dualr_iff [THEN subst])
```
```   849 apply (simp add: CLF.Top_prop [of _ f, OF CLF.intro, OF CL.intro CLF_axioms.intro, OF PO.intro CL_axioms.intro]
```
```   850                  dualA_iff A_def dualPO CL_dualCL CLF_dual)
```
```   851 done
```
```   852
```
```   853 declare [[ sledgehammer_problem_prefix = "Tarski__Bot_in_lattice" ]]  (*ALL THEOREMS*)
```
```   854 lemma (in CLF) Top_intv_not_empty: "x \<in> A  ==> interval r x (Top cl) \<noteq> {}"
```
```   855 apply (metis Top_in_lattice Top_prop empty_iff intervalI reflE)
```
```   856 done
```
```   857
```
```   858 declare [[ sledgehammer_problem_prefix = "Tarski__Bot_intv_not_empty" ]]  (*ALL THEOREMS*)
```
```   859 lemma (in CLF) Bot_intv_not_empty: "x \<in> A ==> interval r (Bot cl) x \<noteq> {}"
```
```   860 apply (metis Bot_prop ex_in_conv intervalI reflE rel_imp_elem)
```
```   861 done
```
```   862
```
```   863
```
```   864 subsection {* fixed points form a partial order *}
```
```   865
```
```   866 lemma (in CLF) fixf_po: "(| pset = P, order = induced P r|) \<in> PartialOrder"
```
```   867 by (simp add: P_def fix_subset po_subset_po)
```
```   868
```
```   869 (*first proved 2007-01-25 after relaxing relevance*)
```
```   870 declare [[ sledgehammer_problem_prefix = "Tarski__Y_subset_A" ]]
```
```   871   declare (in Tarski) P_def[simp] Y_ss [simp]
```
```   872   declare fix_subset [intro] subset_trans [intro]
```
```   873 lemma (in Tarski) Y_subset_A: "Y \<subseteq> A"
```
```   874 (*sledgehammer*)
```
```   875 apply (rule subset_trans [OF _ fix_subset])
```
```   876 apply (rule Y_ss [simplified P_def])
```
```   877 done
```
```   878   declare (in Tarski) P_def[simp del] Y_ss [simp del]
```
```   879   declare fix_subset [rule del] subset_trans [rule del]
```
```   880
```
```   881
```
```   882 lemma (in Tarski) lubY_in_A: "lub Y cl \<in> A"
```
```   883   by (rule Y_subset_A [THEN lub_in_lattice])
```
```   884
```
```   885 (*never proved, 2007-01-22*)
```
```   886 declare [[ sledgehammer_problem_prefix = "Tarski__lubY_le_flubY" ]]  (*ALL THEOREMS*)
```
```   887 lemma (in Tarski) lubY_le_flubY: "(lub Y cl, f (lub Y cl)) \<in> r"
```
```   888 (*sledgehammer*)
```
```   889 apply (rule lub_least)
```
```   890 apply (rule Y_subset_A)
```
```   891 apply (rule f_in_funcset [THEN funcset_mem])
```
```   892 apply (rule lubY_in_A)
```
```   893 -- {* @{text "Y \<subseteq> P ==> f x = x"} *}
```
```   894 apply (rule ballI)
```
```   895 using [[ sledgehammer_problem_prefix = "Tarski__lubY_le_flubY_simpler" ]]  (*ALL THEOREMS*)
```
```   896 (*sledgehammer *)
```
```   897 apply (rule_tac t = "x" in fix_imp_eq [THEN subst])
```
```   898 apply (erule Y_ss [simplified P_def, THEN subsetD])
```
```   899 -- {* @{text "reduce (f x, f (lub Y cl)) \<in> r to (x, lub Y cl) \<in> r"} by monotonicity *}
```
```   900 using [[ sledgehammer_problem_prefix = "Tarski__lubY_le_flubY_simplest" ]]  (*ALL THEOREMS*)
```
```   901 (*sledgehammer*)
```
```   902 apply (rule_tac f = "f" in monotoneE)
```
```   903 apply (rule monotone_f)
```
```   904 apply (simp add: Y_subset_A [THEN subsetD])
```
```   905 apply (rule lubY_in_A)
```
```   906 apply (simp add: lub_upper Y_subset_A)
```
```   907 done
```
```   908
```
```   909 (*first proved 2007-01-25 after relaxing relevance*)
```
```   910 declare [[ sledgehammer_problem_prefix = "Tarski__intY1_subset" ]]  (*ALL THEOREMS*)
```
```   911 lemma (in Tarski) intY1_subset: "intY1 \<subseteq> A"
```
```   912 (*sledgehammer*)
```
```   913 apply (unfold intY1_def)
```
```   914 apply (rule interval_subset)
```
```   915 apply (rule lubY_in_A)
```
```   916 apply (rule Top_in_lattice)
```
```   917 done
```
```   918
```
```   919 lemmas (in Tarski) intY1_elem = intY1_subset [THEN subsetD]
```
```   920
```
```   921 (*never proved, 2007-01-22*)
```
```   922 declare [[ sledgehammer_problem_prefix = "Tarski__intY1_f_closed" ]]  (*ALL THEOREMS*)
```
```   923 lemma (in Tarski) intY1_f_closed: "x \<in> intY1 \<Longrightarrow> f x \<in> intY1"
```
```   924 (*sledgehammer*)
```
```   925 apply (simp add: intY1_def  interval_def)
```
```   926 apply (rule conjI)
```
```   927 apply (rule transE)
```
```   928 apply (rule lubY_le_flubY)
```
```   929 -- {* @{text "(f (lub Y cl), f x) \<in> r"} *}
```
```   930 using [[ sledgehammer_problem_prefix = "Tarski__intY1_f_closed_simpler" ]]  (*ALL THEOREMS*)
```
```   931 (*sledgehammer [has been proved before now...]*)
```
```   932 apply (rule_tac f=f in monotoneE)
```
```   933 apply (rule monotone_f)
```
```   934 apply (rule lubY_in_A)
```
```   935 apply (simp add: intY1_def interval_def  intY1_elem)
```
```   936 apply (simp add: intY1_def  interval_def)
```
```   937 -- {* @{text "(f x, Top cl) \<in> r"} *}
```
```   938 apply (rule Top_prop)
```
```   939 apply (rule f_in_funcset [THEN funcset_mem])
```
```   940 apply (simp add: intY1_def interval_def  intY1_elem)
```
```   941 done
```
```   942
```
```   943 declare [[ sledgehammer_problem_prefix = "Tarski__intY1_func" ]]  (*ALL THEOREMS*)
```
```   944 lemma (in Tarski) intY1_func: "(%x: intY1. f x) \<in> intY1 -> intY1"
```
```   945 apply (rule restrict_in_funcset)
```
```   946 apply (metis intY1_f_closed restrict_in_funcset)
```
```   947 done
```
```   948
```
```   949 declare [[ sledgehammer_problem_prefix = "Tarski__intY1_mono" ]]  (*ALL THEOREMS*)
```
```   950 lemma (in Tarski) intY1_mono:
```
```   951      "monotone (%x: intY1. f x) intY1 (induced intY1 r)"
```
```   952 (*sledgehammer *)
```
```   953 apply (auto simp add: monotone_def induced_def intY1_f_closed)
```
```   954 apply (blast intro: intY1_elem monotone_f [THEN monotoneE])
```
```   955 done
```
```   956
```
```   957 (*proof requires relaxing relevance: 2007-01-25*)
```
```   958 declare [[ sledgehammer_problem_prefix = "Tarski__intY1_is_cl" ]]  (*ALL THEOREMS*)
```
```   959 lemma (in Tarski) intY1_is_cl:
```
```   960     "(| pset = intY1, order = induced intY1 r |) \<in> CompleteLattice"
```
```   961 (*sledgehammer*)
```
```   962 apply (unfold intY1_def)
```
```   963 apply (rule interv_is_compl_latt)
```
```   964 apply (rule lubY_in_A)
```
```   965 apply (rule Top_in_lattice)
```
```   966 apply (rule Top_intv_not_empty)
```
```   967 apply (rule lubY_in_A)
```
```   968 done
```
```   969
```
```   970 (*never proved, 2007-01-22*)
```
```   971 declare [[ sledgehammer_problem_prefix = "Tarski__v_in_P" ]]  (*ALL THEOREMS*)
```
```   972 lemma (in Tarski) v_in_P: "v \<in> P"
```
```   973 (*sledgehammer*)
```
```   974 apply (unfold P_def)
```
```   975 apply (rule_tac A = "intY1" in fixf_subset)
```
```   976 apply (rule intY1_subset)
```
```   977 apply (simp add: CLF.glbH_is_fixp [OF CLF.intro, OF CL.intro CLF_axioms.intro, OF PO.intro CL_axioms.intro, OF _ intY1_is_cl, simplified]
```
```   978                  v_def CL_imp_PO intY1_is_cl CLF_set_def intY1_func intY1_mono)
```
```   979 done
```
```   980
```
```   981 declare [[ sledgehammer_problem_prefix = "Tarski__z_in_interval" ]]  (*ALL THEOREMS*)
```
```   982 lemma (in Tarski) z_in_interval:
```
```   983      "[| z \<in> P; \<forall>y\<in>Y. (y, z) \<in> induced P r |] ==> z \<in> intY1"
```
```   984 (*sledgehammer *)
```
```   985 apply (unfold intY1_def P_def)
```
```   986 apply (rule intervalI)
```
```   987 prefer 2
```
```   988  apply (erule fix_subset [THEN subsetD, THEN Top_prop])
```
```   989 apply (rule lub_least)
```
```   990 apply (rule Y_subset_A)
```
```   991 apply (fast elim!: fix_subset [THEN subsetD])
```
```   992 apply (simp add: induced_def)
```
```   993 done
```
```   994
```
```   995 declare [[ sledgehammer_problem_prefix = "Tarski__fz_in_int_rel" ]]  (*ALL THEOREMS*)
```
```   996 lemma (in Tarski) f'z_in_int_rel: "[| z \<in> P; \<forall>y\<in>Y. (y, z) \<in> induced P r |]
```
```   997       ==> ((%x: intY1. f x) z, z) \<in> induced intY1 r"
```
```   998 apply (metis P_def acc_def fix_imp_eq fix_subset indI reflE restrict_apply subset_eq z_in_interval)
```
```   999 done
```
```  1000
```
```  1001 (*never proved, 2007-01-22*)
```
```  1002 declare [[ sledgehammer_problem_prefix = "Tarski__tarski_full_lemma" ]]  (*ALL THEOREMS*)
```
```  1003 lemma (in Tarski) tarski_full_lemma:
```
```  1004      "\<exists>L. isLub Y (| pset = P, order = induced P r |) L"
```
```  1005 apply (rule_tac x = "v" in exI)
```
```  1006 apply (simp add: isLub_def)
```
```  1007 -- {* @{text "v \<in> P"} *}
```
```  1008 apply (simp add: v_in_P)
```
```  1009 apply (rule conjI)
```
```  1010 (*sledgehammer*)
```
```  1011 -- {* @{text v} is lub *}
```
```  1012 -- {* @{text "1. \<forall>y:Y. (y, v) \<in> induced P r"} *}
```
```  1013 apply (rule ballI)
```
```  1014 apply (simp add: induced_def subsetD v_in_P)
```
```  1015 apply (rule conjI)
```
```  1016 apply (erule Y_ss [THEN subsetD])
```
```  1017 apply (rule_tac b = "lub Y cl" in transE)
```
```  1018 apply (rule lub_upper)
```
```  1019 apply (rule Y_subset_A, assumption)
```
```  1020 apply (rule_tac b = "Top cl" in interval_imp_mem)
```
```  1021 apply (simp add: v_def)
```
```  1022 apply (fold intY1_def)
```
```  1023 apply (rule CL.glb_in_lattice [OF CL.intro, OF PO.intro CL_axioms.intro, OF _ intY1_is_cl, simplified])
```
```  1024  apply (simp add: CL_imp_PO intY1_is_cl, force)
```
```  1025 -- {* @{text v} is LEAST ub *}
```
```  1026 apply clarify
```
```  1027 apply (rule indI)
```
```  1028   prefer 3 apply assumption
```
```  1029  prefer 2 apply (simp add: v_in_P)
```
```  1030 apply (unfold v_def)
```
```  1031 (*never proved, 2007-01-22*)
```
```  1032 using [[ sledgehammer_problem_prefix = "Tarski__tarski_full_lemma_simpler" ]]
```
```  1033 (*sledgehammer*)
```
```  1034 apply (rule indE)
```
```  1035 apply (rule_tac [2] intY1_subset)
```
```  1036 (*never proved, 2007-01-22*)
```
```  1037 using [[ sledgehammer_problem_prefix = "Tarski__tarski_full_lemma_simplest" ]]
```
```  1038 (*sledgehammer*)
```
```  1039 apply (rule CL.glb_lower [OF CL.intro, OF PO.intro CL_axioms.intro, OF _ intY1_is_cl, simplified])
```
```  1040   apply (simp add: CL_imp_PO intY1_is_cl)
```
```  1041  apply force
```
```  1042 apply (simp add: induced_def intY1_f_closed z_in_interval)
```
```  1043 apply (simp add: P_def fix_imp_eq [of _ f A] reflE
```
```  1044                  fix_subset [of f A, THEN subsetD])
```
```  1045 done
```
```  1046
```
```  1047 lemma CompleteLatticeI_simp:
```
```  1048      "[| (| pset = A, order = r |) \<in> PartialOrder;
```
```  1049          \<forall>S. S \<subseteq> A --> (\<exists>L. isLub S (| pset = A, order = r |)  L) |]
```
```  1050     ==> (| pset = A, order = r |) \<in> CompleteLattice"
```
```  1051 by (simp add: CompleteLatticeI Rdual)
```
```  1052
```
```  1053
```
```  1054 (*never proved, 2007-01-22*)
```
```  1055 declare [[ sledgehammer_problem_prefix = "Tarski__Tarski_full" ]]
```
```  1056   declare (in CLF) fixf_po[intro] P_def [simp] A_def [simp] r_def [simp]
```
```  1057                Tarski.tarski_full_lemma [intro] cl_po [intro] cl_co [intro]
```
```  1058                CompleteLatticeI_simp [intro]
```
```  1059 theorem (in CLF) Tarski_full:
```
```  1060      "(| pset = P, order = induced P r|) \<in> CompleteLattice"
```
```  1061 (*sledgehammer*)
```
```  1062 apply (rule CompleteLatticeI_simp)
```
```  1063 apply (rule fixf_po, clarify)
```
```  1064 (*never proved, 2007-01-22*)
```
```  1065 using [[ sledgehammer_problem_prefix = "Tarski__Tarski_full_simpler" ]]
```
```  1066 (*sledgehammer*)
```
```  1067 apply (simp add: P_def A_def r_def)
```
```  1068 apply (blast intro!: Tarski.tarski_full_lemma [OF Tarski.intro, OF CLF.intro Tarski_axioms.intro,
```
```  1069   OF CL.intro CLF_axioms.intro, OF PO.intro CL_axioms.intro] cl_po cl_co f_cl)
```
```  1070 done
```
```  1071
```
```  1072 declare (in CLF) fixf_po [rule del] P_def [simp del] A_def [simp del] r_def [simp del]
```
```  1073          Tarski.tarski_full_lemma [rule del] cl_po [rule del] cl_co [rule del]
```
```  1074          CompleteLatticeI_simp [rule del]
```
```  1075
```
```  1076 end
```