| author | wenzelm | 
| Sat, 07 Aug 2021 22:23:37 +0200 | |
| changeset 74142 | 0f051404f487 | 
| parent 70722 | ae2528273eeb | 
| child 78127 | 24b70433c2e8 | 
| permissions | -rw-r--r-- | 
| 63467 | 1  | 
(* Title: HOL/NthRoot.thy  | 
2  | 
Author: Jacques D. Fleuriot, 1998  | 
|
3  | 
Author: Lawrence C Paulson, 2004  | 
|
| 12196 | 4  | 
*)  | 
5  | 
||
| 60758 | 6  | 
section \<open>Nth Roots of Real Numbers\<close>  | 
| 14324 | 7  | 
|
| 15131 | 8  | 
theory NthRoot  | 
| 
65552
 
f533820e7248
theories "GCD" and "Binomial" are already included in "Main": this avoids improper imports in applications;
 
wenzelm 
parents: 
64267 
diff
changeset
 | 
9  | 
imports Deriv  | 
| 15131 | 10  | 
begin  | 
| 14324 | 11  | 
|
| 63467 | 12  | 
|
| 60758 | 13  | 
subsection \<open>Existence of Nth Root\<close>  | 
| 
20687
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
14  | 
|
| 60758 | 15  | 
text \<open>Existence follows from the Intermediate Value Theorem\<close>  | 
| 14324 | 16  | 
|
| 
23009
 
01c295dd4a36
Prove existence of nth roots using Intermediate Value Theorem
 
huffman 
parents: 
22968 
diff
changeset
 | 
17  | 
lemma realpow_pos_nth:  | 
| 63467 | 18  | 
fixes a :: real  | 
| 
23009
 
01c295dd4a36
Prove existence of nth roots using Intermediate Value Theorem
 
huffman 
parents: 
22968 
diff
changeset
 | 
19  | 
assumes n: "0 < n"  | 
| 63467 | 20  | 
and a: "0 < a"  | 
21  | 
shows "\<exists>r>0. r ^ n = a"  | 
|
| 
23009
 
01c295dd4a36
Prove existence of nth roots using Intermediate Value Theorem
 
huffman 
parents: 
22968 
diff
changeset
 | 
22  | 
proof -  | 
| 
 
01c295dd4a36
Prove existence of nth roots using Intermediate Value Theorem
 
huffman 
parents: 
22968 
diff
changeset
 | 
23  | 
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
 | 
24  | 
proof (rule IVT)  | 
| 63467 | 25  | 
show "0 ^ n \<le> a"  | 
26  | 
using n a by (simp add: power_0_left)  | 
|
27  | 
show "0 \<le> max 1 a"  | 
|
28  | 
by simp  | 
|
29  | 
from n have n1: "1 \<le> n"  | 
|
30  | 
by simp  | 
|
31  | 
have "a \<le> max 1 a ^ 1"  | 
|
32  | 
by simp  | 
|
| 
23009
 
01c295dd4a36
Prove existence of nth roots using Intermediate Value Theorem
 
huffman 
parents: 
22968 
diff
changeset
 | 
33  | 
also have "max 1 a ^ 1 \<le> max 1 a ^ n"  | 
| 63467 | 34  | 
using n1 by (rule power_increasing) simp  | 
| 
23009
 
01c295dd4a36
Prove existence of nth roots using Intermediate Value Theorem
 
huffman 
parents: 
22968 
diff
changeset
 | 
35  | 
finally show "a \<le> max 1 a ^ n" .  | 
| 
 
01c295dd4a36
Prove existence of nth roots using Intermediate Value Theorem
 
huffman 
parents: 
22968 
diff
changeset
 | 
36  | 
show "\<forall>r. 0 \<le> r \<and> r \<le> max 1 a \<longrightarrow> isCont (\<lambda>x. x ^ n) r"  | 
| 44289 | 37  | 
by simp  | 
| 
23009
 
01c295dd4a36
Prove existence of nth roots using Intermediate Value Theorem
 
huffman 
parents: 
22968 
diff
changeset
 | 
38  | 
qed  | 
| 63467 | 39  | 
then obtain r where r: "0 \<le> r \<and> r ^ n = a"  | 
40  | 
by fast  | 
|
41  | 
with n a have "r \<noteq> 0"  | 
|
42  | 
by (auto simp add: power_0_left)  | 
|
43  | 
with r have "0 < r \<and> r ^ n = a"  | 
|
44  | 
by simp  | 
|
45  | 
then show ?thesis ..  | 
|
| 
23009
 
01c295dd4a36
Prove existence of nth roots using Intermediate Value Theorem
 
huffman 
parents: 
22968 
diff
changeset
 | 
46  | 
qed  | 
| 14325 | 47  | 
|
| 23047 | 48  | 
(* Used by Integration/RealRandVar.thy in AFP *)  | 
49  | 
lemma realpow_pos_nth2: "(0::real) < a \<Longrightarrow> \<exists>r>0. r ^ Suc n = a"  | 
|
| 63467 | 50  | 
by (blast intro: realpow_pos_nth)  | 
| 23047 | 51  | 
|
| 63467 | 52  | 
text \<open>Uniqueness of nth positive root.\<close>  | 
53  | 
lemma realpow_pos_nth_unique: "0 < n \<Longrightarrow> 0 < a \<Longrightarrow> \<exists>!r. 0 < r \<and> r ^ n = a" for a :: real  | 
|
54  | 
by (auto intro!: realpow_pos_nth simp: power_eq_iff_eq_base)  | 
|
| 14324 | 55  | 
|
56  | 
||
| 60758 | 57  | 
subsection \<open>Nth Root\<close>  | 
| 
20687
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
58  | 
|
| 63467 | 59  | 
text \<open>  | 
60  | 
We define roots of negative reals such that \<open>root n (- x) = - root n x\<close>.  | 
|
61  | 
This allows us to omit side conditions from many theorems.  | 
|
62  | 
\<close>  | 
|
| 
20687
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
63  | 
|
| 63467 | 64  | 
lemma inj_sgn_power:  | 
65  | 
assumes "0 < n"  | 
|
66  | 
shows "inj (\<lambda>y. sgn y * \<bar>y\<bar>^n :: real)"  | 
|
67  | 
(is "inj ?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
 | 
68  | 
proof (rule injI)  | 
| 63467 | 69  | 
have x: "(0 < a \<and> b < 0) \<or> (a < 0 \<and> 0 < b) \<Longrightarrow> a \<noteq> b" for a b :: real  | 
70  | 
by auto  | 
|
71  | 
fix x y  | 
|
72  | 
assume "?f x = ?f y"  | 
|
73  | 
with power_eq_iff_eq_base[of n "\<bar>x\<bar>" "\<bar>y\<bar>"] \<open>0 < n\<close> show "x = 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
 | 
74  | 
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
 | 
75  | 
(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
 | 
76  | 
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
 | 
77  | 
|
| 63467 | 78  | 
lemma sgn_power_injE:  | 
79  | 
"sgn a * \<bar>a\<bar> ^ n = x \<Longrightarrow> x = sgn b * \<bar>b\<bar> ^ n \<Longrightarrow> 0 < n \<Longrightarrow> a = b"  | 
|
80  | 
for a b :: real  | 
|
| 
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
 | 
81  | 
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
 | 
82  | 
|
| 63467 | 83  | 
definition root :: "nat \<Rightarrow> real \<Rightarrow> real"  | 
84  | 
where "root n x = (if n = 0 then 0 else the_inv (\<lambda>y. sgn y * \<bar>y\<bar>^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
 | 
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 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
 | 
87  | 
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
 | 
88  | 
|
| 
 
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  | 
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
 | 
90  | 
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
 | 
91  | 
|
| 
 
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  | 
lemma sgn_power_root:  | 
| 63467 | 93  | 
assumes "0 < n"  | 
94  | 
shows "sgn (root n x) * \<bar>(root n x)\<bar>^n = x"  | 
|
95  | 
(is "?f (root n x) = x")  | 
|
96  | 
proof (cases "x = 0")  | 
|
97  | 
case True  | 
|
98  | 
with assms root_sgn_power[of n 0] show ?thesis  | 
|
99  | 
by simp  | 
|
100  | 
next  | 
|
101  | 
case False  | 
|
102  | 
with realpow_pos_nth[OF \<open>0 < n\<close>, of "\<bar>x\<bar>"]  | 
|
103  | 
obtain r where "0 < r" "r ^ n = \<bar>x\<bar>"  | 
|
104  | 
by auto  | 
|
| 60758 | 105  | 
with \<open>x \<noteq> 0\<close> have S: "x \<in> range ?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
 | 
106  | 
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
 | 
107  | 
(auto simp: abs_mult sgn_mult power_mult_distrib abs_sgn_eq mult_sgn_abs)  | 
| 60758 | 108  | 
from \<open>0 < n\<close> f_the_inv_into_f[OF inj_sgn_power[OF \<open>0 < n\<close>] this] show ?thesis  | 
| 
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
 | 
109  | 
by (simp add: root_def)  | 
| 63467 | 110  | 
qed  | 
| 
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
 | 
111  | 
|
| 
 
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  | 
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))"  | 
| 63558 | 113  | 
proof (cases "n = 0")  | 
114  | 
case True  | 
|
115  | 
then show ?thesis by simp  | 
|
116  | 
next  | 
|
117  | 
case False  | 
|
118  | 
then show ?thesis  | 
|
119  | 
by simp (metis root_sgn_power sgn_power_root)  | 
|
120  | 
qed  | 
|
| 
20687
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
121  | 
|
| 
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
 | 
122  | 
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
 | 
123  | 
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
 | 
124  | 
|
| 
 
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
 | 
125  | 
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
 | 
126  | 
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
 | 
