src/HOL/Library/Lub_Glb.thy
author wenzelm
Wed, 17 Jun 2015 11:03:05 +0200
changeset 60500 903bb1495239
parent 58881 b9556a055632
child 61585 a9599d3d7610
permissions -rw-r--r--
isabelle update_cartouches;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
58810
922a233805d2 more standard theory name;
wenzelm
parents: 54263
diff changeset
     1
(*  Title:      HOL/Library/Lub_Glb.thy
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
     2
    Author:     Jacques D. Fleuriot, University of Cambridge
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
     3
    Author:     Amine Chaieb, University of Cambridge *)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
     4
60500
903bb1495239 isabelle update_cartouches;
wenzelm
parents: 58881
diff changeset
     5
section \<open>Definitions of Least Upper Bounds and Greatest Lower Bounds\<close>
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
     6
58810
922a233805d2 more standard theory name;
wenzelm
parents: 54263
diff changeset
     7
theory Lub_Glb
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
     8
imports Complex_Main
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
     9
begin
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    10
60500
903bb1495239 isabelle update_cartouches;
wenzelm
parents: 58881
diff changeset
    11
text \<open>Thanks to suggestions by James Margetson\<close>
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    12
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    13
definition setle :: "'a set \<Rightarrow> 'a::ord \<Rightarrow> bool"  (infixl "*<=" 70)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    14
  where "S *<= x = (ALL y: S. y \<le> x)"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    15
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    16
definition setge :: "'a::ord \<Rightarrow> 'a set \<Rightarrow> bool"  (infixl "<=*" 70)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    17
  where "x <=* S = (ALL y: S. x \<le> y)"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    18
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    19
60500
903bb1495239 isabelle update_cartouches;
wenzelm
parents: 58881
diff changeset
    20
subsection \<open>Rules for the Relations @{text "*<="} and @{text "<=*"}\<close>
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    21
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    22
lemma setleI: "ALL y: S. y \<le> x \<Longrightarrow> S *<= x"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    23
  by (simp add: setle_def)
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
    24
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    25
lemma setleD: "S *<= x \<Longrightarrow> y: S \<Longrightarrow> y \<le> x"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    26
  by (simp add: setle_def)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    27
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    28
lemma setgeI: "ALL y: S. x \<le> y \<Longrightarrow> x <=* S"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    29
  by (simp add: setge_def)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    30
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    31
lemma setgeD: "x <=* S \<Longrightarrow> y: S \<Longrightarrow> x \<le> y"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    32
  by (simp add: setge_def)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    33
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    34
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    35
definition leastP :: "('a \<Rightarrow> bool) \<Rightarrow> 'a::ord \<Rightarrow> bool"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    36
  where "leastP P x = (P x \<and> x <=* Collect P)"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    37
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    38
definition isUb :: "'a set \<Rightarrow> 'a set \<Rightarrow> 'a::ord \<Rightarrow> bool"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    39
  where "isUb R S x = (S *<= x \<and> x: R)"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    40
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    41
definition isLub :: "'a set \<Rightarrow> 'a set \<Rightarrow> 'a::ord \<Rightarrow> bool"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    42
  where "isLub R S x = leastP (isUb R S) x"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    43
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    44
definition ubs :: "'a set \<Rightarrow> 'a::ord set \<Rightarrow> 'a set"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    45
  where "ubs R S = Collect (isUb R S)"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    46
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    47
60500
903bb1495239 isabelle update_cartouches;
wenzelm
parents: 58881
diff changeset
    48
