src/HOL/Real/RComplete.thy
 changeset 14365 3d4df8c166ae parent 9429 8ebc549e9326 child 14387 e96d5c42c4b0
```     1.1 --- a/src/HOL/Real/RComplete.thy	Tue Jan 27 09:44:14 2004 +0100
1.2 +++ b/src/HOL/Real/RComplete.thy	Tue Jan 27 15:39:51 2004 +0100
1.3 @@ -6,5 +6,221 @@
1.4                    reals and reals
1.5  *)
1.6
1.7 -RComplete = Lubs + RealArith
1.8 +header{*Completeness Theorems for Positive Reals and Reals.*}
1.9 +
1.10 +theory RComplete = Lubs + RealArith:
1.11 +
1.12 +lemma real_sum_of_halves: "x/2 + x/2 = (x::real)"
1.13 +apply (simp)
1.14 +done
1.15 +
1.16 +
1.17 +subsection{*Completeness of Reals by Supremum Property of type @{typ preal}*}
1.18 +
1.19 + (*a few lemmas*)
1.20 +lemma real_sup_lemma1:
1.21 +     "\<forall>x \<in> P. 0 < x ==>
1.22 +      ((\<exists>x \<in> P. y < x) = (\<exists>X. real_of_preal X \<in> P & y < real_of_preal X))"
1.23 +by (blast dest!: bspec real_gt_zero_preal_Ex [THEN iffD1])
1.24 +
1.25 +lemma real_sup_lemma2:
1.26 +     "[| \<forall>x \<in> P. 0 < x;  a \<in> P;   \<forall>x \<in> P. x < y |]
1.27 +      ==> (\<exists>X. X\<in> {w. real_of_preal w \<in> P}) &
1.28 +          (\<exists>Y. \<forall>X\<in> {w. real_of_preal w \<in> P}. X < Y)"
1.29 +apply (rule conjI)
1.30 +apply (blast dest: bspec real_gt_zero_preal_Ex [THEN iffD1], auto)
1.31 +apply (drule bspec, assumption)
1.32 +apply (frule bspec, assumption)
1.33 +apply (drule order_less_trans, assumption)
1.34 +apply (drule real_gt_zero_preal_Ex [THEN iffD1])
1.35 +apply (force)
1.36 +done
1.37 +
1.38 +(*-------------------------------------------------------------
1.39 +            Completeness of Positive Reals
1.40 + -------------------------------------------------------------*)
1.41 +
1.42 +(**
1.43 + Supremum property for the set of positive reals
1.44 + FIXME: long proof - should be improved
1.45 +**)
1.46 +
1.47 +(*Let P be a non-empty set of positive reals, with an upper bound y.
1.48 +  Then P has a least upper bound (written S).
1.49 +FIXME: Can the premise be weakened to \<forall>x \<in> P. x\<le> y ??*)
1.50 +lemma posreal_complete: "[| \<forall>x \<in> P. (0::real) < x;  \<exists>x. x \<in> P;  \<exists>y. \<forall>x \<in> P. x<y |]
1.51 +      ==> (\<exists>S. \<forall>y. (\<exists>x \<in> P. y < x) = (y < S))"
1.52 +apply (rule_tac x = "real_of_preal (psup ({w. real_of_preal w \<in> P}))" in exI)
1.53 +apply clarify
1.54 +apply (case_tac "0 < ya", auto)
1.55 +apply (frule real_sup_lemma2, assumption+)
1.56 +apply (drule real_gt_zero_preal_Ex [THEN iffD1])
1.57 +apply (drule_tac [3] real_less_all_real2)
1.58 +apply (auto)
1.59 +apply (rule preal_complete [THEN iffD1])
1.60 +apply (auto intro: order_less_imp_le)
1.61 +apply (frule real_gt_preal_preal_Ex)
1.62 +apply (force)
1.63 +(* second part *)
1.64 +apply (rule real_sup_lemma1 [THEN iffD2], assumption)
1.65 +apply (auto dest!: real_less_all_real2 real_gt_zero_preal_Ex [THEN iffD1])
1.66 +apply (frule_tac [2] real_sup_lemma2)
1.67 +apply (frule real_sup_lemma2, assumption+, clarify)
1.68 +apply (rule preal_complete [THEN iffD2, THEN bexE])
1.69 +prefer 3 apply blast
1.70 +apply (blast intro!: order_less_imp_le)+
1.71 +done
1.72 +
1.73 +(*--------------------------------------------------------
1.74 +   Completeness properties using isUb, isLub etc.
1.75 + -------------------------------------------------------*)
1.76 +
1.77 +lemma real_isLub_unique: "[| isLub R S x; isLub R S y |] ==> x = (y::real)"
1.78 +apply (frule isLub_isUb)
1.79 +apply (frule_tac x = y in isLub_isUb)
1.80 +apply (blast intro!: real_le_anti_sym dest!: isLub_le_isUb)
1.81 +done
1.82 +
1.83 +lemma real_order_restrict: "[| (x::real) <=* S'; S <= S' |] ==> x <=* S"
1.84 +by (unfold setle_def setge_def, blast)
1.85 +
1.86 +(*----------------------------------------------------------------
1.87 +           Completeness theorem for the positive reals(again)
1.88 + ----------------------------------------------------------------*)
1.89 +
1.90 +lemma posreals_complete:
1.91 +     "[| \<forall>x \<in>S. 0 < x;
1.92 +         \<exists>x. x \<in>S;
1.93 +         \<exists>u. isUb (UNIV::real set) S u
1.94 +      |] ==> \<exists>t. isLub (UNIV::real set) S t"
1.95 +apply (rule_tac x = "real_of_preal (psup ({w. real_of_preal w \<in> S}))" in exI)
1.96 +apply (auto simp add: isLub_def leastP_def isUb_def)
1.97 +apply (auto intro!: setleI setgeI dest!: real_gt_zero_preal_Ex [THEN iffD1])
1.98 +apply (frule_tac x = y in bspec, assumption)
1.99 +apply (drule real_gt_zero_preal_Ex [THEN iffD1])
1.100 +apply (auto simp add: real_of_preal_le_iff)
1.101 +apply (frule_tac y = "real_of_preal ya" in setleD, assumption)
1.102 +apply (frule real_ge_preal_preal_Ex, safe)
1.103 +apply (blast intro!: preal_psup_le dest!: setleD intro: real_of_preal_le_iff [THEN iffD1])
1.104 +apply (frule_tac x = x in bspec, assumption)
1.105 +apply (frule isUbD2)
1.106 +apply (drule real_gt_zero_preal_Ex [THEN iffD1])
1.107 +apply (auto dest!: isUbD real_ge_preal_preal_Ex simp add: real_of_preal_le_iff)
1.108 +apply (blast dest!: setleD intro!: psup_le_ub intro: real_of_preal_le_iff [THEN iffD1])
1.109 +done
1.110 +
1.111
1.112 +(*-------------------------------
1.113 +    Lemmas
1.114 + -------------------------------*)
1.115 +lemma real_sup_lemma3: "\<forall>y \<in> {z. \<exists>x \<in> P. z = x + (-xa) + 1} Int {x. 0 < x}. 0 < y"
1.116 +by auto
1.117 +
1.118 +lemma lemma_le_swap2: "(xa <= S + X + (-Z)) = (xa + (-X) + Z <= (S::real))"
1.119 +by auto
1.120 +
1.121 +lemma lemma_real_complete2b: "[| (x::real) + (-X) + 1 <= S; xa <= x |] ==> xa <= S + X + (- 1)"
1.122 +by arith
1.123 +
1.124 +(*----------------------------------------------------------
1.125 +      reals Completeness (again!)
1.126 + ----------------------------------------------------------*)
1.127 +lemma reals_complete: "[| \<exists>X. X \<in>S;  \<exists>Y. isUb (UNIV::real set) S Y |]
1.128 +      ==> \<exists>t. isLub (UNIV :: real set) S t"
1.129 +apply safe
1.130 +apply (subgoal_tac "\<exists>u. u\<in> {z. \<exists>x \<in>S. z = x + (-X) + 1} Int {x. 0 < x}")
1.131 +apply (subgoal_tac "isUb (UNIV::real set) ({z. \<exists>x \<in>S. z = x + (-X) + 1} Int {x. 0 < x}) (Y + (-X) + 1) ")
1.132 +apply (cut_tac P = S and xa = X in real_sup_lemma3)
1.133 +apply (frule posreals_complete [OF _ _ exI], blast, blast)
1.134 +apply safe
1.135 +apply (rule_tac x = "t + X + (- 1) " in exI)
1.136 +apply (rule isLubI2)
1.137 +apply (rule_tac [2] setgeI, safe)
1.138 +apply (subgoal_tac [2] "isUb (UNIV:: real set) ({z. \<exists>x \<in>S. z = x + (-X) + 1} Int {x. 0 < x}) (y + (-X) + 1) ")
1.139 +apply (drule_tac [2] y = " (y + (- X) + 1) " in isLub_le_isUb)
1.140 + prefer 2 apply assumption
1.141 + prefer 2
1.142 +apply arith
1.143 +apply (rule setleI [THEN isUbI], safe)
1.144 +apply (rule_tac x = x and y = y in linorder_cases)
1.145 +apply (subst lemma_le_swap2)
1.146 +apply (frule isLubD2)
1.147 + prefer 2 apply assumption
1.148 +apply safe
1.149 +apply blast
1.150 +apply arith
1.151 +apply (subst lemma_le_swap2)
1.152 +apply (frule isLubD2)
1.153 + prefer 2 apply assumption
1.154 +apply blast
1.155 +apply (rule lemma_real_complete2b)
1.156 +apply (erule_tac [2] order_less_imp_le)
1.157 +apply (blast intro!: isLubD2, blast)
1.159 +apply (blast dest: isUbD intro!: setleI [THEN isUbI] intro: add_right_mono)
1.160 +apply (blast dest: isUbD intro!: setleI [THEN isUbI] intro: add_right_mono, auto)
1.161 +done
1.162 +
1.163 +
1.164 +subsection{*Corollary: the Archimedean Property of the Reals*}
1.165 +
1.166 +lemma reals_Archimedean: "0 < x ==> \<exists>n. inverse (real(Suc n)) < x"
1.167 +apply (rule ccontr)
1.168 +apply (subgoal_tac "\<forall>n. x * real (Suc n) <= 1")
1.169 + prefer 2
1.170 +apply (simp add: linorder_not_less inverse_eq_divide, clarify)
1.171 +apply (drule_tac x = n in spec)
1.172 +apply (drule_tac c = "real (Suc n)"  in mult_right_mono)
1.173 +apply (rule real_of_nat_ge_zero)
1.174 +apply (simp add: real_of_nat_Suc_gt_zero [THEN real_not_refl2, THEN not_sym] real_mult_commute)
1.175 +apply (subgoal_tac "isUb (UNIV::real set) {z. \<exists>n. z = x* (real (Suc n))} 1")
1.176 +apply (subgoal_tac "\<exists>X. X \<in> {z. \<exists>n. z = x* (real (Suc n))}")
1.177 +apply (drule reals_complete)
1.178 +apply (auto intro: isUbI setleI)
1.179 +apply (subgoal_tac "\<forall>m. x* (real (Suc m)) <= t")
1.180 +apply (simp add: real_of_nat_Suc right_distrib)
1.181 +prefer 2 apply (blast intro: isLubD2)
1.182 +apply (simp add: le_diff_eq [symmetric] real_diff_def)
1.183 +apply (subgoal_tac "isUb (UNIV::real set) {z. \<exists>n. z = x* (real (Suc n))} (t + (-x))")
1.184 +prefer 2 apply (blast intro!: isUbI setleI)
1.185 +apply (drule_tac y = "t+ (-x) " in isLub_le_isUb)
1.186 +apply (auto simp add: real_of_nat_Suc right_distrib)
1.187 +done
1.188 +
1.189 +(*There must be other proofs, e.g. Suc of the largest integer in the
1.190 +  cut representing x*)
1.191 +lemma reals_Archimedean2: "\<exists>n. (x::real) < real (n::nat)"
1.192 +apply (rule_tac x = x and y = 0 in linorder_cases)
1.193 +apply (rule_tac x = 0 in exI)
1.194 +apply (rule_tac [2] x = 1 in exI)
1.195 +apply (auto elim: order_less_trans simp add: real_of_nat_one)
1.196 +apply (frule positive_imp_inverse_positive [THEN reals_Archimedean], safe)
1.197 +apply (rule_tac x = "Suc n" in exI)
1.198 +apply (frule_tac b = "inverse x" in mult_strict_right_mono, auto)
1.199 +done
1.200 +
1.201 +lemma reals_Archimedean3: "0 < x ==> \<forall>y. \<exists>(n::nat). y < real n * x"
1.202 +apply safe
1.203 +apply (cut_tac x = "y*inverse (x) " in reals_Archimedean2)
1.204 +apply safe
1.205 +apply (frule_tac a = "y * inverse x" in mult_strict_right_mono)
1.206 +apply (auto simp add: mult_assoc real_of_nat_def)
1.207 +done
1.208 +
1.209 +ML
1.210 +{*
1.211 +val real_sum_of_halves = thm "real_sum_of_halves";
1.212 +val posreal_complete = thm "posreal_complete";
1.213 +val real_isLub_unique = thm "real_isLub_unique";
1.214 +val real_order_restrict = thm "real_order_restrict";
1.215 +val posreals_complete = thm "posreals_complete";
1.216 +val reals_complete = thm "reals_complete";
1.217 +val reals_Archimedean = thm "reals_Archimedean";
1.218 +val reals_Archimedean2 = thm "reals_Archimedean2";
1.219 +val reals_Archimedean3 = thm "reals_Archimedean3";
1.220 +*}
1.221 +
1.222 +end
1.223 +
1.224 +
1.225 +
```