127  | 
|
| 63467 | 128  | 
lemma real_root_less_mono: "0 < n \<Longrightarrow> x < y \<Longrightarrow> root n x < 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
 | 
129  | 
proof (clarsimp split: split_root)  | 
| 63467 | 130  | 
have *: "0 < b \<Longrightarrow> a < 0 \<Longrightarrow> \<not> a > b" for a b :: real  | 
131  | 
by auto  | 
|
132  | 
fix a b :: real  | 
|
133  | 
assume "0 < n" "sgn a * \<bar>a\<bar> ^ n < sgn b * \<bar>b\<bar> ^ n"  | 
|
134  | 
then show "a < b"  | 
|
135  | 
using power_less_imp_less_base[of a n b]  | 
|
136  | 
power_less_imp_less_base[of "- b" n "- a"]  | 
|
137  | 
by (simp add: sgn_real_def * [of "a ^ n" "- ((- b) ^ n)"]  | 
|
138  | 
split: if_split_asm)  | 
|
| 
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  | 
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
 | 
140  | 
|
| 63467 | 141  | 
lemma real_root_gt_zero: "0 < n \<Longrightarrow> 0 < x \<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
 | 
142  | 
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
 | 
143  | 
|
| 
 
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_ge_zero: "0 \<le> x \<Longrightarrow> 0 \<le> root n x"  | 
| 63467 | 145  | 
using real_root_gt_zero[of n x]  | 
146  | 
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
 | 
147  | 
|
| 63467 | 148  | 
lemma real_root_pow_pos: "0 < n \<Longrightarrow> 0 < x \<Longrightarrow> root n x ^ n = x" (* TODO: rename *)  | 
| 
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
 | 
149  | 
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
 | 
150  | 
|
| 63467 | 151  | 
lemma real_root_pow_pos2 [simp]: "0 < n \<Longrightarrow> 0 \<le> x \<Longrightarrow> root n x ^ n = x" (* TODO: rename *)  | 
152  | 
by (auto simp add: order_le_less real_root_pow_pos)  | 
|
| 
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
 | 
153  | 
|
| 
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
 | 
154  | 
lemma sgn_root: "0 < n \<Longrightarrow> sgn (root n x) = sgn x"  | 
| 60867 | 155  | 
by (auto split: split_root simp: sgn_real_def)  | 
| 
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
 | 
156  | 
|
| 23046 | 157  | 
lemma odd_real_root_pow: "odd n \<Longrightarrow> root n x ^ n = x"  | 
| 63467 | 158  | 
using sgn_power_root[of n x]  | 
159  | 
by (simp add: odd_pos sgn_real_def split: if_split_asm)  | 
|
| 
20687
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
160  | 
|
| 63467 | 161  | 
lemma real_root_power_cancel: "0 < n \<Longrightarrow> 0 \<le> x \<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
 | 
162  | 
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
 | 
163  | 
|
| 23046 | 164  | 
lemma odd_real_root_power_cancel: "odd n \<Longrightarrow> root n (x ^ n) = x"  | 
| 63467 | 165  | 
using root_sgn_power[of n x]  | 
166  | 
by (simp add: odd_pos sgn_real_def power_0_left split: if_split_asm)  | 
|
| 23046 | 167  | 
|
| 63467 | 168  | 
lemma real_root_pos_unique: "0 < n \<Longrightarrow> 0 \<le> y \<Longrightarrow> y ^ n = x \<Longrightarrow> root n x = 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
 | 
169  | 
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
 | 
170  | 
|
| 63467 | 171  | 
lemma odd_real_root_unique: "odd n \<Longrightarrow> y ^ n = x \<Longrightarrow> root n x = y"  | 
172  | 
by (erule subst, rule odd_real_root_power_cancel)  | 
|
| 23046 | 173  | 
|
| 
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  | 
lemma real_root_one [simp]: "0 < n \<Longrightarrow> root n 1 = 1"  | 
| 63467 | 175  | 
by (simp add: real_root_pos_unique)  | 
| 
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
 | 
176  | 
|
| 63467 | 177  | 
text \<open>Root function is strictly monotonic, hence injective.\<close>  | 
| 
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
 | 
178  | 
|
| 63467 | 179  | 
lemma real_root_le_mono: "0 < n \<Longrightarrow> x \<le> y \<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
 | 
180  | 
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
 | 
