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