author  huffman 
Mon, 14 May 2007 09:27:24 +0200  
changeset 22961  e499ded5d0fc 
parent 22956  617140080e6a 
child 22968  7134874437ac 
permissions  rwrr 
12196  1 
(* Title : NthRoot.thy 
2 
Author : Jacques D. Fleuriot 

3 
Copyright : 1998 University of Cambridge 

14477  4 
Conversion to Isar and new proofs by Lawrence C Paulson, 2004 
12196  5 
*) 
6 

22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

7 
header {* Nth Roots of Real Numbers *} 
14324  8 

15131  9 
theory NthRoot 
21865
55cc354fd2d9
moved several theorems; rearranged theory dependencies
huffman
parents:
21404
diff
changeset

10 
imports SEQ Parity 
15131  11 
begin 
14324  12 

22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

13 
subsection {* Existence of Nth Root *} 
20687
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

14 

14767  15 
text {* 
16 
Various lemmas needed for this result. We follow the proof given by 

17 
John Lindsay Orr (\texttt{jorr@math.unl.edu}) in his Analysis 

18 
Webnotes available at \url{http://www.math.unl.edu/~webnotes}. 

19 

20 
Lemmas about sequences of reals are used to reach the result. 

21 
*} 

14324  22 

23 
lemma lemma_nth_realpow_non_empty: 

24 
"[ (0::real) < a; 0 < n ] ==> \<exists>s. s : {x. x ^ n <= a & 0 < x}" 

25 
apply (case_tac "1 <= a") 

14477  26 
apply (rule_tac x = 1 in exI) 
14334  27 
apply (drule_tac [2] linorder_not_le [THEN iffD1]) 
14477  28 
apply (drule_tac [2] less_not_refl2 [THEN not0_implies_Suc], simp) 
14348
744c868ee0b7
Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents:
14334
diff
changeset

29 
apply (force intro!: realpow_Suc_le_self simp del: realpow_Suc) 
14324  30 
done 
31 

14348
744c868ee0b7
Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents:
14334
diff
changeset

32 
text{*Used only just below*} 
744c868ee0b7
Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents:
14334
diff
changeset

33 
lemma realpow_ge_self2: "[ (1::real) \<le> r; 0 < n ] ==> r \<le> r ^ n" 
744c868ee0b7
Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents:
14334
diff
changeset

34 
by (insert power_increasing [of 1 n r], simp) 
744c868ee0b7
Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents:
14334
diff
changeset

35 

14324  36 
lemma lemma_nth_realpow_isUb_ex: 
37 
"[ (0::real) < a; 0 < n ] 

38 
==> \<exists>u. isUb (UNIV::real set) {x. x ^ n <= a & 0 < x} u" 

39 
apply (case_tac "1 <= a") 

14477  40 
apply (rule_tac x = a in exI) 
14334  41 
apply (drule_tac [2] linorder_not_le [THEN iffD1]) 
14477  42 
apply (rule_tac [2] x = 1 in exI) 
43 
apply (rule_tac [!] setleI [THEN isUbI], safe) 

14324  44 
apply (simp_all (no_asm)) 
45 
apply (rule_tac [!] ccontr) 

14334  46 
apply (drule_tac [!] linorder_not_le [THEN iffD1]) 
14477  47 
apply (drule realpow_ge_self2, assumption) 
48 
apply (drule_tac n = n in realpow_less) 

14324  49 
apply (assumption+) 
14477  50 
apply (drule real_le_trans, assumption) 
51 
apply (drule_tac y = "y ^ n" in order_less_le_trans, assumption, simp) 

52 
apply (drule_tac n = n in zero_less_one [THEN realpow_less], auto) 

14324  53 
done 
54 

55 
lemma nth_realpow_isLub_ex: 

56 
"[ (0::real) < a; 0 < n ] 

57 
==> \<exists>u. isLub (UNIV::real set) {x. x ^ n <= a & 0 < x} u" 

14365
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14355
diff
changeset

58 
by (blast intro: lemma_nth_realpow_isUb_ex lemma_nth_realpow_non_empty reals_complete) 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14355
diff
changeset

59 

14324  60 

22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

61 
subsubsection {* First Half  Lemmas First *} 
14324  62 

63 
lemma lemma_nth_realpow_seq: 

64 
"isLub (UNIV::real set) {x. x ^ n <= a & (0::real) < x} u 

65 
==> u + inverse(real (Suc k)) ~: {x. x ^ n <= a & 0 < x}" 

14477  66 
apply (safe, drule isLubD2, blast) 
14365
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14355
diff
changeset

67 
apply (simp add: linorder_not_less [symmetric]) 
14324  68 
done 
69 

70 
lemma lemma_nth_realpow_isLub_gt_zero: 

71 
"[ isLub (UNIV::real set) {x. x ^ n <= a & (0::real) < x} u; 

72 
0 < a; 0 < n ] ==> 0 < u" 

