The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V15. Real analysis in one variable

Mathlib.Analysis.Calculus.Deriv.Slope

30 declarations. Mathlib docs Β· Source

Derivative as the limit of the slope

In this file we relate the derivative of a function with its definition from a standard undergraduate course as the limit of the slope (f y - f x) / (y - x) as y tends to 𝓝[β‰ ] x. Since we are talking about functions taking values in a normed space instead of the base field, we use slope f x y = (y - x)⁻¹ β€’ (f y - f x) instead of division.

We also prove some estimates on the upper/lower limits of the slope in terms of the derivative.

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

Tags

derivative, slope

Upper estimates on liminf and limsup

theorem hasDerivAtFilter_iff_tendsto_slope E1 #

βˆ€ {π•œ : Type u} [inst : NontriviallyNormedField π•œ] {F : Type v} [inst_1 : NormedAddCommGroup F]
  [inst_2 : NormedSpace π•œ F] {f : π•œ β†’ F} {f' : F} {x : π•œ} {L : Filter π•œ},
  HasDerivAtFilter f f' (L Γ—Λ’ pure x) ↔ Filter.Tendsto (slope f x) (L βŠ“ Filter.principal {x}ᢜ) (nhds f')

If the domain has dimension one, then Fréchet derivative is equivalent to the classical definition with a limit. In this version we have to take the limit along the subset {x}ᢜ, because for y=x the slope equals zero due to the convention 0⁻¹=0.

theorem hasDerivWithinAt_iff_tendsto_slope E1 #

βˆ€ {π•œ : Type u} [inst : NontriviallyNormedField π•œ] {F : Type v} [inst_1 : NormedAddCommGroup F]
  [inst_2 : NormedSpace π•œ F] {f : π•œ β†’ F} {f' : F} {x : π•œ} {s : Set π•œ},
  HasDerivWithinAt f f' s x ↔ Filter.Tendsto (slope f x) (nhdsWithin x (s \ {x})) (nhds f')

theorem hasDerivWithinAt_iff_tendsto_slope' E1 #

βˆ€ {π•œ : Type u} [inst : NontriviallyNormedField π•œ] {F : Type v} [inst_1 : NormedAddCommGroup F]
  [inst_2 : NormedSpace π•œ F] {f : π•œ β†’ F} {f' : F} {x : π•œ} {s : Set π•œ},
  x βˆ‰ s β†’ (HasDerivWithinAt f f' s x ↔ Filter.Tendsto (slope f x) (nhdsWithin x s) (nhds f'))

theorem hasDerivAt_iff_tendsto_slope E1 #

βˆ€ {π•œ : Type u} [inst : NontriviallyNormedField π•œ] {F : Type v} [inst_1 : NormedAddCommGroup F]
  [inst_2 : NormedSpace π•œ F] {f : π•œ β†’ F} {f' : F} {x : π•œ},
  HasDerivAt f f' x ↔ Filter.Tendsto (slope f x) (nhdsWithin x {x}ᢜ) (nhds f')

theorem HasDerivAt.tendsto_slope E1 #

βˆ€ {π•œ : Type u} [inst : NontriviallyNormedField π•œ] {F : Type v} [inst_1 : NormedAddCommGroup F]
  [inst_2 : NormedSpace π•œ F] {f : π•œ β†’ F} {f' : F} {x : π•œ},
  HasDerivAt f f' x β†’ Filter.Tendsto (slope f x) (nhdsWithin x {x}ᢜ) (nhds f')

Alias of the forward direction of hasDerivAt_iff_tendsto_slope.

theorem hasDerivAt_iff_tendsto_slope_left_right E1 #