subsection \<open>Rules about the Operators @{term leastP}, @{term ub} and @{term lub}\<close>
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    49
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    50
lemma leastPD1: "leastP P x \<Longrightarrow> P x"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    51
  by (simp add: leastP_def)
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
    52
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    53
lemma leastPD2: "leastP P x \<Longrightarrow> x <=* Collect P"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    54
  by (simp add: leastP_def)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    55
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    56
lemma leastPD3: "leastP P x \<Longrightarrow> y: Collect P \<Longrightarrow> x \<le> y"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    57
  by (blast dest!: leastPD2 setgeD)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    58
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    59
lemma isLubD1: "isLub R S x \<Longrightarrow> S *<= x"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    60
  by (simp add: isLub_def isUb_def leastP_def)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    61
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    62
lemma isLubD1a: "isLub R S x \<Longrightarrow> x: R"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    63
  by (simp add: isLub_def isUb_def leastP_def)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    64
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    65
lemma isLub_isUb: "isLub R S x \<Longrightarrow> isUb R S x"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    66
  unfolding isUb_def by (blast dest: isLubD1 isLubD1a)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    67
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    68
lemma isLubD2: "isLub R S x \<Longrightarrow> y : S \<Longrightarrow> y \<le> x"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    69
  by (blast dest!: isLubD1 setleD)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    70
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    71
lemma isLubD3: "isLub R S x \<Longrightarrow> leastP (isUb R S) x"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    72
  by (simp add: isLub_def)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    73
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    74
lemma isLubI1: "leastP(isUb R S) x \<Longrightarrow> isLub R S x"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    75
  by (simp add: isLub_def)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    76
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    77
lemma isLubI2: "isUb R S x \<Longrightarrow> x <=* Collect (isUb R S) \<Longrightarrow> isLub R S x"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    78
  by (simp add: isLub_def leastP_def)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    79
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    80
lemma isUbD: "isUb R S x \<Longrightarrow> y : S \<Longrightarrow> y \<le> x"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    81
  by (simp add: isUb_def setle_def)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    82
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    83
lemma isUbD2: "isUb R S x \<Longrightarrow> S *<= x"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    84
  by (simp add: isUb_def)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    85
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    86
lemma isUbD2a: "isUb R S x \<Longrightarrow> x: R"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    87
  by (simp add: isUb_def)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    88
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    89
lemma isUbI: "S *<= x \<Longrightarrow> x: R \<Longrightarrow> isUb R S x"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    90
  by (simp add: isUb_def)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    91
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    92
lemma isLub_le_isUb: "isLub R S x \<Longrightarrow> isUb R S y \<Longrightarrow> x \<le> y"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    93
  unfolding isLub_def by (blast intro!: leastPD3)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    94
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    95
lemma isLub_ubs: "isLub R S x \<Longrightarrow> x <=* ubs R S"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    96
  unfolding ubs_def isLub_def by (rule leastPD2)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    97
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    98
lemma isLub_unique: "[| isLub R S x; isLub R S y |] ==> x = (y::'a::linorder)"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
    99
  apply (frule isLub_isUb)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   100
  apply (frule_tac x = y in isLub_isUb)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   101
  apply (blast intro!: order_antisym dest!: isLub_le_isUb)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   102
  done
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   103
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   104
lemma isUb_UNIV_I: "(\<And>y. y \<in> S \<Longrightarrow> y \<le> u) \<Longrightarrow> isUb UNIV S u"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   105
  by (simp add: isUbI setleI)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   106
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
   107
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   108
definition greatestP :: "('a \<Rightarrow> bool) \<Rightarrow> 'a::ord \<Rightarrow> bool"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   109
  where "greatestP P x = (P x \<and> Collect P *<=  x)"
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
   110
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   111
definition isLb :: "'a set \<Rightarrow> 'a set \<Rightarrow> 'a::ord \<Rightarrow> bool"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   112
  where "isLb R S x = (x <=* S \<and> x: R)"
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
   113
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   114
definition isGlb :: "'a set \<Rightarrow> 'a set \<Rightarrow> 'a::ord \<Rightarrow> bool"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   115
  where "isGlb R S x = greatestP (isLb R S) x"
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
   116
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   117
definition lbs :: "'a set \<Rightarrow> 'a::ord set \<Rightarrow> 'a set"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   118
  where "lbs R S = Collect (isLb R S)"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   119
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
   120
60500
903bb1495239 isabelle update_cartouches;
wenzelm
parents: 58881
diff changeset
   121