181  | 
|
| 63467 | 182  | 
lemma real_root_less_iff [simp]: "0 < n \<Longrightarrow> root n x < root n y \<longleftrightarrow> x < y"  | 
| 63558 | 183  | 
by (cases "x < y") (simp_all add: real_root_less_mono 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
 | 
184  | 
|
| 63467 | 185  | 
lemma real_root_le_iff [simp]: "0 < n \<Longrightarrow> root n x \<le> root n y \<longleftrightarrow> x \<le> y"  | 
| 63558 | 186  | 
by (cases "x \<le> y") (simp_all add: real_root_le_mono 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
 | 
187  | 
|
| 63467 | 188  | 
lemma real_root_eq_iff [simp]: "0 < n \<Longrightarrow> root n x = root n y \<longleftrightarrow> x = y"  | 
189  | 
by (simp add: order_eq_iff)  | 
|
| 
22956
 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
 
huffman 
parents: 
22943 
diff
changeset
 | 
190  | 
|
| 
 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
 
huffman 
parents: 
22943 
diff
changeset
 | 
191  | 
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
 | 
192  | 
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
 | 
193  | 
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
 | 
194  | 
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
 | 
195  | 
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
 | 
196  | 
|
| 63467 | 197  | 
lemma real_root_gt_1_iff [simp]: "0 < n \<Longrightarrow> 1 < root n y \<longleftrightarrow> 1 < y"  | 
198  | 
using real_root_less_iff [where x=1] by simp  | 
|
| 23257 | 199  | 
|
| 63467 | 200  | 
lemma real_root_lt_1_iff [simp]: "0 < n \<Longrightarrow> root n x < 1 \<longleftrightarrow> x < 1"  | 
201  | 
using real_root_less_iff [where y=1] by simp  | 
|
202  | 
||
203  | 
lemma real_root_ge_1_iff [simp]: "0 < n \<Longrightarrow> 1 \<le> root n y \<longleftrightarrow> 1 \<le> y"  | 
|
204  | 
using real_root_le_iff [where x=1] by simp  | 
|
| 23257 | 205  | 
|
| 63467 | 206  | 
lemma real_root_le_1_iff [simp]: "0 < n \<Longrightarrow> root n x \<le> 1 \<longleftrightarrow> x \<le> 1"  | 
207  | 
using real_root_le_iff [where y=1] by simp  | 
|
| 23257 | 208  | 
|
| 63467 | 209  | 
lemma real_root_eq_1_iff [simp]: "0 < n \<Longrightarrow> root n x = 1 \<longleftrightarrow> x = 1"  | 
210  | 
using real_root_eq_iff [where y=1] by simp  | 
|
| 23257 | 211  | 
|
212  | 
||
| 63467 | 213  | 
text \<open>Roots of multiplication and division.\<close>  | 
| 
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
 | 
214  | 
|
| 
 
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
 | 
215  | 
lemma real_root_mult: "root n (x * y) = root n x * root n y"  | 
| 63467 | 216  | 
by (auto split: split_root elim!: sgn_power_injE  | 
217  | 
simp: sgn_mult abs_mult power_mult_distrib)  | 
|
| 
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
 | 
218  | 
|
| 
 
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
 | 
219  | 
lemma real_root_inverse: "root n (inverse x) = inverse (root n x)"  | 
| 63467 | 220  | 
by (auto split: split_root elim!: sgn_power_injE  | 
| 66815 | 221  | 
simp: power_inverse)  | 
| 
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
 | 
222  | 
|
| 
 
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
 | 
223  | 
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
 | 
224  | 
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
 | 
225  | 
|
| 
 
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
 | 
226  | 
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
 | 
227  | 
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
 | 
228  | 
|
| 
70365
 
4df0628e8545
a few new lemmas and a bit of tidying
 
paulson <lp15@cam.ac.uk> 
parents: 
68611 
diff
changeset
 | 
229  | 
lemma root_abs_power: "n > 0 \<Longrightarrow> abs (root n (y ^n)) = abs y"  | 
| 
 
4df0628e8545
a few new lemmas and a bit of tidying
 
paulson <lp15@cam.ac.uk> 
parents: 
68611 
diff
changeset
 | 
230  | 
using root_sgn_power [of n]  | 
| 
 
4df0628e8545
a few new lemmas and a bit of tidying
 
paulson <lp15@cam.ac.uk> 
parents: 
68611 
diff
changeset
 | 
231  | 
by (metis abs_ge_zero power_abs real_root_abs real_root_power_cancel)  | 
| 
 
4df0628e8545
a few new lemmas and a bit of tidying
 
paulson <lp15@cam.ac.uk> 
parents: 
68611 
diff
changeset
 | 
232  | 
|
| 
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
 | 
233  | 
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
 | 
234  | 
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
 | 
235  | 
|
| 63467 | 236  | 
|
237  | 
text \<open>Roots of roots.\<close>  | 
|
| 23257 | 238  | 
|
239  | 
lemma real_root_Suc_0 [simp]: "root (Suc 0) x = x"  | 
|
| 63467 | 240  | 
by (simp add: odd_real_root_unique)  | 
| 23257 | 241  | 
|
| 
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
 | 
242  | 
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
 | 
243  | 
by (auto split: split_root elim!: sgn_power_injE  | 
| 63467 | 244  | 
simp: sgn_zero_iff sgn_mult power_mult[symmetric]  | 
245  | 
abs_mult power_mult_distrib abs_sgn_eq)  | 
|
| 23257 | 246  | 
|
| 
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
 | 
247  | 
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
 | 
248  | 
by (simp add: real_root_mult_exp [symmetric] mult.commute)  | 
| 23257 | 249  | 
|
| 63467 | 250  | 
|
251  | 
text \<open>Monotonicity in first argument.\<close>  | 
|
| 23257 | 252  | 
|
| 63558 | 253  | 
lemma real_root_strict_decreasing:  | 
254  | 
assumes "0 < n" "n < N" "1 < x"  | 
|
255  | 
shows "root N x < root n x"  | 
|
256  | 
proof -  | 
|
257  | 
from assms have "root n (root N x) ^ n < root N (root n x) ^ N"  | 
|
258  | 
by (simp add: real_root_commute power_strict_increasing del: real_root_pow_pos2)  | 
|
259  | 
with assms show ?thesis by simp  | 
|
260  | 
qed  | 
|
| 23257 | 261  | 
|
| 63558 | 262  | 
lemma real_root_strict_increasing:  | 
263  | 
assumes "0 < n" "n < N" "0 < x" "x < 1"  | 
|
264  | 
shows "root n x < root N x"  | 
|
265  | 
proof -  | 
|
266  | 
from assms have "root N (root n x) ^ N < root n (root N x) ^ n"  | 
|
267  | 
by (simp add: real_root_commute power_strict_decreasing del: real_root_pow_pos2)  | 
|
268  | 
with assms show ?thesis by simp  | 
|
269  | 
qed  | 
|
| 23257 | 270  | 
|
| 
70722
 
ae2528273eeb
A couple of new theorems, stolen from AFP entries
 
paulson <lp15@cam.ac.uk> 
parents: 
70378 
diff
changeset
 | 
271  | 
lemma real_root_decreasing: "0 < n \<Longrightarrow> n \<le> N \<Longrightarrow> 1 \<le> x \<Longrightarrow> root N x \<le> root n x"  | 
| 63467 | 272  | 
by (auto simp add: order_le_less real_root_strict_decreasing)  | 
| 23257 | 273  | 
|
| 
70722
 
ae2528273eeb
A couple of new theorems, stolen from AFP entries
 
paulson <lp15@cam.ac.uk> 
parents: 
70378 
diff
changeset
 | 
274  | 
lemma real_root_increasing: "0 < n \<Longrightarrow> n \<le> N \<Longrightarrow> 0 \<le> x \<Longrightarrow> x \<le> 1 \<Longrightarrow> root n x \<le> root N x"  | 
| 63467 | 275  | 
by (auto simp add: order_le_less real_root_strict_increasing)  | 
| 23257 | 276  | 
|
| 63467 | 277  | 
|
278  | 
text \<open>Continuity and derivatives.\<close>  | 
|
| 
23042
 
492514b39956
add lemmas about continuity and derivatives of roots
 
huffman 
parents: 
23009 
diff
changeset
 | 
279  | 
|
| 
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
 | 
280  | 
lemma isCont_real_root: "isCont (root n) x"  | 
| 63467 | 281  | 
proof (cases "n > 0")  | 
282  | 
case True  | 
|
| 
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
 | 
283  | 
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
 | 
284  | 
  have "continuous_on ({0..} \<union> {.. 0}) (\<lambda>x. if 0 < x then x ^ n else - ((-x) ^ n) :: real)"
 | 
| 63467 | 285  | 
using True 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
 | 
286  | 
then have "continuous_on UNIV ?f"  | 
| 63467 | 287  | 
by (rule continuous_on_cong[THEN iffD1, rotated 2]) (auto simp: not_less le_less True)  | 
288  | 
then have [simp]: "isCont ?f x" for 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
 | 
289  | 
by (simp add: continuous_on_eq_continuous_at)  | 
| 
 
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
 | 
290  | 
have "isCont (root n) (?f (root n x))"  | 
| 63467 | 291  | 
by (rule isCont_inverse_function [where f="?f" and d=1]) (auto simp: root_sgn_power True)  | 
| 
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
 | 
292  | 
then show ?thesis  | 
| 63467 | 293  | 
by (simp add: sgn_power_root True)  | 
294  | 
next  | 
|
295  | 
case False  | 
|
296  | 
then show ?thesis  | 
|
297  | 
by (simp add: root_def[abs_def])  | 
|
298  | 
qed  | 
|
| 
23042
 
492514b39956
add lemmas about continuity and derivatives of roots
 
huffman 
parents: 
23009 
diff
changeset
 | 
299  | 
|
| 63467 | 300  | 
lemma tendsto_real_root [tendsto_intros]:  | 
| 61973 | 301  | 
"(f \<longlongrightarrow> x) F \<Longrightarrow> ((\<lambda>x. root n (f x)) \<longlongrightarrow> root n 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
 | 
302  | 
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
 | 
303  | 
|
| 63467 | 304  | 
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
 | 
305  | 
"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
 | 
306  | 
unfolding continuous_def by (rule tendsto_real_root)  | 
| 
61609
 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 
paulson <lp15@cam.ac.uk> 
parents: 
60867 
diff
changeset
 | 
307  | 
|
| 63467 | 308  | 
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
 | 
309  | 
"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
 | 
310  | 
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
 | 
311  | 
|
| 
23042
 
492514b39956
add lemmas about continuity and derivatives of roots
 
huffman 
parents: 
23009 
diff
changeset
 | 
312  | 
lemma DERIV_real_root:  | 
| 
 
492514b39956
add lemmas about continuity and derivatives of roots
 
huffman 
parents: 
23009 
diff
changeset
 | 
313  | 
assumes n: "0 < n"  | 
| 63467 | 314  | 
and x: "0 < x"  | 
| 
23042
 
492514b39956
add lemmas about continuity and derivatives of roots
 
huffman 
parents: 
23009 
diff
changeset
 | 
315  | 
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
 | 
316  | 
proof (rule DERIV_inverse_function)  | 
| 63467 | 317  | 
show "0 < x"  | 
318  | 
using x .  | 
|
319  | 
show "x < x + 1"  | 
|
320  | 
by simp  | 
|
| 
23042
 
492514b39956
add lemmas about continuity and derivatives of roots
 
huffman 
parents: 
23009 
diff
changeset
 | 
321  | 
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
 | 
322  | 
by (rule DERIV_pow)  | 
| 
 
492514b39956
add lemmas about continuity and derivatives of roots
 
huffman 
parents: 
23009 
diff
changeset
 | 
323  | 
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
 | 
324  | 
using n x by simp  | 
| 63467 | 325  | 
show "isCont (root n) x"  | 
326  | 
by (rule isCont_real_root)  | 
|
| 68611 | 327  | 
qed (use n in auto)  | 
| 
23042
 
492514b39956
add lemmas about continuity and derivatives of roots
 
huffman 
parents: 
23009 
diff
changeset
 | 
328  | 
|
| 23046 | 329  | 
lemma DERIV_odd_real_root:  | 
330  | 
assumes n: "odd n"  | 
|
| 63467 | 331  | 
and x: "x \<noteq> 0"  | 
| 23046 | 332  | 
shows "DERIV (root n) x :> inverse (real n * root n x ^ (n - Suc 0))"  | 
333  | 
proof (rule DERIV_inverse_function)  | 
|
| 68611 | 334  | 
show "x - 1 < x" "x < x + 1"  | 
335  | 
by auto  | 
|
| 23046 | 336  | 
show "DERIV (\<lambda>x. x ^ n) (root n x) :> real n * root n x ^ (n - Suc 0)"  | 
337  | 
by (rule DERIV_pow)  | 
|
338  | 
show "real n * root n x ^ (n - Suc 0) \<noteq> 0"  | 
|
339  | 
using odd_pos [OF n] x by simp  | 
|
| 63467 | 340  | 
show "isCont (root n) x"  | 
341  | 
by (rule isCont_real_root)  | 
|
| 68611 | 342  | 
qed (use n odd_real_root_pow in auto)  | 
| 23046 | 343  | 
|
| 31880 | 344  | 
lemma DERIV_even_real_root:  | 
| 63467 | 345  | 
assumes n: "0 < n"  | 
346  | 
and "even n"  | 
|
347  | 
and x: "x < 0"  | 
|
| 31880 | 348  | 
shows "DERIV (root n) x :> inverse (- real n * root n x ^ (n - Suc 0))"  | 
349  | 
proof (rule DERIV_inverse_function)  | 
|
| 63467 | 350  | 
show "x - 1 < x"  | 
351  | 
by simp  | 
|
352  | 
show "x < 0"  | 
|
353  | 
using x .  | 
|
| 68611 | 354  | 
show "- (root n y ^ n) = y" if "x - 1 < y" and "y < 0" for y  | 
355  | 
proof -  | 
|
356  | 
have "root n (-y) ^ n = -y"  | 
|
357  | 
using that \<open>0 < n\<close> by simp  | 
|
| 60758 | 358  | 
with real_root_minus and \<open>even n\<close>  | 
| 31880 | 359  | 
show "- (root n y ^ n) = y" by simp  | 
360  | 
qed  | 
|
361  | 
show "DERIV (\<lambda>x. - (x ^ n)) (root n x) :> - real n * root n x ^ (n - Suc 0)"  | 
|
| 
61609
 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 
paulson <lp15@cam.ac.uk> 
parents: 
60867 
diff
changeset
 | 
362  | 
by (auto intro!: derivative_eq_intros)  | 
| 31880 | 363  | 
show "- real n * root n x ^ (n - Suc 0) \<noteq> 0"  | 
364  | 
using n x by simp  | 
|
| 63467 | 365  | 
show "isCont (root n) x"  | 
366  | 
by (rule isCont_real_root)  | 
|
367  | 
qed  | 
|
| 31880 | 368  | 
|
369  | 
lemma DERIV_real_root_generic:  | 
|
| 63558 | 370  | 
assumes "0 < n"  | 
371  | 
and "x \<noteq> 0"  | 
|
372  | 
and "even n \<Longrightarrow> 0 < x \<Longrightarrow> D = inverse (real n * root n x ^ (n - Suc 0))"  | 
|
373  | 
and "even n \<Longrightarrow> x < 0 \<Longrightarrow> D = - inverse (real n * root n x ^ (n - Suc 0))"  | 
|
| 49753 | 374  | 
and "odd n \<Longrightarrow> D = inverse (real n * root n x ^ (n - Suc 0))"  | 
| 31880 | 375  | 
shows "DERIV (root n) x :> D"  | 
| 63467 | 376  | 
using assms  | 
| 63558 | 377  | 
by (cases "even n", cases "0 < x")  | 
378  | 
(auto intro: DERIV_real_root[THEN DERIV_cong]  | 
|
379  | 
DERIV_odd_real_root[THEN DERIV_cong]  | 
|
380  | 
DERIV_even_real_root[THEN DERIV_cong])  | 
|
| 31880 | 381  | 
|
| 
70378
 
ebd108578ab1
more new material about analysis
 
paulson <lp15@cam.ac.uk> 
parents: 
70365 
diff
changeset
 | 
382  | 
lemma power_tendsto_0_iff [simp]:  | 
| 
 
ebd108578ab1
more new material about analysis
 
paulson <lp15@cam.ac.uk> 
parents: 
70365 
diff
changeset
 | 
383  | 
fixes f :: "'a \<Rightarrow> real"  | 
| 
 
ebd108578ab1
more new material about analysis
 
paulson <lp15@cam.ac.uk> 
parents: 
70365 
diff
changeset
 | 
384  | 
assumes "n > 0"  | 
| 
 
ebd108578ab1
more new material about analysis
 
paulson <lp15@cam.ac.uk> 
parents: 
70365 
diff
changeset
 | 
385  | 
shows "((\<lambda>x. f x ^ n) \<longlongrightarrow> 0) F \<longleftrightarrow> (f \<longlongrightarrow> 0) F"  | 
| 
 
ebd108578ab1
more new material about analysis
 
paulson <lp15@cam.ac.uk> 
parents: 
70365 
diff
changeset
 | 
386  | 
proof -  | 
| 
 
ebd108578ab1
more new material about analysis
 
paulson <lp15@cam.ac.uk> 
parents: 
70365 
diff
changeset
 | 
387  | 
have "((\<lambda>x. \<bar>root n (f x ^ n)\<bar>) \<longlongrightarrow> 0) F \<Longrightarrow> (f \<longlongrightarrow> 0) F"  | 
| 
 
ebd108578ab1
more new material about analysis
 
paulson <lp15@cam.ac.uk> 
parents: 
70365 
diff
changeset
 | 
388  | 
by (auto simp: assms root_abs_power tendsto_rabs_zero_iff)  | 
| 
 
ebd108578ab1
more new material about analysis
 
paulson <lp15@cam.ac.uk> 
parents: 
70365 
diff
changeset
 | 
389  | 
then have "((\<lambda>x. f x ^ n) \<longlongrightarrow> 0) F \<Longrightarrow> (f \<longlongrightarrow> 0) F"  | 
| 
 
ebd108578ab1
more new material about analysis
 
paulson <lp15@cam.ac.uk> 
parents: 
70365 
diff
changeset
 | 
390  | 
by (metis tendsto_real_root abs_0 real_root_zero tendsto_rabs)  | 
| 
 
ebd108578ab1
more new material about analysis
 
paulson <lp15@cam.ac.uk> 
parents: 
70365 
diff
changeset
 | 
391  | 
with assms show ?thesis  | 
| 
 
ebd108578ab1
more new material about analysis
 
paulson <lp15@cam.ac.uk> 
parents: 
70365 
diff
changeset
 | 
392  | 
by (auto simp: tendsto_null_power)  | 
| 
 
ebd108578ab1
more new material about analysis
 
paulson <lp15@cam.ac.uk> 
parents: 
70365 
diff
changeset
 | 
393  | 
qed  | 
| 63467 | 394  | 
|
| 60758 | 395  | 
subsection \<open>Square Root\<close>  | 
| 
20687
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
396  | 
|
| 63467 | 397  | 
definition sqrt :: "real \<Rightarrow> real"  | 
398  | 
where "sqrt = root 2"  | 
|
| 
20687
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
399  | 
|
| 63467 | 400  | 
lemma pos2: "0 < (2::nat)"  | 
401  | 
by 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
 | 
402  | 
|
| 63467 | 403  | 
lemma real_sqrt_unique: "y\<^sup>2 = x \<Longrightarrow> 0 \<le> y \<Longrightarrow> sqrt x = y"  | 
404  | 
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
 | 
405  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
51483 
diff
changeset
 | 
406  | 
lemma real_sqrt_abs [simp]: "sqrt (x\<^sup>2) = \<bar>x\<bar>"  | 
| 
70378
 
ebd108578ab1
more new material about analysis
 
paulson <lp15@cam.ac.uk> 
parents: 
70365 
diff
changeset
 | 
407  | 
by (metis power2_abs abs_ge_zero real_sqrt_unique)  | 
| 
20687
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
408  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
51483 
diff
changeset
 | 
409  | 
lemma real_sqrt_pow2 [simp]: "0 \<le> x \<Longrightarrow> (sqrt x)\<^sup>2 = x"  | 
| 63467 | 410  | 
unfolding sqrt_def by (rule real_root_pow_pos2 [OF pos2])  | 
| 22856 | 411  | 
|
| 63558 | 412  | 
lemma real_sqrt_pow2_iff [simp]: "(sqrt x)\<^sup>2 = x \<longleftrightarrow> 0 \<le> x"  | 
| 
70378
 
ebd108578ab1
more new material about analysis
 
paulson <lp15@cam.ac.uk> 
parents: 
70365 
diff
changeset
 | 
413  | 
by (metis real_sqrt_pow2 zero_le_power2)  | 
| 
20687
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
414  | 
|
| 
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
 | 
415  | 
lemma real_sqrt_zero [simp]: "sqrt 0 = 0"  | 
| 63467 | 416  | 
unfolding sqrt_def by (rule real_root_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
 | 
417  | 
|
| 
 
617140080e6a
define 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  | 
lemma real_sqrt_one [simp]: "sqrt 1 = 1"  | 
| 63467 | 419  | 
unfolding sqrt_def by (rule real_root_one [OF pos2])  | 
| 
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
 | 
420  | 
|
| 
56889
 
48a745e1bde7
avoid the Complex constructor, use the more natural Re/Im view; moved csqrt to Complex.
 
hoelzl 
parents: 
56536 
diff
changeset
 | 
421  | 
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
 | 
422  | 
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
 | 
423  | 
|
| 
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
 | 
424  | 
lemma real_sqrt_minus: "sqrt (- x) = - sqrt x"  | 
| 63467 | 425  | 
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
 | 
426  | 
|
| 
 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
 
huffman 
parents: 
22943 
diff
changeset
 | 
427  | 
lemma real_sqrt_mult: "sqrt (x * y) = sqrt x * sqrt y"  | 
| 63467 | 428  | 
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
 | 
429  | 
|
| 
56889
 
48a745e1bde7
avoid the Complex constructor, use the more natural Re/Im view; moved csqrt to Complex.
 
hoelzl 
parents: 
56536 
diff
changeset
 | 
430  | 
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
 | 
431  | 
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
 | 
432  | 
|
| 
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
 | 
433  | 
lemma real_sqrt_inverse: "sqrt (inverse x) = inverse (sqrt x)"  | 
| 63467 | 434  | 
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
 | 
435  | 
|
| 
 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
 
huffman 
parents: 
22943 
diff
changeset
 | 
436  | 
lemma real_sqrt_divide: "sqrt (x / y) = sqrt x / sqrt y"  | 
| 63467 | 437  | 
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
 | 
438  | 
|
| 
 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
 
huffman 
parents: 
22943 
diff
changeset
 | 
439  | 
lemma real_sqrt_power: "sqrt (x ^ k) = sqrt x ^ k"  | 
| 63467 | 440  | 
unfolding sqrt_def by (rule real_root_power [OF pos2])  | 
| 
22956
 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
 
huffman 
parents: 
22943 
diff
changeset
 | 
441  | 
|
| 
 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
 
huffman 
parents: 
22943 
diff
changeset
 | 
442  | 
lemma real_sqrt_gt_zero: "0 < x \<Longrightarrow> 0 < sqrt x"  | 
| 63467 | 443  | 
unfolding sqrt_def by (rule real_root_gt_zero [OF pos2])  | 
| 
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  | 
|
| 
 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
 
huffman 
parents: 
22943 
diff
changeset
 | 
445  | 
lemma real_sqrt_ge_zero: "0 \<le> x \<Longrightarrow> 0 \<le> sqrt x"  | 
| 63467 | 446  | 
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
 | 
447  | 
|
| 
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
 | 
448  | 
lemma real_sqrt_less_mono: "x < y \<Longrightarrow> sqrt x < sqrt y"  | 
| 63467 | 449  | 
unfolding sqrt_def by (rule real_root_less_mono [OF pos2])  | 
| 
22956
 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
 
huffman 
parents: 
22943 
diff
changeset
 | 
450  | 
|
| 
 
617140080e6a
define roots of negative reals so that many lemmas no longer require side conditions; simplification solves more goals than previously
 
huffman 
parents: 
22943 
diff
changeset
 | 
451  | 
lemma real_sqrt_le_mono: "x \<le> y \<Longrightarrow> sqrt x \<le> sqrt y"  | 
| 63467 | 452  | 
unfolding sqrt_def by (rule real_root_le_mono [OF pos2])  | 
| 
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
 | 
453  | 
|
| 63558 | 454  | 
lemma real_sqrt_less_iff [simp]: "sqrt x < sqrt y \<longleftrightarrow> x < y"  | 
| 63467 | 455  | 
unfolding sqrt_def by (rule real_root_less_iff [OF pos2])  | 
| 
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
 | 
456  | 
|
| 63558 | 457  | 
lemma real_sqrt_le_iff [simp]: "sqrt x \<le> sqrt y \<longleftrightarrow> x \<le> y"  | 
| 63467 | 458  | 
unfolding sqrt_def by (rule real_root_le_iff [OF pos2])  | 
| 
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
 | 
459  | 
|
| 63558 | 460  | 
lemma real_sqrt_eq_iff [simp]: "sqrt x = sqrt y \<longleftrightarrow> x = y"  | 
| 63467 | 461  | 
unfolding sqrt_def by (rule real_root_eq_iff [OF pos2])  | 
| 
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
 | 
462  | 
|
| 
62381
 
a6479cb85944
New and revised material for (multivariate) analysis
 
paulson <lp15@cam.ac.uk> 
parents: 
62347 
diff
changeset
 | 
463  | 
lemma real_less_lsqrt: "0 \<le> x \<Longrightarrow> 0 \<le> y \<Longrightarrow> x < y\<^sup>2 \<Longrightarrow> sqrt x < y"  | 
| 
 
a6479cb85944
New and revised material for (multivariate) analysis
 
paulson <lp15@cam.ac.uk> 
parents: 
62347 
diff
changeset
 | 
464  | 
using real_sqrt_less_iff[of x "y\<^sup>2"] by simp  | 
| 
 
a6479cb85944
New and revised material for (multivariate) analysis
 
paulson <lp15@cam.ac.uk> 
parents: 
62347 
diff
changeset
 | 
465  | 
|
| 
54413
 
88a036a95967
add finite_select_induct; move generic lemmas from MV_Analysis/Linear_Algebra to the HOL image
 
hoelzl 
parents: 
53594 
diff
changeset
 | 
466  | 
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
 | 
467  | 
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
 | 
468  | 
|
| 
 
88a036a95967
add finite_select_induct; move generic lemmas from MV_Analysis/Linear_Algebra to the HOL image
 
hoelzl 
parents: 
53594 
diff
changeset
 | 
469  | 
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
 | 
470  | 
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
 | 
471  | 
|
| 
 
88a036a95967
add finite_select_induct; move generic lemmas from MV_Analysis/Linear_Algebra to the HOL image
 
hoelzl 
parents: 
53594 
diff
changeset
 | 
472  | 
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
 | 
473  | 
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
 | 
474  | 
|
| 
65552
 
f533820e7248
theories "GCD" and "Binomial" are already included in "Main": this avoids improper imports in applications;
 
wenzelm 
parents: 
64267 
diff
changeset
 | 
475  | 
lemma real_sqrt_power_even:  | 
| 63721 | 476  | 
assumes "even n" "x \<ge> 0"  | 
477  | 
shows "sqrt x ^ n = x ^ (n div 2)"  | 
|
478  | 
proof -  | 
|
479  | 
from assms obtain k where "n = 2*k" by (auto elim!: evenE)  | 
|
480  | 
with assms show ?thesis by (simp add: power_mult)  | 
|
481  | 
qed  | 
|
482  | 
||
| 63467 | 483  | 
lemma sqrt_le_D: "sqrt x \<le> y \<Longrightarrow> x \<le> y\<^sup>2"  | 
| 
62131
 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 
paulson 
parents: 
61973 
diff
changeset
 | 
484  | 
by (meson not_le real_less_rsqrt)  | 
| 
 
1baed43f453e
nonneg_Reals, nonpos_Reals, Cauchy integral formula, etc.
 
paulson 
parents: 
61973 
diff
changeset
 | 
485  | 
|
| 
67685
 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 
immler 
parents: 
66815 
diff
changeset
 | 
486  | 
lemma sqrt_ge_absD: "\<bar>x\<bar> \<le> sqrt y \<Longrightarrow> x\<^sup>2 \<le> y"  | 
| 
 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 
immler 
parents: 
66815 
diff
changeset
 | 
487  | 
using real_sqrt_le_iff[of "x\<^sup>2"] by simp  | 
| 
 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 
immler 
parents: 
66815 
diff
changeset
 | 
488  | 
|
| 
54413
 
88a036a95967
add finite_select_induct; move generic lemmas from MV_Analysis/Linear_Algebra to the HOL image
 
hoelzl 
parents: 
53594 
diff
changeset
 | 
489  | 
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
 | 
490  | 
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
 | 
491  | 
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
 | 
492  | 
proof -  | 
| 
58709
 
efdc6c533bd3
prefer generic elimination rules for even/odd over specialized unfold rules for nat
 
haftmann 
parents: 
57514 
diff
changeset
 | 
493  | 
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
 | 
494  | 
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
 | 
495  | 
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
 | 
496  | 
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
 | 
497  | 
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
 | 
498  | 
qed  | 
| 
 
88a036a95967
add finite_select_induct; move generic lemmas from MV_Analysis/Linear_Algebra to the HOL image
 
hoelzl 
parents: 
53594 
diff
changeset
 | 
499  | 
|
| 53594 | 500  | 
lemmas real_sqrt_gt_0_iff [simp] = real_sqrt_less_iff [where x=0, unfolded real_sqrt_zero]  | 
501  | 
lemmas real_sqrt_lt_0_iff [simp] = real_sqrt_less_iff [where y=0, unfolded real_sqrt_zero]  | 
|
502  | 
lemmas real_sqrt_ge_0_iff [simp] = real_sqrt_le_iff [where x=0, unfolded real_sqrt_zero]  | 
|
503  | 
lemmas real_sqrt_le_0_iff [simp] = real_sqrt_le_iff [where y=0, unfolded real_sqrt_zero]  | 
|
504  | 
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
 | 
505  | 
|
| 53594 | 506  | 
lemmas real_sqrt_gt_1_iff [simp] = real_sqrt_less_iff [where x=1, unfolded real_sqrt_one]  | 
507  | 
lemmas real_sqrt_lt_1_iff [simp] = real_sqrt_less_iff [where y=1, unfolded real_sqrt_one]  | 
|
508  | 
lemmas real_sqrt_ge_1_iff [simp] = real_sqrt_le_iff [where x=1, unfolded real_sqrt_one]  | 
|
509  | 
lemmas real_sqrt_le_1_iff [simp] = real_sqrt_le_iff [where y=1, unfolded real_sqrt_one]  | 
|
510  | 
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
 | 
511  | 
|
| 
60615
 
e5fa1d5d3952
Useful lemmas. The theorem concerning swapping the variables in a double integral.
 
paulson <lp15@cam.ac.uk> 
parents: 
60141 
diff
changeset
 | 
512  | 
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
 | 
513  | 
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
 | 
514  | 
shows "sqrt (x + y) \<le> sqrt x + sqrt y"  | 
| 63467 | 515  | 
by (rule power2_le_imp_le) (simp_all add: power2_sum assms)  | 
| 
60615
 
e5fa1d5d3952
Useful lemmas. The theorem concerning swapping the variables in a double integral.
 
paulson <lp15@cam.ac.uk> 
parents: 
60141 
diff
changeset
 | 
516  | 
|
| 
23042
 
492514b39956
add lemmas about continuity and derivatives of roots
 
huffman 
parents: 
23009 
diff
changeset
 | 
517  | 
lemma isCont_real_sqrt: "isCont sqrt x"  | 
| 63467 | 518  | 
unfolding sqrt_def by (rule isCont_real_root)  | 
| 
23042
 
492514b39956
add lemmas about continuity and derivatives of roots
 
huffman 
parents: 
23009 
diff
changeset
 | 
519  | 
|
| 63467 | 520  | 
lemma tendsto_real_sqrt [tendsto_intros]:  | 
| 61973 | 521  | 
"(f \<longlongrightarrow> x) F \<Longrightarrow> ((\<lambda>x. sqrt (f x)) \<longlongrightarrow> 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
 | 
522  | 
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
 | 
523  | 
|
| 63467 | 524  | 
lemma continuous_real_sqrt [continuous_intros]:  | 
| 
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
 | 
525  | 
"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
 | 
526  | 
unfolding sqrt_def by (rule continuous_real_root)  | 
| 
61609
 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 
paulson <lp15@cam.ac.uk> 
parents: 
60867 
diff
changeset
 | 
527  | 
|
| 63467 | 528  | 
lemma continuous_on_real_sqrt [continuous_intros]:  | 
| 57155 | 529  | 
"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
 | 
530  | 
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
 | 
531  | 
|
| 31880 | 532  | 
lemma DERIV_real_sqrt_generic:  | 
533  | 
assumes "x \<noteq> 0"  | 
|
| 63467 | 534  | 
and "x > 0 \<Longrightarrow> D = inverse (sqrt x) / 2"  | 
535  | 
and "x < 0 \<Longrightarrow> D = - inverse (sqrt x) / 2"  | 
|
| 31880 | 536  | 
shows "DERIV sqrt x :> D"  | 
537  | 
using assms unfolding sqrt_def  | 
|
538  | 
by (auto intro!: DERIV_real_root_generic)  | 
|
539  | 
||
| 63467 | 540  | 
lemma DERIV_real_sqrt: "0 < x \<Longrightarrow> DERIV sqrt x :> inverse (sqrt x) / 2"  | 
| 31880 | 541  | 
using DERIV_real_sqrt_generic by simp  | 
542  | 
||
543  | 
declare  | 
|
| 
56381
 
0556204bc230
merged DERIV_intros, has_derivative_intros into derivative_intros
 
hoelzl 
parents: 
56371 
diff
changeset
 | 
544  | 
DERIV_real_sqrt_generic[THEN DERIV_chain2, derivative_intros]  | 
| 
 
0556204bc230
merged DERIV_intros, has_derivative_intros into derivative_intros
 
hoelzl 
parents: 
56371 
diff
changeset
 | 
545  | 
DERIV_real_root_generic[THEN DERIV_chain2, derivative_intros]  | 
| 
23042
 
492514b39956
add lemmas about continuity and derivatives of roots
 
huffman 
parents: 
23009 
diff
changeset
 | 
546  | 
|
| 
67685
 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 
immler 
parents: 
66815 
diff
changeset
 | 
547  | 
lemmas has_derivative_real_sqrt[derivative_intros] = DERIV_real_sqrt[THEN DERIV_compose_FDERIV]  | 
| 
 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 
immler 
parents: 
66815 
diff
changeset
 | 
548  | 
|
| 63558 | 549  | 
lemma not_real_square_gt_zero [simp]: "\<not> 0 < x * x \<longleftrightarrow> x = 0"  | 
550  | 
for x :: real  | 
|
| 63467 | 551  | 
apply auto  | 
| 63558 | 552  | 
using linorder_less_linear [where x = x and y = 0]  | 
| 63467 | 553  | 
apply (simp add: zero_less_mult_iff)  | 
554  | 
done  | 
|
| 
20687
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
555  | 
|
| 63467 | 556  | 
lemma real_sqrt_abs2 [simp]: "sqrt (x * x) = \<bar>x\<bar>"  | 
557  | 
apply (subst power2_eq_square [symmetric])  | 
|
558  | 
apply (rule real_sqrt_abs)  | 
|
559  | 
done  | 
|
| 
20687
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
560  | 
|
| 63467 | 561  | 
lemma real_inv_sqrt_pow2: "0 < x \<Longrightarrow> (inverse (sqrt x))\<^sup>2 = inverse x"  | 
562  | 
by (simp add: power_inverse)  | 
|
| 
20687
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
563  | 
|
| 63467 | 564  | 
lemma real_sqrt_eq_zero_cancel: "0 \<le> x \<Longrightarrow> sqrt x = 0 \<Longrightarrow> x = 0"  | 
565  | 
by simp  | 
|
| 
20687
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
566  | 
|
| 63467 | 567  | 
lemma real_sqrt_ge_one: "1 \<le> x \<Longrightarrow> 1 \<le> sqrt x"  | 
568  | 
by simp  | 
|
| 
20687
 
fedb901be392
move root and sqrt stuff from Transcendental to NthRoot
 
huffman 
parents: 
20515 
diff
changeset
 | 
569  | 
|
| 22443 | 570  | 
lemma sqrt_divide_self_eq:  | 
571  | 
assumes nneg: "0 \<le> x"  | 
|
572  | 
shows "sqrt x / x = inverse (sqrt x)"  | 
|
| 63467 | 573  | 
proof (cases "x = 0")  | 
574  | 
case True  | 
|
575  | 
then show ?thesis by simp  | 
|
| 22443 | 576  | 
next  | 
| 63467 | 577  | 
case False  | 
578  | 
then have pos: "0 < x"  | 
|
579  | 
using nneg by arith  | 
|
| 22443 | 580  | 
show ?thesis  | 
| 63467 | 581  | 
proof (rule right_inverse_eq [THEN iffD1, symmetric])  | 
582  | 
show "sqrt x / x \<noteq> 0"  | 
|
583  | 
by (simp add: divide_inverse nneg False)  | 
|
| 22443 | 584  | 
show "inverse (sqrt x) / (sqrt x / x) = 1"  | 
| 
61609
 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 
paulson <lp15@cam.ac.uk> 
parents: 
60867 
diff
changeset
 | 
585  | 
by (simp add: divide_inverse mult.assoc [symmetric]  | 
| 63467 | 586  | 
power2_eq_square [symmetric] real_inv_sqrt_pow2 pos False)  | 
| 22443 | 587  | 
qed  | 
588  | 
qed  | 
|
589  | 
||
| 
54413
 
88a036a95967
add finite_select_induct; move generic lemmas from MV_Analysis/Linear_Algebra to the HOL image
 
hoelzl 
parents: 
53594 
diff
changeset
 | 
590  | 
lemma real_div_sqrt: "0 \<le> x \<Longrightarrow> x / sqrt x = sqrt x"  | 
| 63558 | 591  | 
by (cases "x = 0") (simp_all add: sqrt_divide_self_eq [of x] field_simps)  | 
| 
54413
 
88a036a95967
add finite_select_induct; move generic lemmas from MV_Analysis/Linear_Algebra to the HOL image
 
hoelzl 
parents: 
53594 
diff
changeset
 | 
592  | 
|
| 63558 | 593  | 
lemma real_divide_square_eq [simp]: "(r * a) / (r * r) = a / r"  | 
594  | 
for a r :: real  | 
|
595  | 
by (cases "r = 0") (simp_all add: divide_inverse ac_simps)  | 
|
| 
22721
 
d9be18bd7a28
moved root and sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
22630 
diff
changeset
 | 
596  | 
|
| 63467 | 597  | 
lemma lemma_real_divide_sqrt_less: "0 < u \<Longrightarrow> u / sqrt 2 < u"  | 
598  | 
by (simp add: divide_less_eq)  | 
|
| 
23049
 
11607c283074
moved sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
23047 
diff
changeset
 | 
599  | 
|
| 63558 | 600  | 
lemma four_x_squared: "4 * x\<^sup>2 = (2 * x)\<^sup>2"  | 
601  | 
for x :: real  | 
|
| 63467 | 602  | 
by (simp add: power2_eq_square)  | 
| 
23049
 
11607c283074
moved sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
23047 
diff
changeset
 | 
603  | 
|
| 
57275
 
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
 
hoelzl 
parents: 
57155 
diff
changeset
 | 
604  | 
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
 | 
605  | 
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
 | 
606  | 
(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
 | 
607  | 
|
| 63467 | 608  | 
|
| 60758 | 609  | 
subsection \<open>Square Root of Sum of Squares\<close>  | 
| 22856 | 610  | 
|
| 63558 | 611  | 
lemma sum_squares_bound: "2 * x * y \<le> x\<^sup>2 + y\<^sup>2"  | 
612  | 
for x y :: "'a::linordered_field"  | 
|
| 55967 | 613  | 
proof -  | 
| 63467 | 614  | 
have "(x - y)\<^sup>2 = x * x - 2 * x * y + y * y"  | 
| 55967 | 615  | 
by algebra  | 
| 63467 | 616  | 
then have "0 \<le> x\<^sup>2 - 2 * x * y + y\<^sup>2"  | 
| 55967 | 617  | 
by (metis sum_power2_ge_zero zero_le_double_add_iff_zero_le_single_add power2_eq_square)  | 
618  | 
then show ?thesis  | 
|
619  | 
by arith  | 
|
620  | 
qed  | 
|
| 22856 | 621  | 
|
| 
61609
 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 
paulson <lp15@cam.ac.uk> 
parents: 
60867 
diff
changeset
 | 
622  | 
lemma arith_geo_mean:  | 
| 63467 | 623  | 
fixes u :: "'a::linordered_field"  | 
624  | 
assumes "u\<^sup>2 = x * y" "x \<ge> 0" "y \<ge> 0"  | 
|
625  | 
shows "u \<le> (x + y)/2"  | 
|
626  | 
apply (rule power2_le_imp_le)  | 
|
627  | 
using sum_squares_bound assms  | 
|
628  | 
apply (auto simp: zero_le_mult_iff)  | 
|
629  | 
apply (auto simp: algebra_simps power2_eq_square)  | 
|
630  | 
done  | 
|
| 55967 | 631  | 
|
| 
61609
 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 
paulson <lp15@cam.ac.uk> 
parents: 
60867 
diff
changeset
 | 
632  | 
lemma arith_geo_mean_sqrt:  | 
| 63558 | 633  | 
fixes x :: real  | 
634  | 
assumes "x \<ge> 0" "y \<ge> 0"  | 
|
635  | 
shows "sqrt (x * y) \<le> (x + y)/2"  | 
|
| 55967 | 636  | 
apply (rule arith_geo_mean)  | 
637  | 
using assms  | 
|
638  | 
apply (auto simp: zero_le_mult_iff)  | 
|
639  | 
done  | 
|
| 
23049
 
11607c283074
moved sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
23047 
diff
changeset
 | 
640  | 
|
| 63558 | 641  | 
lemma real_sqrt_sum_squares_mult_ge_zero [simp]: "0 \<le> sqrt ((x\<^sup>2 + y\<^sup>2) * (xa\<^sup>2 + ya\<^sup>2))"  | 
| 55967 | 642  | 
by (metis real_sqrt_ge_0_iff split_mult_pos_le sum_power2_ge_zero)  | 
| 22856 | 643  | 
|
644  | 
lemma real_sqrt_sum_squares_mult_squared_eq [simp]:  | 
|
| 63467 | 645  | 
"(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 | 646  | 
by (simp add: zero_le_mult_iff)  | 
| 22856 | 647  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
51483 
diff
changeset
 | 
648  | 
lemma real_sqrt_sum_squares_eq_cancel: "sqrt (x\<^sup>2 + y\<^sup>2) = x \<Longrightarrow> y = 0"  | 
| 63467 | 649  | 
by (drule arg_cong [where f = "\<lambda>x. x\<^sup>2"]) simp  | 
| 
23049
 
11607c283074
moved sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
23047 
diff
changeset
 | 
650  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
51483 
diff
changeset
 | 
651  | 
lemma real_sqrt_sum_squares_eq_cancel2: "sqrt (x\<^sup>2 + y\<^sup>2) = y \<Longrightarrow> x = 0"  | 
| 63467 | 652  | 
by (drule arg_cong [where f = "\<lambda>x. x\<^sup>2"]) simp  | 
| 
23049
 
11607c283074
moved sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
23047 
diff
changeset
 | 
653  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
51483 
diff
changeset
 | 
654  | 
lemma real_sqrt_sum_squares_ge1 [simp]: "x \<le> sqrt (x\<^sup>2 + y\<^sup>2)"  | 
| 63467 | 655  | 
by (rule power2_le_imp_le) simp_all  | 
| 22856 | 656  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
51483 
diff
changeset
 | 
657  | 
lemma real_sqrt_sum_squares_ge2 [simp]: "y \<le> sqrt (x\<^sup>2 + y\<^sup>2)"  | 
| 63467 | 658  | 
by (rule power2_le_imp_le) simp_all  | 
| 
23049
 
11607c283074
moved sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
23047 
diff
changeset
 | 
659  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
51483 
diff
changeset
 | 
660  | 
lemma real_sqrt_ge_abs1 [simp]: "\<bar>x\<bar> \<le> sqrt (x\<^sup>2 + y\<^sup>2)"  | 
| 63467 | 661  | 
by (rule power2_le_imp_le) simp_all  | 
| 22856 | 662  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
51483 
diff
changeset
 | 
663  | 
lemma real_sqrt_ge_abs2 [simp]: "\<bar>y\<bar> \<le> sqrt (x\<^sup>2 + y\<^sup>2)"  | 
| 63467 | 664  | 
by (rule power2_le_imp_le) simp_all  | 
| 
23049
 
11607c283074
moved sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
23047 
diff
changeset
 | 
665  | 
|
| 
 
11607c283074
moved sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
23047 
diff
changeset
 | 
666  | 
lemma le_real_sqrt_sumsq [simp]: "x \<le> sqrt (x * x + y * y)"  | 
| 63467 | 667  | 
by (simp add: power2_eq_square [symmetric])  | 
| 
23049
 
11607c283074
moved sqrt lemmas from Transcendental.thy to NthRoot.thy
 
huffman 
parents: 
23047 
diff
changeset
 | 
668  | 
|
| 
67685
 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 
immler 
parents: 
66815 
diff
changeset
 | 
669  | 
lemma sqrt_sum_squares_le_sum:  | 
| 
 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 
immler 
parents: 
66815 
diff
changeset
 | 
670  | 
"\<lbrakk>0 \<le> x; 0 \<le> y\<rbrakk> \<Longrightarrow> sqrt (x\<^sup>2 + y\<^sup>2) \<le> x + y"  | 
| 
68465
 
e699ca8e22b7
New material in support of quaternions
 
paulson <lp15@cam.ac.uk> 
parents: 
68077 
diff
changeset
 | 
671  | 
by (rule power2_le_imp_le) (simp_all add: power2_sum)  | 
| 
 
e699ca8e22b7
New material in support of quaternions
 
paulson <lp15@cam.ac.uk> 
parents: 
68077 
diff
changeset
 | 
672  | 
|
| 
 
e699ca8e22b7
New material in support of quaternions
 
paulson <lp15@cam.ac.uk> 
parents: 
68077 
diff
changeset
 | 
673  | 
lemma L2_set_mult_ineq_lemma:  | 
| 
 
e699ca8e22b7
New material in support of quaternions
 
paulson <lp15@cam.ac.uk> 
parents: 
68077 
diff
changeset
 | 
674  | 
fixes a b c d :: real  | 
| 
 
e699ca8e22b7
New material in support of quaternions
 
paulson <lp15@cam.ac.uk> 
parents: 
68077 
diff
changeset
 | 
675  | 
shows "2 * (a * c) * (b * d) \<le> a\<^sup>2 * d\<^sup>2 + b\<^sup>2 * c\<^sup>2"  | 
| 
 
e699ca8e22b7
New material in support of quaternions
 
paulson <lp15@cam.ac.uk> 
parents: 
68077 
diff
changeset
 | 
676  | 
proof -  | 
| 
 
e699ca8e22b7
New material in support of quaternions
 
paulson <lp15@cam.ac.uk> 
parents: 
68077 
diff
changeset
 | 
677  | 
have "0 \<le> (a * d - b * c)\<^sup>2" by simp  | 
| 
 
e699ca8e22b7
New material in support of quaternions
 
paulson <lp15@cam.ac.uk> 
parents: 
68077 
diff
changeset
 | 
678  | 
also have "\<dots> = a\<^sup>2 * d\<^sup>2 + b\<^sup>2 * c\<^sup>2 - 2 * (a * d) * (b * c)"  | 
| 
 
e699ca8e22b7
New material in support of quaternions
 
paulson <lp15@cam.ac.uk> 
parents: 
68077 
diff
changeset
 | 
679  | 
by (simp only: power2_diff power_mult_distrib)  | 
| 
 
e699ca8e22b7
New material in support of quaternions
 
paulson <lp15@cam.ac.uk> 
parents: 
68077 
diff
changeset
 | 
680  | 
also have "\<dots> = a\<^sup>2 * d\<^sup>2 + b\<^sup>2 * c\<^sup>2 - 2 * (a * c) * (b * d)"  | 
| 
 
e699ca8e22b7
New material in support of quaternions
 
paulson <lp15@cam.ac.uk> 
parents: 
68077 
diff
changeset
 | 
681  | 
by simp  | 
| 
 
e699ca8e22b7
New material in support of quaternions
 
paulson <lp15@cam.ac.uk> 
parents: 
68077 
diff
changeset
 | 
682  | 
finally show "2 * (a * c) * (b * d) \<le> a\<^sup>2 * d\<^sup>2 + b\<^sup>2 * c\<^sup>2"  | 
| 
 
e699ca8e22b7
New material in support of quaternions
 
paulson <lp15@cam.ac.uk> 
parents: 
68077 
diff
changeset
 | 
683  | 
by simp  | 
| 
 
e699ca8e22b7
New material in support of quaternions
 
paulson <lp15@cam.ac.uk> 
parents: 
68077 
diff
changeset
 | 
684  | 
qed  | 
| 
 
e699ca8e22b7
New material in support of quaternions
 
paulson <lp15@cam.ac.uk> 
parents: 
68077 
diff
changeset
 | 
685  | 
|
| 
 
e699ca8e22b7
New material in support of quaternions
 
paulson <lp15@cam.ac.uk> 
parents: 
68077 
diff
changeset
 | 
686  | 
lemma sqrt_sum_squares_le_sum_abs: "sqrt (x\<^sup>2 + y\<^sup>2) \<le> \<bar>x\<bar> + \<bar>y\<bar>"  | 
| 
 
e699ca8e22b7
New material in support of quaternions
 
paulson <lp15@cam.ac.uk> 
parents: 
68077 
diff
changeset
 | 
687  | 
by (rule power2_le_imp_le) (simp_all add: power2_sum)  | 
| 
67685
 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 
immler 
parents: 
66815 
diff
changeset
 | 
688  | 
|
| 22858 | 689  | 
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
 | 
690  | 
"sqrt ((a + c)\<^sup>2 + (b + d)\<^sup>2) \<le> sqrt (a\<^sup>2 + b\<^sup>2) + sqrt (c\<^sup>2 + d\<^sup>2)"  | 
| 
68465
 
e699ca8e22b7
New material in support of quaternions
 
paulson <lp15@cam.ac.uk> 
parents: 
68077 
diff
changeset
 | 
691  | 
proof -  | 
| 
 
e699ca8e22b7
New material in support of quaternions
 
paulson <lp15@cam.ac.uk> 
parents: 
68077 
diff
changeset
 | 
692  | 
have "(a * c + b * d) \<le> (sqrt (a\<^sup>2 + b\<^sup>2) * sqrt (c\<^sup>2 + d\<^sup>2))"  | 
| 
 
e699ca8e22b7
New material in support of quaternions
 
paulson <lp15@cam.ac.uk> 
parents: 
68077 
diff
changeset
 | 
693  | 
by (rule power2_le_imp_le) (simp_all add: power2_sum power_mult_distrib ring_distribs L2_set_mult_ineq_lemma add.commute)  | 
| 
 
e699ca8e22b7
New material in support of quaternions
 
paulson <lp15@cam.ac.uk> 
parents: 
68077 
diff
changeset
 | 
694  | 
then have "(a + c)\<^sup>2 + (b + d)\<^sup>2 \<le> (sqrt (a\<^sup>2 + b\<^sup>2) + sqrt (c\<^sup>2 + d\<^sup>2))\<^sup>2"  | 
| 
 
e699ca8e22b7
New material in support of quaternions
 
paulson <lp15@cam.ac.uk> 
parents: 
68077 
diff
changeset
 | 
695  | 
by (simp add: power2_sum)  | 
| 
 
e699ca8e22b7
New material in support of quaternions
 
paulson <lp15@cam.ac.uk> 
parents: 
68077 
diff
changeset
 | 
696  | 
then show ?thesis  | 
| 
 
e699ca8e22b7
New material in support of quaternions
 
paulson <lp15@cam.ac.uk> 
parents: 
68077 
diff
changeset
 | 
697  | 
by (auto intro: power2_le_imp_le)  | 
| 
 
e699ca8e22b7
New material in support of quaternions
 
paulson <lp15@cam.ac.uk> 
parents: 
68077 
diff
changeset
 | 
698  | 
qed  | 
| 22858 | 699  | 
|
| 63467 | 700  | 
lemma real_sqrt_sum_squares_less: "\<bar>x\<bar> < u / sqrt 2 \<Longrightarrow> \<bar>y\<bar> < u / sqrt 2 \<Longrightarrow> sqrt (x\<^sup>2 + y\<^sup>2) < u"  | 
701  | 
apply (rule power2_less_imp_less)  | 
|
| 63558 | 702  | 
apply simp  | 
703  | 
apply (drule power_strict_mono [OF _ abs_ge_zero pos2])  | 
|
704  | 
apply (drule power_strict_mono [OF _ abs_ge_zero pos2])  | 
|
705  | 
apply (simp add: power_divide)  | 
|
| 63467 | 706  | 
apply (drule order_le_less_trans [OF abs_ge_zero])  | 
707  | 
apply (simp add: zero_less_divide_iff)  | 
|
708  | 
done  | 
|
| 23122 | 709  | 
|
| 
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
 | 
710  | 
lemma sqrt2_less_2: "sqrt 2 < (2::real)"  | 
| 63467 | 711  | 
by (metis not_less not_less_iff_gr_or_eq numeral_less_iff real_sqrt_four  | 
712  | 
real_sqrt_le_iff semiring_norm(75) semiring_norm(78) semiring_norm(85))  | 
|
| 
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
 | 
713  | 
|
| 64122 | 714  | 
lemma sqrt_sum_squares_half_less:  | 
715  | 
"x < u/2 \<Longrightarrow> y < u/2 \<Longrightarrow> 0 \<le> x \<Longrightarrow> 0 \<le> y \<Longrightarrow> 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
 | 
716  | 
apply (rule real_sqrt_sum_squares_less)  | 
| 63558 | 717  | 
apply (auto simp add: abs_if field_simps)  | 
718  | 
apply (rule le_less_trans [where y = "x*2"])  | 
|
| 64122 | 719  | 
using less_eq_real_def sqrt2_less_2 apply force  | 
| 63558 | 720  | 
apply assumption  | 
| 
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
 | 
721  | 
apply (rule le_less_trans [where y = "y*2"])  | 
| 
61609
 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 
paulson <lp15@cam.ac.uk> 
parents: 
60867 
diff
changeset
 | 
722  | 
using less_eq_real_def sqrt2_less_2 mult_le_cancel_left  | 
| 63558 | 723  | 
apply auto  | 
| 
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
 | 
724  | 
done  | 
| 
61609
 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 
paulson <lp15@cam.ac.uk> 
parents: 
60867 
diff
changeset
 | 
725  | 
|
| 61969 | 726  | 
lemma LIMSEQ_root: "(\<lambda>n. root n n) \<longlonglongrightarrow> 1"  | 
| 
60141
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
727  | 
proof -  | 
| 63040 | 728  | 
define x where "x n = root n n - 1" for n  | 
| 61969 | 729  | 
have "x \<longlonglongrightarrow> sqrt 0"  | 
| 
60141
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
730  | 
proof (rule tendsto_sandwich[OF _ _ tendsto_const])  | 
| 61969 | 731  | 
show "(\<lambda>x. sqrt (2 / x)) \<longlonglongrightarrow> sqrt 0"  | 
| 
60141
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
732  | 
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
 | 
733  | 
(simp_all add: at_infinity_eq_at_top_bot)  | 
| 63467 | 734  | 
have "x n \<le> sqrt (2 / real n)" if "2 < n" for n :: nat  | 
735  | 
proof -  | 
|
736  | 
have "1 + (real (n - 1) * n) / 2 * (x n)\<^sup>2 = 1 + of_nat (n choose 2) * (x n)\<^sup>2"  | 
|
| 66815 | 737  | 
by (auto simp add: choose_two field_char_0_class.of_nat_div mod_eq_0_iff_dvd)  | 
| 
60141
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
738  | 
      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
 | 
739  | 
by (simp add: x_def)  | 
| 
68077
 
ee8c13ae81e9
Some tidying up (mostly regarding summations from 0)
 
paulson <lp15@cam.ac.uk> 
parents: 
67685 
diff
changeset
 | 
740  | 
also have "\<dots> \<le> (\<Sum>k\<le>n. of_nat (n choose k) * x n^k)"  | 
| 63467 | 741  | 
using \<open>2 < n\<close>  | 
| 64267 | 742  | 
by (intro sum_mono2) (auto intro!: mult_nonneg_nonneg zero_le_power simp: x_def le_diff_eq)  | 
| 
60141
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
743  | 
also have "\<dots> = (x n + 1) ^ n"  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
744  | 
by (simp add: binomial_ring)  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
745  | 
also have "\<dots> = n"  | 
| 60758 | 746  | 
using \<open>2 < n\<close> by (simp add: x_def)  | 
| 
60141
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
747  | 
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
 | 
748  | 
by simp  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
749  | 
then have "(x n)\<^sup>2 \<le> 2 / real n"  | 
| 60758 | 750  | 
using \<open>2 < n\<close> unfolding mult_le_cancel_left by (simp add: field_simps)  | 
| 63467 | 751  | 
from real_sqrt_le_mono[OF this] show ?thesis  | 
752  | 
by simp  | 
|
753  | 
qed  | 
|
| 
60141
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
754  | 
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
 | 
755  | 
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
 | 
756  | 
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
 | 
757  | 
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
 | 
758  | 
qed  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
759  | 
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
 | 
760  | 
by (simp add: x_def)  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
761  | 
qed  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
762  | 
|
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
763  | 
lemma LIMSEQ_root_const:  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
764  | 
assumes "0 < c"  | 
| 61969 | 765  | 
shows "(\<lambda>n. root n c) \<longlonglongrightarrow> 1"  | 
| 
60141
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
766  | 
proof -  | 
| 63467 | 767  | 
have ge_1: "(\<lambda>n. root n c) \<longlonglongrightarrow> 1" if "1 \<le> c" for c :: real  | 
768  | 
proof -  | 
|
| 63040 | 769  | 
define x where "x n = root n c - 1" for n  | 
| 61969 | 770  | 
have "x \<longlonglongrightarrow> 0"  | 
| 
60141
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
771  | 
proof (rule tendsto_sandwich[OF _ _ tendsto_const])  | 
| 61969 | 772  | 
show "(\<lambda>n. c / n) \<longlonglongrightarrow> 0"  | 
| 
60141
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
773  | 
by (intro tendsto_divide_0[OF tendsto_const] filterlim_mono[OF filterlim_real_sequentially])  | 
| 63467 | 774  | 
(simp_all add: at_infinity_eq_at_top_bot)  | 
775  | 
have "x n \<le> c / n" if "1 < n" for n :: nat  | 
|
776  | 
proof -  | 
|
| 
60141
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
777  | 
have "1 + x n * n = 1 + of_nat (n choose 1) * x n^1"  | 
| 
63417
 
c184ec919c70
more lemmas to emphasize {0::nat..(<)n} as canonical representation of intervals on nat
 
haftmann 
parents: 
63367 
diff
changeset
 | 
778  | 
by (simp add: choose_one)  | 
| 
60141
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
779  | 
        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
 | 
780  | 
by (simp add: x_def)  | 
| 
68077
 
ee8c13ae81e9
Some tidying up (mostly regarding summations from 0)
 
paulson <lp15@cam.ac.uk> 
parents: 
67685 
diff
changeset
 | 
781  | 
also have "\<dots> \<le> (\<Sum>k\<le>n. of_nat (n choose k) * x n^k)"  | 
| 63467 | 782  | 
using \<open>1 < n\<close> \<open>1 \<le> c\<close>  | 
| 64267 | 783  | 
by (intro sum_mono2)  | 
| 63467 | 784  | 
(auto intro!: mult_nonneg_nonneg zero_le_power simp: x_def le_diff_eq)  | 
| 
60141
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
785  | 
also have "\<dots> = (x n + 1) ^ n"  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
786  | 
by (simp add: binomial_ring)  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
787  | 
also have "\<dots> = c"  | 
| 60758 | 788  | 
using \<open>1 < n\<close> \<open>1 \<le> c\<close> by (simp add: x_def)  | 
| 63467 | 789  | 
finally show ?thesis  | 
790  | 
using \<open>1 \<le> c\<close> \<open>1 < n\<close> by (simp add: field_simps)  | 
|
791  | 
qed  | 
|
| 
60141
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
792  | 
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
 | 
793  | 
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
 | 
794  | 
show "eventually (\<lambda>n. 0 \<le> x n) sequentially"  | 
| 63467 | 795  | 
using \<open>1 \<le> c\<close>  | 
796  | 
by (auto intro!: exI[of _ 1] simp: eventually_sequentially le_diff_eq x_def)  | 
|
| 
60141
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
797  | 
qed  | 
| 63467 | 798  | 
from tendsto_add[OF this tendsto_const[of 1]] show ?thesis  | 
799  | 
by (simp add: x_def)  | 
|
800  | 
qed  | 
|
| 
60141
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
801  | 
show ?thesis  | 
| 63467 | 802  | 
proof (cases "1 \<le> c")  | 
803  | 
case True  | 
|
804  | 
with ge_1 show ?thesis by blast  | 
|
| 
60141
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
805  | 
next  | 
| 63467 | 806  | 
case False  | 
| 60758 | 807  | 
with \<open>0 < c\<close> have "1 \<le> 1 / c"  | 
| 
60141
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
808  | 
by simp  | 
| 61969 | 809  | 
then have "(\<lambda>n. 1 / root n (1 / c)) \<longlonglongrightarrow> 1 / 1"  | 
| 60758 | 810  | 
by (intro tendsto_divide tendsto_const ge_1 \<open>1 \<le> 1 / c\<close> one_neq_zero)  | 
| 
60141
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
811  | 
then show ?thesis  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
812  | 
by (rule filterlim_cong[THEN iffD1, rotated 3])  | 
| 63467 | 813  | 
(auto intro!: exI[of _ 1] simp: eventually_sequentially real_root_divide)  | 
| 
60141
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
814  | 
qed  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
815  | 
qed  | 
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
816  | 
|
| 
 
833adf7db7d8
New material, mostly about limits. Consolidation.
 
paulson <lp15@cam.ac.uk> 
parents: 
59741 
diff
changeset
 | 
817  | 
|
| 
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
 | 
818  | 
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
 | 
819  | 
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
 | 
820  | 
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
 | 
821  | 
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
 | 
822  | 
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
 | 
823  | 
|
| 14324 | 824  | 
end  |