| author | paulson <lp15@cam.ac.uk> | 
| Tue, 30 Jun 2015 13:56:16 +0100 | |
| changeset 60615 | e5fa1d5d3952 | 
| parent 60141 | 833adf7db7d8 | 
| child 60758 | d8d85a8172b5 | 
| permissions | -rw-r--r-- | 
| 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  | 
||
| 58889 | 7  | 
section {* Nth Roots of Real Numbers *}
 | 
| 14324 | 8  | 
|
| 15131 | 9  | 
theory NthRoot  | 
| 
60141
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
10  | 
imports Deriv Binomial  | 
| 15131 | 11  | 
begin  | 
| 14324 | 12  | 
|
| 
51483
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
13  | 
lemma abs_sgn_eq: "abs (sgn x :: real) = (if x = 0 then 0 else 1)"  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
14  | 
by (simp add: sgn_real_def)  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
15  | 
|
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
16  | 
lemma inverse_sgn: "sgn (inverse a) = inverse (sgn a :: real)"  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
17  | 
by (simp add: sgn_real_def)  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
18  | 
|
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
19  | 
lemma power_eq_iff_eq_base:  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
20  | 
fixes a b :: "_ :: linordered_semidom"  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
21  | 
shows "0 < n \<Longrightarrow> 0 \<le> a \<Longrightarrow> 0 \<le> b \<Longrightarrow> a ^ n = b ^ n \<longleftrightarrow> a = b"  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
22  | 
using power_eq_imp_eq_base[of a n b] by auto  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
23  | 
|
| 
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
 | 
24  | 
subsection {* Existence of Nth Root *}
 | 
| 
20687
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
25  | 
|
| 
23009
 
01c295dd4a36
Prove existence of nth roots using Intermediate Value Theorem
 
huffman 
parents: 
22968 
diff
changeset
 | 
26  | 
text {* Existence follows from the Intermediate Value Theorem *}
 | 
| 14324 | 27  | 
|
| 
23009
 
01c295dd4a36
Prove existence of nth roots using Intermediate Value Theorem
 
huffman 
parents: 
22968 
diff
changeset
 | 
28  | 
lemma realpow_pos_nth:  | 
| 
 
01c295dd4a36
Prove existence of nth roots using Intermediate Value Theorem
 
huffman 
parents: 
22968 
diff
changeset
 | 
29  | 
assumes n: "0 < n"  | 
| 
 
01c295dd4a36
Prove existence of nth roots using Intermediate Value Theorem
 
huffman 
parents: 
22968 
diff
changeset
 | 
30  | 
assumes a: "0 < a"  | 
| 
 
01c295dd4a36
Prove existence of nth roots using Intermediate Value Theorem
 
huffman 
parents: 
22968 
diff
changeset
 | 
31  | 
shows "\<exists>r>0. r ^ n = (a::real)"  | 
| 
 
01c295dd4a36
Prove existence of nth roots using Intermediate Value Theorem
 
huffman 
parents: 
22968 
diff
changeset
 | 
32  | 
proof -  | 
| 
 
01c295dd4a36
Prove existence of nth roots using Intermediate Value Theorem
 
huffman 
parents: 
22968 
diff
changeset
 | 
33  | 
have "\<exists>r\<ge>0. r \<le> (max 1 a) \<and> r ^ n = a"  | 
| 
 
01c295dd4a36
Prove existence of nth roots using Intermediate Value Theorem
 
huffman 
parents: 
22968 
diff
changeset
 | 
34  | 
proof (rule IVT)  | 
| 
 
01c295dd4a36
Prove existence of nth roots using Intermediate Value Theorem
 
huffman 
parents: 
22968 
diff
changeset
 | 
35  | 
show "0 ^ n \<le> a" using n a by (simp add: power_0_left)  | 
| 
 
01c295dd4a36
Prove existence of nth roots using Intermediate Value Theorem
 
huffman 
parents: 
22968 
diff
changeset
 | 
36  | 
show "0 \<le> max 1 a" by simp  | 
| 
 
01c295dd4a36
Prove existence of nth roots using Intermediate Value Theorem
 
huffman 
parents: 
22968 
diff
changeset
 | 
37  | 
from n have n1: "1 \<le> n" by simp  | 
| 
 
01c295dd4a36
Prove existence of nth roots using Intermediate Value Theorem
 
huffman 
parents: 
22968 
diff
changeset
 | 
38  | 
have "a \<le> max 1 a ^ 1" by simp  | 
| 
 
01c295dd4a36
Prove existence of nth roots using Intermediate Value Theorem
 
huffman 
parents: 
22968 
diff
changeset
 | 
39  | 
also have "max 1 a ^ 1 \<le> max 1 a ^ n"  | 
| 
 
01c295dd4a36
Prove existence of nth roots using Intermediate Value Theorem
 
huffman 
parents: 
22968 
diff
changeset
 | 
40  | 
using n1 by (rule power_increasing, simp)  | 
| 
 
01c295dd4a36
Prove existence of nth roots using Intermediate Value Theorem
 
huffman 
parents: 
22968 
diff
changeset
 | 
41  | 
finally show "a \<le> max 1 a ^ n" .  | 
| 
 
01c295dd4a36
Prove existence of nth roots using Intermediate Value Theorem
 
huffman 
parents: 
22968 
diff
changeset
 | 
42  | 
show "\<forall>r. 0 \<le> r \<and> r \<le> max 1 a \<longrightarrow> isCont (\<lambda>x. x ^ n) r"  | 
| 44289 | 43  | 
by simp  | 
| 
23009
 
01c295dd4a36
Prove existence of nth roots using Intermediate Value Theorem
 
huffman 
parents: 
22968 
diff
changeset
 | 
44  | 
qed  | 
| 
 
01c295dd4a36
Prove existence of nth roots using Intermediate Value Theorem
 
huffman 
parents: 
22968 
diff
changeset
 | 
45  | 
then obtain r where r: "0 \<le> r \<and> r ^ n = a" by fast  | 
| 
 
01c295dd4a36
Prove existence of nth roots using Intermediate Value Theorem
 
huffman 
parents: 
22968 
diff
changeset
 | 
46  | 
with n a have "r \<noteq> 0" by (auto simp add: power_0_left)  | 
| 
 
01c295dd4a36
Prove existence of nth roots using Intermediate Value Theorem
 
huffman 
parents: 
22968 
diff
changeset
 | 
47  | 
with r have "0 < r \<and> r ^ n = a" by simp  | 
| 
 
01c295dd4a36
Prove existence of nth roots using Intermediate Value Theorem
 
huffman 
parents: 
22968 
diff
changeset
 | 
48  | 
thus ?thesis ..  | 
| 
 
01c295dd4a36
Prove existence of nth roots using Intermediate Value Theorem
 
huffman 
parents: 
22968 
diff
changeset
 | 
49  | 
qed  | 
| 14325 | 50  | 
|
| 23047 | 51  | 
(* Used by Integration/RealRandVar.thy in AFP *)  | 
52  | 
lemma realpow_pos_nth2: "(0::real) < a \<Longrightarrow> \<exists>r>0. r ^ Suc n = a"  | 
|
53  | 
by (blast intro: realpow_pos_nth)  | 
|
54  | 
||
| 
23009
 
01c295dd4a36
Prove existence of nth roots using Intermediate Value Theorem
 
huffman 
parents: 
22968 
diff
changeset
 | 
55  | 
text {* Uniqueness of nth positive root *}
 | 
| 14324 | 56  | 
|
| 
51483
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
57  | 
lemma realpow_pos_nth_unique: "\<lbrakk>0 < n; 0 < a\<rbrakk> \<Longrightarrow> \<exists>!r. 0 < r \<and> r ^ n = (a::real)"  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
58  | 
by (auto intro!: realpow_pos_nth simp: power_eq_iff_eq_base)  | 
| 14324 | 59  | 
|
| 
20687
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
60  | 
subsection {* Nth Root *}
 | 
| 
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
61  | 
|
| 
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
 | 
62  | 
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
 | 
