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