author  huffman 
Tue, 08 May 2007 03:03:23 +0200  
changeset 22856  eb0e0582092a 
parent 22721  d9be18bd7a28 
child 22858  5ca5d1cce388 
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 

14324  7 
header{*Existence of Nth Root*} 
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 

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

13 
definition 
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
20898
diff
changeset

14 
root :: "[nat, real] \<Rightarrow> real" where 
20687
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

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

16 

21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
20898
diff
changeset

17 
definition 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
20898
diff
changeset

18 
sqrt :: "real \<Rightarrow> real" where 
20687
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

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

20 

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

21 

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

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

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

26 

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

28 
*} 

14324  29 

30 
lemma lemma_nth_realpow_non_empty: 

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

32 
apply (case_tac "1 <= a") 

14477  33 
apply (rule_tac x = 1 in exI) 
14334  34 
apply (drule_tac [2] linorder_not_le [THEN iffD1]) 
14477  35 
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

36 
apply (force intro!: realpow_Suc_le_self simp del: realpow_Suc) 
14324  37 
done 
38 

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

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

40 
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

41 
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

42 

14324  43 
lemma lemma_nth_realpow_isUb_ex: 
44 
"[ (0::real) < a; 0 < n ] 

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

46 
apply (case_tac "1 <= a") 

14477  47 
apply (rule_tac x = a in exI) 
14334  48 
apply (drule_tac [2] linorder_not_le [THEN iffD1]) 
14477  49 
apply (rule_tac [2] x = 1 in exI) 
50 
apply (rule_tac [!] setleI [THEN isUbI], safe) 

14324  51 
apply (simp_all (no_asm)) 
52 
apply (rule_tac [!] ccontr) 

14334  53 
apply (drule_tac [!] linorder_not_le [THEN iffD1]) 
14477  54 
apply (drule realpow_ge_self2, assumption) 
55 
apply (drule_tac n = n in realpow_less) 

14324  56 
apply (assumption+) 
14477  57 
apply (drule real_le_trans, assumption) 
58 
apply (drule_tac y = "y ^ n" in order_less_le_trans, assumption, simp) 

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

14324  60 
done 
61 

62 
lemma nth_realpow_isLub_ex: 

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

64 
==> \<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

65 
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

66 

14324  67 

68 
subsection{*First Half  Lemmas First*} 

69 

70 
lemma lemma_nth_realpow_seq: 

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

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

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

74 
apply (simp add: linorder_not_less [symmetric]) 
14324  75 
done 
76 

77 
lemma lemma_nth_realpow_isLub_gt_zero: 

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

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

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

14324  82 
apply (auto intro: order_less_le_trans) 
83 
done 

84 

85 
lemma lemma_nth_realpow_isLub_ge: 

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

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

14477  88 
apply safe 
89 
apply (frule lemma_nth_realpow_seq, safe) 

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

90 
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

91 
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

92 
apply (simp add: linorder_not_less) 
14324  93 
apply (rule order_less_trans [of _ 0]) 
14325  94 
apply (auto intro: lemma_nth_realpow_isLub_gt_zero) 
14324  95 
done 
96 

97 
text{*First result we want*} 

98 
lemma realpow_nth_ge: 

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

100 
isLub (UNIV::real set) 

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

14477  102 
apply (frule lemma_nth_realpow_isLub_ge, safe) 
14324  103 
apply (rule LIMSEQ_inverse_real_of_nat_add [THEN LIMSEQ_pow, THEN LIMSEQ_le_const]) 
14334  104 
apply (auto simp add: real_of_nat_def) 
14324  105 
done 
106 

107 
subsection{*Second Half*} 

108 

109 
lemma less_isLub_not_isUb: 

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

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

14477  112 
apply safe 
113 
apply (drule isLub_le_isUb, assumption) 

114 
apply (drule order_less_le_trans, auto) 

14324  115 
done 
116 

117 
lemma not_isUb_less_ex: 

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

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

121 
apply (auto simp add: linorder_not_less [symmetric]) 
14324  122 
done 
123 