63  | 
  @{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
 | 
64  | 
us to omit side conditions from many theorems. *}  | 
| 
20687
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
65  | 
|
| 
51483
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
66  | 
lemma inj_sgn_power: assumes "0 < n" shows "inj (\<lambda>y. sgn y * \<bar>y\<bar>^n :: real)" (is "inj ?f")  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
67  | 
proof (rule injI)  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
68  | 
have x: "\<And>a b :: real. (0 < a \<and> b < 0) \<or> (a < 0 \<and> 0 < b) \<Longrightarrow> a \<noteq> b" by auto  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
69  | 
fix x y assume "?f x = ?f y" with power_eq_iff_eq_base[of n "\<bar>x\<bar>" "\<bar>y\<bar>"] `0<n` show "x = y"  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
70  | 
by (cases rule: linorder_cases[of 0 x, case_product linorder_cases[of 0 y]])  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
71  | 
(simp_all add: x)  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
72  | 
qed  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
73  | 
|
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
74  | 
lemma sgn_power_injE: "sgn a * \<bar>a\<bar> ^ n = x \<Longrightarrow> x = sgn b * \<bar>b\<bar> ^ n \<Longrightarrow> 0 < n \<Longrightarrow> a = (b::real)"  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
75  | 
using inj_sgn_power[THEN injD, of n a b] by simp  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
76  | 
|
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
77  | 
definition root :: "nat \<Rightarrow> real \<Rightarrow> real" where  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
78  | 
"root n x = (if n = 0 then 0 else the_inv (\<lambda>y. sgn y * \<bar>y\<bar>^n) x)"  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
79  | 
|
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
80  | 
lemma root_0 [simp]: "root 0 x = 0"  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
81  | 
by (simp add: root_def)  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
82  | 
|
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
83  | 
lemma root_sgn_power: "0 < n \<Longrightarrow> root n (sgn y * \<bar>y\<bar>^n) = y"  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
84  | 
using the_inv_f_f[OF inj_sgn_power] by (simp add: root_def)  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
85  | 
|
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
86  | 
lemma sgn_power_root:  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
87  | 
assumes "0 < n" shows "sgn (root n x) * \<bar>(root n x)\<bar>^n = x" (is "?f (root n x) = x")  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
88  | 
proof cases  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
89  | 
assume "x \<noteq> 0"  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
90  | 
with realpow_pos_nth[OF `0 < n`, of "\<bar>x\<bar>"] obtain r where "0 < r" "r ^ n = \<bar>x\<bar>" by auto  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
91  | 
with `x \<noteq> 0` have S: "x \<in> range ?f"  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
92  | 
by (intro image_eqI[of _ _ "sgn x * r"])  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
93  | 
(auto simp: abs_mult sgn_mult power_mult_distrib abs_sgn_eq mult_sgn_abs)  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
94  | 
from `0 < n` f_the_inv_into_f[OF inj_sgn_power[OF `0 < n`] this] show ?thesis  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
95  | 
by (simp add: root_def)  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
96  | 
qed (insert `0 < n` root_sgn_power[of n 0], simp)  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
97  | 
|
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
98  | 
lemma split_root: "P (root n x) \<longleftrightarrow> (n = 0 \<longrightarrow> P 0) \<and> (0 < n \<longrightarrow> (\<forall>y. sgn y * \<bar>y\<bar>^n = x \<longrightarrow> P y))"  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
99  | 
apply (cases "n = 0")  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
100  | 
apply simp_all  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
101  | 
apply (metis root_sgn_power sgn_power_root)  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
102  | 
done  | 
| 
20687
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
103  | 
|
| 
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
 | 
104  | 
lemma real_root_zero [simp]: "root n 0 = 0"  | 
| 
51483
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
105  | 
by (simp split: split_root add: sgn_zero_iff)  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
106  | 
|
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
107  | 
lemma real_root_minus: "root n (- x) = - root n x"  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
108  | 
by (clarsimp split: split_root elim!: sgn_power_injE simp: sgn_minus)  | 
| 
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
 | 
109  | 
|
| 
51483
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
110  | 
lemma real_root_less_mono: "\<lbrakk>0 < n; x < y\<rbrakk> \<Longrightarrow> root n x < root n y"  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
111  | 
proof (clarsimp split: split_root)  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
112  | 
have x: "\<And>a b :: real. (0 < b \<and> a < 0) \<Longrightarrow> \<not> a > b" by auto  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
113  | 
fix a b :: real assume "0 < n" "sgn a * \<bar>a\<bar> ^ n < sgn b * \<bar>b\<bar> ^ n" then show "a < b"  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
114  | 
using power_less_imp_less_base[of a n b] power_less_imp_less_base[of "-b" n "-a"]  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
115  | 
by (simp add: sgn_real_def power_less_zero_eq x[of "a ^ n" "- ((- b) ^ n)"] split: split_if_asm)  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
116  | 
qed  | 
| 
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
 | 
117  | 
|
| 
 
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
 | 
118  | 
lemma real_root_gt_zero: "\<lbrakk>0 < n; 0 < x\<rbrakk> \<Longrightarrow> 0 < root n x"  | 
| 
51483
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
119  | 
using real_root_less_mono[of n 0 x] by simp  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
120  | 
|
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
121  | 
lemma real_root_ge_zero: "0 \<le> x \<Longrightarrow> 0 \<le> root n x"  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
122  | 
using real_root_gt_zero[of n x] by (cases "n = 0") (auto simp add: le_less)  | 
| 
20687
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
123  | 
|
| 
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
 | 
124  | 
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
 | 
125  | 
"\<lbrakk>0 < n; 0 < x\<rbrakk> \<Longrightarrow> root n x ^ n = x"  | 
| 
51483
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
126  | 
using sgn_power_root[of n x] real_root_gt_zero[of n x] by simp  | 
| 
20687
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
127  | 
|
| 
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
 | 
128  | 
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
 | 
129  | 
"\<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
 | 
130  | 
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
 | 
131  | 
|
| 
51483
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
132  | 
lemma sgn_root: "0 < n \<Longrightarrow> sgn (root n x) = sgn x"  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
133  | 
by (auto split: split_root simp: sgn_real_def power_less_zero_eq)  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
134  | 
|
| 23046 | 135  | 
lemma odd_real_root_pow: "odd n \<Longrightarrow> root n x ^ n = x"  | 
| 
51483
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
136  | 
using sgn_power_root[of n x] by (simp add: odd_pos sgn_real_def split: split_if_asm)  | 
| 
20687
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
137  | 
|
| 
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
 | 
138  | 
lemma real_root_power_cancel: "\<lbrakk>0 < n; 0 \<le> x\<rbrakk> \<Longrightarrow> root n (x ^ n) = x"  | 
| 
51483
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
139  | 
using root_sgn_power[of n x] by (auto simp add: le_less power_0_left)  | 
| 
20687
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
140  | 
|
| 23046 | 141  | 
lemma odd_real_root_power_cancel: "odd n \<Longrightarrow> root n (x ^ n) = x"  | 
| 
51483
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
142  | 
using root_sgn_power[of n x] by (simp add: odd_pos sgn_real_def power_0_left split: split_if_asm)  | 
| 23046 | 143  | 
|
| 
51483
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
144  | 
lemma real_root_pos_unique: "\<lbrakk>0 < n; 0 \<le> y; y ^ n = x\<rbrakk> \<Longrightarrow> root n x = y"  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
145  | 
using root_sgn_power[of n y] by (auto simp add: le_less power_0_left)  | 
| 
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
 | 
146  | 
|
| 23046 | 147  | 
lemma odd_real_root_unique:  | 
148  | 
"\<lbrakk>odd n; y ^ n = x\<rbrakk> \<Longrightarrow> root n x = y"  | 
|
149  | 
by (erule subst, rule odd_real_root_power_cancel)  | 
|
150  | 
||
| 
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
 | 
151  | 
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
 | 
152  | 
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
 | 
153  | 
|
| 
 
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
 | 
154  | 
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
 | 
155  | 
|
| 
 
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
 | 
156  | 
lemma real_root_le_mono: "\<lbrakk>0 < n; x \<le> y\<rbrakk> \<Longrightarrow> root n x \<le> root n y"  | 
| 
51483
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
157  | 
by (auto simp add: order_le_less real_root_less_mono)  | 
| 
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
 | 
158  | 
|
| 
22721
 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
22630 
diff
changeset
 | 
159  | 
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
 | 
160  | 
"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
 | 
161  | 
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
 | 
162  | 
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
 | 
163  | 
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
 | 
164  | 
done  | 
| 
 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
22630 
diff
changeset
 | 
165  | 
|
| 
 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
22630 
diff
changeset
 | 
166  | 
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
 | 
167  | 
"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
 | 
168  | 
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
 | 
169  | 
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
 | 
170  | 
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
 | 
171  | 
done  | 
| 
 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
22630 
diff
changeset
 | 
172  | 
|
| 
 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
22630 
diff
changeset
 | 
173  | 
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
 | 
174  | 
"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
 | 
175  | 
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
 | 
176  | 
|
| 
 
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
 | 
177  | 
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
 | 
178  | 
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
 | 
179  | 
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
 | 
180  | 
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
 | 
181  | 
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
 | 
182  | 
|
| 23257 | 183  | 
lemma real_root_gt_1_iff [simp]: "0 < n \<Longrightarrow> (1 < root n y) = (1 < y)"  | 
184  | 
by (insert real_root_less_iff [where x=1], simp)  | 
|
185  | 
||
186  | 
lemma real_root_lt_1_iff [simp]: "0 < n \<Longrightarrow> (root n x < 1) = (x < 1)"  | 
|
187  | 
by (insert real_root_less_iff [where y=1], simp)  | 
|
188  | 
||
189  | 
lemma real_root_ge_1_iff [simp]: "0 < n \<Longrightarrow> (1 \<le> root n y) = (1 \<le> y)"  | 
|
190  | 
by (insert real_root_le_iff [where x=1], simp)  | 
|
191  | 
||
192  | 
lemma real_root_le_1_iff [simp]: "0 < n \<Longrightarrow> (root n x \<le> 1) = (x \<le> 1)"  | 
|
193  | 
by (insert real_root_le_iff [where y=1], simp)  | 
|
194  | 
||
195  | 
lemma real_root_eq_1_iff [simp]: "0 < n \<Longrightarrow> (root n x = 1) = (x = 1)"  | 
|
196  | 
by (insert real_root_eq_iff [where y=1], simp)  | 
|
197  | 
||
| 
51483
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
198  | 
text {* Roots of multiplication and division *}
 | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
