Skip to content

Commit

Permalink
feat: lemmas about derivatives of affine maps (#4508)
Browse files Browse the repository at this point in the history
  • Loading branch information
urkud committed Jun 1, 2023
1 parent 34e8b42 commit 859c9ce
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 0 deletions.
1 change: 1 addition & 0 deletions Mathlib.lean
Expand Up @@ -420,6 +420,7 @@ import Mathlib.Analysis.Calculus.Conformal.NormedSpace
import Mathlib.Analysis.Calculus.ContDiffDef
import Mathlib.Analysis.Calculus.Darboux
import Mathlib.Analysis.Calculus.Deriv.Add
import Mathlib.Analysis.Calculus.Deriv.AffineMap
import Mathlib.Analysis.Calculus.Deriv.Basic
import Mathlib.Analysis.Calculus.Deriv.Comp
import Mathlib.Analysis.Calculus.Deriv.Inv
Expand Down
10 changes: 10 additions & 0 deletions Mathlib/Analysis/Calculus/Deriv/Add.lean
Expand Up @@ -83,6 +83,11 @@ theorem deriv_add (hf : DifferentiableAt π•œ f x) (hg : DifferentiableAt π•œ g
(hf.hasDerivAt.add hg.hasDerivAt).deriv
#align deriv_add deriv_add

-- porting note: new theorem
theorem HasStrictDerivAt.add_const (c : F) (hf : HasStrictDerivAt f f' x) :
HasStrictDerivAt (fun y ↦ f y + c) f' x :=
add_zero f' β–Έ hf.add (hasStrictDerivAt_const x c)

theorem HasDerivAtFilter.add_const (hf : HasDerivAtFilter f f' x L) (c : F) :
HasDerivAtFilter (fun y => f y + c) f' x L :=
add_zero f' β–Έ hf.add (hasDerivAtFilter_const x L c)
Expand Down Expand Up @@ -112,6 +117,11 @@ theorem deriv_add_const' (c : F) : (deriv fun y => f y + c) = deriv f :=
funext fun _ => deriv_add_const c
#align deriv_add_const' deriv_add_const'

-- porting note: new theorem
theorem HasStrictDerivAt.const_add (c : F) (hf : HasStrictDerivAt f f' x) :
HasStrictDerivAt (fun y ↦ c + f y) f' x :=
zero_add f' β–Έ (hasStrictDerivAt_const x c).add hf

theorem HasDerivAtFilter.const_add (c : F) (hf : HasDerivAtFilter f f' x L) :
HasDerivAtFilter (fun y => c + f y) f' x L :=
zero_add f' β–Έ (hasDerivAtFilter_const x L c).add hf
Expand Down
73 changes: 73 additions & 0 deletions Mathlib/Analysis/Calculus/Deriv/AffineMap.lean
@@ -0,0 +1,73 @@
/-
Copyright (c) 2023 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
-/
import Mathlib.Analysis.Calculus.Deriv.Add
import Mathlib.Analysis.Calculus.Deriv.Linear
import Mathlib.LinearAlgebra.AffineSpace.AffineMap
/-!
# Derivatives of affine maps
In this file we prove formulas for one-dimensional derivatives of affine maps `f : π•œ →ᡃ[π•œ] E`. We
also specialise some of these results to `AffineMap.lineMap` because it is useful to transfer MVT
from dimension 1 to a domain in higher dimension.
## TODO
Add theorems about `deriv`s and `fderiv`s of `ContinuousAffineMap`s once they will be ported to
Mathlib 4.
## Keywords
affine map, derivative, differentiability
-/

variable {π•œ : Type _} [NontriviallyNormedField π•œ]
{E : Type _} [NormedAddCommGroup E] [NormedSpace π•œ E]
(f : π•œ →ᡃ[π•œ] E) {a b : E} {L : Filter π•œ} {s : Set π•œ} {x : π•œ}

namespace AffineMap

theorem hasStrictDerivAt : HasStrictDerivAt f (f.linear 1) x := by
rw [f.decomp]
exact f.linear.hasStrictDerivAt.add_const (f 0)

theorem hasDerivAtFilter : HasDerivAtFilter f (f.linear 1) x L := by
rw [f.decomp]
exact f.linear.hasDerivAtFilter.add_const (f 0)

theorem hasDerivWithinAt : HasDerivWithinAt f (f.linear 1) s x := f.hasDerivAtFilter
theorem hasDerivAt : HasDerivAt f (f.linear 1) x := f.hasDerivAtFilter

protected theorem derivWithin (hs : UniqueDiffWithinAt π•œ s x) :
derivWithin f s x = f.linear 1 :=
f.hasDerivWithinAt.derivWithin hs

@[simp] protected theorem deriv : deriv f x = f.linear 1 := f.hasDerivAt.deriv

protected theorem differentiableAt : DifferentiableAt π•œ f x := f.hasDerivAt.differentiableAt
protected theorem differentiable : Differentiable π•œ f := fun _ ↦ f.differentiableAt

protected theorem differentiableWithinAt : DifferentiableWithinAt π•œ f s x :=
f.differentiableAt.differentiableWithinAt

protected theorem differentiableOn : DifferentiableOn π•œ f s := fun _ _ ↦ f.differentiableWithinAt

/-!
### Line map
In this section we specialize some lemmas to `AffineMap.lineMap` because this map is very useful to
deduce higher dimensional lemmas from one-dimensional versions.
-/

theorem hasStrictDerivAt_lineMap : HasStrictDerivAt (lineMap a b) (b - a) x := by
simpa using (lineMap a b : π•œ →ᡃ[π•œ] E).hasStrictDerivAt

theorem hasDerivAt_lineMap : HasDerivAt (lineMap a b) (b - a) x :=
hasStrictDerivAt_lineMap.hasDerivAt

theorem hasDerivWithinAt_lineMap : HasDerivWithinAt (lineMap a b) (b - a) s x :=
hasDerivAt_lineMap.hasDerivWithinAt

end AffineMap

0 comments on commit 859c9ce

Please sign in to comment.