src/HOL/Real/RealPow.thy
author paulson
Fri Dec 19 10:38:48 2003 +0100 (2003-12-19)
changeset 14304 cc0b4bbfbc43
parent 14288 d149e3cbdb39
child 14334 6137d24eef79
permissions -rw-r--r--
minor tweaks
wenzelm@9435
     1
(*  Title       : HOL/Real/RealPow.thy
paulson@7219
     2
    ID          : $Id$
paulson@7077
     3
    Author      : Jacques D. Fleuriot  
paulson@7077
     4
    Copyright   : 1998  University of Cambridge
paulson@7077
     5
    Description : Natural powers theory
paulson@7077
     6
paulson@7077
     7
*)
paulson@7077
     8
paulson@14269
     9
theory RealPow = RealArith:
wenzelm@9435
    10
wenzelm@10309
    11
instance real :: power ..
paulson@7077
    12
wenzelm@8856
    13
primrec (realpow)
paulson@12018
    14
     realpow_0:   "r ^ 0       = 1"
wenzelm@9435
    15
     realpow_Suc: "r ^ (Suc n) = (r::real) * (r ^ n)"
paulson@7077
    16
paulson@14265
    17
paulson@14268
    18
lemma realpow_zero [simp]: "(0::real) ^ (Suc n) = 0"
paulson@14268
    19
by auto
paulson@14265
    20
paulson@14268
    21
lemma realpow_not_zero [rule_format]: "r \<noteq> (0::real) --> r ^ n \<noteq> 0"
paulson@14268
    22
by (induct_tac "n", auto)
paulson@14265
    23
paulson@14265
    24
lemma realpow_zero_zero: "r ^ n = (0::real) ==> r = 0"
paulson@14265
    25
apply (rule ccontr)
paulson@14265
    26
apply (auto dest: realpow_not_zero)
paulson@14265
    27
done
paulson@14265
    28
paulson@14265
    29
lemma realpow_inverse: "inverse ((r::real) ^ n) = (inverse r) ^ n"
paulson@14265
    30
apply (induct_tac "n")
paulson@14265
    31
apply (auto simp add: real_inverse_distrib)
paulson@14265
    32
done
paulson@14265
    33
paulson@14265
    34
lemma realpow_abs: "abs(r ^ n) = abs(r::real) ^ n"
paulson@14265
    35
apply (induct_tac "n")
paulson@14265
    36
apply (auto simp add: abs_mult)
paulson@14265
    37
done
paulson@14265
    38
paulson@14265
    39
lemma realpow_add: "(r::real) ^ (n + m) = (r ^ n) * (r ^ m)"
paulson@14265
    40
apply (induct_tac "n")
paulson@14265
    41
apply (auto simp add: real_mult_ac)
paulson@14265
    42
done
paulson@14265
    43
paulson@14268
    44
lemma realpow_one [simp]: "(r::real) ^ 1 = r"
paulson@14268
    45
by simp
paulson@14265
    46
paulson@14265
    47
lemma realpow_two: "(r::real)^ (Suc (Suc 0)) = r * r"
paulson@14268
    48
by simp
paulson@14265
    49
paulson@14268
    50
lemma realpow_gt_zero [rule_format]: "(0::real) < r --> 0 < r ^ n"
paulson@14265
    51
apply (induct_tac "n")
paulson@14265
    52
apply (auto intro: real_mult_order simp add: real_zero_less_one)
paulson@14265
    53
done
paulson@14265
    54
paulson@14268
    55
lemma realpow_ge_zero [rule_format]: "(0::real) \<le> r --> 0 \<le> r ^ n"
paulson@14265
    56
apply (induct_tac "n")
paulson@14265
    57
apply (auto simp add: real_0_le_mult_iff)
paulson@14265
    58
done
paulson@14265
    59
paulson@14268
    60
lemma realpow_le [rule_format]: "(0::real) \<le> x & x \<le> y --> x ^ n \<le> y ^ n"
paulson@14265
    61
apply (induct_tac "n")
paulson@14265
    62
apply (auto intro!: real_mult_le_mono)
paulson@14265
    63
apply (simp (no_asm_simp) add: realpow_ge_zero)
paulson@14265
    64
done
paulson@14265
    65
paulson@14265
    66
lemma realpow_0_left [rule_format, simp]:
paulson@14265
    67
     "0 < n --> 0 ^ n = (0::real)"
paulson@14268
    68
apply (induct_tac "n", auto) 
paulson@14265
    69
done
paulson@14265
    70
paulson@14265
    71
lemma realpow_less' [rule_format]:
paulson@14265
    72
     "[|(0::real) \<le> x; x < y |] ==> 0 < n --> x ^ n < y ^ n"
paulson@14265
    73
apply (induct n) 
paulson@14268
    74