199  | 
|
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
200  | 
lemma real_root_mult: "root n (x * y) = root n x * root n y"  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
201  | 
by (auto split: split_root elim!: sgn_power_injE simp: sgn_mult abs_mult power_mult_distrib)  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
202  | 
|
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
203  | 
lemma real_root_inverse: "root n (inverse x) = inverse (root n x)"  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
204  | 
by (auto split: split_root elim!: sgn_power_injE simp: inverse_sgn power_inverse)  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
205  | 
|
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
206  | 
lemma real_root_divide: "root n (x / y) = root n x / root n y"  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
207  | 
by (simp add: divide_inverse real_root_mult real_root_inverse)  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
208  | 
|
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
209  | 
lemma real_root_abs: "0 < n \<Longrightarrow> root n \<bar>x\<bar> = \<bar>root n x\<bar>"  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
210  | 
by (simp add: abs_if real_root_minus)  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
211  | 
|
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
212  | 
lemma real_root_power: "0 < n \<Longrightarrow> root n (x ^ k) = root n x ^ k"  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
213  | 
by (induct k) (simp_all add: real_root_mult)  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
214  | 
|
| 23257 | 215  | 
text {* Roots of roots *}
 | 
216  | 
||
217  | 
lemma real_root_Suc_0 [simp]: "root (Suc 0) x = x"  | 
|
218  | 
by (simp add: odd_real_root_unique)  | 
|
219  | 
||
| 
51483
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
220  | 
lemma real_root_mult_exp: "root (m * n) x = root m (root n x)"  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
221  | 
by (auto split: split_root elim!: sgn_power_injE  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
222  | 
simp: sgn_zero_iff sgn_mult power_mult[symmetric] abs_mult power_mult_distrib abs_sgn_eq)  | 
| 23257 | 223  | 
|
| 
51483
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
224  | 
lemma real_root_commute: "root m (root n x) = root n (root m x)"  | 
| 
57512
 
cc97b347b301
reduced name variants for assoc and commute on plus and mult
 
haftmann 
parents: 
57275 
diff
changeset
 | 
225  | 
by (simp add: real_root_mult_exp [symmetric] mult.commute)  | 
| 23257 | 226  | 
|
227  | 
text {* Monotonicity in first argument *}
 | 
|
228  | 
||
229  | 
lemma real_root_strict_decreasing:  | 
|
230  | 
"\<lbrakk>0 < n; n < N; 1 < x\<rbrakk> \<Longrightarrow> root N x < root n x"  | 
|
231  | 
apply (subgoal_tac "root n (root N x) ^ n < root N (root n x) ^ N", simp)  | 
|
232  | 
apply (simp add: real_root_commute power_strict_increasing  | 
|
233  | 
del: real_root_pow_pos2)  | 
|
234  | 
done  | 
|
235  | 
||
236  | 
lemma real_root_strict_increasing:  | 
|
237  | 
"\<lbrakk>0 < n; n < N; 0 < x; x < 1\<rbrakk> \<Longrightarrow> root n x < root N x"  | 
|
238  | 
apply (subgoal_tac "root N (root n x) ^ N < root n (root N x) ^ n", simp)  | 
|
239  | 
apply (simp add: real_root_commute power_strict_decreasing  | 
|
240  | 
del: real_root_pow_pos2)  | 
|
241  | 
done  | 
|
242  | 
||
243  | 
lemma real_root_decreasing:  | 
|
244  | 
"\<lbrakk>0 < n; n < N; 1 \<le> x\<rbrakk> \<Longrightarrow> root N x \<le> root n x"  | 
|
245  | 
by (auto simp add: order_le_less real_root_strict_decreasing)  | 
|
246  | 
||
247  | 
lemma real_root_increasing:  | 
|
248  | 
"\<lbrakk>0 < n; n < N; 0 \<le> x; x \<le> 1\<rbrakk> \<Longrightarrow> root n x \<le> root N x"  | 
|
249  | 
by (auto simp add: order_le_less real_root_strict_increasing)  | 
|
250  | 
||
| 
23042
 
492514b39956
add lemmas about continuity and derivatives of roots
 
huffman 
parents: 
23009 
diff
changeset
 | 
251  | 
text {* Continuity and derivatives *}
 | 
| 
 
492514b39956
add lemmas about continuity and derivatives of roots
 
huffman 
parents: 
23009 
diff
changeset
 | 
252  | 
|
| 
51483
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
253  | 
lemma isCont_real_root: "isCont (root n) x"  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
254  | 
proof cases  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
255  | 
assume n: "0 < n"  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
256  | 
let ?f = "\<lambda>y::real. sgn y * \<bar>y\<bar>^n"  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
257  | 
  have "continuous_on ({0..} \<union> {.. 0}) (\<lambda>x. if 0 < x then x ^ n else - ((-x) ^ n) :: real)"
 | 
| 
56371
 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 
hoelzl 
parents: 
55967 
diff
changeset
 | 
258  | 
using n by (intro continuous_on_If continuous_intros) auto  | 
| 
51483
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
259  | 
then have "continuous_on UNIV ?f"  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
260  | 
by (rule continuous_on_cong[THEN iffD1, rotated 2]) (auto simp: not_less real_sgn_neg le_less n)  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
261  | 
then have [simp]: "\<And>x. isCont ?f x"  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
262  | 
by (simp add: continuous_on_eq_continuous_at)  | 
| 
23042
 
492514b39956
add lemmas about continuity and derivatives of roots
 
huffman 
parents: 
23009 
diff
changeset
 | 
263  | 
|
| 
51483
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
264  | 
have "isCont (root n) (?f (root n x))"  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
265  | 
by (rule isCont_inverse_function [where f="?f" and d=1]) (auto simp: root_sgn_power n)  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
266  | 
then show ?thesis  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
267  | 
by (simp add: sgn_power_root n)  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
268  | 
qed (simp add: root_def[abs_def])  | 
| 
23042
 
492514b39956
add lemmas about continuity and derivatives of roots
 
huffman 
parents: 
23009 
diff
changeset
 | 
269  | 
|
| 
51478
 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 
hoelzl 
parents: 
49962 
diff
changeset
 | 
270  | 
lemma tendsto_real_root[tendsto_intros]:  | 
| 
51483
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
271  | 
"(f ---> x) F \<Longrightarrow> ((\<lambda>x. root n (f x)) ---> root n x) F"  | 
| 
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
272  | 
using isCont_tendsto_compose[OF isCont_real_root, of f x F] .  | 
| 
51478
 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 
hoelzl 
parents: 
49962 
diff
changeset
 | 
273  | 
|
| 
 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 
hoelzl 
parents: 
49962 
diff
changeset
 | 
274  | 
lemma continuous_real_root[continuous_intros]:  | 
| 
51483
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
275  | 
"continuous F f \<Longrightarrow> continuous F (\<lambda>x. root n (f x))"  | 
| 
51478
 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 
hoelzl 
parents: 
49962 
diff
changeset
 | 
276  | 
unfolding continuous_def by (rule tendsto_real_root)  | 
| 
 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 
hoelzl 
parents: 
49962 
diff
changeset
 | 
277  | 
|
| 
56371
 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 
hoelzl 
parents: 
55967 
diff
changeset
 | 
278  | 
lemma continuous_on_real_root[continuous_intros]:  | 
| 
51483
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
279  | 
"continuous_on s f \<Longrightarrow> continuous_on s (\<lambda>x. root n (f x))"  | 
| 
51478
 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 
hoelzl 
parents: 
49962 
diff
changeset
 | 
280  | 
unfolding continuous_on_def by (auto intro: tendsto_real_root)  | 
| 
 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 
hoelzl 
parents: 
49962 
diff
changeset
 | 
281  | 
|
| 
23042
 
492514b39956
add lemmas about continuity and derivatives of roots
 
huffman 
parents: 
23009 
diff
changeset
 | 
282  | 
lemma DERIV_real_root:  | 
| 
 
492514b39956
add lemmas about continuity and derivatives of roots
 
huffman 
parents: 
23009 
diff
changeset
 | 
283  | 
assumes n: "0 < n"  | 
| 
 
492514b39956
add lemmas about continuity and derivatives of roots
 
huffman 
parents: 
23009 
diff
changeset
 | 
284  | 
assumes x: "0 < x"  | 
| 
 
492514b39956
add lemmas about continuity and derivatives of roots
 
huffman 
parents: 
23009 
diff
changeset
 | 
285  | 
shows "DERIV (root n) x :> inverse (real n * root n x ^ (n - Suc 0))"  | 
| 
 
492514b39956
add lemmas about continuity and derivatives of roots
 
huffman 
parents: 
23009 
diff
changeset
 | 
286  | 
proof (rule DERIV_inverse_function)  | 
| 23044 | 287  | 
show "0 < x" using x .  | 
288  | 
show "x < x + 1" by simp  | 
|
289  | 
show "\<forall>y. 0 < y \<and> y < x + 1 \<longrightarrow> root n y ^ n = y"  | 
|
| 
23042
 
492514b39956
add lemmas about continuity and derivatives of roots
 
huffman 
parents: 
23009 
diff
changeset
 | 
290  | 
using n by simp  | 
| 
 
492514b39956
add lemmas about continuity and derivatives of roots
 
huffman 
parents: 
23009 
diff
changeset
 | 
291  | 
show "DERIV (\<lambda>x. x ^ n) (root n x) :> real n * root n x ^ (n - Suc 0)"  | 
| 
 
492514b39956
add lemmas about continuity and derivatives of roots
 
huffman 
parents: 
23009 
diff
changeset
 | 
292  | 
by (rule DERIV_pow)  | 
| 
 
492514b39956
add lemmas about continuity and derivatives of roots
 
huffman 
parents: 
23009 
diff
changeset
 | 
293  | 
show "real n * root n x ^ (n - Suc 0) \<noteq> 0"  | 
| 
 
492514b39956
add lemmas about continuity and derivatives of roots
 
huffman 
parents: 
23009 
diff
changeset
 | 
