src/HOL/Hyperreal/NthRoot.thy
author paulson
Fri Jan 09 10:46:18 2004 +0100 (2004-01-09)
changeset 14348 744c868ee0b7
parent 14334 6137d24eef79
child 14355 67e2e96bfe36
permissions -rw-r--r--
Defining the type class "ringpower" and deleting superseded theorems for
types nat, int, real, hypreal
paulson@12196
     1
(*  Title       : NthRoot.thy
paulson@12196
     2
    Author      : Jacques D. Fleuriot
paulson@12196
     3
    Copyright   : 1998  University of Cambridge
paulson@12196
     4
    Description : Existence of nth root. Adapted from
paulson@12196
     5
                   http://www.math.unl.edu/~webnotes
paulson@12196
     6
*)
paulson@12196
     7
paulson@14324
     8
header{*Existence of Nth Root*}
paulson@14324
     9
paulson@14324
    10
theory NthRoot = SEQ + HSeries:
paulson@14324
    11
paulson@14324
    12
text{*Various lemmas needed for this result. We follow the proof
paulson@14324
    13
   given by John Lindsay Orr (jorr@math.unl.edu) in his Analysis
paulson@14324
    14
   Webnotes available on the www at http://www.math.unl.edu/~webnotes
paulson@14324
    15
   Lemmas about sequences of reals are used to reach the result.*}
paulson@14324
    16
paulson@14324
    17
lemma lemma_nth_realpow_non_empty:
paulson@14324
    18
     "[| (0::real) < a; 0 < n |] ==> \<exists>s. s : {x. x ^ n <= a & 0 < x}"
paulson@14324
    19
apply (case_tac "1 <= a")
paulson@14324
    20
apply (rule_tac x = "1" in exI)
paulson@14334
    21
apply (drule_tac [2] linorder_not_le [THEN iffD1])
paulson@14324
    22
apply (drule_tac [2] less_not_refl2 [THEN not0_implies_Suc])
paulson@14348
    23
apply (simp add: ); 
paulson@14348
    24
apply (force intro!: realpow_Suc_le_self simp del: realpow_Suc)
paulson@14324
    25
done
paulson@14324
    26
paulson@14348
    27
text{*Used only just below*}
paulson@14348
    28
lemma realpow_ge_self2: "[| (1::real) \<le> r; 0 < n |] ==> r \<le> r ^ n"
paulson@14348
    29
by (insert power_increasing [of 1 n r], simp)
paulson@14348
    30
paulson@14324
    31
lemma lemma_nth_realpow_isUb_ex:
paulson@14324
    32
     "[| (0::real) < a; 0 < n |]  
paulson@14324
    33
      ==> \<exists>u. isUb (UNIV::real set) {x. x ^ n <= a & 0 < x} u"
paulson@14324
    34
apply (case_tac "1 <= a")
paulson@14324
    35
apply (rule_tac x = "a" in exI)
paulson@14334
    36
apply (drule_tac [2] linorder_not_le [THEN iffD1])
paulson@14324
    37
apply (rule_tac [2] x = "1" in exI)
paulson@14324
    38
apply (rule_tac [!] setleI [THEN isUbI])
paulson@14324
    39
apply safe
paulson@14324
    40
apply (simp_all (no_asm))
paulson@14324
    41
apply (rule_tac [!] ccontr)
paulson@14334
    42
apply (drule_tac [!] linorder_not_le [THEN iffD1])
paulson@14324
    43
apply (drule realpow_ge_self2 , assumption)
paulson@14324
    44
apply (drule_tac n = "n" in realpow_less)
paulson@14324
    45
apply (assumption+)
paulson@14324
    46
apply (drule real_le_trans , assumption)
paulson@14324
    47
apply (drule_tac y = "y ^ n" in order_less_le_trans)
paulson@14324
    48
apply (assumption , erule real_less_irrefl)
paulson@14334
    49
apply (drule_tac n = "n" in zero_less_one [THEN realpow_less])
paulson@14324
    50
apply auto
paulson@14324
    51
done
paulson@14324
    52
paulson@14324
    53
lemma nth_realpow_isLub_ex:
paulson@14324
    54
     "[| (0::real) < a; 0 < n |]  
paulson@14324
    55
      ==> \<exists>u. isLub (UNIV::real set) {x. x ^ n <= a & 0 < x} u"
paulson@14324
    56
apply (blast intro: lemma_nth_realpow_isUb_ex lemma_nth_realpow_non_empty reals_complete)
paulson@14324
    57
done
paulson@14324
    58
 
paulson@14324
    59
subsection{*First Half -- Lemmas First*}
paulson@14324
    60
paulson@14324
    61
lemma lemma_nth_realpow_seq:
paulson@14324
    62
     "isLub (UNIV::real set) {x. x ^ n <= a & (0::real) < x} u  