apply (auto simp add: real_mult_less_mono' realpow_ge_zero) 
paulson@14265
    75
done
paulson@14265
    76
paulson@14265
    77
text{*Legacy: weaker version of the theorem above*}
paulson@14268
    78
lemma realpow_less:
paulson@14265
    79
     "[|(0::real) < x; x < y; 0 < n|] ==> x ^ n < y ^ n"
paulson@14268
    80
apply (rule realpow_less', auto) 
paulson@14265
    81
done
paulson@14265
    82
paulson@14268
    83
lemma realpow_eq_one [simp]: "1 ^ n = (1::real)"
paulson@14268
    84
by (induct_tac "n", auto)
paulson@14265
    85
paulson@14268
    86
lemma abs_realpow_minus_one [simp]: "abs((-1) ^ n) = (1::real)"
paulson@14265
    87
apply (induct_tac "n")
paulson@14265
    88
apply (auto simp add: abs_mult)
paulson@14265
    89
done
paulson@14265
    90
paulson@14265
    91
lemma realpow_mult: "((r::real) * s) ^ n = (r ^ n) * (s ^ n)"
paulson@14265
    92
apply (induct_tac "n")
paulson@14265
    93
apply (auto simp add: real_mult_ac)
paulson@14265
    94
done
paulson@14265
    95
paulson@14268
    96
lemma realpow_two_le [simp]: "(0::real) \<le> r^ Suc (Suc 0)"
paulson@14268
    97
by (simp add: real_le_square)
paulson@14265
    98
paulson@14268
    99
lemma abs_realpow_two [simp]: "abs((x::real)^Suc (Suc 0)) = x^Suc (Suc 0)"
paulson@14268
   100
by (simp add: abs_eqI1 real_le_square)
paulson@14265
   101
paulson@14268
   102
lemma realpow_two_abs [simp]: "abs(x::real)^Suc (Suc 0) = x^Suc (Suc 0)"
paulson@14268
   103
by (simp add: realpow_abs [symmetric] abs_eqI1 del: realpow_Suc)
paulson@14265
   104
paulson@14265
   105
lemma realpow_two_gt_one: "(1::real) < r ==> 1 < r^ (Suc (Suc 0))"
paulson@14265
   106
apply auto
paulson@14265
   107
apply (cut_tac real_zero_less_one)
paulson@14268
   108
apply (frule_tac x = 0 in order_less_trans, assumption)
paulson@14268
   109
apply (drule_tac  z = r and x = 1 in real_mult_less_mono1)
paulson@14265
   110
apply (auto intro: order_less_trans)
paulson@14265
   111
done
paulson@14265
   112
paulson@14268
   113
lemma realpow_ge_one [rule_format]: "(1::real) < r --> 1 \<le> r ^ n"
paulson@14268
   114
apply (induct_tac "n", auto)
paulson@14265
   115
apply (subgoal_tac "1*1 \<le> r * r^n")
paulson@14268
   116
apply (rule_tac [2] real_mult_le_mono, auto)
paulson@14265
   117
done
paulson@14265
   118
paulson@14265
   119
lemma realpow_ge_one2: "(1::real) \<le> r ==> 1 \<le> r ^ n"
paulson@14265
   120
apply (drule order_le_imp_less_or_eq)
paulson@14265
   121
apply (auto dest: realpow_ge_one)
paulson@14265
   122
done
paulson@14265
   123
paulson@14268
   124
lemma two_realpow_ge_one [simp]: "(1::real) \<le> 2 ^ n"
paulson@14265
   125
apply (rule_tac y = "1 ^ n" in order_trans)
paulson@14265
   126
apply (rule_tac [2] realpow_le)
paulson@14265
   127
apply (auto intro: order_less_imp_le)
paulson@14265
   128
done
paulson@14265
   129
paulson@14268
   130
lemma two_realpow_gt [simp]: "real (n::nat) < 2 ^ n"
paulson@14265
   131
apply (induct_tac "n")
paulson@14265
   132
apply (auto simp add: real_of_nat_Suc)
paulson@14265
   133
apply (subst real_mult_2)
paulson@14265
   134
apply (rule real_add_less_le_mono)
paulson@14265
   135
apply (auto simp add: two_realpow_ge_one)
paulson@14265
   136
done
paulson@14265
   137
paulson@14268
   138
lemma realpow_minus_one [simp]: "(-1) ^ (2*n) = (1::real)"
paulson@14268
   139
by (induct_tac "n", auto)
paulson@14268
   140
paulson@14268
   141
lemma realpow_minus_one_odd [simp]: "(-1) ^ Suc (2*n) = -(1::real)"
paulson@14268
   142
by auto
paulson@14265
   143
paulson@14268
   144
lemma realpow_minus_one_even [simp]: "(-1) ^ Suc (Suc (2*n)) = (1::real)"
paulson@14268
   145
by auto
paulson@14265
   146
paulson@14268
   147
lemma realpow_Suc_less [rule_format]:
paulson@14268
   148
     "(0::real) < r & r < (1::real) --> r ^ Suc n < r ^ n"
paulson@14288
   149
  by (induct_tac "n", auto simp add: mult_less_cancel_left)
paulson@14265
   150
paulson@14288
   151
lemma realpow_Suc_le [rule_format]:
paulson@14288
   152
     "0 \<le> r & r < (1::real) --> r ^ Suc n \<le> r ^ n"
paulson@14265
   153
apply (induct_tac "n")
paulson@14265
   154
apply (auto intro: order_less_imp_le dest!: order_le_imp_less_or_eq)
paulson@14265
   155
done
paulson@14265
   156
paulson@14268
   157
lemma realpow_zero_le [simp]: "(0::real) \<le> 0 ^ n"
paulson@14268
   158
by (case_tac "n", auto)
paulson@14265
   159
paulson@14268
   160
lemma realpow_Suc_le2 [rule_format]: "0 < r & r < (1::real) --> r ^ Suc n \<le> r ^ n"
paulson@14268
   161
by (blast intro!: order_less_imp_le realpow_Suc_less)
paulson@14265
   162
paulson@14265
   163
lemma realpow_Suc_le3: "[| 0 \<le> r; r < (1::real) |] ==> r ^ Suc n \<le> r ^ n"
paulson@14265
   164
apply (erule order_le_imp_less_or_eq [THEN disjE])
paulson@14268
   165
apply (rule realpow_Suc_le2, auto)
paulson@14265
   166
done
paulson@14265
   167
paulson@14268
   168
lemma realpow_less_le [rule_format]: "0 \<le> r & r < (1::real) & n < N --> r ^ N \<le> r ^ n"
paulson@14265
   169
apply (induct_tac "N")
paulson@14265
   170
apply (simp_all (no_asm_simp))
paulson@14265
   171
apply clarify
paulson@14268
   172
apply (subgoal_tac "r * r ^ na \<le> 1 * r ^ n", simp)
paulson@14265
   173
apply (rule real_mult_le_mono)
paulson@14265
   174
apply (auto simp add: realpow_ge_zero less_Suc_eq)
paulson@14265
   175
done
paulson@14265
   176
paulson@14265
   177
lemma realpow_le_le: "[| 0 \<le> r; r < (1::real); n \<le> N |] ==> r ^ N \<le> r ^ n"
paulson@14268
   178
apply (drule_tac n = N in le_imp_less_or_eq)
paulson@14265
   179
apply (auto intro: realpow_less_le)
paulson@14265
   180
done
paulson@14265
   181
paulson@14265
   182
lemma realpow_Suc_le_self: "[| 0 < r; r < (1::real) |] ==> r ^ Suc n \<le> r"
paulson@14268
   183
by (drule_tac n = 1 and N = "Suc n" in order_less_imp_le [THEN realpow_le_le], auto)
paulson@14265
   184
paulson@14265
   185
lemma realpow_Suc_less_one: "[| 0 < r; r < (1::real) |] ==> r ^ Suc n < 1"
paulson@14268
   186
by (blast intro: realpow_Suc_le_self order_le_less_trans)
paulson@14268
   187
paulson@14268
   188
lemma realpow_le_Suc [rule_format]: "(1::real) \<le> r --> r ^ n \<le> r ^ Suc n"
paulson@14268
   189
by (induct_tac "n", auto)
paulson@14268
   190
paulson@14268
   191
lemma realpow_less_Suc [rule_format]: "(1::real) < r --> r ^ n < r ^ Suc n"
paulson@14288
   192
by (induct_tac "n", auto simp add: mult_less_cancel_left)
paulson@14265
   193
paulson@14268
   194
lemma realpow_le_Suc2 [rule_format]: "(1::real) < r --> r ^ n \<le> r ^ Suc n"
paulson@14268
   195
by (blast intro!: order_less_imp_le realpow_less_Suc)
paulson@14268
   196
paulson@14268
   197
(*One use in RealPow.thy*)
paulson@14268
   198
lemma real_mult_self_le2: "[| (1::real) \<le> r; (1::real) \<le> x |]  ==> x \<le> r * x"
paulson@14268
   199
apply (subgoal_tac "1 * x \<le> r * x", simp) 
paulson@14268
   200
apply (rule mult_right_mono, auto) 
paulson@14265
   201
done
paulson@14265
   202
paulson@14268
   203
lemma realpow_gt_ge2 [rule_format]: "(1::real) \<le> r & n < N --> r ^ n \<le> r ^ N"
paulson@14268
   204
apply (induct_tac "N", auto)
paulson@14268
   205
apply (frule_tac [!] n = na in realpow_ge_one2)
paulson@14268
   206
apply (drule_tac [!] real_mult_self_le2, assumption)
paulson@14268
   207
prefer 2 apply assumption
paulson@14265
   208
apply (auto intro: order_trans simp add: less_Suc_eq)
paulson@14265
   209
done
paulson@14265
   210
paulson@14265
   211
lemma realpow_ge_ge2: "[| (1::real) \<le> r; n \<le> N |] ==> r ^ n \<le> r ^ N"
paulson@14268
   212
apply (drule_tac n = N in le_imp_less_or_eq)
paulson@14265
   213
apply (auto intro: realpow_gt_ge2)
paulson@14265
   214
done
paulson@14265
   215
paulson@14268
   216
lemma realpow_Suc_ge_self2: "(1::real) \<le> r ==> r \<le> r ^ Suc n"
paulson@14268
   217
by (drule_tac n = 1 and N = "Suc n" in realpow_ge_ge2, auto)
paulson@14265
   218
paulson@14268
   219
(*Used ONCE in Hyperreal/NthRoot.ML*)
paulson@14265
   220
lemma realpow_ge_self2: "[| (1::real) \<le> r; 0 < n |] ==> r \<le> r ^ n"
paulson@14265
   221
apply (drule less_not_refl2 [THEN not0_implies_Suc])
paulson@14265
   222
apply (auto intro!: realpow_Suc_ge_self2)
paulson@14265
   223
done
paulson@14265
   224
paulson@14268
   225
lemma realpow_minus_mult [rule_format, simp]:
paulson@14268
   226
     "0 < n --> (x::real) ^ (n - 1) * x = x ^ n"
paulson@14265
   227
apply (induct_tac "n")
paulson@14265
   228
apply (auto simp add: real_mult_commute)
paulson@14265
   229
done
paulson@14265
   230
paulson@14268
   231
lemma realpow_two_mult_inverse [simp]: "r \<noteq> 0 ==> r * inverse r ^Suc (Suc 0) = inverse (r::real)"
paulson@14268
   232
by (simp add: realpow_two real_mult_assoc [symmetric])
paulson@14265
   233
paulson@14265
   234
(* 05/00 *)
paulson@14268
   235
lemma realpow_two_minus [simp]: "(-x)^Suc (Suc 0) = (x::real)^Suc (Suc 0)"
paulson@14268
   236
by simp
paulson@14265
   237
paulson@14265
   238
lemma realpow_two_diff: "(x::real)^Suc (Suc 0) - y^Suc (Suc 0) = (x - y) * (x + y)"
paulson@14265
   239
apply (unfold real_diff_def)
paulson@14265
   240
apply (simp add: real_add_mult_distrib2 real_add_mult_distrib real_mult_ac)
paulson@14265
   241
done
paulson@14265
   242
paulson@14265
   243
lemma realpow_two_disj: "((x::real)^Suc (Suc 0) = y^Suc (Suc 0)) = (x = y | x = -y)"
paulson@14268
   244
apply (cut_tac x = x and y = y in realpow_two_diff)
paulson@14265
   245
apply (auto simp del: realpow_Suc)
paulson@14265
   246
done
paulson@14265
   247
paulson@14265
   248
(* used in Transc *)
paulson@14265
   249
lemma realpow_diff: "[|(x::real) \<noteq> 0; m \<le> n |] ==> x ^ (n - m) = x ^ n * inverse (x ^ m)"
paulson@14268
   250
by (auto simp add: le_eq_less_or_eq less_iff_Suc_add realpow_add realpow_not_zero real_mult_ac)
paulson@14265
   251
paulson@14265
   252
lemma realpow_real_of_nat: "real (m::nat) ^ n = real (m ^ n)"
paulson@14265
   253
apply (induct_tac "n")
paulson@14265
   254
apply (auto simp add: real_of_nat_one real_of_nat_mult)
paulson@14265
   255
done
paulson@14265
   256
paulson@14268
   257
lemma realpow_real_of_nat_two_pos [simp] : "0 < real (Suc (Suc 0) ^ n)"
paulson@14265
   258
apply (induct_tac "n")
paulson@14265
   259
apply (auto simp add: real_of_nat_mult real_0_less_mult_iff)
paulson@14265
   260
done
paulson@14265
   261
paulson@14265
   262
lemma realpow_increasing:
paulson@14265
   263
  assumes xnonneg: "(0::real) \<le> x"
paulson@14265
   264
      and ynonneg: "0 \<le> y"
paulson@14265
   265
      and le: "x ^ Suc n \<le> y ^ Suc n"
paulson@14265
   266
  shows "x \<le> y"
paulson@14265
   267
 proof (rule ccontr)
paulson@14265
   268
   assume "~ x \<le> y"
paulson@14265
   269
   then have "y<x" by simp
paulson@14265
   270
   then have "y ^ Suc n < x ^ Suc n"
paulson@14265
   271
     by (simp only: prems realpow_less') 
paulson@14265
   272
   from le and this show "False"
paulson@14265
   273
     by simp
paulson@14265
   274
 qed
paulson@14265
   275
  
paulson@14265
   276
lemma realpow_Suc_cancel_eq: "[| (0::real) \<le> x; 0 \<le> y; x ^ Suc n = y ^ Suc n |] ==> x = y"
paulson@14268
   277
by (blast intro: realpow_increasing order_antisym order_eq_refl sym)
paulson@14265
   278
paulson@14265
   279
paulson@14265
   280
(*** Logical equivalences for inequalities ***)
paulson@14265
   281
paulson@14268
   282
lemma realpow_eq_0_iff [simp]: "(x^n = 0) = (x = (0::real) & 0<n)"
paulson@14268
   283
by (induct_tac "n", auto)
paulson@14265
   284
paulson@14268
   285
lemma zero_less_realpow_abs_iff [simp]: "(0 < (abs x)^n) = (x \<noteq> (0::real) | n=0)"
paulson@14265
   286
apply (induct_tac "n")
paulson@14265
   287
apply (auto simp add: real_0_less_mult_iff)
paulson@14265
   288
done
paulson@14265
   289
paulson@14268
   290
lemma zero_le_realpow_abs [simp]: "(0::real) \<le> (abs x)^n"
paulson@14265
   291
apply (induct_tac "n")
paulson@14265
   292
apply (auto simp add: real_0_le_mult_iff)
paulson@14265
   293
done
paulson@14265
   294
paulson@14265
   295
paulson@14265
   296
(*** Literal arithmetic involving powers, type real ***)
paulson@14265
   297
paulson@14265
   298
lemma real_of_int_power: "real (x::int) ^ n = real (x ^ n)"
paulson@14265
   299
apply (induct_tac "n")
paulson@14265
   300
apply (simp_all (no_asm_simp) add: nat_mult_distrib)
paulson@14265
   301
done
paulson@14265
   302
declare real_of_int_power [symmetric, simp]
paulson@14265
   303
paulson@14265
   304
lemma power_real_number_of: "(number_of v :: real) ^ n = real ((number_of v :: int) ^ n)"
paulson@14268
   305
by (simp only: real_number_of_def real_of_int_power)
paulson@14265
   306
paulson@14265
   307
declare power_real_number_of [of _ "number_of w", standard, simp]
paulson@14265
   308
paulson@14265
   309
paulson@14265
   310
lemma real_power_two: "(r::real)\<twosuperior> = r * r"
paulson@14265
   311
  by (simp add: numeral_2_eq_2)
paulson@14265
   312
paulson@14265
   313
lemma real_sqr_ge_zero [iff]: "0 \<le> (r::real)\<twosuperior>"
paulson@14265
   314
  by (simp add: real_power_two)
paulson@14265
   315
paulson@14265
   316
lemma real_sqr_gt_zero: "(r::real) \<noteq> 0 ==> 0 < r\<twosuperior>"
paulson@14265
   317
proof -
paulson@14265
   318
  assume "r \<noteq> 0"
paulson@14265
   319
  hence "0 \<noteq> r\<twosuperior>" by simp
paulson@14265
   320
  also have "0 \<le> r\<twosuperior>" by (simp add: real_sqr_ge_zero)
paulson@14265
   321
  finally show ?thesis .
paulson@14265
   322
qed
paulson@14265
   323
paulson@14265
   324
lemma real_sqr_not_zero: "r \<noteq> 0 ==> (r::real)\<twosuperior> \<noteq> 0"
paulson@14265
   325
  by simp
paulson@14265
   326
paulson@14265
   327
paulson@14268
   328
subsection{*Various Other Theorems*}
paulson@14268
   329
paulson@14268
   330
text{*Used several times in Hyperreal/Transcendental.ML*}
paulson@14268
   331
lemma real_sum_squares_cancel_a: "x * x = -(y * y) ==> x = (0::real) & y=0"
paulson@14268
   332
  by (auto intro: real_sum_squares_cancel)
paulson@14268
   333
paulson@14268
   334
lemma real_squared_diff_one_factored: "x*x - (1::real) = (x + 1)*(x - 1)"
paulson@14268
   335
apply (auto simp add: real_add_mult_distrib real_add_mult_distrib2 real_diff_def)
paulson@14268
   336
done
paulson@14268
   337
paulson@14268
   338
lemma real_mult_is_one: "(x*x = (1::real)) = (x = 1 | x = - 1)"
paulson@14268
   339
apply auto
paulson@14268
   340
apply (drule right_minus_eq [THEN iffD2]) 
paulson@14268
   341
apply (auto simp add: real_squared_diff_one_factored)
paulson@14268
   342
done
paulson@14268
   343
declare real_mult_is_one [iff]
paulson@14268
   344
paulson@14304
   345
lemma real_le_add_half_cancel: "(x + y/2 \<le> (y::real)) = (x \<le> y /2)"
paulson@14268
   346
apply auto
paulson@14268
   347
done
paulson@14268
   348
declare real_le_add_half_cancel [simp]
paulson@14268
   349
paulson@14268
   350
lemma real_minus_half_eq: "(x::real) - x/2 = x/2"
paulson@14268
   351
apply auto
paulson@14268
   352
done
paulson@14268
   353
declare real_minus_half_eq [simp]
paulson@14268
   354
paulson@14268
   355
lemma real_mult_inverse_cancel:
paulson@14268
   356
     "[|(0::real) < x; 0 < x1; x1 * y < x * u |] 
paulson@14268
   357
      ==> inverse x * y < inverse x1 * u"
paulson@14268
   358
apply (rule_tac c=x in mult_less_imp_less_left) 
paulson@14268
   359
apply (auto simp add: real_mult_assoc [symmetric])
paulson@14268
   360
apply (simp (no_asm) add: real_mult_ac)
paulson@14268
   361
apply (rule_tac c=x1 in mult_less_imp_less_right) 
paulson@14268
   362
apply (auto simp add: real_mult_ac)
paulson@14268
   363
done
paulson@14268
   364
paulson@14268
   365
text{*Used once: in Hyperreal/Transcendental.ML*}
paulson@14268
   366
lemma real_mult_inverse_cancel2: "[|(0::real) < x;0 < x1; x1 * y < x * u |] ==> y * inverse x < u * inverse x1"
paulson@14268
   367
apply (auto dest: real_mult_inverse_cancel simp add: real_mult_ac)
paulson@14268
   368
done
paulson@14268
   369
paulson@14268
   370
lemma inverse_real_of_nat_gt_zero: "0 < inverse (real (Suc n))"
paulson@14268
   371
apply auto
paulson@14268
   372
done
paulson@14268
   373
declare inverse_real_of_nat_gt_zero [simp]
paulson@14268
   374
paulson@14304
   375
lemma inverse_real_of_nat_ge_zero: "0 \<le> inverse (real (Suc n))"
paulson@14268
   376
apply auto
paulson@14268
   377
done
paulson@14268
   378
declare inverse_real_of_nat_ge_zero [simp]
paulson@14268
   379
paulson@14268
   380
lemma real_sum_squares_not_zero: "x ~= 0 ==> x * x + y * y ~= (0::real)"
paulson@14268
   381
apply (blast dest!: real_sum_squares_cancel) 
paulson@14268
   382
done
paulson@14268
   383
paulson@14268
   384
lemma real_sum_squares_not_zero2: "y ~= 0 ==> x * x + y * y ~= (0::real)"
paulson@14268
   385
apply (blast dest!: real_sum_squares_cancel2) 
paulson@14268
   386
done
paulson@14268
   387
paulson@14268
   388
(* nice theorem *)
paulson@14268
   389
lemma abs_mult_abs: "abs x * abs x = x * (x::real)"
paulson@14268
   390
apply (insert linorder_less_linear [of x 0]) 
paulson@14268
   391
apply (auto simp add: abs_eqI2 abs_minus_eqI2)
paulson@14268
   392
done
paulson@14268
   393
declare abs_mult_abs [simp]
paulson@14268
   394
paulson@14268
   395
paulson@14268
   396
subsection {*Various Other Theorems*}
paulson@14268
   397
paulson@14268
   398
lemma realpow_divide: 
paulson@14268
   399
    "(x/y) ^ n = ((x::real) ^ n/ y ^ n)"
paulson@14268
   400
apply (unfold real_divide_def)
paulson@14268
   401
apply (auto simp add: realpow_mult realpow_inverse)
paulson@14268
   402
done
paulson@14268
   403
paulson@14304
   404
lemma realpow_ge_zero2 [rule_format (no_asm)]: "(0::real) \<le> r --> 0 \<le> r ^ n"
paulson@14268
   405
apply (induct_tac "n")
paulson@14268
   406
apply (auto simp add: real_0_le_mult_iff)
paulson@14268
   407
done
paulson@14268
   408
paulson@14304
   409
lemma realpow_le2 [rule_format (no_asm)]: "(0::real) \<le> x & x \<le> y --> x ^ n \<le> y ^ n"
paulson@14268
   410
apply (induct_tac "n")
paulson@14268
   411
apply (auto intro!: real_mult_le_mono simp add: realpow_ge_zero2)
paulson@14268
   412
done
paulson@14268
   413
paulson@14268
   414
lemma realpow_Suc_gt_one: "(1::real) < r ==> 1 < r ^ (Suc n)"
paulson@14268
   415
apply (frule_tac n = "n" in realpow_ge_one)
paulson@14268
   416
apply (drule real_le_imp_less_or_eq, safe)
paulson@14268
   417
apply (frule real_zero_less_one [THEN real_less_trans])
paulson@14268
   418
apply (drule_tac y = "r ^ n" in real_mult_less_mono2)
paulson@14268
   419
apply assumption
paulson@14268
   420
apply (auto dest: real_less_trans)
paulson@14268
   421
done
paulson@14268
   422
paulson@14268
   423
lemma realpow_two_sum_zero_iff: "(x ^ 2 + y ^ 2 = (0::real)) = (x = 0 & y = 0)"
paulson@14268
   424
apply (auto intro: real_sum_squares_cancel real_sum_squares_cancel2 simp add: numeral_2_eq_2)
paulson@14268
   425
done
paulson@14268
   426
declare realpow_two_sum_zero_iff [simp]
paulson@14268
   427
paulson@14304
   428
lemma realpow_two_le_add_order: "(0::real) \<le> u ^ 2 + v ^ 2"
paulson@14268
   429
apply (rule real_le_add_order)
paulson@14268
   430
apply (auto simp add: numeral_2_eq_2)
paulson@14268
   431
done
paulson@14268
   432
declare realpow_two_le_add_order [simp]
paulson@14268
   433
paulson@14304
   434
lemma realpow_two_le_add_order2: "(0::real) \<le> u ^ 2 + v ^ 2 + w ^ 2"
paulson@14268
   435
apply (rule real_le_add_order)+
paulson@14268
   436
apply (auto simp add: numeral_2_eq_2)
paulson@14268
   437
done
paulson@14268
   438
declare realpow_two_le_add_order2 [simp]
paulson@14268
   439
paulson@14268
   440
lemma real_sum_square_gt_zero: "x ~= 0 ==> (0::real) < x * x + y * y"
paulson@14268
   441
apply (cut_tac x = "x" and y = "y" in real_mult_self_sum_ge_zero)
paulson@14268
   442
apply (drule real_le_imp_less_or_eq)
paulson@14268
   443
apply (drule_tac y = "y" in real_sum_squares_not_zero)
paulson@14268
   444
apply auto
paulson@14268
   445
done
paulson@14268
   446
paulson@14268
   447
lemma real_sum_square_gt_zero2: "y ~= 0 ==> (0::real) < x * x + y * y"
paulson@14268
   448
apply (rule real_add_commute [THEN subst])
paulson@14268
   449
apply (erule real_sum_square_gt_zero)
paulson@14268
   450
done
paulson@14268
   451
paulson@14304
   452
lemma real_minus_mult_self_le: "-(u * u) \<le> (x * (x::real))"
paulson@14268
   453
apply (rule_tac j = "0" in real_le_trans)
paulson@14268
   454
apply auto
paulson@14268
   455
done
paulson@14268
   456
declare real_minus_mult_self_le [simp]
paulson@14268
   457
paulson@14304
   458
lemma realpow_square_minus_le: "-(u ^ 2) \<le> (x::real) ^ 2"
paulson@14268
   459
apply (auto simp add: numeral_2_eq_2)
paulson@14268
   460
done
paulson@14268
   461
declare realpow_square_minus_le [simp]
paulson@14268
   462
paulson@14268
   463
lemma realpow_num_eq_if: "(m::real) ^ n = (if n=0 then 1 else m * m ^ (n - 1))"
paulson@14268
   464
apply (case_tac "n")
paulson@14268
   465
apply auto
paulson@14268
   466
done
paulson@14268
   467
paulson@14268
   468
lemma real_num_zero_less_two_pow: "0 < (2::real) ^ (4*d)"
paulson@14268
   469
apply (induct_tac "d")
paulson@14268
   470
apply (auto simp add: realpow_num_eq_if)
paulson@14268
   471
done
paulson@14268
   472
declare real_num_zero_less_two_pow [simp]
paulson@14268
   473
paulson@14268
   474
lemma lemma_realpow_num_two_mono: "x * (4::real)   < y ==> x * (2 ^ 8) < y * (2 ^ 6)"
paulson@14268
   475
apply (subgoal_tac " (2::real) ^ 8 = 4 * (2 ^ 6) ")
paulson@14268
   476
apply (simp (no_asm_simp) add: real_mult_assoc [symmetric])
paulson@14268
   477
apply (auto simp add: realpow_num_eq_if)
paulson@14268
   478
done
paulson@14268
   479
paulson@14268
   480
lemma lemma_realpow_4: "2 ^ 2 = (4::real)"
paulson@14268
   481
apply (simp (no_asm) add: realpow_num_eq_if)
paulson@14268
   482
done
paulson@14268
   483
declare lemma_realpow_4 [simp]
paulson@14268
   484
paulson@14268
   485
lemma lemma_realpow_16: "2 ^ 4 = (16::real)"
paulson@14268
   486
apply (simp (no_asm) add: realpow_num_eq_if)
paulson@14268
   487
done
paulson@14268
   488
declare lemma_realpow_16 [simp]
paulson@14268
   489
paulson@14304
   490
lemma zero_le_x_squared: "(0::real) \<le> x^2"
paulson@14268
   491
apply (simp add: numeral_2_eq_2)
paulson@14268
   492
done
paulson@14268
   493
declare zero_le_x_squared [simp]
paulson@14268
   494
paulson@14268
   495
paulson@14268
   496
paulson@14265
   497
ML
paulson@14265
   498
{*
paulson@14265
   499
val realpow_0 = thm "realpow_0";
paulson@14265
   500
val realpow_Suc = thm "realpow_Suc";
paulson@14265
   501
paulson@14265
   502
val realpow_zero = thm "realpow_zero";
paulson@14265
   503
val realpow_not_zero = thm "realpow_not_zero";
paulson@14265
   504
val realpow_zero_zero = thm "realpow_zero_zero";
paulson@14265
   505
val realpow_inverse = thm "realpow_inverse";
paulson@14265
   506
val realpow_abs = thm "realpow_abs";
paulson@14265
   507
val realpow_add = thm "realpow_add";
paulson@14265
   508
val realpow_one = thm "realpow_one";
paulson@14265
   509
val realpow_two = thm "realpow_two";
paulson@14265
   510
val realpow_gt_zero = thm "realpow_gt_zero";
paulson@14265
   511
val realpow_ge_zero = thm "realpow_ge_zero";
paulson@14265
   512
val realpow_le = thm "realpow_le";
paulson@14265
   513
val realpow_0_left = thm "realpow_0_left";
paulson@14265
   514
val realpow_less = thm "realpow_less";
paulson@14265
   515
val realpow_eq_one = thm "realpow_eq_one";
paulson@14265
   516
val abs_realpow_minus_one = thm "abs_realpow_minus_one";
paulson@14265
   517
val realpow_mult = thm "realpow_mult";
paulson@14265
   518
val realpow_two_le = thm "realpow_two_le";
paulson@14265
   519
val abs_realpow_two = thm "abs_realpow_two";
paulson@14265
   520
val realpow_two_abs = thm "realpow_two_abs";
paulson@14265
   521
val realpow_two_gt_one = thm "realpow_two_gt_one";
paulson@14265
   522
val realpow_ge_one = thm "realpow_ge_one";
paulson@14265
   523
val realpow_ge_one2 = thm "realpow_ge_one2";
paulson@14265
   524
val two_realpow_ge_one = thm "two_realpow_ge_one";
paulson@14265
   525
val two_realpow_gt = thm "two_realpow_gt";
paulson@14265
   526
val realpow_minus_one = thm "realpow_minus_one";
paulson@14265
   527
val realpow_minus_one_odd = thm "realpow_minus_one_odd";
paulson@14265
   528
val realpow_minus_one_even = thm "realpow_minus_one_even";
paulson@14265
   529
val realpow_Suc_less = thm "realpow_Suc_less";
paulson@14265
   530
val realpow_Suc_le = thm "realpow_Suc_le";
paulson@14265
   531
val realpow_zero_le = thm "realpow_zero_le";
paulson@14265
   532
val realpow_Suc_le2 = thm "realpow_Suc_le2";
paulson@14265
   533
val realpow_Suc_le3 = thm "realpow_Suc_le3";
paulson@14265
   534
val realpow_less_le = thm "realpow_less_le";
paulson@14265
   535
val realpow_le_le = thm "realpow_le_le";
paulson@14265
   536
val realpow_Suc_le_self = thm "realpow_Suc_le_self";
paulson@14265
   537
val realpow_Suc_less_one = thm "realpow_Suc_less_one";
paulson@14265
   538
val realpow_le_Suc = thm "realpow_le_Suc";
paulson@14265
   539
val realpow_less_Suc = thm "realpow_less_Suc";
paulson@14265
   540
val realpow_le_Suc2 = thm "realpow_le_Suc2";
paulson@14265
   541
val realpow_gt_ge2 = thm "realpow_gt_ge2";
paulson@14265
   542
val realpow_ge_ge2 = thm "realpow_ge_ge2";
paulson@14265
   543
val realpow_Suc_ge_self2 = thm "realpow_Suc_ge_self2";
paulson@14265
   544
val realpow_ge_self2 = thm "realpow_ge_self2";
paulson@14265
   545
val realpow_minus_mult = thm "realpow_minus_mult";
paulson@14265
   546
val realpow_two_mult_inverse = thm "realpow_two_mult_inverse";
paulson@14265
   547
val realpow_two_minus = thm "realpow_two_minus";
paulson@14265
   548
val realpow_two_disj = thm "realpow_two_disj";
paulson@14265
   549
val realpow_diff = thm "realpow_diff";
paulson@14265
   550
val realpow_real_of_nat = thm "realpow_real_of_nat";
paulson@14265
   551
val realpow_real_of_nat_two_pos = thm "realpow_real_of_nat_two_pos";
paulson@14265
   552
val realpow_increasing = thm "realpow_increasing";
paulson@14265
   553
val realpow_Suc_cancel_eq = thm "realpow_Suc_cancel_eq";
paulson@14265
   554
val realpow_eq_0_iff = thm "realpow_eq_0_iff";
paulson@14265
   555
val zero_less_realpow_abs_iff = thm "zero_less_realpow_abs_iff";
paulson@14265
   556
val zero_le_realpow_abs = thm "zero_le_realpow_abs";
paulson@14265
   557
val real_of_int_power = thm "real_of_int_power";
paulson@14265
   558
val power_real_number_of = thm "power_real_number_of";
paulson@14265
   559
val real_power_two = thm "real_power_two";
paulson@14265
   560
val real_sqr_ge_zero = thm "real_sqr_ge_zero";
paulson@14265
   561
val real_sqr_gt_zero = thm "real_sqr_gt_zero";
paulson@14265
   562
val real_sqr_not_zero = thm "real_sqr_not_zero";
paulson@14268
   563
val real_sum_squares_cancel_a = thm "real_sum_squares_cancel_a";
paulson@14268
   564
val real_mult_inverse_cancel2 = thm "real_mult_inverse_cancel2";
paulson@14268
   565
val real_squared_diff_one_factored = thm "real_squared_diff_one_factored";
paulson@14268
   566
val real_mult_is_one = thm "real_mult_is_one";
paulson@14268
   567
val real_le_add_half_cancel = thm "real_le_add_half_cancel";
paulson@14268
   568
val real_minus_half_eq = thm "real_minus_half_eq";
paulson@14268
   569
val real_mult_inverse_cancel = thm "real_mult_inverse_cancel";
paulson@14268
   570
val real_mult_inverse_cancel2 = thm "real_mult_inverse_cancel2";
paulson@14268
   571
val inverse_real_of_nat_gt_zero = thm "inverse_real_of_nat_gt_zero";
paulson@14268
   572
val inverse_real_of_nat_ge_zero = thm "inverse_real_of_nat_ge_zero";
paulson@14268
   573
val real_sum_squares_not_zero = thm "real_sum_squares_not_zero";
paulson@14268
   574
val real_sum_squares_not_zero2 = thm "real_sum_squares_not_zero2";
paulson@14268
   575
val abs_mult_abs = thm "abs_mult_abs";
paulson@14268
   576
paulson@14268
   577
val realpow_divide = thm "realpow_divide";
paulson@14268
   578
val realpow_ge_zero2 = thm "realpow_ge_zero2";
paulson@14268
   579
val realpow_le2 = thm "realpow_le2";
paulson@14268
   580
val realpow_Suc_gt_one = thm "realpow_Suc_gt_one";
paulson@14268
   581
val realpow_two_sum_zero_iff = thm "realpow_two_sum_zero_iff";
paulson@14268
   582
val realpow_two_le_add_order = thm "realpow_two_le_add_order";
paulson@14268
   583
val realpow_two_le_add_order2 = thm "realpow_two_le_add_order2";
paulson@14268
   584
val real_sum_square_gt_zero = thm "real_sum_square_gt_zero";
paulson@14268
   585
val real_sum_square_gt_zero2 = thm "real_sum_square_gt_zero2";
paulson@14268
   586
val real_minus_mult_self_le = thm "real_minus_mult_self_le";
paulson@14268
   587
val realpow_square_minus_le = thm "realpow_square_minus_le";
paulson@14268
   588
val realpow_num_eq_if = thm "realpow_num_eq_if";
paulson@14268
   589
val real_num_zero_less_two_pow = thm "real_num_zero_less_two_pow";
paulson@14268
   590
val lemma_realpow_num_two_mono = thm "lemma_realpow_num_two_mono";
paulson@14268
   591
val lemma_realpow_4 = thm "lemma_realpow_4";
paulson@14268
   592
val lemma_realpow_16 = thm "lemma_realpow_16";
paulson@14268
   593
val zero_le_x_squared = thm "zero_le_x_squared";
paulson@14265
   594
*}
paulson@14265
   595
paulson@14265
   596
paulson@7077
   597
end