analysis.calculus.extend_derivMathlib.Analysis.Calculus.FDeriv.Extend

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)

(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)

(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)

(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)

(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
@@ -198,7 +198,7 @@ theorem has_deriv_at_interval_right_endpoint_of_tendsto_deriv {s : Set ℝ} {e :
 #align has_deriv_at_interval_right_endpoint_of_tendsto_deriv has_deriv_at_interval_right_endpoint_of_tendsto_deriv
 -/
 
-/- ./././Mathport/Syntax/Translate/Basic.lean:641:2: warning: expanding binder collection (y «expr ≠ » x) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:642:2: warning: expanding binder collection (y «expr ≠ » x) -/
 #print hasDerivAt_of_hasDerivAt_of_ne /-
 /-- If a real function `f` has a derivative `g` everywhere but at a point, and `f` and `g` are
 continuous at this point, then `g` is also the derivative of `f` at this point. -/
@@ -236,7 +236,7 @@ theorem hasDerivAt_of_hasDerivAt_of_ne {f g : ℝ → E} {x : ℝ}
 #align has_deriv_at_of_has_deriv_at_of_ne hasDerivAt_of_hasDerivAt_of_ne
 -/
 
-/- ./././Mathport/Syntax/Translate/Basic.lean:641:2: warning: expanding binder collection (y «expr ≠ » x) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:642:2: warning: expanding binder collection (y «expr ≠ » x) -/
 #print hasDerivAt_of_hasDerivAt_of_ne' /-
 /-- If a real function `f` has a derivative `g` everywhere but at a point, and `f` and `g` are
 continuous at this point, then `g` is the derivative of `f` everywhere. -/
Diff
@@ -51,8 +51,8 @@ theorem has_fderiv_at_boundary_of_tendsto_fderiv {f : E → F} {s : Set E} {x :
   -- one can assume without loss of generality that `x` belongs to the closure of `s`, as the
   -- statement is empty otherwise
   by_cases hx : x ∉ closure s
-  · rw [← closure_closure] at hx ; exact hasFDerivWithinAt_of_nmem_closure hx
-  push_neg at hx 
+  · rw [← closure_closure] at hx; exact hasFDerivWithinAt_of_nmem_closure hx
+  push_neg at hx
   rw [HasFDerivWithinAt, HasFDerivAtFilter, Asymptotics.isLittleO_iff]
   /- One needs to show that `‖f y - f x - f' (y - x)‖ ≤ ε ‖y - x‖` for `y` close to `x` in `closure
     s`, where `ε` is an arbitrary positive constant. By continuity of the functions, it suffices to
@@ -68,7 +68,7 @@ theorem has_fderiv_at_boundary_of_tendsto_fderiv {f : E → F} {s : Set E} {x :
     ∀ p : E × E,
       p ∈ closure ((B ∩ s) ×ˢ (B ∩ s)) → ‖f p.2 - f p.1 - (f' p.2 - f' p.1)‖ ≤ ε * ‖p.2 - p.1‖
     by
-    rw [closure_prod_eq] at this 
+    rw [closure_prod_eq] at this
     intro y y_in
     apply this ⟨x, y⟩
     have : B ∩ closure s ⊆ closure (B ∩ s) := is_open_ball.inter_closure
Diff
@@ -46,18 +46,76 @@ theorem has_fderiv_at_boundary_of_tendsto_fderiv {f : E → F} {s : Set E} {x :
     (f_diff : DifferentiableOn ℝ f s) (s_conv : Convex ℝ s) (s_open : IsOpen s)
     (f_cont : ∀ y ∈ closure s, ContinuousWithinAt f s y)
     (h : Tendsto (fun y => fderiv ℝ f y) (𝓝[s] x) (𝓝 f')) : HasFDerivWithinAt f f' (closure s) x :=
-  by classical
+  by
+  classical
+  -- one can assume without loss of generality that `x` belongs to the closure of `s`, as the
+  -- statement is empty otherwise
+  by_cases hx : x ∉ closure s
+  · rw [← closure_closure] at hx ; exact hasFDerivWithinAt_of_nmem_closure hx
+  push_neg at hx 
+  rw [HasFDerivWithinAt, HasFDerivAtFilter, Asymptotics.isLittleO_iff]
+  /- One needs to show that `‖f y - f x - f' (y - x)‖ ≤ ε ‖y - x‖` for `y` close to `x` in `closure
+    s`, where `ε` is an arbitrary positive constant. By continuity of the functions, it suffices to
+    prove this for nearby points inside `s`. In a neighborhood of `x`, the derivative of `f` is
+    arbitrarily close to `f'` by assumption. The mean value inequality completes the proof. -/
+  intro ε ε_pos
+  obtain ⟨δ, δ_pos, hδ⟩ : ∃ δ > 0, ∀ y ∈ s, dist y x < δ → ‖fderiv ℝ f y - f'‖ < ε := by
+    simpa [dist_zero_right] using tendsto_nhds_within_nhds.1 h ε ε_pos
+  set B := ball x δ
+  suffices : ∀ y ∈ B ∩ closure s, ‖f y - f x - (f' y - f' x)‖ ≤ ε * ‖y - x‖
+  exact mem_nhds_within_iff.2 ⟨δ, δ_pos, fun y hy => by simpa using this y hy⟩
+  suffices
+    ∀ p : E × E,
+      p ∈ closure ((B ∩ s) ×ˢ (B ∩ s)) → ‖f p.2 - f p.1 - (f' p.2 - f' p.1)‖ ≤ ε * ‖p.2 - p.1‖
+    by
+    rw [closure_prod_eq] at this 
+    intro y y_in
+    apply this ⟨x, y⟩
+    have : B ∩ closure s ⊆ closure (B ∩ s) := is_open_ball.inter_closure
+    exact ⟨this ⟨mem_ball_self δ_pos, hx⟩, this y_in⟩
+  have key :
+    ∀ p : E × E, p ∈ (B ∩ s) ×ˢ (B ∩ s) → ‖f p.2 - f p.1 - (f' p.2 - f' p.1)‖ ≤ ε * ‖p.2 - p.1‖ :=
+    by
+    rintro ⟨u, v⟩ ⟨u_in, v_in⟩
+    have conv : Convex ℝ (B ∩ s) := (convex_ball _ _).inter s_conv
+    have diff : DifferentiableOn ℝ f (B ∩ s) := f_diff.mono (inter_subset_right _ _)
+    have bound : ∀ z ∈ B ∩ s, ‖fderivWithin ℝ f (B ∩ s) z - f'‖ ≤ ε :=
+      by
+      intro z z_in
+      convert le_of_lt (hδ _ z_in.2 z_in.1)
+      have op : IsOpen (B ∩ s) := is_open_ball.inter s_open
+      rw [DifferentiableAt.fderivWithin _ (op.unique_diff_on z z_in)]
+      exact (diff z z_in).DifferentiableAt (IsOpen.mem_nhds op z_in)
+    simpa using conv.norm_image_sub_le_of_norm_fderiv_within_le' diff bound u_in v_in
+  rintro ⟨u, v⟩ uv_in
+  refine' ContinuousWithinAt.closure_le uv_in _ _ key
+  have f_cont' : ∀ y ∈ closure s, ContinuousWithinAt (f - f') s y :=
+    by
+    intro y y_in
+    exact tendsto.sub (f_cont y y_in) f'.cont.continuous_within_at
+  all_goals
+    -- common start for both continuity proofs
+    have : (B ∩ s) ×ˢ (B ∩ s) ⊆ s ×ˢ s := by mono <;> exact inter_subset_right _ _
+    obtain ⟨u_in, v_in⟩ : u ∈ closure s ∧ v ∈ closure s := by
+      simpa [closure_prod_eq] using closure_mono this uv_in
+    apply ContinuousWithinAt.mono _ this
+    simp only [ContinuousWithinAt]
+  rw [nhdsWithin_prod_eq]
+  · have : ∀ u v, f v - f u - (f' v - f' u) = f v - f' v - (f u - f' u) := by intros; abel
+    simp only [this]
+    exact
+      tendsto.comp continuous_norm.continuous_at
+        ((tendsto.comp (f_cont' v v_in) tendsto_snd).sub <|
+          tendsto.comp (f_cont' u u_in) tendsto_fst)
+  · apply tendsto_nhdsWithin_of_tendsto_nhds
+    rw [nhds_prod_eq]
+    exact
+      tendsto_const_nhds.mul
+        (tendsto.comp continuous_norm.continuous_at <| tendsto_snd.sub tendsto_fst)
 #align has_fderiv_at_boundary_of_tendsto_fderiv has_fderiv_at_boundary_of_tendsto_fderiv
 -/
 
 #print has_deriv_at_interval_left_endpoint_of_tendsto_deriv /-
--- one can assume without loss of generality that `x` belongs to the closure of `s`, as the
--- statement is empty otherwise
-/- One needs to show that `‖f y - f x - f' (y - x)‖ ≤ ε ‖y - x‖` for `y` close to `x` in `closure
-  s`, where `ε` is an arbitrary positive constant. By continuity of the functions, it suffices to
-  prove this for nearby points inside `s`. In a neighborhood of `x`, the derivative of `f` is
-  arbitrarily close to `f'` by assumption. The mean value inequality completes the proof. -/
--- common start for both continuity proofs
 /-- If a function is differentiable on the right of a point `a : ℝ`, continuous at `a`, and
 its derivative also converges at `a`, then `f` is differentiable on the right at `a`. -/
 theorem has_deriv_at_interval_left_endpoint_of_tendsto_deriv {s : Set ℝ} {e : E} {a : ℝ} {f : ℝ → E}
Diff
@@ -46,76 +46,18 @@ theorem has_fderiv_at_boundary_of_tendsto_fderiv {f : E → F} {s : Set E} {x :
     (f_diff : DifferentiableOn ℝ f s) (s_conv : Convex ℝ s) (s_open : IsOpen s)
     (f_cont : ∀ y ∈ closure s, ContinuousWithinAt f s y)
     (h : Tendsto (fun y => fderiv ℝ f y) (𝓝[s] x) (𝓝 f')) : HasFDerivWithinAt f f' (closure s) x :=
-  by
-  classical
-  -- one can assume without loss of generality that `x` belongs to the closure of `s`, as the
-  -- statement is empty otherwise
-  by_cases hx : x ∉ closure s
-  · rw [← closure_closure] at hx ; exact hasFDerivWithinAt_of_nmem_closure hx
-  push_neg at hx 
-  rw [HasFDerivWithinAt, HasFDerivAtFilter, Asymptotics.isLittleO_iff]
-  /- One needs to show that `‖f y - f x - f' (y - x)‖ ≤ ε ‖y - x‖` for `y` close to `x` in `closure
-    s`, where `ε` is an arbitrary positive constant. By continuity of the functions, it suffices to
-    prove this for nearby points inside `s`. In a neighborhood of `x`, the derivative of `f` is
-    arbitrarily close to `f'` by assumption. The mean value inequality completes the proof. -/
-  intro ε ε_pos
-  obtain ⟨δ, δ_pos, hδ⟩ : ∃ δ > 0, ∀ y ∈ s, dist y x < δ → ‖fderiv ℝ f y - f'‖ < ε := by
-    simpa [dist_zero_right] using tendsto_nhds_within_nhds.1 h ε ε_pos
-  set B := ball x δ
-  suffices : ∀ y ∈ B ∩ closure s, ‖f y - f x - (f' y - f' x)‖ ≤ ε * ‖y - x‖
-  exact mem_nhds_within_iff.2 ⟨δ, δ_pos, fun y hy => by simpa using this y hy⟩
-  suffices
-    ∀ p : E × E,
-      p ∈ closure ((B ∩ s) ×ˢ (B ∩ s)) → ‖f p.2 - f p.1 - (f' p.2 - f' p.1)‖ ≤ ε * ‖p.2 - p.1‖
-    by
-    rw [closure_prod_eq] at this 
-    intro y y_in
-    apply this ⟨x, y⟩
-    have : B ∩ closure s ⊆ closure (B ∩ s) := is_open_ball.inter_closure
-    exact ⟨this ⟨mem_ball_self δ_pos, hx⟩, this y_in⟩
-  have key :
-    ∀ p : E × E, p ∈ (B ∩ s) ×ˢ (B ∩ s) → ‖f p.2 - f p.1 - (f' p.2 - f' p.1)‖ ≤ ε * ‖p.2 - p.1‖ :=
-    by
-    rintro ⟨u, v⟩ ⟨u_in, v_in⟩
-    have conv : Convex ℝ (B ∩ s) := (convex_ball _ _).inter s_conv
-    have diff : DifferentiableOn ℝ f (B ∩ s) := f_diff.mono (inter_subset_right _ _)
-    have bound : ∀ z ∈ B ∩ s, ‖fderivWithin ℝ f (B ∩ s) z - f'‖ ≤ ε :=
-      by
-      intro z z_in
-      convert le_of_lt (hδ _ z_in.2 z_in.1)
-      have op : IsOpen (B ∩ s) := is_open_ball.inter s_open
-      rw [DifferentiableAt.fderivWithin _ (op.unique_diff_on z z_in)]
-      exact (diff z z_in).DifferentiableAt (IsOpen.mem_nhds op z_in)
-    simpa using conv.norm_image_sub_le_of_norm_fderiv_within_le' diff bound u_in v_in
-  rintro ⟨u, v⟩ uv_in
-  refine' ContinuousWithinAt.closure_le uv_in _ _ key
-  have f_cont' : ∀ y ∈ closure s, ContinuousWithinAt (f - f') s y :=
-    by
-    intro y y_in
-    exact tendsto.sub (f_cont y y_in) f'.cont.continuous_within_at
-  all_goals
-    -- common start for both continuity proofs
-    have : (B ∩ s) ×ˢ (B ∩ s) ⊆ s ×ˢ s := by mono <;> exact inter_subset_right _ _
-    obtain ⟨u_in, v_in⟩ : u ∈ closure s ∧ v ∈ closure s := by
-      simpa [closure_prod_eq] using closure_mono this uv_in
-    apply ContinuousWithinAt.mono _ this
-    simp only [ContinuousWithinAt]
-  rw [nhdsWithin_prod_eq]
-  · have : ∀ u v, f v - f u - (f' v - f' u) = f v - f' v - (f u - f' u) := by intros; abel
-    simp only [this]
-    exact
-      tendsto.comp continuous_norm.continuous_at
-        ((tendsto.comp (f_cont' v v_in) tendsto_snd).sub <|
-          tendsto.comp (f_cont' u u_in) tendsto_fst)
-  · apply tendsto_nhdsWithin_of_tendsto_nhds
-    rw [nhds_prod_eq]
-    exact
-      tendsto_const_nhds.mul
-        (tendsto.comp continuous_norm.continuous_at <| tendsto_snd.sub tendsto_fst)
+  by classical
 #align has_fderiv_at_boundary_of_tendsto_fderiv has_fderiv_at_boundary_of_tendsto_fderiv
 -/
 
 #print has_deriv_at_interval_left_endpoint_of_tendsto_deriv /-
+-- one can assume without loss of generality that `x` belongs to the closure of `s`, as the
+-- statement is empty otherwise
+/- One needs to show that `‖f y - f x - f' (y - x)‖ ≤ ε ‖y - x‖` for `y` close to `x` in `closure
+  s`, where `ε` is an arbitrary positive constant. By continuity of the functions, it suffices to
+  prove this for nearby points inside `s`. In a neighborhood of `x`, the derivative of `f` is
+  arbitrarily close to `f'` by assumption. The mean value inequality completes the proof. -/
+-- common start for both continuity proofs
 /-- If a function is differentiable on the right of a point `a : ℝ`, continuous at `a`, and
 its derivative also converges at `a`, then `f` is differentiable on the right at `a`. -/
 theorem has_deriv_at_interval_left_endpoint_of_tendsto_deriv {s : Set ℝ} {e : E} {a : ℝ} {f : ℝ → E}
Diff
@@ -3,7 +3,7 @@ Copyright (c) 2019 Sébastien Gouëzel. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel
 -/
-import Mathbin.Analysis.Calculus.MeanValue
+import Analysis.Calculus.MeanValue
 
 #align_import analysis.calculus.extend_deriv from "leanprover-community/mathlib"@"af471b9e3ce868f296626d33189b4ce730fa4c00"
 
@@ -198,7 +198,7 @@ theorem has_deriv_at_interval_right_endpoint_of_tendsto_deriv {s : Set ℝ} {e :
 #align has_deriv_at_interval_right_endpoint_of_tendsto_deriv has_deriv_at_interval_right_endpoint_of_tendsto_deriv
 -/
 
-/- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (y «expr ≠ » x) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:641:2: warning: expanding binder collection (y «expr ≠ » x) -/
 #print hasDerivAt_of_hasDerivAt_of_ne /-
 /-- If a real function `f` has a derivative `g` everywhere but at a point, and `f` and `g` are
 continuous at this point, then `g` is also the derivative of `f` at this point. -/
@@ -236,7 +236,7 @@ theorem hasDerivAt_of_hasDerivAt_of_ne {f g : ℝ → E} {x : ℝ}
 #align has_deriv_at_of_has_deriv_at_of_ne hasDerivAt_of_hasDerivAt_of_ne
 -/
 
-/- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (y «expr ≠ » x) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:641:2: warning: expanding binder collection (y «expr ≠ » x) -/
 #print hasDerivAt_of_hasDerivAt_of_ne' /-
 /-- If a real function `f` has a derivative `g` everywhere but at a point, and `f` and `g` are
 continuous at this point, then `g` is the derivative of `f` everywhere. -/
Diff
@@ -51,7 +51,7 @@ theorem has_fderiv_at_boundary_of_tendsto_fderiv {f : E → F} {s : Set E} {x :
   -- one can assume without loss of generality that `x` belongs to the closure of `s`, as the
   -- statement is empty otherwise
   by_cases hx : x ∉ closure s
-  · rw [← closure_closure] at hx ; exact hasFDerivWithinAt_of_not_mem_closure hx
+  · rw [← closure_closure] at hx ; exact hasFDerivWithinAt_of_nmem_closure hx
   push_neg at hx 
   rw [HasFDerivWithinAt, HasFDerivAtFilter, Asymptotics.isLittleO_iff]
   /- One needs to show that `‖f y - f x - f' (y - x)‖ ≤ ε ‖y - x‖` for `y` close to `x` in `closure
Diff
@@ -2,14 +2,11 @@
 Copyright (c) 2019 Sébastien Gouëzel. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel
-
-! This file was ported from Lean 3 source module analysis.calculus.extend_deriv
-! leanprover-community/mathlib commit af471b9e3ce868f296626d33189b4ce730fa4c00
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Analysis.Calculus.MeanValue
 
+#align_import analysis.calculus.extend_deriv from "leanprover-community/mathlib"@"af471b9e3ce868f296626d33189b4ce730fa4c00"
+
 /-!
 # Extending differentiability to the boundary
 
@@ -201,7 +198,7 @@ theorem has_deriv_at_interval_right_endpoint_of_tendsto_deriv {s : Set ℝ} {e :
 #align has_deriv_at_interval_right_endpoint_of_tendsto_deriv has_deriv_at_interval_right_endpoint_of_tendsto_deriv
 -/
 
-/- ./././Mathport/Syntax/Translate/Basic.lean:638:2: warning: expanding binder collection (y «expr ≠ » x) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (y «expr ≠ » x) -/
 #print hasDerivAt_of_hasDerivAt_of_ne /-
 /-- If a real function `f` has a derivative `g` everywhere but at a point, and `f` and `g` are
 continuous at this point, then `g` is also the derivative of `f` at this point. -/
@@ -239,7 +236,7 @@ theorem hasDerivAt_of_hasDerivAt_of_ne {f g : ℝ → E} {x : ℝ}
 #align has_deriv_at_of_has_deriv_at_of_ne hasDerivAt_of_hasDerivAt_of_ne
 -/
 
-/- ./././Mathport/Syntax/Translate/Basic.lean:638:2: warning: expanding binder collection (y «expr ≠ » x) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (y «expr ≠ » x) -/
 #print hasDerivAt_of_hasDerivAt_of_ne' /-
 /-- If a real function `f` has a derivative `g` everywhere but at a point, and `f` and `g` are
 continuous at this point, then `g` is the derivative of `f` everywhere. -/
Diff
@@ -41,6 +41,7 @@ attribute [local mono] prod_mono
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print has_fderiv_at_boundary_of_tendsto_fderiv /-
 /-- If a function `f` is differentiable in a convex open set and continuous on its closure, and its
 derivative converges to a limit `f'` at a point on the boundary, then `f` is differentiable there
 with derivative `f'`. -/
@@ -115,6 +116,7 @@ theorem has_fderiv_at_boundary_of_tendsto_fderiv {f : E → F} {s : Set E} {x :
       tendsto_const_nhds.mul
         (tendsto.comp continuous_norm.continuous_at <| tendsto_snd.sub tendsto_fst)
 #align has_fderiv_at_boundary_of_tendsto_fderiv has_fderiv_at_boundary_of_tendsto_fderiv
+-/
 
 #print has_deriv_at_interval_left_endpoint_of_tendsto_deriv /-
 /-- If a function is differentiable on the right of a point `a : ℝ`, continuous at `a`, and
Diff
@@ -199,7 +199,7 @@ theorem has_deriv_at_interval_right_endpoint_of_tendsto_deriv {s : Set ℝ} {e :
 #align has_deriv_at_interval_right_endpoint_of_tendsto_deriv has_deriv_at_interval_right_endpoint_of_tendsto_deriv
 -/
 
-/- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (y «expr ≠ » x) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:638:2: warning: expanding binder collection (y «expr ≠ » x) -/
 #print hasDerivAt_of_hasDerivAt_of_ne /-
 /-- If a real function `f` has a derivative `g` everywhere but at a point, and `f` and `g` are
 continuous at this point, then `g` is also the derivative of `f` at this point. -/
@@ -237,7 +237,7 @@ theorem hasDerivAt_of_hasDerivAt_of_ne {f g : ℝ → E} {x : ℝ}
 #align has_deriv_at_of_has_deriv_at_of_ne hasDerivAt_of_hasDerivAt_of_ne
 -/
 
-/- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (y «expr ≠ » x) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:638:2: warning: expanding binder collection (y «expr ≠ » x) -/
 #print hasDerivAt_of_hasDerivAt_of_ne' /-
 /-- If a real function `f` has a derivative `g` everywhere but at a point, and `f` and `g` are
 continuous at this point, then `g` is the derivative of `f` everywhere. -/
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel
 
 ! This file was ported from Lean 3 source module analysis.calculus.extend_deriv
-! leanprover-community/mathlib commit f2ce6086713c78a7f880485f7917ea547a215982
+! leanprover-community/mathlib commit af471b9e3ce868f296626d33189b4ce730fa4c00
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -13,6 +13,9 @@ import Mathbin.Analysis.Calculus.MeanValue
 /-!
 # Extending differentiability to the boundary
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 We investigate how differentiable functions inside a set extend to differentiable functions
 on the boundary. For this, it suffices that the function and its derivative admit limits there.
 A general version of this statement is given in `has_fderiv_at_boundary_of_tendsto_fderiv`.
@@ -47,70 +50,70 @@ theorem has_fderiv_at_boundary_of_tendsto_fderiv {f : E → F} {s : Set E} {x :
     (h : Tendsto (fun y => fderiv ℝ f y) (𝓝[s] x) (𝓝 f')) : HasFDerivWithinAt f f' (closure s) x :=
   by
   classical
-    -- one can assume without loss of generality that `x` belongs to the closure of `s`, as the
-    -- statement is empty otherwise
-    by_cases hx : x ∉ closure s
-    · rw [← closure_closure] at hx ; exact hasFDerivWithinAt_of_not_mem_closure hx
-    push_neg  at hx 
-    rw [HasFDerivWithinAt, HasFDerivAtFilter, Asymptotics.isLittleO_iff]
-    /- One needs to show that `‖f y - f x - f' (y - x)‖ ≤ ε ‖y - x‖` for `y` close to `x` in `closure
-      s`, where `ε` is an arbitrary positive constant. By continuity of the functions, it suffices to
-      prove this for nearby points inside `s`. In a neighborhood of `x`, the derivative of `f` is
-      arbitrarily close to `f'` by assumption. The mean value inequality completes the proof. -/
-    intro ε ε_pos
-    obtain ⟨δ, δ_pos, hδ⟩ : ∃ δ > 0, ∀ y ∈ s, dist y x < δ → ‖fderiv ℝ f y - f'‖ < ε := by
-      simpa [dist_zero_right] using tendsto_nhds_within_nhds.1 h ε ε_pos
-    set B := ball x δ
-    suffices : ∀ y ∈ B ∩ closure s, ‖f y - f x - (f' y - f' x)‖ ≤ ε * ‖y - x‖
-    exact mem_nhds_within_iff.2 ⟨δ, δ_pos, fun y hy => by simpa using this y hy⟩
-    suffices
-      ∀ p : E × E,
-        p ∈ closure ((B ∩ s) ×ˢ (B ∩ s)) → ‖f p.2 - f p.1 - (f' p.2 - f' p.1)‖ ≤ ε * ‖p.2 - p.1‖
-      by
-      rw [closure_prod_eq] at this 
-      intro y y_in
-      apply this ⟨x, y⟩
-      have : B ∩ closure s ⊆ closure (B ∩ s) := is_open_ball.inter_closure
-      exact ⟨this ⟨mem_ball_self δ_pos, hx⟩, this y_in⟩
-    have key :
-      ∀ p : E × E, p ∈ (B ∩ s) ×ˢ (B ∩ s) → ‖f p.2 - f p.1 - (f' p.2 - f' p.1)‖ ≤ ε * ‖p.2 - p.1‖ :=
-      by
-      rintro ⟨u, v⟩ ⟨u_in, v_in⟩
-      have conv : Convex ℝ (B ∩ s) := (convex_ball _ _).inter s_conv
-      have diff : DifferentiableOn ℝ f (B ∩ s) := f_diff.mono (inter_subset_right _ _)
-      have bound : ∀ z ∈ B ∩ s, ‖fderivWithin ℝ f (B ∩ s) z - f'‖ ≤ ε :=
-        by
-        intro z z_in
-        convert le_of_lt (hδ _ z_in.2 z_in.1)
-        have op : IsOpen (B ∩ s) := is_open_ball.inter s_open
-        rw [DifferentiableAt.fderivWithin _ (op.unique_diff_on z z_in)]
-        exact (diff z z_in).DifferentiableAt (IsOpen.mem_nhds op z_in)
-      simpa using conv.norm_image_sub_le_of_norm_fderiv_within_le' diff bound u_in v_in
-    rintro ⟨u, v⟩ uv_in
-    refine' ContinuousWithinAt.closure_le uv_in _ _ key
-    have f_cont' : ∀ y ∈ closure s, ContinuousWithinAt (f - f') s y :=
+  -- one can assume without loss of generality that `x` belongs to the closure of `s`, as the
+  -- statement is empty otherwise
+  by_cases hx : x ∉ closure s
+  · rw [← closure_closure] at hx ; exact hasFDerivWithinAt_of_not_mem_closure hx
+  push_neg at hx 
+  rw [HasFDerivWithinAt, HasFDerivAtFilter, Asymptotics.isLittleO_iff]
+  /- One needs to show that `‖f y - f x - f' (y - x)‖ ≤ ε ‖y - x‖` for `y` close to `x` in `closure
+    s`, where `ε` is an arbitrary positive constant. By continuity of the functions, it suffices to
+    prove this for nearby points inside `s`. In a neighborhood of `x`, the derivative of `f` is
+    arbitrarily close to `f'` by assumption. The mean value inequality completes the proof. -/
+  intro ε ε_pos
+  obtain ⟨δ, δ_pos, hδ⟩ : ∃ δ > 0, ∀ y ∈ s, dist y x < δ → ‖fderiv ℝ f y - f'‖ < ε := by
+    simpa [dist_zero_right] using tendsto_nhds_within_nhds.1 h ε ε_pos
+  set B := ball x δ
+  suffices : ∀ y ∈ B ∩ closure s, ‖f y - f x - (f' y - f' x)‖ ≤ ε * ‖y - x‖
+  exact mem_nhds_within_iff.2 ⟨δ, δ_pos, fun y hy => by simpa using this y hy⟩
+  suffices
+    ∀ p : E × E,
+      p ∈ closure ((B ∩ s) ×ˢ (B ∩ s)) → ‖f p.2 - f p.1 - (f' p.2 - f' p.1)‖ ≤ ε * ‖p.2 - p.1‖
+    by
+    rw [closure_prod_eq] at this 
+    intro y y_in
+    apply this ⟨x, y⟩
+    have : B ∩ closure s ⊆ closure (B ∩ s) := is_open_ball.inter_closure
+    exact ⟨this ⟨mem_ball_self δ_pos, hx⟩, this y_in⟩
+  have key :
+    ∀ p : E × E, p ∈ (B ∩ s) ×ˢ (B ∩ s) → ‖f p.2 - f p.1 - (f' p.2 - f' p.1)‖ ≤ ε * ‖p.2 - p.1‖ :=
+    by
+    rintro ⟨u, v⟩ ⟨u_in, v_in⟩
+    have conv : Convex ℝ (B ∩ s) := (convex_ball _ _).inter s_conv
+    have diff : DifferentiableOn ℝ f (B ∩ s) := f_diff.mono (inter_subset_right _ _)
+    have bound : ∀ z ∈ B ∩ s, ‖fderivWithin ℝ f (B ∩ s) z - f'‖ ≤ ε :=
       by
-      intro y y_in
-      exact tendsto.sub (f_cont y y_in) f'.cont.continuous_within_at
-    all_goals
-      -- common start for both continuity proofs
-      have : (B ∩ s) ×ˢ (B ∩ s) ⊆ s ×ˢ s := by mono <;> exact inter_subset_right _ _
-      obtain ⟨u_in, v_in⟩ : u ∈ closure s ∧ v ∈ closure s := by
-        simpa [closure_prod_eq] using closure_mono this uv_in
-      apply ContinuousWithinAt.mono _ this
-      simp only [ContinuousWithinAt]
-    rw [nhdsWithin_prod_eq]
-    · have : ∀ u v, f v - f u - (f' v - f' u) = f v - f' v - (f u - f' u) := by intros; abel
-      simp only [this]
-      exact
-        tendsto.comp continuous_norm.continuous_at
-          ((tendsto.comp (f_cont' v v_in) tendsto_snd).sub <|
-            tendsto.comp (f_cont' u u_in) tendsto_fst)
-    · apply tendsto_nhdsWithin_of_tendsto_nhds
-      rw [nhds_prod_eq]
-      exact
-        tendsto_const_nhds.mul
-          (tendsto.comp continuous_norm.continuous_at <| tendsto_snd.sub tendsto_fst)
+      intro z z_in
+      convert le_of_lt (hδ _ z_in.2 z_in.1)
+      have op : IsOpen (B ∩ s) := is_open_ball.inter s_open
+      rw [DifferentiableAt.fderivWithin _ (op.unique_diff_on z z_in)]
+      exact (diff z z_in).DifferentiableAt (IsOpen.mem_nhds op z_in)
+    simpa using conv.norm_image_sub_le_of_norm_fderiv_within_le' diff bound u_in v_in
+  rintro ⟨u, v⟩ uv_in
+  refine' ContinuousWithinAt.closure_le uv_in _ _ key
+  have f_cont' : ∀ y ∈ closure s, ContinuousWithinAt (f - f') s y :=
+    by
+    intro y y_in
+    exact tendsto.sub (f_cont y y_in) f'.cont.continuous_within_at
+  all_goals
+    -- common start for both continuity proofs
+    have : (B ∩ s) ×ˢ (B ∩ s) ⊆ s ×ˢ s := by mono <;> exact inter_subset_right _ _
+    obtain ⟨u_in, v_in⟩ : u ∈ closure s ∧ v ∈ closure s := by
+      simpa [closure_prod_eq] using closure_mono this uv_in
+    apply ContinuousWithinAt.mono _ this
+    simp only [ContinuousWithinAt]
+  rw [nhdsWithin_prod_eq]
+  · have : ∀ u v, f v - f u - (f' v - f' u) = f v - f' v - (f u - f' u) := by intros; abel
+    simp only [this]
+    exact
+      tendsto.comp continuous_norm.continuous_at
+        ((tendsto.comp (f_cont' v v_in) tendsto_snd).sub <|
+          tendsto.comp (f_cont' u u_in) tendsto_fst)
+  · apply tendsto_nhdsWithin_of_tendsto_nhds
+    rw [nhds_prod_eq]
+    exact
+      tendsto_const_nhds.mul
+        (tendsto.comp continuous_norm.continuous_at <| tendsto_snd.sub tendsto_fst)
 #align has_fderiv_at_boundary_of_tendsto_fderiv has_fderiv_at_boundary_of_tendsto_fderiv
 
 #print has_deriv_at_interval_left_endpoint_of_tendsto_deriv /-
@@ -143,7 +146,7 @@ theorem has_deriv_at_interval_left_endpoint_of_tendsto_deriv {s : Set ℝ} {e :
     simp only [deriv_fderiv.symm]
     exact
       tendsto.comp
-        (isBoundedBilinearMapSmulRight : IsBoundedBilinearMap ℝ _).continuous_right.ContinuousAt
+        (isBoundedBilinearMap_smulRight : IsBoundedBilinearMap ℝ _).continuous_right.ContinuousAt
         (tendsto_nhdsWithin_mono_left Ioo_subset_Ioi_self f_lim')
   -- now we can apply `has_fderiv_at_boundary_of_differentiable`
   have : HasDerivWithinAt f e (Icc a b) a :=
@@ -185,7 +188,7 @@ theorem has_deriv_at_interval_right_endpoint_of_tendsto_deriv {s : Set ℝ} {e :
     simp only [deriv_fderiv.symm]
     exact
       tendsto.comp
-        (isBoundedBilinearMapSmulRight : IsBoundedBilinearMap ℝ _).continuous_right.ContinuousAt
+        (isBoundedBilinearMap_smulRight : IsBoundedBilinearMap ℝ _).continuous_right.ContinuousAt
         (tendsto_nhdsWithin_mono_left Ioo_subset_Iio_self f_lim')
   -- now we can apply `has_fderiv_at_boundary_of_differentiable`
   have : HasDerivWithinAt f e (Icc b a) a :=
Diff
@@ -113,6 +113,7 @@ theorem has_fderiv_at_boundary_of_tendsto_fderiv {f : E → F} {s : Set E} {x :
           (tendsto.comp continuous_norm.continuous_at <| tendsto_snd.sub tendsto_fst)
 #align has_fderiv_at_boundary_of_tendsto_fderiv has_fderiv_at_boundary_of_tendsto_fderiv
 
+#print has_deriv_at_interval_left_endpoint_of_tendsto_deriv /-
 /-- If a function is differentiable on the right of a point `a : ℝ`, continuous at `a`, and
 its derivative also converges at `a`, then `f` is differentiable on the right at `a`. -/
 theorem has_deriv_at_interval_left_endpoint_of_tendsto_deriv {s : Set ℝ} {e : E} {a : ℝ} {f : ℝ → E}
@@ -151,7 +152,9 @@ theorem has_deriv_at_interval_left_endpoint_of_tendsto_deriv {s : Set ℝ} {e :
     exact has_fderiv_at_boundary_of_tendsto_fderiv t_diff t_conv t_open t_cont t_diff'
   exact this.nhds_within (Icc_mem_nhdsWithin_Ici <| left_mem_Ico.2 ab)
 #align has_deriv_at_interval_left_endpoint_of_tendsto_deriv has_deriv_at_interval_left_endpoint_of_tendsto_deriv
+-/
 
+#print has_deriv_at_interval_right_endpoint_of_tendsto_deriv /-
 /-- If a function is differentiable on the left of a point `a : ℝ`, continuous at `a`, and
 its derivative also converges at `a`, then `f` is differentiable on the left at `a`. -/
 theorem has_deriv_at_interval_right_endpoint_of_tendsto_deriv {s : Set ℝ} {e : E} {a : ℝ}
@@ -191,8 +194,10 @@ theorem has_deriv_at_interval_right_endpoint_of_tendsto_deriv {s : Set ℝ} {e :
     exact has_fderiv_at_boundary_of_tendsto_fderiv t_diff t_conv t_open t_cont t_diff'
   exact this.nhds_within (Icc_mem_nhdsWithin_Iic <| right_mem_Ioc.2 ba)
 #align has_deriv_at_interval_right_endpoint_of_tendsto_deriv has_deriv_at_interval_right_endpoint_of_tendsto_deriv
+-/
 
 /- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (y «expr ≠ » x) -/
+#print hasDerivAt_of_hasDerivAt_of_ne /-
 /-- If a real function `f` has a derivative `g` everywhere but at a point, and `f` and `g` are
 continuous at this point, then `g` is also the derivative of `f` at this point. -/
 theorem hasDerivAt_of_hasDerivAt_of_ne {f g : ℝ → E} {x : ℝ}
@@ -227,8 +232,10 @@ theorem hasDerivAt_of_hasDerivAt_of_ne {f g : ℝ → E} {x : ℝ}
     exact (f_diff y (ne_of_lt hy)).deriv.symm
   simpa using B.union A
 #align has_deriv_at_of_has_deriv_at_of_ne hasDerivAt_of_hasDerivAt_of_ne
+-/
 
 /- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (y «expr ≠ » x) -/
+#print hasDerivAt_of_hasDerivAt_of_ne' /-
 /-- If a real function `f` has a derivative `g` everywhere but at a point, and `f` and `g` are
 continuous at this point, then `g` is the derivative of `f` everywhere. -/
 theorem hasDerivAt_of_hasDerivAt_of_ne' {f g : ℝ → E} {x : ℝ}
@@ -239,4 +246,5 @@ theorem hasDerivAt_of_hasDerivAt_of_ne' {f g : ℝ → E} {x : ℝ}
   · exact hasDerivAt_of_hasDerivAt_of_ne f_diff hf hg
   · exact f_diff y hne
 #align has_deriv_at_of_has_deriv_at_of_ne' hasDerivAt_of_hasDerivAt_of_ne'
+-/
 
Diff
@@ -50,8 +50,8 @@ theorem has_fderiv_at_boundary_of_tendsto_fderiv {f : E → F} {s : Set E} {x :
     -- one can assume without loss of generality that `x` belongs to the closure of `s`, as the
     -- statement is empty otherwise
     by_cases hx : x ∉ closure s
-    · rw [← closure_closure] at hx; exact hasFDerivWithinAt_of_not_mem_closure hx
-    push_neg  at hx
+    · rw [← closure_closure] at hx ; exact hasFDerivWithinAt_of_not_mem_closure hx
+    push_neg  at hx 
     rw [HasFDerivWithinAt, HasFDerivAtFilter, Asymptotics.isLittleO_iff]
     /- One needs to show that `‖f y - f x - f' (y - x)‖ ≤ ε ‖y - x‖` for `y` close to `x` in `closure
       s`, where `ε` is an arbitrary positive constant. By continuity of the functions, it suffices to
@@ -67,7 +67,7 @@ theorem has_fderiv_at_boundary_of_tendsto_fderiv {f : E → F} {s : Set E} {x :
       ∀ p : E × E,
         p ∈ closure ((B ∩ s) ×ˢ (B ∩ s)) → ‖f p.2 - f p.1 - (f' p.2 - f' p.1)‖ ≤ ε * ‖p.2 - p.1‖
       by
-      rw [closure_prod_eq] at this
+      rw [closure_prod_eq] at this 
       intro y y_in
       apply this ⟨x, y⟩
       have : B ∩ closure s ⊆ closure (B ∩ s) := is_open_ball.inter_closure
@@ -100,7 +100,7 @@ theorem has_fderiv_at_boundary_of_tendsto_fderiv {f : E → F} {s : Set E} {x :
       apply ContinuousWithinAt.mono _ this
       simp only [ContinuousWithinAt]
     rw [nhdsWithin_prod_eq]
-    · have : ∀ u v, f v - f u - (f' v - f' u) = f v - f' v - (f u - f' u) := by intros ; abel
+    · have : ∀ u v, f v - f u - (f' v - f' u) = f v - f' v - (f u - f' u) := by intros; abel
       simp only [this]
       exact
         tendsto.comp continuous_norm.continuous_at
Diff
@@ -30,7 +30,7 @@ variable {E : Type _} [NormedAddCommGroup E] [NormedSpace ℝ E] {F : Type _} [N
 
 open Filter Set Metric ContinuousLinearMap
 
-open Topology
+open scoped Topology
 
 attribute [local mono] prod_mono
 
Diff
@@ -50,8 +50,7 @@ theorem has_fderiv_at_boundary_of_tendsto_fderiv {f : E → F} {s : Set E} {x :
     -- one can assume without loss of generality that `x` belongs to the closure of `s`, as the
     -- statement is empty otherwise
     by_cases hx : x ∉ closure s
-    · rw [← closure_closure] at hx
-      exact hasFDerivWithinAt_of_not_mem_closure hx
+    · rw [← closure_closure] at hx; exact hasFDerivWithinAt_of_not_mem_closure hx
     push_neg  at hx
     rw [HasFDerivWithinAt, HasFDerivAtFilter, Asymptotics.isLittleO_iff]
     /- One needs to show that `‖f y - f x - f' (y - x)‖ ≤ ε ‖y - x‖` for `y` close to `x` in `closure
@@ -101,10 +100,7 @@ theorem has_fderiv_at_boundary_of_tendsto_fderiv {f : E → F} {s : Set E} {x :
       apply ContinuousWithinAt.mono _ this
       simp only [ContinuousWithinAt]
     rw [nhdsWithin_prod_eq]
-    · have : ∀ u v, f v - f u - (f' v - f' u) = f v - f' v - (f u - f' u) :=
-        by
-        intros
-        abel
+    · have : ∀ u v, f v - f u - (f' v - f' u) = f v - f' v - (f u - f' u) := by intros ; abel
       simp only [this]
       exact
         tendsto.comp continuous_norm.continuous_at
@@ -138,8 +134,7 @@ theorem has_deriv_at_interval_left_endpoint_of_tendsto_deriv {s : Set ℝ} {e :
     rw [t_closure]
     intro y hy
     by_cases h : y = a
-    · rw [h]
-      exact f_lim.mono ts
+    · rw [h]; exact f_lim.mono ts
     · have : y ∈ s := sab ⟨lt_of_le_of_ne hy.1 (Ne.symm h), hy.2⟩
       exact (f_diff.continuous_on y this).mono ts
   have t_diff' : tendsto (fun x => fderiv ℝ f x) (𝓝[t] a) (𝓝 (smul_right 1 e)) :=
@@ -179,8 +174,7 @@ theorem has_deriv_at_interval_right_endpoint_of_tendsto_deriv {s : Set ℝ} {e :
     rw [t_closure]
     intro y hy
     by_cases h : y = a
-    · rw [h]
-      exact f_lim.mono ts
+    · rw [h]; exact f_lim.mono ts
     · have : y ∈ s := sab ⟨hy.1, lt_of_le_of_ne hy.2 h⟩
       exact (f_diff.continuous_on y this).mono ts
   have t_diff' : tendsto (fun x => fderiv ℝ f x) (𝓝[t] a) (𝓝 (smul_right 1 e)) :=
Diff
@@ -44,16 +44,16 @@ with derivative `f'`. -/
 theorem has_fderiv_at_boundary_of_tendsto_fderiv {f : E → F} {s : Set E} {x : E} {f' : E →L[ℝ] F}
     (f_diff : DifferentiableOn ℝ f s) (s_conv : Convex ℝ s) (s_open : IsOpen s)
     (f_cont : ∀ y ∈ closure s, ContinuousWithinAt f s y)
-    (h : Tendsto (fun y => fderiv ℝ f y) (𝓝[s] x) (𝓝 f')) : HasFderivWithinAt f f' (closure s) x :=
+    (h : Tendsto (fun y => fderiv ℝ f y) (𝓝[s] x) (𝓝 f')) : HasFDerivWithinAt f f' (closure s) x :=
   by
   classical
     -- one can assume without loss of generality that `x` belongs to the closure of `s`, as the
     -- statement is empty otherwise
     by_cases hx : x ∉ closure s
     · rw [← closure_closure] at hx
-      exact hasFderivWithinAt_of_not_mem_closure hx
+      exact hasFDerivWithinAt_of_not_mem_closure hx
     push_neg  at hx
-    rw [HasFderivWithinAt, HasFderivAtFilter, Asymptotics.isLittleO_iff]
+    rw [HasFDerivWithinAt, HasFDerivAtFilter, Asymptotics.isLittleO_iff]
     /- One needs to show that `‖f y - f x - f' (y - x)‖ ≤ ε ‖y - x‖` for `y` close to `x` in `closure
       s`, where `ε` is an arbitrary positive constant. By continuity of the functions, it suffices to
       prove this for nearby points inside `s`. In a neighborhood of `x`, the derivative of `f` is
@@ -152,7 +152,7 @@ theorem has_deriv_at_interval_left_endpoint_of_tendsto_deriv {s : Set ℝ} {e :
   -- now we can apply `has_fderiv_at_boundary_of_differentiable`
   have : HasDerivWithinAt f e (Icc a b) a :=
     by
-    rw [hasDerivWithinAt_iff_hasFderivWithinAt, ← t_closure]
+    rw [hasDerivWithinAt_iff_hasFDerivWithinAt, ← t_closure]
     exact has_fderiv_at_boundary_of_tendsto_fderiv t_diff t_conv t_open t_cont t_diff'
   exact this.nhds_within (Icc_mem_nhdsWithin_Ici <| left_mem_Ico.2 ab)
 #align has_deriv_at_interval_left_endpoint_of_tendsto_deriv has_deriv_at_interval_left_endpoint_of_tendsto_deriv
@@ -193,7 +193,7 @@ theorem has_deriv_at_interval_right_endpoint_of_tendsto_deriv {s : Set ℝ} {e :
   -- now we can apply `has_fderiv_at_boundary_of_differentiable`
   have : HasDerivWithinAt f e (Icc b a) a :=
     by
-    rw [hasDerivWithinAt_iff_hasFderivWithinAt, ← t_closure]
+    rw [hasDerivWithinAt_iff_hasFDerivWithinAt, ← t_closure]
     exact has_fderiv_at_boundary_of_tendsto_fderiv t_diff t_conv t_open t_cont t_diff'
   exact this.nhds_within (Icc_mem_nhdsWithin_Iic <| right_mem_Ioc.2 ba)
 #align has_deriv_at_interval_right_endpoint_of_tendsto_deriv has_deriv_at_interval_right_endpoint_of_tendsto_deriv
Diff
@@ -53,7 +53,7 @@ theorem has_fderiv_at_boundary_of_tendsto_fderiv {f : E → F} {s : Set E} {x :
     · rw [← closure_closure] at hx
       exact hasFderivWithinAt_of_not_mem_closure hx
     push_neg  at hx
-    rw [HasFderivWithinAt, HasFderivAtFilter, Asymptotics.isOCat_iff]
+    rw [HasFderivWithinAt, HasFderivAtFilter, Asymptotics.isLittleO_iff]
     /- One needs to show that `‖f y - f x - f' (y - x)‖ ≤ ε ‖y - x‖` for `y` close to `x` in `closure
       s`, where `ε` is an arbitrary positive constant. By continuity of the functions, it suffices to
       prove this for nearby points inside `s`. In a neighborhood of `x`, the derivative of `f` is
Diff
@@ -198,7 +198,7 @@ theorem has_deriv_at_interval_right_endpoint_of_tendsto_deriv {s : Set ℝ} {e :
   exact this.nhds_within (Icc_mem_nhdsWithin_Iic <| right_mem_Ioc.2 ba)
 #align has_deriv_at_interval_right_endpoint_of_tendsto_deriv has_deriv_at_interval_right_endpoint_of_tendsto_deriv
 
-/- ./././Mathport/Syntax/Translate/Basic.lean:628:2: warning: expanding binder collection (y «expr ≠ » x) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (y «expr ≠ » x) -/
 /-- If a real function `f` has a derivative `g` everywhere but at a point, and `f` and `g` are
 continuous at this point, then `g` is also the derivative of `f` at this point. -/
 theorem hasDerivAt_of_hasDerivAt_of_ne {f g : ℝ → E} {x : ℝ}
@@ -234,7 +234,7 @@ theorem hasDerivAt_of_hasDerivAt_of_ne {f g : ℝ → E} {x : ℝ}
   simpa using B.union A
 #align has_deriv_at_of_has_deriv_at_of_ne hasDerivAt_of_hasDerivAt_of_ne
 
-/- ./././Mathport/Syntax/Translate/Basic.lean:628:2: warning: expanding binder collection (y «expr ≠ » x) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (y «expr ≠ » x) -/
 /-- If a real function `f` has a derivative `g` everywhere but at a point, and `f` and `g` are
 continuous at this point, then `g` is the derivative of `f` everywhere. -/
 theorem hasDerivAt_of_hasDerivAt_of_ne' {f g : ℝ → E} {x : ℝ}

Changes in mathlib4

mathlib3
mathlib4
chore: adapt to multiple goal linter 2 (#12361)

A PR analogous to #12338: reformatting proofs following the multiple goals linter of #12339.

Diff
@@ -81,10 +81,10 @@ theorem has_fderiv_at_boundary_of_tendsto_fderiv {f : E → F} {s : Set E} {x :
         exact le_of_lt (h z_in.2 z_in.1)
       simpa using conv.norm_image_sub_le_of_norm_fderivWithin_le' diff bound u_in v_in
     rintro ⟨u, v⟩ uv_in
-    refine' ContinuousWithinAt.closure_le uv_in _ _ key
     have f_cont' : ∀ y ∈ closure s, ContinuousWithinAt (f -  ⇑f') s y := by
       intro y y_in
       exact Tendsto.sub (f_cont y y_in) f'.cont.continuousWithinAt
+    refine' ContinuousWithinAt.closure_le uv_in _ _ key
     all_goals
       -- common start for both continuity proofs
       have : (B ∩ s) ×ˢ (B ∩ s) ⊆ s ×ˢ s := by mono <;> exact inter_subset_right _ _
@@ -92,8 +92,8 @@ theorem has_fderiv_at_boundary_of_tendsto_fderiv {f : E → F} {s : Set E} {x :
         simpa [closure_prod_eq] using closure_mono this uv_in
       apply ContinuousWithinAt.mono _ this
       simp only [ContinuousWithinAt]
-    rw [nhdsWithin_prod_eq]
-    · have : ∀ u v, f v - f u - (f' v - f' u) = f v - f' v - (f u - f' u) := by intros; abel
+    · rw [nhdsWithin_prod_eq]
+      have : ∀ u v, f v - f u - (f' v - f' u) = f v - f' v - (f u - f' u) := by intros; abel
       simp only [this]
       exact
         Tendsto.comp continuous_norm.continuousAt
chore: superfluous parentheses (#12116)

Co-authored-by: Moritz Firsching <firsching@google.com>

Diff
@@ -78,7 +78,7 @@ theorem has_fderiv_at_boundary_of_tendsto_fderiv {f : E → F} {s : Set E} {x :
           rw [DifferentiableAt.fderivWithin _ (op.uniqueDiffOn z z_in)]
           exact (diff z z_in).differentiableAt (IsOpen.mem_nhds op z_in)
         rw [← this] at h
-        exact (le_of_lt (h z_in.2 z_in.1))
+        exact le_of_lt (h z_in.2 z_in.1)
       simpa using conv.norm_image_sub_le_of_norm_fderivWithin_le' diff bound u_in v_in
     rintro ⟨u, v⟩ uv_in
     refine' ContinuousWithinAt.closure_le uv_in _ _ key
chore: remove stream-of-consciousness uses of have, replace and suffices (#10640)

No changes to tactic file, it's just boring fixes throughout the library.

This follows on from #6964.

Co-authored-by: sgouezel <sebastien.gouezel@univ-rennes1.fr> Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Diff
@@ -55,8 +55,8 @@ theorem has_fderiv_at_boundary_of_tendsto_fderiv {f : E → F} {s : Set E} {x :
     obtain ⟨δ, δ_pos, hδ⟩ : ∃ δ > 0, ∀ y ∈ s, dist y x < δ → ‖fderiv ℝ f y - f'‖ < ε := by
       simpa [dist_zero_right] using tendsto_nhdsWithin_nhds.1 h ε ε_pos
     set B := ball x δ
-    suffices : ∀ y ∈ B ∩ closure s, ‖f y - f x - (f' y - f' x)‖ ≤ ε * ‖y - x‖
-    exact mem_nhdsWithin_iff.2 ⟨δ, δ_pos, fun y hy => by simpa using this y hy⟩
+    suffices ∀ y ∈ B ∩ closure s, ‖f y - f x - (f' y - f' x)‖ ≤ ε * ‖y - x‖ from
+      mem_nhdsWithin_iff.2 ⟨δ, δ_pos, fun y hy => by simpa using this y hy⟩
     suffices
       ∀ p : E × E,
         p ∈ closure ((B ∩ s) ×ˢ (B ∩ s)) → ‖f p.2 - f p.1 - (f' p.2 - f' p.1)‖ ≤ ε * ‖p.2 - p.1‖ by
chore(*): use ∃ x ∈ s, _ instead of ∃ (x) (_ : x ∈ s), _ (#9184)

Search for [∀∃].*(_ and manually replace some occurrences with more readable versions. In case of , the new expressions are defeq to the old ones. In case of , they differ by exists_prop.

In some rare cases, golf proofs that needed fixing.

Diff
@@ -178,7 +178,7 @@ theorem has_deriv_at_interval_right_endpoint_of_tendsto_deriv {s : Set ℝ} {e :
 /-- If a real function `f` has a derivative `g` everywhere but at a point, and `f` and `g` are
 continuous at this point, then `g` is also the derivative of `f` at this point. -/
 theorem hasDerivAt_of_hasDerivAt_of_ne {f g : ℝ → E} {x : ℝ}
-    (f_diff : ∀ (y) (_ : y ≠ x), HasDerivAt f (g y) y) (hf : ContinuousAt f x)
+    (f_diff : ∀ y ≠ x, HasDerivAt f (g y) y) (hf : ContinuousAt f x)
     (hg : ContinuousAt g x) : HasDerivAt f (g x) x := by
   have A : HasDerivWithinAt f (g x) (Ici x) x := by
     have diff : DifferentiableOn ℝ f (Ioi x) := fun y hy =>
@@ -212,7 +212,7 @@ theorem hasDerivAt_of_hasDerivAt_of_ne {f g : ℝ → E} {x : ℝ}
 /-- If a real function `f` has a derivative `g` everywhere but at a point, and `f` and `g` are
 continuous at this point, then `g` is the derivative of `f` everywhere. -/
 theorem hasDerivAt_of_hasDerivAt_of_ne' {f g : ℝ → E} {x : ℝ}
-    (f_diff : ∀ (y) (_ : y ≠ x), HasDerivAt f (g y) y) (hf : ContinuousAt f x)
+    (f_diff : ∀ y ≠ x, HasDerivAt f (g y) y) (hf : ContinuousAt f x)
     (hg : ContinuousAt g x) (y : ℝ) : HasDerivAt f (g y) y := by
   rcases eq_or_ne y x with (rfl | hne)
   · exact hasDerivAt_of_hasDerivAt_of_ne f_diff hf hg
refactor(FDeriv): use structure (#8907)

This way we can easily change the definition so that it works for topological vector spaces without generalizing any of the theorems right away.

Diff
@@ -45,7 +45,7 @@ theorem has_fderiv_at_boundary_of_tendsto_fderiv {f : E → F} {s : Set E} {x :
     by_cases hx : x ∉ closure s
     · rw [← closure_closure] at hx; exact hasFDerivWithinAt_of_nmem_closure hx
     push_neg at hx
-    rw [HasFDerivWithinAt, HasFDerivAtFilter, Asymptotics.isLittleO_iff]
+    rw [HasFDerivWithinAt, hasFDerivAtFilter_iff_isLittleO, Asymptotics.isLittleO_iff]
     /- One needs to show that `‖f y - f x - f' (y - x)‖ ≤ ε ‖y - x‖` for `y` close to `x` in
       `closure s`, where `ε` is an arbitrary positive constant. By continuity of the functions, it
       suffices to prove this for nearby points inside `s`. In a neighborhood of `x`, the derivative
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
@@ -43,7 +43,7 @@ theorem has_fderiv_at_boundary_of_tendsto_fderiv {f : E → F} {s : Set E} {x :
     -- one can assume without loss of generality that `x` belongs to the closure of `s`, as the
     -- statement is empty otherwise
     by_cases hx : x ∉ closure s
-    · rw [← closure_closure] at hx; exact hasFDerivWithinAt_of_not_mem_closure hx
+    · rw [← closure_closure] at hx; exact hasFDerivWithinAt_of_nmem_closure hx
     push_neg at hx
     rw [HasFDerivWithinAt, HasFDerivAtFilter, Asymptotics.isLittleO_iff]
     /- One needs to show that `‖f y - f x - f' (y - x)‖ ≤ ε ‖y - x‖` for `y` close to `x` in
chore: remove duplicate lemma HasFDerivWithinAt.nhdsWithin (#6773)

This is a perfect duplicate of HasFDerivWithinAt.mono_of_mem.

Same thing with Deriv instead of FDeriv.

Diff
@@ -137,7 +137,7 @@ theorem has_deriv_at_interval_left_endpoint_of_tendsto_deriv {s : Set ℝ} {e :
   have : HasDerivWithinAt f e (Icc a b) a := by
     rw [hasDerivWithinAt_iff_hasFDerivWithinAt, ← t_closure]
     exact has_fderiv_at_boundary_of_tendsto_fderiv t_diff t_conv t_open t_cont t_diff'
-  exact this.nhdsWithin (Icc_mem_nhdsWithin_Ici <| left_mem_Ico.2 ab)
+  exact this.mono_of_mem (Icc_mem_nhdsWithin_Ici <| left_mem_Ico.2 ab)
 #align has_deriv_at_interval_left_endpoint_of_tendsto_deriv has_deriv_at_interval_left_endpoint_of_tendsto_deriv
 
 /-- If a function is differentiable on the left of a point `a : ℝ`, continuous at `a`, and
@@ -172,7 +172,7 @@ theorem has_deriv_at_interval_right_endpoint_of_tendsto_deriv {s : Set ℝ} {e :
   have : HasDerivWithinAt f e (Icc b a) a := by
     rw [hasDerivWithinAt_iff_hasFDerivWithinAt, ← t_closure]
     exact has_fderiv_at_boundary_of_tendsto_fderiv t_diff t_conv t_open t_cont t_diff'
-  exact this.nhdsWithin (Icc_mem_nhdsWithin_Iic <| right_mem_Ioc.2 ba)
+  exact this.mono_of_mem (Icc_mem_nhdsWithin_Iic <| right_mem_Ioc.2 ba)
 #align has_deriv_at_interval_right_endpoint_of_tendsto_deriv has_deriv_at_interval_right_endpoint_of_tendsto_deriv
 
 /-- If a real function `f` has a derivative `g` everywhere but at a point, and `f` and `g` are
chore: banish Type _ and Sort _ (#6499)

We remove all possible occurences of Type _ and Sort _ in favor of Type* and Sort*.

This has nice performance benefits.

Diff
@@ -22,7 +22,7 @@ of the one-dimensional derivative `deriv ℝ f`.
 -/
 
 
-variable {E : Type _} [NormedAddCommGroup E] [NormedSpace ℝ E] {F : Type _} [NormedAddCommGroup F]
+variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] {F : Type*} [NormedAddCommGroup F]
   [NormedSpace ℝ F]
 
 open Filter Set Metric ContinuousLinearMap
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,14 +2,11 @@
 Copyright (c) 2019 Sébastien Gouëzel. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel
-
-! This file was ported from Lean 3 source module analysis.calculus.extend_deriv
-! leanprover-community/mathlib commit f2ce6086713c78a7f880485f7917ea547a215982
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Analysis.Calculus.MeanValue
 
+#align_import analysis.calculus.extend_deriv from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
+
 /-!
 # Extending differentiability to the boundary
 
chore: remove occurrences of semicolon after space (#5713)

This is the second half of the changes originally in #5699, removing all occurrences of ; after a space and implementing a linter rule to enforce it.

In most cases this 2-character substring has a space after it, so the following command was run first:

find . -type f -name "*.lean" -exec sed -i -E 's/ ; /; /g' {} \;

The remaining cases were few enough in number that they were done manually.

Diff
@@ -46,7 +46,7 @@ theorem has_fderiv_at_boundary_of_tendsto_fderiv {f : E → F} {s : Set E} {x :
     -- one can assume without loss of generality that `x` belongs to the closure of `s`, as the
     -- statement is empty otherwise
     by_cases hx : x ∉ closure s
-    · rw [← closure_closure] at hx ; exact hasFDerivWithinAt_of_not_mem_closure hx
+    · rw [← closure_closure] at hx; exact hasFDerivWithinAt_of_not_mem_closure hx
     push_neg at hx
     rw [HasFDerivWithinAt, HasFDerivAtFilter, Asymptotics.isLittleO_iff]
     /- One needs to show that `‖f y - f x - f' (y - x)‖ ≤ ε ‖y - x‖` for `y` close to `x` in
chore: clean up spacing around at and goals (#5387)

Changes are of the form

  • some_tactic at h⊢ -> some_tactic at h ⊢
  • some_tactic at h -> some_tactic at h
Diff
@@ -47,7 +47,7 @@ theorem has_fderiv_at_boundary_of_tendsto_fderiv {f : E → F} {s : Set E} {x :
     -- statement is empty otherwise
     by_cases hx : x ∉ closure s
     · rw [← closure_closure] at hx ; exact hasFDerivWithinAt_of_not_mem_closure hx
-    push_neg  at hx
+    push_neg at hx
     rw [HasFDerivWithinAt, HasFDerivAtFilter, Asymptotics.isLittleO_iff]
     /- One needs to show that `‖f y - f x - f' (y - x)‖ ≤ ε ‖y - x‖` for `y` close to `x` in
       `closure s`, where `ε` is an arbitrary positive constant. By continuity of the functions, it
chore: fix some names (#4564)
  • Protect HasFTaylorSeriesUpToOn.fderivWithin, IsBoundedBilinearMap.fderiv, and IsBoundedBilinearMap.fderivWithin.

  • Rename

    • isBoundedBilinearMapSmul -> isBoundedBilinearMap_smul;
    • isBoundedBilinearMapMul -> isBoundedBilinearMap_mul;
    • isBoundedBilinearMapComp -> isBoundedBilinearMap_comp;
    • isBoundedBilinearMapSmulRight -> isBoundedBilinearMap_smulRight;
    • isBoundedBilinearMapCompMultilinear -> isBoundedBilinearMap_compMultilinear;
    • ContinuousLinearMap.mulLeftRightIsBoundedBilinear -> ContinuousLinearMap.mulLeftRight_isBoundedBilinear;
    • nhdsWithin_eq_nhds_within' -> nhdsWithin_eq_nhdsWithin';
    • ContinuousWithinAt.preimage_mem_nhds_within' -> ContinuousWithinAt.preimage_mem_nhdsWithin'.

Co-authored-by: Floris van Doorn <fpvdoorn@gmail.com> Co-authored-by: Parcly Taxel <reddeloostw@gmail.com>

Diff
@@ -133,10 +133,9 @@ theorem has_deriv_at_interval_left_endpoint_of_tendsto_deriv {s : Set ℝ} {e :
       exact (f_diff.continuousOn y this).mono ts
   have t_diff' : Tendsto (fun x => fderiv ℝ f x) (𝓝[t] a) (𝓝 (smulRight 1 e)) := by
     simp only [deriv_fderiv.symm]
-    exact
-      Tendsto.comp
-        (isBoundedBilinearMapSmulRight : IsBoundedBilinearMap ℝ _).continuous_right.continuousAt
-        (tendsto_nhdsWithin_mono_left Ioo_subset_Ioi_self f_lim')
+    exact Tendsto.comp
+      (isBoundedBilinearMap_smulRight : IsBoundedBilinearMap ℝ _).continuous_right.continuousAt
+      (tendsto_nhdsWithin_mono_left Ioo_subset_Ioi_self f_lim')
   -- now we can apply `has_fderiv_at_boundary_of_differentiable`
   have : HasDerivWithinAt f e (Icc a b) a := by
     rw [hasDerivWithinAt_iff_hasFDerivWithinAt, ← t_closure]
@@ -169,10 +168,9 @@ theorem has_deriv_at_interval_right_endpoint_of_tendsto_deriv {s : Set ℝ} {e :
       exact (f_diff.continuousOn y this).mono ts
   have t_diff' : Tendsto (fun x => fderiv ℝ f x) (𝓝[t] a) (𝓝 (smulRight 1 e)) := by
     simp only [deriv_fderiv.symm]
-    exact
-      Tendsto.comp
-        (isBoundedBilinearMapSmulRight : IsBoundedBilinearMap ℝ _).continuous_right.continuousAt
-        (tendsto_nhdsWithin_mono_left Ioo_subset_Iio_self f_lim')
+    exact Tendsto.comp
+      (isBoundedBilinearMap_smulRight : IsBoundedBilinearMap ℝ _).continuous_right.continuousAt
+      (tendsto_nhdsWithin_mono_left Ioo_subset_Iio_self f_lim')
   -- now we can apply `has_fderiv_at_boundary_of_differentiable`
   have : HasDerivWithinAt f e (Icc b a) a := by
     rw [hasDerivWithinAt_iff_hasFDerivWithinAt, ← t_closure]
feat: port Analysis.Calculus.ExtendDeriv (#4562)

Co-authored-by: Moritz Firsching <firsching@google.com>

Dependencies 10 + 764

765 files ported (98.7%)
338883 lines ported (98.5%)
Show graph

The unported dependencies are

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