src/HOL/Real/RComplete.thy
author paulson
Fri Mar 19 10:50:06 2004 +0100 (2004-03-19)
changeset 14476 758e7acdea2f
parent 14387 e96d5c42c4b0
child 14641 79b7bd936264
permissions -rw-r--r--
removed redundant thms
     1 (*  Title       : RComplete.thy
     2     ID          : $Id$
     3     Author      : Jacques D. Fleuriot
     4     Copyright   : 1998  University of Cambridge
     5     Description : Completeness theorems for positive
     6                   reals and reals 
     7 *) 
     8 
     9 header{*Completeness Theorems for Positive Reals and Reals.*}
    10 
    11 theory RComplete = Lubs + RealDef:
    12 
    13 lemma real_sum_of_halves: "x/2 + x/2 = (x::real)"
    14 by simp
    15 
    16 
    17 subsection{*Completeness of Reals by Supremum Property of type @{typ preal}*} 
    18 
    19  (*a few lemmas*)
    20 lemma real_sup_lemma1:
    21      "\<forall>x \<in> P. 0 < x ==>   
    22       ((\<exists>x \<in> P. y < x) = (\<exists>X. real_of_preal X \<in> P & y < real_of_preal X))"
    23 by (blast dest!: bspec real_gt_zero_preal_Ex [THEN iffD1])
    24 
    25 lemma real_sup_lemma2:
    26      "[| \<forall>x \<in> P. 0 < x;  a \<in> P;   \<forall>x \<in> P. x < y |]  
    27       ==> (\<exists>X. X\<in> {w. real_of_preal w \<in> P}) &  
    28           (\<exists>Y. \<forall>X\<in> {w. real_of_preal w \<in> P}. X < Y)"
    29 apply (rule conjI)
    30 apply (blast dest: bspec real_gt_zero_preal_Ex [THEN iffD1], auto)
    31 apply (drule bspec, assumption)
    32 apply (frule bspec, assumption)
    33 apply (drule order_less_trans, assumption)
    34 apply (drule real_gt_zero_preal_Ex [THEN iffD1], force) 
    35 done
    36 
    37 (*-------------------------------------------------------------
    38             Completeness of Positive Reals
    39  -------------------------------------------------------------*)
    40 
    41 (**
    42  Supremum property for the set of positive reals
    43  FIXME: long proof - should be improved
    44 **)
    45 
    46 (*Let P be a non-empty set of positive reals, with an upper bound y.
    47   Then P has a least upper bound (written S).  
    48 FIXME: Can the premise be weakened to \<forall>x \<in> P. x\<le> y ??*)
    49 lemma posreal_complete: "[| \<forall>x \<in> P. (0::real) < x;  \<exists>x. x \<in> P;  \<exists>y. \<forall>x \<in> P. x<y |]  
    50       ==> (\<exists>S. \<forall>y. (\<exists>x \<in> P. y < x) = (y < S))"
    51 apply (rule_tac x = "real_of_preal (psup ({w. real_of_preal w \<in> P}))" in exI)
    52 apply clarify
    53 apply (case_tac "0 < ya", auto)
    54 apply (frule real_sup_lemma2, assumption+)
    55 apply (drule real_gt_zero_preal_Ex [THEN iffD1])
    56 apply (drule_tac [3] real_less_all_real2, auto)
    57 apply (rule preal_complete [THEN iffD1])
    58 apply (auto intro: order_less_imp_le)
    59 apply (frule real_gt_preal_preal_Ex, force)
    60 (* second part *)
    61 apply (rule real_sup_lemma1 [THEN iffD2], assumption)
    62 apply (auto dest!: real_less_all_real2 real_gt_zero_preal_Ex [THEN iffD1])
    63 apply (frule_tac [2] real_sup_lemma2)
    64 apply (frule real_sup_lemma2, assumption+, clarify) 
    65 apply (rule preal_complete [THEN iffD2, THEN bexE])
    66 prefer 3 apply blast
    67 apply (blast intro!: order_less_imp_le)+
    68 done
    69 
    70 (*--------------------------------------------------------
    71    Completeness properties using isUb, isLub etc.
    72  -------------------------------------------------------*)
    73 
    74 lemma real_isLub_unique: "[| isLub R S x; isLub R S y |] ==> x = (y::real)"
    75 apply (frule isLub_isUb)
    76 apply (frule_tac x = y in isLub_isUb)
    77 apply (blast intro!: order_antisym dest!: isLub_le_isUb)
    78 done
    79 
    80 lemma real_order_restrict: "[| (x::real) <=* S'; S <= S' |] ==> x <=* S"
    81 by (unfold setle_def setge_def, blast)
    82 
    83 (*----------------------------------------------------------------
    84            Completeness theorem for the positive reals(again)
    85  ----------------------------------------------------------------*)
    86 
    87 lemma posreals_complete:
    88      "[| \<forall>x \<in>S. 0 < x;  
    89          \<exists>x. x \<in>S;  
    90          \<exists>u. isUb (UNIV::real set) S u  
    91       |] ==> \<exists>t. isLub (UNIV::real set) S t"
    92 apply (rule_tac x = "real_of_preal (psup ({w. real_of_preal w \<in> S}))" in exI)
    93 apply (auto simp add: isLub_def leastP_def isUb_def)
    94 apply (auto intro!: setleI setgeI dest!: real_gt_zero_preal_Ex [THEN iffD1])
    95 apply (frule_tac x = y in bspec, assumption)
    96 apply (drule real_gt_zero_preal_Ex [THEN iffD1])
    97 apply (auto simp add: real_of_preal_le_iff)
    98 apply (frule_tac y = "real_of_preal ya" in setleD, assumption)
    99 apply (frule real_ge_preal_preal_Ex, safe)
   100 apply (blast intro!: preal_psup_le dest!: setleD intro: real_of_preal_le_iff [THEN iffD1])
   101 apply (frule_tac x = x in bspec, assumption)
   102 apply (frule isUbD2)
   103 apply (drule real_gt_zero_preal_Ex [THEN iffD1])
   104 apply (auto dest!: isUbD real_ge_preal_preal_Ex simp add: real_of_preal_le_iff)
   105 apply (blast dest!: setleD intro!: psup_le_ub intro: real_of_preal_le_iff [THEN iffD1])
   106 done
   107 
   108 
   109 (*-------------------------------
   110     Lemmas
   111  -------------------------------*)
   112 lemma real_sup_lemma3: "\<forall>y \<in> {z. \<exists>x \<in> P. z = x + (-xa) + 1} Int {x. 0 < x}. 0 < y"
   113 by auto
   114  
   115 lemma lemma_le_swap2: "(xa <= S + X + (-Z)) = (xa + (-X) + Z <= (S::real))"
   116 by auto
   117 
   118 lemma lemma_real_complete2b: "[| (x::real) + (-X) + 1 <= S; xa <= x |] ==> xa <= S + X + (- 1)"
   119 by arith
   120 
   121 (*----------------------------------------------------------
   122       reals Completeness (again!)
   123  ----------------------------------------------------------*)
   124 lemma reals_complete: "[| \<exists>X. X \<in>S;  \<exists>Y. isUb (UNIV::real set) S Y |]   
   125       ==> \<exists>t. isLub (UNIV :: real set) S t"
   126 apply safe
   127 apply (subgoal_tac "\<exists>u. u\<in> {z. \<exists>x \<in>S. z = x + (-X) + 1} Int {x. 0 < x}")
   128 apply (subgoal_tac "isUb (UNIV::real set) ({z. \<exists>x \<in>S. z = x + (-X) + 1} Int {x. 0 < x}) (Y + (-X) + 1) ")
   129 apply (cut_tac P = S and xa = X in real_sup_lemma3)
   130 apply (frule posreals_complete [OF _ _ exI], blast, blast, safe)
   131 apply (rule_tac x = "t + X + (- 1) " in exI)
   132 apply (rule isLubI2)
   133 apply (rule_tac [2] setgeI, safe)
   134 apply (subgoal_tac [2] "isUb (UNIV:: real set) ({z. \<exists>x \<in>S. z = x + (-X) + 1} Int {x. 0 < x}) (y + (-X) + 1) ")
   135 apply (drule_tac [2] y = " (y + (- X) + 1) " in isLub_le_isUb)
   136  prefer 2 apply assumption
   137  prefer 2
   138 apply arith
   139 apply (rule setleI [THEN isUbI], safe)
   140 apply (rule_tac x = x and y = y in linorder_cases)
   141 apply (subst lemma_le_swap2)
   142 apply (frule isLubD2)
   143  prefer 2 apply assumption
   144 apply safe
   145 apply blast
   146 apply arith
   147 apply (subst lemma_le_swap2)
   148 apply (frule isLubD2)
   149  prefer 2 apply assumption
   150 apply blast
   151 apply (rule lemma_real_complete2b)
   152 apply (erule_tac [2] order_less_imp_le)
   153 apply (blast intro!: isLubD2, blast) 
   154 apply (simp (no_asm_use) add: real_add_assoc)
   155 apply (blast dest: isUbD intro!: setleI [THEN isUbI] intro: add_right_mono)
   156 apply (blast dest: isUbD intro!: setleI [THEN isUbI] intro: add_right_mono, auto)
   157 done
   158 
   159 
   160 subsection{*Corollary: the Archimedean Property of the Reals*}
   161 
   162 lemma reals_Archimedean: "0 < x ==> \<exists>n. inverse (real(Suc n)) < x"
   163 apply (rule ccontr)
   164 apply (subgoal_tac "\<forall>n. x * real (Suc n) <= 1")
   165  prefer 2
   166 apply (simp add: linorder_not_less inverse_eq_divide, clarify) 
   167 apply (drule_tac x = n in spec)
   168 apply (drule_tac c = "real (Suc n)"  in mult_right_mono)
   169 apply (rule real_of_nat_ge_zero)
   170 apply (simp add: real_of_nat_Suc_gt_zero [THEN real_not_refl2, THEN not_sym] real_mult_commute)
   171 apply (subgoal_tac "isUb (UNIV::real set) {z. \<exists>n. z = x* (real (Suc n))} 1")
   172 apply (subgoal_tac "\<exists>X. X \<in> {z. \<exists>n. z = x* (real (Suc n))}")
   173 apply (drule reals_complete)
   174 apply (auto intro: isUbI setleI)
   175 apply (subgoal_tac "\<forall>m. x* (real (Suc m)) <= t")
   176 apply (simp add: real_of_nat_Suc right_distrib)
   177 prefer 2 apply (blast intro: isLubD2)
   178 apply (simp add: le_diff_eq [symmetric] real_diff_def)
   179 apply (subgoal_tac "isUb (UNIV::real set) {z. \<exists>n. z = x* (real (Suc n))} (t + (-x))")
   180 prefer 2 apply (blast intro!: isUbI setleI)
   181 apply (drule_tac y = "t+ (-x) " in isLub_le_isUb)
   182 apply (auto simp add: real_of_nat_Suc right_distrib)
   183 done
   184 
   185 (*There must be other proofs, e.g. Suc of the largest integer in the
   186   cut representing x*)
   187 lemma reals_Archimedean2: "\<exists>n. (x::real) < real (n::nat)"
   188 apply (rule_tac x = x and y = 0 in linorder_cases)
   189 apply (rule_tac x = 0 in exI)
   190 apply (rule_tac [2] x = 1 in exI)
   191 apply (auto elim: order_less_trans simp add: real_of_nat_one)
   192 apply (frule positive_imp_inverse_positive [THEN reals_Archimedean], safe)
   193 apply (rule_tac x = "Suc n" in exI)
   194 apply (frule_tac b = "inverse x" in mult_strict_right_mono, auto)
   195 done
   196 
   197 lemma reals_Archimedean3: "0 < x ==> \<forall>y. \<exists>(n::nat). y < real n * x"
   198 apply safe
   199 apply (cut_tac x = "y*inverse (x) " in reals_Archimedean2)
   200 apply safe
   201 apply (frule_tac a = "y * inverse x" in mult_strict_right_mono)
   202 apply (auto simp add: mult_assoc real_of_nat_def)
   203 done
   204 
   205 ML
   206 {*
   207 val real_sum_of_halves = thm "real_sum_of_halves";
   208 val posreal_complete = thm "posreal_complete";
   209 val real_isLub_unique = thm "real_isLub_unique";
   210 val real_order_restrict = thm "real_order_restrict";
   211 val posreals_complete = thm "posreals_complete";
   212 val reals_complete = thm "reals_complete";
   213 val reals_Archimedean = thm "reals_Archimedean";
   214 val reals_Archimedean2 = thm "reals_Archimedean2";
   215 val reals_Archimedean3 = thm "reals_Archimedean3";
   216 *}
   217 
   218 end
   219 
   220 
   221