294  | 
using n x by simp  | 
| 
51483
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
295  | 
qed (rule isCont_real_root)  | 
| 
23042
 
492514b39956
add lemmas about continuity and derivatives of roots
 
huffman 
parents: 
23009 
diff
changeset
 | 
296  | 
|
| 23046 | 297  | 
lemma DERIV_odd_real_root:  | 
298  | 
assumes n: "odd n"  | 
|
299  | 
assumes x: "x \<noteq> 0"  | 
|
300  | 
shows "DERIV (root n) x :> inverse (real n * root n x ^ (n - Suc 0))"  | 
|
301  | 
proof (rule DERIV_inverse_function)  | 
|
302  | 
show "x - 1 < x" by simp  | 
|
303  | 
show "x < x + 1" by simp  | 
|
304  | 
show "\<forall>y. x - 1 < y \<and> y < x + 1 \<longrightarrow> root n y ^ n = y"  | 
|
305  | 
using n by (simp add: odd_real_root_pow)  | 
|
306  | 
show "DERIV (\<lambda>x. x ^ n) (root n x) :> real n * root n x ^ (n - Suc 0)"  | 
|
307  | 
by (rule DERIV_pow)  | 
|
308  | 
show "real n * root n x ^ (n - Suc 0) \<noteq> 0"  | 
|
309  | 
using odd_pos [OF n] x by simp  | 
|
| 
51483
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
310  | 
qed (rule isCont_real_root)  | 
| 23046 | 311  | 
|
| 31880 | 312  | 
lemma DERIV_even_real_root:  | 
313  | 
assumes n: "0 < n" and "even n"  | 
|
314  | 
assumes x: "x < 0"  | 
|
315  | 
shows "DERIV (root n) x :> inverse (- real n * root n x ^ (n - Suc 0))"  | 
|
316  | 
proof (rule DERIV_inverse_function)  | 
|
317  | 
show "x - 1 < x" by simp  | 
|
318  | 
show "x < 0" using x .  | 
|
319  | 
next  | 
|
320  | 
show "\<forall>y. x - 1 < y \<and> y < 0 \<longrightarrow> - (root n y ^ n) = y"  | 
|
321  | 
proof (rule allI, rule impI, erule conjE)  | 
|
322  | 
fix y assume "x - 1 < y" and "y < 0"  | 
|
323  | 
hence "root n (-y) ^ n = -y" using `0 < n` by simp  | 
|
| 
51483
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
324  | 
with real_root_minus and `even n`  | 
| 31880 | 325  | 
show "- (root n y ^ n) = y" by simp  | 
326  | 
qed  | 
|
327  | 
next  | 
|
328  | 
show "DERIV (\<lambda>x. - (x ^ n)) (root n x) :> - real n * root n x ^ (n - Suc 0)"  | 
|
| 
56381
 
0556204bc230
merged DERIV_intros, has_derivative_intros into derivative_intros
 
hoelzl 
parents: 
56371 
diff
changeset
 | 
329  | 
by (auto intro!: derivative_eq_intros simp: real_of_nat_def)  | 
| 31880 | 330  | 
show "- real n * root n x ^ (n - Suc 0) \<noteq> 0"  | 
331  | 
using n x by simp  | 
|
| 
51483
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
332  | 
qed (rule isCont_real_root)  | 
| 31880 | 333  | 
|
334  | 
lemma DERIV_real_root_generic:  | 
|
335  | 
assumes "0 < n" and "x \<noteq> 0"  | 
|
| 49753 | 336  | 
and "\<lbrakk> even n ; 0 < x \<rbrakk> \<Longrightarrow> D = inverse (real n * root n x ^ (n - Suc 0))"  | 
337  | 
and "\<lbrakk> even n ; x < 0 \<rbrakk> \<Longrightarrow> D = - inverse (real n * root n x ^ (n - Suc 0))"  | 
|
338  | 
and "odd n \<Longrightarrow> D = inverse (real n * root n x ^ (n - Suc 0))"  | 
|
| 31880 | 339  | 
shows "DERIV (root n) x :> D"  | 
340  | 
using assms by (cases "even n", cases "0 < x",  | 
|
341  | 
auto intro: DERIV_real_root[THEN DERIV_cong]  | 
|
342  | 
DERIV_odd_real_root[THEN DERIV_cong]  | 
|
343  | 
DERIV_even_real_root[THEN DERIV_cong])  | 
|
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  | 
|
| 
51483
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
347  | 
definition sqrt :: "real \<Rightarrow> real" where  | 
| 
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
 | 
348  | 
"sqrt = root 2"  | 
| 
20687
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
349  | 
|
| 
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
 | 
350  | 
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
 | 
351  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
51483 
diff
changeset
 | 
352  | 
lemma real_sqrt_unique: "\<lbrakk>y\<^sup>2 = x; 0 \<le> y\<rbrakk> \<Longrightarrow> sqrt x = 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
 | 
353  | 
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
 | 
354  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
51483 
diff
changeset
 | 
355  | 
lemma real_sqrt_abs [simp]: "sqrt (x\<^sup>2) = \<bar>x\<bar>"  | 
| 
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  | 
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
 | 
357  | 
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
 | 
358  | 
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
 | 
359  | 
done  | 
| 
20687
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
360  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
51483 
diff
changeset
 | 
361  | 
lemma real_sqrt_pow2 [simp]: "0 \<le> x \<Longrightarrow> (sqrt x)\<^sup>2 = 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
 | 
362  | 
unfolding sqrt_def by (rule real_root_pow_pos2 [OF pos2])  | 
| 22856 | 363  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
51483 
diff
changeset
 | 
364  | 
lemma real_sqrt_pow2_iff [simp]: "((sqrt x)\<^sup>2 = x) = (0 \<le> x)"  | 
| 22856 | 365  | 
apply (rule iffI)  | 
366  | 
apply (erule subst)  | 
|
367  | 
apply (rule zero_le_power2)  | 
|
368  | 
apply (erule real_sqrt_pow2)  | 
|
| 
20687
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
369  | 
done  | 
| 
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
370  | 
|
| 
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
 | 
371  | 
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
 | 
372  | 
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
 | 
373  | 
|
| 
 
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  | 
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
 | 
375  | 
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
 | 
376  | 
|
| 
56889
 
48a745e1bde7
avoid the Complex constructor, use the more natural Re/Im view; moved csqrt to Complex.
 
hoelzl 
parents: 
56536 
diff
changeset
 | 
377  | 
lemma real_sqrt_four [simp]: "sqrt 4 = 2"  | 
| 
 
48a745e1bde7
avoid the Complex constructor, use the more natural Re/Im view; moved csqrt to Complex.
 
hoelzl 
parents: 
56536 
diff
changeset
 | 
378  | 
using real_sqrt_abs[of 2] by simp  | 
| 
 
48a745e1bde7
avoid the Complex constructor, use the more natural Re/Im view; moved csqrt to Complex.
 
hoelzl 
parents: 
56536 
diff
changeset
 | 
379  | 
|
| 
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
 | 
380  | 
lemma real_sqrt_minus: "sqrt (- x) = - sqrt x"  | 
| 
51483
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
381  | 
unfolding sqrt_def by (rule real_root_minus)  | 
| 
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
 | 
