src/HOL/SupInf.thy
author paulson
Wed, 28 Oct 2009 11:42:31 +0000
changeset 33271 7be66dee1a5a
parent 33269 3b7e2dbbd684
child 33609 059cd49e4b1e
permissions -rw-r--r--
New theory Probability, which contains a development of measure theory
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33269
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
     1
(*  Author: Amine Chaieb and L C Paulson, University of Cambridge *)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
     2
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
     3
header {*Sup and Inf Operators on Sets of Reals.*}
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
     4
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
     5
theory SupInf
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
     6
imports RComplete
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
     7
begin
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
     8
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
     9
lemma minus_max_eq_min:
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    10
  fixes x :: "'a::{lordered_ab_group_add, linorder}"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    11
  shows "- (max x y) = min (-x) (-y)"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    12
by (metis le_imp_neg_le linorder_linear min_max.inf_absorb2 min_max.le_iff_inf min_max.le_iff_sup min_max.sup_absorb1)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    13
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    14
lemma minus_min_eq_max:
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    15
  fixes x :: "'a::{lordered_ab_group_add, linorder}"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    16
  shows "- (min x y) = max (-x) (-y)"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    17
by (metis minus_max_eq_min minus_minus)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    18
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    19
lemma minus_Max_eq_Min [simp]:
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    20
  fixes S :: "'a::{lordered_ab_group_add, linorder} set"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    21
  shows "finite S \<Longrightarrow> S \<noteq> {} \<Longrightarrow> - (Max S) = Min (uminus ` S)"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    22
proof (induct S rule: finite_ne_induct)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    23
  case (singleton x)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    24
  thus ?case by simp
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    25
next
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    26
  case (insert x S)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    27
  thus ?case by (simp add: minus_max_eq_min) 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    28
qed
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    29
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    30
lemma minus_Min_eq_Max [simp]:
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    31
  fixes S :: "'a::{lordered_ab_group_add, linorder} set"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    32
  shows "finite S \<Longrightarrow> S \<noteq> {} \<Longrightarrow> - (Min S) = Max (uminus ` S)"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    33
proof (induct S rule: finite_ne_induct)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    34
  case (singleton x)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    35
  thus ?case by simp
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    36
next
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    37
  case (insert x S)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    38
  thus ?case by (simp add: minus_min_eq_max) 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    39
qed
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    40
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    41
instantiation real :: Sup 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    42
begin
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    43
definition
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    44
  Sup_real_def [code del]: "Sup X == (LEAST z::real. \<forall>x\<in>X. x\<le>z)"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    45
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    46
instance ..
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    47
end
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    48
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    49
instantiation real :: Inf 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    50
begin
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    51
definition
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    52
  Inf_real_def [code del]: "Inf (X::real set) == - (Sup (uminus ` X))"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    53
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    54
instance ..
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    55
end
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    56
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    57
subsection{*Supremum of a set of reals*}
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    58
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    59
lemma Sup_upper [intro]: (*REAL_SUP_UBOUND in HOL4*)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    60
  fixes x :: real
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    61
  assumes x: "x \<in> X"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    62
      and z: "!!x. x \<in> X \<Longrightarrow> x \<le> z"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    63
  shows "x \<le> Sup X"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    64
proof (auto simp add: Sup_real_def) 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    65
  from reals_complete2
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    66
  obtain s where s: "(\<forall>y\<in>X. y \<le> s) & (\<forall>z. ((\<forall>y\<in>X. y \<le> z) --> s \<le> z))"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    67
    by (blast intro: x z)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    68
  hence "x \<le> s"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    69
    by (blast intro: x z)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    70
  also with s have "... = (LEAST z. \<forall>x\<in>X. x \<le> z)"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    71
    by (fast intro: Least_equality [symmetric])  
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    72
  finally show "x \<le> (LEAST z. \<forall>x\<in>X. x \<le> z)" .
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    73
qed
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    74
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    75
lemma Sup_least [intro]: (*REAL_IMP_SUP_LE in HOL4*)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    76
  fixes z :: real
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    77
  assumes x: "X \<noteq> {}"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    78
      and z: "\<And>x. x \<in> X \<Longrightarrow> x \<le> z"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    79
  shows "Sup X \<le> z"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    80