paulson@14324
    63
           ==> u + inverse(real (Suc k)) ~: {x. x ^ n <= a & 0 < x}"
paulson@14324
    64
apply (safe , drule isLubD2 , blast)
paulson@14324
    65
apply (simp add: real_le_def)
paulson@14324
    66
done
paulson@14324
    67
paulson@14324
    68
lemma lemma_nth_realpow_isLub_gt_zero:
paulson@14324
    69
     "[| isLub (UNIV::real set) {x. x ^ n <= a & (0::real) < x} u;  
paulson@14324
    70
         0 < a; 0 < n |] ==> 0 < u"
paulson@14324
    71
apply (drule lemma_nth_realpow_non_empty , auto)
paulson@14324
    72
apply (drule_tac y = "s" in isLub_isUb [THEN isUbD])
paulson@14324
    73
apply (auto intro: order_less_le_trans)
paulson@14324
    74
done
paulson@14324
    75
paulson@14324
    76
lemma lemma_nth_realpow_isLub_ge:
paulson@14324
    77
     "[| isLub (UNIV::real set) {x. x ^ n <= a & (0::real) < x} u;  
paulson@14324
    78
         0 < a; 0 < n |] ==> ALL k. a <= (u + inverse(real (Suc k))) ^ n"
paulson@14324
    79
apply (safe)
paulson@14324
    80
apply (frule lemma_nth_realpow_seq , safe)
paulson@14324
    81
apply (auto elim: real_less_asym simp add: real_le_def)
paulson@14324
    82
apply (simp add: real_le_def [symmetric])
paulson@14324
    83
apply (rule order_less_trans [of _ 0])
paulson@14325
    84
apply (auto intro: lemma_nth_realpow_isLub_gt_zero)
paulson@14324
    85
done
paulson@14324
    86
paulson@14324
    87
text{*First result we want*}
paulson@14324
    88
lemma realpow_nth_ge:
paulson@14324
    89
     "[| (0::real) < a; 0 < n;  
paulson@14324
    90
     isLub (UNIV::real set)  
paulson@14324
    91
     {x. x ^ n <= a & 0 < x} u |] ==> a <= u ^ n"
paulson@14324
    92
apply (frule lemma_nth_realpow_isLub_ge , safe)
paulson@14324
    93
apply (rule LIMSEQ_inverse_real_of_nat_add [THEN LIMSEQ_pow, THEN LIMSEQ_le_const])
paulson@14334
    94
apply (auto simp add: real_of_nat_def)
paulson@14324
    95
done
paulson@14324
    96
paulson@14324
    97
subsection{*Second Half*}
paulson@14324
    98
paulson@14324
    99
lemma less_isLub_not_isUb:
paulson@14324
   100
     "[| isLub (UNIV::real set) S u; x < u |]  
paulson@14324
   101
           ==> ~ isUb (UNIV::real set) S x"
paulson@14324
   102
apply (safe)
paulson@14324
   103
apply (drule isLub_le_isUb)
paulson@14324
   104
apply assumption
paulson@14324
   105
apply (drule order_less_le_trans)
paulson@14324
   106
apply (auto simp add: real_less_not_refl)
paulson@14324
   107
done
paulson@14324
   108
paulson@14324
   109
lemma not_isUb_less_ex:
paulson@14324
   110
     "~ isUb (UNIV::real set) S u ==> \<exists>x \<in> S. u < x"
paulson@14324
   111
apply (rule ccontr , erule swap)
paulson@14324
   112
apply (rule setleI [THEN isUbI])
paulson@14324
   113
apply (auto simp add: real_le_def)
paulson@14324
   114
done
paulson@14324
   115
paulson@14325
   116
lemma real_mult_less_self: "0 < r ==> r * (1 + -inverse(real (Suc n))) < r"
paulson@14334
   117
apply (simp (no_asm) add: right_distrib)
paulson@14334
   118
apply (rule add_less_cancel_left [of "-r", THEN iffD1])
paulson@14334
   119
apply (auto intro: mult_pos
paulson@14334
   120
            simp add: add_assoc [symmetric] neg_less_0_iff_less)
paulson@14325
   121
done
paulson@14325
   122
paulson@14325
   123
lemma real_mult_add_one_minus_ge_zero:
paulson@14325
   124
     "0 < r ==>  0 <= r*(1 + -inverse(real (Suc n)))"
paulson@14325
   125
apply (simp add: zero_le_mult_iff real_of_nat_inverse_le_iff) 
paulson@14334
   126
apply (simp add: real_of_nat_Suc) 
paulson@14325
   127
done
paulson@14325
   128
paulson@14324
   129
lemma lemma_nth_realpow_isLub_le:
paulson@14324
   130
     "[| isLub (UNIV::real set) {x. x ^ n <= a & (0::real) < x} u;  
