Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Lean/Mathlib/Mathlib/Analysis/Calculus/FDeriv/     Datei vom 15.10.2026 mit Größe 14 kB image not shown  

Quelle  Congr.lean   Sprache: Lean

 

/-
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
-/

module

public import Mathlib.Analysis.Calculus.FDeriv.Basic

/-!
# The Fréchet derivative: congruence properties

Lemmas about congruence properties of the Fréchet derivative under change of function, set, etc.

## Tags

derivative, differentiable, Fréchet, calculus
-/


public section

open Filter Asymptotics ContinuousLinearMap Set

open scoped Topology

section
variable {�� : Type*} [NontriviallyNormedField ��]
variable {E : Type*} [AddCommGroup E] [Module �� E] [TopologicalSpace E]
variable {F : Type*} [AddCommGroup F] [Module �� F] [TopologicalSpace F]

variable {f f₀ f₁ : E → F}
variable {f' f₀' f₁' g' : E →L[��] F}
variable {x : E}
variable {s t : Set E}
variable {L : Filter (E × E)}

section congr

/-! ### congr properties of the derivative -/

theorem hasFDerivWithinAt_congr_set_nhdsNE (h : s =ᶠ[��[≠] x] t) :
    HasFDerivWithinAt f f' s x ↔ HasFDerivWithinAt f f' t x :=
  calc
    HasFDerivWithinAt f f' s x ↔ HasFDerivWithinAt f f' (s \ {x}) x :=
      hasFDerivWithinAt_sdiff_singleton_self.symm
    _ ↔ HasFDerivWithinAt f f' (t \ {x}) x := by
      suffices ��[s \ {x}] x = ��[t \ {x}] x by simp only [HasFDerivWithinAt, this]
      simpa only [eventuallyEqSet_iff_inf_principal, ← nhdsWithin_inter', sdiff_eq, inter_comm]
        using h
    _ ↔ HasFDerivWithinAt f f' t x := hasFDerivWithinAt_sdiff_singleton_self

theorem hasFDerivWithinAt_congr_set (h : s =ᶠ[�� x] t) :
    HasFDerivWithinAt f f' s x ↔ HasFDerivWithinAt f f' t x :=
  hasFDerivWithinAt_congr_set_nhdsNE <| h.filter_mono inf_le_left

/-- In the case `y = x`, see also `hasFDerivWithinAt_congr_set_nhdsNE`,
which does not require the domain to be a T₁ space. -/

theorem hasFDerivWithinAt_congr_set' [T1Space E] (y : E)
    (h : s =ᶠ[��[{y}ᶜ] x] t) :
    HasFDerivWithinAt f f' s x ↔ HasFDerivWithinAt f f' t x := by
  rcases eq_or_ne x y with rfl | hne
  · exact hasFDerivWithinAt_congr_set_nhdsNE h
  · rw [hne.nhdsWithin_compl_singleton] at h
    exact hasFDerivWithinAt_congr_set h

theorem differentiableWithinAt_congr_set_nhdsNE (h : s =ᶠ[��[≠] x] t) :
    DifferentiableWithinAt �� f s x ↔ DifferentiableWithinAt �� f t x :=
  exists_congr fun _ => hasFDerivWithinAt_congr_set_nhdsNE h

/-- In the case `y = x`, see also `differentiableWithinAt_congr_set_nhdsNE`,
which does not require the domain to be a T₁ space. -/

theorem differentiableWithinAt_congr_set' [T1Space E] (y : E) (h : s =ᶠ[��[{y}ᶜ] x] t) :
    DifferentiableWithinAt �� f s x ↔ DifferentiableWithinAt �� f t x :=
  exists_congr fun _ => hasFDerivWithinAt_congr_set' _ h

theorem differentiableWithinAt_congr_set (h : s =ᶠ[�� x] t) :
    DifferentiableWithinAt �� f s x ↔ DifferentiableWithinAt �� f t x :=
  exists_congr fun _ => hasFDerivWithinAt_congr_set h

theorem fderivWithin_congr_set_nhdsNE (h : s =ᶠ[��[≠] x] t) :
    fderivWithin �� f s x = fderivWithin �� f t x := by
  classical
  simp only [fderivWithin_def, differentiableWithinAt_congr_set_nhdsNE h,
    hasFDerivWithinAt_congr_set_nhdsNE h]

/-- In the case `y = x`, see also `fderivWithin_congr_set_nhdsNE`,
which does not require the domain to be a T₁ space. -/

theorem fderivWithin_congr_set' [T1Space E] (y : E) (h : s =ᶠ[��[{y}ᶜ] x] t) :
    fderivWithin �� f s x = fderivWithin �� f t x := by
  classical
  simp only [fderivWithin_def, differentiableWithinAt_congr_set' _ h,
    hasFDerivWithinAt_congr_set' _ h]

theorem fderivWithin_congr_set (h : s =ᶠ[�� x] t) : fderivWithin �� f s x = fderivWithin �� f t x :=
  fderivWithin_congr_set_nhdsNE <| h.filter_mono inf_le_left

theorem fderivWithin_eventually_congr_set' [T1Space E] (y : E) (h : s =ᶠ[��[{y}ᶜ] x] t) :
    fderivWithin �� f s =ᶠ[�� x] fderivWithin �� f t :=
  (eventually_nhds_nhdsWithin.2 h).mono fun _ => fderivWithin_congr_set' y

theorem fderivWithin_eventually_congr_set (h : s =ᶠ[�� x] t) :
    fderivWithin �� f s =ᶠ[�� x] fderivWithin �� f t :=
  (eventually_eventually_nhds.2 h).mono fun _ => fderivWithin_congr_set

theorem Filter.EventuallyEq.hasFDerivAtFilter_iff (h₀ : Prod.map f₀ f₀ =ᶠ[L] Prod.map f₁ f₁)
    (h₁ : ∀ x, f₀' x = f₁' x) : HasFDerivAtFilter f₀ f₀' L ↔ HasFDerivAtFilter f₁ f₁' L := by
  simp only [hasFDerivAtFilter_iff_isLittleOTVS]
  exact isLittleOTVS_congr (h₀.mono fun y hy => by simp_all [Prod.map]) .rfl

theorem Filter.EventuallyEq.hasStrictFDerivAt_iff (h : f₀ =ᶠ[�� x] f₁) (h' : ∀ y, f₀' y = f₁' y) :
    HasStrictFDerivAt f₀ f₀' x ↔ HasStrictFDerivAt f₁ f₁' x :=
  h.prodMap_nhds h |>.hasFDerivAtFilter_iff h'

theorem HasStrictFDerivAt.congr_fderiv (h : HasStrictFDerivAt f f' x) (h' : f' = g') :
    HasStrictFDerivAt f g' x :=
  h' ▸ h

theorem HasFDerivAt.congr_fderiv (h : HasFDerivAt f f' x) (h' : f' = g') : HasFDerivAt f g' x :=
  h' ▸ h

theorem HasFDerivWithinAt.congr_fderiv (h : HasFDerivWithinAt f f' s x) (h' : f' = g') :
    HasFDerivWithinAt f g' s x :=
  h' ▸ h

theorem HasStrictFDerivAt.congr_of_eventuallyEq (h : HasStrictFDerivAt f f' x)
    (h₁ : f =ᶠ[�� x] f₁) : HasStrictFDerivAt f₁ f' x :=
  (h₁.hasStrictFDerivAt_iff fun _ => rfl).1 h

theorem HasFDerivAtFilter.congr_of_eventuallyEq (h : HasFDerivAtFilter f f' L)
    (hL : Prod.map f₁ f₁ =ᶠ[L] Prod.map f f) :
    HasFDerivAtFilter f₁ f' L :=
  (hL.hasFDerivAtFilter_iff fun _ => rfl).2 h

theorem Filter.EventuallyEq.hasFDerivAt_iff (h : f₀ =ᶠ[�� x] f₁) :
    HasFDerivAt f₀ f' x ↔ HasFDerivAt f₁ f' x :=
  h.prodMap (h.filter_mono <| pure_le_nhds _) |>.hasFDerivAtFilter_iff fun _ => rfl

theorem Filter.EventuallyEq.differentiableAt_iff (h : f₀ =ᶠ[�� x] f₁) :
    DifferentiableAt �� f₀ x ↔ DifferentiableAt �� f₁ x :=
  exists_congr fun _ => h.hasFDerivAt_iff

theorem Filter.EventuallyEq.hasFDerivWithinAt_iff (h : f₀ =ᶠ[��[s] x] f₁) (hx : f₀ x = f₁ x) :
    HasFDerivWithinAt f₀ f' s x ↔ HasFDerivWithinAt f₁ f' s x :=
  h.prodMap (by assumption) |>.hasFDerivAtFilter_iff fun _ => _root_.rfl

theorem Filter.EventuallyEq.hasFDerivWithinAt_iff_of_mem (h : f₀ =ᶠ[��[s] x] f₁) (hx : x ∈ s) :
    HasFDerivWithinAt f₀ f' s x ↔ HasFDerivWithinAt f₁ f' s x :=
  h.hasFDerivWithinAt_iff (h.eq_of_nhdsWithin hx)

theorem Filter.EventuallyEq.differentiableWithinAt_iff (h : f₀ =ᶠ[��[s] x] f₁) (hx : f₀ x = f₁ x) :
    DifferentiableWithinAt �� f₀ s x ↔ DifferentiableWithinAt �� f₁ s x :=
  exists_congr fun _ => h.hasFDerivWithinAt_iff hx

theorem Filter.EventuallyEq.differentiableWithinAt_iff_of_mem (h : f₀ =ᶠ[��[s] x] f₁) (hx : x ∈ s) :
    DifferentiableWithinAt �� f₀ s x ↔ DifferentiableWithinAt �� f₁ s x :=
  h.differentiableWithinAt_iff (h.eq_of_nhdsWithin hx)

theorem HasFDerivWithinAt.congr_of_eventuallyEq (h : HasFDerivWithinAt f f' s x)
    (h₁ : f₁ =ᶠ[��[s] x] f) (hx : f₁ x = f x) : HasFDerivWithinAt f₁ f' s x :=
  h₁.hasFDerivWithinAt_iff hx |>.mpr h

theorem HasFDerivWithinAt.congr (h : HasFDerivWithinAt f f' s x) (hs : EqOn f₁ f s)
    (hx : f₁ x = f x) : HasFDerivWithinAt f₁ f' s x :=
  h.congr_of_eventuallyEq hs.eventuallyEq_nhdsWithin hx

theorem HasFDerivWithinAt.congr' (h : HasFDerivWithinAt f f' s x) (hs : EqOn f₁ f s) (hx : x ∈ s) :
    HasFDerivWithinAt f₁ f' s x :=
  h.congr hs (hs hx)

theorem HasFDerivWithinAt.congr_mono (h : HasFDerivWithinAt f f' s x) (ht : EqOn f₁ f t)
    (hx : f₁ x = f x) (h₁ : t ⊆ s) : HasFDerivWithinAt f₁ f' t x :=
  h.mono h₁ |>.congr ht hx

theorem HasFDerivAt.congr_of_eventuallyEq (h : HasFDerivAt f f' x) (h₁ : f₁ =ᶠ[�� x] f) :
    HasFDerivAt f₁ f' x :=
  h₁.hasFDerivAt_iff.mpr h

theorem DifferentiableWithinAt.congr_mono (h : DifferentiableWithinAt �� f s x) (ht : EqOn f₁ f t)
    (hx : f₁ x = f x) (h₁ : t ⊆ s) : DifferentiableWithinAt �� f₁ t x :=
  (HasFDerivWithinAt.congr_mono h.hasFDerivWithinAt ht hx h₁).differentiableWithinAt

theorem DifferentiableWithinAt.congr (h : DifferentiableWithinAt �� f s x) (ht : ∀ x ∈ s, f₁ x = f x)
    (hx : f₁ x = f x) : DifferentiableWithinAt �� f₁ s x :=
  DifferentiableWithinAt.congr_mono h ht hx (Subset.refl _)

theorem DifferentiableWithinAt.congr_of_eventuallyEq (h : DifferentiableWithinAt �� f s x)
    (h₁ : f₁ =ᶠ[��[s] x] f) (hx : f₁ x = f x) : DifferentiableWithinAt �� f₁ s x :=
  (h.hasFDerivWithinAt.congr_of_eventuallyEq h₁ hx).differentiableWithinAt

theorem DifferentiableWithinAt.congr_of_eventuallyEq_of_mem (h : DifferentiableWithinAt �� f s x)
    (h₁ : f₁ =ᶠ[��[s] x] f) (hx : x ∈ s) : DifferentiableWithinAt �� f₁ s x :=
  h.congr_of_eventuallyEq h₁ (mem_of_mem_nhdsWithin hx h₁ :)

theorem DifferentiableWithinAt.congr_of_eventuallyEq_insert (h : DifferentiableWithinAt �� f s x)
    (h₁ : f₁ =ᶠ[��[insert x s] x] f) : DifferentiableWithinAt �� f₁ s x :=
  (h.insert.congr_of_eventuallyEq_of_mem h₁ (mem_insert _ _)).of_insert

theorem DifferentiableOn.congr_mono (h : DifferentiableOn �� f s) (h' : ∀ x ∈ t, f₁ x = f x)
    (h₁ : t ⊆ s) : DifferentiableOn �� f₁ t := fun x hx => (h x (h₁ hx)).congr_mono h' (h' x hx) h₁

theorem DifferentiableOn.congr (h : DifferentiableOn �� f s) (h' : ∀ x ∈ s, f₁ x = f x) :
    DifferentiableOn �� f₁ s := fun x hx => (h x hx).congr h' (h' x hx)

theorem differentiableOn_congr (h' : ∀ x ∈ s, f₁ x = f x) :
    DifferentiableOn �� f₁ s ↔ DifferentiableOn �� f s :=
  ⟨fun h => DifferentiableOn.congr h fun y hy => (h' y hy).symm, fun h =>
    DifferentiableOn.congr h h'⟩

theorem DifferentiableAt.congr_of_eventuallyEq (h : DifferentiableAt �� f x) (hL : f₁ =ᶠ[�� x] f) :
    DifferentiableAt �� f₁ x :=
  hL.differentiableAt_iff.2 h

theorem DifferentiableWithinAt.fderivWithin_congr_mono
    [ContinuousAdd E] [ContinuousSMul �� E] [ContinuousAdd F] [ContinuousSMul �� F] [T2Space F]
    (h : DifferentiableWithinAt �� f s x)
    (hs : EqOn f₁ f t) (hx : f₁ x = f x) (hxt : UniqueDiffWithinAt �� t x) (h₁ : t ⊆ s) :
    fderivWithin �� f₁ t x = fderivWithin �� f s x :=
  (HasFDerivWithinAt.congr_mono h.hasFDerivWithinAt hs hx h₁).fderivWithin hxt

set_option backward.isDefEq.respectTransparency false in
theorem Filter.EventuallyEq.fderivWithin_eq (hs : f₁ =ᶠ[��[s] x] f) (hx : f₁ x = f x) :
    fderivWithin �� f₁ s x = fderivWithin �� f s x := by
  classical
  simp only [fderivWithin_def, DifferentiableWithinAt, hs.hasFDerivWithinAt_iff hx]

theorem Filter.EventuallyEq.fderivWithin_eq_of_mem (hs : f₁ =ᶠ[��[s] x] f) (hx : x ∈ s) :
    fderivWithin �� f₁ s x = fderivWithin �� f s x :=
  hs.fderivWithin_eq (mem_of_mem_nhdsWithin hx hs :)

theorem Filter.EventuallyEq.fderivWithin_eq_of_insert (hs : f₁ =ᶠ[��[insert x s] x] f) :
    fderivWithin �� f₁ s x = fderivWithin �� f s x := by
  apply Filter.EventuallyEq.fderivWithin_eq (nhdsWithin_mono _ (subset_insert x s) hs)
  exact (mem_of_mem_nhdsWithin (mem_insert x s) hs :)

theorem Filter.EventuallyEq.fderivWithin' (hs : f₁ =ᶠ[��[s] x] f) (ht : t ⊆ s) :
    fderivWithin �� f₁ t =ᶠ[��[s] x] fderivWithin �� f t :=
  (eventually_eventually_nhdsWithin.2 hs).mp <|
    eventually_mem_nhdsWithin.mono fun _y hys hs =>
      EventuallyEq.fderivWithin_eq (hs.filter_mono <| nhdsWithin_mono _ ht)
        (hs.self_of_nhdsWithin hys)

protected theorem Filter.EventuallyEq.fderivWithin (hs : f₁ =ᶠ[��[s] x] f) :
    fderivWithin �� f₁ s =ᶠ[��[s] x] fderivWithin �� f s :=
  hs.fderivWithin' Subset.rfl

theorem Filter.EventuallyEq.fderivWithin_eq_of_nhds (h : f₁ =ᶠ[�� x] f) :
    fderivWithin �� f₁ s x = fderivWithin �� f s x :=
  (h.filter_mono nhdsWithin_le_nhds).fderivWithin_eq h.self_of_nhds

theorem fderivWithin_congr (hs : EqOn f₁ f s) (hx : f₁ x = f x) :
    fderivWithin �� f₁ s x = fderivWithin �� f s x :=
  (hs.eventuallyEq.filter_mono inf_le_right).fderivWithin_eq hx

theorem fderivWithin_congr' (hs : EqOn f₁ f s) (hx : x ∈ s) :
    fderivWithin �� f₁ s x = fderivWithin �� f s x :=
  fderivWithin_congr hs (hs hx)

theorem Filter.EventuallyEq.fderiv_eq (h : f₁ =ᶠ[�� x] f) : fderiv �� f₁ x = fderiv �� f x := by
  rw [← fderivWithin_univ, ← fderivWithin_univ, h.fderivWithin_eq_of_nhds]

protected theorem Filter.EventuallyEq.fderiv (h : f₁ =ᶠ[�� x] f) : fderiv �� f₁ =ᶠ[�� x] fderiv �� f :=
  h.eventuallyEq_nhds.mono fun _ h => h.fderiv_eq

/-- If two functions agree on a codiscrete subset of `s`, then so do their derivatives within
any subset `t` of `s`. -/

theorem Filter.EventuallyEq.codiscreteWithin_fderivWithin'
    (h : f₁ =ᶠ[codiscreteWithin s] f) (ht : t ⊆ s) :
    fderivWithin �� f₁ t =ᶠ[codiscreteWithin s] fderivWithin �� f t := by
  filter_upwards [h, self_mem_codiscreteWithin s] with x hx hxs
  have hsx : f₁ =ᶠ[��[s] x] f := by
    rw [← insert_sdiff_self_of_mem hxs, nhdsWithin_insert, EventuallyEq,
      eventually_sup, eventually_pure]
    exact ⟨hx, eventuallyEq_codiscreteWithin_iff_forall_eventuallyEq_nhdsWithin.1 h x hxs⟩
  exact (hsx.filter_mono <| nhdsWithin_mono x ht).fderivWithin_eq hx

/-- If two functions agree on a codiscrete subset of `s`, then so do their derivatives
within `s`. -/

theorem Filter.EventuallyEq.codiscreteWithin_fderivWithin
    (h : f₁ =ᶠ[codiscreteWithin s] f) :
    fderivWithin �� f₁ s =ᶠ[codiscreteWithin s] fderivWithin �� f s :=
  h.codiscreteWithin_fderivWithin' Subset.rfl

/-- If two functions agree on a codiscrete subset of an open set `s`, then so do their
derivatives. -/

theorem Filter.EventuallyEq.codiscreteWithin_fderiv
    (h : f₁ =ᶠ[codiscreteWithin s] f) (hs : IsOpen s) :
    fderiv �� f₁ =ᶠ[codiscreteWithin s] fderiv �� f := by
  filter_upwards [h.codiscreteWithin_fderivWithin (�� := ��), self_mem_codiscreteWithin s]
  intro x hx hxs
  simp_all [fderivWithin_of_isOpen]

/-- If two functions agree on a codiscrete subset of `E`, then so do their derivatives within
any subset `s` of `E`. -/

theorem Filter.EventuallyEq.codiscrete_fderivWithin
    (h : f₁ =ᶠ[codiscrete E] f) :
    fderivWithin �� f₁ s =ᶠ[codiscrete E] fderivWithin �� f s :=
  h.codiscreteWithin_fderivWithin' <| subset_univ _

/-- If two functions agree on a codiscrete subset of `E`, then so do their derivatives. -/
theorem Filter.EventuallyEq.codiscrete_fderiv
    (h : f₁ =ᶠ[codiscrete E] f) :
    fderiv �� f₁ =ᶠ[codiscrete E] fderiv �� f :=
  h.codiscreteWithin_fderiv isOpen_univ

end congr

end

Messung
CHZG
9210010097

¤ Dauer der Verarbeitung: 0.29 Sekunden  ¤

*© Formatika GbR, Deutschland