analysis.calculus.deriv.slope ⟷ Mathlib.Analysis.Calculus.Deriv.Slope

This file has been ported!

Changes since the initial port

The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -153,7 +153,7 @@ theorem HasDerivWithinAt.limsup_norm_slope_le (hf : HasDerivWithinAt f f' s x) (
   have B : βˆ€αΆ  z in 𝓝[{x}] x, β€–(z - x)⁻¹ β€’ (f z - f x)β€– ∈ Iio r :=
     mem_of_superset self_mem_nhdsWithin (singleton_subset_iff.2 <| by simp [hrβ‚€])
   have C := mem_sup.2 ⟨A, B⟩
-  rw [← nhdsWithin_union, diff_union_self, nhdsWithin_union, mem_sup] at C 
+  rw [← nhdsWithin_union, diff_union_self, nhdsWithin_union, mem_sup] at C
   filter_upwards [C.1]
   simp only [norm_smul, mem_Iio, norm_inv]
   exact fun _ => id
@@ -208,7 +208,7 @@ theorem HasDerivWithinAt.liminf_right_slope_norm_le (hf : HasDerivWithinAt f f'
   have := (hf.Ioi_of_Ici.limsup_slope_norm_le hr).Frequently
   refine' this.mp (eventually.mono self_mem_nhdsWithin _)
   intro z hxz hz
-  rwa [Real.norm_eq_abs, abs_of_pos (sub_pos_of_lt hxz)] at hz 
+  rwa [Real.norm_eq_abs, abs_of_pos (sub_pos_of_lt hxz)] at hz
 #align has_deriv_within_at.liminf_right_slope_norm_le HasDerivWithinAt.liminf_right_slope_norm_le
 -/
 
Diff
@@ -3,8 +3,8 @@ Copyright (c) 2019 Yury Kudryashov. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yury Kudryashov
 -/
-import Mathbin.Analysis.Calculus.Deriv.Basic
-import Mathbin.LinearAlgebra.AffineSpace.Slope
+import Analysis.Calculus.Deriv.Basic
+import LinearAlgebra.AffineSpace.Slope
 
 #align_import analysis.calculus.deriv.slope from "leanprover-community/mathlib"@"f60c6087a7275b72d5db3c5a1d0e19e35a429c0a"
 
Diff
@@ -2,15 +2,12 @@
 Copyright (c) 2019 Yury Kudryashov. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yury Kudryashov
-
-! This file was ported from Lean 3 source module analysis.calculus.deriv.slope
-! leanprover-community/mathlib commit f60c6087a7275b72d5db3c5a1d0e19e35a429c0a
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Analysis.Calculus.Deriv.Basic
 import Mathbin.LinearAlgebra.AffineSpace.Slope
 
+#align_import analysis.calculus.deriv.slope from "leanprover-community/mathlib"@"f60c6087a7275b72d5db3c5a1d0e19e35a429c0a"
+
 /-!
 # Derivative as the limit of the slope
 
Diff
@@ -61,6 +61,7 @@ variable {s t : Set π•œ}
 
 variable {L L₁ Lβ‚‚ : Filter π•œ}
 
+#print hasDerivAtFilter_iff_tendsto_slope /-
 /-- 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`. -/
@@ -76,13 +77,16 @@ theorem hasDerivAtFilter_iff_tendsto_slope {x : π•œ} {L : Filter π•œ} :
   simp only [(· ∘ ·)]
   rw [smul_sub, ← mul_smul, inv_mul_cancel (sub_ne_zero.2 hz), one_smul, slope_def_module]
 #align has_deriv_at_filter_iff_tendsto_slope hasDerivAtFilter_iff_tendsto_slope
+-/
 
+#print hasDerivWithinAt_iff_tendsto_slope /-
 theorem hasDerivWithinAt_iff_tendsto_slope :
     HasDerivWithinAt f f' s x ↔ Tendsto (slope f x) (𝓝[s \ {x}] x) (𝓝 f') :=
   by
   simp only [HasDerivWithinAt, nhdsWithin, diff_eq, inf_assoc.symm, inf_principal.symm]
   exact hasDerivAtFilter_iff_tendsto_slope
 #align has_deriv_within_at_iff_tendsto_slope hasDerivWithinAt_iff_tendsto_slope
+-/
 
 #print hasDerivWithinAt_iff_tendsto_slope' /-
 theorem hasDerivWithinAt_iff_tendsto_slope' (hs : x βˆ‰ s) :
@@ -93,9 +97,11 @@ theorem hasDerivWithinAt_iff_tendsto_slope' (hs : x βˆ‰ s) :
 #align has_deriv_within_at_iff_tendsto_slope' hasDerivWithinAt_iff_tendsto_slope'
 -/
 
+#print hasDerivAt_iff_tendsto_slope /-
 theorem hasDerivAt_iff_tendsto_slope : HasDerivAt f f' x ↔ Tendsto (slope f x) (𝓝[β‰ ] x) (𝓝 f') :=
   hasDerivAtFilter_iff_tendsto_slope
 #align has_deriv_at_iff_tendsto_slope hasDerivAt_iff_tendsto_slope
+-/
 
 end NormedField
 
@@ -106,20 +112,26 @@ section Real
 
 variable {f : ℝ β†’ ℝ} {f' : ℝ} {s : Set ℝ} {x : ℝ} {r : ℝ}
 
+#print HasDerivWithinAt.limsup_slope_le /-
 theorem HasDerivWithinAt.limsup_slope_le (hf : HasDerivWithinAt f f' s x) (hr : f' < r) :
     βˆ€αΆ  z in 𝓝[s \ {x}] x, slope f x z < r :=
   hasDerivWithinAt_iff_tendsto_slope.1 hf (IsOpen.mem_nhds isOpen_Iio hr)
 #align has_deriv_within_at.limsup_slope_le HasDerivWithinAt.limsup_slope_le
+-/
 
+#print HasDerivWithinAt.limsup_slope_le' /-
 theorem HasDerivWithinAt.limsup_slope_le' (hf : HasDerivWithinAt f f' s x) (hs : x βˆ‰ s)
     (hr : f' < r) : βˆ€αΆ  z in 𝓝[s] x, slope f x z < r :=
   (hasDerivWithinAt_iff_tendsto_slope' hs).1 hf (IsOpen.mem_nhds isOpen_Iio hr)
 #align has_deriv_within_at.limsup_slope_le' HasDerivWithinAt.limsup_slope_le'
+-/
 
+#print HasDerivWithinAt.liminf_right_slope_le /-
 theorem HasDerivWithinAt.liminf_right_slope_le (hf : HasDerivWithinAt f f' (Ici x) x)
     (hr : f' < r) : βˆƒαΆ  z in 𝓝[>] x, slope f x z < r :=
   (hf.Ioi_of_Ici.limsup_slope_le' (lt_irrefl x) hr).Frequently
 #align has_deriv_within_at.liminf_right_slope_le HasDerivWithinAt.liminf_right_slope_le
+-/
 
 end Real
 
@@ -130,6 +142,7 @@ open Metric
 variable {E : Type u} [NormedAddCommGroup E] [NormedSpace ℝ E] {f : ℝ β†’ E} {f' : E} {s : Set ℝ}
   {x r : ℝ}
 
+#print HasDerivWithinAt.limsup_norm_slope_le /-
 /-- 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`
@@ -148,7 +161,9 @@ theorem HasDerivWithinAt.limsup_norm_slope_le (hf : HasDerivWithinAt f f' s x) (
   simp only [norm_smul, mem_Iio, norm_inv]
   exact fun _ => id
 #align has_deriv_within_at.limsup_norm_slope_le HasDerivWithinAt.limsup_norm_slope_le
+-/
 
+#print HasDerivWithinAt.limsup_slope_norm_le /-
 /-- 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`
@@ -164,7 +179,9 @@ theorem HasDerivWithinAt.limsup_slope_norm_le (hf : HasDerivWithinAt f f' s x) (
   refine' lt_of_le_of_lt (mul_le_mul_of_nonneg_left (norm_sub_norm_le _ _) _) hz
   exact inv_nonneg.2 (norm_nonneg _)
 #align has_deriv_within_at.limsup_slope_norm_le HasDerivWithinAt.limsup_slope_norm_le
+-/
 
+#print HasDerivWithinAt.liminf_right_norm_slope_le /-
 /-- 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`
@@ -174,7 +191,9 @@ theorem HasDerivWithinAt.liminf_right_norm_slope_le (hf : HasDerivWithinAt f f'
     (hr : β€–f'β€– < r) : βˆƒαΆ  z in 𝓝[>] x, β€–z - x‖⁻¹ * β€–f z - f xβ€– < r :=
   (hf.Ioi_of_Ici.limsup_norm_slope_le hr).Frequently
 #align has_deriv_within_at.liminf_right_norm_slope_le HasDerivWithinAt.liminf_right_norm_slope_le
+-/
 
+#print HasDerivWithinAt.liminf_right_slope_norm_le /-
 /-- 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`
@@ -194,6 +213,7 @@ theorem HasDerivWithinAt.liminf_right_slope_norm_le (hf : HasDerivWithinAt f f'
   intro z hxz hz
   rwa [Real.norm_eq_abs, abs_of_pos (sub_pos_of_lt hxz)] at hz 
 #align has_deriv_within_at.liminf_right_slope_norm_le HasDerivWithinAt.liminf_right_slope_norm_le
+-/
 
 end RealSpace
 
Diff
@@ -88,7 +88,7 @@ theorem hasDerivWithinAt_iff_tendsto_slope :
 theorem hasDerivWithinAt_iff_tendsto_slope' (hs : x βˆ‰ s) :
     HasDerivWithinAt f f' s x ↔ Tendsto (slope f x) (𝓝[s] x) (𝓝 f') :=
   by
-  convert← hasDerivWithinAt_iff_tendsto_slope
+  convert ← hasDerivWithinAt_iff_tendsto_slope
   exact diff_singleton_eq_self hs
 #align has_deriv_within_at_iff_tendsto_slope' hasDerivWithinAt_iff_tendsto_slope'
 -/
Diff
@@ -143,7 +143,7 @@ theorem HasDerivWithinAt.limsup_norm_slope_le (hf : HasDerivWithinAt f f' s x) (
   have B : βˆ€αΆ  z in 𝓝[{x}] x, β€–(z - x)⁻¹ β€’ (f z - f x)β€– ∈ Iio r :=
     mem_of_superset self_mem_nhdsWithin (singleton_subset_iff.2 <| by simp [hrβ‚€])
   have C := mem_sup.2 ⟨A, B⟩
-  rw [← nhdsWithin_union, diff_union_self, nhdsWithin_union, mem_sup] at C
+  rw [← nhdsWithin_union, diff_union_self, nhdsWithin_union, mem_sup] at C 
   filter_upwards [C.1]
   simp only [norm_smul, mem_Iio, norm_inv]
   exact fun _ => id
@@ -192,7 +192,7 @@ theorem HasDerivWithinAt.liminf_right_slope_norm_le (hf : HasDerivWithinAt f f'
   have := (hf.Ioi_of_Ici.limsup_slope_norm_le hr).Frequently
   refine' this.mp (eventually.mono self_mem_nhdsWithin _)
   intro z hxz hz
-  rwa [Real.norm_eq_abs, abs_of_pos (sub_pos_of_lt hxz)] at hz
+  rwa [Real.norm_eq_abs, abs_of_pos (sub_pos_of_lt hxz)] at hz 
 #align has_deriv_within_at.liminf_right_slope_norm_le HasDerivWithinAt.liminf_right_slope_norm_le
 
 end RealSpace
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yury Kudryashov
 
 ! This file was ported from Lean 3 source module analysis.calculus.deriv.slope
-! leanprover-community/mathlib commit 3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe
+! leanprover-community/mathlib commit f60c6087a7275b72d5db3c5a1d0e19e35a429c0a
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -14,6 +14,9 @@ import Mathbin.LinearAlgebra.AffineSpace.Slope
 /-!
 # Derivative as the limit of the slope
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 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
Diff
@@ -81,12 +81,14 @@ theorem hasDerivWithinAt_iff_tendsto_slope :
   exact hasDerivAtFilter_iff_tendsto_slope
 #align has_deriv_within_at_iff_tendsto_slope hasDerivWithinAt_iff_tendsto_slope
 
+#print hasDerivWithinAt_iff_tendsto_slope' /-
 theorem hasDerivWithinAt_iff_tendsto_slope' (hs : x βˆ‰ s) :
     HasDerivWithinAt f f' s x ↔ Tendsto (slope f x) (𝓝[s] x) (𝓝 f') :=
   by
   convert← hasDerivWithinAt_iff_tendsto_slope
   exact diff_singleton_eq_self hs
 #align has_deriv_within_at_iff_tendsto_slope' hasDerivWithinAt_iff_tendsto_slope'
+-/
 
 theorem hasDerivAt_iff_tendsto_slope : HasDerivAt f f' x ↔ Tendsto (slope f x) (𝓝[β‰ ] x) (𝓝 f') :=
   hasDerivAtFilter_iff_tendsto_slope
Diff
@@ -34,7 +34,7 @@ universe u v w
 
 noncomputable section
 
-open Classical Topology BigOperators Filter ENNReal
+open scoped Classical Topology BigOperators Filter ENNReal
 
 open Filter Asymptotics Set
 

Changes in mathlib4

mathlib3
mathlib4
chore(*): remove empty lines between variable statements (#11418)

Empty lines were removed by executing the following Python script twice

import os
import re


# Loop through each file in the repository
for dir_path, dirs, files in os.walk('.'):
  for filename in files:
    if filename.endswith('.lean'):
      file_path = os.path.join(dir_path, filename)

      # Open the file and read its contents
      with open(file_path, 'r') as file:
        content = file.read()

      # Use a regular expression to replace sequences of "variable" lines separated by empty lines
      # with sequences without empty lines
      modified_content = re.sub(r'(variable.*\n)\n(variable(?! .* in))', r'\1\2', content)

      # Write the modified content back to the file
      with open(file_path, 'w') as file:
        file.write(modified_content)
Diff
@@ -37,19 +37,12 @@ open Filter Set
 section NormedField
 
 variable {π•œ : Type u} [NontriviallyNormedField π•œ]
-
 variable {F : Type v} [NormedAddCommGroup F] [NormedSpace π•œ F]
-
 variable {E : Type w} [NormedAddCommGroup E] [NormedSpace π•œ E]
-
 variable {f fβ‚€ f₁ g : π•œ β†’ F}
-
 variable {f' fβ‚€' f₁' g' : F}
-
 variable {x : π•œ}
-
 variable {s t : Set π•œ}
-
 variable {L L₁ Lβ‚‚ : Filter π•œ}
 
 /-- If the domain has dimension one, then FrΓ©chet derivative is equivalent to the classical
chore(Order): Make more arguments explicit (#11033)

Those lemmas have historically been very annoying to use in rw since all their arguments were implicit. One too many people complained about it on Zulip, so I'm changing them.

Downstream code broken by this change can fix it by adding appropriately many _s.

Also marks CauSeq.ext @[ext].

Order.BoundedOrder

  • top_sup_eq
  • sup_top_eq
  • bot_sup_eq
  • sup_bot_eq
  • top_inf_eq
  • inf_top_eq
  • bot_inf_eq
  • inf_bot_eq

Order.Lattice

  • sup_idem
  • sup_comm
  • sup_assoc
  • sup_left_idem
  • sup_right_idem
  • inf_idem
  • inf_comm
  • inf_assoc
  • inf_left_idem
  • inf_right_idem
  • sup_inf_left
  • sup_inf_right
  • inf_sup_left
  • inf_sup_right

Order.MinMax

  • max_min_distrib_left
  • max_min_distrib_right
  • min_max_distrib_left
  • min_max_distrib_right

Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Diff
@@ -72,7 +72,7 @@ theorem hasDerivAtFilter_iff_tendsto_slope {x : π•œ} {L : Filter π•œ} :
 
 theorem hasDerivWithinAt_iff_tendsto_slope :
     HasDerivWithinAt f f' s x ↔ Tendsto (slope f x) (𝓝[s \ {x}] x) (𝓝 f') := by
-  simp only [HasDerivWithinAt, nhdsWithin, diff_eq, inf_assoc.symm, inf_principal.symm]
+  simp only [HasDerivWithinAt, nhdsWithin, diff_eq, ← inf_assoc, inf_principal.symm]
   exact hasDerivAtFilter_iff_tendsto_slope
 #align has_deriv_within_at_iff_tendsto_slope hasDerivWithinAt_iff_tendsto_slope
 
feat(Topology/Bases): review IsSeparable API (#10286)
  • upgrade isSeparable_iUnion to an Iff lemma, restore the original version as IsSeparable.iUnion;
  • add isSeparable_union and isSeparable_closure;
  • upgrade isSeparable_pi from [Finite ΞΉ] to [Countable ΞΉ], add IsSeparable.univ_pi version;
  • add Dense.isSeparable_iff and isSeparable_range;
  • rename isSeparable_of_separableSpace_subtype to IsSeparable.of_subtype;
  • rename isSeparable_of_separableSpace to IsSeparable.of_separableSpace.
Diff
@@ -152,7 +152,7 @@ theorem range_deriv_subset_closure_span_image
 theorem isSeparable_range_derivWithin [SeparableSpace π•œ] (f : π•œ β†’ F) (s : Set π•œ) :
     IsSeparable (range (derivWithin f s)) := by
   obtain ⟨t, ts, t_count, ht⟩ : βˆƒ t, t βŠ† s ∧ Set.Countable t ∧ s βŠ† closure t :=
-    (isSeparable_of_separableSpace s).exists_countable_dense_subset
+    (IsSeparable.of_separableSpace s).exists_countable_dense_subset
   have : s βŠ† closure (s ∩ t) := by rwa [inter_eq_self_of_subset_right ts]
   apply IsSeparable.mono _ (range_derivWithin_subset_closure_span_image f this)
   exact (Countable.image t_count f).isSeparable.span.closure
feat: better junk value for fderivWithin at isolated points (#7117)

Currently, when x is isolated in the set s, then fderivWithin k f s x can be anything. We modify the definition by ensuring that it is equal to 0 in this case. This ensures that the range of derivWithin is always contained in the closure of the span of the range of f.

Diff
@@ -31,7 +31,7 @@ universe u v w
 
 noncomputable section
 
-open Topology Filter
+open Topology Filter TopologicalSpace
 open Filter Set
 
 section NormedField
@@ -101,6 +101,67 @@ theorem HasDerivAt.tendsto_slope_zero_left [PartialOrder π•œ] (h : HasDerivAt f
     Tendsto (fun t ↦ t⁻¹ β€’ (f (x + t) - f x)) (𝓝[<] 0) (𝓝 f') :=
   h.tendsto_slope_zero.mono_left (nhds_left'_le_nhds_ne 0)
 
+/-- 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_derivWithin_subset_closure_span_image
+    (f : π•œ β†’ F) {s t : Set π•œ} (h : s βŠ† closure (s ∩ t)) :
+    range (derivWithin f s) βŠ† closure (Submodule.span π•œ (f '' t)) := by
+  rintro - ⟨x, rfl⟩
+  rcases eq_or_neBot (𝓝[s \ {x}] x) with H|H
+  Β· simp [derivWithin, fderivWithin, H]
+    exact subset_closure (zero_mem _)
+  by_cases H' : DifferentiableWithinAt π•œ f s x; swap
+  Β· rw [derivWithin_zero_of_not_differentiableWithinAt H']
+    exact subset_closure (zero_mem _)
+  have I : (𝓝[(s ∩ t) \ {x}] x).NeBot := by
+    rw [← mem_closure_iff_nhdsWithin_neBot] at H ⊒
+    have A : closure (s \ {x}) βŠ† closure (closure (s ∩ t) \ {x}) :=
+      closure_mono (diff_subset_diff_left h)
+    have B : closure (s ∩ t) \ {x} βŠ† closure ((s ∩ t) \ {x}) := by
+      convert closure_diff; exact closure_singleton.symm
+    simpa using A.trans (closure_mono B) H
+  have : Tendsto (slope f x) (𝓝[(s ∩ t) \ {x}] x) (𝓝 (derivWithin f s x)) := by
+    apply Tendsto.mono_left (hasDerivWithinAt_iff_tendsto_slope.1 H'.hasDerivWithinAt)
+    rw [inter_comm, inter_diff_assoc]
+    exact nhdsWithin_mono _ (inter_subset_right _ _)
+  rw [← closure_closure, ← Submodule.topologicalClosure_coe]
+  apply mem_closure_of_tendsto this
+  filter_upwards [self_mem_nhdsWithin] with y hy
+  simp only [slope, vsub_eq_sub, SetLike.mem_coe]
+  refine Submodule.smul_mem _ _ (Submodule.sub_mem _ ?_ ?_)
+  Β· apply Submodule.le_topologicalClosure
+    apply Submodule.subset_span
+    exact mem_image_of_mem _ hy.1.2
+  Β· apply Submodule.closure_subset_topologicalClosure_span
+    suffices A : f x ∈ closure (f '' (s ∩ t)) from
+      closure_mono (image_subset _ (inter_subset_right _ _)) A
+    apply ContinuousWithinAt.mem_closure_image
+    apply H'.continuousWithinAt.mono (inter_subset_left _ _)
+    rw [mem_closure_iff_nhdsWithin_neBot]
+    exact I.mono (nhdsWithin_mono _ (diff_subset _ _))
+
+/-- 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 range_deriv_subset_closure_span_image
+    (f : π•œ β†’ F) {t : Set π•œ} (h : Dense t) :
+    range (deriv f) βŠ† closure (Submodule.span π•œ (f '' t)) := by
+  rw [← derivWithin_univ]
+  apply range_derivWithin_subset_closure_span_image
+  simp [dense_iff_closure_eq.1 h]
+
+theorem isSeparable_range_derivWithin [SeparableSpace π•œ] (f : π•œ β†’ F) (s : Set π•œ) :
+    IsSeparable (range (derivWithin f s)) := by
+  obtain ⟨t, ts, t_count, ht⟩ : βˆƒ t, t βŠ† s ∧ Set.Countable t ∧ s βŠ† closure t :=
+    (isSeparable_of_separableSpace s).exists_countable_dense_subset
+  have : s βŠ† closure (s ∩ t) := by rwa [inter_eq_self_of_subset_right ts]
+  apply IsSeparable.mono _ (range_derivWithin_subset_closure_span_image f this)
+  exact (Countable.image t_count f).isSeparable.span.closure
+
+theorem isSeparable_range_deriv [SeparableSpace π•œ] (f : π•œ β†’ F) :
+    IsSeparable (range (deriv f)) := by
+  rw [← derivWithin_univ]
+  exact isSeparable_range_derivWithin _ _
+
 end NormedField
 
 /-! ### Upper estimates on liminf and limsup -/
feat: cleanup API around differentiable functions (#7004)

First calculus prerequisites for Rademacher theorem in #7003.

Add a few lemmas that were available for FDeriv but not for Deriv, weaken assumptions here and there.

Diff
@@ -85,6 +85,22 @@ theorem hasDerivAt_iff_tendsto_slope : HasDerivAt f f' x ↔ Tendsto (slope f x)
   hasDerivAtFilter_iff_tendsto_slope
 #align has_deriv_at_iff_tendsto_slope hasDerivAt_iff_tendsto_slope
 
+theorem hasDerivAt_iff_tendsto_slope_zero :
+    HasDerivAt f f' x ↔ Tendsto (fun t ↦ t⁻¹ β€’ (f (x + t) - f x)) (𝓝[β‰ ] 0) (𝓝 f') := by
+  have : 𝓝[β‰ ] x = Filter.map (fun t ↦ x + t) (𝓝[β‰ ] 0) := by
+    simp [nhdsWithin, map_add_left_nhds_zero x, Filter.map_inf, add_right_injective x]
+  simp [hasDerivAt_iff_tendsto_slope, this, slope, Function.comp]
+
+alias ⟨HasDerivAt.tendsto_slope_zero, _⟩ := hasDerivAt_iff_tendsto_slope_zero
+
+theorem HasDerivAt.tendsto_slope_zero_right [PartialOrder π•œ] (h : HasDerivAt f f' x) :
+    Tendsto (fun t ↦ t⁻¹ β€’ (f (x + t) - f x)) (𝓝[>] 0) (𝓝 f') :=
+  h.tendsto_slope_zero.mono_left (nhds_right'_le_nhds_ne 0)
+
+theorem HasDerivAt.tendsto_slope_zero_left [PartialOrder π•œ] (h : HasDerivAt f f' x) :
+    Tendsto (fun t ↦ t⁻¹ β€’ (f (x + t) - f x)) (𝓝[<] 0) (𝓝 f') :=
+  h.tendsto_slope_zero.mono_left (nhds_left'_le_nhds_ne 0)
+
 end NormedField
 
 /-! ### Upper estimates on liminf and limsup -/
chore: script to replace headers with #align_import statements (#5979)

Open in Gitpod

Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -2,15 +2,12 @@
 Copyright (c) 2019 Yury Kudryashov. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yury Kudryashov
-
-! This file was ported from Lean 3 source module analysis.calculus.deriv.slope
-! leanprover-community/mathlib commit 3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Analysis.Calculus.Deriv.Basic
 import Mathlib.LinearAlgebra.AffineSpace.Slope
 
+#align_import analysis.calculus.deriv.slope from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
+
 /-!
 # Derivative as the limit of the slope
 
fix: change compl precedence (#5586)

Co-authored-by: Yury G. Kudryashov <urkud@urkud.name>

Diff
@@ -59,17 +59,17 @@ variable {L L₁ Lβ‚‚ : Filter π•œ}
 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 hasDerivAtFilter_iff_tendsto_slope {x : π•œ} {L : Filter π•œ} :
-    HasDerivAtFilter f f' x L ↔ Tendsto (slope f x) (L βŠ“ π“Ÿ ({x}ᢜ)) (𝓝 f') :=
+    HasDerivAtFilter f f' x L ↔ Tendsto (slope f x) (L βŠ“ π“Ÿ {x}ᢜ) (𝓝 f') :=
   calc HasDerivAtFilter f f' x L
     ↔ Tendsto (fun y ↦ slope f x y - (y - x)⁻¹ β€’ (y - x) β€’ f') L (𝓝 0) := by
         simp only [hasDerivAtFilter_iff_tendsto, ← norm_inv, ← norm_smul,
           ← tendsto_zero_iff_norm_tendsto_zero, slope_def_module, smul_sub]
-  _ ↔ Tendsto (fun y ↦ slope f x y - (y - x)⁻¹ β€’ (y - x) β€’ f') (L βŠ“ π“Ÿ ({x}ᢜ)) (𝓝 0) :=
+  _ ↔ Tendsto (fun y ↦ slope f x y - (y - x)⁻¹ β€’ (y - x) β€’ f') (L βŠ“ π“Ÿ {x}ᢜ) (𝓝 0) :=
         .symm <| tendsto_inf_principal_nhds_iff_of_forall_eq <| by simp
-  _ ↔ Tendsto (fun y ↦ slope f x y - f') (L βŠ“ π“Ÿ ({x}ᢜ)) (𝓝 0) := tendsto_congr' <| by
+  _ ↔ Tendsto (fun y ↦ slope f x y - f') (L βŠ“ π“Ÿ {x}ᢜ) (𝓝 0) := tendsto_congr' <| by
         refine (EqOn.eventuallyEq fun y hy ↦ ?_).filter_mono inf_le_right
         rw [inv_smul_smulβ‚€ (sub_ne_zero.2 hy) f']
-  _ ↔ Tendsto (slope f x) (L βŠ“ π“Ÿ ({x}ᢜ)) (𝓝 f') :=
+  _ ↔ Tendsto (slope f x) (L βŠ“ π“Ÿ {x}ᢜ) (𝓝 f') :=
         by rw [← nhds_translation_sub f', tendsto_comap_iff]; rfl
 #align has_deriv_at_filter_iff_tendsto_slope hasDerivAtFilter_iff_tendsto_slope
 
feat: port Analysis.Calculus.Deriv.Slope (#4444)

Dependencies 10 + 675

676 files ported (98.5%)
300822 lines ported (98.3%)
Show graph

The unported dependencies are

The following 1 dependencies have changed in mathlib3 since they were ported, which may complicate porting this file