14477  73 
apply (drule lemma_nth_realpow_non_empty, auto) 
74 
apply (drule_tac y = s in isLub_isUb [THEN isUbD]) 

14324  75 
apply (auto intro: order_less_le_trans) 
76 
done 

77 

78 
lemma lemma_nth_realpow_isLub_ge: 

79 
"[ isLub (UNIV::real set) {x. x ^ n <= a & (0::real) < x} u; 

80 
0 < a; 0 < n ] ==> ALL k. a <= (u + inverse(real (Suc k))) ^ n" 

14477  81 
apply safe 
82 
apply (frule lemma_nth_realpow_seq, safe) 

15085
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
14767
diff
changeset

83 
apply (auto elim: order_less_asym simp add: linorder_not_less [symmetric] 
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
14767
diff
changeset

84 
iff: real_0_less_add_iff) {*legacy iff rule!*} 
14365
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14355
diff
changeset

85 
apply (simp add: linorder_not_less) 
14324  86 
apply (rule order_less_trans [of _ 0]) 
14325  87 
apply (auto intro: lemma_nth_realpow_isLub_gt_zero) 
14324  88 
done 
89 

90 
text{*First result we want*} 

91 
lemma realpow_nth_ge: 

92 
"[ (0::real) < a; 0 < n; 

93 
isLub (UNIV::real set) 

94 
{x. x ^ n <= a & 0 < x} u ] ==> a <= u ^ n" 

14477  95 
apply (frule lemma_nth_realpow_isLub_ge, safe) 
14324  96 
apply (rule LIMSEQ_inverse_real_of_nat_add [THEN LIMSEQ_pow, THEN LIMSEQ_le_const]) 
14334  97 
apply (auto simp add: real_of_nat_def) 
14324  98 
done 
99 

22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

100 
subsubsection {* Second Half *} 
14324  101 

102 
lemma less_isLub_not_isUb: 

103 
"[ isLub (UNIV::real set) S u; x < u ] 

104 
==> ~ isUb (UNIV::real set) S x" 

14477  105 
apply safe 
106 
apply (drule isLub_le_isUb, assumption) 

107 
apply (drule order_less_le_trans, auto) 

14324  108 
done 
109 

110 
lemma not_isUb_less_ex: 

111 
"~ isUb (UNIV::real set) S u ==> \<exists>x \<in> S. u < x" 

18585  112 
apply (rule ccontr, erule contrapos_np) 
14324  113 
apply (rule setleI [THEN isUbI]) 
14365
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14355
diff
changeset

114 
apply (auto simp add: linorder_not_less [symmetric]) 
14324  115 
done 
116 

14325  117 
lemma real_mult_less_self: "0 < r ==> r * (1 + inverse(real (Suc n))) < r" 
14334  118 
apply (simp (no_asm) add: right_distrib) 
119 
apply (rule add_less_cancel_left [of "r", THEN iffD1]) 

16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
15140
diff
changeset

120 
apply (auto intro: mult_pos_pos 
14334  121 
simp add: add_assoc [symmetric] neg_less_0_iff_less) 
14325  122 
done 
123 

22630
2a9b64b26612
move lemma real_of_nat_inverse_le_iff from NSA.thy to NthRoot.thy
huffman
parents:
22443
diff
changeset

124 
lemma real_of_nat_inverse_le_iff: 
2a9b64b26612
move lemma real_of_nat_inverse_le_iff from NSA.thy to NthRoot.thy
huffman
parents:
22443
diff
changeset

125 
"(inverse (real(Suc n)) \<le> r) = (1 \<le> r * real(Suc n))" 
2a9b64b26612
move lemma real_of_nat_inverse_le_iff from NSA.thy to NthRoot.thy
huffman
parents:
22443
diff
changeset

126 
by (simp add: inverse_eq_divide pos_divide_le_eq) 
2a9b64b26612
move lemma real_of_nat_inverse_le_iff from NSA.thy to NthRoot.thy
huffman
parents:
22443
diff
changeset

127 

14325  128 
lemma real_mult_add_one_minus_ge_zero: 
129 
"0 < r ==> 0 <= r*(1 + inverse(real (Suc n)))" 

15085
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
14767
diff
changeset