βˆ€ {π•œ : Type u} [inst : NontriviallyNormedField π•œ] {F : Type v} [inst_1 : NormedAddCommGroup F]
  [inst_2 : NormedSpace π•œ F] {f : π•œ β†’ F} {f' : F} {x : π•œ} [inst_3 : LinearOrder π•œ],
  HasDerivAt f f' x ↔
    Filter.Tendsto (slope f x) (nhdsWithin x (Set.Iio x)) (nhds f') ∧
      Filter.Tendsto (slope f x) (nhdsWithin x (Set.Ioi x)) (nhds f')

theorem hasDerivAt_iff_tendsto_slope_zero E1 #

βˆ€ {π•œ : Type u} [inst : NontriviallyNormedField π•œ] {F : Type v} [inst_1 : NormedAddCommGroup F]
  [inst_2 : NormedSpace π•œ F] {f : π•œ β†’ F} {f' : F} {x : π•œ},
  HasDerivAt f f' x ↔ Filter.Tendsto (fun t ↦ t⁻¹ β€’ (f (x + t) - f x)) (nhdsWithin 0 {0}ᢜ) (nhds f')

theorem HasDerivAt.tendsto_slope_zero E1 #

βˆ€ {π•œ : Type u} [inst : NontriviallyNormedField π•œ] {F : Type v} [inst_1 : NormedAddCommGroup F]
  [inst_2 : NormedSpace π•œ F] {f : π•œ β†’ F} {f' : F} {x : π•œ},
  HasDerivAt f f' x β†’ Filter.Tendsto (fun t ↦ t⁻¹ β€’ (f (x + t) - f x)) (nhdsWithin 0 {0}ᢜ) (nhds f')

Alias of the forward direction of hasDerivAt_iff_tendsto_slope_zero.

theorem HasDerivAt.tendsto_slope_zero_right E1 #

βˆ€ {π•œ : Type u} [inst : NontriviallyNormedField π•œ] {F : Type v} [inst_1 : NormedAddCommGroup F]
  [inst_2 : NormedSpace π•œ F] {f : π•œ β†’ F} {f' : F} {x : π•œ} [inst_3 : Preorder π•œ],
  HasDerivAt f f' x β†’ Filter.Tendsto (fun t ↦ t⁻¹ β€’ (f (x + t) - f x)) (nhdsWithin 0 (Set.Ioi 0)) (nhds f')

theorem HasDerivAt.tendsto_slope_zero_left E1 #

βˆ€ {π•œ : Type u} [inst : NontriviallyNormedField π•œ] {F : Type v} [inst_1 : NormedAddCommGroup F]
  [inst_2 : NormedSpace π•œ F] {f : π•œ β†’ F} {f' : F} {x : π•œ} [inst_3 : Preorder π•œ],
  HasDerivAt f f' x β†’ Filter.Tendsto (fun t ↦ t⁻¹ β€’ (f (x + t) - f x)) (nhdsWithin 0 (Set.Iio 0)) (nhds f')

theorem range_derivWithin_subset_closure_span_image E1 #

βˆ€ {π•œ : Type u} [inst : NontriviallyNormedField π•œ] {F : Type v} [inst_1 : NormedAddCommGroup F]
  [inst_2 : NormedSpace π•œ F] (f : π•œ β†’ F) {s t : Set π•œ},
  s βŠ† closure (s ∩ t) β†’ Set.range (derivWithin f s) βŠ† closure ↑(Submodule.span π•œ (f '' t))

Given a set t such that s ∩ t is dense in s, then the range of derivWithin f s is contained in the closure of the submodule spanned by the image of t.

theorem range_deriv_subset_closure_span_image E1 #

βˆ€ {π•œ : Type u} [inst : NontriviallyNormedField π•œ] {F : Type v} [inst_1 : NormedAddCommGroup F]
  [inst_2 : NormedSpace π•œ F] (f : π•œ β†’ F) {t : Set π•œ},
  Dense t β†’ Set.range (deriv f) βŠ† closure ↑(Submodule.span π•œ (f '' t))

Given a dense set t, then the range of deriv f is contained in the closure of the submodule spanned by the image of t.

theorem isSeparable_range_derivWithin E1 #

βˆ€ {π•œ : Type u} [inst : NontriviallyNormedField π•œ] {F : Type v} [inst_1 : NormedAddCommGroup F]
  [inst_2 : NormedSpace π•œ F] [TopologicalSpace.SeparableSpace π•œ] (f : π•œ β†’ F) (s : Set π•œ),
  TopologicalSpace.IsSeparable (Set.range (derivWithin f s))

theorem isSeparable_range_deriv E1 #

βˆ€ {π•œ : Type u} [inst : NontriviallyNormedField π•œ] {F : Type v} [inst_1 : NormedAddCommGroup F]
  [inst_2 : NormedSpace π•œ F] [TopologicalSpace.SeparableSpace π•œ] (f : π•œ β†’ F),
  TopologicalSpace.IsSeparable (Set.range (deriv f))

theorem HasDerivAt.continuousAt_div E1 #

βˆ€ {π•œ : Type u} [inst : NontriviallyNormedField π•œ] [inst_1 : DecidableEq π•œ] {f : π•œ β†’ π•œ} {c a : π•œ},
  HasDerivAt f a c β†’ ContinuousAt (Function.update (fun x ↦ (f x - f c) / (x - c)) c a) c

theorem HasDerivWithinAt.nonneg_of_monotoneOn E1 #

βˆ€ {π•œ : Type u} [inst : NontriviallyNormedField π•œ] {x : π•œ} {s : Set π•œ} [inst_1 : LinearOrder π•œ] [IsStrictOrderedRing π•œ]
  [OrderTopology π•œ] {g : π•œ β†’ π•œ} {g' : π•œ},
  AccPt x (Filter.principal s) β†’ HasDerivWithinAt g g' s x β†’ MonotoneOn g s β†’ 0 ≀ g'

If a monotone function has a derivative within a set at a non-isolated point, then this derivative is nonnegative.

theorem MonotoneOn.derivWithin_nonneg E1 #

βˆ€ {π•œ : Type u} [inst : NontriviallyNormedField π•œ] {x : π•œ} {s : Set π•œ} [inst_1 : LinearOrder π•œ] [IsStrictOrderedRing π•œ]
  [OrderTopology π•œ] {g : π•œ β†’ π•œ}, MonotoneOn g s β†’ 0 ≀ derivWithin g s x

The derivative within a set of a monotone function is nonnegative.

theorem HasDerivAt.nonneg_of_monotone E1 #

βˆ€ {π•œ : Type u} [inst : NontriviallyNormedField π•œ] {x : π•œ} [inst_1 : LinearOrder π•œ] [IsStrictOrderedRing π•œ]
  [OrderTopology π•œ] {g : π•œ β†’ π•œ} {g' : π•œ}, HasDerivAt g g' x β†’ Monotone g β†’ 0 ≀ g'

If a monotone function has a derivative, then this derivative is nonnegative.

theorem Monotone.deriv_nonneg E1 #

βˆ€ {π•œ : Type u} [inst : NontriviallyNormedField π•œ] {x : π•œ} [inst_1 : LinearOrder π•œ] [IsStrictOrderedRing π•œ]
  [OrderTopology π•œ] {g : π•œ β†’ π•œ}, Monotone g β†’ 0 ≀ deriv g x

The derivative of a monotone function is nonnegative.

theorem HasDerivWithinAt.nonpos_of_antitoneOn E1 #

βˆ€ {π•œ : Type u} [inst : NontriviallyNormedField π•œ] {x : π•œ} {s : Set π•œ} [inst_1 : LinearOrder π•œ] [IsStrictOrderedRing π•œ]
  [OrderTopology π•œ] {g : π•œ β†’ π•œ} {g' : π•œ},
  AccPt x (Filter.principal s) β†’ HasDerivWithinAt g g' s x β†’ AntitoneOn g s β†’ g' ≀ 0

If an antitone function has a derivative within a set at a non-isolated point, then this derivative is nonpositive.

theorem AntitoneOn.derivWithin_nonpos E1 #

βˆ€ {π•œ : Type u} [inst : NontriviallyNormedField π•œ] {x : π•œ} {s : Set π•œ} [inst_1 : LinearOrder π•œ] [IsStrictOrderedRing π•œ]
  [OrderTopology π•œ] {g : π•œ β†’ π•œ}, AntitoneOn g s β†’ derivWithin g s x ≀ 0

The derivative within a set of an antitone function is nonpositive.

theorem HasDerivAt.nonpos_of_antitone E1 #

βˆ€ {π•œ : Type u} [inst : NontriviallyNormedField π•œ] {x : π•œ} [inst_1 : LinearOrder π•œ] [IsStrictOrderedRing π•œ]
  [OrderTopology π•œ] {g : π•œ β†’ π•œ} {g' : π•œ}, HasDerivAt g g' x β†’ Antitone g β†’ g' ≀ 0

If an antitone function has a derivative, then this derivative is nonpositive.

theorem Antitone.deriv_nonpos E1 #

βˆ€ {π•œ : Type u} [inst : NontriviallyNormedField π•œ] {x : π•œ} [inst_1 : LinearOrder π•œ] [IsStrictOrderedRing π•œ]
  [OrderTopology π•œ] {g : π•œ β†’ π•œ}, Antitone g β†’ deriv g x ≀ 0

The derivative of an antitone function is nonpositive.

theorem HasDerivWithinAt.limsup_slope_le E1 #

βˆ€ {f : ℝ β†’ ℝ} {f' : ℝ} {s : Set ℝ} {x r : ℝ},
  HasDerivWithinAt f f' s x β†’ f' < r β†’ βˆ€αΆ  (z : ℝ) in nhdsWithin x (s \ {x}), slope f x z < r

theorem HasDerivWithinAt.limsup_slope_le' E1 #

βˆ€ {f : ℝ β†’ ℝ} {f' : ℝ} {s : Set ℝ} {x r : ℝ},
  HasDerivWithinAt f f' s x β†’ x βˆ‰ s β†’ f' < r β†’ βˆ€αΆ  (z : ℝ) in nhdsWithin x s, slope f x z < r

theorem HasDerivWithinAt.liminf_right_slope_le E1 #

βˆ€ {f : ℝ β†’ ℝ} {f' x r : ℝ},
  HasDerivWithinAt f f' (Set.Ici x) x β†’ f' < r β†’ βˆƒαΆ  (z : ℝ) in nhdsWithin x (Set.Ioi x), slope f x z < r

theorem HasDerivWithinAt.limsup_norm_slope_le E1 #

βˆ€ {E : Type u} [inst : NormedAddCommGroup E] [inst_1 : NormedSpace ℝ E] {f : ℝ β†’ E} {f' : E} {s : Set ℝ} {x r : ℝ},
  HasDerivWithinAt f f' s x β†’ β€–f'β€– < r β†’ βˆ€αΆ  (z : ℝ) in nhdsWithin x s, β€–z - x‖⁻¹ * β€–f z - f xβ€– < r

If f has derivative f' within s at x, then for any r > β€–f'β€– the ratio β€–f z - f xβ€– / β€–z - xβ€– is less than r in some neighborhood of x within s. In other words, the limit superior of this ratio as z tends to x along s is less than or equal to β€–f'β€–.

theorem HasDerivWithinAt.limsup_slope_norm_le E2 #

βˆ€ {E : Type u} [inst : NormedAddCommGroup E] [inst_1 : NormedSpace ℝ E] {f : ℝ β†’ E} {f' : E} {s : Set ℝ} {x r : ℝ},
  HasDerivWithinAt f f' s x β†’ β€–f'β€– < r β†’ βˆ€αΆ  (z : ℝ) in nhdsWithin x s, β€–z - x‖⁻¹ * (β€–f zβ€– - β€–f xβ€–) < r

If f has derivative f' within s at x, then for any r > β€–f'β€– the ratio (β€–f zβ€– - β€–f xβ€–) / β€–z - xβ€– is less than r in some neighborhood of x within s. In other words, the limit superior of this ratio as z tends to x along s is less than or equal to β€–f'β€–.

This lemma is a weaker version of HasDerivWithinAt.limsup_norm_slope_le where β€–f zβ€– - β€–f xβ€– is replaced by β€–f z - f xβ€–.

theorem HasDerivWithinAt.liminf_right_norm_slope_le E1 #

βˆ€ {E : Type u} [inst : NormedAddCommGroup E] [inst_1 : NormedSpace ℝ E] {f : ℝ β†’ E} {f' : E} {x r : ℝ},
  HasDerivWithinAt f f' (Set.Ici x) x β†’ β€–f'β€– < r β†’ βˆƒαΆ  (z : ℝ) in nhdsWithin x (Set.Ioi x), β€–z - x‖⁻¹ * β€–f z - f xβ€– < r

If f has derivative f' within (x, +∞) at x, then for any r > β€–f'β€– the ratio β€–f z - f xβ€– / β€–z - xβ€– is frequently less than r as z β†’ x+0. In other words, the limit inferior of this ratio as z tends to x+0 is less than or equal to β€–f'β€–. See also HasDerivWithinAt.limsup_norm_slope_le for a stronger version using limit superior and any set s.

theorem HasDerivWithinAt.liminf_right_slope_norm_le E1 #

βˆ€ {E : Type u} [inst : NormedAddCommGroup E] [inst_1 : NormedSpace ℝ E] {f : ℝ β†’ E} {f' : E} {x r : ℝ},
  HasDerivWithinAt f f' (Set.Ici x) x β†’
    β€–f'β€– < r β†’ βˆƒαΆ  (z : ℝ) in nhdsWithin x (Set.Ioi x), (z - x)⁻¹ * (β€–f zβ€– - β€–f xβ€–) < r

If f has derivative f' within (x, +∞) at x, then for any r > β€–f'β€– the ratio (β€–f zβ€– - β€–f xβ€–) / (z - x) is frequently less than r as z β†’ x+0. In other words, the limit inferior of this ratio as z tends to x+0 is less than or equal to β€–f'β€–.

See also

  • HasDerivWithinAt.limsup_norm_slope_le for a stronger version using limit superior and any set s;
  • HasDerivWithinAt.liminf_right_norm_slope_le for a stronger version using β€–f z - f xpβ€– instead of β€–f zβ€– - β€–f xβ€–.