analysis.inner_product_space.calculusMathlib.Analysis.InnerProductSpace.Calculus

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)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -31,13 +31,13 @@ The last part of the file should be generalized to `pi_Lp`.
 
 noncomputable section
 
-open IsROrC Real Filter
+open RCLike Real Filter
 
 open scoped BigOperators Classical Topology
 
 section DerivInner
 
-variable {𝕜 E F : Type _} [IsROrC 𝕜]
+variable {𝕜 E F : Type _} [RCLike 𝕜]
 
 variable [NormedAddCommGroup E] [InnerProductSpace 𝕜 E]
 
@@ -381,7 +381,7 @@ section PiLike
 
 open ContinuousLinearMap
 
-variable {𝕜 ι H : Type _} [IsROrC 𝕜] [NormedAddCommGroup H] [NormedSpace 𝕜 H] [Fintype ι]
+variable {𝕜 ι H : Type _} [RCLike 𝕜] [NormedAddCommGroup H] [NormedSpace 𝕜 H] [Fintype ι]
   {f : H → EuclideanSpace 𝕜 ι} {f' : H →L[𝕜] EuclideanSpace 𝕜 ι} {t : Set H} {y : H}
 
 #print differentiableWithinAt_euclidean /-
Diff
@@ -509,7 +509,7 @@ theorem Homeomorph.contDiffOn_unitBall_symm {f : E → E}
   refine' ContDiffAt.congr_of_eventuallyEq _ hf
   suffices ContDiffAt ℝ n (fun y => (1 - ‖(y : E)‖ ^ 2).sqrt⁻¹) y by exact this.smul contDiffAt_id
   have h : 0 < 1 - ‖(y : E)‖ ^ 2 := by
-    rwa [mem_ball_zero_iff, ← _root_.abs_one, ← abs_norm, ← sq_lt_sq, one_pow, ← sub_pos] at hy 
+    rwa [mem_ball_zero_iff, ← _root_.abs_one, ← abs_norm, ← sq_lt_sq, one_pow, ← sub_pos] at hy
   refine' ContDiffAt.inv _ (real.sqrt_ne_zero'.mpr h)
   refine' ContDiffAt.comp _ (cont_diff_at_sqrt h.ne.symm) _
   exact cont_diff_at_const.sub (contDiff_norm_sq ℝ).ContDiffAt
Diff
@@ -47,18 +47,18 @@ local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y
 
 variable (𝕜) [NormedSpace ℝ E]
 
-#print fderivInnerClm /-
+#print fderivInnerCLM /-
 /-- Derivative of the inner product. -/
-def fderivInnerClm (p : E × E) : E × E →L[ℝ] 𝕜 :=
+def fderivInnerCLM (p : E × E) : E × E →L[ℝ] 𝕜 :=
   isBoundedBilinearMap_inner.deriv p
-#align fderiv_inner_clm fderivInnerClm
+#align fderiv_inner_clm fderivInnerCLM
 -/
 
-#print fderivInnerClm_apply /-
+#print fderivInnerCLM_apply /-
 @[simp]
-theorem fderivInnerClm_apply (p x : E × E) : fderivInnerClm 𝕜 p x = ⟪p.1, x.2⟫ + ⟪x.1, p.2⟫ :=
+theorem fderivInnerCLM_apply (p x : E × E) : fderivInnerCLM 𝕜 p x = ⟪p.1, x.2⟫ + ⟪x.1, p.2⟫ :=
   rfl
-#align fderiv_inner_clm_apply fderivInnerClm_apply
+#align fderiv_inner_clm_apply fderivInnerCLM_apply
 -/
 
 #print contDiff_inner /-