proof (auto simp add: Sup_real_def) 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    81
  from reals_complete2 x
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    82
  obtain s where s: "(\<forall>y\<in>X. y \<le> s) & (\<forall>z. ((\<forall>y\<in>X. y \<le> z) --> s \<le> z))"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    83
    by (blast intro: z)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    84
  hence "(LEAST z. \<forall>x\<in>X. x \<le> z) = s"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    85
    by (best intro: Least_equality)  
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    86
  also with s z have "... \<le> z"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    87
    by blast
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    88
  finally show "(LEAST z. \<forall>x\<in>X. x \<le> z) \<le> z" .
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    89
qed
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    90
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    91
lemma Sup_singleton [simp]: "Sup {x::real} = x"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    92
  by (force intro: Least_equality simp add: Sup_real_def)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    93
 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    94
lemma Sup_eq_maximum: (*REAL_SUP_MAX in HOL4*)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    95
  fixes z :: real
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    96
  assumes X: "z \<in> X" and z: "!!x. x \<in> X \<Longrightarrow> x \<le> z"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    97
  shows  "Sup X = z"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    98
  by (force intro: Least_equality X z simp add: Sup_real_def)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
    99
 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   100
lemma Sup_upper2: (*REAL_IMP_LE_SUP in HOL4*)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   101
  fixes x :: real
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   102
  shows "x \<in> X \<Longrightarrow> y \<le> x \<Longrightarrow> (!!x. x \<in> X \<Longrightarrow> x \<le> z) \<Longrightarrow> y \<le> Sup X"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   103
  by (metis Sup_upper real_le_trans)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   104
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   105
lemma Sup_real_iff : (*REAL_SUP_LE in HOL4*)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   106
  fixes z :: real
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   107
  shows "X ~= {} ==> (!!x. x \<in> X ==> x \<le> z) ==> (\<exists>x\<in>X. y<x) <-> y < Sup X"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   108
  by (metis Sup_least Sup_upper linorder_not_le le_less_trans)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   109
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   110
lemma Sup_eq:
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   111
  fixes a :: real
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   112
  shows "(!!x. x \<in> X \<Longrightarrow> x \<le> a) 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   113
        \<Longrightarrow> (!!y. (!!x. x \<in> X \<Longrightarrow> x \<le> y) \<Longrightarrow> a \<le> y) \<Longrightarrow> Sup X = a"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   114
  by (metis Sup_least Sup_upper add_le_cancel_left diff_add_cancel insert_absorb
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   115
        insert_not_empty real_le_anti_sym)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   116
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   117
lemma Sup_le:
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   118
  fixes S :: "real set"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   119
  shows "S \<noteq> {} \<Longrightarrow> S *<= b \<Longrightarrow> Sup S \<le> b"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   120
by (metis SupInf.Sup_least setle_def)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   121
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   122
lemma Sup_upper_EX: 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   123
  fixes x :: real
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   124
  shows "x \<in> X \<Longrightarrow> \<exists>z. \<forall>x. x \<in> X \<longrightarrow> x \<le> z \<Longrightarrow>  x \<le> Sup X"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   125
  by blast
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   126
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   127
lemma Sup_insert_nonempty: 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   128
  fixes x :: real
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   129
  assumes x: "x \<in> X"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   130
      and z: "!!x. x \<in> X \<Longrightarrow> x \<le> z"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   131
  shows "Sup (insert a X) = max a (Sup X)"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   132
proof (cases "Sup X \<le> a")
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   133
  case True
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   134
  thus ?thesis
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   135
    apply (simp add: max_def) 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   136
    apply (rule Sup_eq_maximum)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   137
    apply (metis insertCI)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   138
    apply (metis Sup_upper insertE le_iff_sup real_le_linear real_le_trans sup_absorb1 z)     
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   139
    done
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   140
next
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   141
  case False
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   142
  hence 1:"a < Sup X" by simp
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   143
  have "Sup X \<le> Sup (insert a X)"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   144
    apply (rule Sup_least)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   145
    apply (metis empty_psubset_nonempty psubset_eq x)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   146
    apply (rule Sup_upper_EX) 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   147
    apply blast
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   148
    apply (metis insert_iff real_le_linear real_le_refl real_le_trans z)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   149
    done
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   150
  moreover 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   151
  have "Sup (insert a X) \<le> Sup X"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   152
    apply (rule Sup_least)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   153
    apply blast
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   154
    apply (metis False Sup_upper insertE real_le_linear z) 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   155
    done
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   156
  ultimately have "Sup (insert a X) = Sup X"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   157
    by (blast intro:  antisym )
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   158
  thus ?thesis
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   159
    by (metis 1 min_max.le_iff_sup real_less_def)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   160