subsection \<open>Rules about the Operators @{term greatestP}, @{term isLb} and @{term isGlb}\<close>
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
   122
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   123
lemma greatestPD1: "greatestP P x \<Longrightarrow> P x"
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   124
  by (simp add: greatestP_def)
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
   125
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   126
lemma greatestPD2: "greatestP P x \<Longrightarrow> Collect P *<= x"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   127
  by (simp add: greatestP_def)
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
   128
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   129
lemma greatestPD3: "greatestP P x \<Longrightarrow> y: Collect P \<Longrightarrow> x \<ge> y"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   130
  by (blast dest!: greatestPD2 setleD)
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
   131
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   132
lemma isGlbD1: "isGlb R S x \<Longrightarrow> x <=* S"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   133
  by (simp add: isGlb_def isLb_def greatestP_def)
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
   134
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   135
lemma isGlbD1a: "isGlb R S x \<Longrightarrow> x: R"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   136
  by (simp add: isGlb_def isLb_def greatestP_def)
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
   137
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   138
lemma isGlb_isLb: "isGlb R S x \<Longrightarrow> isLb R S x"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   139
  unfolding isLb_def by (blast dest: isGlbD1 isGlbD1a)
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
   140
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   141
lemma isGlbD2: "isGlb R S x \<Longrightarrow> y : S \<Longrightarrow> y \<ge> x"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   142
  by (blast dest!: isGlbD1 setgeD)
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
   143
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   144
lemma isGlbD3: "isGlb R S x \<Longrightarrow> greatestP (isLb R S) x"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   145
  by (simp add: isGlb_def)
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
   146
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   147
lemma isGlbI1: "greatestP (isLb R S) x \<Longrightarrow> isGlb R S x"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   148
  by (simp add: isGlb_def)
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
   149
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   150
lemma isGlbI2: "isLb R S x \<Longrightarrow> Collect (isLb R S) *<= x \<Longrightarrow> isGlb R S x"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   151
  by (simp add: isGlb_def greatestP_def)
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
   152
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   153
lemma isLbD: "isLb R S x \<Longrightarrow> y : S \<Longrightarrow> y \<ge> x"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   154
  by (simp add: isLb_def setge_def)
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
   155
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   156
lemma isLbD2: "isLb R S x \<Longrightarrow> x <=* S "
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   157
  by (simp add: isLb_def)
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
   158
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   159
lemma isLbD2a: "isLb R S x \<Longrightarrow> x: R"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   160
  by (simp add: isLb_def)
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
   161
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   162
lemma isLbI: "x <=* S \<Longrightarrow> x: R \<Longrightarrow> isLb R S x"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   163
  by (simp add: isLb_def)
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
   164
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   165
lemma isGlb_le_isLb: "isGlb R S x \<Longrightarrow> isLb R S y \<Longrightarrow> x \<ge> y"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   166
  unfolding isGlb_def by (blast intro!: greatestPD3)
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
   167
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   168
lemma isGlb_ubs: "isGlb R S x \<Longrightarrow> lbs R S *<= x"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
   169
  unfolding lbs_def isGlb_def by (rule greatestPD2)
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
   170
51342
763c6872bd10 generalized isGlb_unique
hoelzl
parents: 46509
diff changeset
   171
lemma isGlb_unique: "[| isGlb R S x; isGlb R S y |] ==> x = (y::'a::linorder)"
763c6872bd10 generalized isGlb_unique
hoelzl
parents: 46509
diff changeset
   172
  apply (frule isGlb_isLb)
763c6872bd10 generalized isGlb_unique
hoelzl
parents: 46509
diff changeset
   173
  apply (frule_tac x = y in isGlb_isLb)
763c6872bd10 generalized isGlb_unique
hoelzl
parents: 46509
diff changeset
   174
  apply (blast intro!: order_antisym dest!: isGlb_le_isLb)
763c6872bd10 generalized isGlb_unique
hoelzl
parents: 46509
diff changeset
   175
  done
763c6872bd10 generalized isGlb_unique
hoelzl
parents: 46509
diff changeset
   176
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   177
lemma bdd_above_setle: "bdd_above A \<longleftrightarrow> (\<exists>a. A *<= a)"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   178
  by (auto simp: bdd_above_def setle_def)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   179
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   180
lemma bdd_below_setge: "bdd_below A \<longleftrightarrow> (\<exists>a. a <=* A)"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   181
  by (auto simp: bdd_below_def setge_def)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   182
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   183
lemma isLub_cSup: 
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   184
  "(S::'a :: conditionally_complete_lattice set) \<noteq> {} \<Longrightarrow> (\<exists>b. S *<= b) \<Longrightarrow> isLub UNIV S (Sup S)"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   185
  by  (auto simp add: isLub_def setle_def leastP_def isUb_def
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   186
            intro!: setgeI cSup_upper cSup_least)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   187
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   188
lemma isGlb_cInf: 
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   189
  "(S::'a :: conditionally_complete_lattice set) \<noteq> {} \<Longrightarrow> (\<exists>b. b <=* S) \<Longrightarrow> isGlb UNIV S (Inf S)"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   190
  by  (auto simp add: isGlb_def setge_def greatestP_def isLb_def
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   191
            intro!: setleI cInf_lower cInf_greatest)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   192
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   193
lemma cSup_le: "(S::'a::conditionally_complete_lattice set) \<noteq> {} \<Longrightarrow> S *<= b \<Longrightarrow> Sup S \<le> b"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   194
  by (metis cSup_least setle_def)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   195
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   196
lemma cInf_ge: "(S::'a :: conditionally_complete_lattice set) \<noteq> {} \<Longrightarrow> b <=* S \<Longrightarrow> Inf S \<ge> b"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   197
  by (metis cInf_greatest setge_def)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   198
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   199
lemma cSup_bounds:
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   200
  fixes S :: "'a :: conditionally_complete_lattice set"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   201
  shows "S \<noteq> {} \<Longrightarrow> a <=* S \<Longrightarrow> S *<= b \<Longrightarrow> a \<le> Sup S \<and> Sup S \<le> b"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   202
  using cSup_least[of S b] cSup_upper2[of _ S a]
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   203
  by (auto simp: bdd_above_setle setge_def setle_def)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   204
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   205
lemma cSup_unique: "(S::'a :: {conditionally_complete_linorder, no_bot} set) *<= b \<Longrightarrow> (\<forall>b'<b. \<exists>x\<in>S. b' < x) \<Longrightarrow> Sup S = b"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   206
  by (rule cSup_eq) (auto simp: not_le[symmetric] setle_def)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   207
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   208
lemma cInf_unique: "b <=* (S::'a :: {conditionally_complete_linorder, no_top} set) \<Longrightarrow> (\<forall>b'>b. \<exists>x\<in>S. b' > x) \<Longrightarrow> Inf S = b"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   209
  by (rule cInf_eq) (auto simp: not_le[symmetric] setge_def)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   210