382  | 
|
| 
 
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  | 
lemma real_sqrt_mult: "sqrt (x * y) = sqrt x * sqrt y"  | 
| 
51483
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
384  | 
unfolding sqrt_def by (rule 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
 | 
385  | 
|
| 
56889
 
48a745e1bde7
avoid the Complex constructor, use the more natural Re/Im view; moved csqrt to Complex.
 
hoelzl 
parents: 
56536 
diff
changeset
 | 
386  | 
lemma real_sqrt_mult_self[simp]: "sqrt a * sqrt a = \<bar>a\<bar>"  | 
| 
 
48a745e1bde7
avoid the Complex constructor, use the more natural Re/Im view; moved csqrt to Complex.
 
hoelzl 
parents: 
56536 
diff
changeset
 | 
387  | 
using real_sqrt_abs[of a] unfolding power2_eq_square real_sqrt_mult .  | 
| 
 
48a745e1bde7
avoid the Complex constructor, use the more natural Re/Im view; moved csqrt to Complex.
 
hoelzl 
parents: 
56536 
diff
changeset
 | 
388  | 
|
| 
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
 | 
389  | 
lemma real_sqrt_inverse: "sqrt (inverse x) = inverse (sqrt x)"  | 
| 
51483
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
390  | 
unfolding sqrt_def by (rule 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
 | 
391  | 
|
| 
 
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  | 
lemma real_sqrt_divide: "sqrt (x / y) = sqrt x / sqrt y"  | 
| 
51483
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
393  | 
unfolding sqrt_def by (rule real_root_divide)  | 
| 
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
 | 
394  | 
|
| 
 
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  | 
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
 | 
396  | 
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
 | 
397  | 
|
| 
 
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
 | 
398  | 
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
 | 
399  | 
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
 | 
400  | 
|
| 
 
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  | 
lemma real_sqrt_ge_zero: "0 \<le> x \<Longrightarrow> 0 \<le> sqrt x"  | 
| 
51483
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
402  | 
unfolding sqrt_def by (rule real_root_ge_zero)  | 
| 
20687
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
403  | 
|
| 
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
 | 
404  | 
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
 | 
405  | 
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
 | 
406  | 
|
| 
 
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  | 
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
 | 
408  | 
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
 | 
409  | 
|
| 
 
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  | 
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
 | 
411  | 
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
 | 
412  | 
|
| 
 
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  | 
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
 | 
414  | 
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
 | 
415  | 
|
| 
 
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  | 
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
 | 
417  | 
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
 | 
418  | 
|
| 
54413
 
88a036a95967
add finite_select_induct; move generic lemmas from MV_Analysis/Linear_Algebra to the HOL image
 
hoelzl 
parents: 
53594 
diff
changeset
 | 
419  | 
lemma real_le_lsqrt: "0 \<le> x \<Longrightarrow> 0 \<le> y \<Longrightarrow> x \<le> y\<^sup>2 \<Longrightarrow> sqrt x \<le> y"  | 
| 
 
88a036a95967
add finite_select_induct; move generic lemmas from MV_Analysis/Linear_Algebra to the HOL image
 
hoelzl 
parents: 
53594 
diff
changeset
 | 
420  | 
using real_sqrt_le_iff[of x "y\<^sup>2"] by simp  | 
| 
 
88a036a95967
add finite_select_induct; move generic lemmas from MV_Analysis/Linear_Algebra to the HOL image
 
hoelzl 
parents: 
53594 
diff
changeset
 | 
421  | 
|
| 
 
88a036a95967
add finite_select_induct; move generic lemmas from MV_Analysis/Linear_Algebra to the HOL image
 
hoelzl 
parents: 
53594 
diff
changeset
 | 
422  | 
lemma real_le_rsqrt: "x\<^sup>2 \<le> y \<Longrightarrow> x \<le> sqrt y"  | 
| 
 
88a036a95967
add finite_select_induct; move generic lemmas from MV_Analysis/Linear_Algebra to the HOL image
 
hoelzl 
parents: 
53594 
diff
changeset
 | 
423  | 
using real_sqrt_le_mono[of "x\<^sup>2" y] by simp  | 
| 
 
88a036a95967
add finite_select_induct; move generic lemmas from MV_Analysis/Linear_Algebra to the HOL image
 
hoelzl 
parents: 
53594 
diff
changeset
 | 
424  | 
|
| 
 
88a036a95967
add finite_select_induct; move generic lemmas from MV_Analysis/Linear_Algebra to the HOL image
 
hoelzl 
parents: 
53594 
diff
changeset
 | 
425  | 
lemma real_less_rsqrt: "x\<^sup>2 < y \<Longrightarrow> x < sqrt y"  | 
| 
 
88a036a95967
add finite_select_induct; move generic lemmas from MV_Analysis/Linear_Algebra to the HOL image
 
hoelzl 
parents: 
53594 
diff
changeset
 | 
426  | 
using real_sqrt_less_mono[of "x\<^sup>2" y] by simp  | 
| 
 
88a036a95967
add finite_select_induct; move generic lemmas from MV_Analysis/Linear_Algebra to the HOL image
 
hoelzl 
parents: 
53594 
diff
changeset
 | 
427  | 
|
| 
 
88a036a95967
add finite_select_induct; move generic lemmas from MV_Analysis/Linear_Algebra to the HOL image
 
hoelzl 
parents: 
53594 
diff
changeset
 | 
428  | 
lemma sqrt_even_pow2:  | 
| 
 
88a036a95967
add finite_select_induct; move generic lemmas from MV_Analysis/Linear_Algebra to the HOL image
 
hoelzl 
parents: 
53594 
diff
changeset
 | 
429  | 
assumes n: "even n"  | 
| 
 
88a036a95967
add finite_select_induct; move generic lemmas from MV_Analysis/Linear_Algebra to the HOL image
 
hoelzl 
parents: 
53594 
diff
changeset
 | 
430  | 
shows "sqrt (2 ^ n) = 2 ^ (n div 2)"  | 
| 
 
88a036a95967
add finite_select_induct; move generic lemmas from MV_Analysis/Linear_Algebra to the HOL image
 
hoelzl 
parents: 
53594 
diff
changeset
 | 
431  | 
proof -  | 
| 
58709
 
efdc6c533bd3
prefer generic elimination rules for even/odd over specialized unfold rules for nat
 
haftmann 
parents: 
57514 
diff
changeset
 | 
432  | 
from n obtain m where m: "n = 2 * m" ..  | 
| 
54413
 
88a036a95967
add finite_select_induct; move generic lemmas from MV_Analysis/Linear_Algebra to the HOL image
 
hoelzl 
parents: 
53594 
diff
changeset
 | 
433  | 
from m have "sqrt (2 ^ n) = sqrt ((2 ^ m)\<^sup>2)"  | 
| 
57512
 
cc97b347b301
reduced name variants for assoc and commute on plus and mult
 
haftmann 
parents: 
57275 
diff
changeset
 | 
434  | 
by (simp only: power_mult[symmetric] mult.commute)  | 
| 
54413
 
88a036a95967
add finite_select_induct; move generic lemmas from MV_Analysis/Linear_Algebra to the HOL image
 
hoelzl 
parents: 
53594 
diff
changeset
 | 
435  | 
then show ?thesis  | 
| 
 
88a036a95967
add finite_select_induct; move generic lemmas from MV_Analysis/Linear_Algebra to the HOL image
 
hoelzl 
parents: 
53594 
diff
changeset
 | 
436  | 
using m by simp  | 
| 
 
88a036a95967
add finite_select_induct; move generic lemmas from MV_Analysis/Linear_Algebra to the HOL image
 
hoelzl 
parents: 
53594 
diff
changeset
 | 
437  | 
qed  | 
| 
 
88a036a95967
add finite_select_induct; move generic lemmas from MV_Analysis/Linear_Algebra to the HOL image
 
hoelzl 
parents: 
53594 
diff
changeset
 | 
438  | 
|
| 53594 | 439  | 
lemmas real_sqrt_gt_0_iff [simp] = real_sqrt_less_iff [where x=0, unfolded real_sqrt_zero]  | 
440  | 
lemmas real_sqrt_lt_0_iff [simp] = real_sqrt_less_iff [where y=0, unfolded real_sqrt_zero]  | 
|
441  | 
lemmas real_sqrt_ge_0_iff [simp] = real_sqrt_le_iff [where x=0, unfolded real_sqrt_zero]  | 
|
442  | 
lemmas real_sqrt_le_0_iff [simp] = real_sqrt_le_iff [where y=0, unfolded real_sqrt_zero]  | 
|
443  | 
lemmas real_sqrt_eq_0_iff [simp] = real_sqrt_eq_iff [where y=0, unfolded real_sqrt_zero]  | 
|
| 
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
 | 
444  | 
|
| 53594 | 445  | 
lemmas real_sqrt_gt_1_iff [simp] = real_sqrt_less_iff [where x=1, unfolded real_sqrt_one]  | 
446  | 
lemmas real_sqrt_lt_1_iff [simp] = real_sqrt_less_iff [where y=1, unfolded real_sqrt_one]  | 
|
447  | 
lemmas real_sqrt_ge_1_iff [simp] = real_sqrt_le_iff [where x=1, unfolded real_sqrt_one]  | 
|
448  | 
lemmas real_sqrt_le_1_iff [simp] = real_sqrt_le_iff [where y=1, unfolded real_sqrt_one]  | 
|
449  | 
lemmas real_sqrt_eq_1_iff [simp] = real_sqrt_eq_iff [where y=1, unfolded real_sqrt_one]  | 
|
| 
20687
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
450  | 
|
| 
60615
 
e5fa1d5d3952
Useful lemmas. The theorem concerning swapping the variables in a double integral.
 
paulson <lp15@cam.ac.uk> 
parents: 
60141 
diff
changeset
 | 
451  | 
lemma sqrt_add_le_add_sqrt:  | 
| 
 
e5fa1d5d3952
Useful lemmas. The theorem concerning swapping the variables in a double integral.
 
paulson <lp15@cam.ac.uk> 
parents: 
60141 
diff
changeset
 | 
452  | 
assumes "0 \<le> x" "0 \<le> y"  | 
| 
 
e5fa1d5d3952
Useful lemmas. The theorem concerning swapping the variables in a double integral.
 
paulson <lp15@cam.ac.uk> 
parents: 
60141 
diff
changeset
 | 
453  | 
shows "sqrt (x + y) \<le> sqrt x + sqrt y"  | 
| 
 
e5fa1d5d3952
Useful lemmas. The theorem concerning swapping the variables in a double integral.
 
paulson <lp15@cam.ac.uk> 
parents: 
60141 
diff
changeset
 | 
454  | 
by (rule power2_le_imp_le) (simp_all add: power2_sum assms)  | 
| 
 
e5fa1d5d3952
Useful lemmas. The theorem concerning swapping the variables in a double integral.
 
paulson <lp15@cam.ac.uk> 
parents: 
60141 
diff
changeset
 | 
455  | 
|
| 
23042
 
492514b39956
add lemmas about continuity and derivatives of roots
 
huffman 
parents: 
23009 
diff
changeset
 | 
456  | 
lemma isCont_real_sqrt: "isCont sqrt x"  | 
| 
51483
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
457  | 
unfolding sqrt_def by (rule isCont_real_root)  | 
| 
23042
 
492514b39956
add lemmas about continuity and derivatives of roots
 
huffman 
parents: 
23009 
diff
changeset
 | 
458  | 
|
| 
51478
 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 
hoelzl 
parents: 
49962 
diff
changeset
 | 
459  | 
lemma tendsto_real_sqrt[tendsto_intros]:  | 
| 
 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 
hoelzl 
parents: 
49962 
diff
changeset
 | 
460  | 
"(f ---> x) F \<Longrightarrow> ((\<lambda>x. sqrt (f x)) ---> sqrt x) F"  | 
| 
51483
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
461  | 
unfolding sqrt_def by (rule tendsto_real_root)  | 
| 
51478
 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 
hoelzl 
parents: 
49962 
diff
changeset
 | 
462  | 
|
| 
 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 
hoelzl 
parents: 
49962 
diff
changeset
 | 
463  | 
lemma continuous_real_sqrt[continuous_intros]:  | 
| 
 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 
hoelzl 
parents: 
49962 
diff
changeset
 | 
464  | 
"continuous F f \<Longrightarrow> continuous F (\<lambda>x. sqrt (f x))"  | 
| 
51483
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
465  | 
unfolding sqrt_def by (rule continuous_real_root)  | 
| 
51478
 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 
hoelzl 
parents: 
49962 
diff
changeset
 | 
466  | 
|
| 
56371
 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 
hoelzl 
parents: 
55967 
diff
changeset
 | 
467  | 
lemma continuous_on_real_sqrt[continuous_intros]:  | 
| 57155 | 468  | 
"continuous_on s f \<Longrightarrow> continuous_on s (\<lambda>x. sqrt (f x))"  | 
| 
51483
 
dc39d69774bb
modernized definition of root: use the_inv, handle positive and negative case uniformly, and 0-th root is constant 0
 
hoelzl 
parents: 
51478 
diff
changeset
 | 
469  | 
unfolding sqrt_def by (rule continuous_on_real_root)  | 
| 
51478
 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 
hoelzl 
parents: 
49962 
diff
changeset
 | 
470  | 
|
| 31880 | 471  | 
lemma DERIV_real_sqrt_generic:  | 
472  | 
assumes "x \<noteq> 0"  | 
|
473  | 
assumes "x > 0 \<Longrightarrow> D = inverse (sqrt x) / 2"  | 
|
474  | 
assumes "x < 0 \<Longrightarrow> D = - inverse (sqrt x) / 2"  | 
|
475  | 
shows "DERIV sqrt x :> D"  | 
|
476  | 
using assms unfolding sqrt_def  | 
|
477  | 
by (auto intro!: DERIV_real_root_generic)  | 
|
478  | 
||
| 
23042
 
492514b39956
add lemmas about continuity and derivatives of roots
 
huffman 
parents: 
23009 
diff
changeset
 | 
479  | 
lemma DERIV_real_sqrt:  | 
| 
 
492514b39956
add lemmas about continuity and derivatives of roots
 
huffman 
parents: 
23009 
diff
changeset
 | 
480  | 
"0 < x \<Longrightarrow> DERIV sqrt x :> inverse (sqrt x) / 2"  | 
| 31880 | 481  | 
using DERIV_real_sqrt_generic by simp  | 
482  | 
||
483  | 
declare  | 
|
| 
56381
 
0556204bc230
merged DERIV_intros, has_derivative_intros into derivative_intros
 
hoelzl 
parents: 
56371 
diff
changeset
 | 
484  | 
DERIV_real_sqrt_generic[THEN DERIV_chain2, derivative_intros]  | 
| 
 
0556204bc230
merged DERIV_intros, has_derivative_intros into derivative_intros
 
hoelzl 
parents: 
56371 
diff
changeset
 | 
485  | 
DERIV_real_root_generic[THEN DERIV_chain2, derivative_intros]  | 
| 
23042
 
492514b39956
add lemmas about continuity and derivatives of roots
 
huffman 
parents: 
23009 
diff
changeset
 | 
486  | 
|
| 
20687
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
487  | 
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
 | 
488  | 
apply auto  | 
| 
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
489  | 
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
 | 
490  | 
apply (simp add: zero_less_mult_iff)  | 
| 
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
491  | 
done  | 
| 
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
492  | 
|
| 
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
493  | 
lemma real_sqrt_abs2 [simp]: "sqrt(x*x) = \<bar>x\<bar>"  | 
| 22856 | 494  | 
apply (subst power2_eq_square [symmetric])  | 
| 
20687
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
495  | 
apply (rule real_sqrt_abs)  | 
| 
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
496  | 
done  | 
| 
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
497  | 
|
| 53076 | 498  | 
lemma real_inv_sqrt_pow2: "0 < x ==> (inverse (sqrt x))\<^sup>2 = inverse x"  | 
| 22856 | 499  | 
by (simp add: power_inverse [symmetric])  | 
| 
20687
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
500  | 
|
| 
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
501  | 
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
 | 
502  | 
by simp  | 
| 
20687
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
503  | 
|
| 
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
504  | 
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
 | 
505  | 
by simp  | 
| 
20687
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
506  | 
|
| 22443 | 507  | 
lemma sqrt_divide_self_eq:  | 
508  | 
assumes nneg: "0 \<le> x"  | 
|
509  | 
shows "sqrt x / x = inverse (sqrt x)"  | 
|
510  | 
proof cases  | 
|
511  | 
assume "x=0" thus ?thesis by simp  | 
|
512  | 
next  | 
|
513  | 
assume nz: "x\<noteq>0"  | 
|
514  | 
hence pos: "0<x" using nneg by arith  | 
|
515  | 
show ?thesis  | 
|
516  | 
proof (rule right_inverse_eq [THEN iffD1, THEN sym])  | 
|
517  | 
show "sqrt x / x \<noteq> 0" by (simp add: divide_inverse nneg nz)  | 
|
518  | 
show "inverse (sqrt x) / (sqrt x / x) = 1"  | 
|
| 
57512
 
cc97b347b301
reduced name variants for assoc and commute on plus and mult
 
haftmann 
parents: 
57275 
diff
changeset
 | 
519  | 
by (simp add: divide_inverse mult.assoc [symmetric]  | 
| 22443 | 520  | 
power2_eq_square [symmetric] real_inv_sqrt_pow2 pos nz)  | 
521  | 
qed  | 
|
522  | 
qed  | 
|
523  | 
||
| 
54413
 
88a036a95967
add finite_select_induct; move generic lemmas from MV_Analysis/Linear_Algebra to the HOL image
 
hoelzl 
parents: 
53594 
diff
changeset
 | 
524  | 
lemma real_div_sqrt: "0 \<le> x \<Longrightarrow> x / sqrt x = sqrt x"  | 
| 
 
88a036a95967
add finite_select_induct; move generic lemmas from MV_Analysis/Linear_Algebra to the HOL image
 
hoelzl 
parents: 
53594 
diff
changeset
 | 
525  | 
apply (cases "x = 0")  | 
| 
 
88a036a95967
add finite_select_induct; move generic lemmas from MV_Analysis/Linear_Algebra to the HOL image
 
hoelzl 
parents: 
53594 
diff
changeset
 | 
526  | 
apply simp_all  | 
| 
 
88a036a95967
add finite_select_induct; move generic lemmas from MV_Analysis/Linear_Algebra to the HOL image
 
hoelzl 
parents: 
53594 
diff
changeset
 | 
527  | 
using sqrt_divide_self_eq[of x]  | 
| 
 
88a036a95967
add finite_select_induct; move generic lemmas from MV_Analysis/Linear_Algebra to the HOL image
 
hoelzl 
parents: 
53594 
diff
changeset
 | 
528  | 
apply (simp add: inverse_eq_divide field_simps)  | 
| 
 
88a036a95967
add finite_select_induct; move generic lemmas from MV_Analysis/Linear_Algebra to the HOL image
 
hoelzl 
parents: 
53594 
diff
changeset
 | 
529  | 
done  | 
| 
 
88a036a95967
add finite_select_induct; move generic lemmas from MV_Analysis/Linear_Algebra to the HOL image
 
hoelzl 
parents: 
53594 
diff
changeset
 | 
530  | 
|
| 
22721
 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
22630 
diff
changeset
 | 
531  | 
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
 | 
532  | 
apply (simp add: divide_inverse)  | 
| 
 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
22630 
diff
changeset
 | 
533  | 
apply (case_tac "r=0")  | 
| 
57514
 
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
 
haftmann 
parents: 
57512 
diff
changeset
 | 
534  | 
apply (auto simp add: ac_simps)  | 
| 
22721
 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
22630 
diff
changeset
 | 
535  | 
done  | 
| 
 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
22630 
diff
changeset
 | 
536  | 
|
| 
23049
 
11607c283074
moved sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
23047 
diff
changeset
 | 
537  | 
lemma lemma_real_divide_sqrt_less: "0 < u ==> u / sqrt 2 < u"  | 
| 35216 | 538  | 
by (simp add: divide_less_eq)  | 
| 
23049
 
11607c283074
moved sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
23047 
diff
changeset
 | 
539  | 
|
| 
 
11607c283074
moved sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
23047 
diff
changeset
 | 
540  | 
lemma four_x_squared:  | 
| 
 
11607c283074
moved sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
23047 
diff
changeset
 | 
541  | 
fixes x::real  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
51483 
diff
changeset
 | 
542  | 
shows "4 * x\<^sup>2 = (2 * x)\<^sup>2"  | 
| 
23049
 
11607c283074
moved sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
23047 
diff
changeset
 | 
543  | 
by (simp add: power2_eq_square)  | 
| 
 
11607c283074
moved sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
23047 
diff
changeset
 | 
544  | 
|
| 
57275
 
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
 
hoelzl 
parents: 
57155 
diff
changeset
 | 
545  | 
lemma sqrt_at_top: "LIM x at_top. sqrt x :: real :> at_top"  | 
| 
 
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
 
hoelzl 
parents: 
57155 
diff
changeset
 | 
546  | 
by (rule filterlim_at_top_at_top[where Q="\<lambda>x. True" and P="\<lambda>x. 0 < x" and g="power2"])  | 
| 
 
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
 
hoelzl 
parents: 
57155 
diff
changeset
 | 
547  | 
(auto intro: eventually_gt_at_top)  | 
| 
 
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
 
hoelzl 
parents: 
57155 
diff
changeset
 | 
548  | 
|
| 22856 | 549  | 
subsection {* Square Root of Sum of Squares *}
 | 
550  | 
||
| 55967 | 551  | 
lemma sum_squares_bound:  | 
552  | 
fixes x:: "'a::linordered_field"  | 
|
553  | 
shows "2*x*y \<le> x^2 + y^2"  | 
|
554  | 
proof -  | 
|
555  | 
have "(x-y)^2 = x*x - 2*x*y + y*y"  | 
|
556  | 
by algebra  | 
|
557  | 
then have "0 \<le> x^2 - 2*x*y + y^2"  | 
|
558  | 
by (metis sum_power2_ge_zero zero_le_double_add_iff_zero_le_single_add power2_eq_square)  | 
|
559  | 
then show ?thesis  | 
|
560  | 
by arith  | 
|
561  | 
qed  | 
|
| 22856 | 562  | 
|
| 55967 | 563  | 
lemma arith_geo_mean:  | 
564  | 
fixes u:: "'a::linordered_field" assumes "u\<^sup>2 = x*y" "x\<ge>0" "y\<ge>0" shows "u \<le> (x + y)/2"  | 
|
565  | 
apply (rule power2_le_imp_le)  | 
|
566  | 
using sum_squares_bound assms  | 
|
567  | 
apply (auto simp: zero_le_mult_iff)  | 
|
568  | 
by (auto simp: algebra_simps power2_eq_square)  | 
|
569  | 
||
570  | 
lemma arith_geo_mean_sqrt:  | 
|
571  | 
fixes x::real assumes "x\<ge>0" "y\<ge>0" shows "sqrt(x*y) \<le> (x + y)/2"  | 
|
572  | 
apply (rule arith_geo_mean)  | 
|
573  | 
using assms  | 
|
574  | 
apply (auto simp: zero_le_mult_iff)  | 
|
575  | 
done  | 
|
| 
23049
 
11607c283074
moved sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
23047 
diff
changeset
 | 
576  | 
|
| 22856 | 577  | 
lemma real_sqrt_sum_squares_mult_ge_zero [simp]:  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
51483 
diff
changeset
 | 
578  | 
"0 \<le> sqrt ((x\<^sup>2 + y\<^sup>2)*(xa\<^sup>2 + ya\<^sup>2))"  | 
| 55967 | 579  | 
by (metis real_sqrt_ge_0_iff split_mult_pos_le sum_power2_ge_zero)  | 
| 22856 | 580  | 
|
581  | 
lemma real_sqrt_sum_squares_mult_squared_eq [simp]:  | 
|
| 53076 | 582  | 
"(sqrt ((x\<^sup>2 + y\<^sup>2) * (xa\<^sup>2 + ya\<^sup>2)))\<^sup>2 = (x\<^sup>2 + y\<^sup>2) * (xa\<^sup>2 + ya\<^sup>2)"  | 
| 44320 | 583  | 
by (simp add: zero_le_mult_iff)  | 
| 22856 | 584  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
51483 
diff
changeset
 | 
585  | 
lemma real_sqrt_sum_squares_eq_cancel: "sqrt (x\<^sup>2 + y\<^sup>2) = x \<Longrightarrow> y = 0"  | 
| 
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
51483 
diff
changeset
 | 
586  | 
by (drule_tac f = "%x. x\<^sup>2" in arg_cong, simp)  | 
| 
23049
 
11607c283074
moved sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
23047 
diff
changeset
 | 
587  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
51483 
diff
changeset
 | 
588  | 
lemma real_sqrt_sum_squares_eq_cancel2: "sqrt (x\<^sup>2 + y\<^sup>2) = y \<Longrightarrow> x = 0"  | 
| 
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
51483 
diff
changeset
 | 
589  | 
by (drule_tac f = "%x. x\<^sup>2" in arg_cong, simp)  | 
| 
23049
 
11607c283074
moved sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
23047 
diff
changeset
 | 
590  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
51483 
diff
changeset
 | 
591  | 
lemma real_sqrt_sum_squares_ge1 [simp]: "x \<le> sqrt (x\<^sup>2 + y\<^sup>2)"  | 
| 22856 | 592  | 
by (rule power2_le_imp_le, simp_all)  | 
593  | 
||
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
51483 
diff
changeset
 | 
594  | 
lemma real_sqrt_sum_squares_ge2 [simp]: "y \<le> sqrt (x\<^sup>2 + y\<^sup>2)"  | 
| 
23049
 
11607c283074
moved sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
23047 
diff
changeset
 | 
595  | 
by (rule power2_le_imp_le, simp_all)  | 
| 
 
11607c283074
moved sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
23047 
diff
changeset
 | 
596  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
51483 
diff
changeset
 | 
597  | 
lemma real_sqrt_ge_abs1 [simp]: "\<bar>x\<bar> \<le> sqrt (x\<^sup>2 + y\<^sup>2)"  | 
| 22856 | 598  | 
by (rule power2_le_imp_le, simp_all)  | 
599  | 
||
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
51483 
diff
changeset
 | 
600  | 
lemma real_sqrt_ge_abs2 [simp]: "\<bar>y\<bar> \<le> sqrt (x\<^sup>2 + y\<^sup>2)"  | 
| 
23049
 
11607c283074
moved sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
23047 
diff
changeset
 | 
601  | 
by (rule power2_le_imp_le, simp_all)  | 
| 
 
11607c283074
moved sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
23047 
diff
changeset
 | 
602  | 
|
| 
 
11607c283074
moved sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
23047 
diff
changeset
 | 
603  | 
lemma le_real_sqrt_sumsq [simp]: "x \<le> sqrt (x * x + y * y)"  | 
| 
 
11607c283074
moved sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
23047 
diff
changeset
 | 
604  | 
by (simp add: power2_eq_square [symmetric])  | 
| 
 
11607c283074
moved sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
23047 
diff
changeset
 | 
605  | 
|
| 22858 | 606  | 
lemma real_sqrt_sum_squares_triangle_ineq:  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
51483 
diff
changeset
 | 
607  | 
"sqrt ((a + c)\<^sup>2 + (b + d)\<^sup>2) \<le> sqrt (a\<^sup>2 + b\<^sup>2) + sqrt (c\<^sup>2 + d\<^sup>2)"  | 
| 22858 | 608  | 
apply (rule power2_le_imp_le, simp)  | 
609  | 
apply (simp add: power2_sum)  | 
|
| 
57512
 
cc97b347b301
reduced name variants for assoc and commute on plus and mult
 
haftmann 
parents: 
57275 
diff
changeset
 | 
610  | 
apply (simp only: mult.assoc distrib_left [symmetric])  | 
| 22858 | 611  | 
apply (rule mult_left_mono)  | 
612  | 
apply (rule power2_le_imp_le)  | 
|
613  | 
apply (simp add: power2_sum power_mult_distrib)  | 
|
| 
23477
 
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
 
nipkow 
parents: 
23475 
diff
changeset
 | 
614  | 
apply (simp add: ring_distribs)  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
51483 
diff
changeset
 | 
615  | 
apply (subgoal_tac "0 \<le> b\<^sup>2 * c\<^sup>2 + a\<^sup>2 * d\<^sup>2 - 2 * (a * c) * (b * d)", simp)  | 
| 
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
51483 
diff
changeset
 | 
616  | 
apply (rule_tac b="(a * d - b * c)\<^sup>2" in ord_le_eq_trans)  | 
| 22858 | 617  | 
apply (rule zero_le_power2)  | 
618  | 
apply (simp add: power2_diff power_mult_distrib)  | 
|
| 56536 | 619  | 
apply (simp)  | 
| 22858 | 620  | 
apply simp  | 
621  | 
apply (simp add: add_increasing)  | 
|
622  | 
done  | 
|
623  | 
||
| 23122 | 624  | 
lemma real_sqrt_sum_squares_less:  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
51483 
diff
changeset
 | 
625  | 
"\<lbrakk>\<bar>x\<bar> < u / sqrt 2; \<bar>y\<bar> < u / sqrt 2\<rbrakk> \<Longrightarrow> sqrt (x\<^sup>2 + y\<^sup>2) < u"  | 
| 23122 | 626  | 
apply (rule power2_less_imp_less, simp)  | 
627  | 
apply (drule power_strict_mono [OF _ abs_ge_zero pos2])  | 
|
628  | 
apply (drule power_strict_mono [OF _ abs_ge_zero pos2])  | 
|
629  | 
apply (simp add: power_divide)  | 
|
630  | 
apply (drule order_le_less_trans [OF abs_ge_zero])  | 
|
631  | 
apply (simp add: zero_less_divide_iff)  | 
|
632  | 
done  | 
|
633  | 
||
| 
59741
 
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
 
paulson <lp15@cam.ac.uk> 
parents: 
58889 
diff
changeset
 | 
634  | 
lemma sqrt2_less_2: "sqrt 2 < (2::real)"  | 
| 
 
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
 
paulson <lp15@cam.ac.uk> 
parents: 
58889 
diff
changeset
 | 
635  | 
by (metis not_less not_less_iff_gr_or_eq numeral_less_iff real_sqrt_four real_sqrt_le_iff semiring_norm(75) semiring_norm(78) semiring_norm(85))  | 
| 
 
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
 
paulson <lp15@cam.ac.uk> 
parents: 
58889 
diff
changeset
 | 
636  | 
|
| 
 
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
 
paulson <lp15@cam.ac.uk> 
parents: 
58889 
diff
changeset
 | 
637  | 
|
| 
23049
 
11607c283074
moved sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
23047 
diff
changeset
 | 
638  | 
text{*Needed for the infinitely close relation over the nonstandard
 | 
| 
 
11607c283074
moved sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
23047 
diff
changeset
 | 
639  | 
complex numbers*}  | 
| 
 
11607c283074
moved sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
23047 
diff
changeset
 | 
640  | 
lemma lemma_sqrt_hcomplex_capprox:  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
51483 
diff
changeset
 | 
641  | 
"[| 0 < u; x < u/2; y < u/2; 0 \<le> x; 0 \<le> y |] ==> sqrt (x\<^sup>2 + y\<^sup>2) < u"  | 
| 
59741
 
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
 
paulson <lp15@cam.ac.uk> 
parents: 
58889 
diff
changeset
 | 
642  | 
apply (rule real_sqrt_sum_squares_less)  | 
| 
 
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
 
paulson <lp15@cam.ac.uk> 
parents: 
58889 
diff
changeset
 | 
643  | 
apply (auto simp add: abs_if field_simps)  | 
| 
 
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
 
paulson <lp15@cam.ac.uk> 
parents: 
58889 
diff
changeset
 | 
644  | 
apply (rule le_less_trans [where y = "x*2"])  | 
| 
 
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
 
paulson <lp15@cam.ac.uk> 
parents: 
58889 
diff
changeset
 | 
645  | 
using less_eq_real_def sqrt2_less_2 apply force  | 
| 
 
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
 
paulson <lp15@cam.ac.uk> 
parents: 
58889 
diff
changeset
 | 
646  | 
apply assumption  | 
| 
 
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
 
paulson <lp15@cam.ac.uk> 
parents: 
58889 
diff
changeset
 | 
647  | 
apply (rule le_less_trans [where y = "y*2"])  | 
| 
 
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
 
paulson <lp15@cam.ac.uk> 
parents: 
58889 
diff
changeset
 | 
648  | 
using less_eq_real_def sqrt2_less_2 mult_le_cancel_left  | 
| 
 
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
 
paulson <lp15@cam.ac.uk> 
parents: 
58889 
diff
changeset
 | 
649  | 
apply auto  | 
| 
 
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
 
paulson <lp15@cam.ac.uk> 
parents: 
58889 
diff
changeset
 | 
650  | 
done  | 
| 
 
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
 
paulson <lp15@cam.ac.uk> 
parents: 
58889 
diff
changeset
 | 
651  | 
|
| 
60141
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
652  | 
lemma LIMSEQ_root: "(\<lambda>n. root n n) ----> 1"  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
653  | 
proof -  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
654  | 
def x \<equiv> "\<lambda>n. root n n - 1"  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
655  | 
have "x ----> sqrt 0"  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
656  | 
proof (rule tendsto_sandwich[OF _ _ tendsto_const])  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
657  | 
show "(\<lambda>x. sqrt (2 / x)) ----> sqrt 0"  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
658  | 
by (intro tendsto_intros tendsto_divide_0[OF tendsto_const] filterlim_mono[OF filterlim_real_sequentially])  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
659  | 
(simp_all add: at_infinity_eq_at_top_bot)  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
660  | 
    { fix n :: nat assume "2 < n"
 | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
661  | 
have "1 + (real (n - 1) * n) / 2 * x n^2 = 1 + of_nat (n choose 2) * x n^2"  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
662  | 
using `2 < n` unfolding gbinomial_def binomial_gbinomial  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
663  | 
by (simp add: atLeast0AtMost atMost_Suc field_simps real_of_nat_diff numeral_2_eq_2 real_eq_of_nat[symmetric])  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
664  | 
      also have "\<dots> \<le> (\<Sum>k\<in>{0, 2}. of_nat (n choose k) * x n^k)"
 | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
665  | 
by (simp add: x_def)  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
666  | 
also have "\<dots> \<le> (\<Sum>k=0..n. of_nat (n choose k) * x n^k)"  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
667  | 
using `2 < n` by (intro setsum_mono2) (auto intro!: mult_nonneg_nonneg zero_le_power simp: x_def le_diff_eq)  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
668  | 
also have "\<dots> = (x n + 1) ^ n"  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
669  | 
by (simp add: binomial_ring)  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
670  | 
also have "\<dots> = n"  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
671  | 
using `2 < n` by (simp add: x_def)  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
672  | 
finally have "real (n - 1) * (real n / 2 * (x n)\<^sup>2) \<le> real (n - 1) * 1"  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
673  | 
by simp  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
674  | 
then have "(x n)\<^sup>2 \<le> 2 / real n"  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
675  | 
using `2 < n` unfolding mult_le_cancel_left by (simp add: field_simps)  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
676  | 
from real_sqrt_le_mono[OF this] have "x n \<le> sqrt (2 / real n)"  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
677  | 
by simp }  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
678  | 
then show "eventually (\<lambda>n. x n \<le> sqrt (2 / real n)) sequentially"  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
679  | 
by (auto intro!: exI[of _ 3] simp: eventually_sequentially)  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
680  | 
show "eventually (\<lambda>n. sqrt 0 \<le> x n) sequentially"  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
681  | 
by (auto intro!: exI[of _ 1] simp: eventually_sequentially le_diff_eq x_def)  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
682  | 
qed  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
683  | 
from tendsto_add[OF this tendsto_const[of 1]] show ?thesis  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
684  | 
by (simp add: x_def)  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
685  | 
qed  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
686  | 
|
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
687  | 
lemma LIMSEQ_root_const:  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
688  | 
assumes "0 < c"  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
689  | 
shows "(\<lambda>n. root n c) ----> 1"  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
690  | 
proof -  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
691  | 
  { fix c :: real assume "1 \<le> c"
 | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
692  | 
def x \<equiv> "\<lambda>n. root n c - 1"  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
693  | 
have "x ----> 0"  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
694  | 
proof (rule tendsto_sandwich[OF _ _ tendsto_const])  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
695  | 
show "(\<lambda>n. c / n) ----> 0"  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
696  | 
by (intro tendsto_divide_0[OF tendsto_const] filterlim_mono[OF filterlim_real_sequentially])  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
697  | 
(simp_all add: at_infinity_eq_at_top_bot)  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
698  | 
      { fix n :: nat assume "1 < n"
 | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
699  | 
have "1 + x n * n = 1 + of_nat (n choose 1) * x n^1"  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
700  | 
using `1 < n` unfolding gbinomial_def binomial_gbinomial by (simp add: real_eq_of_nat[symmetric])  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
701  | 
        also have "\<dots> \<le> (\<Sum>k\<in>{0, 1}. of_nat (n choose k) * x n^k)"
 | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
702  | 
by (simp add: x_def)  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
703  | 
also have "\<dots> \<le> (\<Sum>k=0..n. of_nat (n choose k) * x n^k)"  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
704  | 
using `1 < n` `1 \<le> c` by (intro setsum_mono2) (auto intro!: mult_nonneg_nonneg zero_le_power simp: x_def le_diff_eq)  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
705  | 
also have "\<dots> = (x n + 1) ^ n"  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
706  | 
by (simp add: binomial_ring)  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
707  | 
also have "\<dots> = c"  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
708  | 
using `1 < n` `1 \<le> c` by (simp add: x_def)  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
709  | 
finally have "x n \<le> c / n"  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
710  | 
using `1 \<le> c` `1 < n` by (simp add: field_simps) }  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
711  | 
then show "eventually (\<lambda>n. x n \<le> c / n) sequentially"  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
712  | 
by (auto intro!: exI[of _ 3] simp: eventually_sequentially)  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
713  | 
show "eventually (\<lambda>n. 0 \<le> x n) sequentially"  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
714  | 
using `1 \<le> c` by (auto intro!: exI[of _ 1] simp: eventually_sequentially le_diff_eq x_def)  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
715  | 
qed  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
716  | 
from tendsto_add[OF this tendsto_const[of 1]] have "(\<lambda>n. root n c) ----> 1"  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
717  | 
by (simp add: x_def) }  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
718  | 
note ge_1 = this  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
719  | 
|
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
720  | 
show ?thesis  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
721  | 
proof cases  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
722  | 
assume "1 \<le> c" with ge_1 show ?thesis by blast  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
723  | 
next  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
724  | 
assume "\<not> 1 \<le> c"  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
725  | 
with `0 < c` have "1 \<le> 1 / c"  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
726  | 
by simp  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
727  | 
then have "(\<lambda>n. 1 / root n (1 / c)) ----> 1 / 1"  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
728  | 
by (intro tendsto_divide tendsto_const ge_1 `1 \<le> 1 / c` one_neq_zero)  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
729  | 
then show ?thesis  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
730  | 
by (rule filterlim_cong[THEN iffD1, rotated 3])  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
731  | 
(auto intro!: exI[of _ 1] simp: eventually_sequentially real_root_divide)  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
732  | 
qed  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
733  | 
qed  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
734  | 
|
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
735  | 
|
| 
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
 | 
736  | 
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
 | 
737  | 
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
 | 
738  | 
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
 | 
739  | 
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
 | 
740  | 
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
 | 
741  | 
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
 | 
742  | 
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
 | 
743  | 
|
| 
 
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
 | 
744  | 
(* 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
 | 
745  | 
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
 | 
746  | 
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
 | 
747  | 
|
| 14324 | 748  | 
end  |