14325  124 
lemma real_mult_less_self: "0 < r ==> r * (1 + inverse(real (Suc n))) < r" 
14334  125 
apply (simp (no_asm) add: right_distrib) 
126 
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

127 
apply (auto intro: mult_pos_pos 
14334  128 
simp add: add_assoc [symmetric] neg_less_0_iff_less) 
14325  129 
done 
130 

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

131 
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

132 
"(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

133 
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

134 

14325  135 
lemma real_mult_add_one_minus_ge_zero: 
136 
"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

137 
by (simp add: zero_le_mult_iff real_of_nat_inverse_le_iff real_0_le_add_iff) 
14325  138 

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

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

146 
apply (drule_tac n = k in 

147 
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

148 
apply (blast intro: order_trans order_less_imp_le power_mono) 
14324  149 
done 
150 

151 
text{*Second result we want*} 

152 
lemma realpow_nth_le: 

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

154 
isLub (UNIV::real set) 

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

14477  156 
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

157 
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

158 
[THEN LIMSEQ_pow, THEN LIMSEQ_le_const2]) 
14334  159 
apply (auto simp add: real_of_nat_def) 
14324  160 
done 
161 

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

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

14324  166 
done 
167 

168 
(* positive only *) 

169 
lemma realpow_pos_nth: "[ (0::real) < a; 0 < n ] ==> \<exists>r. 0 < r & r ^ n = a" 

14477  170 
apply (frule nth_realpow_isLub_ex, auto) 
171 
apply (auto intro: realpow_nth_le realpow_nth_ge order_antisym lemma_nth_realpow_isLub_gt_zero) 

14324  172 
done 
173 

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

14477  175 
by (blast intro: realpow_pos_nth) 
14324  176 

177 
(* uniqueness of nth positive root *) 

178 
lemma realpow_pos_nth_unique: 

179 
"[ (0::real) < a; 0 < n ] ==> EX! r. 0 < r & r ^ n = a" 

180 
apply (auto intro!: realpow_pos_nth) 

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

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

14324  184 
done 
185 

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

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

187 

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

188 
lemma real_root_zero [simp]: "root (Suc n) 0 = 0" 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

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

190 
apply (safe intro!: the_equality power_0_Suc elim!: realpow_zero_zero) 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

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

192 

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

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

194 
"0 < x ==> (root (Suc n) x) ^ (Suc n) = x" 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

195 
apply (simp add: root_def del: realpow_Suc) 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

196 
apply (drule_tac n="Suc n" in realpow_pos_nth_unique, simp) 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

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

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

199 

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

200 
lemma real_root_pow_pos2: "0 \<le> x ==> (root (Suc n) x) ^ (Suc n) = x" 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

201 
by (auto dest!: real_le_imp_less_or_eq dest: real_root_pow_pos) 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

202 

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

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

204 
"0 < x ==> root(Suc n) (x ^ (Suc n)) = x" 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

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

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

207 
apply (frule_tac [2] n = n in zero_less_power) 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

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

209 
apply (rule_tac x = u and y = x in linorder_cases) 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

210 
apply (drule_tac n1 = n and x = u in zero_less_Suc [THEN [3] realpow_less]) 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

211 
apply (drule_tac [4] n1 = n and x = x in zero_less_Suc [THEN [3] realpow_less]) 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

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

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

214 

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

215 
lemma real_root_pos2: "0 \<le> x ==> root(Suc n) (x ^ (Suc n)) = x" 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

216 
by (auto dest!: real_le_imp_less_or_eq real_root_pos) 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

217 

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

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

219 
"0 < x ==> 0 < root (Suc n) x" 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

220 
apply (simp add: root_def del: realpow_Suc) 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

221 
apply (drule_tac n="Suc n" in realpow_pos_nth_unique, simp) 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

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

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

224 

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

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

226 
"0 < x ==> 0 \<le> root(Suc n) x" 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

227 
by (rule real_root_gt_zero [THEN order_less_imp_le]) 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

228 

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

229 
lemma real_root_pos_pos_le: "0 \<le> x ==> 0 \<le> root(Suc n) x" 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

230 
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

231 

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

232 
lemma real_root_one [simp]: "root (Suc n) 1 = 1" 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

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

