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