src/HOL/Hyperreal/NthRoot.thy
 author huffman Fri May 18 17:35:07 2007 +0200 (2007-05-18) changeset 23009 01c295dd4a36 parent 22968 7134874437ac child 23042 492514b39956 permissions -rw-r--r--
Prove existence of nth roots using Intermediate Value Theorem
```     1 (*  Title       : NthRoot.thy
```
```     2     Author      : Jacques D. Fleuriot
```
```     3     Copyright   : 1998  University of Cambridge
```
```     4     Conversion to Isar and new proofs by Lawrence C Paulson, 2004
```
```     5 *)
```
```     6
```
```     7 header {* Nth Roots of Real Numbers *}
```
```     8
```
```     9 theory NthRoot
```
```    10 imports SEQ Parity Deriv
```
```    11 begin
```
```    12
```
```    13 subsection {* Existence of Nth Root *}
```
```    14
```
```    15 text {* Existence follows from the Intermediate Value Theorem *}
```
```    16
```
```    17 lemma realpow_pos_nth:
```
```    18   assumes n: "0 < n"
```
```    19   assumes a: "0 < a"
```
```    20   shows "\<exists>r>0. r ^ n = (a::real)"
```
```    21 proof -
```
```    22   have "\<exists>r\<ge>0. r \<le> (max 1 a) \<and> r ^ n = a"
```
```    23   proof (rule IVT)
```
```    24     show "0 ^ n \<le> a" using n a by (simp add: power_0_left)
```
```    25     show "0 \<le> max 1 a" by simp
```
```    26     from n have n1: "1 \<le> n" by simp
```
```    27     have "a \<le> max 1 a ^ 1" by simp
```
```    28     also have "max 1 a ^ 1 \<le> max 1 a ^ n"
```
```    29       using n1 by (rule power_increasing, simp)
```
```    30     finally show "a \<le> max 1 a ^ n" .
```
```    31     show "\<forall>r. 0 \<le> r \<and> r \<le> max 1 a \<longrightarrow> isCont (\<lambda>x. x ^ n) r"
```
```    32       by (simp add: isCont_power isCont_Id)
```
```    33   qed
```
```    34   then obtain r where r: "0 \<le> r \<and> r ^ n = a" by fast
```
```    35   with n a have "r \<noteq> 0" by (auto simp add: power_0_left)
```
```    36   with r have "0 < r \<and> r ^ n = a" by simp
```
```    37   thus ?thesis ..
```
```    38 qed
```
```    39
```
```    40 text {* Uniqueness of nth positive root *}
```
```    41
```
```    42 lemma realpow_pos_nth_unique:
```
```    43   "\<lbrakk>0 < n; 0 < a\<rbrakk> \<Longrightarrow> \<exists>!r. 0 < r \<and> r ^ n = (a::real)"
```
```    44 apply (auto intro!: realpow_pos_nth)
```
```    45 apply (rule_tac n=n in power_eq_imp_eq_base, simp_all)
```
```    46 done
```
```    47
```
```    48 subsection {* Nth Root *}
```
```    49
```
```    50 text {* We define roots of negative reals such that
```
```    51   @{term "root n (- x) = - root n x"}. This allows
```
```    52   us to omit side conditions from many theorems. *}
```
```    53
```
```    54 definition
```
```    55   root :: "[nat, real] \<Rightarrow> real" where
```
```    56   "root n x = (if 0 < x then (THE u. 0 < u \<and> u ^ n = x) else
```
```    57                if x < 0 then - (THE u. 0 < u \<and> u ^ n = - x) else 0)"
```
```    58
```
```    59 lemma real_root_zero [simp]: "root n 0 = 0"
```
```    60 unfolding root_def by simp
```
```    61
```
```    62 lemma real_root_minus: "0 < n \<Longrightarrow> root n (- x) = - root n x"
```
```    63 unfolding root_def by simp
```
```    64
```
```    65 lemma real_root_gt_zero: "\<lbrakk>0 < n; 0 < x\<rbrakk> \<Longrightarrow> 0 < root n x"
```
```    66 apply (simp add: root_def)
```
```    67 apply (drule (1) realpow_pos_nth_unique)
```
```    68 apply (erule theI' [THEN conjunct1])
```
```    69 done
```
```    70
```
```    71 lemma real_root_pow_pos: (* TODO: rename *)
```
```    72   "\<lbrakk>0 < n; 0 < x\<rbrakk> \<Longrightarrow> root n x ^ n = x"
```
```    73 apply (simp add: root_def)
```
```    74 apply (drule (1) realpow_pos_nth_unique)
```
```    75 apply (erule theI' [THEN conjunct2])
```
```    76 done
```
```    77
```
```    78 lemma real_root_pow_pos2 [simp]: (* TODO: rename *)
```
```    79   "\<lbrakk>0 < n; 0 \<le> x\<rbrakk> \<Longrightarrow> root n x ^ n = x"
```
```    80 by (auto simp add: order_le_less real_root_pow_pos)
```
```    81
```
```    82 lemma real_root_ge_zero: "\<lbrakk>0 < n; 0 \<le> x\<rbrakk> \<Longrightarrow> 0 \<le> root n x"
```
```    83 by (auto simp add: order_le_less real_root_gt_zero)
```
```    84
```
```    85 lemma real_root_power_cancel: "\<lbrakk>0 < n; 0 \<le> x\<rbrakk> \<Longrightarrow> root n (x ^ n) = x"
```
```    86 apply (subgoal_tac "0 \<le> x ^ n")
```
```    87 apply (subgoal_tac "0 \<le> root n (x ^ n)")
```
```    88 apply (subgoal_tac "root n (x ^ n) ^ n = x ^ n")
```
```    89 apply (erule (3) power_eq_imp_eq_base)
```
```    90 apply (erule (1) real_root_pow_pos2)
```
```    91 apply (erule (1) real_root_ge_zero)
```
```    92 apply (erule zero_le_power)
```
```    93 done
```
```    94
```
```    95 lemma real_root_pos_unique:
```
```    96   "\<lbrakk>0 < n; 0 \<le> y; y ^ n = x\<rbrakk> \<Longrightarrow> root n x = y"
```
```    97 by (erule subst, rule real_root_power_cancel)
```
```    98
```
```    99 lemma real_root_one [simp]: "0 < n \<Longrightarrow> root n 1 = 1"
```
```   100 by (simp add: real_root_pos_unique)
```
```   101
```
```   102 text {* Root function is strictly monotonic, hence injective *}
```
```   103
```
```   104 lemma real_root_less_mono_lemma:
```
```   105   "\<lbrakk>0 < n; 0 \<le> x; x < y\<rbrakk> \<Longrightarrow> root n x < root n y"
```
```   106 apply (subgoal_tac "0 \<le> y")
```
```   107 apply (subgoal_tac "root n x ^ n < root n y ^ n")
```
```   108 apply (erule power_less_imp_less_base)
```
```   109 apply (erule (1) real_root_ge_zero)
```
```   110 apply simp
```
```   111 apply simp
```
```   112 done
```
```   113
```
```   114 lemma real_root_less_mono: "\<lbrakk>0 < n; x < y\<rbrakk> \<Longrightarrow> root n x < root n y"
```
```   115 apply (cases "0 \<le> x")
```
```   116 apply (erule (2) real_root_less_mono_lemma)
```
```   117 apply (cases "0 \<le> y")
```
```   118 apply (rule_tac y=0 in order_less_le_trans)
```
```   119 apply (subgoal_tac "0 < root n (- x)")
```
```   120 apply (simp add: real_root_minus)
```
```   121 apply (simp add: real_root_gt_zero)
```
```   122 apply (simp add: real_root_ge_zero)
```
```   123 apply (subgoal_tac "root n (- y) < root n (- x)")
```
```   124 apply (simp add: real_root_minus)
```
```   125 apply (simp add: real_root_less_mono_lemma)
```
```   126 done
```
```   127
```
```   128 lemma real_root_le_mono: "\<lbrakk>0 < n; x \<le> y\<rbrakk> \<Longrightarrow> root n x \<le> root n y"
```
```   129 by (auto simp add: order_le_less real_root_less_mono)
```
```   130
```
```   131 lemma real_root_less_iff [simp]:
```
```   132   "0 < n \<Longrightarrow> (root n x < root n y) = (x < y)"
```
```   133 apply (cases "x < y")
```
```   134 apply (simp add: real_root_less_mono)
```
```   135 apply (simp add: linorder_not_less real_root_le_mono)
```
```   136 done
```
```   137
```
```   138 lemma real_root_le_iff [simp]:
```
```   139   "0 < n \<Longrightarrow> (root n x \<le> root n y) = (x \<le> y)"
```
```   140 apply (cases "x \<le> y")
```
```   141 apply (simp add: real_root_le_mono)
```
```   142 apply (simp add: linorder_not_le real_root_less_mono)
```
```   143 done
```
```   144
```
```   145 lemma real_root_eq_iff [simp]:
```
```   146   "0 < n \<Longrightarrow> (root n x = root n y) = (x = y)"
```
```   147 by (simp add: order_eq_iff)
```
```   148
```
```   149 lemmas real_root_gt_0_iff [simp] = real_root_less_iff [where x=0, simplified]
```
```   150 lemmas real_root_lt_0_iff [simp] = real_root_less_iff [where y=0, simplified]
```
```   151 lemmas real_root_ge_0_iff [simp] = real_root_le_iff [where x=0, simplified]
```
```   152 lemmas real_root_le_0_iff [simp] = real_root_le_iff [where y=0, simplified]
```
```   153 lemmas real_root_eq_0_iff [simp] = real_root_eq_iff [where y=0, simplified]
```
```   154
```
```   155 text {* Roots of multiplication and division *}
```
```   156
```
```   157 lemma real_root_mult_lemma:
```
```   158   "\<lbrakk>0 < n; 0 \<le> x; 0 \<le> y\<rbrakk> \<Longrightarrow> root n (x * y) = root n x * root n y"
```
```   159 by (simp add: real_root_pos_unique mult_nonneg_nonneg power_mult_distrib)
```
```   160
```
```   161 lemma real_root_inverse_lemma:
```
```   162   "\<lbrakk>0 < n; 0 \<le> x\<rbrakk> \<Longrightarrow> root n (inverse x) = inverse (root n x)"
```
```   163 by (simp add: real_root_pos_unique power_inverse [symmetric])
```
```   164
```
```   165 lemma real_root_mult:
```
```   166   assumes n: "0 < n"
```
```   167   shows "root n (x * y) = root n x * root n y"
```
```   168 proof (rule linorder_le_cases, rule_tac [!] linorder_le_cases)
```
```   169   assume "0 \<le> x" and "0 \<le> y"
```
```   170   thus ?thesis by (rule real_root_mult_lemma [OF n])
```
```   171 next
```
```   172   assume "0 \<le> x" and "y \<le> 0"
```
```   173   hence "0 \<le> x" and "0 \<le> - y" by simp_all
```
```   174   hence "root n (x * - y) = root n x * root n (- y)"
```
```   175     by (rule real_root_mult_lemma [OF n])
```
```   176   thus ?thesis by (simp add: real_root_minus [OF n])
```
```   177 next
```
```   178   assume "x \<le> 0" and "0 \<le> y"
```
```   179   hence "0 \<le> - x" and "0 \<le> y" by simp_all
```
```   180   hence "root n (- x * y) = root n (- x) * root n y"
```
```   181     by (rule real_root_mult_lemma [OF n])
```
```   182   thus ?thesis by (simp add: real_root_minus [OF n])
```
```   183 next
```
```   184   assume "x \<le> 0" and "y \<le> 0"
```
```   185   hence "0 \<le> - x" and "0 \<le> - y" by simp_all
```
```   186   hence "root n (- x * - y) = root n (- x) * root n (- y)"
```
```   187     by (rule real_root_mult_lemma [OF n])
```
```   188   thus ?thesis by (simp add: real_root_minus [OF n])
```
```   189 qed
```
```   190
```
```   191 lemma real_root_inverse:
```
```   192   assumes n: "0 < n"
```
```   193   shows "root n (inverse x) = inverse (root n x)"
```
```   194 proof (rule linorder_le_cases)
```
```   195   assume "0 \<le> x"
```
```   196   thus ?thesis by (rule real_root_inverse_lemma [OF n])
```
```   197 next
```
```   198   assume "x \<le> 0"
```
```   199   hence "0 \<le> - x" by simp
```
```   200   hence "root n (inverse (- x)) = inverse (root n (- x))"
```
```   201     by (rule real_root_inverse_lemma [OF n])
```
```   202   thus ?thesis by (simp add: real_root_minus [OF n])
```
```   203 qed
```
```   204
```
```   205 lemma real_root_divide:
```
```   206   "0 < n \<Longrightarrow> root n (x / y) = root n x / root n y"
```
```   207 by (simp add: divide_inverse real_root_mult real_root_inverse)
```
```   208
```
```   209 lemma real_root_power:
```
```   210   "0 < n \<Longrightarrow> root n (x ^ k) = root n x ^ k"
```
```   211 by (induct k, simp_all add: real_root_mult)
```
```   212
```
```   213 subsection {* Square Root *}
```
```   214
```
```   215 definition
```
```   216   sqrt :: "real \<Rightarrow> real" where
```
```   217   "sqrt = root 2"
```
```   218
```
```   219 lemma pos2: "0 < (2::nat)" by simp
```
```   220
```
```   221 lemma real_sqrt_unique: "\<lbrakk>y\<twosuperior> = x; 0 \<le> y\<rbrakk> \<Longrightarrow> sqrt x = y"
```
```   222 unfolding sqrt_def by (rule real_root_pos_unique [OF pos2])
```
```   223
```
```   224 lemma real_sqrt_abs [simp]: "sqrt (x\<twosuperior>) = \<bar>x\<bar>"
```
```   225 apply (rule real_sqrt_unique)
```
```   226 apply (rule power2_abs)
```
```   227 apply (rule abs_ge_zero)
```
```   228 done
```
```   229
```
```   230 lemma real_sqrt_pow2 [simp]: "0 \<le> x \<Longrightarrow> (sqrt x)\<twosuperior> = x"
```
```   231 unfolding sqrt_def by (rule real_root_pow_pos2 [OF pos2])
```
```   232
```
```   233 lemma real_sqrt_pow2_iff [simp]: "((sqrt x)\<twosuperior> = x) = (0 \<le> x)"
```
```   234 apply (rule iffI)
```
```   235 apply (erule subst)
```
```   236 apply (rule zero_le_power2)
```
```   237 apply (erule real_sqrt_pow2)
```
```   238 done
```
```   239
```
```   240 lemma real_sqrt_zero [simp]: "sqrt 0 = 0"
```
```   241 unfolding sqrt_def by (rule real_root_zero)
```
```   242
```
```   243 lemma real_sqrt_one [simp]: "sqrt 1 = 1"
```
```   244 unfolding sqrt_def by (rule real_root_one [OF pos2])
```
```   245
```
```   246 lemma real_sqrt_minus: "sqrt (- x) = - sqrt x"
```
```   247 unfolding sqrt_def by (rule real_root_minus [OF pos2])
```
```   248
```
```   249 lemma real_sqrt_mult: "sqrt (x * y) = sqrt x * sqrt y"
```
```   250 unfolding sqrt_def by (rule real_root_mult [OF pos2])
```
```   251
```
```   252 lemma real_sqrt_inverse: "sqrt (inverse x) = inverse (sqrt x)"
```
```   253 unfolding sqrt_def by (rule real_root_inverse [OF pos2])
```
```   254
```
```   255 lemma real_sqrt_divide: "sqrt (x / y) = sqrt x / sqrt y"
```
```   256 unfolding sqrt_def by (rule real_root_divide [OF pos2])
```
```   257
```
```   258 lemma real_sqrt_power: "sqrt (x ^ k) = sqrt x ^ k"
```
```   259 unfolding sqrt_def by (rule real_root_power [OF pos2])
```
```   260
```
```   261 lemma real_sqrt_gt_zero: "0 < x \<Longrightarrow> 0 < sqrt x"
```
```   262 unfolding sqrt_def by (rule real_root_gt_zero [OF pos2])
```
```   263
```
```   264 lemma real_sqrt_ge_zero: "0 \<le> x \<Longrightarrow> 0 \<le> sqrt x"
```
```   265 unfolding sqrt_def by (rule real_root_ge_zero [OF pos2])
```
```   266
```
```   267 lemma real_sqrt_less_mono: "x < y \<Longrightarrow> sqrt x < sqrt y"
```
```   268 unfolding sqrt_def by (rule real_root_less_mono [OF pos2])
```
```   269
```
```   270 lemma real_sqrt_le_mono: "x \<le> y \<Longrightarrow> sqrt x \<le> sqrt y"
```
```   271 unfolding sqrt_def by (rule real_root_le_mono [OF pos2])
```
```   272
```
```   273 lemma real_sqrt_less_iff [simp]: "(sqrt x < sqrt y) = (x < y)"
```
```   274 unfolding sqrt_def by (rule real_root_less_iff [OF pos2])
```
```   275
```
```   276 lemma real_sqrt_le_iff [simp]: "(sqrt x \<le> sqrt y) = (x \<le> y)"
```
```   277 unfolding sqrt_def by (rule real_root_le_iff [OF pos2])
```
```   278
```
```   279 lemma real_sqrt_eq_iff [simp]: "(sqrt x = sqrt y) = (x = y)"
```
```   280 unfolding sqrt_def by (rule real_root_eq_iff [OF pos2])
```
```   281
```
```   282 lemmas real_sqrt_gt_0_iff [simp] = real_sqrt_less_iff [where x=0, simplified]
```
```   283 lemmas real_sqrt_lt_0_iff [simp] = real_sqrt_less_iff [where y=0, simplified]
```
```   284 lemmas real_sqrt_ge_0_iff [simp] = real_sqrt_le_iff [where x=0, simplified]
```
```   285 lemmas real_sqrt_le_0_iff [simp] = real_sqrt_le_iff [where y=0, simplified]
```
```   286 lemmas real_sqrt_eq_0_iff [simp] = real_sqrt_eq_iff [where y=0, simplified]
```
```   287
```
```   288 lemmas real_sqrt_gt_1_iff [simp] = real_sqrt_less_iff [where x=1, simplified]
```
```   289 lemmas real_sqrt_lt_1_iff [simp] = real_sqrt_less_iff [where y=1, simplified]
```
```   290 lemmas real_sqrt_ge_1_iff [simp] = real_sqrt_le_iff [where x=1, simplified]
```
```   291 lemmas real_sqrt_le_1_iff [simp] = real_sqrt_le_iff [where y=1, simplified]
```
```   292 lemmas real_sqrt_eq_1_iff [simp] = real_sqrt_eq_iff [where y=1, simplified]
```
```   293
```
```   294 lemma not_real_square_gt_zero [simp]: "(~ (0::real) < x*x) = (x = 0)"
```
```   295 apply auto
```
```   296 apply (cut_tac x = x and y = 0 in linorder_less_linear)
```
```   297 apply (simp add: zero_less_mult_iff)
```
```   298 done
```
```   299
```
```   300 lemma real_sqrt_abs2 [simp]: "sqrt(x*x) = \<bar>x\<bar>"
```
```   301 apply (subst power2_eq_square [symmetric])
```
```   302 apply (rule real_sqrt_abs)
```
```   303 done
```
```   304
```
```   305 lemma real_sqrt_pow2_gt_zero: "0 < x ==> 0 < (sqrt x)\<twosuperior>"
```
```   306 by simp (* TODO: delete *)
```
```   307
```
```   308 lemma real_sqrt_not_eq_zero: "0 < x ==> sqrt x \<noteq> 0"
```
```   309 by simp (* TODO: delete *)
```
```   310
```
```   311 lemma real_inv_sqrt_pow2: "0 < x ==> inverse (sqrt(x)) ^ 2 = inverse x"
```
```   312 by (simp add: power_inverse [symmetric])
```
```   313
```
```   314 lemma real_sqrt_eq_zero_cancel: "[| 0 \<le> x; sqrt(x) = 0|] ==> x = 0"
```
```   315 by simp
```
```   316
```
```   317 lemma real_sqrt_ge_one: "1 \<le> x ==> 1 \<le> sqrt x"
```
```   318 by simp
```
```   319
```
```   320 lemma sqrt_divide_self_eq:
```
```   321   assumes nneg: "0 \<le> x"
```
```   322   shows "sqrt x / x = inverse (sqrt x)"
```
```   323 proof cases
```
```   324   assume "x=0" thus ?thesis by simp
```
```   325 next
```
```   326   assume nz: "x\<noteq>0"
```
```   327   hence pos: "0<x" using nneg by arith
```
```   328   show ?thesis
```
```   329   proof (rule right_inverse_eq [THEN iffD1, THEN sym])
```
```   330     show "sqrt x / x \<noteq> 0" by (simp add: divide_inverse nneg nz)
```
```   331     show "inverse (sqrt x) / (sqrt x / x) = 1"
```
```   332       by (simp add: divide_inverse mult_assoc [symmetric]
```
```   333                   power2_eq_square [symmetric] real_inv_sqrt_pow2 pos nz)
```
```   334   qed
```
```   335 qed
```
```   336
```
```   337 lemma real_divide_square_eq [simp]: "(((r::real) * a) / (r * r)) = a / r"
```
```   338 apply (simp add: divide_inverse)
```
```   339 apply (case_tac "r=0")
```
```   340 apply (auto simp add: mult_ac)
```
```   341 done
```
```   342
```
```   343 subsection {* Square Root of Sum of Squares *}
```
```   344
```
```   345 lemma real_sqrt_mult_self_sum_ge_zero [simp]: "0 \<le> sqrt(x*x + y*y)"
```
```   346 by (rule real_sqrt_ge_zero [OF sum_squares_ge_zero])
```
```   347
```
```   348 lemma real_sqrt_sum_squares_ge_zero [simp]: "0 \<le> sqrt (x\<twosuperior> + y\<twosuperior>)"
```
```   349 by simp
```
```   350
```
```   351 lemma real_sqrt_sum_squares_mult_ge_zero [simp]:
```
```   352      "0 \<le> sqrt ((x\<twosuperior> + y\<twosuperior>)*(xa\<twosuperior> + ya\<twosuperior>))"
```
```   353 by (auto intro!: real_sqrt_ge_zero simp add: zero_le_mult_iff)
```
```   354
```
```   355 lemma real_sqrt_sum_squares_mult_squared_eq [simp]:
```
```   356      "sqrt ((x\<twosuperior> + y\<twosuperior>) * (xa\<twosuperior> + ya\<twosuperior>)) ^ 2 = (x\<twosuperior> + y\<twosuperior>) * (xa\<twosuperior> + ya\<twosuperior>)"
```
```   357 by (auto simp add: zero_le_mult_iff)
```
```   358
```
```   359 lemma real_sqrt_sum_squares_ge1 [simp]: "x \<le> sqrt(x\<twosuperior> + y\<twosuperior>)"
```
```   360 by (rule power2_le_imp_le, simp_all)
```
```   361
```
```   362 lemma real_sqrt_sum_squares_ge2 [simp]: "y \<le> sqrt(x\<twosuperior> + y\<twosuperior>)"
```
```   363 by (rule power2_le_imp_le, simp_all)
```
```   364
```
```   365 lemma power2_sum:
```
```   366   fixes x y :: "'a::{number_ring,recpower}"
```
```   367   shows "(x + y)\<twosuperior> = x\<twosuperior> + y\<twosuperior> + 2 * x * y"
```
```   368 by (simp add: left_distrib right_distrib power2_eq_square)
```
```   369
```
```   370 lemma power2_diff:
```
```   371   fixes x y :: "'a::{number_ring,recpower}"
```
```   372   shows "(x - y)\<twosuperior> = x\<twosuperior> + y\<twosuperior> - 2 * x * y"
```
```   373 by (simp add: left_diff_distrib right_diff_distrib power2_eq_square)
```
```   374
```
```   375 lemma real_sqrt_sum_squares_triangle_ineq:
```
```   376   "sqrt ((a + c)\<twosuperior> + (b + d)\<twosuperior>) \<le> sqrt (a\<twosuperior> + b\<twosuperior>) + sqrt (c\<twosuperior> + d\<twosuperior>)"
```
```   377 apply (rule power2_le_imp_le, simp)
```
```   378 apply (simp add: power2_sum)
```
```   379 apply (simp only: mult_assoc right_distrib [symmetric])
```
```   380 apply (rule mult_left_mono)
```
```   381 apply (rule power2_le_imp_le)
```
```   382 apply (simp add: power2_sum power_mult_distrib)
```
```   383 apply (simp add: ring_distrib)
```
```   384 apply (subgoal_tac "0 \<le> b\<twosuperior> * c\<twosuperior> + a\<twosuperior> * d\<twosuperior> - 2 * (a * c) * (b * d)", simp)
```
```   385 apply (rule_tac b="(a * d - b * c)\<twosuperior>" in ord_le_eq_trans)
```
```   386 apply (rule zero_le_power2)
```
```   387 apply (simp add: power2_diff power_mult_distrib)
```
```   388 apply (simp add: mult_nonneg_nonneg)
```
```   389 apply simp
```
```   390 apply (simp add: add_increasing)
```
```   391 done
```
```   392
```
```   393 text "Legacy theorem names:"
```
```   394 lemmas real_root_pos2 = real_root_power_cancel
```
```   395 lemmas real_root_pos_pos = real_root_gt_zero [THEN order_less_imp_le]
```
```   396 lemmas real_root_pos_pos_le = real_root_ge_zero
```
```   397 lemmas real_sqrt_mult_distrib = real_sqrt_mult
```
```   398 lemmas real_sqrt_mult_distrib2 = real_sqrt_mult
```
```   399 lemmas real_sqrt_eq_zero_cancel_iff = real_sqrt_eq_0_iff
```
```   400
```
```   401 (* needed for CauchysMeanTheorem.het_base from AFP *)
```
```   402 lemma real_root_pos: "0 < x \<Longrightarrow> root (Suc n) (x ^ (Suc n)) = x"
```
```   403 by (rule real_root_power_cancel [OF zero_less_Suc order_less_imp_le])
```
```   404
```
```   405 (* FIXME: the stronger version of real_root_less_iff
```
```   406  breaks CauchysMeanTheorem.list_gmean_gt_iff from AFP. *)
```
```   407
```
```   408 declare real_root_less_iff [simp del]
```
```   409 lemma real_root_less_iff_nonneg [simp]:
```
```   410   "\<lbrakk>0 < n; 0 \<le> x; 0 \<le> y\<rbrakk> \<Longrightarrow> (root n x < root n y) = (x < y)"
```
```   411 by (rule real_root_less_iff)
```
```   412
```
```   413 end
```