qed
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   161
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   162
lemma Sup_insert_if: 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   163
  fixes X :: "real set"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   164
  assumes z: "!!x. x \<in> X \<Longrightarrow> x \<le> z"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   165
  shows "Sup (insert a X) = (if X={} then a else max a (Sup X))"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   166
by auto (metis Sup_insert_nonempty z) 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   167
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   168
lemma Sup: 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   169
  fixes S :: "real set"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   170
  shows "S \<noteq> {} \<Longrightarrow> (\<exists>b. S *<= b) \<Longrightarrow> isLub UNIV S (Sup S)"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   171
by  (auto simp add: isLub_def setle_def leastP_def isUb_def intro!: setgeI) 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   172
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   173
lemma Sup_finite_Max: 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   174
  fixes S :: "real set"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   175
  assumes fS: "finite S" and Se: "S \<noteq> {}"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   176
  shows "Sup S = Max S"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   177
using fS Se
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   178
proof-
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   179
  let ?m = "Max S"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   180
  from Max_ge[OF fS] have Sm: "\<forall> x\<in> S. x \<le> ?m" by metis
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   181
  with Sup[OF Se] have lub: "isLub UNIV S (Sup S)" by (metis setle_def)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   182
  from Max_in[OF fS Se] lub have mrS: "?m \<le> Sup S"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   183
    by (auto simp add: isLub_def leastP_def setle_def setge_def isUb_def)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   184
  moreover
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   185
  have "Sup S \<le> ?m" using Sm lub
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   186
    by (auto simp add: isLub_def leastP_def isUb_def setle_def setge_def)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   187
  ultimately  show ?thesis by arith
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   188
qed
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   189
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   190
lemma Sup_finite_in:
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   191
  fixes S :: "real set"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   192
  assumes fS: "finite S" and Se: "S \<noteq> {}"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   193
  shows "Sup S \<in> S"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   194
  using Sup_finite_Max[OF fS Se] Max_in[OF fS Se] by metis
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   195
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   196
lemma Sup_finite_ge_iff: 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   197
  fixes S :: "real set"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   198
  assumes fS: "finite S" and Se: "S \<noteq> {}"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   199
  shows "a \<le> Sup S \<longleftrightarrow> (\<exists> x \<in> S. a \<le> x)"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   200
by (metis Max_ge Se Sup_finite_Max Sup_finite_in fS linorder_not_le less_le_trans)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   201
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   202
lemma Sup_finite_le_iff: 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   203
  fixes S :: "real set"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   204
  assumes fS: "finite S" and Se: "S \<noteq> {}"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   205
  shows "a \<ge> Sup S \<longleftrightarrow> (\<forall> x \<in> S. a \<ge> x)"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   206
by (metis Max_ge Se Sup_finite_Max Sup_finite_in fS le_iff_sup real_le_trans) 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   207
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   208
lemma Sup_finite_gt_iff: 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   209
  fixes S :: "real set"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   210
  assumes fS: "finite S" and Se: "S \<noteq> {}"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   211
  shows "a < Sup S \<longleftrightarrow> (\<exists> x \<in> S. a < x)"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   212
by (metis Se Sup_finite_le_iff fS linorder_not_less)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   213
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   214
lemma Sup_finite_lt_iff: 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   215
  fixes S :: "real set"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   216
  assumes fS: "finite S" and Se: "S \<noteq> {}"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   217
  shows "a > Sup S \<longleftrightarrow> (\<forall> x \<in> S. a > x)"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   218
by (metis Se Sup_finite_ge_iff fS linorder_not_less)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   219
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   220
lemma Sup_unique:
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   221
  fixes S :: "real set"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   222
  shows "S *<= b \<Longrightarrow> (\<forall>b' < b. \<exists>x \<in> S. b' < x) \<Longrightarrow> Sup S = b"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   223
unfolding setle_def
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   224
apply (rule Sup_eq, auto) 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   225
apply (metis linorder_not_less) 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   226
done
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   227
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   228
lemma Sup_abs_le:
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   229
  fixes S :: "real set"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   230
  shows "S \<noteq> {} \<Longrightarrow> (\<forall>x\<in>S. \<bar>x\<bar> \<le> a) \<Longrightarrow> \<bar>Sup S\<bar> \<le> a"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   231
