Skip to content

Commit

Permalink
feat: port Analysis.Calculus.FDeriv.RestrictScalars (#4186)
Browse files Browse the repository at this point in the history
  • Loading branch information
Parcly-Taxel committed May 22, 2023
1 parent d02b929 commit 7634824
Show file tree
Hide file tree
Showing 2 changed files with 127 additions and 0 deletions.
1 change: 1 addition & 0 deletions Mathlib.lean
Expand Up @@ -380,6 +380,7 @@ import Mathlib.Analysis.BoxIntegral.Partition.Tagged
import Mathlib.Analysis.Calculus.FDeriv.Basic
import Mathlib.Analysis.Calculus.FDeriv.Comp
import Mathlib.Analysis.Calculus.FDeriv.Linear
import Mathlib.Analysis.Calculus.FDeriv.RestrictScalars
import Mathlib.Analysis.Calculus.TangentCone
import Mathlib.Analysis.Complex.Basic
import Mathlib.Analysis.Complex.Circle
Expand Down
126 changes: 126 additions & 0 deletions Mathlib/Analysis/Calculus/FDeriv/RestrictScalars.lean
@@ -0,0 +1,126 @@
/-
Copyright (c) 2019 Jeremy Avigad. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jeremy Avigad, SΓ©bastien GouΓ«zel, Yury Kudryashov
! This file was ported from Lean 3 source module analysis.calculus.fderiv.restrict_scalars
! leanprover-community/mathlib commit e3fb84046afd187b710170887195d50bada934ee
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
import Mathlib.Analysis.Calculus.FDeriv.Basic

/-!
# The derivative of the scalar restriction of a linear map
For detailed documentation of the FrΓ©chet derivative,
see the module docstring of `Analysis/Calculus/FDeriv/Basic.lean`.
This file contains the usual formulas (and existence assertions) for the derivative of
the scalar restriction of a linear map.
-/


open Filter Asymptotics ContinuousLinearMap Set Metric

open Topology Classical NNReal Filter Asymptotics ENNReal

noncomputable section

section RestrictScalars

/-!
### Restricting from `β„‚` to `ℝ`, or generally from `π•œ'` to `π•œ`
If a function is differentiable over `β„‚`, then it is differentiable over `ℝ`. In this paragraph,
we give variants of this statement, in the general situation where `β„‚` and `ℝ` are replaced
respectively by `π•œ'` and `π•œ` where `π•œ'` is a normed algebra over `π•œ`.
-/


variable (π•œ : Type _) [NontriviallyNormedField π•œ]

variable {π•œ' : Type _} [NontriviallyNormedField π•œ'] [NormedAlgebra π•œ π•œ']

variable {E : Type _} [NormedAddCommGroup E] [NormedSpace π•œ E] [NormedSpace π•œ' E]

variable [IsScalarTower π•œ π•œ' E]

variable {F : Type _} [NormedAddCommGroup F] [NormedSpace π•œ F] [NormedSpace π•œ' F]

variable [IsScalarTower π•œ π•œ' F]

variable {f : E β†’ F} {f' : E β†’L[π•œ'] F} {s : Set E} {x : E}

theorem HasStrictFDerivAt.restrictScalars (h : HasStrictFDerivAt f f' x) :
HasStrictFDerivAt f (f'.restrictScalars π•œ) x :=
h
#align has_strict_fderiv_at.restrict_scalars HasStrictFDerivAt.restrictScalars

theorem HasFDerivAtFilter.restrictScalars {L} (h : HasFDerivAtFilter f f' x L) :
HasFDerivAtFilter f (f'.restrictScalars π•œ) x L :=
h
#align has_fderiv_at_filter.restrict_scalars HasFDerivAtFilter.restrictScalars

theorem HasFDerivAt.restrictScalars (h : HasFDerivAt f f' x) :
HasFDerivAt f (f'.restrictScalars π•œ) x :=
h
#align has_fderiv_at.restrict_scalars HasFDerivAt.restrictScalars

theorem HasFDerivWithinAt.restrictScalars (h : HasFDerivWithinAt f f' s x) :
HasFDerivWithinAt f (f'.restrictScalars π•œ) s x :=
h
#align has_fderiv_within_at.restrict_scalars HasFDerivWithinAt.restrictScalars

theorem DifferentiableAt.restrictScalars (h : DifferentiableAt π•œ' f x) : DifferentiableAt π•œ f x :=
(h.hasFDerivAt.restrictScalars π•œ).differentiableAt
#align differentiable_at.restrict_scalars DifferentiableAt.restrictScalars

theorem DifferentiableWithinAt.restrictScalars (h : DifferentiableWithinAt π•œ' f s x) :
DifferentiableWithinAt π•œ f s x :=
(h.hasFDerivWithinAt.restrictScalars π•œ).differentiableWithinAt
#align differentiable_within_at.restrict_scalars DifferentiableWithinAt.restrictScalars

theorem DifferentiableOn.restrictScalars (h : DifferentiableOn π•œ' f s) : DifferentiableOn π•œ f s :=
fun x hx => (h x hx).restrictScalars π•œ
#align differentiable_on.restrict_scalars DifferentiableOn.restrictScalars

theorem Differentiable.restrictScalars (h : Differentiable π•œ' f) : Differentiable π•œ f := fun x =>
(h x).restrictScalars π•œ
#align differentiable.restrict_scalars Differentiable.restrictScalars

theorem hasFDerivWithinAt_of_restrictScalars {g' : E β†’L[π•œ] F} (h : HasFDerivWithinAt f g' s x)
(H : f'.restrictScalars π•œ = g') : HasFDerivWithinAt f f' s x := by
rw [← H] at h
exact h
#align has_fderiv_within_at_of_restrict_scalars hasFDerivWithinAt_of_restrictScalars

theorem hasFDerivAt_of_restrictScalars {g' : E β†’L[π•œ] F} (h : HasFDerivAt f g' x)
(H : f'.restrictScalars π•œ = g') : HasFDerivAt f f' x := by
rw [← H] at h
exact h
#align has_fderiv_at_of_restrict_scalars hasFDerivAt_of_restrictScalars

theorem DifferentiableAt.fderiv_restrictScalars (h : DifferentiableAt π•œ' f x) :
fderiv π•œ f x = (fderiv π•œ' f x).restrictScalars π•œ :=
(h.hasFDerivAt.restrictScalars π•œ).fderiv
#align differentiable_at.fderiv_restrict_scalars DifferentiableAt.fderiv_restrictScalars

theorem differentiableWithinAt_iff_restrictScalars (hf : DifferentiableWithinAt π•œ f s x)
(hs : UniqueDiffWithinAt π•œ s x) : DifferentiableWithinAt π•œ' f s x ↔
βˆƒ g' : E β†’L[π•œ'] F, g'.restrictScalars π•œ = fderivWithin π•œ f s x := by
constructor
· rintro ⟨g', hg'⟩
exact ⟨g', hs.eq (hg'.restrictScalars π•œ) hf.hasFDerivWithinAt⟩
· rintro ⟨f', hf'⟩
exact ⟨f', hasFDerivWithinAt_of_restrictScalars π•œ hf.hasFDerivWithinAt hf'⟩
#align differentiable_within_at_iff_restrict_scalars differentiableWithinAt_iff_restrictScalars

theorem differentiableAt_iff_restrictScalars (hf : DifferentiableAt π•œ f x) :
DifferentiableAt π•œ' f x ↔ βˆƒ g' : E β†’L[π•œ'] F, g'.restrictScalars π•œ = fderiv π•œ f x := by
rw [← differentiableWithinAt_univ, ← fderivWithin_univ]
exact
differentiableWithinAt_iff_restrictScalars π•œ hf.differentiableWithinAt uniqueDiffWithinAt_univ
#align differentiable_at_iff_restrict_scalars differentiableAt_iff_restrictScalars

end RestrictScalars

0 comments on commit 7634824

Please sign in to comment.