paulson@14325
   131
       0 < a; 0 < n |] ==> ALL k. (u*(1 + -inverse(real (Suc k)))) ^ n <= a"
paulson@14324
   132
apply (safe)
paulson@14324
   133
apply (frule less_isLub_not_isUb [THEN not_isUb_less_ex])
paulson@14324
   134
apply (rule_tac n = "k" in real_mult_less_self)
paulson@14324
   135
apply (blast intro: lemma_nth_realpow_isLub_gt_zero)
paulson@14324
   136
apply (safe)
paulson@14348
   137
apply (drule_tac n = "k" in
paulson@14348
   138
        lemma_nth_realpow_isLub_gt_zero [THEN real_mult_add_one_minus_ge_zero])
paulson@14348
   139
apply assumption+
paulson@14348
   140
apply (blast intro: order_trans order_less_imp_le power_mono) 
paulson@14324
   141
done
paulson@14324
   142
paulson@14324
   143
text{*Second result we want*}
paulson@14324
   144
lemma realpow_nth_le:
paulson@14324
   145
     "[| (0::real) < a; 0 < n;  
paulson@14324
   146
     isLub (UNIV::real set)  
paulson@14324
   147
     {x. x ^ n <= a & 0 < x} u |] ==> u ^ n <= a"
paulson@14324
   148
apply (frule lemma_nth_realpow_isLub_le , safe)
paulson@14348
   149
apply (rule LIMSEQ_inverse_real_of_nat_add_minus_mult
paulson@14348
   150
                [THEN LIMSEQ_pow, THEN LIMSEQ_le_const2])
paulson@14334
   151
apply (auto simp add: real_of_nat_def)
paulson@14324
   152
done
paulson@14324
   153
paulson@14348
   154
text{*The theorem at last!*}
paulson@14324
   155
lemma realpow_nth: "[| (0::real) < a; 0 < n |] ==> \<exists>r. r ^ n = a"
paulson@14324
   156
apply (frule nth_realpow_isLub_ex , auto)
paulson@14324
   157
apply (auto intro: realpow_nth_le realpow_nth_ge real_le_anti_sym)
paulson@14324
   158
done
paulson@14324
   159
paulson@14324
   160
(* positive only *)
paulson@14324
   161
lemma realpow_pos_nth: "[| (0::real) < a; 0 < n |] ==> \<exists>r. 0 < r & r ^ n = a"
paulson@14324
   162
apply (frule nth_realpow_isLub_ex , auto)
paulson@14324
   163
apply (auto intro: realpow_nth_le realpow_nth_ge real_le_anti_sym lemma_nth_realpow_isLub_gt_zero)
paulson@14324
   164
done
paulson@14324
   165
paulson@14324
   166
lemma realpow_pos_nth2: "(0::real) < a  ==> \<exists>r. 0 < r & r ^ Suc n = a"
paulson@14324
   167
apply (blast intro: realpow_pos_nth)
paulson@14324
   168
done
paulson@14324
   169
paulson@14324
   170
(* uniqueness of nth positive root *)
paulson@14324
   171
lemma realpow_pos_nth_unique:
paulson@14324
   172
     "[| (0::real) < a; 0 < n |] ==> EX! r. 0 < r & r ^ n = a"
paulson@14324
   173
apply (auto intro!: realpow_pos_nth)
paulson@14324
   174
apply (cut_tac x = "r" and y = "y" in linorder_less_linear)
paulson@14324
   175
apply auto
paulson@14324
   176
apply (drule_tac x = "r" in realpow_less)
paulson@14324
   177
apply (drule_tac [4] x = "y" in realpow_less)
paulson@14324
   178
apply (auto simp add: real_less_not_refl)
paulson@14324
   179
done
paulson@14324
   180
paulson@14324
   181
ML
paulson@14324
   182
{*
paulson@14324
   183
val nth_realpow_isLub_ex = thm"nth_realpow_isLub_ex";
paulson@14324
   184
val realpow_nth_ge = thm"realpow_nth_ge";
paulson@14324
   185
val less_isLub_not_isUb = thm"less_isLub_not_isUb";
paulson@14324
   186
val not_isUb_less_ex = thm"not_isUb_less_ex";
paulson@14324
   187
val realpow_nth_le = thm"realpow_nth_le";
paulson@14324
   188
val realpow_nth = thm"realpow_nth";
paulson@14324
   189
val realpow_pos_nth = thm"realpow_pos_nth";
paulson@14324
   190
val realpow_pos_nth2 = thm"realpow_pos_nth2";
paulson@14324
   191
val realpow_pos_nth_unique = thm"realpow_pos_nth_unique";
paulson@14324
   192
*}
paulson@14324
   193
paulson@14324
   194
end