doc-next-gen

Mathlib.Analysis.Calculus.FDeriv.Comp

Module docstring

{"# The derivative of a composition (chain rule)

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 composition of functions (the chain rule). ","### Derivative of the composition of two functions

For composition lemmas, we put x explicit to help the elaborator, as otherwise Lean tends to get confused since there are too many possibilities for composition. "}

HasFDerivAtFilter.comp theorem
{g : F β†’ G} {g' : F β†’L[π•œ] G} {L' : Filter F} (hg : HasFDerivAtFilter g g' (f x) L') (hf : HasFDerivAtFilter f f' x L) (hL : Tendsto f L L') : HasFDerivAtFilter (g ∘ f) (g'.comp f') x L
Full source
theorem HasFDerivAtFilter.comp {g : F β†’ G} {g' : F β†’L[π•œ] G} {L' : Filter F}
    (hg : HasFDerivAtFilter g g' (f x) L') (hf : HasFDerivAtFilter f f' x L) (hL : Tendsto f L L') :
    HasFDerivAtFilter (g ∘ f) (g'.comp f') x L := by
  let eq₁ := (g'.isBigO_comp _ _).trans_isLittleO hf.isLittleO
  let eqβ‚‚ := (hg.isLittleO.comp_tendsto hL).trans_isBigO hf.isBigO_sub
  refine .of_isLittleO <| eqβ‚‚.triangle <| eq₁.congr_left fun x' => ?_
  simp
Chain Rule for FrΓ©chet Derivatives Along Filters
Informal description
Let $E$, $F$, and $G$ be normed spaces over a non-discrete normed field $\mathbb{K}$. Suppose $f : E \to F$ has a FrΓ©chet derivative $f'$ at $x \in E$ along a filter $L$, and $g : F \to G$ has a FrΓ©chet derivative $g'$ at $f(x)$ along a filter $L'$. If $f$ tends to $L'$ along $L$, then the composition $g \circ f$ has a FrΓ©chet derivative at $x$ along $L$ given by the composition $g' \circ f'$.
HasFDerivWithinAt.comp theorem
{g : F β†’ G} {g' : F β†’L[π•œ] G} {t : Set F} (hg : HasFDerivWithinAt g g' t (f x)) (hf : HasFDerivWithinAt f f' s x) (hst : MapsTo f s t) : HasFDerivWithinAt (g ∘ f) (g'.comp f') s x
Full source
@[fun_prop]
theorem HasFDerivWithinAt.comp {g : F β†’ G} {g' : F β†’L[π•œ] G} {t : Set F}
    (hg : HasFDerivWithinAt g g' t (f x)) (hf : HasFDerivWithinAt f f' s x) (hst : MapsTo f s t) :
    HasFDerivWithinAt (g ∘ f) (g'.comp f') s x :=
  HasFDerivAtFilter.comp x hg hf <| hf.continuousWithinAt.tendsto_nhdsWithin hst
Chain Rule for FrΓ©chet Derivatives within Sets
Informal description
Let $E$, $F$, and $G$ be normed spaces over a non-discrete normed field $\mathbb{K}$. Suppose $f : E \to F$ has a FrΓ©chet derivative $f'$ at $x \in E$ within a set $s \subseteq E$, and $g : F \to G$ has a FrΓ©chet derivative $g'$ at $f(x)$ within a set $t \subseteq F$. If $f$ maps $s$ into $t$, then the composition $g \circ f$ has a FrΓ©chet derivative at $x$ within $s$ given by the composition $g' \circ f'$.
HasFDerivAt.comp_hasFDerivWithinAt theorem
{g : F β†’ G} {g' : F β†’L[π•œ] G} (hg : HasFDerivAt g g' (f x)) (hf : HasFDerivWithinAt f f' s x) : HasFDerivWithinAt (g ∘ f) (g'.comp f') s x
Full source
@[fun_prop]
theorem HasFDerivAt.comp_hasFDerivWithinAt {g : F β†’ G} {g' : F β†’L[π•œ] G}
    (hg : HasFDerivAt g g' (f x)) (hf : HasFDerivWithinAt f f' s x) :
    HasFDerivWithinAt (g ∘ f) (g'.comp f') s x :=
  hg.comp x hf hf.continuousWithinAt
Chain Rule for FrΓ©chet Derivatives: Global-to-Local Version
Informal description
Let $E$, $F$, and $G$ be normed spaces over a non-discrete normed field $\mathbb{K}$. Suppose $f : E \to F$ has a FrΓ©chet derivative $f'$ at $x \in E$ within a set $s \subseteq E$, and $g : F \to G$ has a FrΓ©chet derivative $g'$ at $f(x)$. Then the composition $g \circ f$ has a FrΓ©chet derivative at $x$ within $s$ given by the composition $g' \circ f'$.
HasFDerivWithinAt.comp_of_tendsto theorem
{g : F β†’ G} {g' : F β†’L[π•œ] G} {t : Set F} (hg : HasFDerivWithinAt g g' t (f x)) (hf : HasFDerivWithinAt f f' s x) (hst : Tendsto f (𝓝[s] x) (𝓝[t] f x)) : HasFDerivWithinAt (g ∘ f) (g'.comp f') s x
Full source
@[fun_prop]
theorem HasFDerivWithinAt.comp_of_tendsto {g : F β†’ G} {g' : F β†’L[π•œ] G} {t : Set F}
    (hg : HasFDerivWithinAt g g' t (f x)) (hf : HasFDerivWithinAt f f' s x)
    (hst : Tendsto f (𝓝[s] x) (𝓝[t] f x)) : HasFDerivWithinAt (g ∘ f) (g'.comp f') s x :=
  HasFDerivAtFilter.comp x hg hf hst
Chain Rule for FrΓ©chet Derivatives with Tendsto Condition
Informal description
Let $E$, $F$, and $G$ be normed spaces over a non-discrete normed field $\mathbb{K}$. Suppose $f : E \to F$ has a FrΓ©chet derivative $f'$ at $x \in E$ within a set $s \subseteq E$, and $g : F \to G$ has a FrΓ©chet derivative $g'$ at $f(x)$ within a set $t \subseteq F$. If $f$ tends to $t$ within $s$ as $x' \to x$, then the composition $g \circ f$ has a FrΓ©chet derivative at $x$ within $s$ given by the composition $g' \circ f'$.
HasFDerivAt.comp theorem
{g : F β†’ G} {g' : F β†’L[π•œ] G} (hg : HasFDerivAt g g' (f x)) (hf : HasFDerivAt f f' x) : HasFDerivAt (g ∘ f) (g'.comp f') x
Full source
/-- The chain rule. -/
@[fun_prop]
theorem HasFDerivAt.comp {g : F β†’ G} {g' : F β†’L[π•œ] G} (hg : HasFDerivAt g g' (f x))
    (hf : HasFDerivAt f f' x) : HasFDerivAt (g ∘ f) (g'.comp f') x :=
  HasFDerivAtFilter.comp x hg hf hf.continuousAt
Chain Rule for FrΓ©chet Derivatives at a Point
Informal description
Let $E$, $F$, and $G$ be normed spaces over a non-discrete normed field $\mathbb{K}$. If $f \colon E \to F$ is FrΓ©chet differentiable at $x \in E$ with derivative $f'$, and $g \colon F \to G$ is FrΓ©chet differentiable at $f(x)$ with derivative $g'$, then the composition $g \circ f$ is FrΓ©chet differentiable at $x$ with derivative $g' \circ f'$.
DifferentiableWithinAt.comp theorem
{g : F β†’ G} {t : Set F} (hg : DifferentiableWithinAt π•œ g t (f x)) (hf : DifferentiableWithinAt π•œ f s x) (h : MapsTo f s t) : DifferentiableWithinAt π•œ (g ∘ f) s x
Full source
@[fun_prop]
theorem DifferentiableWithinAt.comp {g : F β†’ G} {t : Set F}
    (hg : DifferentiableWithinAt π•œ g t (f x)) (hf : DifferentiableWithinAt π•œ f s x)
    (h : MapsTo f s t) : DifferentiableWithinAt π•œ (g ∘ f) s x :=
  (hg.hasFDerivWithinAt.comp x hf.hasFDerivWithinAt h).differentiableWithinAt
Differentiability of Composition within Sets (Chain Rule)
Informal description
Let $E$, $F$, and $G$ be normed spaces over a non-discrete normed field $\mathbb{K}$. Suppose $f : E \to F$ is differentiable at $x \in E$ within a set $s \subseteq E$, and $g : F \to G$ is differentiable at $f(x)$ within a set $t \subseteq F$. If $f$ maps $s$ into $t$, then the composition $g \circ f$ is differentiable at $x$ within $s$.
DifferentiableWithinAt.comp' theorem
{g : F β†’ G} {t : Set F} (hg : DifferentiableWithinAt π•œ g t (f x)) (hf : DifferentiableWithinAt π•œ f s x) : DifferentiableWithinAt π•œ (g ∘ f) (s ∩ f ⁻¹' t) x
Full source
@[fun_prop]
theorem DifferentiableWithinAt.comp' {g : F β†’ G} {t : Set F}
    (hg : DifferentiableWithinAt π•œ g t (f x)) (hf : DifferentiableWithinAt π•œ f s x) :
    DifferentiableWithinAt π•œ (g ∘ f) (s ∩ f ⁻¹' t) x :=
  hg.comp x (hf.mono inter_subset_left) inter_subset_right
Chain Rule for Differentiability within Intersection of Sets
Informal description
Let $E$, $F$, and $G$ be normed spaces over a non-discrete normed field $\mathbb{K}$. Suppose $f : E \to F$ is differentiable at $x \in E$ within a set $s \subseteq E$, and $g : F \to G$ is differentiable at $f(x)$ within a set $t \subseteq F$. Then the composition $g \circ f$ is differentiable at $x$ within the intersection $s \cap f^{-1}(t)$.
DifferentiableAt.comp theorem
{g : F β†’ G} (hg : DifferentiableAt π•œ g (f x)) (hf : DifferentiableAt π•œ f x) : DifferentiableAt π•œ (g ∘ f) x
Full source
@[fun_prop]
theorem DifferentiableAt.comp {g : F β†’ G} (hg : DifferentiableAt π•œ g (f x))
    (hf : DifferentiableAt π•œ f x) : DifferentiableAt π•œ (g ∘ f) x :=
  (hg.hasFDerivAt.comp x hf.hasFDerivAt).differentiableAt
Differentiability of Function Composition (Chain Rule)
Informal description
Let $E$, $F$, and $G$ be normed spaces over a non-discrete normed field $\mathbb{K}$. If $f \colon E \to F$ is differentiable at $x \in E$ and $g \colon F \to G$ is differentiable at $f(x)$, then the composition $g \circ f$ is differentiable at $x$.
DifferentiableAt.comp_differentiableWithinAt theorem
{g : F β†’ G} (hg : DifferentiableAt π•œ g (f x)) (hf : DifferentiableWithinAt π•œ f s x) : DifferentiableWithinAt π•œ (g ∘ f) s x
Full source
@[fun_prop]
theorem DifferentiableAt.comp_differentiableWithinAt {g : F β†’ G} (hg : DifferentiableAt π•œ g (f x))
    (hf : DifferentiableWithinAt π•œ f s x) : DifferentiableWithinAt π•œ (g ∘ f) s x :=
  hg.differentiableWithinAt.comp x hf (mapsTo_univ _ _)
Differentiability of Composition within a Set (Chain Rule)
Informal description
Let $E$, $F$, and $G$ be normed spaces over a non-discrete normed field $\mathbb{K}$. If $f \colon E \to F$ is differentiable at $x \in E$ within a set $s \subseteq E$ and $g \colon F \to G$ is differentiable at $f(x)$, then the composition $g \circ f$ is differentiable at $x$ within $s$.
fderivWithin_comp theorem
{g : F β†’ G} {t : Set F} (hg : DifferentiableWithinAt π•œ g t (f x)) (hf : DifferentiableWithinAt π•œ f s x) (h : MapsTo f s t) (hxs : UniqueDiffWithinAt π•œ s x) : fderivWithin π•œ (g ∘ f) s x = (fderivWithin π•œ g t (f x)).comp (fderivWithin π•œ f s x)
Full source
theorem fderivWithin_comp {g : F β†’ G} {t : Set F} (hg : DifferentiableWithinAt π•œ g t (f x))
    (hf : DifferentiableWithinAt π•œ f s x) (h : MapsTo f s t) (hxs : UniqueDiffWithinAt π•œ s x) :
    fderivWithin π•œ (g ∘ f) s x = (fderivWithin π•œ g t (f x)).comp (fderivWithin π•œ f s x) :=
  (hg.hasFDerivWithinAt.comp x hf.hasFDerivWithinAt h).fderivWithin hxs
Chain Rule for FrΓ©chet Derivatives within Sets: $\text{fderivWithin}_{\mathbb{K}} (g \circ f) s x = (\text{fderivWithin}_{\mathbb{K}} g t (f x)) \circ (\text{fderivWithin}_{\mathbb{K}} f s x)$
Informal description
Let $E$, $F$, and $G$ be normed spaces over a non-discrete normed field $\mathbb{K}$. Suppose $f : E \to F$ is differentiable at $x \in E$ within a set $s \subseteq E$, and $g : F \to G$ is differentiable at $f(x)$ within a set $t \subseteq F$. If $f$ maps $s$ into $t$ and $s$ is uniquely differentiable at $x$, then the FrΓ©chet derivative of the composition $g \circ f$ at $x$ within $s$ is given by the composition of the derivatives: \[ \text{fderivWithin}_{\mathbb{K}} (g \circ f) s x = (\text{fderivWithin}_{\mathbb{K}} g t (f x)) \circ (\text{fderivWithin}_{\mathbb{K}} f s x). \]
fderivWithin_comp_of_eq theorem
{g : F β†’ G} {t : Set F} {y : F} (hg : DifferentiableWithinAt π•œ g t y) (hf : DifferentiableWithinAt π•œ f s x) (h : MapsTo f s t) (hxs : UniqueDiffWithinAt π•œ s x) (hy : f x = y) : fderivWithin π•œ (g ∘ f) s x = (fderivWithin π•œ g t (f x)).comp (fderivWithin π•œ f s x)
Full source
theorem fderivWithin_comp_of_eq {g : F β†’ G} {t : Set F} {y : F}
    (hg : DifferentiableWithinAt π•œ g t y) (hf : DifferentiableWithinAt π•œ f s x) (h : MapsTo f s t)
    (hxs : UniqueDiffWithinAt π•œ s x) (hy : f x = y) :
    fderivWithin π•œ (g ∘ f) s x = (fderivWithin π•œ g t (f x)).comp (fderivWithin π•œ f s x) := by
  subst hy; exact fderivWithin_comp _ hg hf h hxs
Chain Rule for FrΓ©chet Derivatives within Sets with Point Equality
Informal description
Let $E$, $F$, and $G$ be normed spaces over a non-discrete normed field $\mathbb{K}$. Suppose $f : E \to F$ is differentiable at $x \in E$ within a set $s \subseteq E$, and $g : F \to G$ is differentiable at $y \in F$ within a set $t \subseteq F$. If $f$ maps $s$ into $t$, $s$ is uniquely differentiable at $x$, and $f(x) = y$, then the FrΓ©chet derivative of the composition $g \circ f$ at $x$ within $s$ is given by the composition of the derivatives: \[ \text{fderivWithin}_{\mathbb{K}} (g \circ f) s x = (\text{fderivWithin}_{\mathbb{K}} g t (f x)) \circ (\text{fderivWithin}_{\mathbb{K}} f s x). \]
fderivWithin_comp' theorem
{g : F β†’ G} {t : Set F} (hg : DifferentiableWithinAt π•œ g t (f x)) (hf : DifferentiableWithinAt π•œ f s x) (h : MapsTo f s t) (hxs : UniqueDiffWithinAt π•œ s x) : fderivWithin π•œ (fun y ↦ g (f y)) s x = (fderivWithin π•œ g t (f x)).comp (fderivWithin π•œ f s x)
Full source
/-- A variant for the derivative of a composition, written without `∘`. -/
theorem fderivWithin_comp' {g : F β†’ G} {t : Set F} (hg : DifferentiableWithinAt π•œ g t (f x))
    (hf : DifferentiableWithinAt π•œ f s x) (h : MapsTo f s t) (hxs : UniqueDiffWithinAt π•œ s x) :
    fderivWithin π•œ (fun y ↦ g (f y)) s x
      = (fderivWithin π•œ g t (f x)).comp (fderivWithin π•œ f s x) :=
  fderivWithin_comp _ hg hf h hxs
Chain Rule for FrΓ©chet Derivatives within Sets (Point-Free Form)
Informal description
Let $E$, $F$, and $G$ be normed spaces over a non-discrete normed field $\mathbb{K}$. Suppose $f : E \to F$ is differentiable at $x \in E$ within a set $s \subseteq E$, and $g : F \to G$ is differentiable at $f(x)$ within a set $t \subseteq F$. If $f$ maps $s$ into $t$ and $s$ is uniquely differentiable at $x$, then the FrΓ©chet derivative of the function $y \mapsto g(f(y))$ at $x$ within $s$ is given by the composition of the derivatives: \[ \text{fderivWithin}_{\mathbb{K}} (y \mapsto g(f(y))) s x = (\text{fderivWithin}_{\mathbb{K}} g t (f x)) \circ (\text{fderivWithin}_{\mathbb{K}} f s x). \]
fderivWithin_comp_of_eq' theorem
{g : F β†’ G} {t : Set F} {y : F} (hg : DifferentiableWithinAt π•œ g t y) (hf : DifferentiableWithinAt π•œ f s x) (h : MapsTo f s t) (hxs : UniqueDiffWithinAt π•œ s x) (hy : f x = y) : fderivWithin π•œ (fun y ↦ g (f y)) s x = (fderivWithin π•œ g t (f x)).comp (fderivWithin π•œ f s x)
Full source
/-- A variant for the derivative of a composition, written without `∘`. -/
theorem fderivWithin_comp_of_eq' {g : F β†’ G} {t : Set F} {y : F}
    (hg : DifferentiableWithinAt π•œ g t y) (hf : DifferentiableWithinAt π•œ f s x) (h : MapsTo f s t)
    (hxs : UniqueDiffWithinAt π•œ s x) (hy : f x = y) :
    fderivWithin π•œ (fun y ↦ g (f y)) s x
      = (fderivWithin π•œ g t (f x)).comp (fderivWithin π•œ f s x) := by
  subst hy; exact fderivWithin_comp _ hg hf h hxs
Chain Rule for FrΓ©chet Derivatives within Sets with Explicit Point Equality
Informal description
Let $E$, $F$, and $G$ be normed spaces over a non-discrete normed field $\mathbb{K}$. Suppose $f : E \to F$ is differentiable at $x \in E$ within a set $s \subseteq E$, and $g : F \to G$ is differentiable at $y \in F$ within a set $t \subseteq F$. If $f$ maps $s$ into $t$, $s$ is uniquely differentiable at $x$, and $f(x) = y$, then the FrΓ©chet derivative of the composition $g \circ f$ at $x$ within $s$ is given by the composition of the derivatives: \[ \text{fderivWithin}_{\mathbb{K}} (g \circ f) s x = (\text{fderivWithin}_{\mathbb{K}} g t y) \circ (\text{fderivWithin}_{\mathbb{K}} f s x). \]
fderivWithin_fderivWithin theorem
{g : F β†’ G} {f : E β†’ F} {x : E} {y : F} {s : Set E} {t : Set F} (hg : DifferentiableWithinAt π•œ g t y) (hf : DifferentiableWithinAt π•œ f s x) (h : MapsTo f s t) (hxs : UniqueDiffWithinAt π•œ s x) (hy : f x = y) (v : E) : fderivWithin π•œ g t y (fderivWithin π•œ f s x v) = fderivWithin π•œ (g ∘ f) s x v
Full source
/-- A version of `fderivWithin_comp` that is useful to rewrite the composition of two derivatives
  into a single derivative. This version always applies, but creates a new side-goal `f x = y`. -/
theorem fderivWithin_fderivWithin {g : F β†’ G} {f : E β†’ F} {x : E} {y : F} {s : Set E} {t : Set F}
    (hg : DifferentiableWithinAt π•œ g t y) (hf : DifferentiableWithinAt π•œ f s x) (h : MapsTo f s t)
    (hxs : UniqueDiffWithinAt π•œ s x) (hy : f x = y) (v : E) :
    fderivWithin π•œ g t y (fderivWithin π•œ f s x v) = fderivWithin π•œ (g ∘ f) s x v := by
  subst y
  rw [fderivWithin_comp x hg hf h hxs, coe_comp', Function.comp_apply]
Chain Rule for FrΓ©chet Derivatives within Sets: $\text{fderivWithin}_{\mathbb{K}} g t (f x) \circ \text{fderivWithin}_{\mathbb{K}} f s x = \text{fderivWithin}_{\mathbb{K}} (g \circ f) s x$
Informal description
Let $E$, $F$, and $G$ be normed spaces over a non-discrete normed field $\mathbb{K}$. Suppose $f : E \to F$ is differentiable at $x \in E$ within a set $s \subseteq E$, and $g : F \to G$ is differentiable at $y = f(x) \in F$ within a set $t \subseteq F$. If $f$ maps $s$ into $t$ and $s$ is uniquely differentiable at $x$, then for any vector $v \in E$, the following equality holds: \[ \text{fderivWithin}_{\mathbb{K}} g t y (\text{fderivWithin}_{\mathbb{K}} f s x v) = \text{fderivWithin}_{\mathbb{K}} (g \circ f) s x v. \]
fderivWithin_comp₃ theorem
{g' : G β†’ G'} {g : F β†’ G} {t : Set F} {u : Set G} {y : F} {y' : G} (hg' : DifferentiableWithinAt π•œ g' u y') (hg : DifferentiableWithinAt π•œ g t y) (hf : DifferentiableWithinAt π•œ f s x) (h2g : MapsTo g t u) (h2f : MapsTo f s t) (h3g : g y = y') (h3f : f x = y) (hxs : UniqueDiffWithinAt π•œ s x) : fderivWithin π•œ (g' ∘ g ∘ f) s x = (fderivWithin π•œ g' u y').comp ((fderivWithin π•œ g t y).comp (fderivWithin π•œ f s x))
Full source
/-- Ternary version of `fderivWithin_comp`, with equality assumptions of basepoints added, in
  order to apply more easily as a rewrite from right-to-left. -/
theorem fderivWithin_comp₃ {g' : G β†’ G'} {g : F β†’ G} {t : Set F} {u : Set G} {y : F} {y' : G}
    (hg' : DifferentiableWithinAt π•œ g' u y') (hg : DifferentiableWithinAt π•œ g t y)
    (hf : DifferentiableWithinAt π•œ f s x) (h2g : MapsTo g t u) (h2f : MapsTo f s t) (h3g : g y = y')
    (h3f : f x = y) (hxs : UniqueDiffWithinAt π•œ s x) :
    fderivWithin π•œ (g' ∘ g ∘ f) s x =
      (fderivWithin π•œ g' u y').comp ((fderivWithin π•œ g t y).comp (fderivWithin π•œ f s x)) := by
  substs h3g h3f
  exact (hg'.hasFDerivWithinAt.comp x (hg.hasFDerivWithinAt.comp x hf.hasFDerivWithinAt h2f) <|
    h2g.comp h2f).fderivWithin hxs
Chain Rule for Triple Composition of FrΓ©chet Derivatives within Sets
Informal description
Let $E$, $F$, $G$, and $G'$ be normed spaces over a non-discrete normed field $\mathbb{K}$. Suppose $f : E \to F$ is differentiable at $x \in E$ within a set $s \subseteq E$, $g : F \to G$ is differentiable at $y = f(x) \in F$ within a set $t \subseteq F$, and $g' : G \to G'$ is differentiable at $y' = g(y) \in G$ within a set $u \subseteq G$. If $f$ maps $s$ into $t$, $g$ maps $t$ into $u$, and $s$ is uniquely differentiable at $x$, then the FrΓ©chet derivative of the composition $g' \circ g \circ f$ at $x$ within $s$ is given by the composition of derivatives: \[ \text{fderivWithin}_{\mathbb{K}} (g' \circ g \circ f) s x = (\text{fderivWithin}_{\mathbb{K}} g' u y') \circ (\text{fderivWithin}_{\mathbb{K}} g t y) \circ (\text{fderivWithin}_{\mathbb{K}} f s x). \]
fderiv_comp theorem
{g : F β†’ G} (hg : DifferentiableAt π•œ g (f x)) (hf : DifferentiableAt π•œ f x) : fderiv π•œ (g ∘ f) x = (fderiv π•œ g (f x)).comp (fderiv π•œ f x)
Full source
theorem fderiv_comp {g : F β†’ G} (hg : DifferentiableAt π•œ g (f x)) (hf : DifferentiableAt π•œ f x) :
    fderiv π•œ (g ∘ f) x = (fderiv π•œ g (f x)).comp (fderiv π•œ f x) :=
  (hg.hasFDerivAt.comp x hf.hasFDerivAt).fderiv
Chain Rule for FrΓ©chet Derivatives
Informal description
Let $E$, $F$, and $G$ be normed spaces over a non-discrete normed field $\mathbb{K}$. If $f \colon E \to F$ is differentiable at $x \in E$ and $g \colon F \to G$ is differentiable at $f(x)$, then the FrΓ©chet derivative of the composition $g \circ f$ at $x$ is given by the composition of the derivatives: \[ \text{fderiv}_{\mathbb{K}} (g \circ f) x = (\text{fderiv}_{\mathbb{K}} g (f x)) \circ (\text{fderiv}_{\mathbb{K}} f x). \]
fderiv_comp' theorem
{g : F β†’ G} (hg : DifferentiableAt π•œ g (f x)) (hf : DifferentiableAt π•œ f x) : fderiv π•œ (fun y ↦ g (f y)) x = (fderiv π•œ g (f x)).comp (fderiv π•œ f x)
Full source
/-- A variant for the derivative of a composition, written without `∘`. -/
theorem fderiv_comp' {g : F β†’ G} (hg : DifferentiableAt π•œ g (f x)) (hf : DifferentiableAt π•œ f x) :
    fderiv π•œ (fun y ↦ g (f y)) x = (fderiv π•œ g (f x)).comp (fderiv π•œ f x) :=
  fderiv_comp x hg hf
Chain Rule for FrΓ©chet Derivatives (Pointwise Composition)
Informal description
Let $E$, $F$, and $G$ be normed spaces over a non-discrete normed field $\mathbb{K}$. If $f \colon E \to F$ is differentiable at $x \in E$ and $g \colon F \to G$ is differentiable at $f(x)$, then the FrΓ©chet derivative of the function $y \mapsto g(f(y))$ at $x$ is given by the composition of the derivatives: \[ \text{fderiv}_{\mathbb{K}} (y \mapsto g(f(y))) x = (\text{fderiv}_{\mathbb{K}} g (f x)) \circ (\text{fderiv}_{\mathbb{K}} f x). \]
fderiv_comp_fderivWithin theorem
{g : F β†’ G} (hg : DifferentiableAt π•œ g (f x)) (hf : DifferentiableWithinAt π•œ f s x) (hxs : UniqueDiffWithinAt π•œ s x) : fderivWithin π•œ (g ∘ f) s x = (fderiv π•œ g (f x)).comp (fderivWithin π•œ f s x)
Full source
theorem fderiv_comp_fderivWithin {g : F β†’ G} (hg : DifferentiableAt π•œ g (f x))
    (hf : DifferentiableWithinAt π•œ f s x) (hxs : UniqueDiffWithinAt π•œ s x) :
    fderivWithin π•œ (g ∘ f) s x = (fderiv π•œ g (f x)).comp (fderivWithin π•œ f s x) :=
  (hg.hasFDerivAt.comp_hasFDerivWithinAt x hf.hasFDerivWithinAt).fderivWithin hxs
Chain Rule for FrΓ©chet Derivatives Within a Set
Informal description
Let $E$, $F$, and $G$ be normed spaces over a non-discrete normed field $\mathbb{K}$. Suppose $f : E \to F$ is differentiable at $x \in E$ within a set $s \subseteq E$, and $g : F \to G$ is differentiable at $f(x)$. If $s$ is uniquely differentiable at $x$ (i.e., the tangent cone at $x$ spans a dense subspace of $E$), then the FrΓ©chet derivative of the composition $g \circ f$ at $x$ within $s$ is equal to the composition of the FrΓ©chet derivatives: \[ \text{fderivWithin}_{\mathbb{K}} (g \circ f) s x = (\text{fderiv}_{\mathbb{K}} g (f x)) \circ (\text{fderivWithin}_{\mathbb{K}} f s x). \]
DifferentiableOn.comp theorem
{g : F β†’ G} {t : Set F} (hg : DifferentiableOn π•œ g t) (hf : DifferentiableOn π•œ f s) (st : MapsTo f s t) : DifferentiableOn π•œ (g ∘ f) s
Full source
@[fun_prop]
theorem DifferentiableOn.comp {g : F β†’ G} {t : Set F} (hg : DifferentiableOn π•œ g t)
    (hf : DifferentiableOn π•œ f s) (st : MapsTo f s t) : DifferentiableOn π•œ (g ∘ f) s :=
  fun x hx => DifferentiableWithinAt.comp x (hg (f x) (st hx)) (hf x hx) st
Differentiability of Composition on Sets (Chain Rule)
Informal description
Let $E$, $F$, and $G$ be normed spaces over a non-discrete normed field $\mathbb{K}$. Suppose $f : E \to F$ is differentiable on a set $s \subseteq E$, and $g : F \to G$ is differentiable on a set $t \subseteq F$. If $f$ maps $s$ into $t$, then the composition $g \circ f$ is differentiable on $s$.
Differentiable.comp theorem
{g : F β†’ G} (hg : Differentiable π•œ g) (hf : Differentiable π•œ f) : Differentiable π•œ (g ∘ f)
Full source
@[fun_prop]
theorem Differentiable.comp {g : F β†’ G} (hg : Differentiable π•œ g) (hf : Differentiable π•œ f) :
    Differentiable π•œ (g ∘ f) :=
  fun x => DifferentiableAt.comp x (hg (f x)) (hf x)
Differentiability of Function Composition (Chain Rule)
Informal description
Let $E$, $F$, and $G$ be normed spaces over a non-discrete normed field $\mathbb{K}$. If $f \colon E \to F$ and $g \colon F \to G$ are differentiable functions, then their composition $g \circ f \colon E \to G$ is also differentiable.
Differentiable.comp_differentiableOn theorem
{g : F β†’ G} (hg : Differentiable π•œ g) (hf : DifferentiableOn π•œ f s) : DifferentiableOn π•œ (g ∘ f) s
Full source
@[fun_prop]
theorem Differentiable.comp_differentiableOn {g : F β†’ G} (hg : Differentiable π•œ g)
    (hf : DifferentiableOn π•œ f s) : DifferentiableOn π•œ (g ∘ f) s :=
  hg.differentiableOn.comp hf (mapsTo_univ _ _)
Differentiability of Composition with Differentiable Function on a Set (Chain Rule)
Informal description
Let $E$, $F$, and $G$ be normed spaces over a non-discrete normed field $\mathbb{K}$. If $f \colon E \to F$ is differentiable on a set $s \subseteq E$ and $g \colon F \to G$ is differentiable, then the composition $g \circ f$ is differentiable on $s$.
HasStrictFDerivAt.comp theorem
{g : F β†’ G} {g' : F β†’L[π•œ] G} (hg : HasStrictFDerivAt g g' (f x)) (hf : HasStrictFDerivAt f f' x) : HasStrictFDerivAt (fun x => g (f x)) (g'.comp f') x
Full source
/-- The chain rule for derivatives in the sense of strict differentiability. -/
@[fun_prop]
protected theorem HasStrictFDerivAt.comp {g : F β†’ G} {g' : F β†’L[π•œ] G}
    (hg : HasStrictFDerivAt g g' (f x)) (hf : HasStrictFDerivAt f f' x) :
    HasStrictFDerivAt (fun x => g (f x)) (g'.comp f') x :=
  .of_isLittleO <|
    ((hg.isLittleO.comp_tendsto (hf.continuousAt.prodMap' hf.continuousAt)).trans_isBigO
        hf.isBigO_sub).triangle <| by
      simpa only [g'.map_sub, f'.coe_comp'] using (g'.isBigO_comp _ _).trans_isLittleO hf.isLittleO
Chain Rule for Strict FrΓ©chet Derivatives
Informal description
Let $E$, $F$, and $G$ be normed spaces over a non-discrete normed field $\mathbb{K}$. Suppose $f \colon E \to F$ has a strict FrΓ©chet derivative $f'$ at $x \in E$, and $g \colon F \to G$ has a strict FrΓ©chet derivative $g'$ at $f(x)$. Then the composition $g \circ f$ has a strict FrΓ©chet derivative at $x$ given by the composition $g' \circ f'$ of the derivatives. In symbols: \[ \text{HasStrictFDerivAt } f \, f' \, x \text{ and } \text{HasStrictFDerivAt } g \, g' \, (f x) \implies \text{HasStrictFDerivAt } (g \circ f) \, (g' \circ f') \, x. \]
Differentiable.iterate theorem
{f : E β†’ E} (hf : Differentiable π•œ f) (n : β„•) : Differentiable π•œ f^[n]
Full source
@[fun_prop]
protected theorem Differentiable.iterate {f : E β†’ E} (hf : Differentiable π•œ f) (n : β„•) :
    Differentiable π•œ f^[n] :=
  Nat.recOn n differentiable_id fun _ ihn => ihn.comp hf
Differentiability of Iterated Functions: $(f^n)' = (f')^n$
Informal description
Let $E$ be a normed space over a non-discrete normed field $\mathbb{K}$. If $f : E \to E$ is a differentiable function, then for any natural number $n$, the $n$-th iterate $f^{[n]}$ (the function obtained by composing $f$ with itself $n$ times) is also differentiable.
DifferentiableOn.iterate theorem
{f : E β†’ E} (hf : DifferentiableOn π•œ f s) (hs : MapsTo f s s) (n : β„•) : DifferentiableOn π•œ f^[n] s
Full source
@[fun_prop]
protected theorem DifferentiableOn.iterate {f : E β†’ E} (hf : DifferentiableOn π•œ f s)
    (hs : MapsTo f s s) (n : β„•) : DifferentiableOn π•œ f^[n] s :=
  Nat.recOn n differentiableOn_id fun _ ihn => ihn.comp hf hs
Differentiability of Iterated Function on Invariant Subset
Informal description
Let $E$ be a normed space over a non-discrete normed field $\mathbb{K}$, and let $f : E \to E$ be a function that is differentiable on a subset $s \subseteq E$. If $f$ maps $s$ into itself (i.e., $f(s) \subseteq s$), then for any natural number $n$, the $n$-th iterate $f^{[n]}$ is differentiable on $s$.
HasFDerivAtFilter.iterate theorem
{f : E β†’ E} {f' : E β†’L[π•œ] E} (hf : HasFDerivAtFilter f f' x L) (hL : Tendsto f L L) (hx : f x = x) (n : β„•) : HasFDerivAtFilter f^[n] (f' ^ n) x L
Full source
protected theorem HasFDerivAtFilter.iterate {f : E β†’ E} {f' : E β†’L[π•œ] E}
    (hf : HasFDerivAtFilter f f' x L) (hL : Tendsto f L L) (hx : f x = x) (n : β„•) :
    HasFDerivAtFilter f^[n] (f' ^ n) x L := by
  induction n with
  | zero => exact hasFDerivAtFilter_id x L
  | succ n ihn =>
    rw [Function.iterate_succ, pow_succ]
    rw [← hx] at ihn
    exact ihn.comp x hf hL
FrΓ©chet Derivative of Iterated Function: $(f^{[n]})' = (f')^n$ at Fixed Point
Informal description
Let $E$ be a normed space over a non-discrete normed field $\mathbb{K}$, and let $f : E \to E$ be a function with FrΓ©chet derivative $f'$ at $x \in E$ along a filter $L$. If $f$ maps $L$ to itself (i.e., $\text{tendsto}\, f\, L\, L$) and $f(x) = x$, then for any natural number $n$, the $n$-th iterate $f^{[n]}$ has FrΓ©chet derivative $(f')^n$ at $x$ along $L$.
HasFDerivAt.iterate theorem
{f : E β†’ E} {f' : E β†’L[π•œ] E} (hf : HasFDerivAt f f' x) (hx : f x = x) (n : β„•) : HasFDerivAt f^[n] (f' ^ n) x
Full source
@[fun_prop]
protected theorem HasFDerivAt.iterate {f : E β†’ E} {f' : E β†’L[π•œ] E} (hf : HasFDerivAt f f' x)
    (hx : f x = x) (n : β„•) : HasFDerivAt f^[n] (f' ^ n) x := by
  refine HasFDerivAtFilter.iterate hf ?_ hx n
  convert hf.continuousAt.tendsto
  exact hx.symm
FrΓ©chet Derivative of Iterated Function at Fixed Point: $(f^{[n]})' = (f')^n$
Informal description
Let $E$ be a normed space over a non-discrete normed field $\mathbb{K}$, and let $f : E \to E$ be a function that is FrΓ©chet differentiable at $x \in E$ with derivative $f'$. If $f(x) = x$, then for any natural number $n$, the $n$-th iterate $f^{[n]}$ is FrΓ©chet differentiable at $x$ with derivative $(f')^n$.
HasFDerivWithinAt.iterate theorem
{f : E β†’ E} {f' : E β†’L[π•œ] E} (hf : HasFDerivWithinAt f f' s x) (hx : f x = x) (hs : MapsTo f s s) (n : β„•) : HasFDerivWithinAt f^[n] (f' ^ n) s x
Full source
@[fun_prop]
protected theorem HasFDerivWithinAt.iterate {f : E β†’ E} {f' : E β†’L[π•œ] E}
    (hf : HasFDerivWithinAt f f' s x) (hx : f x = x) (hs : MapsTo f s s) (n : β„•) :
    HasFDerivWithinAt f^[n] (f' ^ n) s x := by
  refine HasFDerivAtFilter.iterate hf ?_ hx n
  rw [nhdsWithin]
  convert tendsto_inf.2 ⟨hf.continuousWithinAt, _⟩
  exacts [hx.symm, (tendsto_principal_principal.2 hs).mono_left inf_le_right]
FrΓ©chet Derivative of Iterated Function within a Set: $(f^{[n]})' = (f')^n$ at Fixed Point
Informal description
Let $E$ be a normed space over a non-discrete normed field $\mathbb{K}$, and let $f : E \to E$ be a function with FrΓ©chet derivative $f'$ at $x \in E$ within a set $s \subseteq E$. If $f(x) = x$ and $f$ maps $s$ into itself, then for any natural number $n$, the $n$-th iterate $f^{[n]}$ has FrΓ©chet derivative $(f')^n$ at $x$ within $s$.
HasStrictFDerivAt.iterate theorem
{f : E β†’ E} {f' : E β†’L[π•œ] E} (hf : HasStrictFDerivAt f f' x) (hx : f x = x) (n : β„•) : HasStrictFDerivAt f^[n] (f' ^ n) x
Full source
@[fun_prop]
protected theorem HasStrictFDerivAt.iterate {f : E β†’ E} {f' : E β†’L[π•œ] E}
    (hf : HasStrictFDerivAt f f' x) (hx : f x = x) (n : β„•) :
    HasStrictFDerivAt f^[n] (f' ^ n) x := by
  induction n with
  | zero => exact hasStrictFDerivAt_id x
  | succ n ihn =>
    rw [Function.iterate_succ, pow_succ]
    rw [← hx] at ihn
    exact ihn.comp x hf
Strict FrΓ©chet Derivative of Iterated Function at Fixed Point: $(f^{[n]})' = (f')^n$
Informal description
Let $E$ be a normed space over a non-discrete normed field $\mathbb{K}$, and let $f : E \to E$ be a function that has a strict FrΓ©chet derivative $f'$ at $x \in E$. If $f(x) = x$, then for any natural number $n$, the $n$-th iterate $f^{[n]}$ has a strict FrΓ©chet derivative at $x$ given by the $n$-th power of $f'$, i.e., $(f')^n$.
DifferentiableAt.iterate theorem
{f : E β†’ E} (hf : DifferentiableAt π•œ f x) (hx : f x = x) (n : β„•) : DifferentiableAt π•œ f^[n] x
Full source
@[fun_prop]
protected theorem DifferentiableAt.iterate {f : E β†’ E} (hf : DifferentiableAt π•œ f x) (hx : f x = x)
    (n : β„•) : DifferentiableAt π•œ f^[n] x :=
  (hf.hasFDerivAt.iterate hx n).differentiableAt
Differentiability of Iterated Function at Fixed Point
Informal description
Let $E$ be a normed space over a non-discrete normed field $\mathbb{K}$, and let $f : E \to E$ be a function differentiable at $x \in E$. If $f(x) = x$, then for any natural number $n$, the $n$-th iterate $f^{[n]}$ is differentiable at $x$.
DifferentiableWithinAt.iterate theorem
{f : E β†’ E} (hf : DifferentiableWithinAt π•œ f s x) (hx : f x = x) (hs : MapsTo f s s) (n : β„•) : DifferentiableWithinAt π•œ f^[n] s x
Full source
@[fun_prop]
protected theorem DifferentiableWithinAt.iterate {f : E β†’ E} (hf : DifferentiableWithinAt π•œ f s x)
    (hx : f x = x) (hs : MapsTo f s s) (n : β„•) : DifferentiableWithinAt π•œ f^[n] s x :=
  (hf.hasFDerivWithinAt.iterate hx hs n).differentiableWithinAt
Differentiability of Iterated Function at Fixed Point within a Set
Informal description
Let $E$ be a normed space over a non-discrete normed field $\mathbb{K}$, and let $f : E \to E$ be a function differentiable at $x \in E$ within a set $s \subseteq E$. If $f(x) = x$ and $f$ maps $s$ into itself, then for any natural number $n$, the $n$-th iterate $f^{[n]}$ is differentiable at $x$ within $s$.