@@ -112,7 +112,7 @@ theorem ContDiff.inner (hf : ContDiff ℝ n f) (hg : ContDiff ℝ n g) :
 #print HasFDerivWithinAt.inner /-
 theorem HasFDerivWithinAt.inner (hf : HasFDerivWithinAt f f' s x)
     (hg : HasFDerivWithinAt g g' s x) :
-    HasFDerivWithinAt (fun t => ⟪f t, g t⟫) ((fderivInnerClm 𝕜 (f x, g x)).comp <| f'.Prod g') s
+    HasFDerivWithinAt (fun t => ⟪f t, g t⟫) ((fderivInnerCLM 𝕜 (f x, g x)).comp <| f'.Prod g') s
       x :=
   (isBoundedBilinearMap_inner.HasFDerivAt (f x, g x)).comp_hasFDerivWithinAt x (hf.Prod hg)
 #align has_fderiv_within_at.inner HasFDerivWithinAt.inner
@@ -120,14 +120,14 @@ theorem HasFDerivWithinAt.inner (hf : HasFDerivWithinAt f f' s x)
 
 #print HasStrictFDerivAt.inner /-
 theorem HasStrictFDerivAt.inner (hf : HasStrictFDerivAt f f' x) (hg : HasStrictFDerivAt g g' x) :
-    HasStrictFDerivAt (fun t => ⟪f t, g t⟫) ((fderivInnerClm 𝕜 (f x, g x)).comp <| f'.Prod g') x :=
+    HasStrictFDerivAt (fun t => ⟪f t, g t⟫) ((fderivInnerCLM 𝕜 (f x, g x)).comp <| f'.Prod g') x :=
   (isBoundedBilinearMap_inner.HasStrictFDerivAt (f x, g x)).comp x (hf.Prod hg)
 #align has_strict_fderiv_at.inner HasStrictFDerivAt.inner
 -/
 
 #print HasFDerivAt.inner /-
 theorem HasFDerivAt.inner (hf : HasFDerivAt f f' x) (hg : HasFDerivAt g g' x) :
-    HasFDerivAt (fun t => ⟪f t, g t⟫) ((fderivInnerClm 𝕜 (f x, g x)).comp <| f'.Prod g') x :=
+    HasFDerivAt (fun t => ⟪f t, g t⟫) ((fderivInnerCLM 𝕜 (f x, g x)).comp <| f'.Prod g') x :=
   (isBoundedBilinearMap_inner.HasFDerivAt (f x, g x)).comp x (hf.Prod hg)
 #align has_fderiv_at.inner HasFDerivAt.inner
 -/
Diff
@@ -3,8 +3,8 @@ Copyright (c) 2020 Yury Kudryashov. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yury Kudryashov
 -/
-import Mathbin.Analysis.InnerProductSpace.PiL2
-import Mathbin.Analysis.SpecialFunctions.Sqrt
+import Analysis.InnerProductSpace.PiL2
+import Analysis.SpecialFunctions.Sqrt
 
 #align_import analysis.inner_product_space.calculus from "leanprover-community/mathlib"@"36938f775671ff28bea1c0310f1608e4afbb22e0"
 
Diff
@@ -482,19 +482,19 @@ open Metric hiding mem_nhds_iffₓ
 
 variable {n : ℕ∞} {E : Type _} [NormedAddCommGroup E] [InnerProductSpace ℝ E]
 
-#print contDiff_homeomorphUnitBall /-
-theorem contDiff_homeomorphUnitBall : ContDiff ℝ n fun x : E => (homeomorphUnitBall x : E) :=
+#print Homeomorph.contDiff_unitBall /-
+theorem Homeomorph.contDiff_unitBall : ContDiff ℝ n fun x : E => (Homeomorph.unitBall x : E) :=
   by
   suffices ContDiff ℝ n fun x => (1 + ‖x‖ ^ 2).sqrt⁻¹ by exact this.smul contDiff_id
   have h : ∀ x : E, 0 < 1 + ‖x‖ ^ 2 := fun x => by positivity
   refine' ContDiff.inv _ fun x => real.sqrt_ne_zero'.mpr (h x)
   exact (cont_diff_const.add <| contDiff_norm_sq ℝ).sqrt fun x => (h x).Ne.symm
-#align cont_diff_homeomorph_unit_ball contDiff_homeomorphUnitBall
+#align cont_diff_homeomorph_unit_ball Homeomorph.contDiff_unitBall
 -/
 
-#print contDiffOn_homeomorphUnitBall_symm /-
-theorem contDiffOn_homeomorphUnitBall_symm {f : E → E}
-    (h : ∀ (y) (hy : y ∈ ball (0 : E) 1), f y = homeomorphUnitBall.symm ⟨y, hy⟩) :
+#print Homeomorph.contDiffOn_unitBall_symm /-
+theorem Homeomorph.contDiffOn_unitBall_symm {f : E → E}
+    (h : ∀ (y) (hy : y ∈ ball (0 : E) 1), f y = Homeomorph.unitBall.symm ⟨y, hy⟩) :
     ContDiffOn ℝ n f <| ball 0 1 := by
   intro y hy
   apply ContDiffAt.contDiffWithinAt
@@ -513,7 +513,7 @@ theorem contDiffOn_homeomorphUnitBall_symm {f : E → E}
   refine' ContDiffAt.inv _ (real.sqrt_ne_zero'.mpr h)
   refine' ContDiffAt.comp _ (cont_diff_at_sqrt h.ne.symm) _
   exact cont_diff_at_const.sub (contDiff_norm_sq ℝ).ContDiffAt
-#align cont_diff_on_homeomorph_unit_ball_symm contDiffOn_homeomorphUnitBall_symm
+#align cont_diff_on_homeomorph_unit_ball_symm Homeomorph.contDiffOn_unitBall_symm
 -/
 
 end DiffeomorphUnitBall
Diff
@@ -2,15 +2,12 @@
 Copyright (c) 2020 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.inner_product_space.calculus
-! leanprover-community/mathlib commit 36938f775671ff28bea1c0310f1608e4afbb22e0
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Analysis.InnerProductSpace.PiL2
 import Mathbin.Analysis.SpecialFunctions.Sqrt
 
+#align_import analysis.inner_product_space.calculus from "leanprover-community/mathlib"@"36938f775671ff28bea1c0310f1608e4afbb22e0"
+
 /-!
 # Calculus in inner product spaces
 
Diff
@@ -46,20 +46,23 @@ variable [NormedAddCommGroup E] [InnerProductSpace 𝕜 E]
 
 variable [NormedAddCommGroup F] [InnerProductSpace ℝ F]
 
--- mathport name: «expr⟪ , ⟫»
 local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y
 
 variable (𝕜) [NormedSpace ℝ E]
 
+#print fderivInnerClm /-
 /-- Derivative of the inner product. -/
 def fderivInnerClm (p : E × E) : E × E →L[ℝ] 𝕜 :=
   isBoundedBilinearMap_inner.deriv p
 #align fderiv_inner_clm fderivInnerClm
+-/
 
+#print fderivInnerClm_apply /-
 @[simp]
 theorem fderivInnerClm_apply (p x : E × E) : fderivInnerClm 𝕜 p x = ⟪p.1, x.2⟫ + ⟪x.1, p.2⟫ :=
   rfl
 #align fderiv_inner_clm_apply fderivInnerClm_apply
+-/
 
 #print contDiff_inner /-
 theorem contDiff_inner {n} : ContDiff ℝ n fun p : E × E => ⟪p.1, p.2⟫ :=
@@ -82,8 +85,6 @@ theorem differentiable_inner : Differentiable ℝ fun p : E × E => ⟪p.1, p.2
 variable {G : Type _} [NormedAddCommGroup G] [NormedSpace ℝ G] {f g : G → E} {f' g' : G →L[ℝ] E}
   {s : Set G} {x : G} {n : ℕ∞}
 
-include 𝕜
-
 #print ContDiffWithinAt.inner /-
 theorem ContDiffWithinAt.inner (hf : ContDiffWithinAt ℝ n f s x) (hg : ContDiffWithinAt ℝ n g s x) :
     ContDiffWithinAt ℝ n (fun x => ⟪f x, g x⟫) s x :=
@@ -134,17 +135,21 @@ theorem HasFDerivAt.inner (hf : HasFDerivAt f f' x) (hg : HasFDerivAt g g' x) :
 #align has_fderiv_at.inner HasFDerivAt.inner
 -/
 
+#print HasDerivWithinAt.inner /-
 theorem HasDerivWithinAt.inner {f g : ℝ → E} {f' g' : E} {s : Set ℝ} {x : ℝ}
     (hf : HasDerivWithinAt f f' s x) (hg : HasDerivWithinAt g g' s x) :
     HasDerivWithinAt (fun t => ⟪f t, g t⟫) (⟪f x, g'⟫ + ⟪f', g x⟫) s x := by
   simpa using (hf.has_fderiv_within_at.inner 𝕜 hg.has_fderiv_within_at).HasDerivWithinAt
 #align has_deriv_within_at.inner HasDerivWithinAt.inner
+-/
 
+#print HasDerivAt.inner /-
 theorem HasDerivAt.inner {f g : ℝ → E} {f' g' : E} {x : ℝ} :
     HasDerivAt f f' x →
       HasDerivAt g g' x → HasDerivAt (fun t => ⟪f t, g t⟫) (⟪f x, g'⟫ + ⟪f', g x⟫) x :=
   by simpa only [← hasDerivWithinAt_univ] using HasDerivWithinAt.inner 𝕜
 #align has_deriv_at.inner HasDerivAt.inner
+-/
 
 #print DifferentiableWithinAt.inner /-
 theorem DifferentiableWithinAt.inner (hf : DifferentiableWithinAt ℝ f s x)
@@ -173,85 +178,115 @@ theorem Differentiable.inner (hf : Differentiable ℝ f) (hg : Differentiable 
 #align differentiable.inner Differentiable.inner
 -/
 
+#print fderiv_inner_apply /-
 theorem fderiv_inner_apply (hf : DifferentiableAt ℝ f x) (hg : DifferentiableAt ℝ g x) (y : G) :
     fderiv ℝ (fun t => ⟪f t, g t⟫) x y = ⟪f x, fderiv ℝ g x y⟫ + ⟪fderiv ℝ f x y, g x⟫ := by
   rw [(hf.has_fderiv_at.inner 𝕜 hg.has_fderiv_at).fderiv]; rfl
 #align fderiv_inner_apply fderiv_inner_apply
+-/
 
+#print deriv_inner_apply /-
 theorem deriv_inner_apply {f g : ℝ → E} {x : ℝ} (hf : DifferentiableAt ℝ f x)
     (hg : DifferentiableAt ℝ g x) :
     deriv (fun t => ⟪f t, g t⟫) x = ⟪f x, deriv g x⟫ + ⟪deriv f x, g x⟫ :=
   (hf.HasDerivAt.inner 𝕜 hg.HasDerivAt).deriv
 #align deriv_inner_apply deriv_inner_apply
+-/
 
+#print contDiff_norm_sq /-
 theorem contDiff_norm_sq : ContDiff ℝ n fun x : E => ‖x‖ ^ 2 :=
   by
   simp only [sq, ← @inner_self_eq_norm_mul_norm 𝕜]
   exact (re_clm : 𝕜 →L[ℝ] ℝ).ContDiff.comp (cont_diff_id.inner 𝕜 contDiff_id)
 #align cont_diff_norm_sq contDiff_norm_sq
+-/
 
+#print ContDiff.norm_sq /-
 theorem ContDiff.norm_sq (hf : ContDiff ℝ n f) : ContDiff ℝ n fun x => ‖f x‖ ^ 2 :=
   (contDiff_norm_sq 𝕜).comp hf
 #align cont_diff.norm_sq ContDiff.norm_sq
+-/
 
+#print ContDiffWithinAt.norm_sq /-
 theorem ContDiffWithinAt.norm_sq (hf : ContDiffWithinAt ℝ n f s x) :
     ContDiffWithinAt ℝ n (fun y => ‖f y‖ ^ 2) s x :=
   (contDiff_norm_sq 𝕜).ContDiffAt.comp_contDiffWithinAt x hf
 #align cont_diff_within_at.norm_sq ContDiffWithinAt.norm_sq
+-/
 
+#print ContDiffAt.norm_sq /-
 theorem ContDiffAt.norm_sq (hf : ContDiffAt ℝ n f x) : ContDiffAt ℝ n (fun y => ‖f y‖ ^ 2) x :=
   hf.normSq 𝕜
 #align cont_diff_at.norm_sq ContDiffAt.norm_sq
+-/
 
+#print contDiffAt_norm /-
 theorem contDiffAt_norm {x : E} (hx : x ≠ 0) : ContDiffAt ℝ n norm x :=
   by
   have : ‖id x‖ ^ 2 ≠ 0 := pow_ne_zero _ (norm_pos_iff.2 hx).ne'
   simpa only [id, sqrt_sq, norm_nonneg] using (cont_diff_at_id.norm_sq 𝕜).sqrt this
 #align cont_diff_at_norm contDiffAt_norm
+-/
 
+#print ContDiffAt.norm /-
 theorem ContDiffAt.norm (hf : ContDiffAt ℝ n f x) (h0 : f x ≠ 0) :
     ContDiffAt ℝ n (fun y => ‖f y‖) x :=
   (contDiffAt_norm 𝕜 h0).comp x hf
 #align cont_diff_at.norm ContDiffAt.norm
+-/
 
+#print ContDiffAt.dist /-
 theorem ContDiffAt.dist (hf : ContDiffAt ℝ n f x) (hg : ContDiffAt ℝ n g x) (hne : f x ≠ g x) :
     ContDiffAt ℝ n (fun y => dist (f y) (g y)) x := by simp only [dist_eq_norm];
   exact (hf.sub hg).norm 𝕜 (sub_ne_zero.2 hne)
 #align cont_diff_at.dist ContDiffAt.dist
+-/
 
+#print ContDiffWithinAt.norm /-
 theorem ContDiffWithinAt.norm (hf : ContDiffWithinAt ℝ n f s x) (h0 : f x ≠ 0) :
     ContDiffWithinAt ℝ n (fun y => ‖f y‖) s x :=
   (contDiffAt_norm 𝕜 h0).comp_contDiffWithinAt x hf
 #align cont_diff_within_at.norm ContDiffWithinAt.norm
+-/
 
+#print ContDiffWithinAt.dist /-
 theorem ContDiffWithinAt.dist (hf : ContDiffWithinAt ℝ n f s x) (hg : ContDiffWithinAt ℝ n g s x)
     (hne : f x ≠ g x) : ContDiffWithinAt ℝ n (fun y => dist (f y) (g y)) s x := by
   simp only [dist_eq_norm]; exact (hf.sub hg).norm 𝕜 (sub_ne_zero.2 hne)
 #align cont_diff_within_at.dist ContDiffWithinAt.dist
+-/
 
+#print ContDiffOn.norm_sq /-
 theorem ContDiffOn.norm_sq (hf : ContDiffOn ℝ n f s) : ContDiffOn ℝ n (fun y => ‖f y‖ ^ 2) s :=
   fun x hx => (hf x hx).normSq 𝕜
 #align cont_diff_on.norm_sq ContDiffOn.norm_sq
+-/
 
+#print ContDiffOn.norm /-
 theorem ContDiffOn.norm (hf : ContDiffOn ℝ n f s) (h0 : ∀ x ∈ s, f x ≠ 0) :
     ContDiffOn ℝ n (fun y => ‖f y‖) s := fun x hx => (hf x hx).norm 𝕜 (h0 x hx)
 #align cont_diff_on.norm ContDiffOn.norm
+-/
 
+#print ContDiffOn.dist /-
 theorem ContDiffOn.dist (hf : ContDiffOn ℝ n f s) (hg : ContDiffOn ℝ n g s)
     (hne : ∀ x ∈ s, f x ≠ g x) : ContDiffOn ℝ n (fun y => dist (f y) (g y)) s := fun x hx =>
   (hf x hx).dist 𝕜 (hg x hx) (hne x hx)
 #align cont_diff_on.dist ContDiffOn.dist
+-/
 
+#print ContDiff.norm /-
 theorem ContDiff.norm (hf : ContDiff ℝ n f) (h0 : ∀ x, f x ≠ 0) : ContDiff ℝ n fun y => ‖f y‖ :=
   contDiff_iff_contDiffAt.2 fun x => hf.ContDiffAt.norm 𝕜 (h0 x)
 #align cont_diff.norm ContDiff.norm
+-/
 
+#print ContDiff.dist /-
 theorem ContDiff.dist (hf : ContDiff ℝ n f) (hg : ContDiff ℝ n g) (hne : ∀ x, f x ≠ g x) :
     ContDiff ℝ n fun y => dist (f y) (g y) :=
   contDiff_iff_contDiffAt.2 fun x => hf.ContDiffAt.dist 𝕜 hg.ContDiffAt (hne x)
 #align cont_diff.dist ContDiff.dist
-
-omit 𝕜
+-/
 
 theorem hasStrictFDerivAt_norm_sq (x : F) :
     HasStrictFDerivAt (fun x => ‖x‖ ^ 2) (bit0 (innerSL ℝ x)) x :=
@@ -262,64 +297,86 @@ theorem hasStrictFDerivAt_norm_sq (x : F) :
   simp [bit0, real_inner_comm]
 #align has_strict_fderiv_at_norm_sq hasStrictFDerivAt_norm_sqₓ
 
-include 𝕜
-
+#print DifferentiableAt.norm_sq /-
 theorem DifferentiableAt.norm_sq (hf : DifferentiableAt ℝ f x) :
     DifferentiableAt ℝ (fun y => ‖f y‖ ^ 2) x :=
   ((contDiffAt_id.normSq 𝕜).DifferentiableAt le_rfl).comp x hf
 #align differentiable_at.norm_sq DifferentiableAt.norm_sq
+-/
 
+#print DifferentiableAt.norm /-
 theorem DifferentiableAt.norm (hf : DifferentiableAt ℝ f x) (h0 : f x ≠ 0) :
     DifferentiableAt ℝ (fun y => ‖f y‖) x :=
   ((contDiffAt_norm 𝕜 h0).DifferentiableAt le_rfl).comp x hf
 #align differentiable_at.norm DifferentiableAt.norm
+-/
 
+#print DifferentiableAt.dist /-
 theorem DifferentiableAt.dist (hf : DifferentiableAt ℝ f x) (hg : DifferentiableAt ℝ g x)
     (hne : f x ≠ g x) : DifferentiableAt ℝ (fun y => dist (f y) (g y)) x := by
   simp only [dist_eq_norm]; exact (hf.sub hg).norm 𝕜 (sub_ne_zero.2 hne)
 #align differentiable_at.dist DifferentiableAt.dist
+-/
 
+#print Differentiable.norm_sq /-
 theorem Differentiable.norm_sq (hf : Differentiable ℝ f) : Differentiable ℝ fun y => ‖f y‖ ^ 2 :=
   fun x => (hf x).normSq 𝕜
 #align differentiable.norm_sq Differentiable.norm_sq
+-/
 
+#print Differentiable.norm /-
 theorem Differentiable.norm (hf : Differentiable ℝ f) (h0 : ∀ x, f x ≠ 0) :
     Differentiable ℝ fun y => ‖f y‖ := fun x => (hf x).norm 𝕜 (h0 x)
 #align differentiable.norm Differentiable.norm
+-/
 
+#print Differentiable.dist /-
 theorem Differentiable.dist (hf : Differentiable ℝ f) (hg : Differentiable ℝ g)
     (hne : ∀ x, f x ≠ g x) : Differentiable ℝ fun y => dist (f y) (g y) := fun x =>
   (hf x).dist 𝕜 (hg x) (hne x)
 #align differentiable.dist Differentiable.dist
+-/
 
+#print DifferentiableWithinAt.norm_sq /-
 theorem DifferentiableWithinAt.norm_sq (hf : DifferentiableWithinAt ℝ f s x) :
     DifferentiableWithinAt ℝ (fun y => ‖f y‖ ^ 2) s x :=
   ((contDiffAt_id.normSq 𝕜).DifferentiableAt le_rfl).comp_differentiableWithinAt x hf
 #align differentiable_within_at.norm_sq DifferentiableWithinAt.norm_sq
+-/
 
+#print DifferentiableWithinAt.norm /-
 theorem DifferentiableWithinAt.norm (hf : DifferentiableWithinAt ℝ f s x) (h0 : f x ≠ 0) :
     DifferentiableWithinAt ℝ (fun y => ‖f y‖) s x :=
   ((contDiffAt_id.norm 𝕜 h0).DifferentiableAt le_rfl).comp_differentiableWithinAt x hf
 #align differentiable_within_at.norm DifferentiableWithinAt.norm
+-/
 
+#print DifferentiableWithinAt.dist /-
 theorem DifferentiableWithinAt.dist (hf : DifferentiableWithinAt ℝ f s x)
     (hg : DifferentiableWithinAt ℝ g s x) (hne : f x ≠ g x) :
     DifferentiableWithinAt ℝ (fun y => dist (f y) (g y)) s x := by simp only [dist_eq_norm];
   exact (hf.sub hg).norm 𝕜 (sub_ne_zero.2 hne)
 #align differentiable_within_at.dist DifferentiableWithinAt.dist
+-/
 
+#print DifferentiableOn.norm_sq /-
 theorem DifferentiableOn.norm_sq (hf : DifferentiableOn ℝ f s) :
     DifferentiableOn ℝ (fun y => ‖f y‖ ^ 2) s := fun x hx => (hf x hx).normSq 𝕜
 #align differentiable_on.norm_sq DifferentiableOn.norm_sq
+-/
 
+#print DifferentiableOn.norm /-
 theorem DifferentiableOn.norm (hf : DifferentiableOn ℝ f s) (h0 : ∀ x ∈ s, f x ≠ 0) :
     DifferentiableOn ℝ (fun y => ‖f y‖) s := fun x hx => (hf x hx).norm 𝕜 (h0 x hx)
 #align differentiable_on.norm DifferentiableOn.norm
+-/
 
+#print DifferentiableOn.dist /-
 theorem DifferentiableOn.dist (hf : DifferentiableOn ℝ f s) (hg : DifferentiableOn ℝ g s)
     (hne : ∀ x ∈ s, f x ≠ g x) : DifferentiableOn ℝ (fun y => dist (f y) (g y)) s := fun x hx =>
   (hf x hx).dist 𝕜 (hg x hx) (hne x hx)
 #align differentiable_on.dist DifferentiableOn.dist
+-/
 
 end DerivInner
 
@@ -330,33 +387,42 @@ open ContinuousLinearMap
 variable {𝕜 ι H : Type _} [IsROrC 𝕜] [NormedAddCommGroup H] [NormedSpace 𝕜 H] [Fintype ι]
   {f : H → EuclideanSpace 𝕜 ι} {f' : H →L[𝕜] EuclideanSpace 𝕜 ι} {t : Set H} {y : H}
 
+#print differentiableWithinAt_euclidean /-
 theorem differentiableWithinAt_euclidean :
     DifferentiableWithinAt 𝕜 f t y ↔ ∀ i, DifferentiableWithinAt 𝕜 (fun x => f x i) t y :=
   by
   rw [← (EuclideanSpace.equiv ι 𝕜).comp_differentiableWithinAt_iff, differentiableWithinAt_pi]
   rfl
 #align differentiable_within_at_euclidean differentiableWithinAt_euclidean
+-/
 
+#print differentiableAt_euclidean /-
 theorem differentiableAt_euclidean :
     DifferentiableAt 𝕜 f y ↔ ∀ i, DifferentiableAt 𝕜 (fun x => f x i) y :=
   by
   rw [← (EuclideanSpace.equiv ι 𝕜).comp_differentiableAt_iff, differentiableAt_pi]
   rfl
 #align differentiable_at_euclidean differentiableAt_euclidean
+-/
 
+#print differentiableOn_euclidean /-
 theorem differentiableOn_euclidean :
     DifferentiableOn 𝕜 f t ↔ ∀ i, DifferentiableOn 𝕜 (fun x => f x i) t :=
   by
   rw [← (EuclideanSpace.equiv ι 𝕜).comp_differentiableOn_iff, differentiableOn_pi]
   rfl
 #align differentiable_on_euclidean differentiableOn_euclidean
+-/
 
+#print differentiable_euclidean /-
 theorem differentiable_euclidean : Differentiable 𝕜 f ↔ ∀ i, Differentiable 𝕜 fun x => f x i :=
   by
   rw [← (EuclideanSpace.equiv ι 𝕜).comp_differentiable_iff, differentiable_pi]
   rfl
 #align differentiable_euclidean differentiable_euclidean
+-/
 
+#print hasStrictFDerivAt_euclidean /-
 theorem hasStrictFDerivAt_euclidean :
     HasStrictFDerivAt f f' y ↔
       ∀ i, HasStrictFDerivAt (fun x => f x i) (EuclideanSpace.proj i ∘L f') y :=
@@ -364,7 +430,9 @@ theorem hasStrictFDerivAt_euclidean :
   rw [← (EuclideanSpace.equiv ι 𝕜).comp_hasStrictFDerivAt_iff, hasStrictFDerivAt_pi']
   rfl
 #align has_strict_fderiv_at_euclidean hasStrictFDerivAt_euclidean
+-/
 
+#print hasFDerivWithinAt_euclidean /-
 theorem hasFDerivWithinAt_euclidean :
     HasFDerivWithinAt f f' t y ↔
       ∀ i, HasFDerivWithinAt (fun x => f x i) (EuclideanSpace.proj i ∘L f') t y :=
@@ -372,33 +440,42 @@ theorem hasFDerivWithinAt_euclidean :
   rw [← (EuclideanSpace.equiv ι 𝕜).comp_hasFDerivWithinAt_iff, hasFDerivWithinAt_pi']
   rfl
 #align has_fderiv_within_at_euclidean hasFDerivWithinAt_euclidean
+-/
 
+#print contDiffWithinAt_euclidean /-
 theorem contDiffWithinAt_euclidean {n : ℕ∞} :
     ContDiffWithinAt 𝕜 n f t y ↔ ∀ i, ContDiffWithinAt 𝕜 n (fun x => f x i) t y :=
   by
   rw [← (EuclideanSpace.equiv ι 𝕜).comp_contDiffWithinAt_iff, contDiffWithinAt_pi]
   rfl
 #align cont_diff_within_at_euclidean contDiffWithinAt_euclidean
+-/
 
+#print contDiffAt_euclidean /-
 theorem contDiffAt_euclidean {n : ℕ∞} :
     ContDiffAt 𝕜 n f y ↔ ∀ i, ContDiffAt 𝕜 n (fun x => f x i) y :=
   by
   rw [← (EuclideanSpace.equiv ι 𝕜).comp_contDiffAt_iff, contDiffAt_pi]
   rfl
 #align cont_diff_at_euclidean contDiffAt_euclidean
+-/
 
+#print contDiffOn_euclidean /-
 theorem contDiffOn_euclidean {n : ℕ∞} :
     ContDiffOn 𝕜 n f t ↔ ∀ i, ContDiffOn 𝕜 n (fun x => f x i) t :=
   by
   rw [← (EuclideanSpace.equiv ι 𝕜).comp_contDiffOn_iff, contDiffOn_pi]
   rfl
 #align cont_diff_on_euclidean contDiffOn_euclidean
+-/
 
+#print contDiff_euclidean /-
 theorem contDiff_euclidean {n : ℕ∞} : ContDiff 𝕜 n f ↔ ∀ i, ContDiff 𝕜 n fun x => f x i :=
   by
   rw [← (EuclideanSpace.equiv ι 𝕜).comp_contDiff_iff, contDiff_pi]
   rfl
 #align cont_diff_euclidean contDiff_euclidean
+-/
 
 end PiLike
 
@@ -408,6 +485,7 @@ open Metric hiding mem_nhds_iffₓ
 
 variable {n : ℕ∞} {E : Type _} [NormedAddCommGroup E] [InnerProductSpace ℝ E]
 
+#print contDiff_homeomorphUnitBall /-
 theorem contDiff_homeomorphUnitBall : ContDiff ℝ n fun x : E => (homeomorphUnitBall x : E) :=
   by
   suffices ContDiff ℝ n fun x => (1 + ‖x‖ ^ 2).sqrt⁻¹ by exact this.smul contDiff_id
@@ -415,7 +493,9 @@ theorem contDiff_homeomorphUnitBall : ContDiff ℝ n fun x : E => (homeomorphUni
   refine' ContDiff.inv _ fun x => real.sqrt_ne_zero'.mpr (h x)
   exact (cont_diff_const.add <| contDiff_norm_sq ℝ).sqrt fun x => (h x).Ne.symm
 #align cont_diff_homeomorph_unit_ball contDiff_homeomorphUnitBall
+-/
 
+#print contDiffOn_homeomorphUnitBall_symm /-
 theorem contDiffOn_homeomorphUnitBall_symm {f : E → E}
     (h : ∀ (y) (hy : y ∈ ball (0 : E) 1), f y = homeomorphUnitBall.symm ⟨y, hy⟩) :
     ContDiffOn ℝ n f <| ball 0 1 := by
@@ -437,6 +517,7 @@ theorem contDiffOn_homeomorphUnitBall_symm {f : E → E}
   refine' ContDiffAt.comp _ (cont_diff_at_sqrt h.ne.symm) _
   exact cont_diff_at_const.sub (contDiff_norm_sq ℝ).ContDiffAt
 #align cont_diff_on_homeomorph_unit_ball_symm contDiffOn_homeomorphUnitBall_symm
+-/
 
 end DiffeomorphUnitBall
 
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.inner_product_space.calculus
-! leanprover-community/mathlib commit f9dd3204df14a0749cd456fac1e6849dfe7d2b88
+! leanprover-community/mathlib commit 36938f775671ff28bea1c0310f1608e4afbb22e0
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -14,6 +14,9 @@ import Mathbin.Analysis.SpecialFunctions.Sqrt
 /-!
 # Calculus in inner product spaces
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 In this file we prove that the inner product and square of the norm in an inner space are
 infinitely `ℝ`-smooth. In order to state these results, we need a `normed_space ℝ E`
 instance. Though we can deduce this structure from `inner_product_space 𝕜 E`, this instance may be
Diff
@@ -58,58 +58,78 @@ theorem fderivInnerClm_apply (p x : E × E) : fderivInnerClm 𝕜 p x = ⟪p.1,
   rfl
 #align fderiv_inner_clm_apply fderivInnerClm_apply
 
+#print contDiff_inner /-
 theorem contDiff_inner {n} : ContDiff ℝ n fun p : E × E => ⟪p.1, p.2⟫ :=
   isBoundedBilinearMap_inner.ContDiff
 #align cont_diff_inner contDiff_inner
+-/
 
+#print contDiffAt_inner /-
 theorem contDiffAt_inner {p : E × E} {n} : ContDiffAt ℝ n (fun p : E × E => ⟪p.1, p.2⟫) p :=
   contDiff_inner.ContDiffAt
 #align cont_diff_at_inner contDiffAt_inner
+-/
 
+#print differentiable_inner /-
 theorem differentiable_inner : Differentiable ℝ fun p : E × E => ⟪p.1, p.2⟫ :=
   isBoundedBilinearMap_inner.DifferentiableAt
 #align differentiable_inner differentiable_inner
+-/
 
 variable {G : Type _} [NormedAddCommGroup G] [NormedSpace ℝ G] {f g : G → E} {f' g' : G →L[ℝ] E}
   {s : Set G} {x : G} {n : ℕ∞}
 
 include 𝕜
 
+#print ContDiffWithinAt.inner /-
 theorem ContDiffWithinAt.inner (hf : ContDiffWithinAt ℝ n f s x) (hg : ContDiffWithinAt ℝ n g s x) :
     ContDiffWithinAt ℝ n (fun x => ⟪f x, g x⟫) s x :=
   contDiffAt_inner.comp_contDiffWithinAt x (hf.Prod hg)
 #align cont_diff_within_at.inner ContDiffWithinAt.inner
+-/
 
+#print ContDiffAt.inner /-
 theorem ContDiffAt.inner (hf : ContDiffAt ℝ n f x) (hg : ContDiffAt ℝ n g x) :
     ContDiffAt ℝ n (fun x => ⟪f x, g x⟫) x :=
   hf.inner 𝕜 hg
 #align cont_diff_at.inner ContDiffAt.inner
+-/
 
+#print ContDiffOn.inner /-
 theorem ContDiffOn.inner (hf : ContDiffOn ℝ n f s) (hg : ContDiffOn ℝ n g s) :
     ContDiffOn ℝ n (fun x => ⟪f x, g x⟫) s := fun x hx => (hf x hx).inner 𝕜 (hg x hx)
 #align cont_diff_on.inner ContDiffOn.inner
+-/
 
+#print ContDiff.inner /-
 theorem ContDiff.inner (hf : ContDiff ℝ n f) (hg : ContDiff ℝ n g) :
     ContDiff ℝ n fun x => ⟪f x, g x⟫ :=
   contDiff_inner.comp (hf.Prod hg)
 #align cont_diff.inner ContDiff.inner
+-/
 
+#print HasFDerivWithinAt.inner /-
 theorem HasFDerivWithinAt.inner (hf : HasFDerivWithinAt f f' s x)
     (hg : HasFDerivWithinAt g g' s x) :
     HasFDerivWithinAt (fun t => ⟪f t, g t⟫) ((fderivInnerClm 𝕜 (f x, g x)).comp <| f'.Prod g') s
       x :=
   (isBoundedBilinearMap_inner.HasFDerivAt (f x, g x)).comp_hasFDerivWithinAt x (hf.Prod hg)
 #align has_fderiv_within_at.inner HasFDerivWithinAt.inner
+-/
 
+#print HasStrictFDerivAt.inner /-
 theorem HasStrictFDerivAt.inner (hf : HasStrictFDerivAt f f' x) (hg : HasStrictFDerivAt g g' x) :
     HasStrictFDerivAt (fun t => ⟪f t, g t⟫) ((fderivInnerClm 𝕜 (f x, g x)).comp <| f'.Prod g') x :=
   (isBoundedBilinearMap_inner.HasStrictFDerivAt (f x, g x)).comp x (hf.Prod hg)
 #align has_strict_fderiv_at.inner HasStrictFDerivAt.inner
+-/
 
+#print HasFDerivAt.inner /-
 theorem HasFDerivAt.inner (hf : HasFDerivAt f f' x) (hg : HasFDerivAt g g' x) :
     HasFDerivAt (fun t => ⟪f t, g t⟫) ((fderivInnerClm 𝕜 (f x, g x)).comp <| f'.Prod g') x :=
   (isBoundedBilinearMap_inner.HasFDerivAt (f x, g x)).comp x (hf.Prod hg)
 #align has_fderiv_at.inner HasFDerivAt.inner
+-/
 
 theorem HasDerivWithinAt.inner {f g : ℝ → E} {f' g' : E} {s : Set ℝ} {x : ℝ}
     (hf : HasDerivWithinAt f f' s x) (hg : HasDerivWithinAt g g' s x) :
@@ -123,24 +143,32 @@ theorem HasDerivAt.inner {f g : ℝ → E} {f' g' : E} {x : ℝ} :
   by simpa only [← hasDerivWithinAt_univ] using HasDerivWithinAt.inner 𝕜
 #align has_deriv_at.inner HasDerivAt.inner
 
+#print DifferentiableWithinAt.inner /-
 theorem DifferentiableWithinAt.inner (hf : DifferentiableWithinAt ℝ f s x)
     (hg : DifferentiableWithinAt ℝ g s x) : DifferentiableWithinAt ℝ (fun x => ⟪f x, g x⟫) s x :=
   ((differentiable_inner _).HasFDerivAt.comp_hasFDerivWithinAt x
       (hf.Prod hg).HasFDerivWithinAt).DifferentiableWithinAt
 #align differentiable_within_at.inner DifferentiableWithinAt.inner
+-/
 
+#print DifferentiableAt.inner /-
 theorem DifferentiableAt.inner (hf : DifferentiableAt ℝ f x) (hg : DifferentiableAt ℝ g x) :
     DifferentiableAt ℝ (fun x => ⟪f x, g x⟫) x :=
   (differentiable_inner _).comp x (hf.Prod hg)
 #align differentiable_at.inner DifferentiableAt.inner
+-/
 
+#print DifferentiableOn.inner /-
 theorem DifferentiableOn.inner (hf : DifferentiableOn ℝ f s) (hg : DifferentiableOn ℝ g s) :
     DifferentiableOn ℝ (fun x => ⟪f x, g x⟫) s := fun x hx => (hf x hx).inner 𝕜 (hg x hx)
 #align differentiable_on.inner DifferentiableOn.inner
+-/
 
+#print Differentiable.inner /-
 theorem Differentiable.inner (hf : Differentiable ℝ f) (hg : Differentiable ℝ g) :
     Differentiable ℝ fun x => ⟪f x, g x⟫ := fun x => (hf x).inner 𝕜 (hg x)
 #align differentiable.inner Differentiable.inner
+-/
 
 theorem fderiv_inner_apply (hf : DifferentiableAt ℝ f x) (hg : DifferentiableAt ℝ g x) (y : G) :
     fderiv ℝ (fun t => ⟪f t, g t⟫) x y = ⟪f x, fderiv ℝ g x y⟫ + ⟪fderiv ℝ f x y, g x⟫ := by
@@ -229,7 +257,7 @@ theorem hasStrictFDerivAt_norm_sq (x : F) :
   convert (hasStrictFDerivAt_id x).inner ℝ (hasStrictFDerivAt_id x)
   ext y
   simp [bit0, real_inner_comm]
-#align has_strict_fderiv_at_norm_sq hasStrictFDerivAt_norm_sq
+#align has_strict_fderiv_at_norm_sq hasStrictFDerivAt_norm_sqₓ
 
 include 𝕜
 
Diff
@@ -226,7 +226,7 @@ theorem hasStrictFDerivAt_norm_sq (x : F) :
     HasStrictFDerivAt (fun x => ‖x‖ ^ 2) (bit0 (innerSL ℝ x)) x :=
   by
   simp only [sq, ← @inner_self_eq_norm_mul_norm ℝ]
-  convert(hasStrictFDerivAt_id x).inner ℝ (hasStrictFDerivAt_id x)
+  convert (hasStrictFDerivAt_id x).inner ℝ (hasStrictFDerivAt_id x)
   ext y
   simp [bit0, real_inner_comm]
 #align has_strict_fderiv_at_norm_sq hasStrictFDerivAt_norm_sq
Diff
@@ -401,7 +401,7 @@ theorem contDiffOn_homeomorphUnitBall_symm {f : E → E}
   refine' ContDiffAt.congr_of_eventuallyEq _ hf
   suffices ContDiffAt ℝ n (fun y => (1 - ‖(y : E)‖ ^ 2).sqrt⁻¹) y by exact this.smul contDiffAt_id
   have h : 0 < 1 - ‖(y : E)‖ ^ 2 := by
-    rwa [mem_ball_zero_iff, ← _root_.abs_one, ← abs_norm, ← sq_lt_sq, one_pow, ← sub_pos] at hy
+    rwa [mem_ball_zero_iff, ← _root_.abs_one, ← abs_norm, ← sq_lt_sq, one_pow, ← sub_pos] at hy 
   refine' ContDiffAt.inv _ (real.sqrt_ne_zero'.mpr h)
   refine' ContDiffAt.comp _ (cont_diff_at_sqrt h.ne.symm) _
   exact cont_diff_at_const.sub (contDiff_norm_sq ℝ).ContDiffAt
Diff
@@ -33,7 +33,7 @@ noncomputable section
 
 open IsROrC Real Filter
 
-open BigOperators Classical Topology
+open scoped BigOperators Classical Topology
 
 section DerivInner
 
Diff
@@ -143,10 +143,8 @@ theorem Differentiable.inner (hf : Differentiable ℝ f) (hg : Differentiable 
 #align differentiable.inner Differentiable.inner
 
 theorem fderiv_inner_apply (hf : DifferentiableAt ℝ f x) (hg : DifferentiableAt ℝ g x) (y : G) :
-    fderiv ℝ (fun t => ⟪f t, g t⟫) x y = ⟪f x, fderiv ℝ g x y⟫ + ⟪fderiv ℝ f x y, g x⟫ :=
-  by
-  rw [(hf.has_fderiv_at.inner 𝕜 hg.has_fderiv_at).fderiv]
-  rfl
+    fderiv ℝ (fun t => ⟪f t, g t⟫) x y = ⟪f x, fderiv ℝ g x y⟫ + ⟪fderiv ℝ f x y, g x⟫ := by
+  rw [(hf.has_fderiv_at.inner 𝕜 hg.has_fderiv_at).fderiv]; rfl
 #align fderiv_inner_apply fderiv_inner_apply
 
 theorem deriv_inner_apply {f g : ℝ → E} {x : ℝ} (hf : DifferentiableAt ℝ f x)
@@ -186,9 +184,7 @@ theorem ContDiffAt.norm (hf : ContDiffAt ℝ n f x) (h0 : f x ≠ 0) :
 #align cont_diff_at.norm ContDiffAt.norm
 
 theorem ContDiffAt.dist (hf : ContDiffAt ℝ n f x) (hg : ContDiffAt ℝ n g x) (hne : f x ≠ g x) :
-    ContDiffAt ℝ n (fun y => dist (f y) (g y)) x :=
-  by
-  simp only [dist_eq_norm]
+    ContDiffAt ℝ n (fun y => dist (f y) (g y)) x := by simp only [dist_eq_norm];
   exact (hf.sub hg).norm 𝕜 (sub_ne_zero.2 hne)
 #align cont_diff_at.dist ContDiffAt.dist
 
@@ -198,10 +194,8 @@ theorem ContDiffWithinAt.norm (hf : ContDiffWithinAt ℝ n f s x) (h0 : f x ≠
 #align cont_diff_within_at.norm ContDiffWithinAt.norm
 
 theorem ContDiffWithinAt.dist (hf : ContDiffWithinAt ℝ n f s x) (hg : ContDiffWithinAt ℝ n g s x)
-    (hne : f x ≠ g x) : ContDiffWithinAt ℝ n (fun y => dist (f y) (g y)) s x :=
-  by
-  simp only [dist_eq_norm]
-  exact (hf.sub hg).norm 𝕜 (sub_ne_zero.2 hne)
+    (hne : f x ≠ g x) : ContDiffWithinAt ℝ n (fun y => dist (f y) (g y)) s x := by
+  simp only [dist_eq_norm]; exact (hf.sub hg).norm 𝕜 (sub_ne_zero.2 hne)
 #align cont_diff_within_at.dist ContDiffWithinAt.dist
 
 theorem ContDiffOn.norm_sq (hf : ContDiffOn ℝ n f s) : ContDiffOn ℝ n (fun y => ‖f y‖ ^ 2) s :=
@@ -250,10 +244,8 @@ theorem DifferentiableAt.norm (hf : DifferentiableAt ℝ f x) (h0 : f x ≠ 0) :
 #align differentiable_at.norm DifferentiableAt.norm
 
 theorem DifferentiableAt.dist (hf : DifferentiableAt ℝ f x) (hg : DifferentiableAt ℝ g x)
-    (hne : f x ≠ g x) : DifferentiableAt ℝ (fun y => dist (f y) (g y)) x :=
-  by
-  simp only [dist_eq_norm]
-  exact (hf.sub hg).norm 𝕜 (sub_ne_zero.2 hne)
+    (hne : f x ≠ g x) : DifferentiableAt ℝ (fun y => dist (f y) (g y)) x := by
+  simp only [dist_eq_norm]; exact (hf.sub hg).norm 𝕜 (sub_ne_zero.2 hne)
 #align differentiable_at.dist DifferentiableAt.dist
 
 theorem Differentiable.norm_sq (hf : Differentiable ℝ f) : Differentiable ℝ fun y => ‖f y‖ ^ 2 :=
@@ -281,9 +273,7 @@ theorem DifferentiableWithinAt.norm (hf : DifferentiableWithinAt ℝ f s x) (h0
 
 theorem DifferentiableWithinAt.dist (hf : DifferentiableWithinAt ℝ f s x)
     (hg : DifferentiableWithinAt ℝ g s x) (hne : f x ≠ g x) :
-    DifferentiableWithinAt ℝ (fun y => dist (f y) (g y)) s x :=
-  by
-  simp only [dist_eq_norm]
+    DifferentiableWithinAt ℝ (fun y => dist (f y) (g y)) s x := by simp only [dist_eq_norm];
   exact (hf.sub hg).norm 𝕜 (sub_ne_zero.2 hne)
 #align differentiable_within_at.dist DifferentiableWithinAt.dist
 
Diff
@@ -94,22 +94,22 @@ theorem ContDiff.inner (hf : ContDiff ℝ n f) (hg : ContDiff ℝ n g) :
   contDiff_inner.comp (hf.Prod hg)
 #align cont_diff.inner ContDiff.inner
 
-theorem HasFderivWithinAt.inner (hf : HasFderivWithinAt f f' s x)
-    (hg : HasFderivWithinAt g g' s x) :
-    HasFderivWithinAt (fun t => ⟪f t, g t⟫) ((fderivInnerClm 𝕜 (f x, g x)).comp <| f'.Prod g') s
+theorem HasFDerivWithinAt.inner (hf : HasFDerivWithinAt f f' s x)
+    (hg : HasFDerivWithinAt g g' s x) :
+    HasFDerivWithinAt (fun t => ⟪f t, g t⟫) ((fderivInnerClm 𝕜 (f x, g x)).comp <| f'.Prod g') s
       x :=
-  (isBoundedBilinearMap_inner.HasFderivAt (f x, g x)).comp_hasFderivWithinAt x (hf.Prod hg)
-#align has_fderiv_within_at.inner HasFderivWithinAt.inner
+  (isBoundedBilinearMap_inner.HasFDerivAt (f x, g x)).comp_hasFDerivWithinAt x (hf.Prod hg)
+#align has_fderiv_within_at.inner HasFDerivWithinAt.inner
 
-theorem HasStrictFderivAt.inner (hf : HasStrictFderivAt f f' x) (hg : HasStrictFderivAt g g' x) :
-    HasStrictFderivAt (fun t => ⟪f t, g t⟫) ((fderivInnerClm 𝕜 (f x, g x)).comp <| f'.Prod g') x :=
-  (isBoundedBilinearMap_inner.HasStrictFderivAt (f x, g x)).comp x (hf.Prod hg)
-#align has_strict_fderiv_at.inner HasStrictFderivAt.inner
+theorem HasStrictFDerivAt.inner (hf : HasStrictFDerivAt f f' x) (hg : HasStrictFDerivAt g g' x) :
+    HasStrictFDerivAt (fun t => ⟪f t, g t⟫) ((fderivInnerClm 𝕜 (f x, g x)).comp <| f'.Prod g') x :=
+  (isBoundedBilinearMap_inner.HasStrictFDerivAt (f x, g x)).comp x (hf.Prod hg)
+#align has_strict_fderiv_at.inner HasStrictFDerivAt.inner
 
-theorem HasFderivAt.inner (hf : HasFderivAt f f' x) (hg : HasFderivAt g g' x) :
-    HasFderivAt (fun t => ⟪f t, g t⟫) ((fderivInnerClm 𝕜 (f x, g x)).comp <| f'.Prod g') x :=
-  (isBoundedBilinearMap_inner.HasFderivAt (f x, g x)).comp x (hf.Prod hg)
-#align has_fderiv_at.inner HasFderivAt.inner
+theorem HasFDerivAt.inner (hf : HasFDerivAt f f' x) (hg : HasFDerivAt g g' x) :
+    HasFDerivAt (fun t => ⟪f t, g t⟫) ((fderivInnerClm 𝕜 (f x, g x)).comp <| f'.Prod g') x :=
+  (isBoundedBilinearMap_inner.HasFDerivAt (f x, g x)).comp x (hf.Prod hg)
+#align has_fderiv_at.inner HasFDerivAt.inner
 
 theorem HasDerivWithinAt.inner {f g : ℝ → E} {f' g' : E} {s : Set ℝ} {x : ℝ}
     (hf : HasDerivWithinAt f f' s x) (hg : HasDerivWithinAt g g' s x) :
@@ -125,8 +125,8 @@ theorem HasDerivAt.inner {f g : ℝ → E} {f' g' : E} {x : ℝ} :
 
 theorem DifferentiableWithinAt.inner (hf : DifferentiableWithinAt ℝ f s x)
     (hg : DifferentiableWithinAt ℝ g s x) : DifferentiableWithinAt ℝ (fun x => ⟪f x, g x⟫) s x :=
-  ((differentiable_inner _).HasFderivAt.comp_hasFderivWithinAt x
-      (hf.Prod hg).HasFderivWithinAt).DifferentiableWithinAt
+  ((differentiable_inner _).HasFDerivAt.comp_hasFDerivWithinAt x
+      (hf.Prod hg).HasFDerivWithinAt).DifferentiableWithinAt
 #align differentiable_within_at.inner DifferentiableWithinAt.inner
 
 theorem DifferentiableAt.inner (hf : DifferentiableAt ℝ f x) (hg : DifferentiableAt ℝ g x) :
@@ -228,14 +228,14 @@ theorem ContDiff.dist (hf : ContDiff ℝ n f) (hg : ContDiff ℝ n g) (hne : ∀
 
 omit 𝕜
 
-theorem hasStrictFderivAt_norm_sq (x : F) :
-    HasStrictFderivAt (fun x => ‖x‖ ^ 2) (bit0 (innerSL ℝ x)) x :=
+theorem hasStrictFDerivAt_norm_sq (x : F) :
+    HasStrictFDerivAt (fun x => ‖x‖ ^ 2) (bit0 (innerSL ℝ x)) x :=
   by
   simp only [sq, ← @inner_self_eq_norm_mul_norm ℝ]
-  convert(hasStrictFderivAt_id x).inner ℝ (hasStrictFderivAt_id x)
+  convert(hasStrictFDerivAt_id x).inner ℝ (hasStrictFDerivAt_id x)
   ext y
   simp [bit0, real_inner_comm]
-#align has_strict_fderiv_at_norm_sq hasStrictFderivAt_norm_sq
+#align has_strict_fderiv_at_norm_sq hasStrictFDerivAt_norm_sq
 
 include 𝕜
 
@@ -336,21 +336,21 @@ theorem differentiable_euclidean : Differentiable 𝕜 f ↔ ∀ i, Differentiab
   rfl
 #align differentiable_euclidean differentiable_euclidean
 
-theorem hasStrictFderivAt_euclidean :
-    HasStrictFderivAt f f' y ↔
-      ∀ i, HasStrictFderivAt (fun x => f x i) (EuclideanSpace.proj i ∘L f') y :=
+theorem hasStrictFDerivAt_euclidean :
+    HasStrictFDerivAt f f' y ↔
+      ∀ i, HasStrictFDerivAt (fun x => f x i) (EuclideanSpace.proj i ∘L f') y :=
   by
-  rw [← (EuclideanSpace.equiv ι 𝕜).comp_hasStrictFderivAt_iff, hasStrictFderivAt_pi']
+  rw [← (EuclideanSpace.equiv ι 𝕜).comp_hasStrictFDerivAt_iff, hasStrictFDerivAt_pi']
   rfl
-#align has_strict_fderiv_at_euclidean hasStrictFderivAt_euclidean
+#align has_strict_fderiv_at_euclidean hasStrictFDerivAt_euclidean
 
-theorem hasFderivWithinAt_euclidean :
-    HasFderivWithinAt f f' t y ↔
-      ∀ i, HasFderivWithinAt (fun x => f x i) (EuclideanSpace.proj i ∘L f') t y :=
+theorem hasFDerivWithinAt_euclidean :
+    HasFDerivWithinAt f f' t y ↔
+      ∀ i, HasFDerivWithinAt (fun x => f x i) (EuclideanSpace.proj i ∘L f') t y :=
   by
-  rw [← (EuclideanSpace.equiv ι 𝕜).comp_hasFderivWithinAt_iff, hasFderivWithinAt_pi']
+  rw [← (EuclideanSpace.equiv ι 𝕜).comp_hasFDerivWithinAt_iff, hasFDerivWithinAt_pi']
   rfl
-#align has_fderiv_within_at_euclidean hasFderivWithinAt_euclidean
+#align has_fderiv_within_at_euclidean hasFDerivWithinAt_euclidean
 
 theorem contDiffWithinAt_euclidean {n : ℕ∞} :
     ContDiffWithinAt 𝕜 n f t y ↔ ∀ i, ContDiffWithinAt 𝕜 n (fun x => f x i) t y :=
Diff
@@ -50,7 +50,7 @@ variable (𝕜) [NormedSpace ℝ E]
 
 /-- Derivative of the inner product. -/
 def fderivInnerClm (p : E × E) : E × E →L[ℝ] 𝕜 :=
-  isBoundedBilinearMapInner.deriv p
+  isBoundedBilinearMap_inner.deriv p
 #align fderiv_inner_clm fderivInnerClm
 
 @[simp]
@@ -59,7 +59,7 @@ theorem fderivInnerClm_apply (p x : E × E) : fderivInnerClm 𝕜 p x = ⟪p.1,
 #align fderiv_inner_clm_apply fderivInnerClm_apply
 
 theorem contDiff_inner {n} : ContDiff ℝ n fun p : E × E => ⟪p.1, p.2⟫ :=
-  isBoundedBilinearMapInner.ContDiff
+  isBoundedBilinearMap_inner.ContDiff
 #align cont_diff_inner contDiff_inner
 
 theorem contDiffAt_inner {p : E × E} {n} : ContDiffAt ℝ n (fun p : E × E => ⟪p.1, p.2⟫) p :=
@@ -67,7 +67,7 @@ theorem contDiffAt_inner {p : E × E} {n} : ContDiffAt ℝ n (fun p : E × E =>
 #align cont_diff_at_inner contDiffAt_inner
 
 theorem differentiable_inner : Differentiable ℝ fun p : E × E => ⟪p.1, p.2⟫ :=
-  isBoundedBilinearMapInner.DifferentiableAt
+  isBoundedBilinearMap_inner.DifferentiableAt
 #align differentiable_inner differentiable_inner
 
 variable {G : Type _} [NormedAddCommGroup G] [NormedSpace ℝ G] {f g : G → E} {f' g' : G →L[ℝ] E}
@@ -98,17 +98,17 @@ theorem HasFderivWithinAt.inner (hf : HasFderivWithinAt f f' s x)
     (hg : HasFderivWithinAt g g' s x) :
     HasFderivWithinAt (fun t => ⟪f t, g t⟫) ((fderivInnerClm 𝕜 (f x, g x)).comp <| f'.Prod g') s
       x :=
-  (isBoundedBilinearMapInner.HasFderivAt (f x, g x)).comp_hasFderivWithinAt x (hf.Prod hg)
+  (isBoundedBilinearMap_inner.HasFderivAt (f x, g x)).comp_hasFderivWithinAt x (hf.Prod hg)
 #align has_fderiv_within_at.inner HasFderivWithinAt.inner
 
 theorem HasStrictFderivAt.inner (hf : HasStrictFderivAt f f' x) (hg : HasStrictFderivAt g g' x) :
     HasStrictFderivAt (fun t => ⟪f t, g t⟫) ((fderivInnerClm 𝕜 (f x, g x)).comp <| f'.Prod g') x :=
-  (isBoundedBilinearMapInner.HasStrictFderivAt (f x, g x)).comp x (hf.Prod hg)
+  (isBoundedBilinearMap_inner.HasStrictFderivAt (f x, g x)).comp x (hf.Prod hg)
 #align has_strict_fderiv_at.inner HasStrictFderivAt.inner
 
 theorem HasFderivAt.inner (hf : HasFderivAt f f' x) (hg : HasFderivAt g g' x) :
     HasFderivAt (fun t => ⟪f t, g t⟫) ((fderivInnerClm 𝕜 (f x, g x)).comp <| f'.Prod g') x :=
-  (isBoundedBilinearMapInner.HasFderivAt (f x, g x)).comp x (hf.Prod hg)
+  (isBoundedBilinearMap_inner.HasFderivAt (f x, g x)).comp x (hf.Prod hg)
 #align has_fderiv_at.inner HasFderivAt.inner
 
 theorem HasDerivWithinAt.inner {f g : ℝ → E} {f' g' : E} {s : Set ℝ} {x : ℝ}
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.inner_product_space.calculus
-! leanprover-community/mathlib commit 46b633fd842bef9469441c0209906f6dddd2b4f5
+! leanprover-community/mathlib commit f9dd3204df14a0749cd456fac1e6849dfe7d2b88
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -411,8 +411,7 @@ theorem contDiffOn_homeomorphUnitBall_symm {f : E → E}
   refine' ContDiffAt.congr_of_eventuallyEq _ hf
   suffices ContDiffAt ℝ n (fun y => (1 - ‖(y : E)‖ ^ 2).sqrt⁻¹) y by exact this.smul contDiffAt_id
   have h : 0 < 1 - ‖(y : E)‖ ^ 2 := by
-    rwa [mem_ball_zero_iff, ← _root_.abs_one, ← abs_norm_eq_norm, ← sq_lt_sq, one_pow, ← sub_pos] at
-      hy
+    rwa [mem_ball_zero_iff, ← _root_.abs_one, ← abs_norm, ← sq_lt_sq, one_pow, ← sub_pos] at hy
   refine' ContDiffAt.inv _ (real.sqrt_ne_zero'.mpr h)
   refine' ContDiffAt.comp _ (cont_diff_at_sqrt h.ne.symm) _
   exact cont_diff_at_const.sub (contDiff_norm_sq ℝ).ContDiffAt
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.inner_product_space.calculus
-! leanprover-community/mathlib commit c78cad350eb321c81e1eacf68d14e3d3ba1e17f7
+! leanprover-community/mathlib commit 46b633fd842bef9469441c0209906f6dddd2b4f5
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -39,12 +39,14 @@ section DerivInner
 
 variable {𝕜 E F : Type _} [IsROrC 𝕜]
 
-variable [InnerProductSpace 𝕜 E] [InnerProductSpace ℝ F]
+variable [NormedAddCommGroup E] [InnerProductSpace 𝕜 E]
+
+variable [NormedAddCommGroup F] [InnerProductSpace ℝ F]
 
 -- mathport name: «expr⟪ , ⟫»
 local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y
 
-variable [NormedSpace ℝ E]
+variable (𝕜) [NormedSpace ℝ E]
 
 /-- Derivative of the inner product. -/
 def fderivInnerClm (p : E × E) : E × E →L[ℝ] 𝕜 :=
@@ -52,7 +54,7 @@ def fderivInnerClm (p : E × E) : E × E →L[ℝ] 𝕜 :=
 #align fderiv_inner_clm fderivInnerClm
 
 @[simp]
-theorem fderivInnerClm_apply (p x : E × E) : fderivInnerClm p x = ⟪p.1, x.2⟫ + ⟪x.1, p.2⟫ :=
+theorem fderivInnerClm_apply (p x : E × E) : fderivInnerClm 𝕜 p x = ⟪p.1, x.2⟫ + ⟪x.1, p.2⟫ :=
   rfl
 #align fderiv_inner_clm_apply fderivInnerClm_apply
 
@@ -80,11 +82,11 @@ theorem ContDiffWithinAt.inner (hf : ContDiffWithinAt ℝ n f s x) (hg : ContDif
 
 theorem ContDiffAt.inner (hf : ContDiffAt ℝ n f x) (hg : ContDiffAt ℝ n g x) :
     ContDiffAt ℝ n (fun x => ⟪f x, g x⟫) x :=
-  hf.inner hg
+  hf.inner 𝕜 hg
 #align cont_diff_at.inner ContDiffAt.inner
 
 theorem ContDiffOn.inner (hf : ContDiffOn ℝ n f s) (hg : ContDiffOn ℝ n g s) :
-    ContDiffOn ℝ n (fun x => ⟪f x, g x⟫) s := fun x hx => (hf x hx).inner (hg x hx)
+    ContDiffOn ℝ n (fun x => ⟪f x, g x⟫) s := fun x hx => (hf x hx).inner 𝕜 (hg x hx)
 #align cont_diff_on.inner ContDiffOn.inner
 
 theorem ContDiff.inner (hf : ContDiff ℝ n f) (hg : ContDiff ℝ n g) :
@@ -94,30 +96,31 @@ theorem ContDiff.inner (hf : ContDiff ℝ n f) (hg : ContDiff ℝ n g) :
 
 theorem HasFderivWithinAt.inner (hf : HasFderivWithinAt f f' s x)
     (hg : HasFderivWithinAt g g' s x) :
-    HasFderivWithinAt (fun t => ⟪f t, g t⟫) ((fderivInnerClm (f x, g x)).comp <| f'.Prod g') s x :=
+    HasFderivWithinAt (fun t => ⟪f t, g t⟫) ((fderivInnerClm 𝕜 (f x, g x)).comp <| f'.Prod g') s
+      x :=
   (isBoundedBilinearMapInner.HasFderivAt (f x, g x)).comp_hasFderivWithinAt x (hf.Prod hg)
 #align has_fderiv_within_at.inner HasFderivWithinAt.inner
 
 theorem HasStrictFderivAt.inner (hf : HasStrictFderivAt f f' x) (hg : HasStrictFderivAt g g' x) :
-    HasStrictFderivAt (fun t => ⟪f t, g t⟫) ((fderivInnerClm (f x, g x)).comp <| f'.Prod g') x :=
+    HasStrictFderivAt (fun t => ⟪f t, g t⟫) ((fderivInnerClm 𝕜 (f x, g x)).comp <| f'.Prod g') x :=
   (isBoundedBilinearMapInner.HasStrictFderivAt (f x, g x)).comp x (hf.Prod hg)
 #align has_strict_fderiv_at.inner HasStrictFderivAt.inner
 
 theorem HasFderivAt.inner (hf : HasFderivAt f f' x) (hg : HasFderivAt g g' x) :
-    HasFderivAt (fun t => ⟪f t, g t⟫) ((fderivInnerClm (f x, g x)).comp <| f'.Prod g') x :=
+    HasFderivAt (fun t => ⟪f t, g t⟫) ((fderivInnerClm 𝕜 (f x, g x)).comp <| f'.Prod g') x :=
   (isBoundedBilinearMapInner.HasFderivAt (f x, g x)).comp x (hf.Prod hg)
 #align has_fderiv_at.inner HasFderivAt.inner
 
 theorem HasDerivWithinAt.inner {f g : ℝ → E} {f' g' : E} {s : Set ℝ} {x : ℝ}
     (hf : HasDerivWithinAt f f' s x) (hg : HasDerivWithinAt g g' s x) :
     HasDerivWithinAt (fun t => ⟪f t, g t⟫) (⟪f x, g'⟫ + ⟪f', g x⟫) s x := by
-  simpa using (hf.has_fderiv_within_at.inner hg.has_fderiv_within_at).HasDerivWithinAt
+  simpa using (hf.has_fderiv_within_at.inner 𝕜 hg.has_fderiv_within_at).HasDerivWithinAt
 #align has_deriv_within_at.inner HasDerivWithinAt.inner
 
 theorem HasDerivAt.inner {f g : ℝ → E} {f' g' : E} {x : ℝ} :
     HasDerivAt f f' x →
       HasDerivAt g g' x → HasDerivAt (fun t => ⟪f t, g t⟫) (⟪f x, g'⟫ + ⟪f', g x⟫) x :=
-  by simpa only [← hasDerivWithinAt_univ] using HasDerivWithinAt.inner
+  by simpa only [← hasDerivWithinAt_univ] using HasDerivWithinAt.inner 𝕜
 #align has_deriv_at.inner HasDerivAt.inner
 
 theorem DifferentiableWithinAt.inner (hf : DifferentiableWithinAt ℝ f s x)
@@ -132,95 +135,95 @@ theorem DifferentiableAt.inner (hf : DifferentiableAt ℝ f x) (hg : Differentia
 #align differentiable_at.inner DifferentiableAt.inner
 
 theorem DifferentiableOn.inner (hf : DifferentiableOn ℝ f s) (hg : DifferentiableOn ℝ g s) :
-    DifferentiableOn ℝ (fun x => ⟪f x, g x⟫) s := fun x hx => (hf x hx).inner (hg x hx)
+    DifferentiableOn ℝ (fun x => ⟪f x, g x⟫) s := fun x hx => (hf x hx).inner 𝕜 (hg x hx)
 #align differentiable_on.inner DifferentiableOn.inner
 
 theorem Differentiable.inner (hf : Differentiable ℝ f) (hg : Differentiable ℝ g) :
-    Differentiable ℝ fun x => ⟪f x, g x⟫ := fun x => (hf x).inner (hg x)
+    Differentiable ℝ fun x => ⟪f x, g x⟫ := fun x => (hf x).inner 𝕜 (hg x)
 #align differentiable.inner Differentiable.inner
 
 theorem fderiv_inner_apply (hf : DifferentiableAt ℝ f x) (hg : DifferentiableAt ℝ g x) (y : G) :
     fderiv ℝ (fun t => ⟪f t, g t⟫) x y = ⟪f x, fderiv ℝ g x y⟫ + ⟪fderiv ℝ f x y, g x⟫ :=
   by
-  rw [(hf.has_fderiv_at.inner hg.has_fderiv_at).fderiv]
+  rw [(hf.has_fderiv_at.inner 𝕜 hg.has_fderiv_at).fderiv]
   rfl
 #align fderiv_inner_apply fderiv_inner_apply
 
 theorem deriv_inner_apply {f g : ℝ → E} {x : ℝ} (hf : DifferentiableAt ℝ f x)
     (hg : DifferentiableAt ℝ g x) :
     deriv (fun t => ⟪f t, g t⟫) x = ⟪f x, deriv g x⟫ + ⟪deriv f x, g x⟫ :=
-  (hf.HasDerivAt.inner hg.HasDerivAt).deriv
+  (hf.HasDerivAt.inner 𝕜 hg.HasDerivAt).deriv
 #align deriv_inner_apply deriv_inner_apply
 
 theorem contDiff_norm_sq : ContDiff ℝ n fun x : E => ‖x‖ ^ 2 :=
   by
-  simp only [sq, ← inner_self_eq_norm_mul_norm]
-  exact (re_clm : 𝕜 →L[ℝ] ℝ).ContDiff.comp (cont_diff_id.inner contDiff_id)
+  simp only [sq, ← @inner_self_eq_norm_mul_norm 𝕜]
+  exact (re_clm : 𝕜 →L[ℝ] ℝ).ContDiff.comp (cont_diff_id.inner 𝕜 contDiff_id)
 #align cont_diff_norm_sq contDiff_norm_sq
 
 theorem ContDiff.norm_sq (hf : ContDiff ℝ n f) : ContDiff ℝ n fun x => ‖f x‖ ^ 2 :=
-  contDiff_norm_sq.comp hf
+  (contDiff_norm_sq 𝕜).comp hf
 #align cont_diff.norm_sq ContDiff.norm_sq
 
 theorem ContDiffWithinAt.norm_sq (hf : ContDiffWithinAt ℝ n f s x) :
     ContDiffWithinAt ℝ n (fun y => ‖f y‖ ^ 2) s x :=
-  contDiff_norm_sq.ContDiffAt.comp_contDiffWithinAt x hf
+  (contDiff_norm_sq 𝕜).ContDiffAt.comp_contDiffWithinAt x hf
 #align cont_diff_within_at.norm_sq ContDiffWithinAt.norm_sq
 
 theorem ContDiffAt.norm_sq (hf : ContDiffAt ℝ n f x) : ContDiffAt ℝ n (fun y => ‖f y‖ ^ 2) x :=
-  hf.normSq
+  hf.normSq 𝕜
 #align cont_diff_at.norm_sq ContDiffAt.norm_sq
 
 theorem contDiffAt_norm {x : E} (hx : x ≠ 0) : ContDiffAt ℝ n norm x :=
   by
   have : ‖id x‖ ^ 2 ≠ 0 := pow_ne_zero _ (norm_pos_iff.2 hx).ne'
-  simpa only [id, sqrt_sq, norm_nonneg] using cont_diff_at_id.norm_sq.sqrt this
+  simpa only [id, sqrt_sq, norm_nonneg] using (cont_diff_at_id.norm_sq 𝕜).sqrt this
 #align cont_diff_at_norm contDiffAt_norm
 
 theorem ContDiffAt.norm (hf : ContDiffAt ℝ n f x) (h0 : f x ≠ 0) :
     ContDiffAt ℝ n (fun y => ‖f y‖) x :=
-  (contDiffAt_norm h0).comp x hf
+  (contDiffAt_norm 𝕜 h0).comp x hf
 #align cont_diff_at.norm ContDiffAt.norm
 
 theorem ContDiffAt.dist (hf : ContDiffAt ℝ n f x) (hg : ContDiffAt ℝ n g x) (hne : f x ≠ g x) :
     ContDiffAt ℝ n (fun y => dist (f y) (g y)) x :=
   by
   simp only [dist_eq_norm]
-  exact (hf.sub hg).norm (sub_ne_zero.2 hne)
+  exact (hf.sub hg).norm 𝕜 (sub_ne_zero.2 hne)
 #align cont_diff_at.dist ContDiffAt.dist
 
 theorem ContDiffWithinAt.norm (hf : ContDiffWithinAt ℝ n f s x) (h0 : f x ≠ 0) :
     ContDiffWithinAt ℝ n (fun y => ‖f y‖) s x :=
-  (contDiffAt_norm h0).comp_contDiffWithinAt x hf
+  (contDiffAt_norm 𝕜 h0).comp_contDiffWithinAt x hf
 #align cont_diff_within_at.norm ContDiffWithinAt.norm
 
 theorem ContDiffWithinAt.dist (hf : ContDiffWithinAt ℝ n f s x) (hg : ContDiffWithinAt ℝ n g s x)
     (hne : f x ≠ g x) : ContDiffWithinAt ℝ n (fun y => dist (f y) (g y)) s x :=
   by
   simp only [dist_eq_norm]
-  exact (hf.sub hg).norm (sub_ne_zero.2 hne)
+  exact (hf.sub hg).norm 𝕜 (sub_ne_zero.2 hne)
 #align cont_diff_within_at.dist ContDiffWithinAt.dist
 
 theorem ContDiffOn.norm_sq (hf : ContDiffOn ℝ n f s) : ContDiffOn ℝ n (fun y => ‖f y‖ ^ 2) s :=
-  fun x hx => (hf x hx).normSq
+  fun x hx => (hf x hx).normSq 𝕜
 #align cont_diff_on.norm_sq ContDiffOn.norm_sq
 
 theorem ContDiffOn.norm (hf : ContDiffOn ℝ n f s) (h0 : ∀ x ∈ s, f x ≠ 0) :
-    ContDiffOn ℝ n (fun y => ‖f y‖) s := fun x hx => (hf x hx).norm (h0 x hx)
+    ContDiffOn ℝ n (fun y => ‖f y‖) s := fun x hx => (hf x hx).norm 𝕜 (h0 x hx)
 #align cont_diff_on.norm ContDiffOn.norm
 
 theorem ContDiffOn.dist (hf : ContDiffOn ℝ n f s) (hg : ContDiffOn ℝ n g s)
     (hne : ∀ x ∈ s, f x ≠ g x) : ContDiffOn ℝ n (fun y => dist (f y) (g y)) s := fun x hx =>
-  (hf x hx).dist (hg x hx) (hne x hx)
+  (hf x hx).dist 𝕜 (hg x hx) (hne x hx)
 #align cont_diff_on.dist ContDiffOn.dist
 
 theorem ContDiff.norm (hf : ContDiff ℝ n f) (h0 : ∀ x, f x ≠ 0) : ContDiff ℝ n fun y => ‖f y‖ :=
-  contDiff_iff_contDiffAt.2 fun x => hf.ContDiffAt.norm (h0 x)
+  contDiff_iff_contDiffAt.2 fun x => hf.ContDiffAt.norm 𝕜 (h0 x)
 #align cont_diff.norm ContDiff.norm
 
 theorem ContDiff.dist (hf : ContDiff ℝ n f) (hg : ContDiff ℝ n g) (hne : ∀ x, f x ≠ g x) :
     ContDiff ℝ n fun y => dist (f y) (g y) :=
-  contDiff_iff_contDiffAt.2 fun x => hf.ContDiffAt.dist hg.ContDiffAt (hne x)
+  contDiff_iff_contDiffAt.2 fun x => hf.ContDiffAt.dist 𝕜 hg.ContDiffAt (hne x)
 #align cont_diff.dist ContDiff.dist
 
 omit 𝕜
@@ -228,8 +231,8 @@ omit 𝕜
 theorem hasStrictFderivAt_norm_sq (x : F) :
     HasStrictFderivAt (fun x => ‖x‖ ^ 2) (bit0 (innerSL ℝ x)) x :=
   by
-  simp only [sq, ← inner_self_eq_norm_mul_norm]
-  convert(hasStrictFderivAt_id x).inner (hasStrictFderivAt_id x)
+  simp only [sq, ← @inner_self_eq_norm_mul_norm ℝ]
+  convert(hasStrictFderivAt_id x).inner ℝ (hasStrictFderivAt_id x)
   ext y
   simp [bit0, real_inner_comm]
 #align has_strict_fderiv_at_norm_sq hasStrictFderivAt_norm_sq
@@ -238,42 +241,42 @@ include 𝕜
 
 theorem DifferentiableAt.norm_sq (hf : DifferentiableAt ℝ f x) :
     DifferentiableAt ℝ (fun y => ‖f y‖ ^ 2) x :=
-  (contDiffAt_id.normSq.DifferentiableAt le_rfl).comp x hf
+  ((contDiffAt_id.normSq 𝕜).DifferentiableAt le_rfl).comp x hf
 #align differentiable_at.norm_sq DifferentiableAt.norm_sq
 
 theorem DifferentiableAt.norm (hf : DifferentiableAt ℝ f x) (h0 : f x ≠ 0) :
     DifferentiableAt ℝ (fun y => ‖f y‖) x :=
-  ((contDiffAt_norm h0).DifferentiableAt le_rfl).comp x hf
+  ((contDiffAt_norm 𝕜 h0).DifferentiableAt le_rfl).comp x hf
 #align differentiable_at.norm DifferentiableAt.norm
 
 theorem DifferentiableAt.dist (hf : DifferentiableAt ℝ f x) (hg : DifferentiableAt ℝ g x)
     (hne : f x ≠ g x) : DifferentiableAt ℝ (fun y => dist (f y) (g y)) x :=
   by
   simp only [dist_eq_norm]
-  exact (hf.sub hg).norm (sub_ne_zero.2 hne)
+  exact (hf.sub hg).norm 𝕜 (sub_ne_zero.2 hne)
 #align differentiable_at.dist DifferentiableAt.dist
 
 theorem Differentiable.norm_sq (hf : Differentiable ℝ f) : Differentiable ℝ fun y => ‖f y‖ ^ 2 :=
-  fun x => (hf x).normSq
+  fun x => (hf x).normSq 𝕜
 #align differentiable.norm_sq Differentiable.norm_sq
 
 theorem Differentiable.norm (hf : Differentiable ℝ f) (h0 : ∀ x, f x ≠ 0) :
-    Differentiable ℝ fun y => ‖f y‖ := fun x => (hf x).norm (h0 x)
+    Differentiable ℝ fun y => ‖f y‖ := fun x => (hf x).norm 𝕜 (h0 x)
 #align differentiable.norm Differentiable.norm
 
 theorem Differentiable.dist (hf : Differentiable ℝ f) (hg : Differentiable ℝ g)
     (hne : ∀ x, f x ≠ g x) : Differentiable ℝ fun y => dist (f y) (g y) := fun x =>
-  (hf x).dist (hg x) (hne x)
+  (hf x).dist 𝕜 (hg x) (hne x)
 #align differentiable.dist Differentiable.dist
 
 theorem DifferentiableWithinAt.norm_sq (hf : DifferentiableWithinAt ℝ f s x) :
     DifferentiableWithinAt ℝ (fun y => ‖f y‖ ^ 2) s x :=
-  (contDiffAt_id.normSq.DifferentiableAt le_rfl).comp_differentiableWithinAt x hf
+  ((contDiffAt_id.normSq 𝕜).DifferentiableAt le_rfl).comp_differentiableWithinAt x hf
 #align differentiable_within_at.norm_sq DifferentiableWithinAt.norm_sq
 
 theorem DifferentiableWithinAt.norm (hf : DifferentiableWithinAt ℝ f s x) (h0 : f x ≠ 0) :
     DifferentiableWithinAt ℝ (fun y => ‖f y‖) s x :=
-  ((contDiffAt_id.norm h0).DifferentiableAt le_rfl).comp_differentiableWithinAt x hf
+  ((contDiffAt_id.norm 𝕜 h0).DifferentiableAt le_rfl).comp_differentiableWithinAt x hf
 #align differentiable_within_at.norm DifferentiableWithinAt.norm
 
 theorem DifferentiableWithinAt.dist (hf : DifferentiableWithinAt ℝ f s x)
@@ -281,20 +284,20 @@ theorem DifferentiableWithinAt.dist (hf : DifferentiableWithinAt ℝ f s x)
     DifferentiableWithinAt ℝ (fun y => dist (f y) (g y)) s x :=
   by
   simp only [dist_eq_norm]
-  exact (hf.sub hg).norm (sub_ne_zero.2 hne)
+  exact (hf.sub hg).norm 𝕜 (sub_ne_zero.2 hne)
 #align differentiable_within_at.dist DifferentiableWithinAt.dist
 
 theorem DifferentiableOn.norm_sq (hf : DifferentiableOn ℝ f s) :
-    DifferentiableOn ℝ (fun y => ‖f y‖ ^ 2) s := fun x hx => (hf x hx).normSq
+    DifferentiableOn ℝ (fun y => ‖f y‖ ^ 2) s := fun x hx => (hf x hx).normSq 𝕜
 #align differentiable_on.norm_sq DifferentiableOn.norm_sq
 
 theorem DifferentiableOn.norm (hf : DifferentiableOn ℝ f s) (h0 : ∀ x ∈ s, f x ≠ 0) :
-    DifferentiableOn ℝ (fun y => ‖f y‖) s := fun x hx => (hf x hx).norm (h0 x hx)
+    DifferentiableOn ℝ (fun y => ‖f y‖) s := fun x hx => (hf x hx).norm 𝕜 (h0 x hx)
 #align differentiable_on.norm DifferentiableOn.norm
 
 theorem DifferentiableOn.dist (hf : DifferentiableOn ℝ f s) (hg : DifferentiableOn ℝ g s)
     (hne : ∀ x ∈ s, f x ≠ g x) : DifferentiableOn ℝ (fun y => dist (f y) (g y)) s := fun x hx =>
-  (hf x hx).dist (hg x hx) (hne x hx)
+  (hf x hx).dist 𝕜 (hg x hx) (hne x hx)
 #align differentiable_on.dist DifferentiableOn.dist
 
 end DerivInner
@@ -382,14 +385,14 @@ section DiffeomorphUnitBall
 
 open Metric hiding mem_nhds_iffₓ
 
-variable {n : ℕ∞} {E : Type _} [InnerProductSpace ℝ E]
+variable {n : ℕ∞} {E : Type _} [NormedAddCommGroup E] [InnerProductSpace ℝ E]
 
 theorem contDiff_homeomorphUnitBall : ContDiff ℝ n fun x : E => (homeomorphUnitBall x : E) :=
   by
   suffices ContDiff ℝ n fun x => (1 + ‖x‖ ^ 2).sqrt⁻¹ by exact this.smul contDiff_id
   have h : ∀ x : E, 0 < 1 + ‖x‖ ^ 2 := fun x => by positivity
   refine' ContDiff.inv _ fun x => real.sqrt_ne_zero'.mpr (h x)
-  exact (cont_diff_const.add contDiff_norm_sq).sqrt fun x => (h x).Ne.symm
+  exact (cont_diff_const.add <| contDiff_norm_sq ℝ).sqrt fun x => (h x).Ne.symm
 #align cont_diff_homeomorph_unit_ball contDiff_homeomorphUnitBall
 
 theorem contDiffOn_homeomorphUnitBall_symm {f : E → E}
@@ -412,7 +415,7 @@ theorem contDiffOn_homeomorphUnitBall_symm {f : E → E}
       hy
   refine' ContDiffAt.inv _ (real.sqrt_ne_zero'.mpr h)
   refine' ContDiffAt.comp _ (cont_diff_at_sqrt h.ne.symm) _
-  exact cont_diff_at_const.sub cont_diff_norm_sq.cont_diff_at
+  exact cont_diff_at_const.sub (contDiff_norm_sq ℝ).ContDiffAt
 #align cont_diff_on_homeomorph_unit_ball_symm contDiffOn_homeomorphUnitBall_symm
 
 end DiffeomorphUnitBall
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.inner_product_space.calculus
-! leanprover-community/mathlib commit f2ce6086713c78a7f880485f7917ea547a215982
+! leanprover-community/mathlib commit c78cad350eb321c81e1eacf68d14e3d3ba1e17f7
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -226,7 +226,7 @@ theorem ContDiff.dist (hf : ContDiff ℝ n f) (hg : ContDiff ℝ n g) (hne : ∀
 omit 𝕜
 
 theorem hasStrictFderivAt_norm_sq (x : F) :
-    HasStrictFderivAt (fun x => ‖x‖ ^ 2) (bit0 (innerSL x : F →L[ℝ] ℝ)) x :=
+    HasStrictFderivAt (fun x => ‖x‖ ^ 2) (bit0 (innerSL ℝ x)) x :=
   by
   simp only [sq, ← inner_self_eq_norm_mul_norm]
   convert(hasStrictFderivAt_id x).inner (hasStrictFderivAt_id x)
Diff
@@ -229,7 +229,7 @@ theorem hasStrictFderivAt_norm_sq (x : F) :
     HasStrictFderivAt (fun x => ‖x‖ ^ 2) (bit0 (innerSL x : F →L[ℝ] ℝ)) x :=
   by
   simp only [sq, ← inner_self_eq_norm_mul_norm]
-  convert (hasStrictFderivAt_id x).inner (hasStrictFderivAt_id x)
+  convert(hasStrictFderivAt_id x).inner (hasStrictFderivAt_id x)
   ext y
   simp [bit0, real_inner_comm]
 #align has_strict_fderiv_at_norm_sq hasStrictFderivAt_norm_sq

Changes in mathlib4

mathlib3
mathlib4
feat: add notation for Real.sqrt (#12056)

This adds the notation √r for Real.sqrt r. The precedence is such that √x⁻¹ is parsed as √(x⁻¹); not because this is particularly desirable, but because it's the default and the choice doesn't really matter.

This is extracted from #7907, which adds a more general nth root typeclass. The idea is to perform all the boring substitutions downstream quickly, so that we can play around with custom elaborators with a much slower rate of code-rot. This PR also won't rot as quickly, as it does not forbid writing x.sqrt as that PR does.

While perhaps claiming for Real.sqrt is greedy; it:

  • Is far more common thatn NNReal.sqrt and Nat.sqrt
  • Is far more interesting to mathlib than sqrt on Float
  • Can be overloaded anyway, so this does not prevent downstream code using the notation on their own types.
  • Will be replaced by a more general typeclass in a future PR.

Zulip

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

Diff
@@ -376,7 +376,7 @@ open Metric hiding mem_nhds_iff
 variable {n : ℕ∞} {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E]
 
 theorem PartialHomeomorph.contDiff_univUnitBall : ContDiff ℝ n (univUnitBall : E → E) := by
-  suffices ContDiff ℝ n fun x : E => (1 + ‖x‖ ^ 2 : ℝ).sqrt⁻¹ from this.smul contDiff_id
+  suffices ContDiff ℝ n fun x : E => (√(1 + ‖x‖ ^ 2 : ℝ))⁻¹ from this.smul contDiff_id
   have h : ∀ x : E, (0 : ℝ) < (1 : ℝ) + ‖x‖ ^ 2 := fun x => by positivity
   refine' ContDiff.inv _ fun x => Real.sqrt_ne_zero'.mpr (h x)
   exact (contDiff_const.add <| contDiff_norm_sq ℝ).sqrt fun x => (h x).ne'
@@ -384,7 +384,7 @@ theorem PartialHomeomorph.contDiff_univUnitBall : ContDiff ℝ n (univUnitBall :
 theorem PartialHomeomorph.contDiffOn_univUnitBall_symm :
     ContDiffOn ℝ n univUnitBall.symm (ball (0 : E) 1) := fun y hy ↦ by
   apply ContDiffAt.contDiffWithinAt
-  suffices ContDiffAt ℝ n (fun y : E => (1 - ‖y‖ ^ 2 : ℝ).sqrt⁻¹) y from this.smul contDiffAt_id
+  suffices ContDiffAt ℝ n (fun y : E => (√(1 - ‖y‖ ^ 2 : ℝ))⁻¹) y from this.smul contDiffAt_id
   have h : (0 : ℝ) < (1 : ℝ) - ‖(y : E)‖ ^ 2 := by
     rwa [mem_ball_zero_iff, ← _root_.abs_one, ← abs_norm, ← sq_lt_sq, one_pow, ← sub_pos] at hy
   refine' ContDiffAt.inv _ (Real.sqrt_ne_zero'.mpr h)
chore: Rename IsROrC to RCLike (#10819)

IsROrC contains data, which goes against the expectation that classes prefixed with Is are prop-valued. People have been complaining about this on and off, so this PR renames IsROrC to RCLike.

Diff
@@ -28,13 +28,13 @@ The last part of the file should be generalized to `PiLp`.
 
 noncomputable section
 
-open IsROrC Real Filter
+open RCLike Real Filter
 
 open scoped BigOperators Classical Topology
 
 section DerivInner
 
-variable {𝕜 E F : Type*} [IsROrC 𝕜]
+variable {𝕜 E F : Type*} [RCLike 𝕜]
 variable [NormedAddCommGroup E] [InnerProductSpace 𝕜 E]
 variable [NormedAddCommGroup F] [InnerProductSpace ℝ F]
 
@@ -304,7 +304,7 @@ section PiLike
 
 open ContinuousLinearMap
 
-variable {𝕜 ι H : Type*} [IsROrC 𝕜] [NormedAddCommGroup H] [NormedSpace 𝕜 H] [Fintype ι]
+variable {𝕜 ι H : Type*} [RCLike 𝕜] [NormedAddCommGroup H] [NormedSpace 𝕜 H] [Fintype ι]
   {f : H → EuclideanSpace 𝕜 ι} {f' : H →L[𝕜] EuclideanSpace 𝕜 ι} {t : Set H} {y : H}
 
 theorem differentiableWithinAt_euclidean :
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
@@ -35,9 +35,7 @@ open scoped BigOperators Classical Topology
 section DerivInner
 
 variable {𝕜 E F : Type*} [IsROrC 𝕜]
-
 variable [NormedAddCommGroup E] [InnerProductSpace 𝕜 E]
-
 variable [NormedAddCommGroup F] [InnerProductSpace ℝ F]
 
 local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y
style: homogenise porting notes (#11145)

Homogenises porting notes via capitalisation and addition of whitespace.

It makes the following changes:

  • converts "--porting note" into "-- Porting note";
  • converts "porting note" into "Porting note".
Diff
@@ -54,7 +54,7 @@ theorem fderivInnerCLM_apply (p x : E × E) : fderivInnerCLM 𝕜 p x = ⟪p.1,
   rfl
 #align fderiv_inner_clm_apply fderivInnerCLM_apply
 
-variable {𝕜} -- porting note: Lean 3 magically switches back to `{𝕜}` here
+variable {𝕜} -- Porting note: Lean 3 magically switches back to `{𝕜}` here
 
 theorem contDiff_inner {n} : ContDiff ℝ n fun p : E × E => ⟪p.1, p.2⟫ :=
   isBoundedBilinearMap_inner.contDiff
@@ -216,7 +216,7 @@ theorem ContDiff.dist (hf : ContDiff ℝ n f) (hg : ContDiff ℝ n g) (hne : ∀
   contDiff_iff_contDiffAt.2 fun x => hf.contDiffAt.dist 𝕜 hg.contDiffAt (hne x)
 #align cont_diff.dist ContDiff.dist
 
--- porting note: use `2 •` instead of `bit0`
+-- Porting note: use `2 •` instead of `bit0`
 theorem hasStrictFDerivAt_norm_sq (x : F) :
     HasStrictFDerivAt (fun x => ‖x‖ ^ 2) (2 • (innerSL ℝ x)) x := by
   simp only [sq, ← @inner_self_eq_norm_mul_norm ℝ]
fix: Clm -> CLM, Cle -> CLE (#10018)

Rename

  • Complex.equivRealProdClmComplex.equivRealProdCLM;
    • TODO: should this one use CLE?
  • Complex.reClmComplex.reCLM;
  • Complex.imClmComplex.imCLM;
  • Complex.conjLieComplex.conjLIE;
  • Complex.conjCleComplex.conjCLE;
  • Complex.ofRealLiComplex.ofRealLI;
  • Complex.ofRealClmComplex.ofRealCLM;
  • fderivInnerClmfderivInnerCLM;
  • LinearPMap.adjointDomainMkClmLinearPMap.adjointDomainMkCLM;
  • LinearPMap.adjointDomainMkClmExtendLinearPMap.adjointDomainMkCLMExtend;
  • IsROrC.reClmIsROrC.reCLM;
  • IsROrC.imClmIsROrC.imCLM;
  • IsROrC.conjLieIsROrC.conjLIE;
  • IsROrC.conjCleIsROrC.conjCLE;
  • IsROrC.ofRealLiIsROrC.ofRealLI;
  • IsROrC.ofRealClmIsROrC.ofRealCLM;
  • MeasureTheory.condexpL1ClmMeasureTheory.condexpL1CLM;
  • algebraMapClmalgebraMapCLM;
  • WeakDual.CharacterSpace.toClmWeakDual.CharacterSpace.toCLM;
  • BoundedContinuousFunction.evalClmBoundedContinuousFunction.evalCLM;
  • ContinuousMap.evalClmContinuousMap.evalCLM;
  • TrivSqZeroExt.fstClmTrivSqZeroExt.fstClm;
  • TrivSqZeroExt.sndClmTrivSqZeroExt.sndCLM;
  • TrivSqZeroExt.inlClmTrivSqZeroExt.inlCLM;
  • TrivSqZeroExt.inrClmTrivSqZeroExt.inrCLM

and related theorems.

Diff
@@ -45,14 +45,14 @@ local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y
 variable (𝕜) [NormedSpace ℝ E]
 
 /-- Derivative of the inner product. -/
-def fderivInnerClm (p : E × E) : E × E →L[ℝ] 𝕜 :=
+def fderivInnerCLM (p : E × E) : E × E →L[ℝ] 𝕜 :=
   isBoundedBilinearMap_inner.deriv p
-#align fderiv_inner_clm fderivInnerClm
+#align fderiv_inner_clm fderivInnerCLM
 
 @[simp]
-theorem fderivInnerClm_apply (p x : E × E) : fderivInnerClm 𝕜 p x = ⟪p.1, x.2⟫ + ⟪x.1, p.2⟫ :=
+theorem fderivInnerCLM_apply (p x : E × E) : fderivInnerCLM 𝕜 p x = ⟪p.1, x.2⟫ + ⟪x.1, p.2⟫ :=
   rfl
-#align fderiv_inner_clm_apply fderivInnerClm_apply
+#align fderiv_inner_clm_apply fderivInnerCLM_apply
 
 variable {𝕜} -- porting note: Lean 3 magically switches back to `{𝕜}` here
 
@@ -93,18 +93,18 @@ theorem ContDiff.inner (hf : ContDiff ℝ n f) (hg : ContDiff ℝ n g) :
 
 theorem HasFDerivWithinAt.inner (hf : HasFDerivWithinAt f f' s x)
     (hg : HasFDerivWithinAt g g' s x) :
-    HasFDerivWithinAt (fun t => ⟪f t, g t⟫) ((fderivInnerClm 𝕜 (f x, g x)).comp <| f'.prod g') s
+    HasFDerivWithinAt (fun t => ⟪f t, g t⟫) ((fderivInnerCLM 𝕜 (f x, g x)).comp <| f'.prod g') s
       x :=
   (isBoundedBilinearMap_inner.hasFDerivAt (f x, g x)).comp_hasFDerivWithinAt x (hf.prod hg)
 #align has_fderiv_within_at.inner HasFDerivWithinAt.inner
 
 theorem HasStrictFDerivAt.inner (hf : HasStrictFDerivAt f f' x) (hg : HasStrictFDerivAt g g' x) :
-    HasStrictFDerivAt (fun t => ⟪f t, g t⟫) ((fderivInnerClm 𝕜 (f x, g x)).comp <| f'.prod g') x :=
+    HasStrictFDerivAt (fun t => ⟪f t, g t⟫) ((fderivInnerCLM 𝕜 (f x, g x)).comp <| f'.prod g') x :=
   (isBoundedBilinearMap_inner.hasStrictFDerivAt (f x, g x)).comp x (hf.prod hg)
 #align has_strict_fderiv_at.inner HasStrictFDerivAt.inner
 
 theorem HasFDerivAt.inner (hf : HasFDerivAt f f' x) (hg : HasFDerivAt g g' x) :
-    HasFDerivAt (fun t => ⟪f t, g t⟫) ((fderivInnerClm 𝕜 (f x, g x)).comp <| f'.prod g') x :=
+    HasFDerivAt (fun t => ⟪f t, g t⟫) ((fderivInnerCLM 𝕜 (f x, g x)).comp <| f'.prod g') x :=
   (isBoundedBilinearMap_inner.hasFDerivAt (f x, g x)).comp x (hf.prod hg)
 #align has_fderiv_at.inner HasFDerivAt.inner
 
@@ -151,7 +151,7 @@ theorem deriv_inner_apply {f g : ℝ → E} {x : ℝ} (hf : DifferentiableAt ℝ
 #align deriv_inner_apply deriv_inner_apply
 
 theorem contDiff_norm_sq : ContDiff ℝ n fun x : E => ‖x‖ ^ 2 := by
-  convert (reClm : 𝕜 →L[ℝ] ℝ).contDiff.comp ((contDiff_id (E := E)).inner 𝕜 (contDiff_id (E := E)))
+  convert (reCLM : 𝕜 →L[ℝ] ℝ).contDiff.comp ((contDiff_id (E := E)).inner 𝕜 (contDiff_id (E := E)))
   exact (inner_self_eq_norm_sq _).symm
 #align cont_diff_norm_sq contDiff_norm_sq
 
chore: rename LocalHomeomorph to PartialHomeomorph (#8982)

LocalHomeomorph evokes a "local homeomorphism": this is not what this means. Instead, this is a homeomorphism on an open set of the domain (extended to the whole space, by the junk value pattern). Hence, partial homeomorphism is more appropriate, and avoids confusion with IsLocallyHomeomorph.

A future PR will rename LocalEquiv to PartialEquiv.

Zulip discussion

Diff
@@ -377,13 +377,13 @@ open Metric hiding mem_nhds_iff
 
 variable {n : ℕ∞} {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E]
 
-theorem LocalHomeomorph.contDiff_univUnitBall : ContDiff ℝ n (univUnitBall : E → E) := by
+theorem PartialHomeomorph.contDiff_univUnitBall : ContDiff ℝ n (univUnitBall : E → E) := by
   suffices ContDiff ℝ n fun x : E => (1 + ‖x‖ ^ 2 : ℝ).sqrt⁻¹ from this.smul contDiff_id
   have h : ∀ x : E, (0 : ℝ) < (1 : ℝ) + ‖x‖ ^ 2 := fun x => by positivity
   refine' ContDiff.inv _ fun x => Real.sqrt_ne_zero'.mpr (h x)
   exact (contDiff_const.add <| contDiff_norm_sq ℝ).sqrt fun x => (h x).ne'
 
-theorem LocalHomeomorph.contDiffOn_univUnitBall_symm :
+theorem PartialHomeomorph.contDiffOn_univUnitBall_symm :
     ContDiffOn ℝ n univUnitBall.symm (ball (0 : E) 1) := fun y hy ↦ by
   apply ContDiffAt.contDiffWithinAt
   suffices ContDiffAt ℝ n (fun y : E => (1 - ‖y‖ ^ 2 : ℝ).sqrt⁻¹) y from this.smul contDiffAt_id
@@ -394,17 +394,17 @@ theorem LocalHomeomorph.contDiffOn_univUnitBall_symm :
   exact contDiffAt_const.sub (contDiff_norm_sq ℝ).contDiffAt
 
 theorem Homeomorph.contDiff_unitBall : ContDiff ℝ n fun x : E => (unitBall x : E) :=
-  LocalHomeomorph.contDiff_univUnitBall
+  PartialHomeomorph.contDiff_univUnitBall
 #align cont_diff_homeomorph_unit_ball Homeomorph.contDiff_unitBall
 
-@[deprecated LocalHomeomorph.contDiffOn_univUnitBall_symm]
+@[deprecated PartialHomeomorph.contDiffOn_univUnitBall_symm]
 theorem Homeomorph.contDiffOn_unitBall_symm {f : E → E}
     (h : ∀ (y) (hy : y ∈ ball (0 : E) 1), f y = Homeomorph.unitBall.symm ⟨y, hy⟩) :
     ContDiffOn ℝ n f <| ball 0 1 :=
-  LocalHomeomorph.contDiffOn_univUnitBall_symm.congr h
+  PartialHomeomorph.contDiffOn_univUnitBall_symm.congr h
 #align cont_diff_on_homeomorph_unit_ball_symm Homeomorph.contDiffOn_unitBall_symm
 
-namespace LocalHomeomorph
+namespace PartialHomeomorph
 
 variable {c : E} {r : ℝ}
 
@@ -424,9 +424,9 @@ theorem contDiffOn_univBall_symm :
   unfold univBall; split_ifs with h
   · refine contDiffOn_univUnitBall_symm.comp (contDiff_unitBallBall_symm h).contDiffOn ?_
     rw [← unitBallBall_source c r h, ← unitBallBall_target c r h]
-    apply LocalHomeomorph.symm_mapsTo
+    apply PartialHomeomorph.symm_mapsTo
   · exact contDiffOn_id.sub contDiffOn_const
 
-end LocalHomeomorph
+end PartialHomeomorph
 
 end DiffeomorphUnitBall
chore(Deriv): golf (#8899)

Assorted golf I did while working on a refactor. Submitting as a separate PR.

  • Move not_differentiableAt_abs_zero to Calculus.Deriv.Add, golf.
  • Rename HasFDerivWithinAt_of_nhdsWithin_eq_bot to HasFDerivWithinAt.of_nhdsWithin_eq_bot, golf.
  • Protect Filter.EventuallyEq.rfl.
  • Golf here and there.
Diff
@@ -252,28 +252,6 @@ theorem DifferentiableAt.norm (hf : DifferentiableAt ℝ f x) (h0 : f x ≠ 0) :
   ((contDiffAt_norm 𝕜 h0).differentiableAt le_rfl).comp x hf
 #align differentiable_at.norm DifferentiableAt.norm
 
-theorem not_differentiableAt_abs_zero : ¬ DifferentiableAt ℝ (abs : ℝ → ℝ) 0 := by
-  rw [DifferentiableAt]
-  push_neg
-  intro f
-  simp only [HasFDerivAt, HasFDerivAtFilter, abs_zero, sub_zero,
-    Asymptotics.isLittleO_iff, norm_eq_abs, not_forall, not_eventually, not_le, exists_prop]
-  use (1 / 2), by norm_num
-  rw [Filter.HasBasis.frequently_iff Metric.nhds_basis_ball]
-  intro δ hδ
-  obtain ⟨x, hx⟩ : ∃ x ∈ Metric.ball 0 δ, x ≠ 0 ∧ f x ≤ 0 := by
-    by_cases h : f (δ / 2) ≤ 0
-    · use (δ / 2)
-      simp [h, abs_of_nonneg hδ.le, hδ, hδ.ne']
-    · use -(δ / 2)
-      push_neg at h
-      simp [h.le, abs_of_nonneg hδ.le, hδ, hδ.ne']
-  use x, hx.left
-  rw [lt_abs]
-  left
-  cancel_denoms
-  linarith [abs_pos.mpr hx.right.left]
-
 theorem DifferentiableAt.dist (hf : DifferentiableAt ℝ f x) (hg : DifferentiableAt ℝ g x)
     (hne : f x ≠ g x) : DifferentiableAt ℝ (fun y => dist (f y) (g y)) x := by
   simp only [dist_eq_norm]; exact (hf.sub hg).norm 𝕜 (sub_ne_zero.2 hne)
chore: add missing hypothesis names to by_cases (#8533)

I've also got a change to make this required, but I'd like to land this first.

Diff
@@ -262,7 +262,7 @@ theorem not_differentiableAt_abs_zero : ¬ DifferentiableAt ℝ (abs : ℝ → 
   rw [Filter.HasBasis.frequently_iff Metric.nhds_basis_ball]
   intro δ hδ
   obtain ⟨x, hx⟩ : ∃ x ∈ Metric.ball 0 δ, x ≠ 0 ∧ f x ≤ 0 := by
-    by_cases f (δ / 2) ≤ 0
+    by_cases h : f (δ / 2) ≤ 0
     · use (δ / 2)
       simp [h, abs_of_nonneg hδ.le, hδ, hδ.ne']
     · use -(δ / 2)
chore: bump to v4.3.0-rc2 (#8366)

PR contents

This is the supremum of

along with some minor fixes from failures on nightly-testing as Mathlib master is merged into it.

Note that some PRs for changes that are already compatible with the current toolchain and will be necessary have already been split out: #8380.

I am hopeful that in future we will be able to progressively merge adaptation PRs into a bump/v4.X.0 branch, so we never end up with a "big merge" like this. However one of these adaptation PRs (#8056) predates my new scheme for combined CI, and it wasn't possible to keep that PR viable in the meantime.

Lean PRs involved in this bump

In particular this includes adjustments for the Lean PRs

leanprover/lean4#2778

We can get rid of all the

local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue [lean4#2220](https://github.com/leanprover/lean4/pull/2220)

macros across Mathlib (and in any projects that want to write natural number powers of reals).

leanprover/lean4#2722

Changes the default behaviour of simp to (config := {decide := false}). This makes simp (and consequentially norm_num) less powerful, but also more consistent, and less likely to blow up in long failures. This requires a variety of changes: changing some previously by simp or norm_num to decide or rfl, or adding (config := {decide := true}).

leanprover/lean4#2783

This changed the behaviour of simp so that simp [f] will only unfold "fully applied" occurrences of f. The old behaviour can be recovered with simp (config := { unfoldPartialApp := true }). We may in future add a syntax for this, e.g. simp [!f]; please provide feedback! In the meantime, we have made the following changes:

  • switching to using explicit lemmas that have the intended level of application
  • (config := { unfoldPartialApp := true }) in some places, to recover the old behaviour
  • Using @[eqns] to manually adjust the equation lemmas for a particular definition, recovering the old behaviour just for that definition. See #8371, where we do this for Function.comp and Function.flip.

This change in Lean may require further changes down the line (e.g. adding the !f syntax, and/or upstreaming the special treatment for Function.comp and Function.flip, and/or removing this special treatment). Please keep an open and skeptical mind about these changes!

Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Mauricio Collares <mauricio@collares.org>

Diff
@@ -26,8 +26,6 @@ and from the equivalence of norms in finite dimensions.
 The last part of the file should be generalized to `PiLp`.
 -/
 
-local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue lean4#2220
-
 noncomputable section
 
 open IsROrC Real Filter
@@ -402,7 +400,7 @@ open Metric hiding mem_nhds_iff
 variable {n : ℕ∞} {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E]
 
 theorem LocalHomeomorph.contDiff_univUnitBall : ContDiff ℝ n (univUnitBall : E → E) := by
-  suffices ContDiff ℝ n fun x : E => ((1 : ℝ) + ‖x‖ ^ 2).sqrt⁻¹ from this.smul contDiff_id
+  suffices ContDiff ℝ n fun x : E => (1 + ‖x‖ ^ 2 : ℝ).sqrt⁻¹ from this.smul contDiff_id
   have h : ∀ x : E, (0 : ℝ) < (1 : ℝ) + ‖x‖ ^ 2 := fun x => by positivity
   refine' ContDiff.inv _ fun x => Real.sqrt_ne_zero'.mpr (h x)
   exact (contDiff_const.add <| contDiff_norm_sq ℝ).sqrt fun x => (h x).ne'
@@ -410,7 +408,7 @@ theorem LocalHomeomorph.contDiff_univUnitBall : ContDiff ℝ n (univUnitBall : E
 theorem LocalHomeomorph.contDiffOn_univUnitBall_symm :
     ContDiffOn ℝ n univUnitBall.symm (ball (0 : E) 1) := fun y hy ↦ by
   apply ContDiffAt.contDiffWithinAt
-  suffices ContDiffAt ℝ n (fun y : E => ((1 : ℝ) - ‖y‖ ^ 2).sqrt⁻¹) y from this.smul contDiffAt_id
+  suffices ContDiffAt ℝ n (fun y : E => (1 - ‖y‖ ^ 2 : ℝ).sqrt⁻¹) y from this.smul contDiffAt_id
   have h : (0 : ℝ) < (1 : ℝ) - ‖(y : E)‖ ^ 2 := by
     rwa [mem_ball_zero_iff, ← _root_.abs_one, ← abs_norm, ← sq_lt_sq, one_pow, ← sub_pos] at hy
   refine' ContDiffAt.inv _ (Real.sqrt_ne_zero'.mpr h)
feat: add HasDerivAt.norm_sq (#8268)

This is just a special case of the HasFDerivAt version

Diff
@@ -231,10 +231,19 @@ theorem HasFDerivAt.norm_sq {f : G → F} {f' : G →L[ℝ] F} (hf : HasFDerivAt
     HasFDerivAt (‖f ·‖ ^ 2) (2 • (innerSL ℝ (f x)).comp f') x :=
   (hasStrictFDerivAt_norm_sq _).hasFDerivAt.comp x hf
 
+theorem HasDerivAt.norm_sq {f : ℝ → F} {f' : F} {x : ℝ} (hf : HasDerivAt f f' x) :
+    HasDerivAt (‖f ·‖ ^ 2) (2 * Inner.inner (f x) f') x := by
+  simpa using hf.hasFDerivAt.norm_sq.hasDerivAt
+
 theorem HasFDerivWithinAt.norm_sq {f : G → F} {f' : G →L[ℝ] F} (hf : HasFDerivWithinAt f f' s x) :
     HasFDerivWithinAt (‖f ·‖ ^ 2) (2 • (innerSL ℝ (f x)).comp f') s x :=
   (hasStrictFDerivAt_norm_sq _).hasFDerivAt.comp_hasFDerivWithinAt x hf
 
+theorem HasDerivWithinAt.norm_sq {f : ℝ → F} {f' : F} {s : Set ℝ} {x : ℝ}
+    (hf : HasDerivWithinAt f f' s x) :
+    HasDerivWithinAt (‖f ·‖ ^ 2) (2 * Inner.inner (f x) f') s x := by
+  simpa using hf.hasFDerivWithinAt.norm_sq.hasDerivWithinAt
+
 theorem DifferentiableAt.norm_sq (hf : DifferentiableAt ℝ f x) :
     DifferentiableAt ℝ (fun y => ‖f y‖ ^ 2) x :=
   ((contDiffAt_id.norm_sq 𝕜).differentiableAt le_rfl).comp x hf
feat(Analysis/InnerProductSpace/Calculus): Add theorem that abs on ℝ is not differentiable at 0 (#7362)

Adds a theorem which states that the absolute value function on ℝ is not differentiable at zero.

Diff
@@ -245,6 +245,28 @@ theorem DifferentiableAt.norm (hf : DifferentiableAt ℝ f x) (h0 : f x ≠ 0) :
   ((contDiffAt_norm 𝕜 h0).differentiableAt le_rfl).comp x hf
 #align differentiable_at.norm DifferentiableAt.norm
 
+theorem not_differentiableAt_abs_zero : ¬ DifferentiableAt ℝ (abs : ℝ → ℝ) 0 := by
+  rw [DifferentiableAt]
+  push_neg
+  intro f
+  simp only [HasFDerivAt, HasFDerivAtFilter, abs_zero, sub_zero,
+    Asymptotics.isLittleO_iff, norm_eq_abs, not_forall, not_eventually, not_le, exists_prop]
+  use (1 / 2), by norm_num
+  rw [Filter.HasBasis.frequently_iff Metric.nhds_basis_ball]
+  intro δ hδ
+  obtain ⟨x, hx⟩ : ∃ x ∈ Metric.ball 0 δ, x ≠ 0 ∧ f x ≤ 0 := by
+    by_cases f (δ / 2) ≤ 0
+    · use (δ / 2)
+      simp [h, abs_of_nonneg hδ.le, hδ, hδ.ne']
+    · use -(δ / 2)
+      push_neg at h
+      simp [h.le, abs_of_nonneg hδ.le, hδ, hδ.ne']
+  use x, hx.left
+  rw [lt_abs]
+  left
+  cancel_denoms
+  linarith [abs_pos.mpr hx.right.left]
+
 theorem DifferentiableAt.dist (hf : DifferentiableAt ℝ f x) (hg : DifferentiableAt ℝ g x)
     (hne : f x ≠ g x) : DifferentiableAt ℝ (fun y => dist (f y) (g y)) x := by
   simp only [dist_eq_norm]; exact (hf.sub hg).norm 𝕜 (sub_ne_zero.2 hne)
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
@@ -36,7 +36,7 @@ open scoped BigOperators Classical Topology
 
 section DerivInner
 
-variable {𝕜 E F : Type _} [IsROrC 𝕜]
+variable {𝕜 E F : Type*} [IsROrC 𝕜]
 
 variable [NormedAddCommGroup E] [InnerProductSpace 𝕜 E]
 
@@ -71,7 +71,7 @@ theorem differentiable_inner : Differentiable ℝ fun p : E × E => ⟪p.1, p.2
 #align differentiable_inner differentiable_inner
 
 variable (𝕜)
-variable {G : Type _} [NormedAddCommGroup G] [NormedSpace ℝ G] {f g : G → E} {f' g' : G →L[ℝ] E}
+variable {G : Type*} [NormedAddCommGroup G] [NormedSpace ℝ G] {f g : G → E} {f' g' : G →L[ℝ] E}
   {s : Set G} {x : G} {n : ℕ∞}
 
 theorem ContDiffWithinAt.inner (hf : ContDiffWithinAt ℝ n f s x) (hg : ContDiffWithinAt ℝ n g s x) :
@@ -299,7 +299,7 @@ section PiLike
 
 open ContinuousLinearMap
 
-variable {𝕜 ι H : Type _} [IsROrC 𝕜] [NormedAddCommGroup H] [NormedSpace 𝕜 H] [Fintype ι]
+variable {𝕜 ι H : Type*} [IsROrC 𝕜] [NormedAddCommGroup H] [NormedSpace 𝕜 H] [Fintype ι]
   {f : H → EuclideanSpace 𝕜 ι} {f' : H →L[𝕜] EuclideanSpace 𝕜 ι} {t : Set H} {y : H}
 
 theorem differentiableWithinAt_euclidean :
@@ -368,7 +368,7 @@ section DiffeomorphUnitBall
 
 open Metric hiding mem_nhds_iff
 
-variable {n : ℕ∞} {E : Type _} [NormedAddCommGroup E] [InnerProductSpace ℝ E]
+variable {n : ℕ∞} {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E]
 
 theorem LocalHomeomorph.contDiff_univUnitBall : ContDiff ℝ n (univUnitBall : E → E) := by
   suffices ContDiff ℝ n fun x : E => ((1 : ℝ) + ‖x‖ ^ 2).sqrt⁻¹ from this.smul contDiff_id
chore: regularize HPow.hPow porting notes (#6465)
Diff
@@ -26,7 +26,7 @@ and from the equivalence of norms in finite dimensions.
 The last part of the file should be generalized to `PiLp`.
 -/
 
-local macro_rules | `($x ^ $y)   => `(HPow.hPow $x $y) -- Porting note: See Lean 4 issue #2220
+local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue lean4#2220
 
 noncomputable section
 
refactor: rename/redefine homeomorphUnitBall (#6030)
  • Add Equiv.toLocalEquivOfImageEq and Homeomorph.toLocalHomeomorphOfImageEq.
  • Rename homeomorphUnitBall to Homeomorph.unitBall.
  • Add LocalHomeomorph.univUnitBall, a LocalHomeomorph version of Homeomorph.unitBall.
  • Add LocalHomeomorph.unitBallBall and LocalHomeomorph.univBall.

Inspired by a definition from the sphere eversion project.

Diff
@@ -5,6 +5,7 @@ Authors: Yury Kudryashov
 -/
 import Mathlib.Analysis.InnerProductSpace.PiL2
 import Mathlib.Analysis.SpecialFunctions.Sqrt
+import Mathlib.Analysis.NormedSpace.HomeomorphBall
 
 #align_import analysis.inner_product_space.calculus from "leanprover-community/mathlib"@"f9dd3204df14a0749cd456fac1e6849dfe7d2b88"
 
@@ -369,29 +370,56 @@ open Metric hiding mem_nhds_iff
 
 variable {n : ℕ∞} {E : Type _} [NormedAddCommGroup E] [InnerProductSpace ℝ E]
 
-theorem contDiff_homeomorphUnitBall : ContDiff ℝ n fun x : E => (homeomorphUnitBall x : E) := by
-  suffices ContDiff ℝ n fun x : E => ((1 : ℝ) + ‖x‖ ^ 2).sqrt⁻¹ by exact this.smul contDiff_id
+theorem LocalHomeomorph.contDiff_univUnitBall : ContDiff ℝ n (univUnitBall : E → E) := by
+  suffices ContDiff ℝ n fun x : E => ((1 : ℝ) + ‖x‖ ^ 2).sqrt⁻¹ from this.smul contDiff_id
   have h : ∀ x : E, (0 : ℝ) < (1 : ℝ) + ‖x‖ ^ 2 := fun x => by positivity
   refine' ContDiff.inv _ fun x => Real.sqrt_ne_zero'.mpr (h x)
   exact (contDiff_const.add <| contDiff_norm_sq ℝ).sqrt fun x => (h x).ne'
-#align cont_diff_homeomorph_unit_ball contDiff_homeomorphUnitBall
 
-theorem contDiffOn_homeomorphUnitBall_symm {f : E → E}
-    (h : ∀ (y) (hy : y ∈ ball (0 : E) 1), f y = homeomorphUnitBall.symm ⟨y, hy⟩) :
-    ContDiffOn ℝ n f <| ball 0 1 := fun y hy ↦ by
+theorem LocalHomeomorph.contDiffOn_univUnitBall_symm :
+    ContDiffOn ℝ n univUnitBall.symm (ball (0 : E) 1) := fun y hy ↦ by
   apply ContDiffAt.contDiffWithinAt
-  have hf : f =ᶠ[𝓝 y] fun y => ((1 : ℝ) - ‖(y : E)‖ ^ 2).sqrt⁻¹ • (y : E) := by
-    filter_upwards [isOpen_ball.mem_nhds hy] with z hz
-    rw [h z hz]
-    rfl
-  refine' ContDiffAt.congr_of_eventuallyEq _ hf
-  suffices ContDiffAt ℝ n (fun y => ((1 : ℝ) - ‖(y : E)‖ ^ 2).sqrt⁻¹) y from this.smul contDiffAt_id
+  suffices ContDiffAt ℝ n (fun y : E => ((1 : ℝ) - ‖y‖ ^ 2).sqrt⁻¹) y from this.smul contDiffAt_id
   have h : (0 : ℝ) < (1 : ℝ) - ‖(y : E)‖ ^ 2 := by
     rwa [mem_ball_zero_iff, ← _root_.abs_one, ← abs_norm, ← sq_lt_sq, one_pow, ← sub_pos] at hy
   refine' ContDiffAt.inv _ (Real.sqrt_ne_zero'.mpr h)
   refine' (contDiffAt_sqrt h.ne').comp y _
   exact contDiffAt_const.sub (contDiff_norm_sq ℝ).contDiffAt
-#align cont_diff_on_homeomorph_unit_ball_symm contDiffOn_homeomorphUnitBall_symm
 
-end DiffeomorphUnitBall
+theorem Homeomorph.contDiff_unitBall : ContDiff ℝ n fun x : E => (unitBall x : E) :=
+  LocalHomeomorph.contDiff_univUnitBall
+#align cont_diff_homeomorph_unit_ball Homeomorph.contDiff_unitBall
+
+@[deprecated LocalHomeomorph.contDiffOn_univUnitBall_symm]
+theorem Homeomorph.contDiffOn_unitBall_symm {f : E → E}
+    (h : ∀ (y) (hy : y ∈ ball (0 : E) 1), f y = Homeomorph.unitBall.symm ⟨y, hy⟩) :
+    ContDiffOn ℝ n f <| ball 0 1 :=
+  LocalHomeomorph.contDiffOn_univUnitBall_symm.congr h
+#align cont_diff_on_homeomorph_unit_ball_symm Homeomorph.contDiffOn_unitBall_symm
+
+namespace LocalHomeomorph
+
+variable {c : E} {r : ℝ}
+
+theorem contDiff_unitBallBall (hr : 0 < r) : ContDiff ℝ n (unitBallBall c r hr) :=
+  (contDiff_id.const_smul _).add contDiff_const
 
+theorem contDiff_unitBallBall_symm (hr : 0 < r) : ContDiff ℝ n (unitBallBall c r hr).symm :=
+  (contDiff_id.sub contDiff_const).const_smul _
+
+theorem contDiff_univBall : ContDiff ℝ n (univBall c r) := by
+  unfold univBall; split_ifs with h
+  · exact (contDiff_unitBallBall h).comp contDiff_univUnitBall
+  · exact contDiff_id.add contDiff_const
+
+theorem contDiffOn_univBall_symm :
+    ContDiffOn ℝ n (univBall c r).symm (ball c r) := by
+  unfold univBall; split_ifs with h
+  · refine contDiffOn_univUnitBall_symm.comp (contDiff_unitBallBall_symm h).contDiffOn ?_
+    rw [← unitBallBall_source c r h, ← unitBallBall_target c r h]
+    apply LocalHomeomorph.symm_mapsTo
+  · exact contDiffOn_id.sub contDiffOn_const
+
+end LocalHomeomorph
+
+end DiffeomorphUnitBall
feat: derivative of the inversion (#5937)

Prove that inversion is smooth away from the center and its derivative is a scaled reflection.

Co-authored-by: Oliver Nash <github@olivernash.org>

Diff
@@ -226,6 +226,14 @@ theorem hasStrictFDerivAt_norm_sq (x : F) :
   simp [two_smul, real_inner_comm]
 #align has_strict_fderiv_at_norm_sq hasStrictFDerivAt_norm_sqₓ
 
+theorem HasFDerivAt.norm_sq {f : G → F} {f' : G →L[ℝ] F} (hf : HasFDerivAt f f' x) :
+    HasFDerivAt (‖f ·‖ ^ 2) (2 • (innerSL ℝ (f x)).comp f') x :=
+  (hasStrictFDerivAt_norm_sq _).hasFDerivAt.comp x hf
+
+theorem HasFDerivWithinAt.norm_sq {f : G → F} {f' : G →L[ℝ] F} (hf : HasFDerivWithinAt f f' s x) :
+    HasFDerivWithinAt (‖f ·‖ ^ 2) (2 • (innerSL ℝ (f x)).comp f') s x :=
+  (hasStrictFDerivAt_norm_sq _).hasFDerivAt.comp_hasFDerivWithinAt x hf
+
 theorem DifferentiableAt.norm_sq (hf : DifferentiableAt ℝ f x) :
     DifferentiableAt ℝ (fun y => ‖f y‖ ^ 2) x :=
   ((contDiffAt_id.norm_sq 𝕜).differentiableAt le_rfl).comp x hf
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) 2020 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.inner_product_space.calculus
-! leanprover-community/mathlib commit f9dd3204df14a0749cd456fac1e6849dfe7d2b88
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Analysis.InnerProductSpace.PiL2
 import Mathlib.Analysis.SpecialFunctions.Sqrt
 
+#align_import analysis.inner_product_space.calculus from "leanprover-community/mathlib"@"f9dd3204df14a0749cd456fac1e6849dfe7d2b88"
+
 /-!
 # Calculus in inner product spaces
 
feat: port Analysis.InnerProductSpace.Calculus (#4659)

Dependencies 12 + 944

945 files ported (98.7%)
418834 lines ported (98.7%)
Show graph

The unported dependencies are

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