by (auto simp add: abs_le_interval_iff) (metis Sup_upper2) 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   232
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   233
lemma Sup_bounds:
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   234
  fixes S :: "real set"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   235
  assumes Se: "S \<noteq> {}" and l: "a <=* S" and u: "S *<= b"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   236
  shows "a \<le> Sup S \<and> Sup S \<le> b"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   237
proof-
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   238
  from Sup[OF Se] u have lub: "isLub UNIV S (Sup S)" by blast
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   239
  hence b: "Sup S \<le> b" using u 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   240
    by (auto simp add: isLub_def leastP_def setle_def setge_def isUb_def) 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   241
  from Se obtain y where y: "y \<in> S" by blast
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   242
  from lub l have "a \<le> Sup S"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   243
    by (auto simp add: isLub_def leastP_def setle_def setge_def isUb_def)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   244
       (metis le_iff_sup le_sup_iff y)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   245
  with b show ?thesis by blast
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   246
qed
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   247
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   248
lemma Sup_asclose: 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   249
  fixes S :: "real set"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   250
  assumes S:"S \<noteq> {}" and b: "\<forall>x\<in>S. \<bar>x - l\<bar> \<le> e" shows "\<bar>Sup S - l\<bar> \<le> e"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   251
proof-
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   252
  have th: "\<And>(x::real) l e. \<bar>x - l\<bar> \<le> e \<longleftrightarrow> l - e \<le> x \<and> x \<le> l + e" by arith
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   253
  thus ?thesis using S b Sup_bounds[of S "l - e" "l+e"] unfolding th
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   254
    by  (auto simp add: setge_def setle_def)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   255
qed
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   256
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   257
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   258
subsection{*Infimum of a set of reals*}
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   259
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   260
lemma Inf_lower [intro]: 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   261
  fixes z :: real
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   262
  assumes x: "x \<in> X"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   263
      and z: "!!x. x \<in> X \<Longrightarrow> z \<le> x"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   264
  shows "Inf X \<le> x"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   265
proof -
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   266
  have "-x \<le> Sup (uminus ` X)"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   267
    by (rule Sup_upper [where z = "-z"]) (auto simp add: image_iff x z)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   268
  thus ?thesis 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   269
    by (auto simp add: Inf_real_def)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   270
qed
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   271
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   272
lemma Inf_greatest [intro]: 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   273
  fixes z :: real
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   274
  assumes x: "X \<noteq> {}"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   275
      and z: "\<And>x. x \<in> X \<Longrightarrow> z \<le> x"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   276
  shows "z \<le> Inf X"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   277
proof -
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   278
  have "Sup (uminus ` X) \<le> -z" using x z by (force intro: Sup_least)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   279
  hence "z \<le> - Sup (uminus ` X)"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   280
    by simp
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   281
  thus ?thesis 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   282
    by (auto simp add: Inf_real_def)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   283
qed
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   284
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   285
lemma Inf_singleton [simp]: "Inf {x::real} = x"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   286
  by (simp add: Inf_real_def) 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   287
 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   288
lemma Inf_eq_minimum: (*REAL_INF_MIN in HOL4*)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   289
  fixes z :: real
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   290
  assumes x: "z \<in> X" and z: "!!x. x \<in> X \<Longrightarrow> z \<le> x"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   291
  shows  "Inf X = z"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   292
proof -
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   293
  have "Sup (uminus ` X) = -z" using x z
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   294
    by (force intro: Sup_eq_maximum x z)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   295
  thus ?thesis
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   296
    by (simp add: Inf_real_def) 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   297
qed
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   298
 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   299
lemma Inf_lower2:
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   300
  fixes x :: real
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   301
  shows "x \<in> X \<Longrightarrow> x \<le> y \<Longrightarrow> (!!x. x \<in> X \<Longrightarrow> z \<le> x) \<Longrightarrow> Inf X \<le> y"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   302
  by (metis Inf_lower real_le_trans)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   303
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   304
lemma Inf_real_iff:
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   305
  fixes z :: real
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   306
  shows "X \<noteq> {} \<Longrightarrow> (!!x. x \<in> X \<Longrightarrow> z \<le> x) \<Longrightarrow> (\<exists>x\<in>X. x<y) \<longleftrightarrow> Inf X < y"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   307
  by (metis Inf_greatest Inf_lower less_le_not_le real_le_linear 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   308
            order_less_le_trans)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   309
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   310
lemma Inf_eq:
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   311
  fixes a :: real
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   312
  shows "(!!x. x \<in> X \<Longrightarrow> a \<le> x) \<Longrightarrow> (!!y. (!!x. x \<in> X \<Longrightarrow> y \<le> x) \<Longrightarrow> y \<le> a) \<Longrightarrow> Inf X = a"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   313
  by (metis Inf_greatest Inf_lower add_le_cancel_left diff_add_cancel
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   314
        insert_absorb insert_not_empty real_le_anti_sym)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   315
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   316
lemma Inf_ge: 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   317
  fixes S :: "real set"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   318
  shows "S \<noteq> {} \<Longrightarrow> b <=* S \<Longrightarrow> Inf S \<ge> b"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   319
