@@ -3,103 +3,169 @@ Copyright (c) 2019 SΓ©bastien GouΓ«zel. All rights reserved.
3
3
Released under Apache 2.0 license as described in the file LICENSE.
4
4
Authors: SΓ©bastien GouΓ«zel
5
5
-/
6
- import Mathlib.Analysis.Calculus.Deriv.Mul
7
- import Mathlib.Analysis.Calculus.Deriv.Comp
6
+ import Mathlib.Analysis.Calculus.FDeriv.Pow
8
7
9
8
/-!
10
9
# Derivative of `(f x) ^ n`, `n : β`
11
10
12
- In this file we prove that `(x ^ n)' = n * x ^ (n - 1)`, where `n` is a natural number.
11
+ In this file we prove that the FrΓ©chet derivative of `fun x => f x ^ n`,
12
+ where `n` is a natural number, is `n * f x ^ (n - 1) * f'`.
13
+ Additionally, we prove the case for non-commutative rings (with primed names like `deriv_pow'`),
14
+ where the result is instead `β i β Finset.range n, f x ^ (n.pred - i) * f' * f x ^ i`.
13
15
14
16
For a more detailed overview of one-dimensional derivatives in mathlib, see the module docstring of
15
- `Analysis/Calculus/Deriv/Basic`.
17
+ `Mathlib/ Analysis/Calculus/Deriv/Basic.lean `.
16
18
17
19
## Keywords
18
20
19
21
derivative, power
20
22
-/
21
23
22
- universe u
23
-
24
- variable {π : Type u} [NontriviallyNormedField π] {x : π} {s : Set π}
24
+ variable {π πΈ : Type *}
25
+
26
+ section NormedRing
27
+ variable [NontriviallyNormedField π] [NormedRing πΈ]
28
+ variable [NormedAlgebra π πΈ] {f : π β πΈ} {f' : πΈ} {x : π} {s : Set π}
29
+
30
+ nonrec theorem HasStrictDerivAt.fun_pow' (h : HasStrictDerivAt f f' x) (n : β) :
31
+ HasStrictDerivAt (fun x β¦ f x ^ n)
32
+ (β i β Finset.range n, f x ^ (n.pred - i) * f' * f x ^ i) x := by
33
+ unfold HasStrictDerivAt
34
+ convert h.pow' n
35
+ ext
36
+ simp
37
+
38
+ nonrec theorem HasStrictDerivAt.pow' (h : HasStrictDerivAt f f' x) (n : β) :
39
+ HasStrictDerivAt (f ^ n)
40
+ (β i β Finset.range n, f x ^ (n.pred - i) * f' * f x ^ i) x := h.fun_pow' n
41
+
42
+ nonrec theorem HasDerivWithinAt.fun_pow' (h : HasDerivWithinAt f f' s x) (n : β) :
43
+ HasDerivWithinAt (fun x β¦ f x ^ n)
44
+ (β i β Finset.range n, f x ^ (n.pred - i) * f' * f x ^ i) s x := by
45
+ simpa using h.hasFDerivWithinAt.pow' n |>.hasDerivWithinAt
46
+
47
+ nonrec theorem HasDerivWithinAt.pow' (h : HasDerivWithinAt f f' s x) (n : β) :
48
+ HasDerivWithinAt (f ^ n)
49
+ (β i β Finset.range n, f x ^ (n.pred - i) * f' * f x ^ i) s x := h.fun_pow' n
50
+
51
+ theorem HasDerivAt.fun_pow' (h : HasDerivAt f f' x) (n : β) :
52
+ HasDerivAt (fun x β¦ f x ^ n)
53
+ (β i β Finset.range n, f x ^ (n.pred - i) * f' * f x ^ i) x := by
54
+ simpa using h.hasFDerivAt.pow' n |>.hasDerivAt
55
+
56
+ theorem HasDerivAt.pow' (h : HasDerivAt f f' x) (n : β) :
57
+ HasDerivAt (f ^ n)
58
+ (β i β Finset.range n, f x ^ (n.pred - i) * f' * f x ^ i) x := h.fun_pow' n
59
+
60
+ @[simp low]
61
+ theorem derivWithin_fun_pow' (h : DifferentiableWithinAt π f s x) (n : β) :
62
+ derivWithin (fun x => f x ^ n) s x =
63
+ β i β Finset.range n, f x ^ (n.pred - i) * derivWithin f s x * f x ^ i := by
64
+ by_cases hsx : UniqueDiffWithinAt π s x
65
+ Β· exact (h.hasDerivWithinAt.pow' n).derivWithin hsx
66
+ Β· simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]
25
67
26
- /-! ### Derivative of `x β¦ x^n` for `n : β` -/
68
+ @[simp low]
69
+ theorem derivWithin_pow' (h : DifferentiableWithinAt π f s x) (n : β) :
70
+ derivWithin (f ^ n) s x =
71
+ β i β Finset.range n, f x ^ (n.pred - i) * derivWithin f s x * f x ^ i :=
72
+ derivWithin_fun_pow' h n
27
73
28
- variable {c : π β π} {c' : π}
29
- variable (n : β)
74
+ @[simp low]
75
+ theorem deriv_fun_pow' (h : DifferentiableAt π f x) (n : β) :
76
+ deriv (fun x => f x ^ n) x = β i β Finset.range n, f x ^ (n.pred - i) * deriv f x * f x ^ i :=
77
+ (h.hasDerivAt.pow' n).deriv
30
78
31
- theorem hasStrictDerivAt_pow :
32
- β (n : β) (x : π), HasStrictDerivAt (fun x : π β¦ x ^ n) ((n : π) * x ^ (n - 1 )) x
33
- | 0 , x => by simp [hasStrictDerivAt_const]
34
- | 1 , x => by simpa using hasStrictDerivAt_id x
35
- | n + 1 + 1 , x => by
36
- simpa [pow_succ, add_mul, mul_assoc] using
37
- (hasStrictDerivAt_pow (n + 1 ) x).fun_mul (hasStrictDerivAt_id x)
79
+ @[simp low]
80
+ theorem deriv_pow' (h : DifferentiableAt π f x) (n : β) :
81
+ deriv (f ^ n) x = β i β Finset.range n, f x ^ (n.pred - i) * deriv f x * f x ^ i :=
82
+ deriv_fun_pow' h n
38
83
39
- theorem hasDerivAt_pow (n : β) (x : π) :
40
- HasDerivAt (fun x : π => x ^ n) ((n : π) * x ^ (n - 1 )) x :=
41
- (hasStrictDerivAt_pow n x).hasDerivAt
84
+ end NormedRing
42
85
43
- theorem hasDerivWithinAt_pow (n : β) (x : π) (s : Set π) :
44
- HasDerivWithinAt ( fun x : π => x ^ n) ((n : π) * x ^ (n - 1 )) s x :=
45
- (hasDerivAt_pow n x).hasDerivWithinAt
86
+ section NormedCommRing
87
+ variable [NontriviallyNormedField π] [NormedCommRing πΈ]
88
+ variable [NormedAlgebra π πΈ] {f : π β πΈ} {f' : πΈ} {x : π} {s : Set π}
46
89
47
- theorem differentiableAt_pow : DifferentiableAt π (fun x : π => x ^ n) x :=
48
- (hasDerivAt_pow n x).differentiableAt
90
+ open scoped RightActions
49
91
50
- theorem differentiableWithinAt_pow :
51
- DifferentiableWithinAt π (fun x : π => x ^ n) s x :=
52
- (differentiableAt_pow n).differentiableWithinAt
92
+ nonrec theorem HasStrictDerivAt.fun_pow (h : HasStrictDerivAt f f' x) (n : β) :
93
+ HasStrictDerivAt (fun x β¦ f x ^ n) (n * f x ^ (n - 1 ) * f') x := by
94
+ unfold HasStrictDerivAt
95
+ convert h.pow n
96
+ ext
97
+ simp [mul_assoc]
53
98
54
- theorem differentiable_pow : Differentiable π fun x : π => x ^ n := fun _ => differentiableAt_pow n
99
+ nonrec theorem HasStrictDerivAt.pow (h : HasStrictDerivAt f f' x) (n : β) :
100
+ HasStrictDerivAt (f ^ n) (n * f x ^ (n - 1 ) * f') x := h.fun_pow n
55
101
56
- theorem differentiableOn_pow : DifferentiableOn π (fun x : π => x ^ n) s :=
57
- (differentiable_pow n).differentiableOn
102
+ nonrec theorem HasDerivWithinAt.fun_pow (h : HasDerivWithinAt f f' s x) (n : β) :
103
+ HasDerivWithinAt (fun x β¦ f x ^ n) (n * f x ^ (n - 1 ) * f') s x := by
104
+ simpa using h.hasFDerivWithinAt.pow n |>.hasDerivWithinAt
58
105
59
- theorem deriv_pow : deriv ( fun x : π => x ^ n) x = (n : π) * x ^ (n - 1 ) :=
60
- (hasDerivAt_pow n x).deriv
106
+ nonrec theorem HasDerivWithinAt.pow (h : HasDerivWithinAt f f' s x) (n : β) :
107
+ HasDerivWithinAt (f ^ n) (n * f x ^ (n - 1 ) * f') s x := h.fun_pow n
61
108
62
- @[simp]
63
- theorem deriv_pow' : (deriv fun x : π => x ^ n) = fun x => (n : π) * x ^ (n - 1 ) :=
64
- funext fun _ => deriv_pow n
109
+ theorem HasDerivAt.fun_pow (h : HasDerivAt f f' x) (n : β) :
110
+ HasDerivAt ( fun x β¦ f x ^ n) (n * f x ^ (n - 1 ) * f') x := by
111
+ simpa using h.hasFDerivAt.pow n |>.hasDerivAt
65
112
66
- theorem derivWithin_pow (hxs : UniqueDiffWithinAt π s x) :
67
- derivWithin (fun x : π => x ^ n) s x = (n : π) * x ^ (n - 1 ) :=
68
- (hasDerivWithinAt_pow n x s).derivWithin hxs
113
+ theorem HasDerivAt.pow (h : HasDerivAt f f' x) (n : β) :
114
+ HasDerivAt (f ^ n) (n * f x ^ (n - 1 ) * f') x := h.fun_pow n
69
115
70
- theorem HasDerivWithinAt.fun_pow (hc : HasDerivWithinAt c c' s x) :
71
- HasDerivWithinAt (fun y => c y ^ n) ((n : π) * c x ^ (n - 1 ) * c') s x :=
72
- (hasDerivAt_pow n (c x)).comp_hasDerivWithinAt x hc
116
+ @[simp]
117
+ theorem derivWithin_fun_pow (h : DifferentiableWithinAt π f s x) (n : β) :
118
+ derivWithin (fun x => f x ^ n) s x = n * f x ^ (n - 1 ) * derivWithin f s x := by
119
+ by_cases hsx : UniqueDiffWithinAt π s x
120
+ Β· exact (h.hasDerivWithinAt.pow n).derivWithin hsx
121
+ Β· simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]
73
122
74
- theorem HasDerivWithinAt.pow (hc : HasDerivWithinAt c c' s x) :
75
- HasDerivWithinAt (c ^ n) ((n : π) * c x ^ (n - 1 ) * c') s x :=
76
- (hasDerivAt_pow n (c x)).comp_hasDerivWithinAt x hc
123
+ @[simp]
124
+ theorem derivWithin_pow (h : DifferentiableWithinAt π f s x) (n : β) :
125
+ derivWithin (f ^ n) s x = n * f x ^ (n - 1 ) * derivWithin f s x :=
126
+ derivWithin_fun_pow h n
77
127
78
- theorem HasDerivAt.fun_pow (hc : HasDerivAt c c' x) :
79
- HasDerivAt ( fun y => c y ^ n ) (( n : π) * c x ^ (n - 1 ) * c') x := by
80
- rw [β hasDerivWithinAt_univ] at *
81
- exact hc. pow n
128
+ @[simp]
129
+ theorem deriv_fun_pow (h : DifferentiableAt π f x ) (n : β) :
130
+ deriv ( fun x => f x ^ n) x = n * f x ^ (n - 1 ) * deriv f x :=
131
+ (h.hasDerivAt. pow n).deriv
82
132
83
- theorem HasDerivAt.pow (hc : HasDerivAt c c' x) :
84
- HasDerivAt (c ^ n) ((n : π) * c x ^ (n - 1 ) * c') x :=
85
- hc.fun_pow _
133
+ @[simp]
134
+ theorem deriv_pow (h : DifferentiableAt π f x) (n : β) :
135
+ deriv (f ^ n) x = n * f x ^ (n - 1 ) * deriv f x := deriv_fun_pow h n
86
136
87
- theorem derivWithin_fun_pow' (hc : DifferentiableWithinAt π c s x) :
88
- derivWithin (fun x => c x ^ n) s x = (n : π) * c x ^ (n - 1 ) * derivWithin c s x := by
89
- by_cases hsx : UniqueDiffWithinAt π s x
90
- Β· exact (hc.hasDerivWithinAt.pow n).derivWithin hsx
91
- Β· simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]
137
+ end NormedCommRing
92
138
93
- theorem derivWithin_pow' (hc : DifferentiableWithinAt π c s x) :
94
- derivWithin (c ^ n) s x = (n : π) * c x ^ (n - 1 ) * derivWithin c s x :=
95
- derivWithin_fun_pow' _ hc
139
+ section NontriviallyNormedField
140
+ variable [NontriviallyNormedField π] {x : π} {s : Set π} {c : π β π}
96
141
97
- @[simp ]
98
- theorem deriv_fun_pow'' (hc : DifferentiableAt π c x) :
142
+ @[deprecated deriv_fun_pow (since := "2025-07-16") ]
143
+ theorem deriv_fun_pow'' {c : π β π} (n : β) (hc : DifferentiableAt π c x) :
99
144
deriv (fun x => c x ^ n) x = (n : π) * c x ^ (n - 1 ) * deriv c x :=
100
- (hc.hasDerivAt.pow n).deriv
145
+ deriv_fun_pow hc n
101
146
102
- @[simp ]
103
- theorem deriv_pow'' (hc : DifferentiableAt π c x) :
147
+ @[deprecated deriv_pow (since := "2025-07-16") ]
148
+ theorem deriv_pow'' {c : π β π} (n : β) (hc : DifferentiableAt π c x) :
104
149
deriv (c ^ n) x = (n : π) * c x ^ (n - 1 ) * deriv c x :=
105
- (hc.hasDerivAt.pow n).deriv
150
+ deriv_pow hc n
151
+
152
+ theorem hasStrictDerivAt_pow (n : β) (x : π) :
153
+ HasStrictDerivAt (fun x : π β¦ x ^ n) (n * x ^ (n - 1 )) x := by
154
+ simpa using (hasStrictDerivAt_id x).pow n
155
+
156
+ theorem hasDerivWithinAt_pow (n : β) (x : π) :
157
+ HasDerivWithinAt (fun x : π β¦ x ^ n) (n * x ^ (n - 1 )) s x := by
158
+ simpa using (hasDerivWithinAt_id x s).pow n
159
+
160
+ theorem hasDerivAt_pow (n : β) (x : π) :
161
+ HasDerivAt (fun x : π => x ^ n) ((n : π) * x ^ (n - 1 )) x := by
162
+ simpa using (hasStrictDerivAt_pow n x).hasDerivAt
163
+
164
+ theorem derivWithin_pow_field (h : UniqueDiffWithinAt π s x) (n : β) :
165
+ derivWithin (fun x => x ^ n) s x = (n : π) * x ^ (n - 1 ) := by
166
+ rw [derivWithin_fun_pow (differentiableWithinAt_id' (s := s)) n, derivWithin_id' _ _ h, mul_one]
167
+
168
+ theorem deriv_pow_field (n : β) : deriv (fun x => x ^ n) x = (n : π) * x ^ (n - 1 ) := by
169
+ simp
170
+
171
+ end NontriviallyNormedField
0 commit comments