130 
by (simp add: zero_le_mult_iff real_of_nat_inverse_le_iff real_0_le_add_iff) 
14325  131 

14324  132 
lemma lemma_nth_realpow_isLub_le: 
133 
"[ isLub (UNIV::real set) {x. x ^ n <= a & (0::real) < x} u; 

14325  134 
0 < a; 0 < n ] ==> ALL k. (u*(1 + inverse(real (Suc k)))) ^ n <= a" 
14477  135 
apply safe 
14324  136 
apply (frule less_isLub_not_isUb [THEN not_isUb_less_ex]) 
14477  137 
apply (rule_tac n = k in real_mult_less_self) 
138 
apply (blast intro: lemma_nth_realpow_isLub_gt_zero, safe) 

139 
apply (drule_tac n = k in 

140 
lemma_nth_realpow_isLub_gt_zero [THEN real_mult_add_one_minus_ge_zero], assumption+) 

14348
744c868ee0b7
Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents:
14334
diff
changeset

141 
apply (blast intro: order_trans order_less_imp_le power_mono) 
14324  142 
done 
143 

144 
text{*Second result we want*} 

145 
lemma realpow_nth_le: 

146 
"[ (0::real) < a; 0 < n; 

147 
isLub (UNIV::real set) 

148 
{x. x ^ n <= a & 0 < x} u ] ==> u ^ n <= a" 

14477  149 
apply (frule lemma_nth_realpow_isLub_le, safe) 
14348
744c868ee0b7
Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents:
14334
diff
changeset

150 
apply (rule LIMSEQ_inverse_real_of_nat_add_minus_mult 
744c868ee0b7
Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents:
14334
diff
changeset

151 
[THEN LIMSEQ_pow, THEN LIMSEQ_le_const2]) 
14334  152 
apply (auto simp add: real_of_nat_def) 
14324  153 
done 
154 

14348
744c868ee0b7
Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents:
14334
diff
changeset

155 
text{*The theorem at last!*} 
14324  156 
lemma realpow_nth: "[ (0::real) < a; 0 < n ] ==> \<exists>r. r ^ n = a" 
14477  157 
apply (frule nth_realpow_isLub_ex, auto) 
158 
apply (auto intro: realpow_nth_le realpow_nth_ge order_antisym) 

14324  159 
done 
160 

22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

161 
text {* positive only *} 
14324  162 
lemma realpow_pos_nth: "[ (0::real) < a; 0 < n ] ==> \<exists>r. 0 < r & r ^ n = a" 
14477  163 
apply (frule nth_realpow_isLub_ex, auto) 
164 
apply (auto intro: realpow_nth_le realpow_nth_ge order_antisym lemma_nth_realpow_isLub_gt_zero) 

14324  165 
done 
166 

167 
lemma realpow_pos_nth2: "(0::real) < a ==> \<exists>r. 0 < r & r ^ Suc n = a" 

14477  168 
by (blast intro: realpow_pos_nth) 
14324  169 

22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

170 
text {* uniqueness of nth positive root *} 
14324  171 
lemma realpow_pos_nth_unique: 
172 
"[ (0::real) < a; 0 < n ] ==> EX! r. 0 < r & r ^ n = a" 

173 
apply (auto intro!: realpow_pos_nth) 

14477  174 
apply (cut_tac x = r and y = y in linorder_less_linear, auto) 
175 
apply (drule_tac x = r in realpow_less) 

176 
apply (drule_tac [4] x = y in realpow_less, auto) 

14324  177 
done 
178 

20687
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

179 
subsection {* Nth Root *} 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

180 

22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

181 
text {* We define roots of negative reals such that 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

182 
@{term "root n ( x) =  root n x"}. This allows 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

183 
us to omit side conditions from many theorems. *} 
20687
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

184 

22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

185 
definition 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

186 
root :: "[nat, real] \<Rightarrow> real" where 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

187 
"root n x = (if 0 < x then (THE u. 0 < u \<and> u ^ n = x) else 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

188 
if x < 0 then  (THE u. 0 < u \<and> u ^ n =  x) else 0)" 
20687
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

189 

22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

190 
lemma real_root_zero [simp]: "root n 0 = 0" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

191 
unfolding root_def by simp 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

192 

617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

193 
lemma real_root_minus: "0 < n \<Longrightarrow> root n ( x) =  root n x" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

194 
unfolding root_def by simp 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

195 

617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

196 
lemma real_root_gt_zero: "\<lbrakk>0 < n; 0 < x\<rbrakk> \<Longrightarrow> 0 < root n x" 
20687
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