by (metis SupInf.Inf_greatest setge_def)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   320
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   321
lemma Inf_lower_EX: 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   322
  fixes x :: real
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   323
  shows "x \<in> X \<Longrightarrow> \<exists>z. \<forall>x. x \<in> X \<longrightarrow> z \<le> x \<Longrightarrow> Inf X \<le> x"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   324
  by blast
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   325
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   326
lemma Inf_insert_nonempty: 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   327
  fixes x :: real
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   328
  assumes x: "x \<in> X"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   329
      and z: "!!x. x \<in> X \<Longrightarrow> z \<le> x"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   330
  shows "Inf (insert a X) = min a (Inf X)"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   331
proof (cases "a \<le> Inf X")
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   332
  case True
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   333
  thus ?thesis
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   334
    by (simp add: min_def)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   335
       (blast intro: Inf_eq_minimum Inf_lower real_le_refl real_le_trans z) 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   336
next
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   337
  case False
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   338
  hence 1:"Inf X < a" by simp
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   339
  have "Inf (insert a X) \<le> Inf X"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   340
    apply (rule Inf_greatest)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   341
    apply (metis empty_psubset_nonempty psubset_eq x)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   342
    apply (rule Inf_lower_EX) 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   343
    apply (blast intro: elim:) 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   344
    apply (metis insert_iff real_le_linear real_le_refl real_le_trans z)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   345
    done
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   346
  moreover 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   347
  have "Inf X \<le> Inf (insert a X)"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   348
    apply (rule Inf_greatest)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   349
    apply blast
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   350
    apply (metis False Inf_lower insertE real_le_linear z) 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   351
    done
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   352
  ultimately have "Inf (insert a X) = Inf X"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   353
    by (blast intro:  antisym )
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   354
  thus ?thesis
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   355
    by (metis False min_max.inf_absorb2 real_le_linear)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   356
qed
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   357
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   358
lemma Inf_insert_if: 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   359
  fixes X :: "real set"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   360
  assumes z:  "!!x. x \<in> X \<Longrightarrow> z \<le> x"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   361
  shows "Inf (insert a X) = (if X={} then a else min a (Inf X))"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   362
by auto (metis Inf_insert_nonempty z) 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   363
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   364
lemma Inf_greater:
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   365
  fixes z :: real
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   366
  shows "X \<noteq> {} \<Longrightarrow>  Inf X < z \<Longrightarrow> \<exists>x \<in> X. x < z"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   367
  by (metis Inf_real_iff mem_def not_leE)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   368
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   369
lemma Inf_close:
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   370
  fixes e :: real
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   371
  shows "X \<noteq> {} \<Longrightarrow> 0 < e \<Longrightarrow> \<exists>x \<in> X. x < Inf X + e"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   372
  by (metis add_strict_increasing comm_monoid_add.mult_commute Inf_greater linorder_not_le pos_add_strict)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   373
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   374
lemma Inf_finite_Min:
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   375
  fixes S :: "real set"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   376
  shows "finite S \<Longrightarrow> S \<noteq> {} \<Longrightarrow> Inf S = Min S"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   377
by (simp add: Inf_real_def Sup_finite_Max image_image) 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   378
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   379
lemma Inf_finite_in: 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   380
  fixes S :: "real set"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   381
  assumes fS: "finite S" and Se: "S \<noteq> {}"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   382
  shows "Inf S \<in> S"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   383
  using Inf_finite_Min[OF fS Se] Min_in[OF fS Se] by metis
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   384
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   385
lemma Inf_finite_ge_iff: 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   386
  fixes S :: "real set"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   387
  shows "finite S \<Longrightarrow> S \<noteq> {} \<Longrightarrow> a \<le> Inf S \<longleftrightarrow> (\<forall> x \<in> S. a \<le> x)"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   388
