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