Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Lean/Mathlib/Mathlib/LinearAlgebra/Dual/     Datei vom 15.10.2026 mit Größe 4 kB image not shown  

Quelle  Mul.lean   Sprache: Lean

 

/-
Copyright (c) 2019 Gabriel Ebner. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Gabriel Ebner, Anatole Dedecker, Yury Kudryashov
-/

module

public import Mathlib.Analysis.Calculus.Deriv.Support
public import Mathlib.Analysis.Calculus.FDeriv.Mul

import Mathlib.Analysis.Calculus.FDeriv.CompCLM

/-!
# Derivative of `f x * g x`

In this file we prove formulas for `(f x * g x)'` and `(f x • g x)'`.

For a more detailed overview of one-dimensional derivatives in mathlib, see the module docstring of
`Mathlib/Analysis/Calculus/Deriv/Basic.lean`.

## Keywords

derivative, multiplication
-/

public section

universe u v w

open scoped Topology Filter ENNReal

open Filter Set

variable {�� : Type u} [NontriviallyNormedField ��]
variable {F : Type v} [NormedAddCommGroup F] [NormedSpace �� F]
variable {E : Type w} [NormedAddCommGroup E] [NormedSpace �� E]
variable {G : Type*} [NormedAddCommGroup G] [NormedSpace �� G]
variable {f : �� → F}
variable {f' : F}
variable {x : ��}
variable {s : Set ��}
variable {L : Filter (�� × ��)}

/-! ### Derivative of bilinear maps -/


namespace ContinuousLinearMap

variable {B : E →L[��] F →L[��] G} {u : �� → E} {v : �� → F} {u' : E} {v' : F}

theorem hasDerivWithinAt_of_bilinear
    (hu : HasDerivWithinAt u u' s x) (hv : HasDerivWithinAt v v' s x) :
    HasDerivWithinAt (fun x ↦ B (u x) (v x)) (B (u x) v' + B u' (v x)) s x := by
  simpa using (B.hasFDerivWithinAt_of_bilinear
    hu.hasFDerivWithinAt hv.hasFDerivWithinAt).hasDerivWithinAt

theorem hasDerivAt_of_bilinear (hu : x ∈ tsupport v → HasDerivAt u u' x)
    (hv : x ∈ tsupport u → HasDerivAt v v' x) :
    HasDerivAt (fun x ↦ B (u x) (v x)) (B (u x) v' + B u' (v x)) x := by
  by_cases hxu : x ∈ tsupport u
  · by_cases hxv : x ∈ tsupport v
    · simpa using (B.hasFDerivAt_of_bilinear (hu hxv).hasFDerivAt (hv hxu).hasFDerivAt).hasDerivAt
    · have hx : x ∉ tsupport fun x ↦ B (u x) (v x) :=
        mt (closure_mono (fun x ↦ mt fun h ↦ by simp [h]) ·) hxv
      convert HasDerivAt.of_notMem_tsupport hx
      simp [(hv hxu).unique <| .of_notMem_tsupport hxv, image_eq_zero_of_notMem_tsupport hxv]
  · have hx : x ∉ tsupport fun x ↦ B (u x) (v x) :=
      mt (closure_mono (fun x ↦ mt fun h ↦ by simp [h]) ·) hxu
    convert HasDerivAt.of_notMem_tsupport hx
    by_cases hxv : x ∈ tsupport v
    · simp [image_eq_zero_of_notMem_tsupport hxu, (hu hxv).unique <| .of_notMem_tsupport hxu]
    · simp [image_eq_zero_of_notMem_tsupport hxu, image_eq_zero_of_notMem_tsupport hxv]

theorem hasStrictDerivAt_of_bilinear (hu : HasStrictDerivAt u u' x) (hv : HasStrictDerivAt v v' x) :
    HasStrictDerivAt (fun x ↦ B (u x) (v x)) (B (u x) v' + B u' (v x)) x := by
  simpa using
    (B.hasStrictFDerivAt_of_bilinear hu.hasStrictFDerivAt hv.hasStrictFDerivAt).hasStrictDerivAt

theorem derivWithin_of_bilinear
    (hu : DifferentiableWithinAt �� u s x) (hv : DifferentiableWithinAt �� v s x) :
    derivWithin (fun y => B (u y) (v y)) s x =
      B (u x) (derivWithin v s x) + B (derivWithin u s x) (v x) := by
  by_cases hsx : UniqueDiffWithinAt �� s x
  · exact (B.hasDerivWithinAt_of_bilinear hu.hasDerivWithinAt hv.hasDerivWithinAt).derivWithin hsx
  · simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]

theorem deriv_of_bilinear (hu : x ∈ tsupport v → DifferentiableAt �� u x)
    (hv : x ∈ tsupport u → DifferentiableAt �� v x) :
    deriv (fun y => B (u y) (v y)) x = B (u x) (deriv v x) + B (deriv u x) (v x) :=
  (B.hasDerivAt_of_bilinear (fun hx ↦ (hu hx).hasDerivAt) fun hx ↦ (hv hx).hasDerivAt).deriv

end ContinuousLinearMap

section SMul

/-! ### Derivative of the multiplication of a scalar function and a vector function -/


variable {��' : Type*} [NormedRing ��'] [NormedAlgebra �� ��'] [Module ��' F] [IsBoundedSMul ��' F]
  [IsScalarTower �� ��' F] {c : �� → ��'} {c' : ��'}

@[to_fun]
theorem HasDerivWithinAt.smul (hc : HasDerivWithinAt c c' s x) (hf : HasDerivWithinAt f f' s x) :
    HasDerivWithinAt (c • f) (c x • f' + c' • f x) s x := by
  simpa using (HasFDerivWithinAt.smul hc hf).hasDerivWithinAt

@[to_fun]
theorem HasDerivAt.smul (hc : HasDerivAt c c' x) (hf : HasDerivAt f f' x) :
    HasDerivAt (c • f) (c x • f' + c' • f x) x := by
  rw [← hasDerivWithinAt_univ] at *
  exact hc.smul hf

@[to_fun]
theorem HasStrictDerivAt.smul (hc : HasStrictDerivAt c c' x) (hf : HasStrictDerivAt f f' x) :
    HasStrictDerivAt (c • f) (c x • f' + c' • f x) x := by
  simpa using (HasStrictFDerivAt.smul hc hf).hasStrictDerivAt

theorem derivWithin_fun_smul (hc : DifferentiableWithinAt �� c s x)
    (hf : DifferentiableWithinAt �� f s x) :
    derivWithin (fun y => c y • f y) s x = c x • derivWithin f s x + derivWithin c s x • f x := by
  by_cases hsx : UniqueDiffWithinAt �� s x
  · exact (hc.hasDerivWithinAt.smul hf.hasDerivWithinAt).derivWithin hsx
  · simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]

theorem derivWithin_smul (hc : DifferentiableWithinAt �� c s x)
    (hf : DifferentiableWithinAt �� f s x) :
    derivWithin (c • f) s x = c x • derivWithin f s x + derivWithin c s x • f x :=
  derivWithin_fun_smul hc hf

theorem deriv_fun_smul (hc : DifferentiableAt �� c x) (hf : DifferentiableAt �� f x) :
    deriv (fun y => c y • f y) x = c x • deriv f x + deriv c x • f x :=
  (hc.hasDerivAt.smul hf.hasDerivAt).deriv

theorem deriv_smul (hc : DifferentiableAt �� c x) (hf : DifferentiableAt �� f x) :
    deriv (c • f) x = c x • deriv f x + deriv c x • f x :=
  (hc.hasDerivAt.smul hf.hasDerivAt).deriv

theorem HasStrictDerivAt.smul_const (hc : HasStrictDerivAt c c' x) (f : F) :
    HasStrictDerivAt (fun y => c y • f) (c' • f) x := by
  have := hc.smul (hasStrictDerivAt_const x f)
  rwa [smul_zero, zero_add] at this

theorem HasDerivWithinAt.smul_const (hc : HasDerivWithinAt c c' s x) (f : F) :
    HasDerivWithinAt (fun y => c y • f) (c' • f) s x := by
  have := hc.smul (hasDerivWithinAt_const x s f)
  rwa [smul_zero, zero_add] at this

theorem HasDerivAt.smul_const (hc : HasDerivAt c c' x) (f : F) :
    HasDerivAt (fun y => c y • f) (c' • f) x := by
  rw [← hasDerivWithinAt_univ] at *
  exact hc.smul_const f

-- TODO: Version of this without differentiability assumptions when `c` takes values in a
-- division ring (seems non-trivial)
theorem derivWithin_smul_const (hc : DifferentiableWithinAt �� c s x) (f : F) :
    derivWithin (fun y => c y • f) s x = derivWithin c s x • f := by
  by_cases hsx : UniqueDiffWithinAt �� s x
  · exact (hc.hasDerivWithinAt.smul_const f).derivWithin hsx
  · simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]

theorem deriv_smul_const (hc : DifferentiableAt �� c x) (f : F) :
    deriv (fun y => c y • f) x = deriv c x • f :=
  (hc.hasDerivAt.smul_const f).deriv

end SMul

section ConstSMul

variable
  {R : Type*} [Monoid R] [DistribMulAction R F] [SMulCommClass �� R F] [ContinuousConstSMul R F]
  -- TODO: all results involving `��` would actually work for a `GroupWithZero` if we had a
  -- `DistribMulActionWithZero` typeclass
  {�� : Type*} [DivisionSemiring ��] [Module �� F] [SMulCommClass �� �� F] [ContinuousConstSMul �� F]

@[to_fun]
theorem HasStrictDerivAt.const_smul (c : R) (hf : HasStrictDerivAt f f' x) :
    HasStrictDerivAt (c • f) (c • f') x := by
  simpa using (HasStrictFDerivAt.const_smul hf c).hasStrictDerivAt

@[to_fun]
theorem HasDerivAtFilter.const_smul (c : R) (hf : HasDerivAtFilter f f' L) :
    HasDerivAtFilter (c • f) (c • f') L := by
  simpa using (HasFDerivAtFilter.const_smul hf c).hasDerivAtFilter

@[to_fun]
theorem HasDerivWithinAt.const_smul (c : R) (hf : HasDerivWithinAt f f' s x) :
    HasDerivWithinAt (c • f) (c • f') s x :=
  HasDerivAtFilter.const_smul c hf

@[to_fun]
theorem HasDerivAt.const_smul (c : R) (hf : HasDerivAt f f' x) :
    HasDerivAt (c • f) (c • f') x :=
  HasDerivAtFilter.const_smul c hf

theorem derivWithin_fun_const_smul (c : R) (hf : DifferentiableWithinAt �� f s x) :
    derivWithin (fun y => c • f y) s x = c • derivWithin f s x := by
  by_cases hsx : UniqueDiffWithinAt �� s x
  · exact (hf.hasDerivWithinAt.const_smul c).derivWithin hsx
  · simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]

theorem derivWithin_const_smul (c : R) (hf : DifferentiableWithinAt �� f s x) :
    derivWithin (c • f) s x = c • derivWithin f s x :=
  derivWithin_fun_const_smul c hf

/-- A variant of `derivWithin_fun_const_smul` without differentiability assumption when the scalar
multiplication is by division ring elements. -/

lemma derivWithin_fun_const_smul_field (c : ��) (f : �� → F) :
    derivWithin (fun y ↦ c • f y) s x = c • derivWithin f s x := by
  by_cases hsx : UniqueDiffWithinAt �� s x
  · simp [← fderivWithin_derivWithin, ← Pi.smul_def, fderivWithin_const_smul_field c hsx]
  · simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]

/-- A variant of `derivWithin_const_smul` without differentiability assumption when the scalar
multiplication is by division ring elements. -/

lemma derivWithin_const_smul_field (c : ��) (f : �� → F) :
    derivWithin (c • f) s x = c • derivWithin f s x :=
  derivWithin_fun_const_smul_field c f

theorem deriv_fun_const_smul (c : R) (hf : DifferentiableAt �� f x) :
    deriv (fun y => c • f y) x = c • deriv f x :=
  (hf.hasDerivAt.const_smul c).deriv

theorem deriv_const_smul (c : R) (hf : DifferentiableAt �� f x) :
    deriv (c • f) x = c • deriv f x :=
  (hf.hasDerivAt.const_smul c).deriv

/-- A variant of `deriv_fun_const_smul` without differentiability assumption when the scalar
multiplication is by division ring elements. -/

lemma deriv_fun_const_smul_field (c : ��) (f : �� → F) :
    deriv (fun y ↦ c • f y) x = c • deriv f x := by
  simp only [← derivWithin_univ, derivWithin_fun_const_smul_field]

/-- A variant of `deriv_const_smul` without differentiability assumption when the scalar
multiplication is by division ring elements. -/

lemma deriv_const_smul_field (c : ��) (f : �� → F) :
    deriv (c • f) x = c • deriv f x := by
  simp only [← derivWithin_univ, derivWithin_const_smul_field]

end ConstSMul

section Mul

/-! ### Derivative of the multiplication of two functions -/


variable {��' �� : Type*} [NormedDivisionRing ��'] [NormedRing ��] [NormedAlgebra �� ��']
  [NormedAlgebra �� ��] {c d : �� → ��} {c' d' : ��} {u v : �� → ��'}

@[to_fun]
theorem HasDerivWithinAt.mul (hc : HasDerivWithinAt c c' s x) (hd : HasDerivWithinAt d d' s x) :
    HasDerivWithinAt (c * d) (c' * d x + c x * d') s x := by
  simpa [add_comm] using (HasFDerivWithinAt.mul' hc hd).hasDerivWithinAt

@[to_fun]
theorem HasDerivAt.mul (hc : HasDerivAt c c' x) (hd : HasDerivAt d d' x) :
    HasDerivAt (c * d) (c' * d x + c x * d') x := by
  rw [← hasDerivWithinAt_univ] at *
  exact HasDerivWithinAt.mul hc hd

@[to_fun]
theorem HasStrictDerivAt.mul (hc : HasStrictDerivAt c c' x) (hd : HasStrictDerivAt d d' x) :
    HasStrictDerivAt (c * d) (c' * d x + c x * d') x := by
  simpa [add_comm] using (HasStrictFDerivAt.mul' hc hd).hasStrictDerivAt

theorem derivWithin_fun_mul (hc : DifferentiableWithinAt �� c s x)
    (hd : DifferentiableWithinAt �� d s x) :
    derivWithin (fun y => c y * d y) s x = derivWithin c s x * d x + c x * derivWithin d s x := by
  by_cases hsx : UniqueDiffWithinAt �� s x
  · exact (hc.hasDerivWithinAt.mul hd.hasDerivWithinAt).derivWithin hsx
  · simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]

theorem derivWithin_mul (hc : DifferentiableWithinAt �� c s x)
    (hd : DifferentiableWithinAt �� d s x) :
    derivWithin (c * d) s x = derivWithin c s x * d x + c x * derivWithin d s x :=
  derivWithin_fun_mul hc hd

@[simp]
theorem deriv_fun_mul (hc : DifferentiableAt �� c x) (hd : DifferentiableAt �� d x) :
    deriv (fun y => c y * d y) x = deriv c x * d x + c x * deriv d x :=
  (hc.hasDerivAt.mul hd.hasDerivAt).deriv

@[simp]
theorem deriv_mul (hc : DifferentiableAt �� c x) (hd : DifferentiableAt �� d x) :
    deriv (c * d) x = deriv c x * d x + c x * deriv d x :=
  (hc.hasDerivAt.mul hd.hasDerivAt).deriv

theorem HasDerivWithinAt.mul_const (hc : HasDerivWithinAt c c' s x) (d : ��) :
    HasDerivWithinAt (fun y => c y * d) (c' * d) s x := by
  convert hc.mul (hasDerivWithinAt_const x s d) using 1
  rw [mul_zero, add_zero]

theorem HasDerivAt.mul_const (hc : HasDerivAt c c' x) (d : ��) :
    HasDerivAt (fun y => c y * d) (c' * d) x := by
  rw [← hasDerivWithinAt_univ] at *
  exact hc.mul_const d

theorem hasDerivAt_mul_const (c : ��) : HasDerivAt (fun x => x * c) c x := by
  simpa only [one_mul] using (hasDerivAt_id' x).mul_const c

theorem HasStrictDerivAt.mul_const (hc : HasStrictDerivAt c c' x) (d : ��) :
    HasStrictDerivAt (fun y => c y * d) (c' * d) x := by
  convert hc.mul (hasStrictDerivAt_const x d) using 1
  rw [mul_zero, add_zero]

theorem derivWithin_mul_const (hc : DifferentiableWithinAt �� c s x) (d : ��) :
    derivWithin (fun y => c y * d) s x = derivWithin c s x * d := by
  by_cases hsx : UniqueDiffWithinAt �� s x
  · exact (hc.hasDerivWithinAt.mul_const d).derivWithin hsx
  · simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]

lemma derivWithin_mul_const_field (u : ��') :
    derivWithin (fun y => v y * u) s x = derivWithin v s x * u := by
  by_cases hv : DifferentiableWithinAt �� v s x
  · rw [derivWithin_mul_const hv u]
  by_cases hu : u = 0
  · simp [hu]
  rw [derivWithin_zero_of_not_differentiableWithinAt hv, zero_mul,
      derivWithin_zero_of_not_differentiableWithinAt]
  have : v = fun x ↦ (v x * u) * u⁻¹ := by ext; simp [hu]
  exact fun h_diff ↦ hv <| this ▸ h_diff.mul_const _

theorem deriv_mul_const (hc : DifferentiableAt �� c x) (d : ��) :
    deriv (fun y => c y * d) x = deriv c x * d :=
  (hc.hasDerivAt.mul_const d).deriv

theorem deriv_mul_const_field (v : ��') : deriv (fun y => u y * v) x = deriv u x * v := by
  by_cases hu : DifferentiableAt �� u x
  · exact deriv_mul_const hu v
  · rw [deriv_zero_of_not_differentiableAt hu, zero_mul]
    rcases eq_or_ne v 0 with (rfl | hd)
    · simp only [mul_zero, deriv_const]
    · refine deriv_zero_of_not_differentiableAt (mt (fun H => ?_) hu)
      simpa only [mul_inv_cancel_right₀ hd] using H.mul_const v⁻¹

@[simp]
theorem deriv_mul_const_field' (v : ��') : (deriv fun x => u x * v) = fun x => deriv u x * v :=
  funext fun _ => deriv_mul_const_field v

theorem HasDerivWithinAt.const_mul (c : ��) (hd : HasDerivWithinAt d d' s x) :
    HasDerivWithinAt (fun y => c * d y) (c * d') s x := by
  convert (hasDerivWithinAt_const x s c).mul hd using 1
  rw [zero_mul, zero_add]

theorem HasDerivAt.const_mul (c : ��) (hd : HasDerivAt d d' x) :
    HasDerivAt (fun y => c * d y) (c * d') x := by
  rw [← hasDerivWithinAt_univ] at *
  exact hd.const_mul c

theorem hasDerivAt_const_mul (c : ��) : HasDerivAt (fun y => c * y) c x := by
  simpa only [mul_one] using (hasDerivAt_id' x).const_mul c

theorem HasStrictDerivAt.const_mul (c : ��) (hd : HasStrictDerivAt d d' x) :
    HasStrictDerivAt (fun y => c * d y) (c * d') x := by
  convert (hasStrictDerivAt_const _ _).mul hd using 1
  rw [zero_mul, zero_add]

theorem derivWithin_const_mul (c : ��) (hd : DifferentiableWithinAt �� d s x) :
    derivWithin (fun y => c * d y) s x = c * derivWithin d s x := by
  by_cases hsx : UniqueDiffWithinAt �� s x
  · exact (hd.hasDerivWithinAt.const_mul c).derivWithin hsx
  · simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]

/-- A variant of `derivWithin_const_mul` without differentiability assumption when the scalar
multiplication is by division ring elements. -/

lemma derivWithin_const_mul_field (u : ��') :
    derivWithin (fun y => u * v y) s x = u * derivWithin v s x := by
  apply derivWithin_const_smul_field (c := u)

theorem deriv_const_mul (c : ��) (hd : DifferentiableAt �� d x) :
    deriv (fun y => c * d y) x = c * deriv d x :=
  (hd.hasDerivAt.const_mul c).deriv

/-- A variant of `deriv_const_mul` without differentiability assumption when the scalar
multiplication is by division ring elements. -/

theorem deriv_const_mul_field (u : ��') : deriv (fun y => u * v y) x = u * deriv v x := by
  simpa only [← derivWithin_univ] using derivWithin_const_mul_field u

@[simp]
theorem deriv_const_mul_field' (u : ��') : (deriv fun x => u * v x) = fun x => u * deriv v x :=
  funext fun _ => deriv_const_mul_field u

theorem deriv_const_mul_id (c : ��) : deriv (fun y => c * y) x = c := by
  simp only [deriv_const_mul c differentiableAt_fun_id, deriv_id'', mul_one]

@[simp]
theorem deriv_const_mul_id' (c : ��) : deriv (fun x => c * x) = fun _ => c :=
  funext fun _ => by simp only [deriv_const_mul_id]

end Mul

section Prod

section HasDeriv

variable {ι : Type*} [DecidableEq ι] {��' : Type*} [NormedCommRing ��'] [NormedAlgebra �� ��']
  {u : Finset ι} {f : ι → �� → ��'} {f' : ι → ��'}

theorem HasDerivAt.fun_finsetProd (hf : ∀ i ∈ u, HasDerivAt (f i) (f' i) x) :
    HasDerivAt (∏ i ∈ u, f i ·) (∑ i ∈ u, (∏ j ∈ u.erase i, f j x) • f' i) x := by
  simpa using (HasFDerivAt.finsetProd (hf · · |> hasFDerivAt)).hasDerivAt

theorem HasDerivAt.finsetProd (hf : ∀ i ∈ u, HasDerivAt (f i) (f' i) x) :
    HasDerivAt (∏ i ∈ u, f i) (∑ i ∈ u, (∏ j ∈ u.erase i, f j x) • f' i) x := by
  convert! HasDerivAt.fun_finsetProd hf; simp

theorem HasDerivWithinAt.fun_finsetProd (hf : ∀ i ∈ u, HasDerivWithinAt (f i) (f' i) s x) :
    HasDerivWithinAt (∏ i ∈ u, f i ·) (∑ i ∈ u, (∏ j ∈ u.erase i, f j x) • f' i) s x := by
  simpa using (HasFDerivWithinAt.finsetProd (hf · · |> hasFDerivWithinAt)).hasDerivWithinAt

theorem HasDerivWithinAt.finsetProd (hf : ∀ i ∈ u, HasDerivWithinAt (f i) (f' i) s x) :
    HasDerivWithinAt (∏ i ∈ u, f i) (∑ i ∈ u, (∏ j ∈ u.erase i, f j x) • f' i) s x := by
  convert! HasDerivWithinAt.fun_finsetProd hf; simp

theorem HasStrictDerivAt.fun_finsetProd (hf : ∀ i ∈ u, HasStrictDerivAt (f i) (f' i) x) :
    HasStrictDerivAt (∏ i ∈ u, f i ·) (∑ i ∈ u, (∏ j ∈ u.erase i, f j x) • f' i) x := by
  simpa using (HasStrictFDerivAt.finsetProd (hf · · |> hasStrictFDerivAt)).hasStrictDerivAt

theorem HasStrictDerivAt.finsetProd (hf : ∀ i ∈ u, HasStrictDerivAt (f i) (f' i) x) :
    HasStrictDerivAt (∏ i ∈ u, f i) (∑ i ∈ u, (∏ j ∈ u.erase i, f j x) • f' i) x := by
  convert! HasStrictDerivAt.fun_finsetProd hf; simp

theorem deriv_fun_finsetProd (hf : ∀ i ∈ u, DifferentiableAt �� (f i) x) :
    deriv (∏ i ∈ u, f i ·) x = ∑ i ∈ u, (∏ j ∈ u.erase i, f j x) • deriv (f i) x :=
  (HasDerivAt.fun_finsetProd fun i hi ↦ (hf i hi).hasDerivAt).deriv

theorem deriv_finsetProd (hf : ∀ i ∈ u, DifferentiableAt �� (f i) x) :
    deriv (∏ i ∈ u, f i) x = ∑ i ∈ u, (∏ j ∈ u.erase i, f j x) • deriv (f i) x :=
  (HasDerivAt.finsetProd fun i hi ↦ (hf i hi).hasDerivAt).deriv

theorem derivWithin_fun_finsetProd (hf : ∀ i ∈ u, DifferentiableWithinAt �� (f i) s x) :
    derivWithin (∏ i ∈ u, f i ·) s x =
      ∑ i ∈ u, (∏ j ∈ u.erase i, f j x) • derivWithin (f i) s x := by
  by_cases hsx : UniqueDiffWithinAt �� s x
  · exact (HasDerivWithinAt.fun_finsetProd fun i hi ↦ (hf i hi).hasDerivWithinAt).derivWithin hsx
  · simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]

theorem derivWithin_finsetProd (hf : ∀ i ∈ u, DifferentiableWithinAt �� (f i) s x) :
    derivWithin (∏ i ∈ u, f i) s x =
      ∑ i ∈ u, (∏ j ∈ u.erase i, f j x) • derivWithin (f i) s x := by
  convert! derivWithin_fun_finsetProd hf; simp

end HasDeriv

variable {ι : Type*} {��' : Type*} [NormedCommRing ��'] [NormedAlgebra �� ��']
  {u : Finset ι} {f : ι → �� → ��'}

@[fun_prop]
theorem DifferentiableAt.fun_finsetProd (hd : ∀ i ∈ u, DifferentiableAt �� (f i) x) :
    DifferentiableAt �� (∏ i ∈ u, f i ·) x := by
  classical
  exact
    (HasDerivAt.fun_finsetProd (fun i hi ↦ DifferentiableAt.hasDerivAt (hd i hi))).differentiableAt

@[fun_prop]
theorem DifferentiableAt.finsetProd (hd : ∀ i ∈ u, DifferentiableAt �� (f i) x) :
    DifferentiableAt �� (∏ i ∈ u, f i) x := by
  convert! DifferentiableAt.fun_finsetProd hd; simp

@[fun_prop]
theorem DifferentiableWithinAt.fun_finsetProd (hd : ∀ i ∈ u, DifferentiableWithinAt �� (f i) s x) :
    DifferentiableWithinAt �� (∏ i ∈ u, f i ·) s x := by
  classical
  exact (HasDerivWithinAt.fun_finsetProd (fun i hi ↦
    DifferentiableWithinAt.hasDerivWithinAt (hd i hi))).differentiableWithinAt

@[fun_prop]
theorem DifferentiableWithinAt.finsetProd (hd : ∀ i ∈ u, DifferentiableWithinAt �� (f i) s x) :
    DifferentiableWithinAt �� (∏ i ∈ u, f i) s x := by
  convert! DifferentiableWithinAt.fun_finsetProd hd; simp

@[fun_prop]
theorem DifferentiableOn.fun_finsetProd (hd : ∀ i ∈ u, DifferentiableOn �� (f i) s) :
    DifferentiableOn �� (∏ i ∈ u, f i ·) s :=
  fun x hx ↦ .fun_finsetProd (fun i hi ↦ hd i hi x hx)

@[fun_prop]
theorem DifferentiableOn.finsetProd (hd : ∀ i ∈ u, DifferentiableOn �� (f i) s) :
    DifferentiableOn �� (∏ i ∈ u, f i) s :=
  fun x hx ↦ .finsetProd (fun i hi ↦ hd i hi x hx)

@[fun_prop]
theorem Differentiable.fun_finsetProd (hd : ∀ i ∈ u, Differentiable �� (f i)) :
    Differentiable �� (∏ i ∈ u, f i ·) :=
  fun x ↦ .fun_finsetProd (fun i hi ↦ hd i hi x)

@[fun_prop]
theorem Differentiable.finsetProd (hd : ∀ i ∈ u, Differentiable �� (f i)) :
    Differentiable �� (∏ i ∈ u, f i) :=
  fun x ↦ .finsetProd (fun i hi ↦ hd i hi x)

end Prod

section Div

variable {��' : Type*} [NormedDivisionRing ��'] [NormedAlgebra �� ��'] {c : �� → ��'} {c' : ��'}

theorem HasDerivAt.div_const (hc : HasDerivAt c c' x) (d : ��') :
    HasDerivAt (fun x => c x / d) (c' / d) x := by
  simpa only [div_eq_mul_inv] using hc.mul_const d⁻¹

theorem HasDerivWithinAt.div_const (hc : HasDerivWithinAt c c' s x) (d : ��') :
    HasDerivWithinAt (fun x => c x / d) (c' / d) s x := by
  simpa only [div_eq_mul_inv] using hc.mul_const d⁻¹

theorem HasStrictDerivAt.div_const (hc : HasStrictDerivAt c c' x) (d : ��') :
    HasStrictDerivAt (fun x => c x / d) (c' / d) x := by
  simpa only [div_eq_mul_inv] using hc.mul_const d⁻¹

@[fun_prop]
theorem DifferentiableWithinAt.div_const (hc : DifferentiableWithinAt �� c s x) (d : ��') :
    DifferentiableWithinAt �� (fun x => c x / d) s x :=
  (hc.hasDerivWithinAt.div_const _).differentiableWithinAt

@[simp, fun_prop]
theorem DifferentiableAt.div_const (hc : DifferentiableAt �� c x) (d : ��') :
    DifferentiableAt �� (fun x => c x / d) x :=
  (hc.hasDerivAt.div_const _).differentiableAt

@[fun_prop]
theorem DifferentiableOn.div_const (hc : DifferentiableOn �� c s) (d : ��') :
    DifferentiableOn �� (fun x => c x / d) s := fun x hx => (hc x hx).div_const d

@[simp, fun_prop]
theorem Differentiable.div_const (hc : Differentiable �� c) (d : ��') :
    Differentiable �� fun x => c x / d := fun x => (hc x).div_const d

theorem derivWithin_div_const (c : �� → ��') (d : ��') :
    derivWithin (fun x => c x / d) s x = derivWithin c s x / d := by
  simp [div_eq_mul_inv, derivWithin_mul_const_field]

@[simp]
theorem deriv_div_const (d : ��') : deriv (fun x => c x / d) x = deriv c x / d := by
  simp only [div_eq_mul_inv, deriv_mul_const_field]

end Div

section CLMCompApply

/-! ### Derivative of the pointwise composition/application of continuous linear maps -/


open ContinuousLinearMap

variable {G : Type*} [NormedAddCommGroup G] [NormedSpace �� G] {c : �� → F →L[��] G} {c' : F →L[��] G}
  {d : �� → E →L[��] F} {d' : E →L[��] F} {u : �� → F} {u' : F}

theorem HasStrictDerivAt.clm_comp (hc : HasStrictDerivAt c c' x) (hd : HasStrictDerivAt d d' x) :
    HasStrictDerivAt (fun y => (c y).comp (d y)) (c'.comp (d x) + (c x).comp d') x := by
  simpa [add_comm] using (hc.hasStrictFDerivAt.clm_comp hd.hasStrictFDerivAt).hasStrictDerivAt

theorem HasDerivWithinAt.clm_comp (hc : HasDerivWithinAt c c' s x)
    (hd : HasDerivWithinAt d d' s x) :
    HasDerivWithinAt (fun y => (c y).comp (d y)) (c'.comp (d x) + (c x).comp d') s x := by
  simpa [add_comm] using (hc.hasFDerivWithinAt.clm_comp hd.hasFDerivWithinAt).hasDerivWithinAt

theorem HasDerivAt.clm_comp (hc : HasDerivAt c c' x) (hd : HasDerivAt d d' x) :
    HasDerivAt (fun y => (c y).comp (d y)) (c'.comp (d x) + (c x).comp d') x := by
  rw [← hasDerivWithinAt_univ] at *
  exact hc.clm_comp hd

theorem derivWithin_clm_comp (hc : DifferentiableWithinAt �� c s x)
    (hd : DifferentiableWithinAt �� d s x) :
    derivWithin (fun y => (c y).comp (d y)) s x =
      (derivWithin c s x).comp (d x) + (c x).comp (derivWithin d s x) := by
  by_cases hsx : UniqueDiffWithinAt �� s x
  · exact (hc.hasDerivWithinAt.clm_comp hd.hasDerivWithinAt).derivWithin hsx
  · simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]

theorem deriv_clm_comp (hc : DifferentiableAt �� c x) (hd : DifferentiableAt �� d x) :
    deriv (fun y => (c y).comp (d y)) x = (deriv c x).comp (d x) + (c x).comp (deriv d x) :=
  (hc.hasDerivAt.clm_comp hd.hasDerivAt).deriv

theorem HasStrictDerivAt.clm_apply (hc : HasStrictDerivAt c c' x) (hu : HasStrictDerivAt u u' x) :
    HasStrictDerivAt (fun y => (c y) (u y)) (c' (u x) + c x u') x := by
  simpa [add_comm] using (hc.hasStrictFDerivAt.clm_apply hu.hasStrictFDerivAt).hasStrictDerivAt

theorem HasDerivWithinAt.clm_apply (hc : HasDerivWithinAt c c' s x)
    (hu : HasDerivWithinAt u u' s x) :
    HasDerivWithinAt (fun y => (c y) (u y)) (c' (u x) + c x u') s x := by
  simpa [add_comm] using (hc.hasFDerivWithinAt.clm_apply hu.hasFDerivWithinAt).hasDerivWithinAt

theorem HasDerivAt.clm_apply (hc : HasDerivAt c c' x) (hu : HasDerivAt u u' x) :
    HasDerivAt (fun y => (c y) (u y)) (c' (u x) + c x u') x := by
  simpa [add_comm] using (hc.hasFDerivAt.clm_apply hu.hasFDerivAt).hasDerivAt

theorem derivWithin_clm_apply (hc : DifferentiableWithinAt �� c s x)
    (hu : DifferentiableWithinAt �� u s x) :
    derivWithin (fun y => (c y) (u y)) s x = derivWithin c s x (u x) + c x (derivWithin u s x) := by
  by_cases hsx : UniqueDiffWithinAt �� s x
  · exact (hc.hasDerivWithinAt.clm_apply hu.hasDerivWithinAt).derivWithin hsx
  · simp [derivWithin_zero_of_not_uniqueDiffWithinAt hsx]

theorem deriv_clm_apply (hc : DifferentiableAt �� c x) (hu : DifferentiableAt �� u x) :
    deriv (fun y => (c y) (u y)) x = deriv c x (u x) + c x (deriv u x) :=
  (hc.hasDerivAt.clm_apply hu.hasDerivAt).deriv

end CLMCompApply

Messung
CHZG
9210010097

¤ Dauer der Verarbeitung: 0.28 Sekunden  ¤

*© Formatika GbR, Deutschland