by (metis Inf_finite_Min Inf_finite_in Min_le real_le_trans)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   389
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   390
lemma Inf_finite_le_iff:
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   391
  fixes S :: "real set"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   392
  shows "finite S \<Longrightarrow> S \<noteq> {} \<Longrightarrow> a \<ge> Inf S \<longleftrightarrow> (\<exists> x \<in> S. a \<ge> x)"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   393
by (metis Inf_finite_Min Inf_finite_ge_iff Inf_finite_in Min_le
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   394
          real_le_anti_sym real_le_linear)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   395
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   396
lemma Inf_finite_gt_iff: 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   397
  fixes S :: "real set"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   398
  shows "finite S \<Longrightarrow> S \<noteq> {} \<Longrightarrow> a < Inf S \<longleftrightarrow> (\<forall> x \<in> S. a < x)"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   399
by (metis Inf_finite_le_iff linorder_not_less)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   400
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   401
lemma Inf_finite_lt_iff: 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   402
  fixes S :: "real set"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   403
  shows "finite S \<Longrightarrow> S \<noteq> {} \<Longrightarrow> a > Inf S \<longleftrightarrow> (\<exists> x \<in> S. a > x)"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   404
by (metis Inf_finite_ge_iff linorder_not_less)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   405
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   406
lemma Inf_unique:
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   407
  fixes S :: "real set"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   408
  shows "b <=* S \<Longrightarrow> (\<forall>b' > b. \<exists>x \<in> S. b' > x) \<Longrightarrow> Inf S = b"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   409
unfolding setge_def
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   410
apply (rule Inf_eq, auto) 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   411
apply (metis less_le_not_le linorder_not_less) 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   412
done
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   413
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   414
lemma Inf_abs_ge:
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   415
  fixes S :: "real set"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   416
  shows "S \<noteq> {} \<Longrightarrow> (\<forall>x\<in>S. \<bar>x\<bar> \<le> a) \<Longrightarrow> \<bar>Inf S\<bar> \<le> a"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   417
by (simp add: Inf_real_def) (rule Sup_abs_le, auto) 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   418
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   419
lemma Inf_asclose:
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   420
  fixes S :: "real set"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   421
  assumes S:"S \<noteq> {}" and b: "\<forall>x\<in>S. \<bar>x - l\<bar> \<le> e" shows "\<bar>Inf S - l\<bar> \<le> e"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   422
proof -
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   423
  have "\<bar>- Sup (uminus ` S) - l\<bar> =  \<bar>Sup (uminus ` S) - (-l)\<bar>"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   424
    by auto
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   425
  also have "... \<le> e" 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   426
    apply (rule Sup_asclose) 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   427
    apply (auto simp add: S)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   428
    apply (metis abs_minus_add_cancel b comm_monoid_add.mult_commute real_diff_def) 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   429
    done
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   430
  finally have "\<bar>- Sup (uminus ` S) - l\<bar> \<le> e" .
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   431
  thus ?thesis
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   432
    by (simp add: Inf_real_def)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   433
qed
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   434
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents: 33269
diff changeset
   435
subsection{*Relate max and min to Sup and Inf.*}
33269
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   436
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   437
lemma real_max_Sup:
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   438
  fixes x :: real
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   439
  shows "max x y = Sup {x,y}"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   440
proof-
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   441
  have f: "finite {x, y}" "{x,y} \<noteq> {}"  by simp_all
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   442
  from Sup_finite_le_iff[OF f, of "max x y"] have "Sup {x,y} \<le> max x y" by simp
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   443
  moreover
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   444
  have "max x y \<le> Sup {x,y}" using Sup_finite_ge_iff[OF f, of "max x y"]
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   445
    by (simp add: linorder_linear)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   446
  ultimately show ?thesis by arith
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   447
qed
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   448
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   449
lemma real_min_Inf: 
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   450
  fixes x :: real
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   451
  shows "min x y = Inf {x,y}"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   452
proof-
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   453
  have f: "finite {x, y}" "{x,y} \<noteq> {}"  by simp_all
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   454
  from Inf_finite_le_iff[OF f, of "min x y"] have "Inf {x,y} \<le> min x y"
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   455
    by (simp add: linorder_linear)
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   456
  moreover
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   457
  have "min x y \<le> Inf {x,y}" using Inf_finite_ge_iff[OF f, of "min x y"]
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   458
    by simp
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   459
  ultimately show ?thesis by arith
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   460
qed
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   461
3b7e2dbbd684 New theory SupInf of the supremum and infimum operators for sets of reals.
paulson
parents:
diff changeset
   462
end