234 
apply (rule the_equality, auto) 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

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

236 
apply (rule_tac x = u and y = 1 in linorder_cases) 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

237 
apply (drule_tac n = n in realpow_Suc_less_one) 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

238 
apply (drule_tac [4] n = n in power_gt1_lemma) 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

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

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

241 

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

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

243 
"[ 0 \<le> x; x < y ] ==> root(Suc n) x < root(Suc n) y" 
22856  244 
apply (subgoal_tac "0 \<le> y") 
245 
apply (rule_tac n="Suc n" in power_less_imp_less_base) 

246 
apply (simp only: real_root_pow_pos2) 

247 
apply (erule real_root_pos_pos_le) 

248 
apply (erule order_trans) 

249 
apply (erule order_less_imp_le) 

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

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

251 

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

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

253 
"[ 0 \<le> x; x \<le> y ] ==> root(Suc n) x \<le> root(Suc n) y" 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

254 
apply (drule_tac y = y in order_le_imp_less_or_eq) 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

255 
apply (auto dest: real_root_less_mono intro: order_less_imp_le) 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

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

257 

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

258 
lemma real_root_less_iff [simp]: 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

259 
"[ 0 \<le> x; 0 \<le> y ] ==> (root(Suc n) x < root(Suc n) y) = (x < y)" 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

260 
apply (auto intro: real_root_less_mono) 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

261 
apply (rule ccontr, drule linorder_not_less [THEN iffD1]) 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

262 
apply (drule_tac x = y and n = n in real_root_le_mono, auto) 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

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

264 

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

265 
lemma real_root_le_iff [simp]: 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

266 
"[ 0 \<le> x; 0 \<le> y ] ==> (root(Suc n) x \<le> root(Suc n) y) = (x \<le> y)" 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

267 
apply (auto intro: real_root_le_mono) 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

268 
apply (simp (no_asm) add: linorder_not_less [symmetric]) 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

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

270 
apply (drule_tac x = y and n = n in real_root_less_mono, auto) 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

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

272 

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

273 
lemma real_root_eq_iff [simp]: 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

274 
"[ 0 \<le> x; 0 \<le> y ] ==> (root(Suc n) x = root(Suc n) y) = (x = y)" 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

