Skip to content

Commit 3ed173e

Browse files
committed
feat: mfderivWithin_{add,neg,sub} (leanprover-community#39451)
Add some lemmas for `HasMFDerivWithinAt` and `mfderivWithin` at whose corresponding versions without a set already existed. Part of leanprover-community#36036, i.e. from the path towards the Levi-Civita connection and fixing defeq abuses related to tangent space and scalar multiplication in mathlib.
1 parent e12bcd0 commit 3ed173e

1 file changed

Lines changed: 45 additions & 4 deletions

File tree

Mathlib/Geometry/Manifold/MFDeriv/SpecificFunctions.lean

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,12 @@ theorem mfderiv_add (hf : MDiffAt f z) (hg : MDiffAt g z) :
790790
(by exact mfderiv% f z) + (by exact mfderiv% g z) :=
791791
(hf.hasMFDerivAt.add hg.hasMFDerivAt).mfderiv
792792

793+
theorem mfderivWithin_add (hf : MDiffAt[s] f z) (hg : MDiffAt[s] g z)
794+
(hs : UniqueMDiffWithinAt I s z) :
795+
(mfderiv[s] (f + g) z : TangentSpace I z →L[𝕜] E') =
796+
(by exact mfderiv[s] f z) + (by exact mfderiv[s] g z) :=
797+
(hf.hasMFDerivWithinAt.add hg.hasMFDerivWithinAt).mfderivWithin hs
798+
793799
section sum
794800
variable {ι : Type} {t : Finset ι} {f : ι → M → E'} {f' : ι → TangentSpace I z →L[𝕜] E'}
795801

@@ -821,13 +827,23 @@ lemma MDifferentiable.sum (hf : ∀ i ∈ t, MDiff (f i)) : MDiff (∑ i ∈ t,
821827

822828
end sum
823829

830+
theorem HasMFDerivWithinAt.const_smul (hf : HasMFDerivAt[s] f z f') (a : 𝕜) :
831+
HasMFDerivAt[s] (a • f) z (a • f') :=
832+
⟨hf.1.const_smul a, hf.2.const_smul a⟩
833+
824834
theorem HasMFDerivAt.const_smul (hf : HasMFDerivAt% f z f') (s : 𝕜) :
825835
HasMFDerivAt% (s • f) z (s • f') :=
826836
⟨hf.1.const_smul s, hf.2.const_smul s⟩
827837

838+
theorem MDifferentiableWithinAt.const_smul (hf : MDiffAt[s] f z) (a : 𝕜) : MDiffAt[s] (a • f) z :=
839+
(hf.hasMFDerivWithinAt.const_smul a).mdifferentiableWithinAt
840+
828841
theorem MDifferentiableAt.const_smul (hf : MDiffAt f z) (s : 𝕜) : MDiffAt (s • f) z :=
829842
(hf.hasMFDerivAt.const_smul s).mdifferentiableAt
830843

844+
theorem MDifferentiableOn.const_smul (a : 𝕜) (hf : MDiff[s] f) : MDiff[s] (a • f) :=
845+
fun x hx ↦ (hf x hx).const_smul a
846+
831847
theorem MDifferentiable.const_smul (s : 𝕜) (hf : MDiff f) : MDiff (s • f) :=
832848
fun x ↦ (hf x).const_smul s
833849

@@ -853,28 +869,53 @@ theorem MDifferentiableAt.neg (hf : MDiffAt f z) : MDiffAt (-f) z :=
853869
theorem MDifferentiableOn.neg {s : Set M} (hf : MDiff[s] f) : MDiff[s] (-f) :=
854870
fun x hx ↦ (hf x hx).neg
855871

872+
theorem mdifferentiableWithinAt_neg : MDiffAt[s] (-f) z ↔ MDiffAt[s] f z :=
873+
fun hf ↦ by convert hf.neg; rw [neg_neg], fun hf ↦ hf.neg⟩
874+
856875
theorem mdifferentiableAt_neg : MDiffAt (-f) z ↔ MDiffAt f z :=
857876
fun hf ↦ by convert hf.neg; rw [neg_neg], fun hf ↦ hf.neg⟩
858877

859878
theorem MDifferentiable.neg (hf : MDiff f) : MDiff (-f) := fun x ↦ (hf x).neg
860879

861880
set_option backward.isDefEq.respectTransparency false in
881+
theorem mfderivWithin_neg (f : M → E') (x : M) (hs : UniqueMDiffWithinAt I s x) :
882+
mfderiv[s] (-f) x = -mfderiv[s] f x := by
883+
simp_rw [mfderivWithin]
884+
by_cases hf : MDiffAt[s] f x
885+
· exact hf.hasMFDerivWithinAt.neg.mfderivWithin hs
886+
· rw [if_neg hf]; rw [← mdifferentiableWithinAt_neg] at hf; rw [if_neg hf, neg_zero]
887+
862888
theorem mfderiv_neg (f : M → E') (x : M) : mfderiv% (-f) x = -mfderiv% f x := by
863-
simp_rw [mfderiv]
864-
by_cases hf : MDiffAt f x
865-
· exact hf.hasMFDerivAt.neg.mfderiv
866-
· rw [if_neg hf]; rw [← mdifferentiableAt_neg] at hf; rw [if_neg hf, neg_zero]
889+
rw [← mfderivWithin_univ, mfderivWithin_neg _ _ (uniqueMDiffWithinAt_univ I), mfderivWithin_univ]
890+
891+
theorem HasMFDerivWithinAt.sub (hf : HasMFDerivAt[s] f z f') (hg : HasMFDerivAt[s] g z g') :
892+
HasMFDerivAt[s] (f - g) z (f' - g') :=
893+
⟨hf.1.sub hg.1, hf.2.sub hg.2
867894

868895
theorem HasMFDerivAt.sub (hf : HasMFDerivAt% f z f') (hg : HasMFDerivAt% g z g') :
869896
HasMFDerivAt% (f - g) z (f' - g') :=
870897
⟨hf.1.sub hg.1, hf.2.sub hg.2
871898

899+
theorem MDifferentiableWithinAt.sub (hf : MDiffAt[s] f z) (hg : MDiffAt[s] g z) :
900+
MDiffAt[s] (f - g) z :=
901+
(hf.hasMFDerivWithinAt.sub hg.hasMFDerivWithinAt).mdifferentiableWithinAt
902+
872903
theorem MDifferentiableAt.sub (hf : MDiffAt f z) (hg : MDiffAt g z) : MDiffAt (f - g) z :=
873904
(hf.hasMFDerivAt.sub hg.hasMFDerivAt).mdifferentiableAt
874905

906+
theorem MDifferentiableOn.sub (hf : MDiff[s] f) (hg : MDiff[s] g) :
907+
MDiff[s] (f - g) :=
908+
fun x hx ↦ (hf x hx).sub (hg x hx)
909+
875910
theorem MDifferentiable.sub (hf : MDiff f) (hg : MDiff g) : MDiff (f - g) :=
876911
fun x ↦ (hf x).sub (hg x)
877912

913+
theorem mfderivWithin_sub (hf : MDiffAt[s] f z) (hg : MDiffAt[s] g z)
914+
(hs : UniqueMDiffWithinAt I s z) :
915+
(mfderiv[s] (f - g) z : TangentSpace I z →L[𝕜] E') =
916+
(by exact mfderiv[s] f z) - (by exact mfderiv[s] g z) :=
917+
(hf.hasMFDerivWithinAt.sub hg.hasMFDerivWithinAt).mfderivWithin hs
918+
878919
theorem mfderiv_sub (hf : MDiffAt f z) (hg : MDiffAt g z) :
879920
(mfderiv% (f - g) z : TangentSpace I z →L[𝕜] E') =
880921
(by exact mfderiv% f z) - (by exact mfderiv% g z) :=

0 commit comments

Comments
 (0)