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