Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: port Analysis.Calculus.Deriv.Pow (#4441)
- Loading branch information
Showing
2 changed files
with
126 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
/- | ||
Copyright (c) 2019 SΓ©bastien GouΓ«zel. All rights reserved. | ||
Released under Apache 2.0 license as described in the file LICENSE. | ||
Authors: SΓ©bastien GouΓ«zel | ||
! This file was ported from Lean 3 source module analysis.calculus.deriv.pow | ||
! leanprover-community/mathlib commit 3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe | ||
! Please do not edit these lines, except to modify the commit id | ||
! if you have ported upstream changes. | ||
-/ | ||
import Mathlib.Analysis.Calculus.Deriv.Mul | ||
import Mathlib.Analysis.Calculus.Deriv.Comp | ||
|
||
/-! | ||
# Derivative of `(f x) ^ n`, `n : β` | ||
In this file we prove that `(x ^ n)' = n * x ^ (n - 1)`, where `n` is a natural number. | ||
For a more detailed overview of one-dimensional derivatives in mathlib, see the module docstring of | ||
`Analysis/Calculus/Deriv/Basic`. | ||
## Keywords | ||
derivative, power | ||
-/ | ||
|
||
universe u v w | ||
|
||
open Classical Topology BigOperators Filter ENNReal | ||
|
||
open Filter Asymptotics Set | ||
|
||
variable {π : Type u} [NontriviallyNormedField π] | ||
|
||
variable {F : Type v} [NormedAddCommGroup F] [NormedSpace π F] | ||
|
||
variable {E : Type w} [NormedAddCommGroup E] [NormedSpace π E] | ||
|
||
variable {f fβ fβ g : π β F} | ||
|
||
variable {f' fβ' fβ' g' : F} | ||
|
||
variable {x : π} | ||
|
||
variable {s t : Set π} | ||
|
||
variable {L Lβ Lβ : Filter π} | ||
|
||
/-! ### Derivative of `x β¦ x^n` for `n : β` -/ | ||
|
||
variable {c : π β π} {c' : π} | ||
|
||
variable (n : β) | ||
|
||
theorem hasStrictDerivAt_pow : | ||
β (n : β) (x : π), HasStrictDerivAt (fun x : π β¦ x ^ n) ((n : π) * x ^ (n - 1)) x | ||
| 0, x => by simp [hasStrictDerivAt_const] | ||
| 1, x => by simpa using hasStrictDerivAt_id x | ||
| n + 1 + 1, x => by | ||
simpa [pow_succ', add_mul, mul_assoc] using | ||
(hasStrictDerivAt_pow (n + 1) x).mul (hasStrictDerivAt_id x) | ||
#align has_strict_deriv_at_pow hasStrictDerivAt_pow | ||
|
||
theorem hasDerivAt_pow (n : β) (x : π) : | ||
HasDerivAt (fun x : π => x ^ n) ((n : π) * x ^ (n - 1)) x := | ||
(hasStrictDerivAt_pow n x).hasDerivAt | ||
#align has_deriv_at_pow hasDerivAt_pow | ||
|
||
theorem hasDerivWithinAt_pow (n : β) (x : π) (s : Set π) : | ||
HasDerivWithinAt (fun x : π => x ^ n) ((n : π) * x ^ (n - 1)) s x := | ||
(hasDerivAt_pow n x).hasDerivWithinAt | ||
#align has_deriv_within_at_pow hasDerivWithinAt_pow | ||
|
||
theorem differentiableAt_pow : DifferentiableAt π (fun x : π => x ^ n) x := | ||
(hasDerivAt_pow n x).differentiableAt | ||
#align differentiable_at_pow differentiableAt_pow | ||
|
||
theorem differentiableWithinAt_pow : | ||
DifferentiableWithinAt π (fun x : π => x ^ n) s x := | ||
(differentiableAt_pow n).differentiableWithinAt | ||
#align differentiable_within_at_pow differentiableWithinAt_pow | ||
|
||
theorem differentiable_pow : Differentiable π fun x : π => x ^ n := fun _ => differentiableAt_pow n | ||
#align differentiable_pow differentiable_pow | ||
|
||
theorem differentiableOn_pow : DifferentiableOn π (fun x : π => x ^ n) s := | ||
(differentiable_pow n).differentiableOn | ||
#align differentiable_on_pow differentiableOn_pow | ||
|
||
theorem deriv_pow : deriv (fun x : π => x ^ n) x = (n : π) * x ^ (n - 1) := | ||
(hasDerivAt_pow n x).deriv | ||
#align deriv_pow deriv_pow | ||
|
||
@[simp] | ||
theorem deriv_pow' : (deriv fun x : π => x ^ n) = fun x => (n : π) * x ^ (n - 1) := | ||
funext fun _ => deriv_pow n | ||
#align deriv_pow' deriv_pow' | ||
|
||
theorem derivWithin_pow (hxs : UniqueDiffWithinAt π s x) : | ||
derivWithin (fun x : π => x ^ n) s x = (n : π) * x ^ (n - 1) := | ||
(hasDerivWithinAt_pow n x s).derivWithin hxs | ||
#align deriv_within_pow derivWithin_pow | ||
|
||
theorem HasDerivWithinAt.pow (hc : HasDerivWithinAt c c' s x) : | ||
HasDerivWithinAt (fun y => c y ^ n) ((n : π) * c x ^ (n - 1) * c') s x := | ||
(hasDerivAt_pow n (c x)).comp_hasDerivWithinAt x hc | ||
#align has_deriv_within_at.pow HasDerivWithinAt.pow | ||
|
||
theorem HasDerivAt.pow (hc : HasDerivAt c c' x) : | ||
HasDerivAt (fun y => c y ^ n) ((n : π) * c x ^ (n - 1) * c') x := by | ||
rw [β hasDerivWithinAt_univ] at * | ||
exact hc.pow n | ||
#align has_deriv_at.pow HasDerivAt.pow | ||
|
||
theorem derivWithin_pow' (hc : DifferentiableWithinAt π c s x) (hxs : UniqueDiffWithinAt π s x) : | ||
derivWithin (fun x => c x ^ n) s x = (n : π) * c x ^ (n - 1) * derivWithin c s x := | ||
(hc.hasDerivWithinAt.pow n).derivWithin hxs | ||
#align deriv_within_pow' derivWithin_pow' | ||
|
||
@[simp] | ||
theorem deriv_pow'' (hc : DifferentiableAt π c x) : | ||
deriv (fun x => c x ^ n) x = (n : π) * c x ^ (n - 1) * deriv c x := | ||
(hc.hasDerivAt.pow n).deriv | ||
#align deriv_pow'' deriv_pow'' | ||
|