60500
903bb1495239 isabelle update_cartouches;
wenzelm
parents: 58881
diff changeset
   211
text\<open>Use completeness of reals (supremum property) to show that any bounded sequence has a least upper bound\<close>
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   212
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   213
lemma reals_complete: "\<exists>X. X \<in> S \<Longrightarrow> \<exists>Y. isUb (UNIV::real set) S Y \<Longrightarrow> \<exists>t. isLub (UNIV :: real set) S t"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   214
  by (intro exI[of _ "Sup S"] isLub_cSup) (auto simp: setle_def isUb_def intro!: cSup_upper)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   215
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   216
lemma Bseq_isUb: "\<And>X :: nat \<Rightarrow> real. Bseq X \<Longrightarrow> \<exists>U. isUb (UNIV::real set) {x. \<exists>n. X n = x} U"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   217
  by (auto intro: isUbI setleI simp add: Bseq_def abs_le_iff)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   218
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   219
lemma Bseq_isLub: "\<And>X :: nat \<Rightarrow> real. Bseq X \<Longrightarrow> \<exists>U. isLub (UNIV::real set) {x. \<exists>n. X n = x} U"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   220
  by (blast intro: reals_complete Bseq_isUb)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   221
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   222
lemma isLub_mono_imp_LIMSEQ:
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   223
  fixes X :: "nat \<Rightarrow> real"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   224
  assumes u: "isLub UNIV {x. \<exists>n. X n = x} u" (* FIXME: use 'range X' *)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   225
  assumes X: "\<forall>m n. m \<le> n \<longrightarrow> X m \<le> X n"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   226
  shows "X ----> u"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   227
proof -
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   228
  have "X ----> (SUP i. X i)"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   229
    using u[THEN isLubD1] X
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   230
    by (intro LIMSEQ_incseq_SUP) (auto simp: incseq_def image_def eq_commute bdd_above_setle)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   231
  also have "(SUP i. X i) = u"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   232
    using isLub_cSup[of "range X"] u[THEN isLubD1]
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   233
    by (intro isLub_unique[OF _ u]) (auto simp add: SUP_def image_def eq_commute)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   234
  finally show ?thesis .
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   235
qed
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   236
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   237
lemmas real_isGlb_unique = isGlb_unique[where 'a=real]
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   238
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   239
lemma real_le_inf_subset: "t \<noteq> {} \<Longrightarrow> t \<subseteq> s \<Longrightarrow> \<exists>b. b <=* s \<Longrightarrow> Inf s \<le> Inf (t::real set)"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   240
  by (rule cInf_superset_mono) (auto simp: bdd_below_setge)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   241
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   242
lemma real_ge_sup_subset: "t \<noteq> {} \<Longrightarrow> t \<subseteq> s \<Longrightarrow> \<exists>b. s *<= b \<Longrightarrow> Sup s \<ge> Sup (t::real set)"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   243
  by (rule cSup_subset_mono) (auto simp: bdd_above_setle)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 51342
diff changeset
   244
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
   245
end