197 
apply (simp add: root_def) 
22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

198 
apply (drule (1) realpow_pos_nth_unique) 
20687
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

199 
apply (erule theI' [THEN conjunct1]) 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

200 
done 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

201 

22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

202 
lemma real_root_pow_pos: (* TODO: rename *) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

203 
"\<lbrakk>0 < n; 0 < x\<rbrakk> \<Longrightarrow> root n x ^ n = x" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

204 
apply (simp add: root_def) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

205 
apply (drule (1) realpow_pos_nth_unique) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

206 
apply (erule theI' [THEN conjunct2]) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

207 
done 
20687
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

208 

22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

209 
lemma real_root_pow_pos2 [simp]: (* TODO: rename *) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

210 
"\<lbrakk>0 < n; 0 \<le> x\<rbrakk> \<Longrightarrow> root n x ^ n = x" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

211 
by (auto simp add: order_le_less real_root_pow_pos) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

212 

617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

213 
lemma real_root_ge_zero: "\<lbrakk>0 < n; 0 \<le> x\<rbrakk> \<Longrightarrow> 0 \<le> root n x" 
20687
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

214 
by (auto simp add: order_le_less real_root_gt_zero) 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

215 

22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

216 
lemma real_root_power_cancel: "\<lbrakk>0 < n; 0 \<le> x\<rbrakk> \<Longrightarrow> root n (x ^ n) = x" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

217 
apply (subgoal_tac "0 \<le> x ^ n") 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

218 
apply (subgoal_tac "0 \<le> root n (x ^ n)") 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

219 
apply (subgoal_tac "root n (x ^ n) ^ n = x ^ n") 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

220 
apply (erule (3) power_eq_imp_eq_base) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

221 
apply (erule (1) real_root_pow_pos2) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

222 
apply (erule (1) real_root_ge_zero) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

223 
apply (erule zero_le_power) 
20687
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

224 
done 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

225 

22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

226 
lemma real_root_pos_unique: 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

227 
"\<lbrakk>0 < n; 0 \<le> y; y ^ n = x\<rbrakk> \<Longrightarrow> root n x = y" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

228 
by (erule subst, rule real_root_power_cancel) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

229 

617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

230 
lemma real_root_one [simp]: "0 < n \<Longrightarrow> root n 1 = 1" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

231 
by (simp add: real_root_pos_unique) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

232 

617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

233 
text {* Root function is strictly monotonic, hence injective *} 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

234 

617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

235 
lemma real_root_less_mono_lemma: 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

236 
"\<lbrakk>0 < n; 0 \<le> x; x < y\<rbrakk> \<Longrightarrow> root n x < root n y" 
22856  237 
apply (subgoal_tac "0 \<le> y") 
22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

238 
apply (subgoal_tac "root n x ^ n < root n y ^ n") 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

239 
apply (erule power_less_imp_less_base) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

240 
apply (erule (1) real_root_ge_zero) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

241 
apply simp 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

242 
apply simp 
22721
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

243 
done 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

244 

22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

245 
lemma real_root_less_mono: "\<lbrakk>0 < n; x < y\<rbrakk> \<Longrightarrow> root n x < root n y" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

246 
apply (cases "0 \<le> x") 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

247 
apply (erule (2) real_root_less_mono_lemma) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

248 
apply (cases "0 \<le> y") 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

249 
apply (rule_tac y=0 in order_less_le_trans) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

250 
apply (subgoal_tac "0 < root n ( x)") 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

251 
apply (simp add: real_root_minus) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

252 
apply (simp add: real_root_gt_zero) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

253 
apply (simp add: real_root_ge_zero) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

254 
apply (subgoal_tac "root n ( y) < root n ( x)") 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

255 
apply (simp add: real_root_minus) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

256 
apply (simp add: real_root_less_mono_lemma) 
22721
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

257 
done 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

258 

22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

259 
lemma real_root_le_mono: "\<lbrakk>0 < n; x \<le> y\<rbrakk> \<Longrightarrow> root n x \<le> root n y" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

260 
by (auto simp add: order_le_less real_root_less_mono) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

261 

22721
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

262 
lemma real_root_less_iff [simp]: 
22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

263 
"0 < n \<Longrightarrow> (root n x < root n y) = (x < y)" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

264 
apply (cases "x < y") 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

265 
apply (simp add: real_root_less_mono) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

266 
apply (simp add: linorder_not_less real_root_le_mono) 
22721
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

267 
done 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

268 

d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

269 
lemma real_root_le_iff [simp]: 
22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

270 
"0 < n \<Longrightarrow> (root n x \<le> root n y) = (x \<le> y)" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

271 
apply (cases "x \<le> y") 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

272 
apply (simp add: real_root_le_mono) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

273 
apply (simp add: linorder_not_le real_root_less_mono) 
22721
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

274 
done 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

275 

d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

276 
lemma real_root_eq_iff [simp]: 
22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

277 
"0 < n \<Longrightarrow> (root n x = root n y) = (x = y)" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

278 
by (simp add: order_eq_iff) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

279 

617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

280 
lemmas real_root_gt_0_iff [simp] = real_root_less_iff [where x=0, simplified] 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

281 
lemmas real_root_lt_0_iff [simp] = real_root_less_iff [where y=0, simplified] 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

282 
lemmas real_root_ge_0_iff [simp] = real_root_le_iff [where x=0, simplified] 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

283 
lemmas real_root_le_0_iff [simp] = real_root_le_iff [where y=0, simplified] 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

284 
lemmas real_root_eq_0_iff [simp] = real_root_eq_iff [where y=0, simplified] 
22721
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

285 

22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

286 
text {* Roots of multiplication and division *} 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

287 

617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

288 
lemma real_root_mult_lemma: 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

289 
"\<lbrakk>0 < n; 0 \<le> x; 0 \<le> y\<rbrakk> \<Longrightarrow> root n (x * y) = root n x * root n y" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

290 
by (simp add: real_root_pos_unique mult_nonneg_nonneg power_mult_distrib) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

291 

617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

292 
lemma real_root_inverse_lemma: 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

293 
"\<lbrakk>0 < n; 0 \<le> x\<rbrakk> \<Longrightarrow> root n (inverse x) = inverse (root n x)" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

294 
by (simp add: real_root_pos_unique power_inverse [symmetric]) 
22721
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

295 

d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

296 
lemma real_root_mult: 
22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

297 
assumes n: "0 < n" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

298 
shows "root n (x * y) = root n x * root n y" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

299 
proof (rule linorder_le_cases, rule_tac [!] linorder_le_cases) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

300 
assume "0 \<le> x" and "0 \<le> y" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

301 
thus ?thesis by (rule real_root_mult_lemma [OF n]) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

302 
next 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

303 
assume "0 \<le> x" and "y \<le> 0" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

304 
hence "0 \<le> x" and "0 \<le>  y" by simp_all 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

305 
hence "root n (x *  y) = root n x * root n ( y)" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

306 
by (rule real_root_mult_lemma [OF n]) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

307 
thus ?thesis by (simp add: real_root_minus [OF n]) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

308 
next 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

309 
assume "x \<le> 0" and "0 \<le> y" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

310 
hence "0 \<le>  x" and "0 \<le> y" by simp_all 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

311 
hence "root n ( x * y) = root n ( x) * root n y" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

312 
by (rule real_root_mult_lemma [OF n]) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

313 
thus ?thesis by (simp add: real_root_minus [OF n]) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

314 
next 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

315 
assume "x \<le> 0" and "y \<le> 0" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

316 
hence "0 \<le>  x" and "0 \<le>  y" by simp_all 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

317 
hence "root n ( x *  y) = root n ( x) * root n ( y)" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

318 
by (rule real_root_mult_lemma [OF n]) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

319 
thus ?thesis by (simp add: real_root_minus [OF n]) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

320 
qed 
22721
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

321 

d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

322 
lemma real_root_inverse: 
22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

323 
assumes n: "0 < n" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

324 
shows "root n (inverse x) = inverse (root n x)" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

325 
proof (rule linorder_le_cases) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

326 
assume "0 \<le> x" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

327 
thus ?thesis by (rule real_root_inverse_lemma [OF n]) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

328 
next 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

329 
assume "x \<le> 0" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

330 
hence "0 \<le>  x" by simp 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

331 
hence "root n (inverse ( x)) = inverse (root n ( x))" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

332 
by (rule real_root_inverse_lemma [OF n]) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

333 
thus ?thesis by (simp add: real_root_minus [OF n]) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

334 
qed 
22721
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

335 

22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

336 
lemma real_root_divide: 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

337 
"0 < n \<Longrightarrow> root n (x / y) = root n x / root n y" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

338 
by (simp add: divide_inverse real_root_mult real_root_inverse) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

339 

617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

340 
lemma real_root_power: 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

341 
"0 < n \<Longrightarrow> root n (x ^ k) = root n x ^ k" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

342 
by (induct k, simp_all add: real_root_mult) 
22721
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

343 

20687
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

344 

22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

345 
subsection {* Square Root *} 
20687
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

346 

22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

347 
definition 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

348 
sqrt :: "real \<Rightarrow> real" where 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

349 
"sqrt = root 2" 
20687
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

350 

22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

351 
lemma pos2: "0 < (2::nat)" by simp 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

352 

617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

353 
lemma real_sqrt_unique: "\<lbrakk>y\<twosuperior> = x; 0 \<le> y\<rbrakk> \<Longrightarrow> sqrt x = y" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

354 
unfolding sqrt_def by (rule real_root_pos_unique [OF pos2]) 
20687
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

355 

22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

356 
lemma real_sqrt_abs [simp]: "sqrt (x\<twosuperior>) = \<bar>x\<bar>" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

357 
apply (rule real_sqrt_unique) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

358 
apply (rule power2_abs) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

359 
apply (rule abs_ge_zero) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

360 
done 
20687
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

361 

22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

362 
lemma real_sqrt_pow2 [simp]: "0 \<le> x \<Longrightarrow> (sqrt x)\<twosuperior> = x" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

363 
unfolding sqrt_def by (rule real_root_pow_pos2 [OF pos2]) 
22856  364 

22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

365 
lemma real_sqrt_pow2_iff [simp]: "((sqrt x)\<twosuperior> = x) = (0 \<le> x)" 
22856  366 
apply (rule iffI) 
367 
apply (erule subst) 

368 
apply (rule zero_le_power2) 

369 
apply (erule real_sqrt_pow2) 

20687
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

370 
done 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

371 

22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

372 
lemma real_sqrt_zero [simp]: "sqrt 0 = 0" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

373 
unfolding sqrt_def by (rule real_root_zero) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

374 

617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

375 
lemma real_sqrt_one [simp]: "sqrt 1 = 1" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

376 
unfolding sqrt_def by (rule real_root_one [OF pos2]) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

377 

617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

378 
lemma real_sqrt_minus: "sqrt ( x) =  sqrt x" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

379 
unfolding sqrt_def by (rule real_root_minus [OF pos2]) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

380 

617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

381 
lemma real_sqrt_mult: "sqrt (x * y) = sqrt x * sqrt y" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

382 
unfolding sqrt_def by (rule real_root_mult [OF pos2]) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

383 

617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

384 
lemma real_sqrt_inverse: "sqrt (inverse x) = inverse (sqrt x)" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

385 
unfolding sqrt_def by (rule real_root_inverse [OF pos2]) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

386 

617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

387 
lemma real_sqrt_divide: "sqrt (x / y) = sqrt x / sqrt y" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

388 
unfolding sqrt_def by (rule real_root_divide [OF pos2]) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

389 

617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

390 
lemma real_sqrt_power: "sqrt (x ^ k) = sqrt x ^ k" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

391 
unfolding sqrt_def by (rule real_root_power [OF pos2]) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

392 

617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

393 
lemma real_sqrt_gt_zero: "0 < x \<Longrightarrow> 0 < sqrt x" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

394 
unfolding sqrt_def by (rule real_root_gt_zero [OF pos2]) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

395 

617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

396 
lemma real_sqrt_ge_zero: "0 \<le> x \<Longrightarrow> 0 \<le> sqrt x" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

397 
unfolding sqrt_def by (rule real_root_ge_zero [OF pos2]) 
20687
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

398 

22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

399 
lemma real_sqrt_less_mono: "x < y \<Longrightarrow> sqrt x < sqrt y" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

400 
unfolding sqrt_def by (rule real_root_less_mono [OF pos2]) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

401 

617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

402 
lemma real_sqrt_le_mono: "x \<le> y \<Longrightarrow> sqrt x \<le> sqrt y" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

403 
unfolding sqrt_def by (rule real_root_le_mono [OF pos2]) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

404 

617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

405 
lemma real_sqrt_less_iff [simp]: "(sqrt x < sqrt y) = (x < y)" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

406 
unfolding sqrt_def by (rule real_root_less_iff [OF pos2]) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

407 

617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

408 
lemma real_sqrt_le_iff [simp]: "(sqrt x \<le> sqrt y) = (x \<le> y)" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

409 
unfolding sqrt_def by (rule real_root_le_iff [OF pos2]) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

410 

617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

411 
lemma real_sqrt_eq_iff [simp]: "(sqrt x = sqrt y) = (x = y)" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

412 
unfolding sqrt_def by (rule real_root_eq_iff [OF pos2]) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

413 

617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

414 
lemmas real_sqrt_gt_0_iff [simp] = real_sqrt_less_iff [where x=0, simplified] 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

415 
lemmas real_sqrt_lt_0_iff [simp] = real_sqrt_less_iff [where y=0, simplified] 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

416 
lemmas real_sqrt_ge_0_iff [simp] = real_sqrt_le_iff [where x=0, simplified] 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

417 
lemmas real_sqrt_le_0_iff [simp] = real_sqrt_le_iff [where y=0, simplified] 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

418 
lemmas real_sqrt_eq_0_iff [simp] = real_sqrt_eq_iff [where y=0, simplified] 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

419 

617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

420 
lemmas real_sqrt_gt_1_iff [simp] = real_sqrt_less_iff [where x=1, simplified] 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

421 
lemmas real_sqrt_lt_1_iff [simp] = real_sqrt_less_iff [where y=1, simplified] 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

422 
lemmas real_sqrt_ge_1_iff [simp] = real_sqrt_le_iff [where x=1, simplified] 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

423 
lemmas real_sqrt_le_1_iff [simp] = real_sqrt_le_iff [where y=1, simplified] 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

424 
lemmas real_sqrt_eq_1_iff [simp] = real_sqrt_eq_iff [where y=1, simplified] 
20687
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

425 

fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

426 
lemma not_real_square_gt_zero [simp]: "(~ (0::real) < x*x) = (x = 0)" 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

427 
apply auto 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

428 
apply (cut_tac x = x and y = 0 in linorder_less_linear) 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

429 
apply (simp add: zero_less_mult_iff) 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

430 
done 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

431 

fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

432 
lemma real_sqrt_abs2 [simp]: "sqrt(x*x) = \<bar>x\<bar>" 
22856  433 
apply (subst power2_eq_square [symmetric]) 
20687
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

434 
apply (rule real_sqrt_abs) 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

435 
done 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

436 

fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

437 
lemma real_sqrt_pow2_gt_zero: "0 < x ==> 0 < (sqrt x)\<twosuperior>" 
22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

438 
by simp (* TODO: delete *) 
20687
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

439 

fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

440 
lemma real_sqrt_not_eq_zero: "0 < x ==> sqrt x \<noteq> 0" 
22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

441 
by simp (* TODO: delete *) 
20687
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

442 

fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

443 
lemma real_inv_sqrt_pow2: "0 < x ==> inverse (sqrt(x)) ^ 2 = inverse x" 
22856  444 
by (simp add: power_inverse [symmetric]) 
20687
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

445 

fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

446 
lemma real_sqrt_eq_zero_cancel: "[ 0 \<le> x; sqrt(x) = 0] ==> x = 0" 
22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

447 
by simp 
20687
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

448 

fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

449 
lemma real_sqrt_ge_one: "1 \<le> x ==> 1 \<le> sqrt x" 
22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

450 
by simp 
20687
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

451 

22443  452 
lemma sqrt_divide_self_eq: 
453 
assumes nneg: "0 \<le> x" 

454 
shows "sqrt x / x = inverse (sqrt x)" 

455 
proof cases 

456 
assume "x=0" thus ?thesis by simp 

457 
next 

458 
assume nz: "x\<noteq>0" 

459 
hence pos: "0<x" using nneg by arith 

460 
show ?thesis 

461 
proof (rule right_inverse_eq [THEN iffD1, THEN sym]) 

462 
show "sqrt x / x \<noteq> 0" by (simp add: divide_inverse nneg nz) 

463 
show "inverse (sqrt x) / (sqrt x / x) = 1" 

464 
by (simp add: divide_inverse mult_assoc [symmetric] 

465 
power2_eq_square [symmetric] real_inv_sqrt_pow2 pos nz) 

466 
qed 

467 
qed 

468 

22721
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

469 
lemma real_divide_square_eq [simp]: "(((r::real) * a) / (r * r)) = a / r" 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

470 
apply (simp add: divide_inverse) 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

471 
apply (case_tac "r=0") 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

472 
apply (auto simp add: mult_ac) 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

473 
done 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

474 

22856  475 
subsection {* Square Root of Sum of Squares *} 
476 

477 
lemma real_sqrt_mult_self_sum_ge_zero [simp]: "0 \<le> sqrt(x*x + y*y)" 

22961  478 
by (rule real_sqrt_ge_zero [OF real_mult_self_sum_ge_zero]) 
22856  479 

480 
lemma real_sqrt_sum_squares_ge_zero [simp]: "0 \<le> sqrt (x\<twosuperior> + y\<twosuperior>)" 

22961  481 
by simp 
22856  482 

483 
lemma real_sqrt_sum_squares_mult_ge_zero [simp]: 

484 
"0 \<le> sqrt ((x\<twosuperior> + y\<twosuperior>)*(xa\<twosuperior> + ya\<twosuperior>))" 

485 
by (auto intro!: real_sqrt_ge_zero simp add: zero_le_mult_iff) 

486 

487 
lemma real_sqrt_sum_squares_mult_squared_eq [simp]: 

488 
"sqrt ((x\<twosuperior> + y\<twosuperior>) * (xa\<twosuperior> + ya\<twosuperior>)) ^ 2 = (x\<twosuperior> + y\<twosuperior>) * (xa\<twosuperior> + ya\<twosuperior>)" 

22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

489 
by (auto simp add: zero_le_mult_iff) 
22856  490 

491 
lemma real_sqrt_sum_squares_ge1 [simp]: "x \<le> sqrt(x\<twosuperior> + y\<twosuperior>)" 

492 
by (rule power2_le_imp_le, simp_all) 

493 

494 
lemma real_sqrt_sum_squares_ge2 [simp]: "y \<le> sqrt(x\<twosuperior> + y\<twosuperior>)" 

495 
by (rule power2_le_imp_le, simp_all) 

496 

22858  497 
lemma power2_sum: 
498 
fixes x y :: "'a::{number_ring,recpower}" 

499 
shows "(x + y)\<twosuperior> = x\<twosuperior> + y\<twosuperior> + 2 * x * y" 

500 
by (simp add: left_distrib right_distrib power2_eq_square) 

501 

502 
lemma power2_diff: 

503 
fixes x y :: "'a::{number_ring,recpower}" 

504 
shows "(x  y)\<twosuperior> = x\<twosuperior> + y\<twosuperior>  2 * x * y" 

505 
by (simp add: left_diff_distrib right_diff_distrib power2_eq_square) 

506 

507 
lemma real_sqrt_sum_squares_triangle_ineq: 

508 
"sqrt ((a + c)\<twosuperior> + (b + d)\<twosuperior>) \<le> sqrt (a\<twosuperior> + b\<twosuperior>) + sqrt (c\<twosuperior> + d\<twosuperior>)" 

509 
apply (rule power2_le_imp_le, simp) 

510 
apply (simp add: power2_sum) 

511 
apply (simp only: mult_assoc right_distrib [symmetric]) 

512 
apply (rule mult_left_mono) 

513 
apply (rule power2_le_imp_le) 

514 
apply (simp add: power2_sum power_mult_distrib) 

515 
apply (simp add: ring_distrib) 

516 
apply (subgoal_tac "0 \<le> b\<twosuperior> * c\<twosuperior> + a\<twosuperior> * d\<twosuperior>  2 * (a * c) * (b * d)", simp) 

517 
apply (rule_tac b="(a * d  b * c)\<twosuperior>" in ord_le_eq_trans) 

518 
apply (rule zero_le_power2) 

519 
apply (simp add: power2_diff power_mult_distrib) 

520 
apply (simp add: mult_nonneg_nonneg) 

521 
apply simp 

522 
apply (simp add: add_increasing) 

523 
done 

524 

22956
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

525 
text "Legacy theorem names:" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

526 
lemmas real_root_pos2 = real_root_power_cancel 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

527 
lemmas real_root_pos_pos = real_root_gt_zero [THEN order_less_imp_le] 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

528 
lemmas real_root_pos_pos_le = real_root_ge_zero 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

529 
lemmas real_sqrt_mult_distrib = real_sqrt_mult 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

530 
lemmas real_sqrt_mult_distrib2 = real_sqrt_mult 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

531 
lemmas real_sqrt_eq_zero_cancel_iff = real_sqrt_eq_0_iff 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

532 

617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

533 
(* needed for CauchysMeanTheorem.het_base from AFP *) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

534 
lemma real_root_pos: "0 < x \<Longrightarrow> root (Suc n) (x ^ (Suc n)) = x" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

535 
by (rule real_root_power_cancel [OF zero_less_Suc order_less_imp_le]) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

536 

617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

537 
(* FIXME: the stronger version of real_root_less_iff 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

538 
breaks CauchysMeanTheorem.list_gmean_gt_iff from AFP. *) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

539 

617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

540 
declare real_root_less_iff [simp del] 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

541 
lemma real_root_less_iff_nonneg [simp]: 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

542 
"\<lbrakk>0 < n; 0 \<le> x; 0 \<le> y\<rbrakk> \<Longrightarrow> (root n x < root n y) = (x < y)" 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

543 
by (rule real_root_less_iff) 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
huffman
parents:
22943
diff
changeset

544 

14324  545 
end 