275 
apply (auto intro!: order_antisym [where 'a = real]) 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

276 
apply (rule_tac n1 = n in real_root_le_iff [THEN iffD1]) 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

277 
apply (rule_tac [4] n1 = n in real_root_le_iff [THEN iffD1], auto) 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

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

279 

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

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

281 
"[ 0 \<le> x; 0 \<le> y; y ^ (Suc n) = x ] ==> root (Suc n) x = y" 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

282 
by (auto dest: real_root_pos2 simp del: realpow_Suc) 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

283 

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

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

285 
"[ 0 \<le> x; 0 \<le> y ] 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

286 
==> root(Suc n) (x * y) = root(Suc n) x * root(Suc n) y" 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

287 
apply (rule real_root_pos_unique) 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

288 
apply (auto intro!: real_root_pos_pos_le 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

289 
simp add: power_mult_distrib zero_le_mult_iff real_root_pow_pos2 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

290 
simp del: realpow_Suc) 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

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

292 

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

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

294 
"0 \<le> x ==> (root(Suc n) (inverse x) = inverse(root(Suc n) x))" 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

295 
apply (rule real_root_pos_unique) 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

296 
apply (auto intro: real_root_pos_pos_le 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

297 
simp add: power_inverse [symmetric] real_root_pow_pos2 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

298 
simp del: realpow_Suc) 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

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

300 

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

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

302 
"[ 0 \<le> x; 0 \<le> y ] 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

303 
==> (root(Suc n) (x / y) = root(Suc n) x / root(Suc n) y)" 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

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

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

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

307 

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

308 

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

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

310 

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

311 
text{*needed because 2 is a binary numeral!*} 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

312 
lemma root_2_eq [simp]: "root 2 = root (Suc (Suc 0))" 
22856  313 
by (simp only: numeral_2_eq_2) 
20687
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

314 

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

315 
lemma real_sqrt_zero [simp]: "sqrt 0 = 0" 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

316 
by (simp add: sqrt_def) 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

317 

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

318 
lemma real_sqrt_one [simp]: "sqrt 1 = 1" 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

319 
by (simp add: sqrt_def) 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

320 

22856  321 
lemma real_sqrt_pow2 [simp]: "0 \<le> x ==> (sqrt x)\<twosuperior> = x" 
322 
unfolding sqrt_def numeral_2_eq_2 

323 
by (rule real_root_pow_pos2) 

324 

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

325 
lemma real_sqrt_pow2_iff [iff]: "((sqrt x)\<twosuperior> = x) = (0 \<le> x)" 
22856  326 
apply (rule iffI) 
327 
apply (erule subst) 

328 
apply (rule zero_le_power2) 

329 
apply (erule real_sqrt_pow2) 

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

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

331 

22856  332 
lemma real_sqrt_abs_abs [simp]: "(sqrt \<bar>x\<bar>)\<twosuperior> = \<bar>x\<bar>" (* TODO: delete *) 
333 
by simp 

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

334 

22856  335 
lemma sqrt_eqI: "\<lbrakk>r\<twosuperior> = a; 0 \<le> r\<rbrakk> \<Longrightarrow> sqrt a = r" 
336 
unfolding sqrt_def numeral_2_eq_2 

337 
by (erule subst, erule real_root_pos2) 

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

338 

22856  339 
lemma real_sqrt_abs [simp]: "sqrt (x\<twosuperior>) = \<bar>x\<bar>" 
340 
apply (rule sqrt_eqI) 

341 
apply (rule power2_abs) 

342 
apply (rule abs_ge_zero) 

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

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

344 

22856  345 
lemma real_pow_sqrt_eq_sqrt_pow: (* TODO: delete *) 
346 
"0 \<le> x ==> (sqrt x)\<twosuperior> = sqrt(x\<twosuperior>)" 

347 
by simp 

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

348 

22856  349 
lemma real_pow_sqrt_eq_sqrt_abs_pow2: (* TODO: delete *) 
350 
"0 \<le> x ==> (sqrt x)\<twosuperior> = sqrt(\<bar>x\<bar> ^ 2)" 

351 
by simp 

352 

353 
lemma real_sqrt_pow_abs: "0 \<le> x ==> (sqrt x)\<twosuperior> = \<bar>x\<bar>" (* TODO: delete *) 

354 
by simp 

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

355 

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

356 
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

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

358 
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

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

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

361 

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

362 
lemma real_sqrt_gt_zero: "0 < x ==> 0 < sqrt(x)" 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

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

364 

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

365 
lemma real_sqrt_ge_zero: "0 \<le> x ==> 0 \<le> sqrt(x)" 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

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

367 

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

368 

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

369 
(*we need to prove something like this: 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

370 
lemma "[r ^ n = a; 0<n; 0 < a \<longrightarrow> 0 < r] ==> root n a = r" 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

371 
apply (case_tac n, simp) 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

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

373 
apply (rule someI2 [of _ r], safe) 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

374 
apply (auto simp del: realpow_Suc dest: power_inject_base) 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

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

376 

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

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

378 
"[ 0 \<le> x; 0 \<le> y ] ==> sqrt(x*y) = sqrt(x) * sqrt(y)" 
22856  379 
unfolding sqrt_def numeral_2_eq_2 
380 
by (rule real_root_mult) 

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

381 

22856  382 
lemmas real_sqrt_mult_distrib2 = real_sqrt_mult_distrib 
20687
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

383 

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

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

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

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

388 

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

389 
lemma real_sqrt_pow2_gt_zero: "0 < x ==> 0 < (sqrt x)\<twosuperior>" 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

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

391 

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

392 
lemma real_sqrt_not_eq_zero: "0 < x ==> sqrt x \<noteq> 0" 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

393 
apply (frule real_sqrt_pow2_gt_zero) 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

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

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

396 

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

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

399 

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

400 
lemma real_sqrt_eq_zero_cancel: "[ 0 \<le> x; sqrt(x) = 0] ==> x = 0" 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

401 
apply (drule real_le_imp_less_or_eq) 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

402 
apply (auto dest: real_sqrt_not_eq_zero) 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

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

404 

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

405 
lemma real_sqrt_eq_zero_cancel_iff [simp]: "0 \<le> x ==> ((sqrt x = 0) = (x=0))" 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
huffman
parents:
20515
diff
changeset

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

407 

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

408 
lemma real_sqrt_ge_one: "1 \<le> x ==> 1 \<le> sqrt x" 
22856  409 
apply (rule power2_le_imp_le, simp) 
410 
apply (simp add: real_sqrt_ge_zero) 

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

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

412 

22443  413 
lemma sqrt_divide_self_eq: 
414 
assumes nneg: "0 \<le> x" 

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

416 
proof cases 

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

418 
next 

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

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

421 
show ?thesis 

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

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

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

425 
by (simp add: divide_inverse mult_assoc [symmetric] 

426 
power2_eq_square [symmetric] real_inv_sqrt_pow2 pos nz) 

427 
qed 

428 
qed 

429 

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

430 

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

431 
lemma real_sqrt_less_mono: "[ 0 \<le> x; x < y ] ==> sqrt(x) < sqrt(y)" 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

432 
by (simp add: sqrt_def) 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

433 

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

434 
lemma real_sqrt_le_mono: "[ 0 \<le> x; x \<le> y ] ==> sqrt(x) \<le> sqrt(y)" 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

435 
by (simp add: sqrt_def) 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

436 

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

437 
lemma real_sqrt_less_iff [simp]: 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

438 
"[ 0 \<le> x; 0 \<le> y ] ==> (sqrt(x) < sqrt(y)) = (x < y)" 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

439 
by (simp add: sqrt_def) 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

440 

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

441 
lemma real_sqrt_le_iff [simp]: 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

442 
"[ 0 \<le> x; 0 \<le> y ] ==> (sqrt(x) \<le> sqrt(y)) = (x \<le> y)" 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

443 
by (simp add: sqrt_def) 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

444 

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

445 
lemma real_sqrt_eq_iff [simp]: 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

446 
"[ 0 \<le> x; 0 \<le> y ] ==> (sqrt(x) = sqrt(y)) = (x = y)" 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

447 
by (simp add: sqrt_def) 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
huffman
parents:
22630
diff
changeset

448 

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

449 
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

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

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

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

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

454 

22856  455 
subsection {* Square Root of Sum of Squares *} 
456 

457 
lemma "(sqrt (x\<twosuperior> + y\<twosuperior>))\<twosuperior> = x\<twosuperior> + y\<twosuperior>" 

458 
by (rule realpow_two_le_add_order [THEN real_sqrt_pow2_iff [THEN iffD2]]) 

459 

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

461 
by (rule real_sqrt_ge_zero [OF real_mult_self_sum_ge_zero]) 

462 

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

464 
by (auto intro!: real_sqrt_ge_zero) 

465 

466 
lemma real_sqrt_sum_squares_mult_ge_zero [simp]: 

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

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

469 

470 
lemma real_sqrt_sum_squares_mult_squared_eq [simp]: 

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

472 
by (auto simp add: zero_le_mult_iff simp del: realpow_Suc) 

473 

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

475 
by (rule power2_le_imp_le, simp_all) 

476 

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

478 
by (rule power2_le_imp_le, simp_all) 

479 

480 
lemma real_sqrt_sos_less_one_iff [simp]: "(sqrt(x\<twosuperior> + y\<twosuperior>) < 1) = (x\<twosuperior> + y\<twosuperior> < 1)" 

481 
apply (subst real_sqrt_one [symmetric]) 

482 
apply (rule real_sqrt_less_iff, auto) 

483 
done 

484 

485 
lemma real_sqrt_sos_eq_one_iff [simp]: "(sqrt(x\<twosuperior> + y\<twosuperior>) = 1) = (x\<twosuperior> + y\<twosuperior> = 1)" 

486 
apply (subst real_sqrt_one [symmetric]) 

487 
apply (rule real_sqrt_eq_iff, auto) 

488 
done 

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

489 

14324  490 
end 