analysis.calculus.cont_diff ⟷ Mathlib.Analysis.Calculus.ContDiff.Bounds

This file has been ported!

Changes since the initial port

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

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -3,7 +3,7 @@ Copyright (c) 2019 SΓ©bastien GouΓ«zel. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: SΓ©bastien GouΓ«zel, Floris van Doorn
 -/
-import Analysis.Calculus.ContDiffDef
+import Analysis.Calculus.ContDiff.Defs
 import Analysis.Calculus.Deriv.Inverse
 import Analysis.Calculus.MeanValue
 import Analysis.NormedSpace.FiniteDimension
@@ -369,8 +369,8 @@ theorem ContinuousLinearMap.iteratedFDerivWithin_comp_left {f : E β†’ F} (g : F
     (hf : ContDiffOn π•œ n f s) (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) {i : β„•} (hi : (i : β„•βˆž) ≀ n) :
     iteratedFDerivWithin π•œ i (g ∘ f) s x =
       g.compContinuousMultilinearMap (iteratedFDerivWithin π•œ i f s x) :=
-  (((hf.ftaylorSeriesWithin hs).continuousLinearMap_comp g).eq_ftaylor_series_of_uniqueDiffOn hi hs
-      hx).symm
+  (((hf.ftaylorSeriesWithin hs).continuousLinearMap_comp g).eq_iteratedFDerivWithin_of_uniqueDiffOn
+      hi hs hx).symm
 #align continuous_linear_map.iterated_fderiv_within_comp_left ContinuousLinearMap.iteratedFDerivWithin_comp_left
 -/
 
@@ -582,8 +582,8 @@ theorem ContinuousLinearMap.iteratedFDerivWithin_comp_right {f : E β†’ F} (g : G
     (hx : g x ∈ s) {i : β„•} (hi : (i : β„•βˆž) ≀ n) :
     iteratedFDerivWithin π•œ i (f ∘ g) (g ⁻¹' s) x =
       (iteratedFDerivWithin π•œ i f s (g x)).compContinuousLinearMap fun _ => g :=
-  (((hf.ftaylorSeriesWithin hs).compContinuousLinearMap g).eq_ftaylor_series_of_uniqueDiffOn hi h's
-      hx).symm
+  (((hf.ftaylorSeriesWithin hs).compContinuousLinearMap g).eq_iteratedFDerivWithin_of_uniqueDiffOn
+      hi h's hx).symm
 #align continuous_linear_map.iterated_fderiv_within_comp_right ContinuousLinearMap.iteratedFDerivWithin_comp_right
 -/
 
@@ -1945,7 +1945,7 @@ theorem contDiff_prod {t : Finset ΞΉ} {f : ΞΉ β†’ E β†’ 𝔸'} (h : βˆ€ i ∈ t,
 #print ContDiff.pow /-
 theorem ContDiff.pow {f : E β†’ 𝔸} (hf : ContDiff π•œ n f) : βˆ€ m : β„•, ContDiff π•œ n fun x => f x ^ m
   | 0 => by simpa using contDiff_const
-  | m + 1 => by simpa [pow_succ] using hf.mul (ContDiff.pow m)
+  | m + 1 => by simpa [pow_succ'] using hf.mul (ContDiff.pow m)
 #align cont_diff.pow ContDiff.pow
 -/
 
@@ -2554,7 +2554,7 @@ section Real
 -/
 
 
-variable {𝕂 : Type _} [IsROrC 𝕂] {E' : Type _} [NormedAddCommGroup E'] [NormedSpace 𝕂 E']
+variable {𝕂 : Type _} [RCLike 𝕂] {E' : Type _} [NormedAddCommGroup E'] [NormedSpace 𝕂 E']
   {F' : Type _} [NormedAddCommGroup F'] [NormedSpace 𝕂 F']
 
 #print HasFTaylorSeriesUpToOn.hasStrictFDerivAt /-
Diff
@@ -671,7 +671,7 @@ theorem ContinuousLinearEquiv.contDiffWithinAt_comp_iff (e : G ≃L[π•œ] E) :
   Β· intro H
     simpa [← preimage_comp, (Β· ∘ Β·)] using H.comp_continuous_linear_map (e.symm : E β†’L[π•œ] G)
   Β· intro H
-    rw [← e.apply_symm_apply x, ← e.coe_coe] at H 
+    rw [← e.apply_symm_apply x, ← e.coe_coe] at H
     exact H.comp_continuous_linear_map _
 #align continuous_linear_equiv.cont_diff_within_at_comp_iff ContinuousLinearEquiv.contDiffWithinAt_comp_iff
 -/
@@ -877,7 +877,7 @@ theorem ContDiffOn.comp {s : Set E} {t : Set F} {g : F β†’ G} {f : E β†’ F} (hg
     ext y
     simp only [Function.comp_apply, gu, fu]
     rw [isoF.apply_symm_apply (f (isoE y))]
-  rwa [this, isoE.cont_diff_on_comp_iff, isoG.symm.comp_cont_diff_on_iff] at main 
+  rwa [this, isoE.cont_diff_on_comp_iff, isoG.symm.comp_cont_diff_on_iff] at main
 #align cont_diff_on.comp ContDiffOn.comp
 -/
 
@@ -934,7 +934,7 @@ theorem ContDiffWithinAt.comp {s : Set E} {t : Set F} {g : F β†’ G} {f : E β†’ F
       simp [hy1, hy2, vs hy2]
     rw [A, ← nhdsWithin_restrict'']
     exact Filter.inter_mem this v_nhd
-  rwa [insert_eq_of_mem xmem, this] at Z 
+  rwa [insert_eq_of_mem xmem, this] at Z
 #align cont_diff_within_at.comp ContDiffWithinAt.comp
 -/
 
@@ -1356,7 +1356,7 @@ theorem ContDiffWithinAt.fderivWithin {f : E β†’ F β†’ G} {g : E β†’ F} {t : Set
     (hg : ContDiffWithinAt π•œ m g s xβ‚€) (ht : UniqueDiffOn π•œ t) (hmn : m + 1 ≀ n) (hxβ‚€ : xβ‚€ ∈ s)
     (hst : s βŠ† g ⁻¹' t) : ContDiffWithinAt π•œ m (fun x => fderivWithin π•œ (f x) t (g x)) s xβ‚€ :=
   by
-  rw [← insert_eq_self.mpr hxβ‚€] at hf 
+  rw [← insert_eq_self.mpr hxβ‚€] at hf
   refine' hf.fderiv_within' hg _ hmn hst
   rw [insert_eq_self.mpr hxβ‚€]
   exact eventually_of_mem self_mem_nhdsWithin fun x hx => ht _ (hst hx)
@@ -2400,7 +2400,7 @@ theorem PartialHomeomorph.contDiffAt_symm [CompleteSpace E] (f : PartialHomeomor
       have h_nhds : {y : E | βˆƒ e : E ≃L[π•œ] F, ↑e = f' y} ∈ 𝓝 (f.symm a) :=
         by
         have hfβ‚€' := fβ‚€'.nhds
-        rw [← eq_fβ‚€'] at hfβ‚€' 
+        rw [← eq_fβ‚€'] at hfβ‚€'
         exact hf'.continuous_at.preimage_mem_nhds hfβ‚€'
       obtain ⟨t, htu, ht, htf⟩ := mem_nhds_iff.mp (Filter.inter_mem hu h_nhds)
       use f.target ∩ f.symm ⁻¹' t
@@ -2575,7 +2575,7 @@ theorem ContDiffAt.hasStrictFDerivAt' {f : E' β†’ F'} {f' : E' β†’L[𝕂] F'} {x
     (hf : ContDiffAt 𝕂 n f x) (hf' : HasFDerivAt f f' x) (hn : 1 ≀ n) : HasStrictFDerivAt f f' x :=
   by
   rcases hf 1 hn with ⟨u, H, p, hp⟩
-  simp only [nhdsWithin_univ, mem_univ, insert_eq_of_mem] at H 
+  simp only [nhdsWithin_univ, mem_univ, insert_eq_of_mem] at H
   have := hp.has_strict_fderiv_at le_rfl H
   rwa [hf'.unique this.has_fderiv_at]
 #align cont_diff_at.has_strict_fderiv_at' ContDiffAt.hasStrictFDerivAt'
@@ -2670,9 +2670,9 @@ theorem ContDiffWithinAt.exists_lipschitzOnWith {E F : Type _} [NormedAddCommGro
   rcases metric.mem_nhds_within_iff.mp hst with ⟨Ρ, Ρ0, hΡ⟩
   replace hp : HasFTaylorSeriesUpToOn 1 f p (Metric.ball x Ρ ∩ insert x s) := hp.mono hΡ
   clear hst hΞ΅ t
-  rw [← insert_eq_of_mem (Metric.mem_ball_self Ξ΅0), ← insert_inter_distrib] at hp 
+  rw [← insert_eq_of_mem (Metric.mem_ball_self Ξ΅0), ← insert_inter_distrib] at hp
   rcases hp.exists_lipschitz_on_with ((convex_ball _ _).inter hs) with ⟨K, t, hst, hft⟩
-  rw [inter_comm, ← nhdsWithin_restrict' _ (Metric.ball_mem_nhds _ Ξ΅0)] at hst 
+  rw [inter_comm, ← nhdsWithin_restrict' _ (Metric.ball_mem_nhds _ Ξ΅0)] at hst
   exact ⟨K, t, hst, hft⟩
 #align cont_diff_within_at.exists_lipschitz_on_with ContDiffWithinAt.exists_lipschitzOnWith
 -/
@@ -2789,11 +2789,11 @@ theorem ContDiffOn.derivWithin (hf : ContDiffOn π•œ n fβ‚‚ sβ‚‚) (hs : UniqueDi
     (hmn : m + 1 ≀ n) : ContDiffOn π•œ m (derivWithin fβ‚‚ sβ‚‚) sβ‚‚ :=
   by
   cases m
-  Β· change ∞ + 1 ≀ n at hmn 
+  Β· change ∞ + 1 ≀ n at hmn
     have : n = ∞ := by simpa using hmn
-    rw [this] at hf 
+    rw [this] at hf
     exact ((contDiffOn_top_iff_derivWithin hs).1 hf).2
-  Β· change (m.succ : β„•βˆž) ≀ n at hmn 
+  Β· change (m.succ : β„•βˆž) ≀ n at hmn
     exact ((contDiffOn_succ_iff_derivWithin hs).1 (hf.of_le hmn)).2
 #align cont_diff_on.deriv_within ContDiffOn.derivWithin
 -/
@@ -3114,13 +3114,13 @@ theorem ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear (B : E β†’L
     intro i
     rw [LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_left _ _ hsu hxu]
     rw [LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_right _ _ hs, xu_x]
-    rwa [← xu_x] at hx 
+    rwa [← xu_x] at hx
   have Ngu : βˆ€ i, β€–iteratedFDerivWithin π•œ i gu su xuβ€– = β€–iteratedFDerivWithin π•œ i g s xβ€– :=
     by
     intro i
     rw [LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_left _ _ hsu hxu]
     rw [LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_right _ _ hs, xu_x]
-    rwa [← xu_x] at hx 
+    rwa [← xu_x] at hx
   have NBu :
     β€–iteratedFDerivWithin π•œ n (fun y => Bu (fu y) (gu y)) su xuβ€– =
       β€–iteratedFDerivWithin π•œ n (fun y => B (f y) (g y)) s xβ€– :=
@@ -3128,7 +3128,7 @@ theorem ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear (B : E β†’L
     rw [Bu_eq]
     rw [LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_left _ _ hsu hxu]
     rw [LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_right _ _ hs, xu_x]
-    rwa [← xu_x] at hx 
+    rwa [← xu_x] at hx
   -- state the bound for the lifted objects, and deduce the original bound from it.
   have :
     β€–iteratedFDerivWithin π•œ n (fun y => Bu (fu y) (gu y)) su xuβ€– ≀
@@ -3137,7 +3137,7 @@ theorem ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear (B : E β†’L
           (n.choose i : ℝ) * β€–iteratedFDerivWithin π•œ i fu su xuβ€– *
             β€–iteratedFDerivWithin π•œ (n - i) gu su xuβ€– :=
     Bu.norm_iterated_fderiv_within_le_of_bilinear_aux hfu hgu hsu hxu
-  simp only [Nfu, Ngu, NBu] at this 
+  simp only [Nfu, Ngu, NBu] at this
   apply this.trans (mul_le_mul_of_nonneg_right Bu_le _)
   exact Finset.sum_nonneg' fun i => by positivity
 #align continuous_linear_map.norm_iterated_fderiv_within_le_of_bilinear ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear
@@ -3302,7 +3302,7 @@ theorem norm_iteratedFDerivWithin_comp_le_aux {Fu Gu : Type u} [NormedAddCommGro
       β€–iteratedFDerivWithin π•œ i (fderivWithin π•œ g t ∘ f) s xβ€– ≀ i ! * C * D ^ i :=
     by
     intro i hi
-    simp only [Finset.mem_range_succ_iff] at hi 
+    simp only [Finset.mem_range_succ_iff] at hi
     apply IH i hi
     apply hf.of_le (Nat.cast_le.2 (hi.trans n.le_succ))
     Β· intro j hj h'j
@@ -3443,7 +3443,7 @@ theorem norm_iteratedFDerivWithin_comp_le {g : F β†’ G} {f : E β†’ F} {n : β„•}
     by
     intro i
     rw [LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_left _ _ hs hx]
-  simp_rw [← Nfu] at hD 
+  simp_rw [← Nfu] at hD
   have Ngu : βˆ€ i, β€–iteratedFDerivWithin π•œ i gu tu (fu x)β€– = β€–iteratedFDerivWithin π•œ i g t (f x)β€– :=
     by
     intro i
@@ -3451,7 +3451,7 @@ theorem norm_iteratedFDerivWithin_comp_le {g : F β†’ G} {f : E β†’ F} {n : β„•}
     rw [LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_right _ _ ht, Ffu]
     rw [Ffu]
     exact hst hx
-  simp_rw [← Ngu] at hC 
+  simp_rw [← Ngu] at hC
   have Nfgu : β€–iteratedFDerivWithin π•œ n (g ∘ f) s xβ€– = β€–iteratedFDerivWithin π•œ n (gu ∘ fu) s xβ€– :=
     by
     have : gu ∘ fu = isoG.symm ∘ g ∘ f := by
@@ -3523,7 +3523,7 @@ theorem norm_iteratedFDerivWithin_clm_apply_const {f : E β†’ F β†’L[π•œ] G} {c
   by
   let g : (F β†’L[π•œ] G) β†’L[π•œ] G := ContinuousLinearMap.apply π•œ G c
   have h := g.norm_comp_continuous_multilinear_map_le (iteratedFDerivWithin π•œ n f s x)
-  rw [← g.iterated_fderiv_within_comp_left hf hs hx hn] at h 
+  rw [← g.iterated_fderiv_within_comp_left hf hs hx hn] at h
   refine' h.trans (mul_le_mul_of_nonneg_right _ (norm_nonneg _))
   refine' g.op_norm_le_bound (norm_nonneg _) fun f => _
   rw [ContinuousLinearMap.apply_apply, mul_comm]
Diff
@@ -2960,7 +2960,7 @@ theorem ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear_aux {Du Eu
   induction' n with n IH generalizing Eu Fu Gu
   Β· simp only [← mul_assoc, norm_iteratedFDerivWithin_zero, Finset.range_one, Finset.sum_singleton,
       Nat.choose_self, algebraMap.coe_one, one_mul]
-    apply ((B (f x)).le_op_norm (g x)).trans
+    apply ((B (f x)).le_opNorm (g x)).trans
     apply mul_le_mul_of_nonneg_right _ (norm_nonneg _)
     exact B.le_op_norm (f x)
   Β· have In : (n : β„•βˆž) + 1 ≀ n.succ := by simp only [Nat.cast_succ, le_refl]
@@ -3087,15 +3087,15 @@ theorem ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear (B : E β†’L
   -- All norms are preserved by the lifting process.
   have Bu_le : β€–Buβ€– ≀ β€–Bβ€– :=
     by
-    refine' ContinuousLinearMap.op_norm_le_bound _ (norm_nonneg _) fun y => _
-    refine' ContinuousLinearMap.op_norm_le_bound _ (by positivity) fun x => _
+    refine' ContinuousLinearMap.opNorm_le_bound _ (norm_nonneg _) fun y => _
+    refine' ContinuousLinearMap.opNorm_le_bound _ (by positivity) fun x => _
     simp only [Bu, ContinuousLinearMap.compL_apply, ContinuousLinearMap.coe_comp',
       Function.comp_apply, LinearIsometryEquiv.coe_coe'', ContinuousLinearMap.flip_apply,
       LinearIsometryEquiv.norm_map]
     calc
-      β€–B (isoE y) (isoF x)β€– ≀ β€–B (isoE y)β€– * β€–isoF xβ€– := ContinuousLinearMap.le_op_norm _ _
+      β€–B (isoE y) (isoF x)β€– ≀ β€–B (isoE y)β€– * β€–isoF xβ€– := ContinuousLinearMap.le_opNorm _ _
       _ ≀ β€–Bβ€– * β€–isoE yβ€– * β€–isoF xβ€– :=
-        (mul_le_mul_of_nonneg_right (ContinuousLinearMap.le_op_norm _ _) (norm_nonneg _))
+        (mul_le_mul_of_nonneg_right (ContinuousLinearMap.le_opNorm _ _) (norm_nonneg _))
       _ = β€–Bβ€– * β€–yβ€– * β€–xβ€– := by simp only [LinearIsometryEquiv.norm_map]
   let su := isoD ⁻¹' s
   have hsu : UniqueDiffOn π•œ su := isoD.to_continuous_linear_equiv.unique_diff_on_preimage_iff.2 hs
@@ -3214,7 +3214,7 @@ theorem norm_iteratedFDerivWithin_smul_le {f : E β†’ π•œ'} {g : E β†’ F} {N : 
           β€–iteratedFDerivWithin π•œ (n - i) g s xβ€– :=
   (ContinuousLinearMap.lsmul π•œ π•œ' :
         π•œ' β†’L[π•œ] F β†’L[π•œ] F).norm_iteratedFDerivWithin_le_of_bilinear_of_le_one
-    hf hg hs hx hn ContinuousLinearMap.op_norm_lsmul_le
+    hf hg hs hx hn ContinuousLinearMap.opNorm_lsmul_le
 #align norm_iterated_fderiv_within_smul_le norm_iteratedFDerivWithin_smul_le
 -/
 
@@ -3225,7 +3225,7 @@ theorem norm_iteratedFDeriv_smul_le {f : E β†’ π•œ'} {g : E β†’ F} {N : β„•βˆž}
       βˆ‘ i in Finset.range (n + 1),
         (n.choose i : ℝ) * β€–iteratedFDeriv π•œ i f xβ€– * β€–iteratedFDeriv π•œ (n - i) g xβ€– :=
   (ContinuousLinearMap.lsmul π•œ π•œ' : π•œ' β†’L[π•œ] F β†’L[π•œ] F).norm_iteratedFDeriv_le_of_bilinear_of_le_one
-    hf hg x hn ContinuousLinearMap.op_norm_lsmul_le
+    hf hg x hn ContinuousLinearMap.opNorm_lsmul_le
 #align norm_iterated_fderiv_smul_le norm_iteratedFDeriv_smul_le
 -/
 
@@ -3245,7 +3245,7 @@ theorem norm_iteratedFDerivWithin_mul_le {f : E β†’ A} {g : E β†’ A} {N : β„•βˆž
           β€–iteratedFDerivWithin π•œ (n - i) g s xβ€– :=
   (ContinuousLinearMap.mul π•œ A :
         A β†’L[π•œ] A β†’L[π•œ] A).norm_iteratedFDerivWithin_le_of_bilinear_of_le_one
-    hf hg hs hx hn (ContinuousLinearMap.op_norm_mul_le _ _)
+    hf hg hs hx hn (ContinuousLinearMap.opNorm_mul_le _ _)
 #align norm_iterated_fderiv_within_mul_le norm_iteratedFDerivWithin_mul_le
 -/
 
@@ -3494,8 +3494,8 @@ theorem norm_iteratedFDerivWithin_clm_apply {f : E β†’ F β†’L[π•œ] G} {g : E 
   let B : (F β†’L[π•œ] G) β†’L[π•œ] F β†’L[π•œ] G := ContinuousLinearMap.flip (ContinuousLinearMap.apply π•œ G)
   have hB : β€–Bβ€– ≀ 1 :=
     by
-    simp only [ContinuousLinearMap.op_norm_flip, ContinuousLinearMap.apply]
-    refine' ContinuousLinearMap.op_norm_le_bound _ zero_le_one fun f => _
+    simp only [ContinuousLinearMap.opNorm_flip, ContinuousLinearMap.apply]
+    refine' ContinuousLinearMap.opNorm_le_bound _ zero_le_one fun f => _
     simp only [ContinuousLinearMap.coe_id', id.def, one_mul]
   exact B.norm_iterated_fderiv_within_le_of_bilinear_of_le_one hf hg hs hx hn hB
 #align norm_iterated_fderiv_within_clm_apply norm_iteratedFDerivWithin_clm_apply
Diff
@@ -1806,7 +1806,12 @@ theorem ContDiff.sub {f g : E β†’ F} (hf : ContDiff π•œ n f) (hg : ContDiff 
 #print ContDiffWithinAt.sum /-
 theorem ContDiffWithinAt.sum {ΞΉ : Type _} {f : ΞΉ β†’ E β†’ F} {s : Finset ΞΉ} {t : Set E} {x : E}
     (h : βˆ€ i ∈ s, ContDiffWithinAt π•œ n (fun x => f i x) t x) :
-    ContDiffWithinAt π•œ n (fun x => βˆ‘ i in s, f i x) t x := by classical
+    ContDiffWithinAt π•œ n (fun x => βˆ‘ i in s, f i x) t x := by
+  classical
+  induction' s using Finset.induction_on with i s is IH
+  Β· simp [contDiffWithinAt_const]
+  Β· simp only [is, Finset.sum_insert, not_false_iff]
+    exact (h _ (Finset.mem_insert_self i s)).add (IH fun j hj => h _ (Finset.mem_insert_of_mem hj))
 #align cont_diff_within_at.sum ContDiffWithinAt.sum
 -/
 
Diff
@@ -1806,12 +1806,7 @@ theorem ContDiff.sub {f g : E β†’ F} (hf : ContDiff π•œ n f) (hg : ContDiff 
 #print ContDiffWithinAt.sum /-
 theorem ContDiffWithinAt.sum {ΞΉ : Type _} {f : ΞΉ β†’ E β†’ F} {s : Finset ΞΉ} {t : Set E} {x : E}
     (h : βˆ€ i ∈ s, ContDiffWithinAt π•œ n (fun x => f i x) t x) :
-    ContDiffWithinAt π•œ n (fun x => βˆ‘ i in s, f i x) t x := by
-  classical
-  induction' s using Finset.induction_on with i s is IH
-  Β· simp [contDiffWithinAt_const]
-  Β· simp only [is, Finset.sum_insert, not_false_iff]
-    exact (h _ (Finset.mem_insert_self i s)).add (IH fun j hj => h _ (Finset.mem_insert_of_mem hj))
+    ContDiffWithinAt π•œ n (fun x => βˆ‘ i in s, f i x) t x := by classical
 #align cont_diff_within_at.sum ContDiffWithinAt.sum
 -/
 
Diff
@@ -3393,7 +3393,7 @@ theorem norm_iteratedFDerivWithin_comp_le_aux {Fu Gu : Type u} [NormedAddCommGro
         simpa only [Ne.def, Nat.cast_eq_zero] using i.factorial_ne_zero
       Β· rw [← pow_add]
         congr 1
-        rw [Nat.add_succ, Nat.succ_inj']
+        rw [Nat.add_succ, Nat.succ_inj]
         exact Nat.add_sub_of_le (Finset.mem_range_succ_iff.1 hi)
     _ ≀ βˆ‘ i in Finset.range (n + 1), (n ! : ℝ) * 1 * C * D ^ (n + 1) * 1 :=
       by
Diff
@@ -2372,7 +2372,7 @@ section FunctionInverse
 
 open ContinuousLinearMap
 
-#print LocalHomeomorph.contDiffAt_symm /-
+#print PartialHomeomorph.contDiffAt_symm /-
 /-- If `f` is a local homeomorphism and the point `a` is in its target,
 and if `f` is `n` times continuously differentiable at `f.symm a`,
 and if the derivative at `f.symm a` is a continuous linear equivalence,
@@ -2380,7 +2380,7 @@ then `f.symm` is `n` times continuously differentiable at the point `a`.
 
 This is one of the easy parts of the inverse function theorem: it assumes that we already have
 an inverse function. -/
-theorem LocalHomeomorph.contDiffAt_symm [CompleteSpace E] (f : LocalHomeomorph E F)
+theorem PartialHomeomorph.contDiffAt_symm [CompleteSpace E] (f : PartialHomeomorph E F)
     {fβ‚€' : E ≃L[π•œ] F} {a : F} (ha : a ∈ f.target)
     (hfβ‚€' : HasFDerivAt f (fβ‚€' : E β†’L[π•œ] F) (f.symm a)) (hf : ContDiffAt π•œ n f (f.symm a)) :
     ContDiffAt π•œ n f.symm a :=
@@ -2430,7 +2430,7 @@ theorem LocalHomeomorph.contDiffAt_symm [CompleteSpace E] (f : LocalHomeomorph E
   Β· refine' cont_diff_at_top.mpr _
     intro n
     exact Itop n (cont_diff_at_top.mp hf n)
-#align local_homeomorph.cont_diff_at_symm LocalHomeomorph.contDiffAt_symm
+#align local_homeomorph.cont_diff_at_symm PartialHomeomorph.contDiffAt_symm
 -/
 
 #print Homeomorph.contDiff_symm /-
@@ -2444,22 +2444,22 @@ theorem Homeomorph.contDiff_symm [CompleteSpace E] (f : E β‰ƒβ‚œ F) {fβ‚€' : E 
     (hfβ‚€' : βˆ€ a, HasFDerivAt f (fβ‚€' a : E β†’L[π•œ] F) a) (hf : ContDiff π•œ n (f : E β†’ F)) :
     ContDiff π•œ n (f.symm : F β†’ E) :=
   contDiff_iff_contDiffAt.2 fun x =>
-    f.toLocalHomeomorph.contDiffAt_symm (mem_univ x) (hfβ‚€' _) hf.ContDiffAt
+    f.toPartialHomeomorph.contDiffAt_symm (mem_univ x) (hfβ‚€' _) hf.ContDiffAt
 #align homeomorph.cont_diff_symm Homeomorph.contDiff_symm
 -/
 
-#print LocalHomeomorph.contDiffAt_symm_deriv /-
+#print PartialHomeomorph.contDiffAt_symm_deriv /-
 /-- Let `f` be a local homeomorphism of a nontrivially normed field, let `a` be a point in its
 target. if `f` is `n` times continuously differentiable at `f.symm a`, and if the derivative at
 `f.symm a` is nonzero, then `f.symm` is `n` times continuously differentiable at the point `a`.
 
 This is one of the easy parts of the inverse function theorem: it assumes that we already have
 an inverse function. -/
-theorem LocalHomeomorph.contDiffAt_symm_deriv [CompleteSpace π•œ] (f : LocalHomeomorph π•œ π•œ)
+theorem PartialHomeomorph.contDiffAt_symm_deriv [CompleteSpace π•œ] (f : PartialHomeomorph π•œ π•œ)
     {fβ‚€' a : π•œ} (hβ‚€ : fβ‚€' β‰  0) (ha : a ∈ f.target) (hfβ‚€' : HasDerivAt f fβ‚€' (f.symm a))
     (hf : ContDiffAt π•œ n f (f.symm a)) : ContDiffAt π•œ n f.symm a :=
   f.contDiffAt_symm ha (hfβ‚€'.hasFDerivAt_equiv hβ‚€) hf
-#align local_homeomorph.cont_diff_at_symm_deriv LocalHomeomorph.contDiffAt_symm_deriv
+#align local_homeomorph.cont_diff_at_symm_deriv PartialHomeomorph.contDiffAt_symm_deriv
 -/
 
 #print Homeomorph.contDiff_symm_deriv /-
@@ -2473,7 +2473,7 @@ theorem Homeomorph.contDiff_symm_deriv [CompleteSpace π•œ] (f : π•œ β‰ƒβ‚œ 
     (hβ‚€ : βˆ€ x, f' x β‰  0) (hf' : βˆ€ x, HasDerivAt f (f' x) x) (hf : ContDiff π•œ n (f : π•œ β†’ π•œ)) :
     ContDiff π•œ n (f.symm : π•œ β†’ π•œ) :=
   contDiff_iff_contDiffAt.2 fun x =>
-    f.toLocalHomeomorph.contDiffAt_symm_deriv (hβ‚€ _) (mem_univ x) (hf' _) hf.ContDiffAt
+    f.toPartialHomeomorph.contDiffAt_symm_deriv (hβ‚€ _) (mem_univ x) (hf' _) hf.ContDiffAt
 #align homeomorph.cont_diff_symm_deriv Homeomorph.contDiff_symm_deriv
 -/
 
Diff
@@ -2738,17 +2738,17 @@ theorem contDiffOn_succ_iff_derivWithin {n : β„•} (hs : UniqueDiffOn π•œ sβ‚‚)
 -/
 
 /- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:73:14: unsupported tactic `congrm #[[expr «expr ∧ »(_, _)]] -/
-#print contDiffOn_succ_iff_deriv_of_open /-
+#print contDiffOn_succ_iff_deriv_of_isOpen /-
 /-- A function is `C^(n + 1)` on an open domain if and only if it is
 differentiable there, and its derivative (formulated with `deriv`) is `C^n`. -/
-theorem contDiffOn_succ_iff_deriv_of_open {n : β„•} (hs : IsOpen sβ‚‚) :
+theorem contDiffOn_succ_iff_deriv_of_isOpen {n : β„•} (hs : IsOpen sβ‚‚) :
     ContDiffOn π•œ (n + 1 : β„•) fβ‚‚ sβ‚‚ ↔ DifferentiableOn π•œ fβ‚‚ sβ‚‚ ∧ ContDiffOn π•œ n (deriv fβ‚‚) sβ‚‚ :=
   by
   rw [contDiffOn_succ_iff_derivWithin hs.unique_diff_on]
   trace
     "./././Mathport/Syntax/Translate/Tactic/Builtin.lean:73:14: unsupported tactic `congrm #[[expr «expr ∧ »(_, _)]]"
-  exact contDiffOn_congr fun _ => derivWithin_of_open hs
-#align cont_diff_on_succ_iff_deriv_of_open contDiffOn_succ_iff_deriv_of_open
+  exact contDiffOn_congr fun _ => derivWithin_of_isOpen hs
+#align cont_diff_on_succ_iff_deriv_of_open contDiffOn_succ_iff_deriv_of_isOpen
 -/
 
 #print contDiffOn_top_iff_derivWithin /-
@@ -2771,17 +2771,17 @@ theorem contDiffOn_top_iff_derivWithin (hs : UniqueDiffOn π•œ sβ‚‚) :
 -/
 
 /- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:73:14: unsupported tactic `congrm #[[expr «expr ∧ »(_, _)]] -/
-#print contDiffOn_top_iff_deriv_of_open /-
+#print contDiffOn_top_iff_deriv_of_isOpen /-
 /-- A function is `C^∞` on an open domain if and only if it is differentiable
 there, and its derivative (formulated with `deriv`) is `C^∞`. -/
-theorem contDiffOn_top_iff_deriv_of_open (hs : IsOpen sβ‚‚) :
+theorem contDiffOn_top_iff_deriv_of_isOpen (hs : IsOpen sβ‚‚) :
     ContDiffOn π•œ ∞ fβ‚‚ sβ‚‚ ↔ DifferentiableOn π•œ fβ‚‚ sβ‚‚ ∧ ContDiffOn π•œ ∞ (deriv fβ‚‚) sβ‚‚ :=
   by
   rw [contDiffOn_top_iff_derivWithin hs.unique_diff_on]
   trace
     "./././Mathport/Syntax/Translate/Tactic/Builtin.lean:73:14: unsupported tactic `congrm #[[expr «expr ∧ »(_, _)]]"
-  exact contDiffOn_congr fun _ => derivWithin_of_open hs
-#align cont_diff_on_top_iff_deriv_of_open contDiffOn_top_iff_deriv_of_open
+  exact contDiffOn_congr fun _ => derivWithin_of_isOpen hs
+#align cont_diff_on_top_iff_deriv_of_open contDiffOn_top_iff_deriv_of_isOpen
 -/
 
 #print ContDiffOn.derivWithin /-
@@ -2798,11 +2798,11 @@ theorem ContDiffOn.derivWithin (hf : ContDiffOn π•œ n fβ‚‚ sβ‚‚) (hs : UniqueDi
 #align cont_diff_on.deriv_within ContDiffOn.derivWithin
 -/
 
-#print ContDiffOn.deriv_of_open /-
-theorem ContDiffOn.deriv_of_open (hf : ContDiffOn π•œ n fβ‚‚ sβ‚‚) (hs : IsOpen sβ‚‚) (hmn : m + 1 ≀ n) :
+#print ContDiffOn.deriv_of_isOpen /-
+theorem ContDiffOn.deriv_of_isOpen (hf : ContDiffOn π•œ n fβ‚‚ sβ‚‚) (hs : IsOpen sβ‚‚) (hmn : m + 1 ≀ n) :
     ContDiffOn π•œ m (deriv fβ‚‚) sβ‚‚ :=
-  (hf.derivWithin hs.UniqueDiffOn hmn).congr fun x hx => (derivWithin_of_open hs hx).symm
-#align cont_diff_on.deriv_of_open ContDiffOn.deriv_of_open
+  (hf.derivWithin hs.UniqueDiffOn hmn).congr fun x hx => (derivWithin_of_isOpen hs hx).symm
+#align cont_diff_on.deriv_of_open ContDiffOn.deriv_of_isOpen
 -/
 
 #print ContDiffOn.continuousOn_derivWithin /-
@@ -2812,11 +2812,11 @@ theorem ContDiffOn.continuousOn_derivWithin (h : ContDiffOn π•œ n fβ‚‚ sβ‚‚) (h
 #align cont_diff_on.continuous_on_deriv_within ContDiffOn.continuousOn_derivWithin
 -/
 
-#print ContDiffOn.continuousOn_deriv_of_open /-
-theorem ContDiffOn.continuousOn_deriv_of_open (h : ContDiffOn π•œ n fβ‚‚ sβ‚‚) (hs : IsOpen sβ‚‚)
+#print ContDiffOn.continuousOn_deriv_of_isOpen /-
+theorem ContDiffOn.continuousOn_deriv_of_isOpen (h : ContDiffOn π•œ n fβ‚‚ sβ‚‚) (hs : IsOpen sβ‚‚)
     (hn : 1 ≀ n) : ContinuousOn (deriv fβ‚‚) sβ‚‚ :=
-  ((contDiffOn_succ_iff_deriv_of_open hs).1 (h.of_le hn)).2.ContinuousOn
-#align cont_diff_on.continuous_on_deriv_of_open ContDiffOn.continuousOn_deriv_of_open
+  ((contDiffOn_succ_iff_deriv_of_isOpen hs).1 (h.of_le hn)).2.ContinuousOn
+#align cont_diff_on.continuous_on_deriv_of_open ContDiffOn.continuousOn_deriv_of_isOpen
 -/
 
 #print contDiff_succ_iff_deriv /-
@@ -2824,7 +2824,7 @@ theorem ContDiffOn.continuousOn_deriv_of_open (h : ContDiffOn π•œ n fβ‚‚ sβ‚‚)
   and its derivative (formulated in terms of `deriv`) is `C^n`. -/
 theorem contDiff_succ_iff_deriv {n : β„•} :
     ContDiff π•œ (n + 1 : β„•) fβ‚‚ ↔ Differentiable π•œ fβ‚‚ ∧ ContDiff π•œ n (deriv fβ‚‚) := by
-  simp only [← contDiffOn_univ, contDiffOn_succ_iff_deriv_of_open, isOpen_univ,
+  simp only [← contDiffOn_univ, contDiffOn_succ_iff_deriv_of_isOpen, isOpen_univ,
     differentiableOn_univ]
 #align cont_diff_succ_iff_deriv contDiff_succ_iff_deriv
 -/
Diff
@@ -3,11 +3,11 @@ Copyright (c) 2019 SΓ©bastien GouΓ«zel. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: SΓ©bastien GouΓ«zel, Floris van Doorn
 -/
-import Mathbin.Analysis.Calculus.ContDiffDef
-import Mathbin.Analysis.Calculus.Deriv.Inverse
-import Mathbin.Analysis.Calculus.MeanValue
-import Mathbin.Analysis.NormedSpace.FiniteDimension
-import Mathbin.Data.Nat.Choose.Cast
+import Analysis.Calculus.ContDiffDef
+import Analysis.Calculus.Deriv.Inverse
+import Analysis.Calculus.MeanValue
+import Analysis.NormedSpace.FiniteDimension
+import Data.Nat.Choose.Cast
 
 #align_import analysis.calculus.cont_diff from "leanprover-community/mathlib"@"575b4ea3738b017e30fb205cb9b4a8742e5e82b6"
 
Diff
@@ -1201,14 +1201,14 @@ theorem ContDiffOn.clm_comp {g : X β†’ F β†’L[π•œ] G} {f : X β†’ E β†’L[π•œ] F
 #print ContDiff.clm_apply /-
 theorem ContDiff.clm_apply {f : E β†’ F β†’L[π•œ] G} {g : E β†’ F} {n : β„•βˆž} (hf : ContDiff π•œ n f)
     (hg : ContDiff π•œ n g) : ContDiff π•œ n fun x => (f x) (g x) :=
-  isBoundedBilinearMapApply.ContDiff.compβ‚‚ hf hg
+  isBoundedBilinearMap_apply.ContDiff.compβ‚‚ hf hg
 #align cont_diff.clm_apply ContDiff.clm_apply
 -/
 
 #print ContDiffOn.clm_apply /-
 theorem ContDiffOn.clm_apply {f : E β†’ F β†’L[π•œ] G} {g : E β†’ F} {n : β„•βˆž} (hf : ContDiffOn π•œ n f s)
     (hg : ContDiffOn π•œ n g s) : ContDiffOn π•œ n (fun x => (f x) (g x)) s :=
-  isBoundedBilinearMapApply.ContDiff.comp_contDiff_onβ‚‚ hf hg
+  isBoundedBilinearMap_apply.ContDiff.comp_contDiff_onβ‚‚ hf hg
 #align cont_diff_on.clm_apply ContDiffOn.clm_apply
 -/
 
Diff
@@ -2,11 +2,6 @@
 Copyright (c) 2019 SΓ©bastien GouΓ«zel. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: SΓ©bastien GouΓ«zel, Floris van Doorn
-
-! This file was ported from Lean 3 source module analysis.calculus.cont_diff
-! leanprover-community/mathlib commit 575b4ea3738b017e30fb205cb9b4a8742e5e82b6
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Analysis.Calculus.ContDiffDef
 import Mathbin.Analysis.Calculus.Deriv.Inverse
@@ -14,6 +9,8 @@ import Mathbin.Analysis.Calculus.MeanValue
 import Mathbin.Analysis.NormedSpace.FiniteDimension
 import Mathbin.Data.Nat.Choose.Cast
 
+#align_import analysis.calculus.cont_diff from "leanprover-community/mathlib"@"575b4ea3738b017e30fb205cb9b4a8742e5e82b6"
+
 /-!
 # Higher differentiability of usual operations
 
Diff
@@ -138,7 +138,7 @@ theorem iteratedFDeriv_zero_fun {n : β„•} : (iteratedFDeriv π•œ n fun x : E =>
   by
   induction' n with n IH
   Β· ext m; simp
-  Β· ext (x m)
+  Β· ext x m
     rw [iteratedFDeriv_succ_apply_left, IH]
     change (fderiv π•œ (fun x : E => (0 : E[Γ—n]β†’L[π•œ] F)) x : E β†’ E[Γ—n]β†’L[π•œ] F) (m 0) (tail m) = _
     rw [fderiv_const]
@@ -217,7 +217,7 @@ theorem contDiffOn_of_subsingleton [Subsingleton F] : ContDiffOn π•œ n f s := b
 #print iteratedFDeriv_succ_const /-
 theorem iteratedFDeriv_succ_const (n : β„•) (c : F) : (iteratedFDeriv π•œ (n + 1) fun y : E => c) = 0 :=
   by
-  ext (x m)
+  ext x m
   simp only [iteratedFDeriv_succ_apply_right, fderiv_const, Pi.zero_apply, iteratedFDeriv_zero_fun,
     ContinuousMultilinearMap.zero_apply, ContinuousLinearMap.zero_apply]
 #align iterated_fderiv_succ_const iteratedFDeriv_succ_const
@@ -535,7 +535,7 @@ theorem HasFTaylorSeriesUpToOn.compContinuousLinearMap (hf : HasFTaylorSeriesUpT
     convert
       (hA m).HasFDerivAt.comp_hasFDerivWithinAt x
         ((hf.fderiv_within m hm (g x) hx).comp x g.has_fderiv_within_at (subset.refl _))
-    ext (y v)
+    ext y v
     change p (g x) (Nat.succ m) (g ∘ cons y v) = p (g x) m.succ (cons (g y) (g ∘ v))
     rw [comp_cons]
   Β· intro m hm
Diff
@@ -49,7 +49,6 @@ noncomputable section
 
 open scoped Classical BigOperators NNReal Nat
 
--- mathport name: «expr∞»
 local notation "∞" => (⊀ : β„•βˆž)
 
 universe u v w uD uE uF uG
@@ -59,6 +58,7 @@ attribute [local instance 1001] NormedAddCommGroup.toAddCommGroup NormedSpace.to
 
 namespace Finset
 
+#print Finset.sum_choose_succ_mul /-
 -- TODO porting note: move the next two lemmas to the file `data.nat.choose.sum`
 /-- The sum of `(n+1).choose i * f i (n+1-i)` can be split into two sums at rank `n`,
 respectively of `n.choose i * f i (n+1-i)` and `n.choose i * f (i+1) (n-i)`. -/
@@ -89,7 +89,9 @@ theorem sum_choose_succ_mul {R : Type _} [Semiring R] (f : β„• β†’ β„• β†’ R) (n
       rw [Finset.sum_add_distrib, ← A]
       abel
 #align finset.sum_choose_succ_mul Finset.sum_choose_succ_mul
+-/
 
+#print Finset.sum_antidiagonal_choose_succ_mul /-
 /-- The sum along the antidiagonal of `(n+1).choose i * f i j` can be split into two sums along the
 antidiagonal at rank `n`, respectively of `n.choose i * f i (j+1)` and `n.choose j * f (i+1) j`. -/
 theorem sum_antidiagonal_choose_succ_mul {R : Type _} [Semiring R] (f : β„• β†’ β„• β†’ R) (n : β„•) :
@@ -113,6 +115,7 @@ theorem sum_antidiagonal_choose_succ_mul {R : Type _} [Semiring R] (f : β„• β†’
     apply Nat.choose_symm_of_eq_add
     rw [← nat.mem_antidiagonal.1 hi, add_comm]
 #align finset.sum_antidiagonal_choose_succ_mul Finset.sum_antidiagonal_choose_succ_mul
+-/
 
 end Finset
 
@@ -129,6 +132,7 @@ variable {π•œ : Type _} [NontriviallyNormedField π•œ] {D : Type uD} [NormedAdd
 /-! ### Constants -/
 
 
+#print iteratedFDeriv_zero_fun /-
 @[simp]
 theorem iteratedFDeriv_zero_fun {n : β„•} : (iteratedFDeriv π•œ n fun x : E => (0 : F)) = 0 :=
   by
@@ -140,14 +144,18 @@ theorem iteratedFDeriv_zero_fun {n : β„•} : (iteratedFDeriv π•œ n fun x : E =>
     rw [fderiv_const]
     rfl
 #align iterated_fderiv_zero_fun iteratedFDeriv_zero_fun
+-/
 
+#print contDiff_zero_fun /-
 theorem contDiff_zero_fun : ContDiff π•œ n fun x : E => (0 : F) :=
   by
   apply contDiff_of_differentiable_iteratedFDeriv fun m hm => _
   rw [iteratedFDeriv_zero_fun]
   exact differentiable_const (0 : E[Γ—m]β†’L[π•œ] F)
 #align cont_diff_zero_fun contDiff_zero_fun
+-/
 
+#print contDiff_const /-
 /-- Constants are `C^∞`.
 -/
 theorem contDiff_const {c : F} : ContDiff π•œ n fun x : E => c :=
@@ -158,56 +166,76 @@ theorem contDiff_const {c : F} : ContDiff π•œ n fun x : E => c :=
   rw [fderiv_const]
   exact contDiff_zero_fun
 #align cont_diff_const contDiff_const
+-/
 
+#print contDiffOn_const /-
 theorem contDiffOn_const {c : F} {s : Set E} : ContDiffOn π•œ n (fun x : E => c) s :=
   contDiff_const.ContDiffOn
 #align cont_diff_on_const contDiffOn_const
+-/
 
+#print contDiffAt_const /-
 theorem contDiffAt_const {c : F} : ContDiffAt π•œ n (fun x : E => c) x :=
   contDiff_const.ContDiffAt
 #align cont_diff_at_const contDiffAt_const
+-/
 
+#print contDiffWithinAt_const /-
 theorem contDiffWithinAt_const {c : F} : ContDiffWithinAt π•œ n (fun x : E => c) s x :=
   contDiffAt_const.ContDiffWithinAt
 #align cont_diff_within_at_const contDiffWithinAt_const
+-/
 
+#print contDiff_of_subsingleton /-
 @[nontriviality]
 theorem contDiff_of_subsingleton [Subsingleton F] : ContDiff π•œ n f := by
   rw [Subsingleton.elim f fun _ => 0]; exact contDiff_const
 #align cont_diff_of_subsingleton contDiff_of_subsingleton
+-/
 
+#print contDiffAt_of_subsingleton /-
 @[nontriviality]
 theorem contDiffAt_of_subsingleton [Subsingleton F] : ContDiffAt π•œ n f x := by
   rw [Subsingleton.elim f fun _ => 0]; exact contDiffAt_const
 #align cont_diff_at_of_subsingleton contDiffAt_of_subsingleton
+-/
 
+#print contDiffWithinAt_of_subsingleton /-
 @[nontriviality]
 theorem contDiffWithinAt_of_subsingleton [Subsingleton F] : ContDiffWithinAt π•œ n f s x := by
   rw [Subsingleton.elim f fun _ => 0]; exact contDiffWithinAt_const
 #align cont_diff_within_at_of_subsingleton contDiffWithinAt_of_subsingleton
+-/
 
+#print contDiffOn_of_subsingleton /-
 @[nontriviality]
 theorem contDiffOn_of_subsingleton [Subsingleton F] : ContDiffOn π•œ n f s := by
   rw [Subsingleton.elim f fun _ => 0]; exact contDiffOn_const
 #align cont_diff_on_of_subsingleton contDiffOn_of_subsingleton
+-/
 
+#print iteratedFDeriv_succ_const /-
 theorem iteratedFDeriv_succ_const (n : β„•) (c : F) : (iteratedFDeriv π•œ (n + 1) fun y : E => c) = 0 :=
   by
   ext (x m)
   simp only [iteratedFDeriv_succ_apply_right, fderiv_const, Pi.zero_apply, iteratedFDeriv_zero_fun,
     ContinuousMultilinearMap.zero_apply, ContinuousLinearMap.zero_apply]
 #align iterated_fderiv_succ_const iteratedFDeriv_succ_const
+-/
 
+#print iteratedFDeriv_const_of_ne /-
 theorem iteratedFDeriv_const_of_ne {n : β„•} (hn : n β‰  0) (c : F) :
     (iteratedFDeriv π•œ n fun y : E => c) = 0 :=
   by
   cases' Nat.exists_eq_succ_of_ne_zero hn with k hk
   rw [hk, iteratedFDeriv_succ_const]
 #align iterated_fderiv_const_of_ne iteratedFDeriv_const_of_ne
+-/
 
 /-! ### Smoothness of linear functions -/
 
 
+#print IsBoundedLinearMap.contDiff /-
 /-- Unbundled bounded linear functions are `C^∞`.
 -/
 theorem IsBoundedLinearMap.contDiff (hf : IsBoundedLinearMap π•œ f) : ContDiff π•œ n f :=
@@ -218,41 +246,59 @@ theorem IsBoundedLinearMap.contDiff (hf : IsBoundedLinearMap π•œ f) : ContDiff
   simp_rw [hf.fderiv]
   exact contDiff_const
 #align is_bounded_linear_map.cont_diff IsBoundedLinearMap.contDiff
+-/
 
+#print ContinuousLinearMap.contDiff /-
 theorem ContinuousLinearMap.contDiff (f : E β†’L[π•œ] F) : ContDiff π•œ n f :=
   f.IsBoundedLinearMap.ContDiff
 #align continuous_linear_map.cont_diff ContinuousLinearMap.contDiff
+-/
 
+#print ContinuousLinearEquiv.contDiff /-
 theorem ContinuousLinearEquiv.contDiff (f : E ≃L[π•œ] F) : ContDiff π•œ n f :=
   (f : E β†’L[π•œ] F).ContDiff
 #align continuous_linear_equiv.cont_diff ContinuousLinearEquiv.contDiff
+-/
 
+#print LinearIsometry.contDiff /-
 theorem LinearIsometry.contDiff (f : E β†’β‚—α΅’[π•œ] F) : ContDiff π•œ n f :=
   f.toContinuousLinearMap.ContDiff
 #align linear_isometry.cont_diff LinearIsometry.contDiff
+-/
 
+#print LinearIsometryEquiv.contDiff /-
 theorem LinearIsometryEquiv.contDiff (f : E ≃ₗᡒ[π•œ] F) : ContDiff π•œ n f :=
   (f : E β†’L[π•œ] F).ContDiff
 #align linear_isometry_equiv.cont_diff LinearIsometryEquiv.contDiff
+-/
 
+#print contDiff_id /-
 /-- The identity is `C^∞`.
 -/
 theorem contDiff_id : ContDiff π•œ n (id : E β†’ E) :=
   IsBoundedLinearMap.id.ContDiff
 #align cont_diff_id contDiff_id
+-/
 
+#print contDiffWithinAt_id /-
 theorem contDiffWithinAt_id {s x} : ContDiffWithinAt π•œ n (id : E β†’ E) s x :=
   contDiff_id.ContDiffWithinAt
 #align cont_diff_within_at_id contDiffWithinAt_id
+-/
 
+#print contDiffAt_id /-
 theorem contDiffAt_id {x} : ContDiffAt π•œ n (id : E β†’ E) x :=
   contDiff_id.ContDiffAt
 #align cont_diff_at_id contDiffAt_id
+-/
 
+#print contDiffOn_id /-
 theorem contDiffOn_id {s} : ContDiffOn π•œ n (id : E β†’ E) s :=
   contDiff_id.ContDiffOn
 #align cont_diff_on_id contDiffOn_id
+-/
 
+#print IsBoundedBilinearMap.contDiff /-
 /-- Bilinear functions are `C^∞`.
 -/
 theorem IsBoundedBilinearMap.contDiff (hb : IsBoundedBilinearMap π•œ b) : ContDiff π•œ n b :=
@@ -263,7 +309,9 @@ theorem IsBoundedBilinearMap.contDiff (hb : IsBoundedBilinearMap π•œ b) : ContD
   simp [hb.fderiv]
   exact hb.is_bounded_linear_map_deriv.cont_diff
 #align is_bounded_bilinear_map.cont_diff IsBoundedBilinearMap.contDiff
+-/
 
+#print HasFTaylorSeriesUpToOn.continuousLinearMap_comp /-
 /-- If `f` admits a Taylor series `p` in a set `s`, and `g` is linear, then `g ∘ f` admits a Taylor
 series whose `k`-th term is given by `g ∘ (p k)`. -/
 theorem HasFTaylorSeriesUpToOn.continuousLinearMap_comp (g : F β†’L[π•œ] G)
@@ -279,7 +327,9 @@ theorem HasFTaylorSeriesUpToOn.continuousLinearMap_comp (g : F β†’L[π•œ] G)
   Β· intro m hm
     convert (L m).Continuous.comp_continuousOn (hf.cont m hm)
 #align has_ftaylor_series_up_to_on.continuous_linear_map_comp HasFTaylorSeriesUpToOn.continuousLinearMap_comp
+-/
 
+#print ContDiffWithinAt.continuousLinearMap_comp /-
 /-- Composition by continuous linear maps on the left preserves `C^n` functions in a domain
 at a point. -/
 theorem ContDiffWithinAt.continuousLinearMap_comp (g : F β†’L[π•œ] G)
@@ -289,25 +339,33 @@ theorem ContDiffWithinAt.continuousLinearMap_comp (g : F β†’L[π•œ] G)
   rcases hf m hm with ⟨u, hu, p, hp⟩
   exact ⟨u, hu, _, hp.continuous_linear_map_comp g⟩
 #align cont_diff_within_at.continuous_linear_map_comp ContDiffWithinAt.continuousLinearMap_comp
+-/
 
+#print ContDiffAt.continuousLinearMap_comp /-
 /-- Composition by continuous linear maps on the left preserves `C^n` functions in a domain
 at a point. -/
 theorem ContDiffAt.continuousLinearMap_comp (g : F β†’L[π•œ] G) (hf : ContDiffAt π•œ n f x) :
     ContDiffAt π•œ n (g ∘ f) x :=
   ContDiffWithinAt.continuousLinearMap_comp g hf
 #align cont_diff_at.continuous_linear_map_comp ContDiffAt.continuousLinearMap_comp
+-/
 
+#print ContDiffOn.continuousLinearMap_comp /-
 /-- Composition by continuous linear maps on the left preserves `C^n` functions on domains. -/
 theorem ContDiffOn.continuousLinearMap_comp (g : F β†’L[π•œ] G) (hf : ContDiffOn π•œ n f s) :
     ContDiffOn π•œ n (g ∘ f) s := fun x hx => (hf x hx).continuousLinearMap_comp g
 #align cont_diff_on.continuous_linear_map_comp ContDiffOn.continuousLinearMap_comp
+-/
 
+#print ContDiff.continuousLinearMap_comp /-
 /-- Composition by continuous linear maps on the left preserves `C^n` functions. -/
 theorem ContDiff.continuousLinearMap_comp {f : E β†’ F} (g : F β†’L[π•œ] G) (hf : ContDiff π•œ n f) :
     ContDiff π•œ n fun x => g (f x) :=
   contDiffOn_univ.1 <| ContDiffOn.continuousLinearMap_comp _ (contDiffOn_univ.2 hf)
 #align cont_diff.continuous_linear_map_comp ContDiff.continuousLinearMap_comp
+-/
 
+#print ContinuousLinearMap.iteratedFDerivWithin_comp_left /-
 /-- The iterated derivative within a set of the composition with a linear map on the left is
 obtained by applying the linear map to the iterated derivative. -/
 theorem ContinuousLinearMap.iteratedFDerivWithin_comp_left {f : E β†’ F} (g : F β†’L[π•œ] G)
@@ -317,7 +375,9 @@ theorem ContinuousLinearMap.iteratedFDerivWithin_comp_left {f : E β†’ F} (g : F
   (((hf.ftaylorSeriesWithin hs).continuousLinearMap_comp g).eq_ftaylor_series_of_uniqueDiffOn hi hs
       hx).symm
 #align continuous_linear_map.iterated_fderiv_within_comp_left ContinuousLinearMap.iteratedFDerivWithin_comp_left
+-/
 
+#print ContinuousLinearMap.iteratedFDeriv_comp_left /-
 /-- The iterated derivative of the composition with a linear map on the left is
 obtained by applying the linear map to the iterated derivative. -/
 theorem ContinuousLinearMap.iteratedFDeriv_comp_left {f : E β†’ F} (g : F β†’L[π•œ] G)
@@ -327,7 +387,9 @@ theorem ContinuousLinearMap.iteratedFDeriv_comp_left {f : E β†’ F} (g : F β†’L[
   simp only [← iteratedFDerivWithin_univ]
   exact g.iterated_fderiv_within_comp_left hf.cont_diff_on uniqueDiffOn_univ (mem_univ x) hi
 #align continuous_linear_map.iterated_fderiv_comp_left ContinuousLinearMap.iteratedFDeriv_comp_left
+-/
 
+#print ContinuousLinearEquiv.iteratedFDerivWithin_comp_left /-
 /-- The iterated derivative within a set of the composition with a linear equiv on the left is
 obtained by applying the linear equiv to the iterated derivative. This is true without
 differentiability assumptions. -/
@@ -357,7 +419,9 @@ theorem ContinuousLinearEquiv.iteratedFDerivWithin_comp_left (g : F ≃L[π•œ] G
       ContinuousLinearMap.compContinuousMultilinearMap_coe, EmbeddingLike.apply_eq_iff_eq]
     rw [iteratedFDerivWithin_succ_apply_left]
 #align continuous_linear_equiv.iterated_fderiv_within_comp_left ContinuousLinearEquiv.iteratedFDerivWithin_comp_left
+-/
 
+#print LinearIsometry.norm_iteratedFDerivWithin_comp_left /-
 /-- Composition with a linear isometry on the left preserves the norm of the iterated
 derivative within a set. -/
 theorem LinearIsometry.norm_iteratedFDerivWithin_comp_left {f : E β†’ F} (g : F β†’β‚—α΅’[π•œ] G)
@@ -371,7 +435,9 @@ theorem LinearIsometry.norm_iteratedFDerivWithin_comp_left {f : E β†’ F} (g : F
   rw [this]
   apply LinearIsometry.norm_compContinuousMultilinearMap
 #align linear_isometry.norm_iterated_fderiv_within_comp_left LinearIsometry.norm_iteratedFDerivWithin_comp_left
+-/
 
+#print LinearIsometry.norm_iteratedFDeriv_comp_left /-
 /-- Composition with a linear isometry on the left preserves the norm of the iterated
 derivative. -/
 theorem LinearIsometry.norm_iteratedFDeriv_comp_left {f : E β†’ F} (g : F β†’β‚—α΅’[π•œ] G)
@@ -381,7 +447,9 @@ theorem LinearIsometry.norm_iteratedFDeriv_comp_left {f : E β†’ F} (g : F β†’β‚—
   simp only [← iteratedFDerivWithin_univ]
   exact g.norm_iterated_fderiv_within_comp_left hf.cont_diff_on uniqueDiffOn_univ (mem_univ x) hi
 #align linear_isometry.norm_iterated_fderiv_comp_left LinearIsometry.norm_iteratedFDeriv_comp_left
+-/
 
+#print LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_left /-
 /-- Composition with a linear isometry equiv on the left preserves the norm of the iterated
 derivative within a set. -/
 theorem LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_left (g : F ≃ₗᡒ[π•œ] G) (f : E β†’ F)
@@ -395,7 +463,9 @@ theorem LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_left (g : F ≃ₗᡒ
   rw [this]
   apply LinearIsometry.norm_compContinuousMultilinearMap g.to_linear_isometry
 #align linear_isometry_equiv.norm_iterated_fderiv_within_comp_left LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_left
+-/
 
+#print LinearIsometryEquiv.norm_iteratedFDeriv_comp_left /-
 /-- Composition with a linear isometry equiv on the left preserves the norm of the iterated
 derivative. -/
 theorem LinearIsometryEquiv.norm_iteratedFDeriv_comp_left (g : F ≃ₗᡒ[π•œ] G) (f : E β†’ F) (x : E)
@@ -404,7 +474,9 @@ theorem LinearIsometryEquiv.norm_iteratedFDeriv_comp_left (g : F ≃ₗᡒ[π•œ]
   rw [← iteratedFDerivWithin_univ, ← iteratedFDerivWithin_univ]
   apply g.norm_iterated_fderiv_within_comp_left f uniqueDiffOn_univ (mem_univ x) i
 #align linear_isometry_equiv.norm_iterated_fderiv_comp_left LinearIsometryEquiv.norm_iteratedFDeriv_comp_left
+-/
 
+#print ContinuousLinearEquiv.comp_contDiffWithinAt_iff /-
 /-- Composition by continuous linear equivs on the left respects higher differentiability at a
 point in a domain. -/
 theorem ContinuousLinearEquiv.comp_contDiffWithinAt_iff (e : F ≃L[π•œ] G) :
@@ -414,27 +486,35 @@ theorem ContinuousLinearEquiv.comp_contDiffWithinAt_iff (e : F ≃L[π•œ] G) :
       H.continuous_linear_map_comp (e.symm : G β†’L[π•œ] F),
     fun H => H.continuousLinearMap_comp (e : F β†’L[π•œ] G)⟩
 #align continuous_linear_equiv.comp_cont_diff_within_at_iff ContinuousLinearEquiv.comp_contDiffWithinAt_iff
+-/
 
+#print ContinuousLinearEquiv.comp_contDiffAt_iff /-
 /-- Composition by continuous linear equivs on the left respects higher differentiability at a
 point. -/
 theorem ContinuousLinearEquiv.comp_contDiffAt_iff (e : F ≃L[π•œ] G) :
     ContDiffAt π•œ n (e ∘ f) x ↔ ContDiffAt π•œ n f x := by
   simp only [← contDiffWithinAt_univ, e.comp_cont_diff_within_at_iff]
 #align continuous_linear_equiv.comp_cont_diff_at_iff ContinuousLinearEquiv.comp_contDiffAt_iff
+-/
 
+#print ContinuousLinearEquiv.comp_contDiffOn_iff /-
 /-- Composition by continuous linear equivs on the left respects higher differentiability on
 domains. -/
 theorem ContinuousLinearEquiv.comp_contDiffOn_iff (e : F ≃L[π•œ] G) :
     ContDiffOn π•œ n (e ∘ f) s ↔ ContDiffOn π•œ n f s := by
   simp [ContDiffOn, e.comp_cont_diff_within_at_iff]
 #align continuous_linear_equiv.comp_cont_diff_on_iff ContinuousLinearEquiv.comp_contDiffOn_iff
+-/
 
+#print ContinuousLinearEquiv.comp_contDiff_iff /-
 /-- Composition by continuous linear equivs on the left respects higher differentiability. -/
 theorem ContinuousLinearEquiv.comp_contDiff_iff (e : F ≃L[π•œ] G) :
     ContDiff π•œ n (e ∘ f) ↔ ContDiff π•œ n f := by
   simp only [← contDiffOn_univ, e.comp_cont_diff_on_iff]
 #align continuous_linear_equiv.comp_cont_diff_iff ContinuousLinearEquiv.comp_contDiff_iff
+-/
 
+#print HasFTaylorSeriesUpToOn.compContinuousLinearMap /-
 /-- If `f` admits a Taylor series `p` in a set `s`, and `g` is linear, then `f ∘ g` admits a Taylor
 series in `g ⁻¹' s`, whose `k`-th term is given by `p k (g v₁, ..., g vβ‚–)` . -/
 theorem HasFTaylorSeriesUpToOn.compContinuousLinearMap (hf : HasFTaylorSeriesUpToOn n f p s)
@@ -463,7 +543,9 @@ theorem HasFTaylorSeriesUpToOn.compContinuousLinearMap (hf : HasFTaylorSeriesUpT
       (hA m).Continuous.comp_continuousOn
         ((hf.cont m hm).comp g.continuous.continuous_on (subset.refl _))
 #align has_ftaylor_series_up_to_on.comp_continuous_linear_map HasFTaylorSeriesUpToOn.compContinuousLinearMap
+-/
 
+#print ContDiffWithinAt.comp_continuousLinearMap /-
 /-- Composition by continuous linear maps on the right preserves `C^n` functions at a point on
 a domain. -/
 theorem ContDiffWithinAt.comp_continuousLinearMap {x : G} (g : G β†’L[π•œ] E)
@@ -478,18 +560,24 @@ theorem ContDiffWithinAt.comp_continuousLinearMap {x : G} (g : G β†’L[π•œ] E)
     rw [image_insert_eq]
     exact insert_subset_insert (image_preimage_subset g s)
 #align cont_diff_within_at.comp_continuous_linear_map ContDiffWithinAt.comp_continuousLinearMap
+-/
 
+#print ContDiffOn.comp_continuousLinearMap /-
 /-- Composition by continuous linear maps on the right preserves `C^n` functions on domains. -/
 theorem ContDiffOn.comp_continuousLinearMap (hf : ContDiffOn π•œ n f s) (g : G β†’L[π•œ] E) :
     ContDiffOn π•œ n (f ∘ g) (g ⁻¹' s) := fun x hx => (hf (g x) hx).compContinuousLinearMap g
 #align cont_diff_on.comp_continuous_linear_map ContDiffOn.comp_continuousLinearMap
+-/
 
+#print ContDiff.comp_continuousLinearMap /-
 /-- Composition by continuous linear maps on the right preserves `C^n` functions. -/
 theorem ContDiff.comp_continuousLinearMap {f : E β†’ F} {g : G β†’L[π•œ] E} (hf : ContDiff π•œ n f) :
     ContDiff π•œ n (f ∘ g) :=
   contDiffOn_univ.1 <| ContDiffOn.comp_continuousLinearMap (contDiffOn_univ.2 hf) _
 #align cont_diff.comp_continuous_linear_map ContDiff.comp_continuousLinearMap
+-/
 
+#print ContinuousLinearMap.iteratedFDerivWithin_comp_right /-
 /-- The iterated derivative within a set of the composition with a linear map on the right is
 obtained by composing the iterated derivative with the linear map. -/
 theorem ContinuousLinearMap.iteratedFDerivWithin_comp_right {f : E β†’ F} (g : G β†’L[π•œ] E)
@@ -500,7 +588,9 @@ theorem ContinuousLinearMap.iteratedFDerivWithin_comp_right {f : E β†’ F} (g : G
   (((hf.ftaylorSeriesWithin hs).compContinuousLinearMap g).eq_ftaylor_series_of_uniqueDiffOn hi h's
       hx).symm
 #align continuous_linear_map.iterated_fderiv_within_comp_right ContinuousLinearMap.iteratedFDerivWithin_comp_right
+-/
 
+#print ContinuousLinearEquiv.iteratedFDerivWithin_comp_right /-
 /-- The iterated derivative within a set of the composition with a linear equiv on the right is
 obtained by composing the iterated derivative with the linear equiv. -/
 theorem ContinuousLinearEquiv.iteratedFDerivWithin_comp_right (g : G ≃L[π•œ] E) (f : E β†’ F)
@@ -531,7 +621,9 @@ theorem ContinuousLinearEquiv.iteratedFDerivWithin_comp_right (g : G ≃L[π•œ]
     rw [ContinuousLinearEquiv.comp_right_fderivWithin _ (g.unique_diff_on_preimage_iff.2 hs x hx)]
     rfl
 #align continuous_linear_equiv.iterated_fderiv_within_comp_right ContinuousLinearEquiv.iteratedFDerivWithin_comp_right
+-/
 
+#print ContinuousLinearMap.iteratedFDeriv_comp_right /-
 /-- The iterated derivative of the composition with a linear map on the right is
 obtained by composing the iterated derivative with the linear map. -/
 theorem ContinuousLinearMap.iteratedFDeriv_comp_right (g : G β†’L[π•œ] E) {f : E β†’ F}
@@ -544,7 +636,9 @@ theorem ContinuousLinearMap.iteratedFDeriv_comp_right (g : G β†’L[π•œ] E) {f :
     g.iterated_fderiv_within_comp_right hf.cont_diff_on uniqueDiffOn_univ uniqueDiffOn_univ
       (mem_univ _) hi
 #align continuous_linear_map.iterated_fderiv_comp_right ContinuousLinearMap.iteratedFDeriv_comp_right
+-/
 
+#print LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_right /-
 /-- Composition with a linear isometry on the right preserves the norm of the iterated derivative
 within a set. -/
 theorem LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_right (g : G ≃ₗᡒ[π•œ] E) (f : E β†’ F)
@@ -557,7 +651,9 @@ theorem LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_right (g : G ≃ₗ
     g.to_continuous_linear_equiv.iterated_fderiv_within_comp_right f hs hx i
   rw [this, ContinuousMultilinearMap.norm_compContinuous_linearIsometryEquiv]
 #align linear_isometry_equiv.norm_iterated_fderiv_within_comp_right LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_right
+-/
 
+#print LinearIsometryEquiv.norm_iteratedFDeriv_comp_right /-
 /-- Composition with a linear isometry on the right preserves the norm of the iterated derivative
 within a set. -/
 theorem LinearIsometryEquiv.norm_iteratedFDeriv_comp_right (g : G ≃ₗᡒ[π•œ] E) (f : E β†’ F) (x : G)
@@ -566,7 +662,9 @@ theorem LinearIsometryEquiv.norm_iteratedFDeriv_comp_right (g : G ≃ₗᡒ[π•œ
   simp only [← iteratedFDerivWithin_univ]
   apply g.norm_iterated_fderiv_within_comp_right f uniqueDiffOn_univ (mem_univ (g x)) i
 #align linear_isometry_equiv.norm_iterated_fderiv_comp_right LinearIsometryEquiv.norm_iteratedFDeriv_comp_right
+-/
 
+#print ContinuousLinearEquiv.contDiffWithinAt_comp_iff /-
 /-- Composition by continuous linear equivs on the right respects higher differentiability at a
 point in a domain. -/
 theorem ContinuousLinearEquiv.contDiffWithinAt_comp_iff (e : G ≃L[π•œ] E) :
@@ -579,7 +677,9 @@ theorem ContinuousLinearEquiv.contDiffWithinAt_comp_iff (e : G ≃L[π•œ] E) :
     rw [← e.apply_symm_apply x, ← e.coe_coe] at H 
     exact H.comp_continuous_linear_map _
 #align continuous_linear_equiv.cont_diff_within_at_comp_iff ContinuousLinearEquiv.contDiffWithinAt_comp_iff
+-/
 
+#print ContinuousLinearEquiv.contDiffAt_comp_iff /-
 /-- Composition by continuous linear equivs on the right respects higher differentiability at a
 point. -/
 theorem ContinuousLinearEquiv.contDiffAt_comp_iff (e : G ≃L[π•œ] E) :
@@ -588,7 +688,9 @@ theorem ContinuousLinearEquiv.contDiffAt_comp_iff (e : G ≃L[π•œ] E) :
   rw [← contDiffWithinAt_univ, ← contDiffWithinAt_univ, ← preimage_univ]
   exact e.cont_diff_within_at_comp_iff
 #align continuous_linear_equiv.cont_diff_at_comp_iff ContinuousLinearEquiv.contDiffAt_comp_iff
+-/
 
+#print ContinuousLinearEquiv.contDiffOn_comp_iff /-
 /-- Composition by continuous linear equivs on the right respects higher differentiability on
 domains. -/
 theorem ContinuousLinearEquiv.contDiffOn_comp_iff (e : G ≃L[π•œ] E) :
@@ -601,7 +703,9 @@ theorem ContinuousLinearEquiv.contDiffOn_comp_iff (e : G ≃L[π•œ] E) :
   rw [A, ← B]
   exact H.comp_continuous_linear_map (e.symm : E β†’L[π•œ] G)
 #align continuous_linear_equiv.cont_diff_on_comp_iff ContinuousLinearEquiv.contDiffOn_comp_iff
+-/
 
+#print ContinuousLinearEquiv.contDiff_comp_iff /-
 /-- Composition by continuous linear equivs on the right respects higher differentiability. -/
 theorem ContinuousLinearEquiv.contDiff_comp_iff (e : G ≃L[π•œ] E) :
     ContDiff π•œ n (f ∘ e) ↔ ContDiff π•œ n f :=
@@ -609,7 +713,9 @@ theorem ContinuousLinearEquiv.contDiff_comp_iff (e : G ≃L[π•œ] E) :
   rw [← contDiffOn_univ, ← contDiffOn_univ, ← preimage_univ]
   exact e.cont_diff_on_comp_iff
 #align continuous_linear_equiv.cont_diff_comp_iff ContinuousLinearEquiv.contDiff_comp_iff
+-/
 
+#print HasFTaylorSeriesUpToOn.prod /-
 /-- If two functions `f` and `g` admit Taylor series `p` and `q` in a set `s`, then the cartesian
 product of `f` and `g` admits the cartesian product of `p` and `q` as a Taylor series. -/
 theorem HasFTaylorSeriesUpToOn.prod (hf : HasFTaylorSeriesUpToOn n f p s) {g : E β†’ G}
@@ -626,7 +732,9 @@ theorem HasFTaylorSeriesUpToOn.prod (hf : HasFTaylorSeriesUpToOn n f p s) {g : E
   Β· intro m hm
     exact (L m).Continuous.comp_continuousOn ((hf.cont m hm).Prod (hg.cont m hm))
 #align has_ftaylor_series_up_to_on.prod HasFTaylorSeriesUpToOn.prod
+-/
 
+#print ContDiffWithinAt.prod /-
 /-- The cartesian product of `C^n` functions at a point in a domain is `C^n`. -/
 theorem ContDiffWithinAt.prod {s : Set E} {f : E β†’ F} {g : E β†’ G} (hf : ContDiffWithinAt π•œ n f s x)
     (hg : ContDiffWithinAt π•œ n g s x) : ContDiffWithinAt π•œ n (fun x : E => (f x, g x)) s x :=
@@ -638,25 +746,32 @@ theorem ContDiffWithinAt.prod {s : Set E} {f : E β†’ F} {g : E β†’ G} (hf : Cont
     ⟨u ∩ v, Filter.inter_mem hu hv, _,
       (hp.mono (inter_subset_left u v)).Prod (hq.mono (inter_subset_right u v))⟩
 #align cont_diff_within_at.prod ContDiffWithinAt.prod
+-/
 
+#print ContDiffOn.prod /-
 /-- The cartesian product of `C^n` functions on domains is `C^n`. -/
 theorem ContDiffOn.prod {s : Set E} {f : E β†’ F} {g : E β†’ G} (hf : ContDiffOn π•œ n f s)
     (hg : ContDiffOn π•œ n g s) : ContDiffOn π•œ n (fun x : E => (f x, g x)) s := fun x hx =>
   (hf x hx).Prod (hg x hx)
 #align cont_diff_on.prod ContDiffOn.prod
+-/
 
+#print ContDiffAt.prod /-
 /-- The cartesian product of `C^n` functions at a point is `C^n`. -/
 theorem ContDiffAt.prod {f : E β†’ F} {g : E β†’ G} (hf : ContDiffAt π•œ n f x)
     (hg : ContDiffAt π•œ n g x) : ContDiffAt π•œ n (fun x : E => (f x, g x)) x :=
   contDiffWithinAt_univ.1 <|
     ContDiffWithinAt.prod (contDiffWithinAt_univ.2 hf) (contDiffWithinAt_univ.2 hg)
 #align cont_diff_at.prod ContDiffAt.prod
+-/
 
+#print ContDiff.prod /-
 /-- The cartesian product of `C^n` functions is `C^n`.-/
 theorem ContDiff.prod {f : E β†’ F} {g : E β†’ G} (hf : ContDiff π•œ n f) (hg : ContDiff π•œ n g) :
     ContDiff π•œ n fun x : E => (f x, g x) :=
   contDiffOn_univ.1 <| ContDiffOn.prod (contDiffOn_univ.2 hf) (contDiffOn_univ.2 hg)
 #align cont_diff.prod ContDiff.prod
+-/
 
 /-!
 ### Composition of `C^n` functions
@@ -732,6 +847,7 @@ private theorem cont_diff_on.comp_same_univ {Eu : Type u} [NormedAddCommGroup Eu
   · rw [contDiffOn_top] at hf hg ⊒
     exact fun n => Itop n (hg n) (hf n) st
 
+#print ContDiffOn.comp /-
 /-- The composition of `C^n` functions on domains is `C^n`. -/
 theorem ContDiffOn.comp {s : Set E} {t : Set F} {g : F β†’ G} {f : E β†’ F} (hg : ContDiffOn π•œ n g t)
     (hf : ContDiffOn π•œ n f s) (st : s βŠ† f ⁻¹' t) : ContDiffOn π•œ n (g ∘ f) s :=
@@ -766,25 +882,33 @@ theorem ContDiffOn.comp {s : Set E} {t : Set F} {g : F β†’ G} {f : E β†’ F} (hg
     rw [isoF.apply_symm_apply (f (isoE y))]
   rwa [this, isoE.cont_diff_on_comp_iff, isoG.symm.comp_cont_diff_on_iff] at main 
 #align cont_diff_on.comp ContDiffOn.comp
+-/
 
+#print ContDiffOn.comp' /-
 /-- The composition of `C^n` functions on domains is `C^n`. -/
 theorem ContDiffOn.comp' {s : Set E} {t : Set F} {g : F β†’ G} {f : E β†’ F} (hg : ContDiffOn π•œ n g t)
     (hf : ContDiffOn π•œ n f s) : ContDiffOn π•œ n (g ∘ f) (s ∩ f ⁻¹' t) :=
   hg.comp (hf.mono (inter_subset_left _ _)) (inter_subset_right _ _)
 #align cont_diff_on.comp' ContDiffOn.comp'
+-/
 
+#print ContDiff.comp_contDiffOn /-
 /-- The composition of a `C^n` function on a domain with a `C^n` function is `C^n`. -/
 theorem ContDiff.comp_contDiffOn {s : Set E} {g : F β†’ G} {f : E β†’ F} (hg : ContDiff π•œ n g)
     (hf : ContDiffOn π•œ n f s) : ContDiffOn π•œ n (g ∘ f) s :=
   (contDiffOn_univ.2 hg).comp hf subset_preimage_univ
 #align cont_diff.comp_cont_diff_on ContDiff.comp_contDiffOn
+-/
 
+#print ContDiff.comp /-
 /-- The composition of `C^n` functions is `C^n`. -/
 theorem ContDiff.comp {g : F β†’ G} {f : E β†’ F} (hg : ContDiff π•œ n g) (hf : ContDiff π•œ n f) :
     ContDiff π•œ n (g ∘ f) :=
   contDiffOn_univ.1 <| ContDiffOn.comp (contDiffOn_univ.2 hg) (contDiffOn_univ.2 hf) (subset_univ _)
 #align cont_diff.comp ContDiff.comp
+-/
 
+#print ContDiffWithinAt.comp /-
 /-- The composition of `C^n` functions at points in domains is `C^n`. -/
 theorem ContDiffWithinAt.comp {s : Set E} {t : Set F} {g : F β†’ G} {f : E β†’ F} (x : E)
     (hg : ContDiffWithinAt π•œ n g t (f x)) (hf : ContDiffWithinAt π•œ n f s x) (st : s βŠ† f ⁻¹' t) :
@@ -815,7 +939,9 @@ theorem ContDiffWithinAt.comp {s : Set E} {t : Set F} {g : F β†’ G} {f : E β†’ F
     exact Filter.inter_mem this v_nhd
   rwa [insert_eq_of_mem xmem, this] at Z 
 #align cont_diff_within_at.comp ContDiffWithinAt.comp
+-/
 
+#print ContDiffWithinAt.comp_of_mem /-
 /-- The composition of `C^n` functions at points in domains is `C^n`,
   with a weaker condition on `s` and `t`. -/
 theorem ContDiffWithinAt.comp_of_mem {s : Set E} {t : Set F} {g : F β†’ G} {f : E β†’ F} (x : E)
@@ -823,148 +949,199 @@ theorem ContDiffWithinAt.comp_of_mem {s : Set E} {t : Set F} {g : F β†’ G} {f :
     (hs : t ∈ 𝓝[f '' s] f x) : ContDiffWithinAt π•œ n (g ∘ f) s x :=
   (hg.mono_of_mem hs).comp x hf (subset_preimage_image f s)
 #align cont_diff_within_at.comp_of_mem ContDiffWithinAt.comp_of_mem
+-/
 
+#print ContDiffWithinAt.comp' /-
 /-- The composition of `C^n` functions at points in domains is `C^n`. -/
 theorem ContDiffWithinAt.comp' {s : Set E} {t : Set F} {g : F β†’ G} {f : E β†’ F} (x : E)
     (hg : ContDiffWithinAt π•œ n g t (f x)) (hf : ContDiffWithinAt π•œ n f s x) :
     ContDiffWithinAt π•œ n (g ∘ f) (s ∩ f ⁻¹' t) x :=
   hg.comp x (hf.mono (inter_subset_left _ _)) (inter_subset_right _ _)
 #align cont_diff_within_at.comp' ContDiffWithinAt.comp'
+-/
 
+#print ContDiffAt.comp_contDiffWithinAt /-
 theorem ContDiffAt.comp_contDiffWithinAt {n} (x : E) (hg : ContDiffAt π•œ n g (f x))
     (hf : ContDiffWithinAt π•œ n f s x) : ContDiffWithinAt π•œ n (g ∘ f) s x :=
   hg.comp x hf (mapsTo_univ _ _)
 #align cont_diff_at.comp_cont_diff_within_at ContDiffAt.comp_contDiffWithinAt
+-/
 
+#print ContDiffAt.comp /-
 /-- The composition of `C^n` functions at points is `C^n`. -/
 theorem ContDiffAt.comp (x : E) (hg : ContDiffAt π•œ n g (f x)) (hf : ContDiffAt π•œ n f x) :
     ContDiffAt π•œ n (g ∘ f) x :=
   hg.comp x hf subset_preimage_univ
 #align cont_diff_at.comp ContDiffAt.comp
+-/
 
+#print ContDiff.comp_contDiffWithinAt /-
 theorem ContDiff.comp_contDiffWithinAt {g : F β†’ G} {f : E β†’ F} (h : ContDiff π•œ n g)
     (hf : ContDiffWithinAt π•œ n f t x) : ContDiffWithinAt π•œ n (g ∘ f) t x :=
   haveI : ContDiffWithinAt π•œ n g univ (f x) := h.cont_diff_at.cont_diff_within_at
   this.comp x hf (subset_univ _)
 #align cont_diff.comp_cont_diff_within_at ContDiff.comp_contDiffWithinAt
+-/
 
+#print ContDiff.comp_contDiffAt /-
 theorem ContDiff.comp_contDiffAt {g : F β†’ G} {f : E β†’ F} (x : E) (hg : ContDiff π•œ n g)
     (hf : ContDiffAt π•œ n f x) : ContDiffAt π•œ n (g ∘ f) x :=
   hg.comp_contDiffWithinAt hf
 #align cont_diff.comp_cont_diff_at ContDiff.comp_contDiffAt
+-/
 
 /-!
 ### Smoothness of projections
 -/
 
 
+#print contDiff_fst /-
 /-- The first projection in a product is `C^∞`. -/
 theorem contDiff_fst : ContDiff π•œ n (Prod.fst : E Γ— F β†’ E) :=
   IsBoundedLinearMap.contDiff IsBoundedLinearMap.fst
 #align cont_diff_fst contDiff_fst
+-/
 
+#print ContDiff.fst /-
 /-- Postcomposing `f` with `prod.fst` is `C^n` -/
 theorem ContDiff.fst {f : E β†’ F Γ— G} (hf : ContDiff π•œ n f) : ContDiff π•œ n fun x => (f x).1 :=
   contDiff_fst.comp hf
 #align cont_diff.fst ContDiff.fst
+-/
 
+#print ContDiff.fst' /-
 /-- Precomposing `f` with `prod.fst` is `C^n` -/
 theorem ContDiff.fst' {f : E β†’ G} (hf : ContDiff π•œ n f) : ContDiff π•œ n fun x : E Γ— F => f x.1 :=
   hf.comp contDiff_fst
 #align cont_diff.fst' ContDiff.fst'
+-/
 
+#print contDiffOn_fst /-
 /-- The first projection on a domain in a product is `C^∞`. -/
 theorem contDiffOn_fst {s : Set (E Γ— F)} : ContDiffOn π•œ n (Prod.fst : E Γ— F β†’ E) s :=
   ContDiff.contDiffOn contDiff_fst
 #align cont_diff_on_fst contDiffOn_fst
+-/
 
+#print ContDiffOn.fst /-
 theorem ContDiffOn.fst {f : E β†’ F Γ— G} {s : Set E} (hf : ContDiffOn π•œ n f s) :
     ContDiffOn π•œ n (fun x => (f x).1) s :=
   contDiff_fst.comp_contDiffOn hf
 #align cont_diff_on.fst ContDiffOn.fst
+-/
 
+#print contDiffAt_fst /-
 /-- The first projection at a point in a product is `C^∞`. -/
 theorem contDiffAt_fst {p : E Γ— F} : ContDiffAt π•œ n (Prod.fst : E Γ— F β†’ E) p :=
   contDiff_fst.ContDiffAt
 #align cont_diff_at_fst contDiffAt_fst
+-/
 
+#print ContDiffAt.fst /-
 /-- Postcomposing `f` with `prod.fst` is `C^n` at `(x, y)` -/
 theorem ContDiffAt.fst {f : E β†’ F Γ— G} {x : E} (hf : ContDiffAt π•œ n f x) :
     ContDiffAt π•œ n (fun x => (f x).1) x :=
   contDiffAt_fst.comp x hf
 #align cont_diff_at.fst ContDiffAt.fst
+-/
 
+#print ContDiffAt.fst' /-
 /-- Precomposing `f` with `prod.fst` is `C^n` at `(x, y)` -/
 theorem ContDiffAt.fst' {f : E β†’ G} {x : E} {y : F} (hf : ContDiffAt π•œ n f x) :
     ContDiffAt π•œ n (fun x : E Γ— F => f x.1) (x, y) :=
   ContDiffAt.comp (x, y) hf contDiffAt_fst
 #align cont_diff_at.fst' ContDiffAt.fst'
+-/
 
+#print ContDiffAt.fst'' /-
 /-- Precomposing `f` with `prod.fst` is `C^n` at `x : E Γ— F` -/
 theorem ContDiffAt.fst'' {f : E β†’ G} {x : E Γ— F} (hf : ContDiffAt π•œ n f x.1) :
     ContDiffAt π•œ n (fun x : E Γ— F => f x.1) x :=
   hf.comp x contDiffAt_fst
 #align cont_diff_at.fst'' ContDiffAt.fst''
+-/
 
+#print contDiffWithinAt_fst /-
 /-- The first projection within a domain at a point in a product is `C^∞`. -/
 theorem contDiffWithinAt_fst {s : Set (E Γ— F)} {p : E Γ— F} :
     ContDiffWithinAt π•œ n (Prod.fst : E Γ— F β†’ E) s p :=
   contDiff_fst.ContDiffWithinAt
 #align cont_diff_within_at_fst contDiffWithinAt_fst
+-/
 
+#print contDiff_snd /-
 /-- The second projection in a product is `C^∞`. -/
 theorem contDiff_snd : ContDiff π•œ n (Prod.snd : E Γ— F β†’ F) :=
   IsBoundedLinearMap.contDiff IsBoundedLinearMap.snd
 #align cont_diff_snd contDiff_snd
+-/
 
+#print ContDiff.snd /-
 /-- Postcomposing `f` with `prod.snd` is `C^n` -/
 theorem ContDiff.snd {f : E β†’ F Γ— G} (hf : ContDiff π•œ n f) : ContDiff π•œ n fun x => (f x).2 :=
   contDiff_snd.comp hf
 #align cont_diff.snd ContDiff.snd
+-/
 
+#print ContDiff.snd' /-
 /-- Precomposing `f` with `prod.snd` is `C^n` -/
 theorem ContDiff.snd' {f : F β†’ G} (hf : ContDiff π•œ n f) : ContDiff π•œ n fun x : E Γ— F => f x.2 :=
   hf.comp contDiff_snd
 #align cont_diff.snd' ContDiff.snd'
+-/
 
+#print contDiffOn_snd /-
 /-- The second projection on a domain in a product is `C^∞`. -/
 theorem contDiffOn_snd {s : Set (E Γ— F)} : ContDiffOn π•œ n (Prod.snd : E Γ— F β†’ F) s :=
   ContDiff.contDiffOn contDiff_snd
 #align cont_diff_on_snd contDiffOn_snd
+-/
 
+#print ContDiffOn.snd /-
 theorem ContDiffOn.snd {f : E β†’ F Γ— G} {s : Set E} (hf : ContDiffOn π•œ n f s) :
     ContDiffOn π•œ n (fun x => (f x).2) s :=
   contDiff_snd.comp_contDiffOn hf
 #align cont_diff_on.snd ContDiffOn.snd
+-/
 
+#print contDiffAt_snd /-
 /-- The second projection at a point in a product is `C^∞`. -/
 theorem contDiffAt_snd {p : E Γ— F} : ContDiffAt π•œ n (Prod.snd : E Γ— F β†’ F) p :=
   contDiff_snd.ContDiffAt
 #align cont_diff_at_snd contDiffAt_snd
+-/
 
+#print ContDiffAt.snd /-
 /-- Postcomposing `f` with `prod.snd` is `C^n` at `x` -/
 theorem ContDiffAt.snd {f : E β†’ F Γ— G} {x : E} (hf : ContDiffAt π•œ n f x) :
     ContDiffAt π•œ n (fun x => (f x).2) x :=
   contDiffAt_snd.comp x hf
 #align cont_diff_at.snd ContDiffAt.snd
+-/
 
+#print ContDiffAt.snd' /-
 /-- Precomposing `f` with `prod.snd` is `C^n` at `(x, y)` -/
 theorem ContDiffAt.snd' {f : F β†’ G} {x : E} {y : F} (hf : ContDiffAt π•œ n f y) :
     ContDiffAt π•œ n (fun x : E Γ— F => f x.2) (x, y) :=
   ContDiffAt.comp (x, y) hf contDiffAt_snd
 #align cont_diff_at.snd' ContDiffAt.snd'
+-/
 
+#print ContDiffAt.snd'' /-
 /-- Precomposing `f` with `prod.snd` is `C^n` at `x : E Γ— F` -/
 theorem ContDiffAt.snd'' {f : F β†’ G} {x : E Γ— F} (hf : ContDiffAt π•œ n f x.2) :
     ContDiffAt π•œ n (fun x : E Γ— F => f x.2) x :=
   hf.comp x contDiffAt_snd
 #align cont_diff_at.snd'' ContDiffAt.snd''
+-/
 
+#print contDiffWithinAt_snd /-
 /-- The second projection within a domain at a point in a product is `C^∞`. -/
 theorem contDiffWithinAt_snd {s : Set (E Γ— F)} {p : E Γ— F} :
     ContDiffWithinAt π•œ n (Prod.snd : E Γ— F β†’ F) s p :=
   contDiff_snd.ContDiffWithinAt
 #align cont_diff_within_at_snd contDiffWithinAt_snd
+-/
 
 section NAry
 
@@ -974,54 +1151,71 @@ variable [NormedAddCommGroup E₁] [NormedAddCommGroup Eβ‚‚] [NormedAddCommGroup
   [NormedAddCommGroup Eβ‚„] [NormedSpace π•œ E₁] [NormedSpace π•œ Eβ‚‚] [NormedSpace π•œ E₃]
   [NormedSpace π•œ Eβ‚„]
 
+#print ContDiff.compβ‚‚ /-
 theorem ContDiff.compβ‚‚ {g : E₁ Γ— Eβ‚‚ β†’ G} {f₁ : F β†’ E₁} {fβ‚‚ : F β†’ Eβ‚‚} (hg : ContDiff π•œ n g)
     (hf₁ : ContDiff π•œ n f₁) (hfβ‚‚ : ContDiff π•œ n fβ‚‚) : ContDiff π•œ n fun x => g (f₁ x, fβ‚‚ x) :=
   hg.comp <| hf₁.Prod hfβ‚‚
 #align cont_diff.compβ‚‚ ContDiff.compβ‚‚
+-/
 
+#print ContDiff.comp₃ /-
 theorem ContDiff.comp₃ {g : E₁ Γ— Eβ‚‚ Γ— E₃ β†’ G} {f₁ : F β†’ E₁} {fβ‚‚ : F β†’ Eβ‚‚} {f₃ : F β†’ E₃}
     (hg : ContDiff π•œ n g) (hf₁ : ContDiff π•œ n f₁) (hfβ‚‚ : ContDiff π•œ n fβ‚‚) (hf₃ : ContDiff π•œ n f₃) :
     ContDiff π•œ n fun x => g (f₁ x, fβ‚‚ x, f₃ x) :=
   hg.compβ‚‚ hf₁ <| hfβ‚‚.Prod hf₃
 #align cont_diff.comp₃ ContDiff.comp₃
+-/
 
+#print ContDiff.comp_contDiff_onβ‚‚ /-
 theorem ContDiff.comp_contDiff_onβ‚‚ {g : E₁ Γ— Eβ‚‚ β†’ G} {f₁ : F β†’ E₁} {fβ‚‚ : F β†’ Eβ‚‚} {s : Set F}
     (hg : ContDiff π•œ n g) (hf₁ : ContDiffOn π•œ n f₁ s) (hfβ‚‚ : ContDiffOn π•œ n fβ‚‚ s) :
     ContDiffOn π•œ n (fun x => g (f₁ x, fβ‚‚ x)) s :=
   hg.comp_contDiffOn <| hf₁.Prod hfβ‚‚
 #align cont_diff.comp_cont_diff_onβ‚‚ ContDiff.comp_contDiff_onβ‚‚
+-/
 
+#print ContDiff.comp_contDiff_on₃ /-
 theorem ContDiff.comp_contDiff_on₃ {g : E₁ Γ— Eβ‚‚ Γ— E₃ β†’ G} {f₁ : F β†’ E₁} {fβ‚‚ : F β†’ Eβ‚‚} {f₃ : F β†’ E₃}
     {s : Set F} (hg : ContDiff π•œ n g) (hf₁ : ContDiffOn π•œ n f₁ s) (hfβ‚‚ : ContDiffOn π•œ n fβ‚‚ s)
     (hf₃ : ContDiffOn π•œ n f₃ s) : ContDiffOn π•œ n (fun x => g (f₁ x, fβ‚‚ x, f₃ x)) s :=
   hg.comp_contDiff_onβ‚‚ hf₁ <| hfβ‚‚.Prod hf₃
 #align cont_diff.comp_cont_diff_on₃ ContDiff.comp_contDiff_on₃
+-/
 
 end NAry
 
 section SpecificBilinearMaps
 
+#print ContDiff.clm_comp /-
 theorem ContDiff.clm_comp {g : X β†’ F β†’L[π•œ] G} {f : X β†’ E β†’L[π•œ] F} (hg : ContDiff π•œ n g)
     (hf : ContDiff π•œ n f) : ContDiff π•œ n fun x => (g x).comp (f x) :=
   isBoundedBilinearMap_comp.ContDiff.compβ‚‚ hg hf
 #align cont_diff.clm_comp ContDiff.clm_comp
+-/
 
+#print ContDiffOn.clm_comp /-
 theorem ContDiffOn.clm_comp {g : X β†’ F β†’L[π•œ] G} {f : X β†’ E β†’L[π•œ] F} {s : Set X}
     (hg : ContDiffOn π•œ n g s) (hf : ContDiffOn π•œ n f s) :
     ContDiffOn π•œ n (fun x => (g x).comp (f x)) s :=
   isBoundedBilinearMap_comp.ContDiff.comp_contDiff_onβ‚‚ hg hf
 #align cont_diff_on.clm_comp ContDiffOn.clm_comp
+-/
 
+#print ContDiff.clm_apply /-
 theorem ContDiff.clm_apply {f : E β†’ F β†’L[π•œ] G} {g : E β†’ F} {n : β„•βˆž} (hf : ContDiff π•œ n f)
     (hg : ContDiff π•œ n g) : ContDiff π•œ n fun x => (f x) (g x) :=
   isBoundedBilinearMapApply.ContDiff.compβ‚‚ hf hg
 #align cont_diff.clm_apply ContDiff.clm_apply
+-/
 
+#print ContDiffOn.clm_apply /-
 theorem ContDiffOn.clm_apply {f : E β†’ F β†’L[π•œ] G} {g : E β†’ F} {n : β„•βˆž} (hf : ContDiffOn π•œ n f s)
     (hg : ContDiffOn π•œ n g s) : ContDiffOn π•œ n (fun x => (f x) (g x)) s :=
   isBoundedBilinearMapApply.ContDiff.comp_contDiff_onβ‚‚ hf hg
 #align cont_diff_on.clm_apply ContDiffOn.clm_apply
+-/
 
+#print ContDiff.smulRight /-
 theorem ContDiff.smulRight {f : E β†’ F β†’L[π•œ] π•œ} {g : E β†’ G} {n : β„•βˆž} (hf : ContDiff π•œ n f)
     (hg : ContDiff π•œ n g) : ContDiff π•œ n fun x => (f x).smul_right (g x) :=
   (-- giving the following implicit type arguments speeds up elaboration significantly
@@ -1029,9 +1223,11 @@ theorem ContDiff.smulRight {f : E β†’ F β†’L[π•œ] π•œ} {g : E β†’ G} {n : β„•
           π•œ _ F _ _ G _ _).ContDiff.compβ‚‚
     hf hg
 #align cont_diff.smul_right ContDiff.smulRight
+-/
 
 end SpecificBilinearMaps
 
+#print contDiff_prodAssoc /-
 /-- The natural equivalence `(E Γ— F) Γ— G ≃ E Γ— (F Γ— G)` is smooth.
 
 Warning: if you think you need this lemma, it is likely that you can simplify your proof by
@@ -1041,7 +1237,9 @@ Note [continuity lemma statement]
 theorem contDiff_prodAssoc : ContDiff π•œ ⊀ <| Equiv.prodAssoc E F G :=
   (LinearIsometryEquiv.prodAssoc π•œ E F G).ContDiff
 #align cont_diff_prod_assoc contDiff_prodAssoc
+-/
 
+#print contDiff_prodAssoc_symm /-
 /-- The natural equivalence `E Γ— (F Γ— G) ≃ (E Γ— F) Γ— G` is smooth.
 
 Warning: see remarks attached to `cont_diff_prod_assoc`
@@ -1049,12 +1247,14 @@ Warning: see remarks attached to `cont_diff_prod_assoc`
 theorem contDiff_prodAssoc_symm : ContDiff π•œ ⊀ <| (Equiv.prodAssoc E F G).symm :=
   (LinearIsometryEquiv.prodAssoc π•œ E F G).symm.ContDiff
 #align cont_diff_prod_assoc_symm contDiff_prodAssoc_symm
+-/
 
 /-! ### Bundled derivatives are smooth -/
 
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print ContDiffWithinAt.hasFDerivWithinAt_nhds /-
 /-- One direction of `cont_diff_within_at_succ_iff_has_fderiv_within_at`, but where all derivatives
 	are taken within the same set. Version for partial derivatives / functions with parameters.
 	If `f x` is a `C^n+1` family of functions and `g x` is a `C^n` family of points, then the
@@ -1103,8 +1303,10 @@ theorem ContDiffWithinAt.hasFDerivWithinAt_nhds {f : E β†’ F β†’ G} {g : E β†’ F
               (ContinuousLinearMap.inr π•œ E F)).comp_of_mem
         xβ‚€ (cont_diff_within_at_id.prod hg) hst
 #align cont_diff_within_at.has_fderiv_within_at_nhds ContDiffWithinAt.hasFDerivWithinAt_nhds
+-/
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print ContDiffWithinAt.fderivWithin'' /-
 /-- The most general lemma stating that `x ↦ fderiv_within π•œ (f x) t (g x)` is `C^n`
 at a point within a set.
 To show that `x ↦ D_yf(x,y)g(x)` (taken within `t`) is `C^m` at `xβ‚€` within `s`, we require that
@@ -1134,8 +1336,10 @@ theorem ContDiffWithinAt.fderivWithin'' {f : E β†’ F β†’ G} {g : E β†’ F} {t : S
     exact fun m => this m le_top
   exact this m le_rfl
 #align cont_diff_within_at.fderiv_within'' ContDiffWithinAt.fderivWithin''
+-/
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print ContDiffWithinAt.fderivWithin' /-
 /-- A special case of `cont_diff_within_at.fderiv_within''` where we require that `s βŠ† g⁻¹(t)`. -/
 theorem ContDiffWithinAt.fderivWithin' {f : E β†’ F β†’ G} {g : E β†’ F} {t : Set F} {n : β„•βˆž}
     (hf : ContDiffWithinAt π•œ n (Function.uncurry f) (insert xβ‚€ s Γ—Λ’ t) (xβ‚€, g xβ‚€))
@@ -1144,8 +1348,10 @@ theorem ContDiffWithinAt.fderivWithin' {f : E β†’ F β†’ G} {g : E β†’ F} {t : Se
     (hst : s βŠ† g ⁻¹' t) : ContDiffWithinAt π•œ m (fun x => fderivWithin π•œ (f x) t (g x)) s xβ‚€ :=
   hf.fderivWithin'' hg ht hmn <| mem_of_superset self_mem_nhdsWithin <| image_subset_iff.mpr hst
 #align cont_diff_within_at.fderiv_within' ContDiffWithinAt.fderivWithin'
+-/
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print ContDiffWithinAt.fderivWithin /-
 /-- A special case of `cont_diff_within_at.fderiv_within'` where we require that `xβ‚€ ∈ s` and there
   are unique derivatives everywhere within `t`. -/
 theorem ContDiffWithinAt.fderivWithin {f : E β†’ F β†’ G} {g : E β†’ F} {t : Set F} {n : β„•βˆž}
@@ -1158,8 +1364,10 @@ theorem ContDiffWithinAt.fderivWithin {f : E β†’ F β†’ G} {g : E β†’ F} {t : Set
   rw [insert_eq_self.mpr hxβ‚€]
   exact eventually_of_mem self_mem_nhdsWithin fun x hx => ht _ (hst hx)
 #align cont_diff_within_at.fderiv_within ContDiffWithinAt.fderivWithin
+-/
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print ContDiffWithinAt.fderivWithin_apply /-
 /-- `x ↦ fderiv_within π•œ (f x) t (g x) (k x)` is smooth at a point within a set. -/
 theorem ContDiffWithinAt.fderivWithin_apply {f : E β†’ F β†’ G} {g k : E β†’ F} {t : Set F} {n : β„•βˆž}
     (hf : ContDiffWithinAt π•œ n (Function.uncurry f) (s Γ—Λ’ t) (xβ‚€, g xβ‚€))
@@ -1169,7 +1377,9 @@ theorem ContDiffWithinAt.fderivWithin_apply {f : E β†’ F β†’ G} {g k : E β†’ F}
   (contDiff_fst.clm_apply contDiff_snd).ContDiffAt.comp_contDiffWithinAt xβ‚€
     ((hf.fderivWithin hg ht hmn hxβ‚€ hst).Prod hk)
 #align cont_diff_within_at.fderiv_within_apply ContDiffWithinAt.fderivWithin_apply
+-/
 
+#print ContDiffWithinAt.fderivWithin_right /-
 /-- `fderiv_within π•œ f s` is smooth at `xβ‚€` within `s`. -/
 theorem ContDiffWithinAt.fderivWithin_right (hf : ContDiffWithinAt π•œ n f s xβ‚€)
     (hs : UniqueDiffOn π•œ s) (hmn : (m + 1 : β„•βˆž) ≀ n) (hxβ‚€s : xβ‚€ ∈ s) :
@@ -1178,7 +1388,9 @@ theorem ContDiffWithinAt.fderivWithin_right (hf : ContDiffWithinAt π•œ n f s x
     (ContDiffWithinAt.comp (xβ‚€, xβ‚€) hf contDiffWithinAt_snd <| prod_subset_preimage_snd s s)
     contDiffWithinAt_id hs hmn hxβ‚€s (by rw [preimage_id'])
 #align cont_diff_within_at.fderiv_within_right ContDiffWithinAt.fderivWithin_right
+-/
 
+#print ContDiffAt.fderiv /-
 /-- `x ↦ fderiv π•œ (f x) (g x)` is smooth at `xβ‚€`. -/
 theorem ContDiffAt.fderiv {f : E β†’ F β†’ G} {g : E β†’ F} {n : β„•βˆž}
     (hf : ContDiffAt π•œ n (Function.uncurry f) (xβ‚€, g xβ‚€)) (hg : ContDiffAt π•œ m g xβ‚€)
@@ -1191,41 +1403,53 @@ theorem ContDiffAt.fderiv {f : E β†’ F β†’ G} {g : E β†’ F} {n : β„•βˆž}
       univ_mem
   rw [preimage_univ]
 #align cont_diff_at.fderiv ContDiffAt.fderiv
+-/
 
+#print ContDiffAt.fderiv_right /-
 /-- `fderiv π•œ f` is smooth at `xβ‚€`. -/
 theorem ContDiffAt.fderiv_right (hf : ContDiffAt π•œ n f xβ‚€) (hmn : (m + 1 : β„•βˆž) ≀ n) :
     ContDiffAt π•œ m (fderiv π•œ f) xβ‚€ :=
   ContDiffAt.fderiv (ContDiffAt.comp (xβ‚€, xβ‚€) hf contDiffAt_snd) contDiffAt_id hmn
 #align cont_diff_at.fderiv_right ContDiffAt.fderiv_right
+-/
 
+#print ContDiff.fderiv /-
 /-- `x ↦ fderiv π•œ (f x) (g x)` is smooth. -/
 theorem ContDiff.fderiv {f : E β†’ F β†’ G} {g : E β†’ F} {n m : β„•βˆž}
     (hf : ContDiff π•œ m <| Function.uncurry f) (hg : ContDiff π•œ n g) (hnm : n + 1 ≀ m) :
     ContDiff π•œ n fun x => fderiv π•œ (f x) (g x) :=
   contDiff_iff_contDiffAt.mpr fun x => hf.ContDiffAt.fderiv hg.ContDiffAt hnm
 #align cont_diff.fderiv ContDiff.fderiv
+-/
 
+#print ContDiff.fderiv_right /-
 /-- `fderiv π•œ f` is smooth. -/
 theorem ContDiff.fderiv_right (hf : ContDiff π•œ n f) (hmn : (m + 1 : β„•βˆž) ≀ n) :
     ContDiff π•œ m (fderiv π•œ f) :=
   contDiff_iff_contDiffAt.mpr fun x => hf.ContDiffAt.fderiv_right hmn
 #align cont_diff.fderiv_right ContDiff.fderiv_right
+-/
 
+#print Continuous.fderiv /-
 /-- `x ↦ fderiv π•œ (f x) (g x)` is continuous. -/
 theorem Continuous.fderiv {f : E β†’ F β†’ G} {g : E β†’ F} {n : β„•βˆž}
     (hf : ContDiff π•œ n <| Function.uncurry f) (hg : Continuous g) (hn : 1 ≀ n) :
     Continuous fun x => fderiv π•œ (f x) (g x) :=
   (hf.fderiv (contDiff_zero.mpr hg) hn).Continuous
 #align continuous.fderiv Continuous.fderiv
+-/
 
+#print ContDiff.fderiv_apply /-
 /-- `x ↦ fderiv π•œ (f x) (g x) (k x)` is smooth. -/
 theorem ContDiff.fderiv_apply {f : E β†’ F β†’ G} {g k : E β†’ F} {n m : β„•βˆž}
     (hf : ContDiff π•œ m <| Function.uncurry f) (hg : ContDiff π•œ n g) (hk : ContDiff π•œ n k)
     (hnm : n + 1 ≀ m) : ContDiff π•œ n fun x => fderiv π•œ (f x) (g x) (k x) :=
   (hf.fderiv hg hnm).clm_apply hk
 #align cont_diff.fderiv_apply ContDiff.fderiv_apply
+-/
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print contDiffOn_fderivWithin_apply /-
 /-- The bundled derivative of a `C^{n+1}` function is `C^n`. -/
 theorem contDiffOn_fderivWithin_apply {m n : β„•βˆž} {s : Set E} {f : E β†’ F} (hf : ContDiffOn π•œ n f s)
     (hs : UniqueDiffOn π•œ s) (hmn : m + 1 ≀ n) :
@@ -1233,8 +1457,10 @@ theorem contDiffOn_fderivWithin_apply {m n : β„•βˆž} {s : Set E} {f : E β†’ F} (
   ((hf.fderivWithin hs hmn).comp contDiffOn_fst (prod_subset_preimage_fst _ _)).clm_apply
     contDiffOn_snd
 #align cont_diff_on_fderiv_within_apply contDiffOn_fderivWithin_apply
+-/
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print ContDiffOn.continuousOn_fderivWithin_apply /-
 /-- If a function is at least `C^1`, its bundled derivative (mapping `(x, v)` to `Df(x) v`) is
 continuous. -/
 theorem ContDiffOn.continuousOn_fderivWithin_apply (hf : ContDiffOn π•œ n f s) (hs : UniqueDiffOn π•œ s)
@@ -1242,7 +1468,9 @@ theorem ContDiffOn.continuousOn_fderivWithin_apply (hf : ContDiffOn π•œ n f s)
     ContinuousOn (fun p : E Γ— E => (fderivWithin π•œ f s p.1 : E β†’ F) p.2) (s Γ—Λ’ univ) :=
   (contDiffOn_fderivWithin_apply hf hs <| by rwa [zero_add]).ContinuousOn
 #align cont_diff_on.continuous_on_fderiv_within_apply ContDiffOn.continuousOn_fderivWithin_apply
+-/
 
+#print ContDiff.contDiff_fderiv_apply /-
 /-- The bundled derivative of a `C^{n+1}` function is `C^n`. -/
 theorem ContDiff.contDiff_fderiv_apply {f : E β†’ F} (hf : ContDiff π•œ n f) (hmn : m + 1 ≀ n) :
     ContDiff π•œ m fun p : E Γ— E => (fderiv π•œ f p.1 : E β†’L[π•œ] F) p.2 :=
@@ -1251,6 +1479,7 @@ theorem ContDiff.contDiff_fderiv_apply {f : E β†’ F} (hf : ContDiff π•œ n f) (h
   rw [← fderivWithin_univ, ← univ_prod_univ]
   exact contDiffOn_fderivWithin_apply hf uniqueDiffOn_univ hmn
 #align cont_diff.cont_diff_fderiv_apply ContDiff.contDiff_fderiv_apply
+-/
 
 /-!
 ### Smoothness of functions `f : E β†’ Ξ  i, F' i`
@@ -1263,6 +1492,7 @@ variable {ΞΉ ΞΉ' : Type _} [Fintype ΞΉ] [Fintype ΞΉ'] {F' : ΞΉ β†’ Type _} [βˆ€
   [βˆ€ i, NormedSpace π•œ (F' i)] {Ο† : βˆ€ i, E β†’ F' i} {p' : βˆ€ i, E β†’ FormalMultilinearSeries π•œ E (F' i)}
   {Ξ¦ : E β†’ βˆ€ i, F' i} {P' : E β†’ FormalMultilinearSeries π•œ E (βˆ€ i, F' i)}
 
+#print hasFTaylorSeriesUpToOn_pi /-
 theorem hasFTaylorSeriesUpToOn_pi :
     HasFTaylorSeriesUpToOn n (fun x i => Ο† i x)
         (fun x m => ContinuousMultilinearMap.pi fun i => p' i x m) s ↔
@@ -1284,7 +1514,9 @@ theorem hasFTaylorSeriesUpToOn_pi :
     have := continuousOn_pi.2 fun i => (h i).cont m hm
     convert (L m).Continuous.comp_continuousOn this
 #align has_ftaylor_series_up_to_on_pi hasFTaylorSeriesUpToOn_pi
+-/
 
+#print hasFTaylorSeriesUpToOn_pi' /-
 @[simp]
 theorem hasFTaylorSeriesUpToOn_pi' :
     HasFTaylorSeriesUpToOn n Ξ¦ P' s ↔
@@ -1295,7 +1527,9 @@ theorem hasFTaylorSeriesUpToOn_pi' :
           s :=
   by convert hasFTaylorSeriesUpToOn_pi; ext; rfl
 #align has_ftaylor_series_up_to_on_pi' hasFTaylorSeriesUpToOn_pi'
+-/
 
+#print contDiffWithinAt_pi /-
 theorem contDiffWithinAt_pi :
     ContDiffWithinAt π•œ n Ξ¦ s x ↔ βˆ€ i, ContDiffWithinAt π•œ n (fun x => Ξ¦ x i) s x :=
   by
@@ -1306,29 +1540,40 @@ theorem contDiffWithinAt_pi :
     βŸ¨β‹‚ i, u i, Filter.iInter_mem.2 hux, _,
       hasFTaylorSeriesUpToOn_pi.2 fun i => (hp i).mono <| Inter_subset _ _⟩
 #align cont_diff_within_at_pi contDiffWithinAt_pi
+-/
 
+#print contDiffOn_pi /-
 theorem contDiffOn_pi : ContDiffOn π•œ n Ξ¦ s ↔ βˆ€ i, ContDiffOn π•œ n (fun x => Ξ¦ x i) s :=
   ⟨fun h i x hx => contDiffWithinAt_pi.1 (h x hx) _, fun h x hx =>
     contDiffWithinAt_pi.2 fun i => h i x hx⟩
 #align cont_diff_on_pi contDiffOn_pi
+-/
 
+#print contDiffAt_pi /-
 theorem contDiffAt_pi : ContDiffAt π•œ n Ξ¦ x ↔ βˆ€ i, ContDiffAt π•œ n (fun x => Ξ¦ x i) x :=
   contDiffWithinAt_pi
 #align cont_diff_at_pi contDiffAt_pi
+-/
 
+#print contDiff_pi /-
 theorem contDiff_pi : ContDiff π•œ n Ξ¦ ↔ βˆ€ i, ContDiff π•œ n fun x => Ξ¦ x i := by
   simp only [← contDiffOn_univ, contDiffOn_pi]
 #align cont_diff_pi contDiff_pi
+-/
 
 variable (π•œ E)
 
+#print contDiff_apply /-
 theorem contDiff_apply (i : ΞΉ) : ContDiff π•œ n fun f : ΞΉ β†’ E => f i :=
   contDiff_pi.mp contDiff_id i
 #align cont_diff_apply contDiff_apply
+-/
 
+#print contDiff_apply_apply /-
 theorem contDiff_apply_apply (i : ΞΉ) (j : ΞΉ') : ContDiff π•œ n fun f : ΞΉ β†’ ΞΉ' β†’ E => f i j :=
   contDiff_pi.mp (contDiff_apply π•œ (ΞΉ' β†’ E) i) j
 #align cont_diff_apply_apply contDiff_apply_apply
+-/
 
 variable {π•œ E}
 
@@ -1339,38 +1584,49 @@ end Pi
 
 section Add
 
+#print contDiff_add /-
 -- The sum is smooth.
 theorem contDiff_add : ContDiff π•œ n fun p : F Γ— F => p.1 + p.2 :=
   (IsBoundedLinearMap.fst.add IsBoundedLinearMap.snd).ContDiff
 #align cont_diff_add contDiff_add
+-/
 
+#print ContDiffWithinAt.add /-
 /-- The sum of two `C^n` functions within a set at a point is `C^n` within this set
 at this point. -/
 theorem ContDiffWithinAt.add {s : Set E} {f g : E β†’ F} (hf : ContDiffWithinAt π•œ n f s x)
     (hg : ContDiffWithinAt π•œ n g s x) : ContDiffWithinAt π•œ n (fun x => f x + g x) s x :=
   contDiff_add.ContDiffWithinAt.comp x (hf.Prod hg) subset_preimage_univ
 #align cont_diff_within_at.add ContDiffWithinAt.add
+-/
 
+#print ContDiffAt.add /-
 /-- The sum of two `C^n` functions at a point is `C^n` at this point. -/
 theorem ContDiffAt.add {f g : E β†’ F} (hf : ContDiffAt π•œ n f x) (hg : ContDiffAt π•œ n g x) :
     ContDiffAt π•œ n (fun x => f x + g x) x := by
   rw [← contDiffWithinAt_univ] at * <;> exact hf.add hg
 #align cont_diff_at.add ContDiffAt.add
+-/
 
+#print ContDiff.add /-
 /-- The sum of two `C^n`functions is `C^n`. -/
 theorem ContDiff.add {f g : E β†’ F} (hf : ContDiff π•œ n f) (hg : ContDiff π•œ n g) :
     ContDiff π•œ n fun x => f x + g x :=
   contDiff_add.comp (hf.Prod hg)
 #align cont_diff.add ContDiff.add
+-/
 
+#print ContDiffOn.add /-
 /-- The sum of two `C^n` functions on a domain is `C^n`. -/
 theorem ContDiffOn.add {s : Set E} {f g : E β†’ F} (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).add (hg x hx)
 #align cont_diff_on.add ContDiffOn.add
+-/
 
 variable {i : β„•}
 
+#print iteratedFDerivWithin_add_apply /-
 /-- The iterated derivative of the sum of two functions is the sum of the iterated derivatives.
 See also `iterated_fderiv_within_add_apply'`, which uses the spelling `(Ξ» x, f x + g x)`
 instead of `f + g`. -/
@@ -1404,7 +1660,9 @@ theorem iteratedFDerivWithin_add_apply {f g : E β†’ F} (hf : ContDiffOn π•œ i f
         by rw [Pi.add_def, fderivWithin_add (hu x hx) (hdf x hx) (hdg x hx)]; rfl
       _ = (iteratedFDerivWithin π•œ (i + 1) f s + iteratedFDerivWithin π•œ (i + 1) g s) x h := rfl
 #align iterated_fderiv_within_add_apply iteratedFDerivWithin_add_apply
+-/
 
+#print iteratedFDerivWithin_add_apply' /-
 /-- The iterated derivative of the sum of two functions is the sum of the iterated derivatives.
 This is the same as `iterated_fderiv_within_add_apply`, but using the spelling `(Ξ» x, f x + g x)`
 instead of `f + g`, which can be handy for some rewrites.
@@ -1415,19 +1673,24 @@ theorem iteratedFDerivWithin_add_apply' {f g : E β†’ F} (hf : ContDiffOn π•œ i
       iteratedFDerivWithin π•œ i f s x + iteratedFDerivWithin π•œ i g s x :=
   iteratedFDerivWithin_add_apply hf hg hu hx
 #align iterated_fderiv_within_add_apply' iteratedFDerivWithin_add_apply'
+-/
 
+#print iteratedFDeriv_add_apply /-
 theorem iteratedFDeriv_add_apply {i : β„•} {f g : E β†’ F} (hf : ContDiff π•œ i f) (hg : ContDiff π•œ i g) :
     iteratedFDeriv π•œ i (f + g) x = iteratedFDeriv π•œ i f x + iteratedFDeriv π•œ i g x :=
   by
   simp_rw [← contDiffOn_univ, ← iteratedFDerivWithin_univ] at hf hg ⊒
   exact iteratedFDerivWithin_add_apply hf hg uniqueDiffOn_univ (Set.mem_univ _)
 #align iterated_fderiv_add_apply iteratedFDeriv_add_apply
+-/
 
+#print iteratedFDeriv_add_apply' /-
 theorem iteratedFDeriv_add_apply' {i : β„•} {f g : E β†’ F} (hf : ContDiff π•œ i f)
     (hg : ContDiff π•œ i g) :
     iteratedFDeriv π•œ i (fun x => f x + g x) x = iteratedFDeriv π•œ i f x + iteratedFDeriv π•œ i g x :=
   iteratedFDeriv_add_apply hf hg
 #align iterated_fderiv_add_apply' iteratedFDeriv_add_apply'
+-/
 
 end Add
 
@@ -1436,35 +1699,46 @@ end Add
 
 section Neg
 
+#print contDiff_neg /-
 -- The negative is smooth.
 theorem contDiff_neg : ContDiff π•œ n fun p : F => -p :=
   IsBoundedLinearMap.id.neg.ContDiff
 #align cont_diff_neg contDiff_neg
+-/
 
+#print ContDiffWithinAt.neg /-
 /-- The negative of a `C^n` function within a domain at a point is `C^n` within this domain at
 this point. -/
 theorem ContDiffWithinAt.neg {s : Set E} {f : E β†’ F} (hf : ContDiffWithinAt π•œ n f s x) :
     ContDiffWithinAt π•œ n (fun x => -f x) s x :=
   contDiff_neg.ContDiffWithinAt.comp x hf subset_preimage_univ
 #align cont_diff_within_at.neg ContDiffWithinAt.neg
+-/
 
+#print ContDiffAt.neg /-
 /-- The negative of a `C^n` function at a point is `C^n` at this point. -/
 theorem ContDiffAt.neg {f : E β†’ F} (hf : ContDiffAt π•œ n f x) : ContDiffAt π•œ n (fun x => -f x) x :=
   by rw [← contDiffWithinAt_univ] at * <;> exact hf.neg
 #align cont_diff_at.neg ContDiffAt.neg
+-/
 
+#print ContDiff.neg /-
 /-- The negative of a `C^n`function is `C^n`. -/
 theorem ContDiff.neg {f : E β†’ F} (hf : ContDiff π•œ n f) : ContDiff π•œ n fun x => -f x :=
   contDiff_neg.comp hf
 #align cont_diff.neg ContDiff.neg
+-/
 
+#print ContDiffOn.neg /-
 /-- The negative of a `C^n` function on a domain is `C^n`. -/
 theorem ContDiffOn.neg {s : Set E} {f : E β†’ F} (hf : ContDiffOn π•œ n f s) :
     ContDiffOn π•œ n (fun x => -f x) s := fun x hx => (hf x hx).neg
 #align cont_diff_on.neg ContDiffOn.neg
+-/
 
 variable {i : β„•}
 
+#print iteratedFDerivWithin_neg_apply /-
 theorem iteratedFDerivWithin_neg_apply {f : E β†’ F} (hu : UniqueDiffOn π•œ s) (hx : x ∈ s) :
     iteratedFDerivWithin π•œ i (-f) s x = -iteratedFDerivWithin π•œ i f s x :=
   by
@@ -1482,45 +1756,57 @@ theorem iteratedFDerivWithin_neg_apply {f : E β†’ F} (hu : UniqueDiffOn π•œ s)
         rw [Pi.neg_def, fderivWithin_neg (hu x hx)]; rfl
       _ = -(iteratedFDerivWithin π•œ (i + 1) f s) x h := rfl
 #align iterated_fderiv_within_neg_apply iteratedFDerivWithin_neg_apply
+-/
 
+#print iteratedFDeriv_neg_apply /-
 theorem iteratedFDeriv_neg_apply {i : β„•} {f : E β†’ F} :
     iteratedFDeriv π•œ i (-f) x = -iteratedFDeriv π•œ i f x :=
   by
   simp_rw [← iteratedFDerivWithin_univ]
   exact iteratedFDerivWithin_neg_apply uniqueDiffOn_univ (Set.mem_univ _)
 #align iterated_fderiv_neg_apply iteratedFDeriv_neg_apply
+-/
 
 end Neg
 
 /-! ### Subtraction -/
 
 
+#print ContDiffWithinAt.sub /-
 /-- The difference of two `C^n` functions within a set at a point is `C^n` within this set
 at this point. -/
 theorem ContDiffWithinAt.sub {s : Set E} {f g : E β†’ F} (hf : ContDiffWithinAt π•œ n f s x)
     (hg : ContDiffWithinAt π•œ n g s x) : ContDiffWithinAt π•œ n (fun x => f x - g x) s x := by
   simpa only [sub_eq_add_neg] using hf.add hg.neg
 #align cont_diff_within_at.sub ContDiffWithinAt.sub
+-/
 
+#print ContDiffAt.sub /-
 /-- The difference of two `C^n` functions at a point is `C^n` at this point. -/
 theorem ContDiffAt.sub {f g : E β†’ F} (hf : ContDiffAt π•œ n f x) (hg : ContDiffAt π•œ n g x) :
     ContDiffAt π•œ n (fun x => f x - g x) x := by simpa only [sub_eq_add_neg] using hf.add hg.neg
 #align cont_diff_at.sub ContDiffAt.sub
+-/
 
+#print ContDiffOn.sub /-
 /-- The difference of two `C^n` functions on a domain is `C^n`. -/
 theorem ContDiffOn.sub {s : Set E} {f g : E β†’ F} (hf : ContDiffOn π•œ n f s)
     (hg : ContDiffOn π•œ n g s) : ContDiffOn π•œ n (fun x => f x - g x) s := by
   simpa only [sub_eq_add_neg] using hf.add hg.neg
 #align cont_diff_on.sub ContDiffOn.sub
+-/
 
+#print ContDiff.sub /-
 /-- The difference of two `C^n` functions is `C^n`. -/
 theorem ContDiff.sub {f g : E β†’ F} (hf : ContDiff π•œ n f) (hg : ContDiff π•œ n g) :
     ContDiff π•œ n fun x => f x - g x := by simpa only [sub_eq_add_neg] using hf.add hg.neg
 #align cont_diff.sub ContDiff.sub
+-/
 
 /-! ### Sum of finitely many functions -/
 
 
+#print ContDiffWithinAt.sum /-
 theorem ContDiffWithinAt.sum {ΞΉ : Type _} {f : ΞΉ β†’ E β†’ F} {s : Finset ΞΉ} {t : Set E} {x : E}
     (h : βˆ€ i ∈ s, ContDiffWithinAt π•œ n (fun x => f i x) t x) :
     ContDiffWithinAt π•œ n (fun x => βˆ‘ i in s, f i x) t x := by
@@ -1530,23 +1816,30 @@ theorem ContDiffWithinAt.sum {ΞΉ : Type _} {f : ΞΉ β†’ E β†’ F} {s : Finset ΞΉ}
   Β· simp only [is, Finset.sum_insert, not_false_iff]
     exact (h _ (Finset.mem_insert_self i s)).add (IH fun j hj => h _ (Finset.mem_insert_of_mem hj))
 #align cont_diff_within_at.sum ContDiffWithinAt.sum
+-/
 
+#print ContDiffAt.sum /-
 theorem ContDiffAt.sum {ΞΉ : Type _} {f : ΞΉ β†’ E β†’ F} {s : Finset ΞΉ} {x : E}
     (h : βˆ€ i ∈ s, ContDiffAt π•œ n (fun x => f i x) x) :
     ContDiffAt π•œ n (fun x => βˆ‘ i in s, f i x) x := by
   rw [← contDiffWithinAt_univ] at * <;> exact ContDiffWithinAt.sum h
 #align cont_diff_at.sum ContDiffAt.sum
+-/
 
+#print ContDiffOn.sum /-
 theorem ContDiffOn.sum {ΞΉ : Type _} {f : ΞΉ β†’ E β†’ F} {s : Finset ΞΉ} {t : Set E}
     (h : βˆ€ i ∈ s, ContDiffOn π•œ n (fun x => f i x) t) :
     ContDiffOn π•œ n (fun x => βˆ‘ i in s, f i x) t := fun x hx =>
   ContDiffWithinAt.sum fun i hi => h i hi x hx
 #align cont_diff_on.sum ContDiffOn.sum
+-/
 
+#print ContDiff.sum /-
 theorem ContDiff.sum {ΞΉ : Type _} {f : ΞΉ β†’ E β†’ F} {s : Finset ΞΉ}
     (h : βˆ€ i ∈ s, ContDiff π•œ n fun x => f i x) : ContDiff π•œ n fun x => βˆ‘ i in s, f i x := by
   simp only [← contDiffOn_univ] at * <;> exact ContDiffOn.sum h
 #align cont_diff.sum ContDiff.sum
+-/
 
 /-! ### Product of two functions -/
 
@@ -1556,112 +1849,154 @@ section MulProd
 variable {𝔸 𝔸' ΞΉ π•œ' : Type _} [NormedRing 𝔸] [NormedAlgebra π•œ 𝔸] [NormedCommRing 𝔸']
   [NormedAlgebra π•œ 𝔸'] [NormedField π•œ'] [NormedAlgebra π•œ π•œ']
 
+#print contDiff_mul /-
 -- The product is smooth.
 theorem contDiff_mul : ContDiff π•œ n fun p : 𝔸 Γ— 𝔸 => p.1 * p.2 :=
   (ContinuousLinearMap.mul π•œ 𝔸).IsBoundedBilinearMap.ContDiff
 #align cont_diff_mul contDiff_mul
+-/
 
+#print ContDiffWithinAt.mul /-
 /-- The product of two `C^n` functions within a set at a point is `C^n` within this set
 at this point. -/
 theorem ContDiffWithinAt.mul {s : Set E} {f g : E β†’ 𝔸} (hf : ContDiffWithinAt π•œ n f s x)
     (hg : ContDiffWithinAt π•œ n g s x) : ContDiffWithinAt π•œ n (fun x => f x * g x) s x :=
   contDiff_mul.comp_contDiffWithinAt (hf.Prod hg)
 #align cont_diff_within_at.mul ContDiffWithinAt.mul
+-/
 
+#print ContDiffAt.mul /-
 /-- The product of two `C^n` functions at a point is `C^n` at this point. -/
 theorem ContDiffAt.mul {f g : E β†’ 𝔸} (hf : ContDiffAt π•œ n f x) (hg : ContDiffAt π•œ n g x) :
     ContDiffAt π•œ n (fun x => f x * g x) x :=
   hf.mul hg
 #align cont_diff_at.mul ContDiffAt.mul
+-/
 
+#print ContDiffOn.mul /-
 /-- The product of two `C^n` functions on a domain is `C^n`. -/
 theorem ContDiffOn.mul {f g : E β†’ 𝔸} (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).mul (hg x hx)
 #align cont_diff_on.mul ContDiffOn.mul
+-/
 
+#print ContDiff.mul /-
 /-- The product of two `C^n`functions is `C^n`. -/
 theorem ContDiff.mul {f g : E β†’ 𝔸} (hf : ContDiff π•œ n f) (hg : ContDiff π•œ n g) :
     ContDiff π•œ n fun x => f x * g x :=
   contDiff_mul.comp (hf.Prod hg)
 #align cont_diff.mul ContDiff.mul
+-/
 
+#print contDiffWithinAt_prod' /-
 theorem contDiffWithinAt_prod' {t : Finset ΞΉ} {f : ΞΉ β†’ E β†’ 𝔸'}
     (h : βˆ€ i ∈ t, ContDiffWithinAt π•œ n (f i) s x) : ContDiffWithinAt π•œ n (∏ i in t, f i) s x :=
   Finset.prod_induction f (fun f => ContDiffWithinAt π•œ n f s x) (fun _ _ => ContDiffWithinAt.mul)
     (@contDiffWithinAt_const _ _ _ _ _ _ _ _ _ _ _ 1) h
 #align cont_diff_within_at_prod' contDiffWithinAt_prod'
+-/
 
+#print contDiffWithinAt_prod /-
 theorem contDiffWithinAt_prod {t : Finset ΞΉ} {f : ΞΉ β†’ E β†’ 𝔸'}
     (h : βˆ€ i ∈ t, ContDiffWithinAt π•œ n (f i) s x) :
     ContDiffWithinAt π•œ n (fun y => ∏ i in t, f i y) s x := by
   simpa only [← Finset.prod_apply] using contDiffWithinAt_prod' h
 #align cont_diff_within_at_prod contDiffWithinAt_prod
+-/
 
+#print contDiffAt_prod' /-
 theorem contDiffAt_prod' {t : Finset ΞΉ} {f : ΞΉ β†’ E β†’ 𝔸'} (h : βˆ€ i ∈ t, ContDiffAt π•œ n (f i) x) :
     ContDiffAt π•œ n (∏ i in t, f i) x :=
   contDiffWithinAt_prod' h
 #align cont_diff_at_prod' contDiffAt_prod'
+-/
 
+#print contDiffAt_prod /-
 theorem contDiffAt_prod {t : Finset ΞΉ} {f : ΞΉ β†’ E β†’ 𝔸'} (h : βˆ€ i ∈ t, ContDiffAt π•œ n (f i) x) :
     ContDiffAt π•œ n (fun y => ∏ i in t, f i y) x :=
   contDiffWithinAt_prod h
 #align cont_diff_at_prod contDiffAt_prod
+-/
 
+#print contDiffOn_prod' /-
 theorem contDiffOn_prod' {t : Finset ΞΉ} {f : ΞΉ β†’ E β†’ 𝔸'} (h : βˆ€ i ∈ t, ContDiffOn π•œ n (f i) s) :
     ContDiffOn π•œ n (∏ i in t, f i) s := fun x hx => contDiffWithinAt_prod' fun i hi => h i hi x hx
 #align cont_diff_on_prod' contDiffOn_prod'
+-/
 
+#print contDiffOn_prod /-
 theorem contDiffOn_prod {t : Finset ΞΉ} {f : ΞΉ β†’ E β†’ 𝔸'} (h : βˆ€ i ∈ t, ContDiffOn π•œ n (f i) s) :
     ContDiffOn π•œ n (fun y => ∏ i in t, f i y) s := fun x hx =>
   contDiffWithinAt_prod fun i hi => h i hi x hx
 #align cont_diff_on_prod contDiffOn_prod
+-/
 
+#print contDiff_prod' /-
 theorem contDiff_prod' {t : Finset ΞΉ} {f : ΞΉ β†’ E β†’ 𝔸'} (h : βˆ€ i ∈ t, ContDiff π•œ n (f i)) :
     ContDiff π•œ n (∏ i in t, f i) :=
   contDiff_iff_contDiffAt.mpr fun x => contDiffAt_prod' fun i hi => (h i hi).ContDiffAt
 #align cont_diff_prod' contDiff_prod'
+-/
 
+#print contDiff_prod /-
 theorem contDiff_prod {t : Finset ΞΉ} {f : ΞΉ β†’ E β†’ 𝔸'} (h : βˆ€ i ∈ t, ContDiff π•œ n (f i)) :
     ContDiff π•œ n fun y => ∏ i in t, f i y :=
   contDiff_iff_contDiffAt.mpr fun x => contDiffAt_prod fun i hi => (h i hi).ContDiffAt
 #align cont_diff_prod contDiff_prod
+-/
 
+#print ContDiff.pow /-
 theorem ContDiff.pow {f : E β†’ 𝔸} (hf : ContDiff π•œ n f) : βˆ€ m : β„•, ContDiff π•œ n fun x => f x ^ m
   | 0 => by simpa using contDiff_const
   | m + 1 => by simpa [pow_succ] using hf.mul (ContDiff.pow m)
 #align cont_diff.pow ContDiff.pow
+-/
 
+#print ContDiffWithinAt.pow /-
 theorem ContDiffWithinAt.pow {f : E β†’ 𝔸} (hf : ContDiffWithinAt π•œ n f s x) (m : β„•) :
     ContDiffWithinAt π•œ n (fun y => f y ^ m) s x :=
   (contDiff_id.pow m).comp_contDiffWithinAt hf
 #align cont_diff_within_at.pow ContDiffWithinAt.pow
+-/
 
+#print ContDiffAt.pow /-
 theorem ContDiffAt.pow {f : E β†’ 𝔸} (hf : ContDiffAt π•œ n f x) (m : β„•) :
     ContDiffAt π•œ n (fun y => f y ^ m) x :=
   hf.pow m
 #align cont_diff_at.pow ContDiffAt.pow
+-/
 
+#print ContDiffOn.pow /-
 theorem ContDiffOn.pow {f : E β†’ 𝔸} (hf : ContDiffOn π•œ n f s) (m : β„•) :
     ContDiffOn π•œ n (fun y => f y ^ m) s := fun y hy => (hf y hy).pow m
 #align cont_diff_on.pow ContDiffOn.pow
+-/
 
+#print ContDiffWithinAt.div_const /-
 theorem ContDiffWithinAt.div_const {f : E β†’ π•œ'} {n} (hf : ContDiffWithinAt π•œ n f s x) (c : π•œ') :
     ContDiffWithinAt π•œ n (fun x => f x / c) s x := by
   simpa only [div_eq_mul_inv] using hf.mul contDiffWithinAt_const
 #align cont_diff_within_at.div_const ContDiffWithinAt.div_const
+-/
 
+#print ContDiffAt.div_const /-
 theorem ContDiffAt.div_const {f : E β†’ π•œ'} {n} (hf : ContDiffAt π•œ n f x) (c : π•œ') :
     ContDiffAt π•œ n (fun x => f x / c) x :=
   hf.div_const c
 #align cont_diff_at.div_const ContDiffAt.div_const
+-/
 
+#print ContDiffOn.div_const /-
 theorem ContDiffOn.div_const {f : E β†’ π•œ'} {n} (hf : ContDiffOn π•œ n f s) (c : π•œ') :
     ContDiffOn π•œ n (fun x => f x / c) s := fun x hx => (hf x hx).div_const c
 #align cont_diff_on.div_const ContDiffOn.div_const
+-/
 
+#print ContDiff.div_const /-
 theorem ContDiff.div_const {f : E β†’ π•œ'} {n} (hf : ContDiff π•œ n f) (c : π•œ') :
     ContDiff π•œ n fun x => f x / c := by simpa only [div_eq_mul_inv] using hf.mul contDiff_const
 #align cont_diff.div_const ContDiff.div_const
+-/
 
 end MulProd
 
@@ -1670,35 +2005,45 @@ end MulProd
 
 section Smul
 
+#print contDiff_smul /-
 -- The scalar multiplication is smooth.
 theorem contDiff_smul : ContDiff π•œ n fun p : π•œ Γ— F => p.1 β€’ p.2 :=
   isBoundedBilinearMap_smul.ContDiff
 #align cont_diff_smul contDiff_smul
+-/
 
+#print ContDiffWithinAt.smul /-
 /-- The scalar multiplication of two `C^n` functions within a set at a point is `C^n` within this
 set at this point. -/
 theorem ContDiffWithinAt.smul {s : Set E} {f : E β†’ π•œ} {g : E β†’ F} (hf : ContDiffWithinAt π•œ n f s x)
     (hg : ContDiffWithinAt π•œ n g s x) : ContDiffWithinAt π•œ n (fun x => f x β€’ g x) s x :=
   contDiff_smul.ContDiffWithinAt.comp x (hf.Prod hg) subset_preimage_univ
 #align cont_diff_within_at.smul ContDiffWithinAt.smul
+-/
 
+#print ContDiffAt.smul /-
 /-- The scalar multiplication of two `C^n` functions at a point is `C^n` at this point. -/
 theorem ContDiffAt.smul {f : E β†’ π•œ} {g : E β†’ F} (hf : ContDiffAt π•œ n f x)
     (hg : ContDiffAt π•œ n g x) : ContDiffAt π•œ n (fun x => f x β€’ g x) x := by
   rw [← contDiffWithinAt_univ] at * <;> exact hf.smul hg
 #align cont_diff_at.smul ContDiffAt.smul
+-/
 
+#print ContDiff.smul /-
 /-- The scalar multiplication of two `C^n` functions is `C^n`. -/
 theorem ContDiff.smul {f : E β†’ π•œ} {g : E β†’ F} (hf : ContDiff π•œ n f) (hg : ContDiff π•œ n g) :
     ContDiff π•œ n fun x => f x β€’ g x :=
   contDiff_smul.comp (hf.Prod hg)
 #align cont_diff.smul ContDiff.smul
+-/
 
+#print ContDiffOn.smul /-
 /-- The scalar multiplication of two `C^n` functions on a domain is `C^n`. -/
 theorem ContDiffOn.smul {s : Set E} {f : E β†’ π•œ} {g : E β†’ F} (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).smul (hg x hx)
 #align cont_diff_on.smul ContDiffOn.smul
+-/
 
 end Smul
 
@@ -1711,38 +2056,49 @@ variable {R : Type _} [Semiring R] [Module R F] [SMulCommClass π•œ R F]
 
 variable [ContinuousConstSMul R F]
 
+#print contDiff_const_smul /-
 -- The scalar multiplication with a constant is smooth.
 theorem contDiff_const_smul (c : R) : ContDiff π•œ n fun p : F => c β€’ p :=
   (c β€’ ContinuousLinearMap.id π•œ F).ContDiff
 #align cont_diff_const_smul contDiff_const_smul
+-/
 
+#print ContDiffWithinAt.const_smul /-
 /-- The scalar multiplication of a constant and a `C^n` function within a set at a point is `C^n`
 within this set at this point. -/
 theorem ContDiffWithinAt.const_smul {s : Set E} {f : E β†’ F} {x : E} (c : R)
     (hf : ContDiffWithinAt π•œ n f s x) : ContDiffWithinAt π•œ n (fun y => c β€’ f y) s x :=
   (contDiff_const_smul c).ContDiffAt.comp_contDiffWithinAt x hf
 #align cont_diff_within_at.const_smul ContDiffWithinAt.const_smul
+-/
 
+#print ContDiffAt.const_smul /-
 /-- The scalar multiplication of a constant and a `C^n` function at a point is `C^n` at this
 point. -/
 theorem ContDiffAt.const_smul {f : E β†’ F} {x : E} (c : R) (hf : ContDiffAt π•œ n f x) :
     ContDiffAt π•œ n (fun y => c β€’ f y) x := by
   rw [← contDiffWithinAt_univ] at * <;> exact hf.const_smul c
 #align cont_diff_at.const_smul ContDiffAt.const_smul
+-/
 
+#print ContDiff.const_smul /-
 /-- The scalar multiplication of a constant and a `C^n` function is `C^n`. -/
 theorem ContDiff.const_smul {f : E β†’ F} (c : R) (hf : ContDiff π•œ n f) :
     ContDiff π•œ n fun y => c β€’ f y :=
   (contDiff_const_smul c).comp hf
 #align cont_diff.const_smul ContDiff.const_smul
+-/
 
+#print ContDiffOn.const_smul /-
 /-- The scalar multiplication of a constant and a `C^n` on a domain is `C^n`. -/
 theorem ContDiffOn.const_smul {s : Set E} {f : E β†’ F} (c : R) (hf : ContDiffOn π•œ n f s) :
     ContDiffOn π•œ n (fun y => c β€’ f y) s := fun x hx => (hf x hx).const_smul c
 #align cont_diff_on.const_smul ContDiffOn.const_smul
+-/
 
 variable {i : β„•} {a : R}
 
+#print iteratedFDerivWithin_const_smul_apply /-
 theorem iteratedFDerivWithin_const_smul_apply (hf : ContDiffOn π•œ i f s) (hu : UniqueDiffOn π•œ s)
     (hx : x ∈ s) : iteratedFDerivWithin π•œ i (a β€’ f) s x = a β€’ iteratedFDerivWithin π•œ i f s x :=
   by
@@ -1763,13 +2119,16 @@ theorem iteratedFDerivWithin_const_smul_apply (hf : ContDiffOn π•œ i f s) (hu :
         rw [Pi.smul_def, fderivWithin_const_smul (hu x hx) (hdf x hx)]; rfl
       _ = a β€’ iteratedFDerivWithin π•œ (i + 1) f s x h := rfl
 #align iterated_fderiv_within_const_smul_apply iteratedFDerivWithin_const_smul_apply
+-/
 
+#print iteratedFDeriv_const_smul_apply /-
 theorem iteratedFDeriv_const_smul_apply {x : E} (hf : ContDiff π•œ i f) :
     iteratedFDeriv π•œ i (a β€’ f) x = a β€’ iteratedFDeriv π•œ i f x :=
   by
   simp_rw [← contDiffOn_univ, ← iteratedFDerivWithin_univ] at *
   refine' iteratedFDerivWithin_const_smul_apply hf uniqueDiffOn_univ (Set.mem_univ _)
 #align iterated_fderiv_const_smul_apply iteratedFDeriv_const_smul_apply
+-/
 
 end ConstSmul
 
@@ -1783,6 +2142,7 @@ variable {E' : Type _} [NormedAddCommGroup E'] [NormedSpace π•œ E']
 variable {F' : Type _} [NormedAddCommGroup F'] [NormedSpace π•œ F']
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print ContDiffWithinAt.prod_map' /-
 /-- The product map of two `C^n` functions within a set at a point is `C^n`
 within the product set at the product point. -/
 theorem ContDiffWithinAt.prod_map' {s : Set E} {t : Set E'} {f : E β†’ F} {g : E' β†’ F'} {p : E Γ— E'}
@@ -1791,15 +2151,19 @@ theorem ContDiffWithinAt.prod_map' {s : Set E} {t : Set E'} {f : E β†’ F} {g : E
   (hf.comp p contDiffWithinAt_fst (prod_subset_preimage_fst _ _)).Prod
     (hg.comp p contDiffWithinAt_snd (prod_subset_preimage_snd _ _))
 #align cont_diff_within_at.prod_map' ContDiffWithinAt.prod_map'
+-/
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print ContDiffWithinAt.prod_map /-
 theorem ContDiffWithinAt.prod_map {s : Set E} {t : Set E'} {f : E β†’ F} {g : E' β†’ F'} {x : E}
     {y : E'} (hf : ContDiffWithinAt π•œ n f s x) (hg : ContDiffWithinAt π•œ n g t y) :
     ContDiffWithinAt π•œ n (Prod.map f g) (s Γ—Λ’ t) (x, y) :=
   ContDiffWithinAt.prod_map' hf hg
 #align cont_diff_within_at.prod_map ContDiffWithinAt.prod_map
+-/
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print ContDiffOn.prod_map /-
 /-- The product map of two `C^n` functions on a set is `C^n` on the product set. -/
 theorem ContDiffOn.prod_map {E' : Type _} [NormedAddCommGroup E'] [NormedSpace π•œ E'] {F' : Type _}
     [NormedAddCommGroup F'] [NormedSpace π•œ F'] {s : Set E} {t : Set E'} {f : E β†’ F} {g : E' β†’ F'}
@@ -1807,7 +2171,9 @@ theorem ContDiffOn.prod_map {E' : Type _} [NormedAddCommGroup E'] [NormedSpace 
   (hf.comp contDiffOn_fst (prod_subset_preimage_fst _ _)).Prod
     (hg.comp contDiffOn_snd (prod_subset_preimage_snd _ _))
 #align cont_diff_on.prod_map ContDiffOn.prod_map
+-/
 
+#print ContDiffAt.prod_map /-
 /-- The product map of two `C^n` functions within a set at a point is `C^n`
 within the product set at the product point. -/
 theorem ContDiffAt.prod_map {f : E β†’ F} {g : E' β†’ F'} {x : E} {y : E'} (hf : ContDiffAt π•œ n f x)
@@ -1817,7 +2183,9 @@ theorem ContDiffAt.prod_map {f : E β†’ F} {g : E' β†’ F'} {x : E} {y : E'} (hf :
   convert hf.prod_map hg
   simp only [univ_prod_univ]
 #align cont_diff_at.prod_map ContDiffAt.prod_map
+-/
 
+#print ContDiffAt.prod_map' /-
 /-- The product map of two `C^n` functions within a set at a point is `C^n`
 within the product set at the product point. -/
 theorem ContDiffAt.prod_map' {f : E β†’ F} {g : E' β†’ F'} {p : E Γ— E'} (hf : ContDiffAt π•œ n f p.1)
@@ -1826,7 +2194,9 @@ theorem ContDiffAt.prod_map' {f : E β†’ F} {g : E' β†’ F'} {p : E Γ— E'} (hf : C
   rcases p with ⟨⟩
   exact ContDiffAt.prod_map hf hg
 #align cont_diff_at.prod_map' ContDiffAt.prod_map'
+-/
 
+#print ContDiff.prod_map /-
 /-- The product map of two `C^n` functions is `C^n`. -/
 theorem ContDiff.prod_map {f : E β†’ F} {g : E' β†’ F'} (hf : ContDiff π•œ n f) (hg : ContDiff π•œ n g) :
     ContDiff π•œ n (Prod.map f g) :=
@@ -1834,14 +2204,19 @@ theorem ContDiff.prod_map {f : E β†’ F} {g : E' β†’ F'} (hf : ContDiff π•œ n f)
   rw [contDiff_iff_contDiffAt] at *
   exact fun ⟨x, y⟩ => (hf x).Prod_map (hg y)
 #align cont_diff.prod_map ContDiff.prod_map
+-/
 
+#print contDiff_prod_mk_left /-
 theorem contDiff_prod_mk_left (fβ‚€ : F) : ContDiff π•œ n fun e : E => (e, fβ‚€) :=
   contDiff_id.Prod contDiff_const
 #align cont_diff_prod_mk_left contDiff_prod_mk_left
+-/
 
+#print contDiff_prod_mk_right /-
 theorem contDiff_prod_mk_right (eβ‚€ : E) : ContDiff π•œ n fun f : F => (eβ‚€, f) :=
   contDiff_const.Prod contDiff_id
 #align cont_diff_prod_mk_right contDiff_prod_mk_right
+-/
 
 end Prod_map
 
@@ -1854,6 +2229,7 @@ variable (π•œ) {R : Type _} [NormedRing R] [NormedAlgebra π•œ R]
 
 open NormedRing ContinuousLinearMap Ring
 
+#print contDiffAt_ring_inverse /-
 /-- In a complete normed algebra, the operation of inversion is `C^n`, for all `n`, at each
 invertible element.  The proof is by induction, bootstrapping using an identity expressing the
 derivative of inversion as a bilinear map of inversion itself. -/
@@ -1881,19 +2257,25 @@ theorem contDiffAt_ring_inverse [CompleteSpace R] (x : RΛ£) : ContDiffAt π•œ n
         (mul_left_right_is_bounded_bilinear π•œ R).ContDiff.neg.comp_contDiffAt (x : R) (IH.prod IH)
   Β· exact cont_diff_at_top.mpr Itop
 #align cont_diff_at_ring_inverse contDiffAt_ring_inverse
+-/
 
 variable (π•œ) {π•œ' : Type _} [NormedField π•œ'] [NormedAlgebra π•œ π•œ'] [CompleteSpace π•œ']
 
+#print contDiffAt_inv /-
 theorem contDiffAt_inv {x : π•œ'} (hx : x β‰  0) {n} : ContDiffAt π•œ n Inv.inv x := by
   simpa only [Ring.inverse_eq_inv'] using contDiffAt_ring_inverse π•œ (Units.mk0 x hx)
 #align cont_diff_at_inv contDiffAt_inv
+-/
 
+#print contDiffOn_inv /-
 theorem contDiffOn_inv {n} : ContDiffOn π•œ n (Inv.inv : π•œ' β†’ π•œ') ({0}ᢜ) := fun x hx =>
   (contDiffAt_inv π•œ hx).ContDiffWithinAt
 #align cont_diff_on_inv contDiffOn_inv
+-/
 
 variable {π•œ}
 
+#print ContDiffWithinAt.inv /-
 -- TODO: the next few lemmas don't need `π•œ` or `π•œ'` to be complete
 -- A good way to show this is to generalize `cont_diff_at_ring_inverse` to the setting
 -- of a function `f` such that `βˆ€αΆ  x in 𝓝 a, x * f x = 1`.
@@ -1901,44 +2283,59 @@ theorem ContDiffWithinAt.inv {f : E β†’ π•œ'} {n} (hf : ContDiffWithinAt π•œ n
     ContDiffWithinAt π•œ n (fun x => (f x)⁻¹) s x :=
   (contDiffAt_inv π•œ hx).comp_contDiffWithinAt x hf
 #align cont_diff_within_at.inv ContDiffWithinAt.inv
+-/
 
+#print ContDiffOn.inv /-
 theorem ContDiffOn.inv {f : E β†’ π•œ'} {n} (hf : ContDiffOn π•œ n f s) (h : βˆ€ x ∈ s, f x β‰  0) :
     ContDiffOn π•œ n (fun x => (f x)⁻¹) s := fun x hx => (hf.ContDiffWithinAt hx).inv (h x hx)
 #align cont_diff_on.inv ContDiffOn.inv
+-/
 
+#print ContDiffAt.inv /-
 theorem ContDiffAt.inv {f : E β†’ π•œ'} {n} (hf : ContDiffAt π•œ n f x) (hx : f x β‰  0) :
     ContDiffAt π•œ n (fun x => (f x)⁻¹) x :=
   hf.inv hx
 #align cont_diff_at.inv ContDiffAt.inv
+-/
 
+#print ContDiff.inv /-
 theorem ContDiff.inv {f : E β†’ π•œ'} {n} (hf : ContDiff π•œ n f) (h : βˆ€ x, f x β‰  0) :
     ContDiff π•œ n fun x => (f x)⁻¹ := by rw [contDiff_iff_contDiffAt];
   exact fun x => hf.cont_diff_at.inv (h x)
 #align cont_diff.inv ContDiff.inv
+-/
 
+#print ContDiffWithinAt.div /-
 -- TODO: generalize to `f g : E β†’ π•œ'`
 theorem ContDiffWithinAt.div [CompleteSpace π•œ] {f g : E β†’ π•œ} {n} (hf : ContDiffWithinAt π•œ n f s x)
     (hg : ContDiffWithinAt π•œ n g s x) (hx : g x β‰  0) :
     ContDiffWithinAt π•œ n (fun x => f x / g x) s x := by
   simpa only [div_eq_mul_inv] using hf.mul (hg.inv hx)
 #align cont_diff_within_at.div ContDiffWithinAt.div
+-/
 
+#print ContDiffOn.div /-
 theorem ContDiffOn.div [CompleteSpace π•œ] {f g : E β†’ π•œ} {n} (hf : ContDiffOn π•œ n f s)
     (hg : ContDiffOn π•œ n g s) (hβ‚€ : βˆ€ x ∈ s, g x β‰  0) : ContDiffOn π•œ n (f / g) s := fun x hx =>
   (hf x hx).div (hg x hx) (hβ‚€ x hx)
 #align cont_diff_on.div ContDiffOn.div
+-/
 
+#print ContDiffAt.div /-
 theorem ContDiffAt.div [CompleteSpace π•œ] {f g : E β†’ π•œ} {n} (hf : ContDiffAt π•œ n f x)
     (hg : ContDiffAt π•œ n g x) (hx : g x β‰  0) : ContDiffAt π•œ n (fun x => f x / g x) x :=
   hf.div hg hx
 #align cont_diff_at.div ContDiffAt.div
+-/
 
+#print ContDiff.div /-
 theorem ContDiff.div [CompleteSpace π•œ] {f g : E β†’ π•œ} {n} (hf : ContDiff π•œ n f) (hg : ContDiff π•œ n g)
     (h0 : βˆ€ x, g x β‰  0) : ContDiff π•œ n fun x => f x / g x :=
   by
   simp only [contDiff_iff_contDiffAt] at *
   exact fun x => (hf x).div (hg x) (h0 x)
 #align cont_diff.div ContDiff.div
+-/
 
 end AlgebraInverse
 
@@ -1949,6 +2346,7 @@ section MapInverse
 
 open ContinuousLinearMap
 
+#print contDiffAt_map_inverse /-
 /-- At a continuous linear equivalence `e : E ≃L[π•œ] F` between Banach spaces, the operation of
 inversion is `C^n`, for all `n`. -/
 theorem contDiffAt_map_inverse [CompleteSpace E] (e : E ≃L[π•œ] F) :
@@ -1969,6 +2367,7 @@ theorem contDiffAt_map_inverse [CompleteSpace E] (e : E ≃L[π•œ] F) :
   convert contDiffAt_ring_inverse π•œ (1 : (E β†’L[π•œ] E)Λ£)
   simp [Oβ‚‚, one_def]
 #align cont_diff_at_map_inverse contDiffAt_map_inverse
+-/
 
 end MapInverse
 
@@ -1976,6 +2375,7 @@ section FunctionInverse
 
 open ContinuousLinearMap
 
+#print LocalHomeomorph.contDiffAt_symm /-
 /-- If `f` is a local homeomorphism and the point `a` is in its target,
 and if `f` is `n` times continuously differentiable at `f.symm a`,
 and if the derivative at `f.symm a` is a continuous linear equivalence,
@@ -2034,7 +2434,9 @@ theorem LocalHomeomorph.contDiffAt_symm [CompleteSpace E] (f : LocalHomeomorph E
     intro n
     exact Itop n (cont_diff_at_top.mp hf n)
 #align local_homeomorph.cont_diff_at_symm LocalHomeomorph.contDiffAt_symm
+-/
 
+#print Homeomorph.contDiff_symm /-
 /-- If `f` is an `n` times continuously differentiable homeomorphism,
 and if the derivative of `f` at each point is a continuous linear equivalence,
 then `f.symm` is `n` times continuously differentiable.
@@ -2047,7 +2449,9 @@ theorem Homeomorph.contDiff_symm [CompleteSpace E] (f : E β‰ƒβ‚œ F) {fβ‚€' : E 
   contDiff_iff_contDiffAt.2 fun x =>
     f.toLocalHomeomorph.contDiffAt_symm (mem_univ x) (hfβ‚€' _) hf.ContDiffAt
 #align homeomorph.cont_diff_symm Homeomorph.contDiff_symm
+-/
 
+#print LocalHomeomorph.contDiffAt_symm_deriv /-
 /-- Let `f` be a local homeomorphism of a nontrivially normed field, let `a` be a point in its
 target. if `f` is `n` times continuously differentiable at `f.symm a`, and if the derivative at
 `f.symm a` is nonzero, then `f.symm` is `n` times continuously differentiable at the point `a`.
@@ -2059,7 +2463,9 @@ theorem LocalHomeomorph.contDiffAt_symm_deriv [CompleteSpace π•œ] (f : LocalHom
     (hf : ContDiffAt π•œ n f (f.symm a)) : ContDiffAt π•œ n f.symm a :=
   f.contDiffAt_symm ha (hfβ‚€'.hasFDerivAt_equiv hβ‚€) hf
 #align local_homeomorph.cont_diff_at_symm_deriv LocalHomeomorph.contDiffAt_symm_deriv
+-/
 
+#print Homeomorph.contDiff_symm_deriv /-
 /-- Let `f` be an `n` times continuously differentiable homeomorphism of a nontrivially normed
 field.  Suppose that the derivative of `f` is never equal to zero. Then `f.symm` is `n` times
 continuously differentiable.
@@ -2072,6 +2478,7 @@ theorem Homeomorph.contDiff_symm_deriv [CompleteSpace π•œ] (f : π•œ β‰ƒβ‚œ 
   contDiff_iff_contDiffAt.2 fun x =>
     f.toLocalHomeomorph.contDiffAt_symm_deriv (hβ‚€ _) (mem_univ x) (hf' _) hf.ContDiffAt
 #align homeomorph.cont_diff_symm_deriv Homeomorph.contDiff_symm_deriv
+-/
 
 end FunctionInverse
 
@@ -2084,6 +2491,7 @@ open Function FiniteDimensional
 
 variable [CompleteSpace π•œ]
 
+#print contDiffOn_clm_apply /-
 /-- A family of continuous linear maps is `C^n` on `s` if all its applications are. -/
 theorem contDiffOn_clm_apply {n : β„•βˆž} {f : E β†’ F β†’L[π•œ] G} {s : Set E} [FiniteDimensional π•œ F] :
     ContDiffOn π•œ n f s ↔ βˆ€ y, ContDiffOn π•œ n (fun x => f x y) s :=
@@ -2096,12 +2504,16 @@ theorem contDiffOn_clm_apply {n : β„•βˆž} {f : E β†’ F β†’L[π•œ] G} {s : Set E}
   rw [← comp.left_id f, ← eβ‚‚.symm_comp_self]
   exact eβ‚‚.symm.cont_diff.comp_cont_diff_on (cont_diff_on_pi.mpr fun i => h _)
 #align cont_diff_on_clm_apply contDiffOn_clm_apply
+-/
 
+#print contDiff_clm_apply_iff /-
 theorem contDiff_clm_apply_iff {n : β„•βˆž} {f : E β†’ F β†’L[π•œ] G} [FiniteDimensional π•œ F] :
     ContDiff π•œ n f ↔ βˆ€ y, ContDiff π•œ n fun x => f x y := by
   simp_rw [← contDiffOn_univ, contDiffOn_clm_apply]
 #align cont_diff_clm_apply_iff contDiff_clm_apply_iff
+-/
 
+#print contDiff_succ_iff_fderiv_apply /-
 /-- This is a useful lemma to prove that a certain operation preserves functions being `C^n`.
 When you do induction on `n`, this gives a useful characterization of a function being `C^(n+1)`,
 assuming you have already computed the derivative. The advantage of this version over
@@ -2115,19 +2527,24 @@ theorem contDiff_succ_iff_fderiv_apply [FiniteDimensional π•œ E] {n : β„•} {f :
     ContDiff π•œ (n + 1 : β„•) f ↔ Differentiable π•œ f ∧ βˆ€ y, ContDiff π•œ n fun x => fderiv π•œ f x y := by
   rw [contDiff_succ_iff_fderiv, contDiff_clm_apply_iff]
 #align cont_diff_succ_iff_fderiv_apply contDiff_succ_iff_fderiv_apply
+-/
 
+#print contDiffOn_succ_of_fderiv_apply /-
 theorem contDiffOn_succ_of_fderiv_apply [FiniteDimensional π•œ E] {n : β„•} {f : E β†’ F} {s : Set E}
     (hf : DifferentiableOn π•œ f s) (h : βˆ€ y, ContDiffOn π•œ n (fun x => fderivWithin π•œ f s x y) s) :
     ContDiffOn π•œ (n + 1 : β„•) f s :=
   contDiffOn_succ_of_fderivWithin hf <| contDiffOn_clm_apply.mpr h
 #align cont_diff_on_succ_of_fderiv_apply contDiffOn_succ_of_fderiv_apply
+-/
 
+#print contDiffOn_succ_iff_fderiv_apply /-
 theorem contDiffOn_succ_iff_fderiv_apply [FiniteDimensional π•œ E] {n : β„•} {f : E β†’ F} {s : Set E}
     (hs : UniqueDiffOn π•œ s) :
     ContDiffOn π•œ (n + 1 : β„•) f s ↔
       DifferentiableOn π•œ f s ∧ βˆ€ y, ContDiffOn π•œ n (fun x => fderivWithin π•œ f s x y) s :=
   by rw [contDiffOn_succ_iff_fderivWithin hs, contDiffOn_clm_apply]
 #align cont_diff_on_succ_iff_fderiv_apply contDiffOn_succ_iff_fderiv_apply
+-/
 
 end FiniteDimensional
 
@@ -2143,6 +2560,7 @@ section Real
 variable {𝕂 : Type _} [IsROrC 𝕂] {E' : Type _} [NormedAddCommGroup E'] [NormedSpace 𝕂 E']
   {F' : Type _} [NormedAddCommGroup F'] [NormedSpace 𝕂 F']
 
+#print HasFTaylorSeriesUpToOn.hasStrictFDerivAt /-
 /-- If a function has a Taylor series at order at least 1, then at points in the interior of the
     domain of definition, the term of order 1 of this series is a strict derivative of `f`. -/
 theorem HasFTaylorSeriesUpToOn.hasStrictFDerivAt {s : Set E'} {f : E' β†’ F'} {x : E'}
@@ -2151,7 +2569,9 @@ theorem HasFTaylorSeriesUpToOn.hasStrictFDerivAt {s : Set E'} {f : E' β†’ F'} {x
   hasStrictFDerivAt_of_hasFDerivAt_of_continuousAt (hf.eventually_hasFDerivAt hn hs) <|
     (continuousMultilinearCurryFin1 𝕂 E' F').ContinuousAt.comp <| (hf.cont 1 hn).ContinuousAt hs
 #align has_ftaylor_series_up_to_on.has_strict_fderiv_at HasFTaylorSeriesUpToOn.hasStrictFDerivAt
+-/
 
+#print ContDiffAt.hasStrictFDerivAt' /-
 /-- If a function is `C^n` with `1 ≀ n` around a point, and its derivative at that point is given to
 us as `f'`, then `f'` is also a strict derivative. -/
 theorem ContDiffAt.hasStrictFDerivAt' {f : E' β†’ F'} {f' : E' β†’L[𝕂] F'} {x : E'}
@@ -2162,40 +2582,52 @@ theorem ContDiffAt.hasStrictFDerivAt' {f : E' β†’ F'} {f' : E' β†’L[𝕂] F'} {x
   have := hp.has_strict_fderiv_at le_rfl H
   rwa [hf'.unique this.has_fderiv_at]
 #align cont_diff_at.has_strict_fderiv_at' ContDiffAt.hasStrictFDerivAt'
+-/
 
+#print ContDiffAt.hasStrictDerivAt' /-
 /-- If a function is `C^n` with `1 ≀ n` around a point, and its derivative at that point is given to
 us as `f'`, then `f'` is also a strict derivative. -/
 theorem ContDiffAt.hasStrictDerivAt' {f : 𝕂 β†’ F'} {f' : F'} {x : 𝕂} (hf : ContDiffAt 𝕂 n f x)
     (hf' : HasDerivAt f f' x) (hn : 1 ≀ n) : HasStrictDerivAt f f' x :=
   hf.hasStrictFDerivAt' hf' hn
 #align cont_diff_at.has_strict_deriv_at' ContDiffAt.hasStrictDerivAt'
+-/
 
+#print ContDiffAt.hasStrictFDerivAt /-
 /-- If a function is `C^n` with `1 ≀ n` around a point, then the derivative of `f` at this point
 is also a strict derivative. -/
 theorem ContDiffAt.hasStrictFDerivAt {f : E' β†’ F'} {x : E'} (hf : ContDiffAt 𝕂 n f x) (hn : 1 ≀ n) :
     HasStrictFDerivAt f (fderiv 𝕂 f x) x :=
   hf.hasStrictFDerivAt' (hf.DifferentiableAt hn).HasFDerivAt hn
 #align cont_diff_at.has_strict_fderiv_at ContDiffAt.hasStrictFDerivAt
+-/
 
+#print ContDiffAt.hasStrictDerivAt /-
 /-- If a function is `C^n` with `1 ≀ n` around a point, then the derivative of `f` at this point
 is also a strict derivative. -/
 theorem ContDiffAt.hasStrictDerivAt {f : 𝕂 β†’ F'} {x : 𝕂} (hf : ContDiffAt 𝕂 n f x) (hn : 1 ≀ n) :
     HasStrictDerivAt f (deriv f x) x :=
   (hf.HasStrictFDerivAt hn).HasStrictDerivAt
 #align cont_diff_at.has_strict_deriv_at ContDiffAt.hasStrictDerivAt
+-/
 
+#print ContDiff.hasStrictFDerivAt /-
 /-- If a function is `C^n` with `1 ≀ n`, then the derivative of `f` is also a strict derivative. -/
 theorem ContDiff.hasStrictFDerivAt {f : E' β†’ F'} {x : E'} (hf : ContDiff 𝕂 n f) (hn : 1 ≀ n) :
     HasStrictFDerivAt f (fderiv 𝕂 f x) x :=
   hf.ContDiffAt.HasStrictFDerivAt hn
 #align cont_diff.has_strict_fderiv_at ContDiff.hasStrictFDerivAt
+-/
 
+#print ContDiff.hasStrictDerivAt /-
 /-- If a function is `C^n` with `1 ≀ n`, then the derivative of `f` is also a strict derivative. -/
 theorem ContDiff.hasStrictDerivAt {f : 𝕂 β†’ F'} {x : 𝕂} (hf : ContDiff 𝕂 n f) (hn : 1 ≀ n) :
     HasStrictDerivAt f (deriv f x) x :=
   hf.ContDiffAt.HasStrictDerivAt hn
 #align cont_diff.has_strict_deriv_at ContDiff.hasStrictDerivAt
+-/
 
+#print HasFTaylorSeriesUpToOn.exists_lipschitzOnWith_of_nnnorm_lt /-
 /-- If `f` has a formal Taylor series `p` up to order `1` on `{x} βˆͺ s`, where `s` is a convex set,
 and `β€–p x 1β€–β‚Š < K`, then `f` is `K`-Lipschitz in a neighborhood of `x` within `s`. -/
 theorem HasFTaylorSeriesUpToOn.exists_lipschitzOnWith_of_nnnorm_lt {E F : Type _}
@@ -2215,7 +2647,9 @@ theorem HasFTaylorSeriesUpToOn.exists_lipschitzOnWith_of_nnnorm_lt {E F : Type _
     hs.exists_nhds_within_lipschitz_on_with_of_has_fderiv_within_at_of_nnnorm_lt
       (eventually_nhdsWithin_iff.2 <| eventually_of_forall hder) hcont K hK
 #align has_ftaylor_series_up_to_on.exists_lipschitz_on_with_of_nnnorm_lt HasFTaylorSeriesUpToOn.exists_lipschitzOnWith_of_nnnorm_lt
+-/
 
+#print HasFTaylorSeriesUpToOn.exists_lipschitzOnWith /-
 /-- If `f` has a formal Taylor series `p` up to order `1` on `{x} βˆͺ s`, where `s` is a convex set,
 then `f` is Lipschitz in a neighborhood of `x` within `s`. -/
 theorem HasFTaylorSeriesUpToOn.exists_lipschitzOnWith {E F : Type _} [NormedAddCommGroup E]
@@ -2225,7 +2659,9 @@ theorem HasFTaylorSeriesUpToOn.exists_lipschitzOnWith {E F : Type _} [NormedAddC
     βˆƒ K, βˆƒ t ∈ 𝓝[s] x, LipschitzOnWith K f t :=
   (exists_gt _).imp <| hf.exists_lipschitzOnWith_of_nnnorm_lt hs
 #align has_ftaylor_series_up_to_on.exists_lipschitz_on_with HasFTaylorSeriesUpToOn.exists_lipschitzOnWith
+-/
 
+#print ContDiffWithinAt.exists_lipschitzOnWith /-
 /-- If `f` is `C^1` within a conves set `s` at `x`, then it is Lipschitz on a neighborhood of `x`
 within `s`. -/
 theorem ContDiffWithinAt.exists_lipschitzOnWith {E F : Type _} [NormedAddCommGroup E]
@@ -2242,7 +2678,9 @@ theorem ContDiffWithinAt.exists_lipschitzOnWith {E F : Type _} [NormedAddCommGro
   rw [inter_comm, ← nhdsWithin_restrict' _ (Metric.ball_mem_nhds _ Ξ΅0)] at hst 
   exact ⟨K, t, hst, hft⟩
 #align cont_diff_within_at.exists_lipschitz_on_with ContDiffWithinAt.exists_lipschitzOnWith
+-/
 
+#print ContDiffAt.exists_lipschitzOnWith_of_nnnorm_lt /-
 /-- If `f` is `C^1` at `x` and `K > β€–fderiv 𝕂 f xβ€–`, then `f` is `K`-Lipschitz in a neighborhood of
 `x`. -/
 theorem ContDiffAt.exists_lipschitzOnWith_of_nnnorm_lt {f : E' β†’ F'} {x : E'}
@@ -2250,12 +2688,15 @@ theorem ContDiffAt.exists_lipschitzOnWith_of_nnnorm_lt {f : E' β†’ F'} {x : E'}
     βˆƒ t ∈ 𝓝 x, LipschitzOnWith K f t :=
   (hf.HasStrictFDerivAt le_rfl).exists_lipschitzOnWith_of_nnnorm_lt K hK
 #align cont_diff_at.exists_lipschitz_on_with_of_nnnorm_lt ContDiffAt.exists_lipschitzOnWith_of_nnnorm_lt
+-/
 
+#print ContDiffAt.exists_lipschitzOnWith /-
 /-- If `f` is `C^1` at `x`, then `f` is Lipschitz in a neighborhood of `x`. -/
 theorem ContDiffAt.exists_lipschitzOnWith {f : E' β†’ F'} {x : E'} (hf : ContDiffAt 𝕂 1 f x) :
     βˆƒ K, βˆƒ t ∈ 𝓝 x, LipschitzOnWith K f t :=
   (hf.HasStrictFDerivAt le_rfl).exists_lipschitzOnWith
 #align cont_diff_at.exists_lipschitz_on_with ContDiffAt.exists_lipschitzOnWith
+-/
 
 end Real
 
@@ -2274,6 +2715,7 @@ variable {fβ‚‚ : π•œ β†’ F} {sβ‚‚ : Set π•œ}
 
 open ContinuousLinearMap (smul_right)
 
+#print contDiffOn_succ_iff_derivWithin /-
 /-- A function is `C^(n + 1)` on a domain with unique derivatives if and only if it is
 differentiable there, and its derivative (formulated with `deriv_within`) is `C^n`. -/
 theorem contDiffOn_succ_iff_derivWithin {n : β„•} (hs : UniqueDiffOn π•œ sβ‚‚) :
@@ -2296,8 +2738,10 @@ theorem contDiffOn_succ_iff_derivWithin {n : β„•} (hs : UniqueDiffOn π•œ sβ‚‚)
     have : IsBoundedBilinearMap π•œ fun _ : (π•œ β†’L[π•œ] π•œ) Γ— F => _ := isBoundedBilinearMap_smulRight
     exact (this.is_bounded_linear_map_right _).ContDiff
 #align cont_diff_on_succ_iff_deriv_within contDiffOn_succ_iff_derivWithin
+-/
 
 /- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:73:14: unsupported tactic `congrm #[[expr «expr ∧ »(_, _)]] -/
+#print contDiffOn_succ_iff_deriv_of_open /-
 /-- A function is `C^(n + 1)` on an open domain if and only if it is
 differentiable there, and its derivative (formulated with `deriv`) is `C^n`. -/
 theorem contDiffOn_succ_iff_deriv_of_open {n : β„•} (hs : IsOpen sβ‚‚) :
@@ -2308,7 +2752,9 @@ theorem contDiffOn_succ_iff_deriv_of_open {n : β„•} (hs : IsOpen sβ‚‚) :
     "./././Mathport/Syntax/Translate/Tactic/Builtin.lean:73:14: unsupported tactic `congrm #[[expr «expr ∧ »(_, _)]]"
   exact contDiffOn_congr fun _ => derivWithin_of_open hs
 #align cont_diff_on_succ_iff_deriv_of_open contDiffOn_succ_iff_deriv_of_open
+-/
 
+#print contDiffOn_top_iff_derivWithin /-
 /-- A function is `C^∞` on a domain with unique derivatives if and only if it is differentiable
 there, and its derivative (formulated with `deriv_within`) is `C^∞`. -/
 theorem contDiffOn_top_iff_derivWithin (hs : UniqueDiffOn π•œ sβ‚‚) :
@@ -2325,8 +2771,10 @@ theorem contDiffOn_top_iff_derivWithin (hs : UniqueDiffOn π•œ sβ‚‚) :
     apply ((contDiffOn_succ_iff_derivWithin hs).2 ⟨h.1, h.2.of_le A⟩).of_le
     exact WithTop.coe_le_coe.2 (Nat.le_succ n)
 #align cont_diff_on_top_iff_deriv_within contDiffOn_top_iff_derivWithin
+-/
 
 /- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:73:14: unsupported tactic `congrm #[[expr «expr ∧ »(_, _)]] -/
+#print contDiffOn_top_iff_deriv_of_open /-
 /-- A function is `C^∞` on an open domain if and only if it is differentiable
 there, and its derivative (formulated with `deriv`) is `C^∞`. -/
 theorem contDiffOn_top_iff_deriv_of_open (hs : IsOpen sβ‚‚) :
@@ -2337,7 +2785,9 @@ theorem contDiffOn_top_iff_deriv_of_open (hs : IsOpen sβ‚‚) :
     "./././Mathport/Syntax/Translate/Tactic/Builtin.lean:73:14: unsupported tactic `congrm #[[expr «expr ∧ »(_, _)]]"
   exact contDiffOn_congr fun _ => derivWithin_of_open hs
 #align cont_diff_on_top_iff_deriv_of_open contDiffOn_top_iff_deriv_of_open
+-/
 
+#print ContDiffOn.derivWithin /-
 theorem ContDiffOn.derivWithin (hf : ContDiffOn π•œ n fβ‚‚ sβ‚‚) (hs : UniqueDiffOn π•œ sβ‚‚)
     (hmn : m + 1 ≀ n) : ContDiffOn π•œ m (derivWithin fβ‚‚ sβ‚‚) sβ‚‚ :=
   by
@@ -2349,22 +2799,30 @@ theorem ContDiffOn.derivWithin (hf : ContDiffOn π•œ n fβ‚‚ sβ‚‚) (hs : UniqueDi
   Β· change (m.succ : β„•βˆž) ≀ n at hmn 
     exact ((contDiffOn_succ_iff_derivWithin hs).1 (hf.of_le hmn)).2
 #align cont_diff_on.deriv_within ContDiffOn.derivWithin
+-/
 
+#print ContDiffOn.deriv_of_open /-
 theorem ContDiffOn.deriv_of_open (hf : ContDiffOn π•œ n fβ‚‚ sβ‚‚) (hs : IsOpen sβ‚‚) (hmn : m + 1 ≀ n) :
     ContDiffOn π•œ m (deriv fβ‚‚) sβ‚‚ :=
   (hf.derivWithin hs.UniqueDiffOn hmn).congr fun x hx => (derivWithin_of_open hs hx).symm
 #align cont_diff_on.deriv_of_open ContDiffOn.deriv_of_open
+-/
 
+#print ContDiffOn.continuousOn_derivWithin /-
 theorem ContDiffOn.continuousOn_derivWithin (h : ContDiffOn π•œ n fβ‚‚ sβ‚‚) (hs : UniqueDiffOn π•œ sβ‚‚)
     (hn : 1 ≀ n) : ContinuousOn (derivWithin fβ‚‚ sβ‚‚) sβ‚‚ :=
   ((contDiffOn_succ_iff_derivWithin hs).1 (h.of_le hn)).2.ContinuousOn
 #align cont_diff_on.continuous_on_deriv_within ContDiffOn.continuousOn_derivWithin
+-/
 
+#print ContDiffOn.continuousOn_deriv_of_open /-
 theorem ContDiffOn.continuousOn_deriv_of_open (h : ContDiffOn π•œ n fβ‚‚ sβ‚‚) (hs : IsOpen sβ‚‚)
     (hn : 1 ≀ n) : ContinuousOn (deriv fβ‚‚) sβ‚‚ :=
   ((contDiffOn_succ_iff_deriv_of_open hs).1 (h.of_le hn)).2.ContinuousOn
 #align cont_diff_on.continuous_on_deriv_of_open ContDiffOn.continuousOn_deriv_of_open
+-/
 
+#print contDiff_succ_iff_deriv /-
 /-- A function is `C^(n + 1)` if and only if it is differentiable,
   and its derivative (formulated in terms of `deriv`) is `C^n`. -/
 theorem contDiff_succ_iff_deriv {n : β„•} :
@@ -2372,11 +2830,15 @@ theorem contDiff_succ_iff_deriv {n : β„•} :
   simp only [← contDiffOn_univ, contDiffOn_succ_iff_deriv_of_open, isOpen_univ,
     differentiableOn_univ]
 #align cont_diff_succ_iff_deriv contDiff_succ_iff_deriv
+-/
 
+#print contDiff_one_iff_deriv /-
 theorem contDiff_one_iff_deriv : ContDiff π•œ 1 fβ‚‚ ↔ Differentiable π•œ fβ‚‚ ∧ Continuous (deriv fβ‚‚) :=
   contDiff_succ_iff_deriv.trans <| Iff.rfl.And contDiff_zero
 #align cont_diff_one_iff_deriv contDiff_one_iff_deriv
+-/
 
+#print contDiff_top_iff_deriv /-
 /-- A function is `C^∞` if and only if it is differentiable,
 and its derivative (formulated in terms of `deriv`) is `C^∞`. -/
 theorem contDiff_top_iff_deriv : ContDiff π•œ ∞ fβ‚‚ ↔ Differentiable π•œ fβ‚‚ ∧ ContDiff π•œ ∞ (deriv fβ‚‚) :=
@@ -2384,22 +2846,29 @@ theorem contDiff_top_iff_deriv : ContDiff π•œ ∞ fβ‚‚ ↔ Differentiable π•œ
   simp only [← contDiffOn_univ, ← differentiableOn_univ, ← derivWithin_univ]
   rw [contDiffOn_top_iff_derivWithin uniqueDiffOn_univ]
 #align cont_diff_top_iff_deriv contDiff_top_iff_deriv
+-/
 
+#print ContDiff.continuous_deriv /-
 theorem ContDiff.continuous_deriv (h : ContDiff π•œ n fβ‚‚) (hn : 1 ≀ n) : Continuous (deriv fβ‚‚) :=
   (contDiff_succ_iff_deriv.mp (h.of_le hn)).2.Continuous
 #align cont_diff.continuous_deriv ContDiff.continuous_deriv
+-/
 
+#print ContDiff.iterate_deriv /-
 theorem ContDiff.iterate_deriv :
     βˆ€ (n : β„•) {fβ‚‚ : π•œ β†’ F} (hf : ContDiff π•œ ∞ fβ‚‚), ContDiff π•œ ∞ ((deriv^[n]) fβ‚‚)
   | 0, fβ‚‚, hf => hf
   | n + 1, fβ‚‚, hf => ContDiff.iterate_deriv n (contDiff_top_iff_deriv.mp hf).2
 #align cont_diff.iterate_deriv ContDiff.iterate_deriv
+-/
 
+#print ContDiff.iterate_deriv' /-
 theorem ContDiff.iterate_deriv' (n : β„•) :
     βˆ€ (k : β„•) {fβ‚‚ : π•œ β†’ F} (hf : ContDiff π•œ (n + k : β„•) fβ‚‚), ContDiff π•œ n ((deriv^[k]) fβ‚‚)
   | 0, fβ‚‚, hf => hf
   | n + 1, fβ‚‚, hf => ContDiff.iterate_deriv' n (contDiff_succ_iff_deriv.mp hf).2
 #align cont_diff.iterate_deriv' ContDiff.iterate_deriv'
+-/
 
 end deriv
 
@@ -2423,6 +2892,7 @@ variable [NormedSpace π•œ' F] [IsScalarTower π•œ π•œ' F]
 
 variable {p' : E β†’ FormalMultilinearSeries π•œ' E F}
 
+#print HasFTaylorSeriesUpToOn.restrictScalars /-
 theorem HasFTaylorSeriesUpToOn.restrictScalars (h : HasFTaylorSeriesUpToOn n f p' s) :
     HasFTaylorSeriesUpToOn n f (fun x => (p' x).restrictScalars π•œ) s :=
   { zero_eq := fun x hx => h.zero_eq x hx
@@ -2434,31 +2904,41 @@ theorem HasFTaylorSeriesUpToOn.restrictScalars (h : HasFTaylorSeriesUpToOn n f p
     cont := fun m hm =>
       ContinuousMultilinearMap.continuous_restrictScalars.comp_continuousOn (h.cont m hm) }
 #align has_ftaylor_series_up_to_on.restrict_scalars HasFTaylorSeriesUpToOn.restrictScalars
+-/
 
+#print ContDiffWithinAt.restrict_scalars /-
 theorem ContDiffWithinAt.restrict_scalars (h : ContDiffWithinAt π•œ' n f s x) :
     ContDiffWithinAt π•œ n f s x := by
   intro m hm
   rcases h m hm with ⟨u, u_mem, p', hp'⟩
   exact ⟨u, u_mem, _, hp'.restrict_scalars _⟩
 #align cont_diff_within_at.restrict_scalars ContDiffWithinAt.restrict_scalars
+-/
 
+#print ContDiffOn.restrict_scalars /-
 theorem ContDiffOn.restrict_scalars (h : ContDiffOn π•œ' n f s) : ContDiffOn π•œ n f s := fun x hx =>
   (h x hx).restrictScalars _
 #align cont_diff_on.restrict_scalars ContDiffOn.restrict_scalars
+-/
 
+#print ContDiffAt.restrict_scalars /-
 theorem ContDiffAt.restrict_scalars (h : ContDiffAt π•œ' n f x) : ContDiffAt π•œ n f x :=
   contDiffWithinAt_univ.1 <| h.ContDiffWithinAt.restrictScalars _
 #align cont_diff_at.restrict_scalars ContDiffAt.restrict_scalars
+-/
 
+#print ContDiff.restrict_scalars /-
 theorem ContDiff.restrict_scalars (h : ContDiff π•œ' n f) : ContDiff π•œ n f :=
   contDiff_iff_contDiffAt.2 fun x => h.ContDiffAt.restrictScalars _
 #align cont_diff.restrict_scalars ContDiff.restrict_scalars
+-/
 
 end RestrictScalars
 
 /-!## Quantitative bounds -/
 
 
+#print ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear_aux /-
 /-- Bounding the norm of the iterated derivative of `B (f x) (g x)` within a set in terms of the
 iterated derivatives of `f` and `g` when `B` is bilinear. This lemma is an auxiliary version
 assuming all spaces live in the same universe, to enable an induction. Use instead
@@ -2565,7 +3045,9 @@ theorem ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear_aux {Du Eu
       (Finset.sum_choose_succ_mul
           (fun i j => β€–iteratedFDerivWithin π•œ i f s xβ€– * β€–iteratedFDerivWithin π•œ j g s xβ€–) n).symm
 #align continuous_linear_map.norm_iterated_fderiv_within_le_of_bilinear_aux ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear_aux
+-/
 
+#print ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear /-
 /-- Bounding the norm of the iterated derivative of `B (f x) (g x)` within a set in terms of the
 iterated derivatives of `f` and `g` when `B` is bilinear:
 `β€–D^n (x ↦ B (f x) (g x))β€– ≀ β€–Bβ€– βˆ‘_{k ≀ n} n.choose k β€–D^k fβ€– β€–D^{n-k} gβ€–` -/
@@ -2662,7 +3144,9 @@ theorem ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear (B : E β†’L
   apply this.trans (mul_le_mul_of_nonneg_right Bu_le _)
   exact Finset.sum_nonneg' fun i => by positivity
 #align continuous_linear_map.norm_iterated_fderiv_within_le_of_bilinear ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear
+-/
 
+#print ContinuousLinearMap.norm_iteratedFDeriv_le_of_bilinear /-
 /-- Bounding the norm of the iterated derivative of `B (f x) (g x)` in terms of the
 iterated derivatives of `f` and `g` when `B` is bilinear:
 `β€–D^n (x ↦ B (f x) (g x))β€– ≀ β€–Bβ€– βˆ‘_{k ≀ n} n.choose k β€–D^k fβ€– β€–D^{n-k} gβ€–` -/
@@ -2679,7 +3163,9 @@ theorem ContinuousLinearMap.norm_iteratedFDeriv_le_of_bilinear (B : E β†’L[π•œ]
     B.norm_iterated_fderiv_within_le_of_bilinear hf.cont_diff_on hg.cont_diff_on uniqueDiffOn_univ
       (mem_univ x) hn
 #align continuous_linear_map.norm_iterated_fderiv_le_of_bilinear ContinuousLinearMap.norm_iteratedFDeriv_le_of_bilinear
+-/
 
+#print ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear_of_le_one /-
 /-- Bounding the norm of the iterated derivative of `B (f x) (g x)` within a set in terms of the
 iterated derivatives of `f` and `g` when `B` is bilinear of norm at most `1`:
 `β€–D^n (x ↦ B (f x) (g x))β€– ≀ βˆ‘_{k ≀ n} n.choose k β€–D^k fβ€– β€–D^{n-k} gβ€–` -/
@@ -2696,7 +3182,9 @@ theorem ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear_of_le_one
   apply mul_le_of_le_one_left (Finset.sum_nonneg' fun i => _) hB
   positivity
 #align continuous_linear_map.norm_iterated_fderiv_within_le_of_bilinear_of_le_one ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear_of_le_one
+-/
 
+#print ContinuousLinearMap.norm_iteratedFDeriv_le_of_bilinear_of_le_one /-
 /-- Bounding the norm of the iterated derivative of `B (f x) (g x)` in terms of the
 iterated derivatives of `f` and `g` when `B` is bilinear of norm at most `1`:
 `β€–D^n (x ↦ B (f x) (g x))β€– ≀ βˆ‘_{k ≀ n} n.choose k β€–D^k fβ€– β€–D^{n-k} gβ€–` -/
@@ -2712,12 +3200,14 @@ theorem ContinuousLinearMap.norm_iteratedFDeriv_le_of_bilinear_of_le_one (B : E
     B.norm_iterated_fderiv_within_le_of_bilinear_of_le_one hf.cont_diff_on hg.cont_diff_on
       uniqueDiffOn_univ (mem_univ x) hn hB
 #align continuous_linear_map.norm_iterated_fderiv_le_of_bilinear_of_le_one ContinuousLinearMap.norm_iteratedFDeriv_le_of_bilinear_of_le_one
+-/
 
 section
 
 variable {π•œ' : Type _} [NormedField π•œ'] [NormedAlgebra π•œ π•œ'] [NormedSpace π•œ' F]
   [IsScalarTower π•œ π•œ' F]
 
+#print norm_iteratedFDerivWithin_smul_le /-
 theorem norm_iteratedFDerivWithin_smul_le {f : E β†’ π•œ'} {g : E β†’ F} {N : β„•βˆž}
     (hf : ContDiffOn π•œ N f s) (hg : ContDiffOn π•œ N g s) (hs : UniqueDiffOn π•œ s) {x : E} (hx : x ∈ s)
     {n : β„•} (hn : (n : β„•βˆž) ≀ N) :
@@ -2729,7 +3219,9 @@ theorem norm_iteratedFDerivWithin_smul_le {f : E β†’ π•œ'} {g : E β†’ F} {N : 
         π•œ' β†’L[π•œ] F β†’L[π•œ] F).norm_iteratedFDerivWithin_le_of_bilinear_of_le_one
     hf hg hs hx hn ContinuousLinearMap.op_norm_lsmul_le
 #align norm_iterated_fderiv_within_smul_le norm_iteratedFDerivWithin_smul_le
+-/
 
+#print norm_iteratedFDeriv_smul_le /-
 theorem norm_iteratedFDeriv_smul_le {f : E β†’ π•œ'} {g : E β†’ F} {N : β„•βˆž} (hf : ContDiff π•œ N f)
     (hg : ContDiff π•œ N g) (x : E) {n : β„•} (hn : (n : β„•βˆž) ≀ N) :
     β€–iteratedFDeriv π•œ n (fun y => f y β€’ g y) xβ€– ≀
@@ -2738,6 +3230,7 @@ theorem norm_iteratedFDeriv_smul_le {f : E β†’ π•œ'} {g : E β†’ F} {N : β„•βˆž}
   (ContinuousLinearMap.lsmul π•œ π•œ' : π•œ' β†’L[π•œ] F β†’L[π•œ] F).norm_iteratedFDeriv_le_of_bilinear_of_le_one
     hf hg x hn ContinuousLinearMap.op_norm_lsmul_le
 #align norm_iterated_fderiv_smul_le norm_iteratedFDeriv_smul_le
+-/
 
 end
 
@@ -2745,6 +3238,7 @@ section
 
 variable {A : Type _} [NormedRing A] [NormedAlgebra π•œ A]
 
+#print norm_iteratedFDerivWithin_mul_le /-
 theorem norm_iteratedFDerivWithin_mul_le {f : E β†’ A} {g : E β†’ A} {N : β„•βˆž} (hf : ContDiffOn π•œ N f s)
     (hg : ContDiffOn π•œ N g s) (hs : UniqueDiffOn π•œ s) {x : E} (hx : x ∈ s) {n : β„•}
     (hn : (n : β„•βˆž) ≀ N) :
@@ -2756,7 +3250,9 @@ theorem norm_iteratedFDerivWithin_mul_le {f : E β†’ A} {g : E β†’ A} {N : β„•βˆž
         A β†’L[π•œ] A β†’L[π•œ] A).norm_iteratedFDerivWithin_le_of_bilinear_of_le_one
     hf hg hs hx hn (ContinuousLinearMap.op_norm_mul_le _ _)
 #align norm_iterated_fderiv_within_mul_le norm_iteratedFDerivWithin_mul_le
+-/
 
+#print norm_iteratedFDeriv_mul_le /-
 theorem norm_iteratedFDeriv_mul_le {f : E β†’ A} {g : E β†’ A} {N : β„•βˆž} (hf : ContDiff π•œ N f)
     (hg : ContDiff π•œ N g) (x : E) {n : β„•} (hn : (n : β„•βˆž) ≀ N) :
     β€–iteratedFDeriv π•œ n (fun y => f y * g y) xβ€– ≀
@@ -2768,9 +3264,11 @@ theorem norm_iteratedFDeriv_mul_le {f : E β†’ A} {g : E β†’ A} {N : β„•βˆž} (hf
     norm_iteratedFDerivWithin_mul_le hf.cont_diff_on hg.cont_diff_on uniqueDiffOn_univ (mem_univ x)
       hn
 #align norm_iterated_fderiv_mul_le norm_iteratedFDeriv_mul_le
+-/
 
 end
 
+#print norm_iteratedFDerivWithin_comp_le_aux /-
 /-- If the derivatives within a set of `g` at `f x` are bounded by `C`, and the `i`-th derivative
 within a set of `f` at `x` is bounded by `D^i` for all `1 ≀ i ≀ n`, then the `n`-th derivative
 of `g ∘ f` is bounded by `n! * C * D^n`.
@@ -2910,7 +3408,9 @@ theorem norm_iteratedFDerivWithin_comp_le_aux {Fu Gu : Type u} [NormedAddCommGro
       simp only [mul_assoc, mul_one, Finset.sum_const, Finset.card_range, nsmul_eq_mul,
         Nat.factorial_succ, Nat.cast_mul]
 #align norm_iterated_fderiv_within_comp_le_aux norm_iteratedFDerivWithin_comp_le_aux
+-/
 
+#print norm_iteratedFDerivWithin_comp_le /-
 /-- If the derivatives within a set of `g` at `f x` are bounded by `C`, and the `i`-th derivative
 within a set of `f` at `x` is bounded by `D^i` for all `1 ≀ i ≀ n`, then the `n`-th derivative
 of `g ∘ f` is bounded by `n! * C * D^n`. -/
@@ -2965,7 +3465,9 @@ theorem norm_iteratedFDerivWithin_comp_le {g : F β†’ G} {f : E β†’ F} {n : β„•}
   rw [Nfgu]
   exact norm_iteratedFDerivWithin_comp_le_aux hgu hfu htu hs hstu hx hC hD
 #align norm_iterated_fderiv_within_comp_le norm_iteratedFDerivWithin_comp_le
+-/
 
+#print norm_iteratedFDeriv_comp_le /-
 /-- If the derivatives of `g` at `f x` are bounded by `C`, and the `i`-th derivative
 of `f` at `x` is bounded by `D^i` for all `1 ≀ i ≀ n`, then the `n`-th derivative
 of `g ∘ f` is bounded by `n! * C * D^n`. -/
@@ -2980,9 +3482,11 @@ theorem norm_iteratedFDeriv_comp_le {g : F β†’ G} {f : E β†’ F} {n : β„•} {N : 
     norm_iteratedFDerivWithin_comp_le hg.cont_diff_on hf.cont_diff_on hn uniqueDiffOn_univ
       uniqueDiffOn_univ (maps_to_univ _ _) (mem_univ x) hC hD
 #align norm_iterated_fderiv_comp_le norm_iteratedFDeriv_comp_le
+-/
 
 section Apply
 
+#print norm_iteratedFDerivWithin_clm_apply /-
 theorem norm_iteratedFDerivWithin_clm_apply {f : E β†’ F β†’L[π•œ] G} {g : E β†’ F} {s : Set E} {x : E}
     {N : β„•βˆž} {n : β„•} (hf : ContDiffOn π•œ N f s) (hg : ContDiffOn π•œ N g s) (hs : UniqueDiffOn π•œ s)
     (hx : x ∈ s) (hn : ↑n ≀ N) :
@@ -2998,7 +3502,9 @@ theorem norm_iteratedFDerivWithin_clm_apply {f : E β†’ F β†’L[π•œ] G} {g : E 
     simp only [ContinuousLinearMap.coe_id', id.def, one_mul]
   exact B.norm_iterated_fderiv_within_le_of_bilinear_of_le_one hf hg hs hx hn hB
 #align norm_iterated_fderiv_within_clm_apply norm_iteratedFDerivWithin_clm_apply
+-/
 
+#print norm_iteratedFDeriv_clm_apply /-
 theorem norm_iteratedFDeriv_clm_apply {f : E β†’ F β†’L[π•œ] G} {g : E β†’ F} {N : β„•βˆž} {n : β„•}
     (hf : ContDiff π•œ N f) (hg : ContDiff π•œ N g) (x : E) (hn : ↑n ≀ N) :
     β€–iteratedFDeriv π•œ n (fun y : E => (f y) (g y)) xβ€– ≀
@@ -3010,7 +3516,9 @@ theorem norm_iteratedFDeriv_clm_apply {f : E β†’ F β†’L[π•œ] G} {g : E β†’ F} {
     norm_iteratedFDerivWithin_clm_apply hf.cont_diff_on hg.cont_diff_on uniqueDiffOn_univ
       (Set.mem_univ x) hn
 #align norm_iterated_fderiv_clm_apply norm_iteratedFDeriv_clm_apply
+-/
 
+#print norm_iteratedFDerivWithin_clm_apply_const /-
 theorem norm_iteratedFDerivWithin_clm_apply_const {f : E β†’ F β†’L[π•œ] G} {c : F} {s : Set E} {x : E}
     {N : β„•βˆž} {n : β„•} (hf : ContDiffOn π•œ N f s) (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) (hn : ↑n ≀ N) :
     β€–iteratedFDerivWithin π•œ n (fun y : E => (f y) c) s xβ€– ≀
@@ -3024,7 +3532,9 @@ theorem norm_iteratedFDerivWithin_clm_apply_const {f : E β†’ F β†’L[π•œ] G} {c
   rw [ContinuousLinearMap.apply_apply, mul_comm]
   exact f.le_op_norm c
 #align norm_iterated_fderiv_within_clm_apply_const norm_iteratedFDerivWithin_clm_apply_const
+-/
 
+#print norm_iteratedFDeriv_clm_apply_const /-
 theorem norm_iteratedFDeriv_clm_apply_const {f : E β†’ F β†’L[π•œ] G} {c : F} {x : E} {N : β„•βˆž} {n : β„•}
     (hf : ContDiff π•œ N f) (hn : ↑n ≀ N) :
     β€–iteratedFDeriv π•œ n (fun y : E => (f y) c) xβ€– ≀ β€–cβ€– * β€–iteratedFDeriv π•œ n f xβ€– :=
@@ -3033,6 +3543,7 @@ theorem norm_iteratedFDeriv_clm_apply_const {f : E β†’ F β†’L[π•œ] G} {c : F} {
   refine'
     norm_iteratedFDerivWithin_clm_apply_const hf.cont_diff_on uniqueDiffOn_univ (Set.mem_univ x) hn
 #align norm_iterated_fderiv_clm_apply_const norm_iteratedFDeriv_clm_apply_const
+-/
 
 end Apply
 
Diff
@@ -63,26 +63,26 @@ namespace Finset
 /-- The sum of `(n+1).choose i * f i (n+1-i)` can be split into two sums at rank `n`,
 respectively of `n.choose i * f i (n+1-i)` and `n.choose i * f (i+1) (n-i)`. -/
 theorem sum_choose_succ_mul {R : Type _} [Semiring R] (f : β„• β†’ β„• β†’ R) (n : β„•) :
-    (βˆ‘ i in range (n + 2), ((n + 1).choose i : R) * f i (n + 1 - i)) =
-      (βˆ‘ i in range (n + 1), (n.choose i : R) * f i (n + 1 - i)) +
+    βˆ‘ i in range (n + 2), ((n + 1).choose i : R) * f i (n + 1 - i) =
+      βˆ‘ i in range (n + 1), (n.choose i : R) * f i (n + 1 - i) +
         βˆ‘ i in range (n + 1), (n.choose i : R) * f (i + 1) (n - i) :=
   by
   have A :
-    (βˆ‘ i in range (n + 1), (n.choose (i + 1) : R) * f (i + 1) (n - i)) + f 0 (n + 1) =
+    βˆ‘ i in range (n + 1), (n.choose (i + 1) : R) * f (i + 1) (n - i) + f 0 (n + 1) =
       βˆ‘ i in range (n + 1), n.choose i * f i (n + 1 - i) :=
     by
     rw [Finset.sum_range_succ, Finset.sum_range_succ']
     simp only [Nat.choose_succ_self, algebraMap.coe_zero, MulZeroClass.zero_mul, add_zero,
       Nat.succ_sub_succ_eq_sub, Nat.choose_zero_right, algebraMap.coe_one, one_mul, tsub_zero]
   calc
-    (βˆ‘ i in Finset.range (n + 2), ((n + 1).choose i : R) * f i (n + 1 - i)) =
-        (βˆ‘ i in Finset.range (n + 1), ((n + 1).choose (i + 1) : R) * f (i + 1) (n + 1 - (i + 1))) +
+    βˆ‘ i in Finset.range (n + 2), ((n + 1).choose i : R) * f i (n + 1 - i) =
+        βˆ‘ i in Finset.range (n + 1), ((n + 1).choose (i + 1) : R) * f (i + 1) (n + 1 - (i + 1)) +
           f 0 (n + 1 - 0) :=
       by
       rw [Finset.sum_range_succ']
       simp only [Nat.choose_zero_right, algebraMap.coe_one, one_mul]
     _ =
-        (βˆ‘ i in Finset.range (n + 1), (n.choose i : R) * f i (n + 1 - i)) +
+        βˆ‘ i in Finset.range (n + 1), (n.choose i : R) * f i (n + 1 - i) +
           βˆ‘ i in Finset.range (n + 1), n.choose i * f (i + 1) (n - i) :=
       by
       simp only [Nat.choose_succ_succ, Nat.cast_add, Nat.succ_sub_succ_eq_sub, tsub_zero, add_mul]
@@ -93,8 +93,8 @@ theorem sum_choose_succ_mul {R : Type _} [Semiring R] (f : β„• β†’ β„• β†’ R) (n
 /-- The sum along the antidiagonal of `(n+1).choose i * f i j` can be split into two sums along the
 antidiagonal at rank `n`, respectively of `n.choose i * f i (j+1)` and `n.choose j * f (i+1) j`. -/
 theorem sum_antidiagonal_choose_succ_mul {R : Type _} [Semiring R] (f : β„• β†’ β„• β†’ R) (n : β„•) :
-    (βˆ‘ ij in Nat.antidiagonal (n + 1), ((n + 1).choose ij.1 : R) * f ij.1 ij.2) =
-      (βˆ‘ ij in Nat.antidiagonal n, (n.choose ij.1 : R) * f ij.1 (ij.2 + 1)) +
+    βˆ‘ ij in Nat.antidiagonal (n + 1), ((n + 1).choose ij.1 : R) * f ij.1 ij.2 =
+      βˆ‘ ij in Nat.antidiagonal n, (n.choose ij.1 : R) * f ij.1 (ij.2 + 1) +
         βˆ‘ ij in Nat.antidiagonal n, (n.choose ij.2 : R) * f (ij.1 + 1) ij.2 :=
   by
   convert sum_choose_succ_mul f n using 1
@@ -105,7 +105,7 @@ theorem sum_antidiagonal_choose_succ_mul {R : Type _} [Semiring R] (f : β„• β†’
     have : n + 1 - i = n - i + 1 := Nat.sub_add_comm (Nat.lt_succ_iff.1 (Finset.mem_range.1 hi))
     simp only [this]
   Β· suffices H :
-      (βˆ‘ ij in nat.antidiagonal n, (n.choose ij.2 : R) * f (ij.1 + 1) ij.2) =
+      βˆ‘ ij in nat.antidiagonal n, (n.choose ij.2 : R) * f (ij.1 + 1) ij.2 =
         βˆ‘ ij in nat.antidiagonal n, (n.choose ij.1 : R) * f (ij.1 + 1) ij.2
     Β· rw [H, nat.sum_antidiagonal_eq_sum_range_succ (fun i j => (n.choose i : R) * f (i + 1) j) n]
     apply Finset.sum_congr rfl fun i hi => _
Diff
@@ -88,7 +88,6 @@ theorem sum_choose_succ_mul {R : Type _} [Semiring R] (f : β„• β†’ β„• β†’ R) (n
       simp only [Nat.choose_succ_succ, Nat.cast_add, Nat.succ_sub_succ_eq_sub, tsub_zero, add_mul]
       rw [Finset.sum_add_distrib, ← A]
       abel
-    
 #align finset.sum_choose_succ_mul Finset.sum_choose_succ_mul
 
 /-- The sum along the antidiagonal of `(n+1).choose i * f i j` can be split into two sums along the
@@ -1404,7 +1403,6 @@ theorem iteratedFDerivWithin_add_apply {f g : E β†’ F} (hf : ContDiffOn π•œ i f
             x (h 0) (Fin.tail h) :=
         by rw [Pi.add_def, fderivWithin_add (hu x hx) (hdf x hx) (hdg x hx)]; rfl
       _ = (iteratedFDerivWithin π•œ (i + 1) f s + iteratedFDerivWithin π•œ (i + 1) g s) x h := rfl
-      
 #align iterated_fderiv_within_add_apply iteratedFDerivWithin_add_apply
 
 /-- The iterated derivative of the sum of two functions is the sum of the iterated derivatives.
@@ -1483,7 +1481,6 @@ theorem iteratedFDerivWithin_neg_apply {f : E β†’ F} (hu : UniqueDiffOn π•œ s)
       _ = -(fderivWithin π•œ (iteratedFDerivWithin π•œ i f s) s) x (h 0) (Fin.tail h) := by
         rw [Pi.neg_def, fderivWithin_neg (hu x hx)]; rfl
       _ = -(iteratedFDerivWithin π•œ (i + 1) f s) x h := rfl
-      
 #align iterated_fderiv_within_neg_apply iteratedFDerivWithin_neg_apply
 
 theorem iteratedFDeriv_neg_apply {i : β„•} {f : E β†’ F} :
@@ -1765,7 +1762,6 @@ theorem iteratedFDerivWithin_const_smul_apply (hf : ContDiffOn π•œ i f s) (hu :
       _ = (a β€’ fderivWithin π•œ (iteratedFDerivWithin π•œ i f s)) s x (h 0) (Fin.tail h) := by
         rw [Pi.smul_def, fderivWithin_const_smul (hu x hx) (hdf x hx)]; rfl
       _ = a β€’ iteratedFDerivWithin π•œ (i + 1) f s x h := rfl
-      
 #align iterated_fderiv_within_const_smul_apply iteratedFDerivWithin_const_smul_apply
 
 theorem iteratedFDeriv_const_smul_apply {x : E} (hf : ContDiff π•œ i f) :
@@ -2516,7 +2512,6 @@ theorem ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear_aux {Du Eu
           apply Finset.sum_congr rfl fun i hi => _
           rw [Nat.succ_sub (Nat.lt_succ_iff.1 (Finset.mem_range.1 hi)),
             iteratedFDerivWithin_succ_eq_comp_right hs hx, LinearIsometryEquiv.norm_map]
-        
     have I2 :
       β€–iteratedFDerivWithin π•œ n (fun y : Du => B.precompL Du (fderivWithin π•œ f s y) (g y)) s xβ€– ≀
         β€–Bβ€– *
@@ -2541,7 +2536,6 @@ theorem ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear_aux {Du Eu
           congr 1
           apply Finset.sum_congr rfl fun i hi => _
           rw [iteratedFDerivWithin_succ_eq_comp_right hs hx, LinearIsometryEquiv.norm_map]
-        
     have J :
       iteratedFDerivWithin π•œ n (fun y : Du => fderivWithin π•œ (fun y : Du => B (f y) (g y)) s y) s
           x =
@@ -2624,7 +2618,6 @@ theorem ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear (B : E β†’L
       _ ≀ β€–Bβ€– * β€–isoE yβ€– * β€–isoF xβ€– :=
         (mul_le_mul_of_nonneg_right (ContinuousLinearMap.le_op_norm _ _) (norm_nonneg _))
       _ = β€–Bβ€– * β€–yβ€– * β€–xβ€– := by simp only [LinearIsometryEquiv.norm_map]
-      
   let su := isoD ⁻¹' s
   have hsu : UniqueDiffOn π•œ su := isoD.to_continuous_linear_equiv.unique_diff_on_preimage_iff.2 hs
   let xu := isoD.symm x
@@ -2916,7 +2909,6 @@ theorem norm_iteratedFDerivWithin_comp_le_aux {Fu Gu : Type u} [NormedAddCommGro
     _ = (n + 1)! * C * D ^ (n + 1) := by
       simp only [mul_assoc, mul_one, Finset.sum_const, Finset.card_range, nsmul_eq_mul,
         Nat.factorial_succ, Nat.cast_mul]
-    
 #align norm_iterated_fderiv_within_comp_le_aux norm_iteratedFDerivWithin_comp_le_aux
 
 /-- If the derivatives within a set of `g` at `f x` are bounded by `C`, and the `i`-th derivative
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: SΓ©bastien GouΓ«zel, Floris van Doorn
 
 ! This file was ported from Lean 3 source module analysis.calculus.cont_diff
-! leanprover-community/mathlib commit 3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe
+! leanprover-community/mathlib commit 575b4ea3738b017e30fb205cb9b4a8742e5e82b6
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -17,6 +17,9 @@ import Mathbin.Data.Nat.Choose.Cast
 /-!
 # Higher differentiability of usual operations
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 We prove that the usual operations (addition, multiplication, difference, composition, and
 so on) preserve `C^n` functions. We also expand the API around `C^n` functions.
 
Diff
@@ -273,9 +273,9 @@ theorem HasFTaylorSeriesUpToOn.continuousLinearMap_comp (g : F β†’L[π•œ] G)
   constructor
   Β· exact fun x hx => congr_arg g (hf.zero_eq x hx)
   Β· intro m hm x hx
-    convert(L m).HasFDerivAt.comp_hasFDerivWithinAt x (hf.fderiv_within m hm x hx)
+    convert (L m).HasFDerivAt.comp_hasFDerivWithinAt x (hf.fderiv_within m hm x hx)
   Β· intro m hm
-    convert(L m).Continuous.comp_continuousOn (hf.cont m hm)
+    convert (L m).Continuous.comp_continuousOn (hf.cont m hm)
 #align has_ftaylor_series_up_to_on.continuous_linear_map_comp HasFTaylorSeriesUpToOn.continuousLinearMap_comp
 
 /-- Composition by continuous linear maps on the left preserves `C^n` functions in a domain
@@ -450,7 +450,8 @@ theorem HasFTaylorSeriesUpToOn.compContinuousLinearMap (hf : HasFTaylorSeriesUpT
     rw [ContinuousLinearMap.map_zero]
     rfl
   Β· intro m hm x hx
-    convert(hA m).HasFDerivAt.comp_hasFDerivWithinAt x
+    convert
+      (hA m).HasFDerivAt.comp_hasFDerivWithinAt x
         ((hf.fderiv_within m hm (g x) hx).comp x g.has_fderiv_within_at (subset.refl _))
     ext (y v)
     change p (g x) (Nat.succ m) (g ∘ cons y v) = p (g x) m.succ (cons (g y) (g ∘ v))
@@ -469,7 +470,7 @@ theorem ContDiffWithinAt.comp_continuousLinearMap {x : G} (g : G β†’L[π•œ] E)
   intro m hm
   rcases hf m hm with ⟨u, hu, p, hp⟩
   refine' ⟨g ⁻¹' u, _, _, hp.comp_continuous_linear_map g⟩
-  apply ContinuousWithinAt.preimage_mem_nhds_within'
+  apply ContinuousWithinAt.preimage_mem_nhdsWithin'
   Β· exact g.continuous.continuous_within_at
   Β· apply nhdsWithin_mono (g x) _ hu
     rw [image_insert_eq]
@@ -617,7 +618,8 @@ theorem HasFTaylorSeriesUpToOn.prod (hf : HasFTaylorSeriesUpToOn n f p s) {g : E
   constructor
   Β· intro x hx; rw [← hf.zero_eq x hx, ← hg.zero_eq x hx]; rfl
   Β· intro m hm x hx
-    convert(L m).HasFDerivAt.comp_hasFDerivWithinAt x
+    convert
+      (L m).HasFDerivAt.comp_hasFDerivWithinAt x
         ((hf.fderiv_within m hm x hx).Prod (hg.fderiv_within m hm x hx))
   Β· intro m hm
     exact (L m).Continuous.comp_continuousOn ((hf.cont m hm).Prod (hg.cont m hm))
@@ -709,7 +711,7 @@ private theorem cont_diff_on.comp_same_univ {Eu : Type u} [NormedAddCommGroup Eu
     show w ∈ 𝓝[s] x
     Β· apply Filter.inter_mem self_mem_nhdsWithin
       apply Filter.inter_mem hu
-      apply ContinuousWithinAt.preimage_mem_nhds_within'
+      apply ContinuousWithinAt.preimage_mem_nhdsWithin'
       Β· rw [← continuousWithinAt_inter' hu]
         exact (hf' x xu).DifferentiableWithinAt.ContinuousWithinAt.mono (inter_subset_right _ _)
       Β· apply nhdsWithin_mono _ _ hv
@@ -999,13 +1001,13 @@ section SpecificBilinearMaps
 
 theorem ContDiff.clm_comp {g : X β†’ F β†’L[π•œ] G} {f : X β†’ E β†’L[π•œ] F} (hg : ContDiff π•œ n g)
     (hf : ContDiff π•œ n f) : ContDiff π•œ n fun x => (g x).comp (f x) :=
-  isBoundedBilinearMapComp.ContDiff.compβ‚‚ hg hf
+  isBoundedBilinearMap_comp.ContDiff.compβ‚‚ hg hf
 #align cont_diff.clm_comp ContDiff.clm_comp
 
 theorem ContDiffOn.clm_comp {g : X β†’ F β†’L[π•œ] G} {f : X β†’ E β†’L[π•œ] F} {s : Set X}
     (hg : ContDiffOn π•œ n g s) (hf : ContDiffOn π•œ n f s) :
     ContDiffOn π•œ n (fun x => (g x).comp (f x)) s :=
-  isBoundedBilinearMapComp.ContDiff.comp_contDiff_onβ‚‚ hg hf
+  isBoundedBilinearMap_comp.ContDiff.comp_contDiff_onβ‚‚ hg hf
 #align cont_diff_on.clm_comp ContDiffOn.clm_comp
 
 theorem ContDiff.clm_apply {f : E β†’ F β†’L[π•œ] G} {g : E β†’ F} {n : β„•βˆž} (hf : ContDiff π•œ n f)
@@ -1021,7 +1023,7 @@ theorem ContDiffOn.clm_apply {f : E β†’ F β†’L[π•œ] G} {g : E β†’ F} {n : β„•
 theorem ContDiff.smulRight {f : E β†’ F β†’L[π•œ] π•œ} {g : E β†’ G} {n : β„•βˆž} (hf : ContDiff π•œ n f)
     (hg : ContDiff π•œ n g) : ContDiff π•œ n fun x => (f x).smul_right (g x) :=
   (-- giving the following implicit type arguments speeds up elaboration significantly
-          @isBoundedBilinearMapSmulRight
+          @isBoundedBilinearMap_smulRight
           π•œ _ F _ _ G _ _).ContDiff.compβ‚‚
     hf hg
 #align cont_diff.smul_right ContDiff.smulRight
@@ -1085,7 +1087,7 @@ theorem ContDiffWithinAt.hasFDerivWithinAt_nhds {f : E β†’ F β†’ G} {g : E β†’ F
   Β· refine' inter_mem _ self_mem_nhdsWithin
     have := mem_of_mem_nhdsWithin (mem_insert _ _) hv
     refine' mem_nhds_within_insert.mpr ⟨this, _⟩
-    refine' (continuous_within_at_id.prod hg.continuous_within_at).preimage_mem_nhds_within' _
+    refine' (continuous_within_at_id.prod hg.continuous_within_at).preimage_mem_nhdsWithin' _
     rw [← nhdsWithin_le_iff] at hst hv ⊒
     refine' (hst.trans <| nhdsWithin_mono _ <| subset_insert _ _).trans hv
   Β· intro z hz
@@ -1108,7 +1110,7 @@ To show that `x ↦ D_yf(x,y)g(x)` (taken within `t`) is `C^m` at `xβ‚€` within
 * `g` is `C^m` at `xβ‚€` within `s`;
 * Derivatives are unique at `g(x)` within `t` for `x` sufficiently close to `xβ‚€` within `s βˆͺ {xβ‚€}`;
 * `t` is a neighborhood of `g(xβ‚€)` within `g '' s`; -/
-theorem ContDiffWithinAt.fderiv_within'' {f : E β†’ F β†’ G} {g : E β†’ F} {t : Set F} {n : β„•βˆž}
+theorem ContDiffWithinAt.fderivWithin'' {f : E β†’ F β†’ G} {g : E β†’ F} {t : Set F} {n : β„•βˆž}
     (hf : ContDiffWithinAt π•œ n (Function.uncurry f) (insert xβ‚€ s Γ—Λ’ t) (xβ‚€, g xβ‚€))
     (hg : ContDiffWithinAt π•œ m g s xβ‚€)
     (ht : βˆ€αΆ  x in 𝓝[insert xβ‚€ s] xβ‚€, UniqueDiffWithinAt π•œ t (g x)) (hmn : m + 1 ≀ n)
@@ -1129,17 +1131,17 @@ theorem ContDiffWithinAt.fderiv_within'' {f : E β†’ F β†’ G} {g : E β†’ F} {t :
     rw [contDiffWithinAt_top]
     exact fun m => this m le_top
   exact this m le_rfl
-#align cont_diff_within_at.fderiv_within'' ContDiffWithinAt.fderiv_within''
+#align cont_diff_within_at.fderiv_within'' ContDiffWithinAt.fderivWithin''
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 /-- A special case of `cont_diff_within_at.fderiv_within''` where we require that `s βŠ† g⁻¹(t)`. -/
-theorem ContDiffWithinAt.fderiv_within' {f : E β†’ F β†’ G} {g : E β†’ F} {t : Set F} {n : β„•βˆž}
+theorem ContDiffWithinAt.fderivWithin' {f : E β†’ F β†’ G} {g : E β†’ F} {t : Set F} {n : β„•βˆž}
     (hf : ContDiffWithinAt π•œ n (Function.uncurry f) (insert xβ‚€ s Γ—Λ’ t) (xβ‚€, g xβ‚€))
     (hg : ContDiffWithinAt π•œ m g s xβ‚€)
     (ht : βˆ€αΆ  x in 𝓝[insert xβ‚€ s] xβ‚€, UniqueDiffWithinAt π•œ t (g x)) (hmn : m + 1 ≀ n)
     (hst : s βŠ† g ⁻¹' t) : ContDiffWithinAt π•œ m (fun x => fderivWithin π•œ (f x) t (g x)) s xβ‚€ :=
-  hf.fderiv_within'' hg ht hmn <| mem_of_superset self_mem_nhdsWithin <| image_subset_iff.mpr hst
-#align cont_diff_within_at.fderiv_within' ContDiffWithinAt.fderiv_within'
+  hf.fderivWithin'' hg ht hmn <| mem_of_superset self_mem_nhdsWithin <| image_subset_iff.mpr hst
+#align cont_diff_within_at.fderiv_within' ContDiffWithinAt.fderivWithin'
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 /-- A special case of `cont_diff_within_at.fderiv_within'` where we require that `xβ‚€ ∈ s` and there
@@ -1275,10 +1277,10 @@ theorem hasFTaylorSeriesUpToOn_pi :
     exact (h i).zero_eq x hx
   Β· intro m hm x hx
     have := hasFDerivWithinAt_pi.2 fun i => (h i).fderivWithin m hm x hx
-    convert(L m).HasFDerivAt.comp_hasFDerivWithinAt x this
+    convert (L m).HasFDerivAt.comp_hasFDerivWithinAt x this
   Β· intro m hm
     have := continuousOn_pi.2 fun i => (h i).cont m hm
-    convert(L m).Continuous.comp_continuousOn this
+    convert (L m).Continuous.comp_continuousOn this
 #align has_ftaylor_series_up_to_on_pi hasFTaylorSeriesUpToOn_pi
 
 @[simp]
@@ -1523,11 +1525,10 @@ theorem ContDiffWithinAt.sum {ΞΉ : Type _} {f : ΞΉ β†’ E β†’ F} {s : Finset ΞΉ}
     (h : βˆ€ i ∈ s, ContDiffWithinAt π•œ n (fun x => f i x) t x) :
     ContDiffWithinAt π•œ n (fun x => βˆ‘ i in s, f i x) t x := by
   classical
-    induction' s using Finset.induction_on with i s is IH
-    Β· simp [contDiffWithinAt_const]
-    Β· simp only [is, Finset.sum_insert, not_false_iff]
-      exact
-        (h _ (Finset.mem_insert_self i s)).add (IH fun j hj => h _ (Finset.mem_insert_of_mem hj))
+  induction' s using Finset.induction_on with i s is IH
+  Β· simp [contDiffWithinAt_const]
+  Β· simp only [is, Finset.sum_insert, not_false_iff]
+    exact (h _ (Finset.mem_insert_self i s)).add (IH fun j hj => h _ (Finset.mem_insert_of_mem hj))
 #align cont_diff_within_at.sum ContDiffWithinAt.sum
 
 theorem ContDiffAt.sum {ΞΉ : Type _} {f : ΞΉ β†’ E β†’ F} {s : Finset ΞΉ} {x : E}
@@ -1671,7 +1672,7 @@ section Smul
 
 -- The scalar multiplication is smooth.
 theorem contDiff_smul : ContDiff π•œ n fun p : π•œ Γ— F => p.1 β€’ p.2 :=
-  isBoundedBilinearMapSmul.ContDiff
+  isBoundedBilinearMap_smul.ContDiff
 #align cont_diff_smul contDiff_smul
 
 /-- The scalar multiplication of two `C^n` functions within a set at a point is `C^n` within this
@@ -1861,7 +1862,7 @@ theorem contDiffAt_ring_inverse [CompleteSpace R] (x : RΛ£) : ContDiffAt π•œ n
   by
   induction' n using ENat.nat_induction with n IH Itop
   Β· intro m hm
-    refine' ⟨{ y : R | IsUnit y }, _, _⟩
+    refine' ⟨{y : R | IsUnit y}, _, _⟩
     Β· simp [nhdsWithin_univ]
       exact x.nhds
     Β· use ftaylorSeriesWithin π•œ inverse univ
@@ -1872,13 +1873,13 @@ theorem contDiffAt_ring_inverse [CompleteSpace R] (x : RΛ£) : ContDiffAt π•œ n
       Β· simp [ftaylorSeriesWithin]
   Β· apply cont_diff_at_succ_iff_has_fderiv_at.mpr
     refine' ⟨fun x : R => -mul_left_right π•œ R (inverse x) (inverse x), _, _⟩
-    · refine' ⟨{ y : R | IsUnit y }, x.nhds, _⟩
+    · refine' ⟨{y : R | IsUnit y}, x.nhds, _⟩
       rintro _ ⟨y, rfl⟩
       rw [inverse_unit]
       exact hasFDerivAt_ring_inverse y
     Β·
-      convert(mul_left_right_is_bounded_bilinear π•œ R).ContDiff.neg.comp_contDiffAt (x : R)
-          (IH.prod IH)
+      convert
+        (mul_left_right_is_bounded_bilinear π•œ R).ContDiff.neg.comp_contDiffAt (x : R) (IH.prod IH)
   Β· exact cont_diff_at_top.mpr Itop
 #align cont_diff_at_ring_inverse contDiffAt_ring_inverse
 
@@ -2000,7 +2001,7 @@ theorem LocalHomeomorph.contDiffAt_symm [CompleteSpace E] (f : LocalHomeomorph E
     -- This follows by a bootstrapping formula expressing the derivative as a function of `f` itself
     refine' ⟨inverse ∘ f' ∘ f.symm, _, _⟩
     Β· -- We first check that the derivative of `f` is that formula
-      have h_nhds : { y : E | βˆƒ e : E ≃L[π•œ] F, ↑e = f' y } ∈ 𝓝 (f.symm a) :=
+      have h_nhds : {y : E | βˆƒ e : E ≃L[π•œ] F, ↑e = f' y} ∈ 𝓝 (f.symm a) :=
         by
         have hfβ‚€' := fβ‚€'.nhds
         rw [← eq_fβ‚€'] at hfβ‚€' 
@@ -2154,27 +2155,27 @@ theorem HasFTaylorSeriesUpToOn.hasStrictFDerivAt {s : Set E'} {f : E' β†’ F'} {x
 
 /-- If a function is `C^n` with `1 ≀ n` around a point, and its derivative at that point is given to
 us as `f'`, then `f'` is also a strict derivative. -/
-theorem ContDiffAt.has_strict_fderiv_at' {f : E' β†’ F'} {f' : E' β†’L[𝕂] F'} {x : E'}
+theorem ContDiffAt.hasStrictFDerivAt' {f : E' β†’ F'} {f' : E' β†’L[𝕂] F'} {x : E'}
     (hf : ContDiffAt 𝕂 n f x) (hf' : HasFDerivAt f f' x) (hn : 1 ≀ n) : HasStrictFDerivAt f f' x :=
   by
   rcases hf 1 hn with ⟨u, H, p, hp⟩
   simp only [nhdsWithin_univ, mem_univ, insert_eq_of_mem] at H 
   have := hp.has_strict_fderiv_at le_rfl H
   rwa [hf'.unique this.has_fderiv_at]
-#align cont_diff_at.has_strict_fderiv_at' ContDiffAt.has_strict_fderiv_at'
+#align cont_diff_at.has_strict_fderiv_at' ContDiffAt.hasStrictFDerivAt'
 
 /-- If a function is `C^n` with `1 ≀ n` around a point, and its derivative at that point is given to
 us as `f'`, then `f'` is also a strict derivative. -/
-theorem ContDiffAt.has_strict_deriv_at' {f : 𝕂 β†’ F'} {f' : F'} {x : 𝕂} (hf : ContDiffAt 𝕂 n f x)
+theorem ContDiffAt.hasStrictDerivAt' {f : 𝕂 β†’ F'} {f' : F'} {x : 𝕂} (hf : ContDiffAt 𝕂 n f x)
     (hf' : HasDerivAt f f' x) (hn : 1 ≀ n) : HasStrictDerivAt f f' x :=
-  hf.has_strict_fderiv_at' hf' hn
-#align cont_diff_at.has_strict_deriv_at' ContDiffAt.has_strict_deriv_at'
+  hf.hasStrictFDerivAt' hf' hn
+#align cont_diff_at.has_strict_deriv_at' ContDiffAt.hasStrictDerivAt'
 
 /-- If a function is `C^n` with `1 ≀ n` around a point, then the derivative of `f` at this point
 is also a strict derivative. -/
 theorem ContDiffAt.hasStrictFDerivAt {f : E' β†’ F'} {x : E'} (hf : ContDiffAt 𝕂 n f x) (hn : 1 ≀ n) :
     HasStrictFDerivAt f (fderiv 𝕂 f x) x :=
-  hf.has_strict_fderiv_at' (hf.DifferentiableAt hn).HasFDerivAt hn
+  hf.hasStrictFDerivAt' (hf.DifferentiableAt hn).HasFDerivAt hn
 #align cont_diff_at.has_strict_fderiv_at ContDiffAt.hasStrictFDerivAt
 
 /-- If a function is `C^n` with `1 ≀ n` around a point, then the derivative of `f` at this point
@@ -2293,7 +2294,7 @@ theorem contDiffOn_succ_iff_derivWithin {n : β„•} (hs : UniqueDiffOn π•œ sβ‚‚)
       simp [derivWithin]
     simp only [this]
     apply ContDiff.comp_contDiffOn _ h
-    have : IsBoundedBilinearMap π•œ fun _ : (π•œ β†’L[π•œ] π•œ) Γ— F => _ := isBoundedBilinearMapSmulRight
+    have : IsBoundedBilinearMap π•œ fun _ : (π•œ β†’L[π•œ] π•œ) Γ— F => _ := isBoundedBilinearMap_smulRight
     exact (this.is_bounded_linear_map_right _).ContDiff
 #align cont_diff_on_succ_iff_deriv_within contDiffOn_succ_iff_derivWithin
 
@@ -2428,7 +2429,8 @@ theorem HasFTaylorSeriesUpToOn.restrictScalars (h : HasFTaylorSeriesUpToOn n f p
   { zero_eq := fun x hx => h.zero_eq x hx
     fderivWithin := by
       intro m hm x hx
-      convert(ContinuousMultilinearMap.restrictScalarsLinear π•œ).HasFDerivAt.comp_hasFDerivWithinAt _
+      convert
+        (ContinuousMultilinearMap.restrictScalarsLinear π•œ).HasFDerivAt.comp_hasFDerivWithinAt _
           ((h.fderiv_within m hm x hx).restrictScalars π•œ)
     cont := fun m hm =>
       ContinuousMultilinearMap.continuous_restrictScalars.comp_continuousOn (h.cont m hm) }
Diff
@@ -51,8 +51,8 @@ local notation "∞" => (⊀ : β„•βˆž)
 
 universe u v w uD uE uF uG
 
-attribute [local instance 1001]
-  NormedAddCommGroup.toAddCommGroup NormedSpace.toModule' AddCommGroup.toAddCommMonoid
+attribute [local instance 1001] NormedAddCommGroup.toAddCommGroup NormedSpace.toModule'
+  AddCommGroup.toAddCommMonoid
 
 namespace Finset
 
@@ -573,7 +573,7 @@ theorem ContinuousLinearEquiv.contDiffWithinAt_comp_iff (e : G ≃L[π•œ] E) :
   Β· intro H
     simpa [← preimage_comp, (Β· ∘ Β·)] using H.comp_continuous_linear_map (e.symm : E β†’L[π•œ] G)
   Β· intro H
-    rw [← e.apply_symm_apply x, ← e.coe_coe] at H
+    rw [← e.apply_symm_apply x, ← e.coe_coe] at H 
     exact H.comp_continuous_linear_map _
 #align continuous_linear_equiv.cont_diff_within_at_comp_iff ContinuousLinearEquiv.contDiffWithinAt_comp_iff
 
@@ -693,13 +693,13 @@ private theorem cont_diff_on.comp_same_univ {Eu : Type u} [NormedAddCommGroup Eu
     ContDiffOn π•œ n (g ∘ f) s :=
   by
   induction' n using ENat.nat_induction with n IH Itop generalizing Eu Fu Gu
-  · rw [contDiffOn_zero] at hf hg⊒
+  · rw [contDiffOn_zero] at hf hg ⊒
     exact ContinuousOn.comp hg hf st
-  · rw [contDiffOn_succ_iff_hasFDerivWithinAt] at hg⊒
+  · rw [contDiffOn_succ_iff_hasFDerivWithinAt] at hg ⊒
     intro x hx
     rcases(contDiffOn_succ_iff_hasFDerivWithinAt.1 hf) x hx with ⟨u, hu, f', hf', f'_diff⟩
     rcases hg (f x) (st hx) with ⟨v, hv, g', hg', g'_diff⟩
-    rw [insert_eq_of_mem hx] at hu⊒
+    rw [insert_eq_of_mem hx] at hu ⊒
     have xu : x ∈ u := mem_of_mem_nhdsWithin hx hu
     let w := s ∩ (u ∩ f ⁻¹' v)
     have wv : w βŠ† f ⁻¹' v := fun y hy => hy.2.2
@@ -725,7 +725,7 @@ private theorem cont_diff_on.comp_same_univ {Eu : Type u} [NormedAddCommGroup Eu
       have D : ContDiffOn π•œ n (fun p : (Fu β†’L[π•œ] Gu) Γ— (Eu β†’L[π•œ] Fu) => p.1.comp p.2) univ :=
         is_bounded_bilinear_map_comp.cont_diff.cont_diff_on
       exact IH D C (subset_univ _)
-  · rw [contDiffOn_top] at hf hg⊒
+  · rw [contDiffOn_top] at hf hg ⊒
     exact fun n => Itop n (hg n) (hf n) st
 
 /-- The composition of `C^n` functions on domains is `C^n`. -/
@@ -760,7 +760,7 @@ theorem ContDiffOn.comp {s : Set E} {t : Set F} {g : F β†’ G} {f : E β†’ F} (hg
     ext y
     simp only [Function.comp_apply, gu, fu]
     rw [isoF.apply_symm_apply (f (isoE y))]
-  rwa [this, isoE.cont_diff_on_comp_iff, isoG.symm.comp_cont_diff_on_iff] at main
+  rwa [this, isoE.cont_diff_on_comp_iff, isoG.symm.comp_cont_diff_on_iff] at main 
 #align cont_diff_on.comp ContDiffOn.comp
 
 /-- The composition of `C^n` functions on domains is `C^n`. -/
@@ -809,7 +809,7 @@ theorem ContDiffWithinAt.comp {s : Set E} {t : Set F} {g : F β†’ G} {f : E β†’ F
       simp [hy1, hy2, vs hy2]
     rw [A, ← nhdsWithin_restrict'']
     exact Filter.inter_mem this v_nhd
-  rwa [insert_eq_of_mem xmem, this] at Z
+  rwa [insert_eq_of_mem xmem, this] at Z 
 #align cont_diff_within_at.comp ContDiffWithinAt.comp
 
 /-- The composition of `C^n` functions at points in domains is `C^n`,
@@ -1086,7 +1086,7 @@ theorem ContDiffWithinAt.hasFDerivWithinAt_nhds {f : E β†’ F β†’ G} {g : E β†’ F
     have := mem_of_mem_nhdsWithin (mem_insert _ _) hv
     refine' mem_nhds_within_insert.mpr ⟨this, _⟩
     refine' (continuous_within_at_id.prod hg.continuous_within_at).preimage_mem_nhds_within' _
-    rw [← nhdsWithin_le_iff] at hst hv⊒
+    rw [← nhdsWithin_le_iff] at hst hv ⊒
     refine' (hst.trans <| nhdsWithin_mono _ <| subset_insert _ _).trans hv
   Β· intro z hz
     have := hvf' (z, g z) hz.1
@@ -1149,7 +1149,7 @@ theorem ContDiffWithinAt.fderivWithin {f : E β†’ F β†’ G} {g : E β†’ F} {t : Set
     (hg : ContDiffWithinAt π•œ m g s xβ‚€) (ht : UniqueDiffOn π•œ t) (hmn : m + 1 ≀ n) (hxβ‚€ : xβ‚€ ∈ s)
     (hst : s βŠ† g ⁻¹' t) : ContDiffWithinAt π•œ m (fun x => fderivWithin π•œ (f x) t (g x)) s xβ‚€ :=
   by
-  rw [← insert_eq_self.mpr hxβ‚€] at hf
+  rw [← insert_eq_self.mpr hxβ‚€] at hf 
   refine' hf.fderiv_within' hg _ hmn hst
   rw [insert_eq_self.mpr hxβ‚€]
   exact eventually_of_mem self_mem_nhdsWithin fun x hx => ht _ (hst hx)
@@ -1243,7 +1243,7 @@ theorem ContDiffOn.continuousOn_fderivWithin_apply (hf : ContDiffOn π•œ n f s)
 theorem ContDiff.contDiff_fderiv_apply {f : E β†’ F} (hf : ContDiff π•œ n f) (hmn : m + 1 ≀ n) :
     ContDiff π•œ m fun p : E Γ— E => (fderiv π•œ f p.1 : E β†’L[π•œ] F) p.2 :=
   by
-  rw [← contDiffOn_univ] at hf⊒
+  rw [← contDiffOn_univ] at hf ⊒
   rw [← fderivWithin_univ, ← univ_prod_univ]
   exact contDiffOn_fderivWithin_apply hf uniqueDiffOn_univ hmn
 #align cont_diff.cont_diff_fderiv_apply ContDiff.contDiff_fderiv_apply
@@ -1416,7 +1416,7 @@ theorem iteratedFDerivWithin_add_apply' {f g : E β†’ F} (hf : ContDiffOn π•œ i
 theorem iteratedFDeriv_add_apply {i : β„•} {f g : E β†’ F} (hf : ContDiff π•œ i f) (hg : ContDiff π•œ i g) :
     iteratedFDeriv π•œ i (f + g) x = iteratedFDeriv π•œ i f x + iteratedFDeriv π•œ i g x :=
   by
-  simp_rw [← contDiffOn_univ, ← iteratedFDerivWithin_univ] at hf hg⊒
+  simp_rw [← contDiffOn_univ, ← iteratedFDerivWithin_univ] at hf hg ⊒
   exact iteratedFDerivWithin_add_apply hf hg uniqueDiffOn_univ (Set.mem_univ _)
 #align iterated_fderiv_add_apply iteratedFDeriv_add_apply
 
@@ -2003,7 +2003,7 @@ theorem LocalHomeomorph.contDiffAt_symm [CompleteSpace E] (f : LocalHomeomorph E
       have h_nhds : { y : E | βˆƒ e : E ≃L[π•œ] F, ↑e = f' y } ∈ 𝓝 (f.symm a) :=
         by
         have hfβ‚€' := fβ‚€'.nhds
-        rw [← eq_fβ‚€'] at hfβ‚€'
+        rw [← eq_fβ‚€'] at hfβ‚€' 
         exact hf'.continuous_at.preimage_mem_nhds hfβ‚€'
       obtain ⟨t, htu, ht, htf⟩ := mem_nhds_iff.mp (Filter.inter_mem hu h_nhds)
       use f.target ∩ f.symm ⁻¹' t
@@ -2158,7 +2158,7 @@ theorem ContDiffAt.has_strict_fderiv_at' {f : E' β†’ F'} {f' : E' β†’L[𝕂] F'}
     (hf : ContDiffAt 𝕂 n f x) (hf' : HasFDerivAt f f' x) (hn : 1 ≀ n) : HasStrictFDerivAt f f' x :=
   by
   rcases hf 1 hn with ⟨u, H, p, hp⟩
-  simp only [nhdsWithin_univ, mem_univ, insert_eq_of_mem] at H
+  simp only [nhdsWithin_univ, mem_univ, insert_eq_of_mem] at H 
   have := hp.has_strict_fderiv_at le_rfl H
   rwa [hf'.unique this.has_fderiv_at]
 #align cont_diff_at.has_strict_fderiv_at' ContDiffAt.has_strict_fderiv_at'
@@ -2237,9 +2237,9 @@ theorem ContDiffWithinAt.exists_lipschitzOnWith {E F : Type _} [NormedAddCommGro
   rcases metric.mem_nhds_within_iff.mp hst with ⟨Ρ, Ρ0, hΡ⟩
   replace hp : HasFTaylorSeriesUpToOn 1 f p (Metric.ball x Ρ ∩ insert x s) := hp.mono hΡ
   clear hst hΞ΅ t
-  rw [← insert_eq_of_mem (Metric.mem_ball_self Ξ΅0), ← insert_inter_distrib] at hp
+  rw [← insert_eq_of_mem (Metric.mem_ball_self Ξ΅0), ← insert_inter_distrib] at hp 
   rcases hp.exists_lipschitz_on_with ((convex_ball _ _).inter hs) with ⟨K, t, hst, hft⟩
-  rw [inter_comm, ← nhdsWithin_restrict' _ (Metric.ball_mem_nhds _ Ξ΅0)] at hst
+  rw [inter_comm, ← nhdsWithin_restrict' _ (Metric.ball_mem_nhds _ Ξ΅0)] at hst 
   exact ⟨K, t, hst, hft⟩
 #align cont_diff_within_at.exists_lipschitz_on_with ContDiffWithinAt.exists_lipschitzOnWith
 
@@ -2342,11 +2342,11 @@ theorem ContDiffOn.derivWithin (hf : ContDiffOn π•œ n fβ‚‚ sβ‚‚) (hs : UniqueDi
     (hmn : m + 1 ≀ n) : ContDiffOn π•œ m (derivWithin fβ‚‚ sβ‚‚) sβ‚‚ :=
   by
   cases m
-  Β· change ∞ + 1 ≀ n at hmn
+  Β· change ∞ + 1 ≀ n at hmn 
     have : n = ∞ := by simpa using hmn
-    rw [this] at hf
+    rw [this] at hf 
     exact ((contDiffOn_top_iff_derivWithin hs).1 hf).2
-  Β· change (m.succ : β„•βˆž) ≀ n at hmn
+  Β· change (m.succ : β„•βˆž) ≀ n at hmn 
     exact ((contDiffOn_succ_iff_derivWithin hs).1 (hf.of_le hmn)).2
 #align cont_diff_on.deriv_within ContDiffOn.derivWithin
 
@@ -2637,13 +2637,13 @@ theorem ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear (B : E β†’L
     intro i
     rw [LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_left _ _ hsu hxu]
     rw [LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_right _ _ hs, xu_x]
-    rwa [← xu_x] at hx
+    rwa [← xu_x] at hx 
   have Ngu : βˆ€ i, β€–iteratedFDerivWithin π•œ i gu su xuβ€– = β€–iteratedFDerivWithin π•œ i g s xβ€– :=
     by
     intro i
     rw [LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_left _ _ hsu hxu]
     rw [LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_right _ _ hs, xu_x]
-    rwa [← xu_x] at hx
+    rwa [← xu_x] at hx 
   have NBu :
     β€–iteratedFDerivWithin π•œ n (fun y => Bu (fu y) (gu y)) su xuβ€– =
       β€–iteratedFDerivWithin π•œ n (fun y => B (f y) (g y)) s xβ€– :=
@@ -2651,7 +2651,7 @@ theorem ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear (B : E β†’L
     rw [Bu_eq]
     rw [LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_left _ _ hsu hxu]
     rw [LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_right _ _ hs, xu_x]
-    rwa [← xu_x] at hx
+    rwa [← xu_x] at hx 
   -- state the bound for the lifted objects, and deduce the original bound from it.
   have :
     β€–iteratedFDerivWithin π•œ n (fun y => Bu (fu y) (gu y)) su xuβ€– ≀
@@ -2660,7 +2660,7 @@ theorem ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear (B : E β†’L
           (n.choose i : ℝ) * β€–iteratedFDerivWithin π•œ i fu su xuβ€– *
             β€–iteratedFDerivWithin π•œ (n - i) gu su xuβ€– :=
     Bu.norm_iterated_fderiv_within_le_of_bilinear_aux hfu hgu hsu hxu
-  simp only [Nfu, Ngu, NBu] at this
+  simp only [Nfu, Ngu, NBu] at this 
   apply this.trans (mul_le_mul_of_nonneg_right Bu_le _)
   exact Finset.sum_nonneg' fun i => by positivity
 #align continuous_linear_map.norm_iterated_fderiv_within_le_of_bilinear ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear
@@ -2809,7 +2809,7 @@ theorem norm_iteratedFDerivWithin_comp_le_aux {Fu Gu : Type u} [NormedAddCommGro
       β€–iteratedFDerivWithin π•œ i (fderivWithin π•œ g t ∘ f) s xβ€– ≀ i ! * C * D ^ i :=
     by
     intro i hi
-    simp only [Finset.mem_range_succ_iff] at hi
+    simp only [Finset.mem_range_succ_iff] at hi 
     apply IH i hi
     apply hf.of_le (Nat.cast_le.2 (hi.trans n.le_succ))
     Β· intro j hj h'j
@@ -2949,7 +2949,7 @@ theorem norm_iteratedFDerivWithin_comp_le {g : F β†’ G} {f : E β†’ F} {n : β„•}
     by
     intro i
     rw [LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_left _ _ hs hx]
-  simp_rw [← Nfu] at hD
+  simp_rw [← Nfu] at hD 
   have Ngu : βˆ€ i, β€–iteratedFDerivWithin π•œ i gu tu (fu x)β€– = β€–iteratedFDerivWithin π•œ i g t (f x)β€– :=
     by
     intro i
@@ -2957,7 +2957,7 @@ theorem norm_iteratedFDerivWithin_comp_le {g : F β†’ G} {f : E β†’ F} {n : β„•}
     rw [LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_right _ _ ht, Ffu]
     rw [Ffu]
     exact hst hx
-  simp_rw [← Ngu] at hC
+  simp_rw [← Ngu] at hC 
   have Nfgu : β€–iteratedFDerivWithin π•œ n (g ∘ f) s xβ€– = β€–iteratedFDerivWithin π•œ n (gu ∘ fu) s xβ€– :=
     by
     have : gu ∘ fu = isoG.symm ∘ g ∘ f := by
@@ -2978,7 +2978,7 @@ theorem norm_iteratedFDeriv_comp_le {g : F β†’ G} {f : E β†’ F} {n : β„•} {N : 
     (hD : βˆ€ i, 1 ≀ i β†’ i ≀ n β†’ β€–iteratedFDeriv π•œ i f xβ€– ≀ D ^ i) :
     β€–iteratedFDeriv π•œ n (g ∘ f) xβ€– ≀ n ! * C * D ^ n :=
   by
-  simp_rw [← iteratedFDerivWithin_univ] at hC hD⊒
+  simp_rw [← iteratedFDerivWithin_univ] at hC hD ⊒
   exact
     norm_iteratedFDerivWithin_comp_le hg.cont_diff_on hf.cont_diff_on hn uniqueDiffOn_univ
       uniqueDiffOn_univ (maps_to_univ _ _) (mem_univ x) hC hD
@@ -3021,7 +3021,7 @@ theorem norm_iteratedFDerivWithin_clm_apply_const {f : E β†’ F β†’L[π•œ] G} {c
   by
   let g : (F β†’L[π•œ] G) β†’L[π•œ] G := ContinuousLinearMap.apply π•œ G c
   have h := g.norm_comp_continuous_multilinear_map_le (iteratedFDerivWithin π•œ n f s x)
-  rw [← g.iterated_fderiv_within_comp_left hf hs hx hn] at h
+  rw [← g.iterated_fderiv_within_comp_left hf hs hx hn] at h 
   refine' h.trans (mul_le_mul_of_nonneg_right _ (norm_nonneg _))
   refine' g.op_norm_le_bound (norm_nonneg _) fun f => _
   rw [ContinuousLinearMap.apply_apply, mul_comm]
Diff
@@ -128,21 +128,21 @@ variable {π•œ : Type _} [NontriviallyNormedField π•œ] {D : Type uD} [NormedAdd
 
 
 @[simp]
-theorem iteratedFderiv_zero_fun {n : β„•} : (iteratedFderiv π•œ n fun x : E => (0 : F)) = 0 :=
+theorem iteratedFDeriv_zero_fun {n : β„•} : (iteratedFDeriv π•œ n fun x : E => (0 : F)) = 0 :=
   by
   induction' n with n IH
   Β· ext m; simp
   Β· ext (x m)
-    rw [iteratedFderiv_succ_apply_left, IH]
+    rw [iteratedFDeriv_succ_apply_left, IH]
     change (fderiv π•œ (fun x : E => (0 : E[Γ—n]β†’L[π•œ] F)) x : E β†’ E[Γ—n]β†’L[π•œ] F) (m 0) (tail m) = _
     rw [fderiv_const]
     rfl
-#align iterated_fderiv_zero_fun iteratedFderiv_zero_fun
+#align iterated_fderiv_zero_fun iteratedFDeriv_zero_fun
 
 theorem contDiff_zero_fun : ContDiff π•œ n fun x : E => (0 : F) :=
   by
-  apply contDiff_of_differentiable_iteratedFderiv fun m hm => _
-  rw [iteratedFderiv_zero_fun]
+  apply contDiff_of_differentiable_iteratedFDeriv fun m hm => _
+  rw [iteratedFDeriv_zero_fun]
   exact differentiable_const (0 : E[Γ—m]β†’L[π•œ] F)
 #align cont_diff_zero_fun contDiff_zero_fun
 
@@ -189,19 +189,19 @@ theorem contDiffOn_of_subsingleton [Subsingleton F] : ContDiffOn π•œ n f s := b
   rw [Subsingleton.elim f fun _ => 0]; exact contDiffOn_const
 #align cont_diff_on_of_subsingleton contDiffOn_of_subsingleton
 
-theorem iteratedFderiv_succ_const (n : β„•) (c : F) : (iteratedFderiv π•œ (n + 1) fun y : E => c) = 0 :=
+theorem iteratedFDeriv_succ_const (n : β„•) (c : F) : (iteratedFDeriv π•œ (n + 1) fun y : E => c) = 0 :=
   by
   ext (x m)
-  simp only [iteratedFderiv_succ_apply_right, fderiv_const, Pi.zero_apply, iteratedFderiv_zero_fun,
+  simp only [iteratedFDeriv_succ_apply_right, fderiv_const, Pi.zero_apply, iteratedFDeriv_zero_fun,
     ContinuousMultilinearMap.zero_apply, ContinuousLinearMap.zero_apply]
-#align iterated_fderiv_succ_const iteratedFderiv_succ_const
+#align iterated_fderiv_succ_const iteratedFDeriv_succ_const
 
-theorem iteratedFderiv_const_of_ne {n : β„•} (hn : n β‰  0) (c : F) :
-    (iteratedFderiv π•œ n fun y : E => c) = 0 :=
+theorem iteratedFDeriv_const_of_ne {n : β„•} (hn : n β‰  0) (c : F) :
+    (iteratedFDeriv π•œ n fun y : E => c) = 0 :=
   by
   cases' Nat.exists_eq_succ_of_ne_zero hn with k hk
-  rw [hk, iteratedFderiv_succ_const]
-#align iterated_fderiv_const_of_ne iteratedFderiv_const_of_ne
+  rw [hk, iteratedFDeriv_succ_const]
+#align iterated_fderiv_const_of_ne iteratedFDeriv_const_of_ne
 
 /-! ### Smoothness of linear functions -/
 
@@ -264,9 +264,9 @@ theorem IsBoundedBilinearMap.contDiff (hb : IsBoundedBilinearMap π•œ b) : ContD
 
 /-- If `f` admits a Taylor series `p` in a set `s`, and `g` is linear, then `g ∘ f` admits a Taylor
 series whose `k`-th term is given by `g ∘ (p k)`. -/
-theorem HasFtaylorSeriesUpToOn.continuousLinearMapComp (g : F β†’L[π•œ] G)
-    (hf : HasFtaylorSeriesUpToOn n f p s) :
-    HasFtaylorSeriesUpToOn n (g ∘ f) (fun x k => g.compContinuousMultilinearMap (p x k)) s :=
+theorem HasFTaylorSeriesUpToOn.continuousLinearMap_comp (g : F β†’L[π•œ] G)
+    (hf : HasFTaylorSeriesUpToOn n f p s) :
+    HasFTaylorSeriesUpToOn n (g ∘ f) (fun x k => g.compContinuousMultilinearMap (p x k)) s :=
   by
   set L : βˆ€ m : β„•, (E[Γ—m]β†’L[π•œ] F) β†’L[π•œ] E[Γ—m]β†’L[π•œ] G := fun m =>
     ContinuousLinearMap.compContinuousMultilinearMapL π•œ (fun _ => E) F G g
@@ -276,7 +276,7 @@ theorem HasFtaylorSeriesUpToOn.continuousLinearMapComp (g : F β†’L[π•œ] G)
     convert(L m).HasFDerivAt.comp_hasFDerivWithinAt x (hf.fderiv_within m hm x hx)
   Β· intro m hm
     convert(L m).Continuous.comp_continuousOn (hf.cont m hm)
-#align has_ftaylor_series_up_to_on.continuous_linear_map_comp HasFtaylorSeriesUpToOn.continuousLinearMapComp
+#align has_ftaylor_series_up_to_on.continuous_linear_map_comp HasFTaylorSeriesUpToOn.continuousLinearMap_comp
 
 /-- Composition by continuous linear maps on the left preserves `C^n` functions in a domain
 at a point. -/
@@ -297,7 +297,7 @@ theorem ContDiffAt.continuousLinearMap_comp (g : F β†’L[π•œ] G) (hf : ContDiffA
 
 /-- Composition by continuous linear maps on the left preserves `C^n` functions on domains. -/
 theorem ContDiffOn.continuousLinearMap_comp (g : F β†’L[π•œ] G) (hf : ContDiffOn π•œ n f s) :
-    ContDiffOn π•œ n (g ∘ f) s := fun x hx => (hf x hx).continuousLinearMapComp g
+    ContDiffOn π•œ n (g ∘ f) s := fun x hx => (hf x hx).continuousLinearMap_comp g
 #align cont_diff_on.continuous_linear_map_comp ContDiffOn.continuousLinearMap_comp
 
 /-- Composition by continuous linear maps on the left preserves `C^n` functions. -/
@@ -308,44 +308,44 @@ theorem ContDiff.continuousLinearMap_comp {f : E β†’ F} (g : F β†’L[π•œ] G) (hf
 
 /-- The iterated derivative within a set of the composition with a linear map on the left is
 obtained by applying the linear map to the iterated derivative. -/
-theorem ContinuousLinearMap.iteratedFderivWithin_comp_left {f : E β†’ F} (g : F β†’L[π•œ] G)
+theorem ContinuousLinearMap.iteratedFDerivWithin_comp_left {f : E β†’ F} (g : F β†’L[π•œ] G)
     (hf : ContDiffOn π•œ n f s) (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) {i : β„•} (hi : (i : β„•βˆž) ≀ n) :
-    iteratedFderivWithin π•œ i (g ∘ f) s x =
-      g.compContinuousMultilinearMap (iteratedFderivWithin π•œ i f s x) :=
-  (((hf.ftaylorSeriesWithin hs).continuousLinearMapComp g).eq_ftaylor_series_of_uniqueDiffOn hi hs
+    iteratedFDerivWithin π•œ i (g ∘ f) s x =
+      g.compContinuousMultilinearMap (iteratedFDerivWithin π•œ i f s x) :=
+  (((hf.ftaylorSeriesWithin hs).continuousLinearMap_comp g).eq_ftaylor_series_of_uniqueDiffOn hi hs
       hx).symm
-#align continuous_linear_map.iterated_fderiv_within_comp_left ContinuousLinearMap.iteratedFderivWithin_comp_left
+#align continuous_linear_map.iterated_fderiv_within_comp_left ContinuousLinearMap.iteratedFDerivWithin_comp_left
 
 /-- The iterated derivative of the composition with a linear map on the left is
 obtained by applying the linear map to the iterated derivative. -/
-theorem ContinuousLinearMap.iteratedFderiv_comp_left {f : E β†’ F} (g : F β†’L[π•œ] G)
+theorem ContinuousLinearMap.iteratedFDeriv_comp_left {f : E β†’ F} (g : F β†’L[π•œ] G)
     (hf : ContDiff π•œ n f) (x : E) {i : β„•} (hi : (i : β„•βˆž) ≀ n) :
-    iteratedFderiv π•œ i (g ∘ f) x = g.compContinuousMultilinearMap (iteratedFderiv π•œ i f x) :=
+    iteratedFDeriv π•œ i (g ∘ f) x = g.compContinuousMultilinearMap (iteratedFDeriv π•œ i f x) :=
   by
-  simp only [← iteratedFderivWithin_univ]
+  simp only [← iteratedFDerivWithin_univ]
   exact g.iterated_fderiv_within_comp_left hf.cont_diff_on uniqueDiffOn_univ (mem_univ x) hi
-#align continuous_linear_map.iterated_fderiv_comp_left ContinuousLinearMap.iteratedFderiv_comp_left
+#align continuous_linear_map.iterated_fderiv_comp_left ContinuousLinearMap.iteratedFDeriv_comp_left
 
 /-- The iterated derivative within a set of the composition with a linear equiv on the left is
 obtained by applying the linear equiv to the iterated derivative. This is true without
 differentiability assumptions. -/
-theorem ContinuousLinearEquiv.iteratedFderivWithin_comp_left (g : F ≃L[π•œ] G) (f : E β†’ F)
+theorem ContinuousLinearEquiv.iteratedFDerivWithin_comp_left (g : F ≃L[π•œ] G) (f : E β†’ F)
     (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) (i : β„•) :
-    iteratedFderivWithin π•œ i (g ∘ f) s x =
-      (g : F β†’L[π•œ] G).compContinuousMultilinearMap (iteratedFderivWithin π•œ i f s x) :=
+    iteratedFDerivWithin π•œ i (g ∘ f) s x =
+      (g : F β†’L[π•œ] G).compContinuousMultilinearMap (iteratedFDerivWithin π•œ i f s x) :=
   by
   induction' i with i IH generalizing x
   Β· ext1 m
-    simp only [iteratedFderivWithin_zero_apply, ContinuousLinearEquiv.coe_coe,
+    simp only [iteratedFDerivWithin_zero_apply, ContinuousLinearEquiv.coe_coe,
       ContinuousLinearMap.compContinuousMultilinearMap_coe, EmbeddingLike.apply_eq_iff_eq]
   Β· ext1 m
-    rw [iteratedFderivWithin_succ_apply_left]
+    rw [iteratedFDerivWithin_succ_apply_left]
     have Z :
-      fderivWithin π•œ (iteratedFderivWithin π•œ i (g ∘ f) s) s x =
+      fderivWithin π•œ (iteratedFDerivWithin π•œ i (g ∘ f) s) s x =
         fderivWithin π•œ
           (fun y =>
             g.comp_continuous_multilinear_mapL (fun j : Fin i => E)
-              (iteratedFderivWithin π•œ i f s y))
+              (iteratedFDerivWithin π•œ i f s y))
           s x :=
       fderivWithin_congr' (@IH) hx
     simp_rw [Z]
@@ -353,55 +353,55 @@ theorem ContinuousLinearEquiv.iteratedFderivWithin_comp_left (g : F ≃L[π•œ] G
     simp only [ContinuousLinearMap.coe_comp', ContinuousLinearEquiv.coe_coe, comp_app,
       ContinuousLinearEquiv.compContinuousMultilinearMapL_apply,
       ContinuousLinearMap.compContinuousMultilinearMap_coe, EmbeddingLike.apply_eq_iff_eq]
-    rw [iteratedFderivWithin_succ_apply_left]
-#align continuous_linear_equiv.iterated_fderiv_within_comp_left ContinuousLinearEquiv.iteratedFderivWithin_comp_left
+    rw [iteratedFDerivWithin_succ_apply_left]
+#align continuous_linear_equiv.iterated_fderiv_within_comp_left ContinuousLinearEquiv.iteratedFDerivWithin_comp_left
 
 /-- Composition with a linear isometry on the left preserves the norm of the iterated
 derivative within a set. -/
-theorem LinearIsometry.norm_iteratedFderivWithin_comp_left {f : E β†’ F} (g : F β†’β‚—α΅’[π•œ] G)
+theorem LinearIsometry.norm_iteratedFDerivWithin_comp_left {f : E β†’ F} (g : F β†’β‚—α΅’[π•œ] G)
     (hf : ContDiffOn π•œ n f s) (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) {i : β„•} (hi : (i : β„•βˆž) ≀ n) :
-    β€–iteratedFderivWithin π•œ i (g ∘ f) s xβ€– = β€–iteratedFderivWithin π•œ i f s xβ€– :=
+    β€–iteratedFDerivWithin π•œ i (g ∘ f) s xβ€– = β€–iteratedFDerivWithin π•œ i f s xβ€– :=
   by
   have :
-    iteratedFderivWithin π•œ i (g ∘ f) s x =
-      g.to_continuous_linear_map.comp_continuous_multilinear_map (iteratedFderivWithin π•œ i f s x) :=
+    iteratedFDerivWithin π•œ i (g ∘ f) s x =
+      g.to_continuous_linear_map.comp_continuous_multilinear_map (iteratedFDerivWithin π•œ i f s x) :=
     g.to_continuous_linear_map.iterated_fderiv_within_comp_left hf hs hx hi
   rw [this]
   apply LinearIsometry.norm_compContinuousMultilinearMap
-#align linear_isometry.norm_iterated_fderiv_within_comp_left LinearIsometry.norm_iteratedFderivWithin_comp_left
+#align linear_isometry.norm_iterated_fderiv_within_comp_left LinearIsometry.norm_iteratedFDerivWithin_comp_left
 
 /-- Composition with a linear isometry on the left preserves the norm of the iterated
 derivative. -/
-theorem LinearIsometry.norm_iteratedFderiv_comp_left {f : E β†’ F} (g : F β†’β‚—α΅’[π•œ] G)
+theorem LinearIsometry.norm_iteratedFDeriv_comp_left {f : E β†’ F} (g : F β†’β‚—α΅’[π•œ] G)
     (hf : ContDiff π•œ n f) (x : E) {i : β„•} (hi : (i : β„•βˆž) ≀ n) :
-    β€–iteratedFderiv π•œ i (g ∘ f) xβ€– = β€–iteratedFderiv π•œ i f xβ€– :=
+    β€–iteratedFDeriv π•œ i (g ∘ f) xβ€– = β€–iteratedFDeriv π•œ i f xβ€– :=
   by
-  simp only [← iteratedFderivWithin_univ]
+  simp only [← iteratedFDerivWithin_univ]
   exact g.norm_iterated_fderiv_within_comp_left hf.cont_diff_on uniqueDiffOn_univ (mem_univ x) hi
-#align linear_isometry.norm_iterated_fderiv_comp_left LinearIsometry.norm_iteratedFderiv_comp_left
+#align linear_isometry.norm_iterated_fderiv_comp_left LinearIsometry.norm_iteratedFDeriv_comp_left
 
 /-- Composition with a linear isometry equiv on the left preserves the norm of the iterated
 derivative within a set. -/
-theorem LinearIsometryEquiv.norm_iteratedFderivWithin_comp_left (g : F ≃ₗᡒ[π•œ] G) (f : E β†’ F)
+theorem LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_left (g : F ≃ₗᡒ[π•œ] G) (f : E β†’ F)
     (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) (i : β„•) :
-    β€–iteratedFderivWithin π•œ i (g ∘ f) s xβ€– = β€–iteratedFderivWithin π•œ i f s xβ€– :=
+    β€–iteratedFDerivWithin π•œ i (g ∘ f) s xβ€– = β€–iteratedFDerivWithin π•œ i f s xβ€– :=
   by
   have :
-    iteratedFderivWithin π•œ i (g ∘ f) s x =
-      (g : F β†’L[π•œ] G).compContinuousMultilinearMap (iteratedFderivWithin π•œ i f s x) :=
+    iteratedFDerivWithin π•œ i (g ∘ f) s x =
+      (g : F β†’L[π•œ] G).compContinuousMultilinearMap (iteratedFDerivWithin π•œ i f s x) :=
     g.to_continuous_linear_equiv.iterated_fderiv_within_comp_left f hs hx i
   rw [this]
   apply LinearIsometry.norm_compContinuousMultilinearMap g.to_linear_isometry
-#align linear_isometry_equiv.norm_iterated_fderiv_within_comp_left LinearIsometryEquiv.norm_iteratedFderivWithin_comp_left
+#align linear_isometry_equiv.norm_iterated_fderiv_within_comp_left LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_left
 
 /-- Composition with a linear isometry equiv on the left preserves the norm of the iterated
 derivative. -/
-theorem LinearIsometryEquiv.norm_iteratedFderiv_comp_left (g : F ≃ₗᡒ[π•œ] G) (f : E β†’ F) (x : E)
-    (i : β„•) : β€–iteratedFderiv π•œ i (g ∘ f) xβ€– = β€–iteratedFderiv π•œ i f xβ€– :=
+theorem LinearIsometryEquiv.norm_iteratedFDeriv_comp_left (g : F ≃ₗᡒ[π•œ] G) (f : E β†’ F) (x : E)
+    (i : β„•) : β€–iteratedFDeriv π•œ i (g ∘ f) xβ€– = β€–iteratedFDeriv π•œ i f xβ€– :=
   by
-  rw [← iteratedFderivWithin_univ, ← iteratedFderivWithin_univ]
+  rw [← iteratedFDerivWithin_univ, ← iteratedFDerivWithin_univ]
   apply g.norm_iterated_fderiv_within_comp_left f uniqueDiffOn_univ (mem_univ x) i
-#align linear_isometry_equiv.norm_iterated_fderiv_comp_left LinearIsometryEquiv.norm_iteratedFderiv_comp_left
+#align linear_isometry_equiv.norm_iterated_fderiv_comp_left LinearIsometryEquiv.norm_iteratedFDeriv_comp_left
 
 /-- Composition by continuous linear equivs on the left respects higher differentiability at a
 point in a domain. -/
@@ -410,7 +410,7 @@ theorem ContinuousLinearEquiv.comp_contDiffWithinAt_iff (e : F ≃L[π•œ] G) :
   ⟨fun H => by
     simpa only [(· ∘ ·), e.symm.coe_coe, e.symm_apply_apply] using
       H.continuous_linear_map_comp (e.symm : G β†’L[π•œ] F),
-    fun H => H.continuousLinearMapComp (e : F β†’L[π•œ] G)⟩
+    fun H => H.continuousLinearMap_comp (e : F β†’L[π•œ] G)⟩
 #align continuous_linear_equiv.comp_cont_diff_within_at_iff ContinuousLinearEquiv.comp_contDiffWithinAt_iff
 
 /-- Composition by continuous linear equivs on the left respects higher differentiability at a
@@ -435,9 +435,9 @@ theorem ContinuousLinearEquiv.comp_contDiff_iff (e : F ≃L[π•œ] G) :
 
 /-- If `f` admits a Taylor series `p` in a set `s`, and `g` is linear, then `f ∘ g` admits a Taylor
 series in `g ⁻¹' s`, whose `k`-th term is given by `p k (g v₁, ..., g vβ‚–)` . -/
-theorem HasFtaylorSeriesUpToOn.compContinuousLinearMap (hf : HasFtaylorSeriesUpToOn n f p s)
+theorem HasFTaylorSeriesUpToOn.compContinuousLinearMap (hf : HasFTaylorSeriesUpToOn n f p s)
     (g : G β†’L[π•œ] E) :
-    HasFtaylorSeriesUpToOn n (f ∘ g) (fun x k => (p (g x) k).compContinuousLinearMap fun _ => g)
+    HasFTaylorSeriesUpToOn n (f ∘ g) (fun x k => (p (g x) k).compContinuousLinearMap fun _ => g)
       (g ⁻¹' s) :=
   by
   let A : βˆ€ m : β„•, (E[Γ—m]β†’L[π•œ] F) β†’ G[Γ—m]β†’L[π•œ] F := fun m h => h.compContinuousLinearMap fun _ => g
@@ -459,7 +459,7 @@ theorem HasFtaylorSeriesUpToOn.compContinuousLinearMap (hf : HasFtaylorSeriesUpT
     exact
       (hA m).Continuous.comp_continuousOn
         ((hf.cont m hm).comp g.continuous.continuous_on (subset.refl _))
-#align has_ftaylor_series_up_to_on.comp_continuous_linear_map HasFtaylorSeriesUpToOn.compContinuousLinearMap
+#align has_ftaylor_series_up_to_on.comp_continuous_linear_map HasFTaylorSeriesUpToOn.compContinuousLinearMap
 
 /-- Composition by continuous linear maps on the right preserves `C^n` functions at a point on
 a domain. -/
@@ -489,35 +489,35 @@ theorem ContDiff.comp_continuousLinearMap {f : E β†’ F} {g : G β†’L[π•œ] E} (hf
 
 /-- The iterated derivative within a set of the composition with a linear map on the right is
 obtained by composing the iterated derivative with the linear map. -/
-theorem ContinuousLinearMap.iteratedFderivWithin_comp_right {f : E β†’ F} (g : G β†’L[π•œ] E)
+theorem ContinuousLinearMap.iteratedFDerivWithin_comp_right {f : E β†’ F} (g : G β†’L[π•œ] E)
     (hf : ContDiffOn π•œ n f s) (hs : UniqueDiffOn π•œ s) (h's : UniqueDiffOn π•œ (g ⁻¹' s)) {x : G}
     (hx : g x ∈ s) {i : β„•} (hi : (i : β„•βˆž) ≀ n) :
-    iteratedFderivWithin π•œ i (f ∘ g) (g ⁻¹' s) x =
-      (iteratedFderivWithin π•œ i f s (g x)).compContinuousLinearMap fun _ => g :=
+    iteratedFDerivWithin π•œ i (f ∘ g) (g ⁻¹' s) x =
+      (iteratedFDerivWithin π•œ i f s (g x)).compContinuousLinearMap fun _ => g :=
   (((hf.ftaylorSeriesWithin hs).compContinuousLinearMap g).eq_ftaylor_series_of_uniqueDiffOn hi h's
       hx).symm
-#align continuous_linear_map.iterated_fderiv_within_comp_right ContinuousLinearMap.iteratedFderivWithin_comp_right
+#align continuous_linear_map.iterated_fderiv_within_comp_right ContinuousLinearMap.iteratedFDerivWithin_comp_right
 
 /-- The iterated derivative within a set of the composition with a linear equiv on the right is
 obtained by composing the iterated derivative with the linear equiv. -/
-theorem ContinuousLinearEquiv.iteratedFderivWithin_comp_right (g : G ≃L[π•œ] E) (f : E β†’ F)
+theorem ContinuousLinearEquiv.iteratedFDerivWithin_comp_right (g : G ≃L[π•œ] E) (f : E β†’ F)
     (hs : UniqueDiffOn π•œ s) {x : G} (hx : g x ∈ s) (i : β„•) :
-    iteratedFderivWithin π•œ i (f ∘ g) (g ⁻¹' s) x =
-      (iteratedFderivWithin π•œ i f s (g x)).compContinuousLinearMap fun _ => g :=
+    iteratedFDerivWithin π•œ i (f ∘ g) (g ⁻¹' s) x =
+      (iteratedFDerivWithin π•œ i f s (g x)).compContinuousLinearMap fun _ => g :=
   by
   induction' i with i IH generalizing x
   Β· ext1 m
-    simp only [iteratedFderivWithin_zero_apply,
+    simp only [iteratedFDerivWithin_zero_apply,
       ContinuousMultilinearMap.compContinuousLinearMap_apply]
   Β· ext1 m
     simp only [ContinuousMultilinearMap.compContinuousLinearMap_apply,
-      ContinuousLinearEquiv.coe_coe, iteratedFderivWithin_succ_apply_left]
+      ContinuousLinearEquiv.coe_coe, iteratedFDerivWithin_succ_apply_left]
     have :
-      fderivWithin π•œ (iteratedFderivWithin π•œ i (f ∘ ⇑g) (⇑g ⁻¹' s)) (⇑g ⁻¹' s) x =
+      fderivWithin π•œ (iteratedFDerivWithin π•œ i (f ∘ ⇑g) (⇑g ⁻¹' s)) (⇑g ⁻¹' s) x =
         fderivWithin π•œ
           (fun y =>
             ContinuousMultilinearMap.compContinuousLinearMapEquivL _ (fun _x : Fin i => g)
-              (iteratedFderivWithin π•œ i f s (g y)))
+              (iteratedFDerivWithin π•œ i f s (g y)))
           (g ⁻¹' s) x :=
       fderivWithin_congr' (@IH) hx
     rw [this]
@@ -527,42 +527,42 @@ theorem ContinuousLinearEquiv.iteratedFderivWithin_comp_right (g : G ≃L[π•œ]
       ContinuousMultilinearMap.compContinuousLinearMap_apply]
     rw [ContinuousLinearEquiv.comp_right_fderivWithin _ (g.unique_diff_on_preimage_iff.2 hs x hx)]
     rfl
-#align continuous_linear_equiv.iterated_fderiv_within_comp_right ContinuousLinearEquiv.iteratedFderivWithin_comp_right
+#align continuous_linear_equiv.iterated_fderiv_within_comp_right ContinuousLinearEquiv.iteratedFDerivWithin_comp_right
 
 /-- The iterated derivative of the composition with a linear map on the right is
 obtained by composing the iterated derivative with the linear map. -/
-theorem ContinuousLinearMap.iteratedFderiv_comp_right (g : G β†’L[π•œ] E) {f : E β†’ F}
+theorem ContinuousLinearMap.iteratedFDeriv_comp_right (g : G β†’L[π•œ] E) {f : E β†’ F}
     (hf : ContDiff π•œ n f) (x : G) {i : β„•} (hi : (i : β„•βˆž) ≀ n) :
-    iteratedFderiv π•œ i (f ∘ g) x =
-      (iteratedFderiv π•œ i f (g x)).compContinuousLinearMap fun _ => g :=
+    iteratedFDeriv π•œ i (f ∘ g) x =
+      (iteratedFDeriv π•œ i f (g x)).compContinuousLinearMap fun _ => g :=
   by
-  simp only [← iteratedFderivWithin_univ]
+  simp only [← iteratedFDerivWithin_univ]
   apply
     g.iterated_fderiv_within_comp_right hf.cont_diff_on uniqueDiffOn_univ uniqueDiffOn_univ
       (mem_univ _) hi
-#align continuous_linear_map.iterated_fderiv_comp_right ContinuousLinearMap.iteratedFderiv_comp_right
+#align continuous_linear_map.iterated_fderiv_comp_right ContinuousLinearMap.iteratedFDeriv_comp_right
 
 /-- Composition with a linear isometry on the right preserves the norm of the iterated derivative
 within a set. -/
-theorem LinearIsometryEquiv.norm_iteratedFderivWithin_comp_right (g : G ≃ₗᡒ[π•œ] E) (f : E β†’ F)
+theorem LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_right (g : G ≃ₗᡒ[π•œ] E) (f : E β†’ F)
     (hs : UniqueDiffOn π•œ s) {x : G} (hx : g x ∈ s) (i : β„•) :
-    β€–iteratedFderivWithin π•œ i (f ∘ g) (g ⁻¹' s) xβ€– = β€–iteratedFderivWithin π•œ i f s (g x)β€– :=
+    β€–iteratedFDerivWithin π•œ i (f ∘ g) (g ⁻¹' s) xβ€– = β€–iteratedFDerivWithin π•œ i f s (g x)β€– :=
   by
   have :
-    iteratedFderivWithin π•œ i (f ∘ g) (g ⁻¹' s) x =
-      (iteratedFderivWithin π•œ i f s (g x)).compContinuousLinearMap fun _ => g :=
+    iteratedFDerivWithin π•œ i (f ∘ g) (g ⁻¹' s) x =
+      (iteratedFDerivWithin π•œ i f s (g x)).compContinuousLinearMap fun _ => g :=
     g.to_continuous_linear_equiv.iterated_fderiv_within_comp_right f hs hx i
   rw [this, ContinuousMultilinearMap.norm_compContinuous_linearIsometryEquiv]
-#align linear_isometry_equiv.norm_iterated_fderiv_within_comp_right LinearIsometryEquiv.norm_iteratedFderivWithin_comp_right
+#align linear_isometry_equiv.norm_iterated_fderiv_within_comp_right LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_right
 
 /-- Composition with a linear isometry on the right preserves the norm of the iterated derivative
 within a set. -/
-theorem LinearIsometryEquiv.norm_iteratedFderiv_comp_right (g : G ≃ₗᡒ[π•œ] E) (f : E β†’ F) (x : G)
-    (i : β„•) : β€–iteratedFderiv π•œ i (f ∘ g) xβ€– = β€–iteratedFderiv π•œ i f (g x)β€– :=
+theorem LinearIsometryEquiv.norm_iteratedFDeriv_comp_right (g : G ≃ₗᡒ[π•œ] E) (f : E β†’ F) (x : G)
+    (i : β„•) : β€–iteratedFDeriv π•œ i (f ∘ g) xβ€– = β€–iteratedFDeriv π•œ i f (g x)β€– :=
   by
-  simp only [← iteratedFderivWithin_univ]
+  simp only [← iteratedFDerivWithin_univ]
   apply g.norm_iterated_fderiv_within_comp_right f uniqueDiffOn_univ (mem_univ (g x)) i
-#align linear_isometry_equiv.norm_iterated_fderiv_comp_right LinearIsometryEquiv.norm_iteratedFderiv_comp_right
+#align linear_isometry_equiv.norm_iterated_fderiv_comp_right LinearIsometryEquiv.norm_iteratedFDeriv_comp_right
 
 /-- Composition by continuous linear equivs on the right respects higher differentiability at a
 point in a domain. -/
@@ -609,9 +609,9 @@ theorem ContinuousLinearEquiv.contDiff_comp_iff (e : G ≃L[π•œ] E) :
 
 /-- If two functions `f` and `g` admit Taylor series `p` and `q` in a set `s`, then the cartesian
 product of `f` and `g` admits the cartesian product of `p` and `q` as a Taylor series. -/
-theorem HasFtaylorSeriesUpToOn.prod (hf : HasFtaylorSeriesUpToOn n f p s) {g : E β†’ G}
-    {q : E β†’ FormalMultilinearSeries π•œ E G} (hg : HasFtaylorSeriesUpToOn n g q s) :
-    HasFtaylorSeriesUpToOn n (fun y => (f y, g y)) (fun y k => (p y k).Prod (q y k)) s :=
+theorem HasFTaylorSeriesUpToOn.prod (hf : HasFTaylorSeriesUpToOn n f p s) {g : E β†’ G}
+    {q : E β†’ FormalMultilinearSeries π•œ E G} (hg : HasFTaylorSeriesUpToOn n g q s) :
+    HasFTaylorSeriesUpToOn n (fun y => (f y, g y)) (fun y k => (p y k).Prod (q y k)) s :=
   by
   set L := fun m => ContinuousMultilinearMap.prodL π•œ (fun i : Fin m => E) F G
   constructor
@@ -621,7 +621,7 @@ theorem HasFtaylorSeriesUpToOn.prod (hf : HasFtaylorSeriesUpToOn n f p s) {g : E
         ((hf.fderiv_within m hm x hx).Prod (hg.fderiv_within m hm x hx))
   Β· intro m hm
     exact (L m).Continuous.comp_continuousOn ((hf.cont m hm).Prod (hg.cont m hm))
-#align has_ftaylor_series_up_to_on.prod HasFtaylorSeriesUpToOn.prod
+#align has_ftaylor_series_up_to_on.prod HasFTaylorSeriesUpToOn.prod
 
 /-- The cartesian product of `C^n` functions at a point in a domain is `C^n`. -/
 theorem ContDiffWithinAt.prod {s : Set E} {f : E β†’ F} {g : E β†’ G} (hf : ContDiffWithinAt π•œ n f s x)
@@ -1259,10 +1259,10 @@ variable {ΞΉ ΞΉ' : Type _} [Fintype ΞΉ] [Fintype ΞΉ'] {F' : ΞΉ β†’ Type _} [βˆ€
   [βˆ€ i, NormedSpace π•œ (F' i)] {Ο† : βˆ€ i, E β†’ F' i} {p' : βˆ€ i, E β†’ FormalMultilinearSeries π•œ E (F' i)}
   {Ξ¦ : E β†’ βˆ€ i, F' i} {P' : E β†’ FormalMultilinearSeries π•œ E (βˆ€ i, F' i)}
 
-theorem hasFtaylorSeriesUpToOn_pi :
-    HasFtaylorSeriesUpToOn n (fun x i => Ο† i x)
+theorem hasFTaylorSeriesUpToOn_pi :
+    HasFTaylorSeriesUpToOn n (fun x i => Ο† i x)
         (fun x m => ContinuousMultilinearMap.pi fun i => p' i x m) s ↔
-      βˆ€ i, HasFtaylorSeriesUpToOn n (Ο† i) (p' i) s :=
+      βˆ€ i, HasFTaylorSeriesUpToOn n (Ο† i) (p' i) s :=
   by
   set pr := @ContinuousLinearMap.proj π•œ _ ΞΉ F' _ _ _
   letI : βˆ€ (m : β„•) (i : ΞΉ), NormedSpace π•œ (E[Γ—m]β†’L[π•œ] F' i) := fun m i => inferInstance
@@ -1279,28 +1279,28 @@ theorem hasFtaylorSeriesUpToOn_pi :
   Β· intro m hm
     have := continuousOn_pi.2 fun i => (h i).cont m hm
     convert(L m).Continuous.comp_continuousOn this
-#align has_ftaylor_series_up_to_on_pi hasFtaylorSeriesUpToOn_pi
+#align has_ftaylor_series_up_to_on_pi hasFTaylorSeriesUpToOn_pi
 
 @[simp]
-theorem hasFtaylorSeriesUpToOn_pi' :
-    HasFtaylorSeriesUpToOn n Ξ¦ P' s ↔
+theorem hasFTaylorSeriesUpToOn_pi' :
+    HasFTaylorSeriesUpToOn n Ξ¦ P' s ↔
       βˆ€ i,
-        HasFtaylorSeriesUpToOn n (fun x => Ξ¦ x i)
+        HasFTaylorSeriesUpToOn n (fun x => Ξ¦ x i)
           (fun x m =>
             (@ContinuousLinearMap.proj π•œ _ ΞΉ F' _ _ _ i).compContinuousMultilinearMap (P' x m))
           s :=
-  by convert hasFtaylorSeriesUpToOn_pi; ext; rfl
-#align has_ftaylor_series_up_to_on_pi' hasFtaylorSeriesUpToOn_pi'
+  by convert hasFTaylorSeriesUpToOn_pi; ext; rfl
+#align has_ftaylor_series_up_to_on_pi' hasFTaylorSeriesUpToOn_pi'
 
 theorem contDiffWithinAt_pi :
     ContDiffWithinAt π•œ n Ξ¦ s x ↔ βˆ€ i, ContDiffWithinAt π•œ n (fun x => Ξ¦ x i) s x :=
   by
   set pr := @ContinuousLinearMap.proj π•œ _ ΞΉ F' _ _ _
-  refine' ⟨fun h i => h.continuousLinearMapComp (pr i), fun h m hm => _⟩
+  refine' ⟨fun h i => h.continuousLinearMap_comp (pr i), fun h m hm => _⟩
   choose u hux p hp using fun i => h i m hm
   exact
     βŸ¨β‹‚ i, u i, Filter.iInter_mem.2 hux, _,
-      hasFtaylorSeriesUpToOn_pi.2 fun i => (hp i).mono <| Inter_subset _ _⟩
+      hasFTaylorSeriesUpToOn_pi.2 fun i => (hp i).mono <| Inter_subset _ _⟩
 #align cont_diff_within_at_pi contDiffWithinAt_pi
 
 theorem contDiffOn_pi : ContDiffOn π•œ n Ξ¦ s ↔ βˆ€ i, ContDiffOn π•œ n (fun x => Ξ¦ x i) s :=
@@ -1370,61 +1370,61 @@ variable {i : β„•}
 /-- The iterated derivative of the sum of two functions is the sum of the iterated derivatives.
 See also `iterated_fderiv_within_add_apply'`, which uses the spelling `(Ξ» x, f x + g x)`
 instead of `f + g`. -/
-theorem iteratedFderivWithin_add_apply {f g : E β†’ F} (hf : ContDiffOn π•œ i f s)
+theorem iteratedFDerivWithin_add_apply {f g : E β†’ F} (hf : ContDiffOn π•œ i f s)
     (hg : ContDiffOn π•œ i g s) (hu : UniqueDiffOn π•œ s) (hx : x ∈ s) :
-    iteratedFderivWithin π•œ i (f + g) s x =
-      iteratedFderivWithin π•œ i f s x + iteratedFderivWithin π•œ i g s x :=
+    iteratedFDerivWithin π•œ i (f + g) s x =
+      iteratedFDerivWithin π•œ i f s x + iteratedFDerivWithin π•œ i g s x :=
   by
   induction' i with i hi generalizing x
   Β· ext h; simp
   Β· ext h
     have hi' : (i : β„•βˆž) < i + 1 := with_top.coe_lt_coe.mpr (Nat.lt_succ_self _)
-    have hdf : DifferentiableOn π•œ (iteratedFderivWithin π•œ i f s) s :=
+    have hdf : DifferentiableOn π•œ (iteratedFDerivWithin π•œ i f s) s :=
       hf.differentiable_on_iterated_fderiv_within hi' hu
-    have hdg : DifferentiableOn π•œ (iteratedFderivWithin π•œ i g s) s :=
+    have hdg : DifferentiableOn π•œ (iteratedFDerivWithin π•œ i g s) s :=
       hg.differentiable_on_iterated_fderiv_within hi' hu
     have hcdf : ContDiffOn π•œ i f s := hf.of_le hi'.le
     have hcdg : ContDiffOn π•œ i g s := hg.of_le hi'.le
     calc
-      iteratedFderivWithin π•œ (i + 1) (f + g) s x h =
-          fderivWithin π•œ (iteratedFderivWithin π•œ i (f + g) s) s x (h 0) (Fin.tail h) :=
+      iteratedFDerivWithin π•œ (i + 1) (f + g) s x h =
+          fderivWithin π•œ (iteratedFDerivWithin π•œ i (f + g) s) s x (h 0) (Fin.tail h) :=
         rfl
       _ =
-          fderivWithin π•œ (iteratedFderivWithin π•œ i f s + iteratedFderivWithin π•œ i g s) s x (h 0)
+          fderivWithin π•œ (iteratedFDerivWithin π•œ i f s + iteratedFDerivWithin π•œ i g s) s x (h 0)
             (Fin.tail h) :=
         by rw [fderivWithin_congr' (fun _ => hi hcdf hcdg) hx]; rfl
       _ =
-          (fderivWithin π•œ (iteratedFderivWithin π•œ i f s) s +
-              fderivWithin π•œ (iteratedFderivWithin π•œ i g s) s)
+          (fderivWithin π•œ (iteratedFDerivWithin π•œ i f s) s +
+              fderivWithin π•œ (iteratedFDerivWithin π•œ i g s) s)
             x (h 0) (Fin.tail h) :=
         by rw [Pi.add_def, fderivWithin_add (hu x hx) (hdf x hx) (hdg x hx)]; rfl
-      _ = (iteratedFderivWithin π•œ (i + 1) f s + iteratedFderivWithin π•œ (i + 1) g s) x h := rfl
+      _ = (iteratedFDerivWithin π•œ (i + 1) f s + iteratedFDerivWithin π•œ (i + 1) g s) x h := rfl
       
-#align iterated_fderiv_within_add_apply iteratedFderivWithin_add_apply
+#align iterated_fderiv_within_add_apply iteratedFDerivWithin_add_apply
 
 /-- The iterated derivative of the sum of two functions is the sum of the iterated derivatives.
 This is the same as `iterated_fderiv_within_add_apply`, but using the spelling `(Ξ» x, f x + g x)`
 instead of `f + g`, which can be handy for some rewrites.
 TODO: use one form consistently. -/
-theorem iteratedFderivWithin_add_apply' {f g : E β†’ F} (hf : ContDiffOn π•œ i f s)
+theorem iteratedFDerivWithin_add_apply' {f g : E β†’ F} (hf : ContDiffOn π•œ i f s)
     (hg : ContDiffOn π•œ i g s) (hu : UniqueDiffOn π•œ s) (hx : x ∈ s) :
-    iteratedFderivWithin π•œ i (fun x => f x + g x) s x =
-      iteratedFderivWithin π•œ i f s x + iteratedFderivWithin π•œ i g s x :=
-  iteratedFderivWithin_add_apply hf hg hu hx
-#align iterated_fderiv_within_add_apply' iteratedFderivWithin_add_apply'
+    iteratedFDerivWithin π•œ i (fun x => f x + g x) s x =
+      iteratedFDerivWithin π•œ i f s x + iteratedFDerivWithin π•œ i g s x :=
+  iteratedFDerivWithin_add_apply hf hg hu hx
+#align iterated_fderiv_within_add_apply' iteratedFDerivWithin_add_apply'
 
-theorem iteratedFderiv_add_apply {i : β„•} {f g : E β†’ F} (hf : ContDiff π•œ i f) (hg : ContDiff π•œ i g) :
-    iteratedFderiv π•œ i (f + g) x = iteratedFderiv π•œ i f x + iteratedFderiv π•œ i g x :=
+theorem iteratedFDeriv_add_apply {i : β„•} {f g : E β†’ F} (hf : ContDiff π•œ i f) (hg : ContDiff π•œ i g) :
+    iteratedFDeriv π•œ i (f + g) x = iteratedFDeriv π•œ i f x + iteratedFDeriv π•œ i g x :=
   by
-  simp_rw [← contDiffOn_univ, ← iteratedFderivWithin_univ] at hf hg⊒
-  exact iteratedFderivWithin_add_apply hf hg uniqueDiffOn_univ (Set.mem_univ _)
-#align iterated_fderiv_add_apply iteratedFderiv_add_apply
+  simp_rw [← contDiffOn_univ, ← iteratedFDerivWithin_univ] at hf hg⊒
+  exact iteratedFDerivWithin_add_apply hf hg uniqueDiffOn_univ (Set.mem_univ _)
+#align iterated_fderiv_add_apply iteratedFDeriv_add_apply
 
-theorem iteratedFderiv_add_apply' {i : β„•} {f g : E β†’ F} (hf : ContDiff π•œ i f)
+theorem iteratedFDeriv_add_apply' {i : β„•} {f g : E β†’ F} (hf : ContDiff π•œ i f)
     (hg : ContDiff π•œ i g) :
-    iteratedFderiv π•œ i (fun x => f x + g x) x = iteratedFderiv π•œ i f x + iteratedFderiv π•œ i g x :=
-  iteratedFderiv_add_apply hf hg
-#align iterated_fderiv_add_apply' iteratedFderiv_add_apply'
+    iteratedFDeriv π•œ i (fun x => f x + g x) x = iteratedFDeriv π•œ i f x + iteratedFDeriv π•œ i g x :=
+  iteratedFDeriv_add_apply hf hg
+#align iterated_fderiv_add_apply' iteratedFDeriv_add_apply'
 
 end Add
 
@@ -1462,31 +1462,31 @@ theorem ContDiffOn.neg {s : Set E} {f : E β†’ F} (hf : ContDiffOn π•œ n f s) :
 
 variable {i : β„•}
 
-theorem iteratedFderivWithin_neg_apply {f : E β†’ F} (hu : UniqueDiffOn π•œ s) (hx : x ∈ s) :
-    iteratedFderivWithin π•œ i (-f) s x = -iteratedFderivWithin π•œ i f s x :=
+theorem iteratedFDerivWithin_neg_apply {f : E β†’ F} (hu : UniqueDiffOn π•œ s) (hx : x ∈ s) :
+    iteratedFDerivWithin π•œ i (-f) s x = -iteratedFDerivWithin π•œ i f s x :=
   by
   induction' i with i hi generalizing x
   Β· ext h; simp
   Β· ext h
     have hi' : (i : β„•βˆž) < i + 1 := with_top.coe_lt_coe.mpr (Nat.lt_succ_self _)
     calc
-      iteratedFderivWithin π•œ (i + 1) (-f) s x h =
-          fderivWithin π•œ (iteratedFderivWithin π•œ i (-f) s) s x (h 0) (Fin.tail h) :=
+      iteratedFDerivWithin π•œ (i + 1) (-f) s x h =
+          fderivWithin π•œ (iteratedFDerivWithin π•œ i (-f) s) s x (h 0) (Fin.tail h) :=
         rfl
-      _ = fderivWithin π•œ (-iteratedFderivWithin π•œ i f s) s x (h 0) (Fin.tail h) := by
+      _ = fderivWithin π•œ (-iteratedFDerivWithin π•œ i f s) s x (h 0) (Fin.tail h) := by
         rw [fderivWithin_congr' (@hi) hx]; rfl
-      _ = -(fderivWithin π•œ (iteratedFderivWithin π•œ i f s) s) x (h 0) (Fin.tail h) := by
+      _ = -(fderivWithin π•œ (iteratedFDerivWithin π•œ i f s) s) x (h 0) (Fin.tail h) := by
         rw [Pi.neg_def, fderivWithin_neg (hu x hx)]; rfl
-      _ = -(iteratedFderivWithin π•œ (i + 1) f s) x h := rfl
+      _ = -(iteratedFDerivWithin π•œ (i + 1) f s) x h := rfl
       
-#align iterated_fderiv_within_neg_apply iteratedFderivWithin_neg_apply
+#align iterated_fderiv_within_neg_apply iteratedFDerivWithin_neg_apply
 
-theorem iteratedFderiv_neg_apply {i : β„•} {f : E β†’ F} :
-    iteratedFderiv π•œ i (-f) x = -iteratedFderiv π•œ i f x :=
+theorem iteratedFDeriv_neg_apply {i : β„•} {f : E β†’ F} :
+    iteratedFDeriv π•œ i (-f) x = -iteratedFDeriv π•œ i f x :=
   by
-  simp_rw [← iteratedFderivWithin_univ]
-  exact iteratedFderivWithin_neg_apply uniqueDiffOn_univ (Set.mem_univ _)
-#align iterated_fderiv_neg_apply iteratedFderiv_neg_apply
+  simp_rw [← iteratedFDerivWithin_univ]
+  exact iteratedFDerivWithin_neg_apply uniqueDiffOn_univ (Set.mem_univ _)
+#align iterated_fderiv_neg_apply iteratedFDeriv_neg_apply
 
 end Neg
 
@@ -1742,34 +1742,34 @@ theorem ContDiffOn.const_smul {s : Set E} {f : E β†’ F} (c : R) (hf : ContDiffOn
 
 variable {i : β„•} {a : R}
 
-theorem iteratedFderivWithin_const_smul_apply (hf : ContDiffOn π•œ i f s) (hu : UniqueDiffOn π•œ s)
-    (hx : x ∈ s) : iteratedFderivWithin π•œ i (a β€’ f) s x = a β€’ iteratedFderivWithin π•œ i f s x :=
+theorem iteratedFDerivWithin_const_smul_apply (hf : ContDiffOn π•œ i f s) (hu : UniqueDiffOn π•œ s)
+    (hx : x ∈ s) : iteratedFDerivWithin π•œ i (a β€’ f) s x = a β€’ iteratedFDerivWithin π•œ i f s x :=
   by
   induction' i with i hi generalizing x
   Β· ext; simp
   Β· ext h
     have hi' : (i : β„•βˆž) < i + 1 := with_top.coe_lt_coe.mpr (Nat.lt_succ_self _)
-    have hdf : DifferentiableOn π•œ (iteratedFderivWithin π•œ i f s) s :=
+    have hdf : DifferentiableOn π•œ (iteratedFDerivWithin π•œ i f s) s :=
       hf.differentiable_on_iterated_fderiv_within hi' hu
     have hcdf : ContDiffOn π•œ i f s := hf.of_le hi'.le
     calc
-      iteratedFderivWithin π•œ (i + 1) (a β€’ f) s x h =
-          fderivWithin π•œ (iteratedFderivWithin π•œ i (a β€’ f) s) s x (h 0) (Fin.tail h) :=
+      iteratedFDerivWithin π•œ (i + 1) (a β€’ f) s x h =
+          fderivWithin π•œ (iteratedFDerivWithin π•œ i (a β€’ f) s) s x (h 0) (Fin.tail h) :=
         rfl
-      _ = fderivWithin π•œ (a β€’ iteratedFderivWithin π•œ i f s) s x (h 0) (Fin.tail h) := by
+      _ = fderivWithin π•œ (a β€’ iteratedFDerivWithin π•œ i f s) s x (h 0) (Fin.tail h) := by
         rw [fderivWithin_congr' (fun _ => hi hcdf) hx]; rfl
-      _ = (a β€’ fderivWithin π•œ (iteratedFderivWithin π•œ i f s)) s x (h 0) (Fin.tail h) := by
+      _ = (a β€’ fderivWithin π•œ (iteratedFDerivWithin π•œ i f s)) s x (h 0) (Fin.tail h) := by
         rw [Pi.smul_def, fderivWithin_const_smul (hu x hx) (hdf x hx)]; rfl
-      _ = a β€’ iteratedFderivWithin π•œ (i + 1) f s x h := rfl
+      _ = a β€’ iteratedFDerivWithin π•œ (i + 1) f s x h := rfl
       
-#align iterated_fderiv_within_const_smul_apply iteratedFderivWithin_const_smul_apply
+#align iterated_fderiv_within_const_smul_apply iteratedFDerivWithin_const_smul_apply
 
-theorem iteratedFderiv_const_smul_apply {x : E} (hf : ContDiff π•œ i f) :
-    iteratedFderiv π•œ i (a β€’ f) x = a β€’ iteratedFderiv π•œ i f x :=
+theorem iteratedFDeriv_const_smul_apply {x : E} (hf : ContDiff π•œ i f) :
+    iteratedFDeriv π•œ i (a β€’ f) x = a β€’ iteratedFDeriv π•œ i f x :=
   by
-  simp_rw [← contDiffOn_univ, ← iteratedFderivWithin_univ] at *
-  refine' iteratedFderivWithin_const_smul_apply hf uniqueDiffOn_univ (Set.mem_univ _)
-#align iterated_fderiv_const_smul_apply iteratedFderiv_const_smul_apply
+  simp_rw [← contDiffOn_univ, ← iteratedFDerivWithin_univ] at *
+  refine' iteratedFDerivWithin_const_smul_apply hf uniqueDiffOn_univ (Set.mem_univ _)
+#align iterated_fderiv_const_smul_apply iteratedFDeriv_const_smul_apply
 
 end ConstSmul
 
@@ -1865,7 +1865,7 @@ theorem contDiffAt_ring_inverse [CompleteSpace R] (x : RΛ£) : ContDiffAt π•œ n
     Β· simp [nhdsWithin_univ]
       exact x.nhds
     Β· use ftaylorSeriesWithin π•œ inverse univ
-      rw [le_antisymm hm bot_le, hasFtaylorSeriesUpToOn_zero_iff]
+      rw [le_antisymm hm bot_le, hasFTaylorSeriesUpToOn_zero_iff]
       constructor
       · rintro _ ⟨x', rfl⟩
         exact (inverse_continuous_at x').ContinuousWithinAt
@@ -2145,12 +2145,12 @@ variable {𝕂 : Type _} [IsROrC 𝕂] {E' : Type _} [NormedAddCommGroup E'] [No
 
 /-- If a function has a Taylor series at order at least 1, then at points in the interior of the
     domain of definition, the term of order 1 of this series is a strict derivative of `f`. -/
-theorem HasFtaylorSeriesUpToOn.hasStrictFDerivAt {s : Set E'} {f : E' β†’ F'} {x : E'}
-    {p : E' β†’ FormalMultilinearSeries 𝕂 E' F'} (hf : HasFtaylorSeriesUpToOn n f p s) (hn : 1 ≀ n)
+theorem HasFTaylorSeriesUpToOn.hasStrictFDerivAt {s : Set E'} {f : E' β†’ F'} {x : E'}
+    {p : E' β†’ FormalMultilinearSeries 𝕂 E' F'} (hf : HasFTaylorSeriesUpToOn n f p s) (hn : 1 ≀ n)
     (hs : s ∈ 𝓝 x) : HasStrictFDerivAt f ((continuousMultilinearCurryFin1 𝕂 E' F') (p x 1)) x :=
   hasStrictFDerivAt_of_hasFDerivAt_of_continuousAt (hf.eventually_hasFDerivAt hn hs) <|
     (continuousMultilinearCurryFin1 𝕂 E' F').ContinuousAt.comp <| (hf.cont 1 hn).ContinuousAt hs
-#align has_ftaylor_series_up_to_on.has_strict_fderiv_at HasFtaylorSeriesUpToOn.hasStrictFDerivAt
+#align has_ftaylor_series_up_to_on.has_strict_fderiv_at HasFTaylorSeriesUpToOn.hasStrictFDerivAt
 
 /-- If a function is `C^n` with `1 ≀ n` around a point, and its derivative at that point is given to
 us as `f'`, then `f'` is also a strict derivative. -/
@@ -2198,10 +2198,10 @@ theorem ContDiff.hasStrictDerivAt {f : 𝕂 β†’ F'} {x : 𝕂} (hf : ContDiff 
 
 /-- If `f` has a formal Taylor series `p` up to order `1` on `{x} βˆͺ s`, where `s` is a convex set,
 and `β€–p x 1β€–β‚Š < K`, then `f` is `K`-Lipschitz in a neighborhood of `x` within `s`. -/
-theorem HasFtaylorSeriesUpToOn.exists_lipschitzOnWith_of_nnnorm_lt {E F : Type _}
+theorem HasFTaylorSeriesUpToOn.exists_lipschitzOnWith_of_nnnorm_lt {E F : Type _}
     [NormedAddCommGroup E] [NormedSpace ℝ E] [NormedAddCommGroup F] [NormedSpace ℝ F] {f : E β†’ F}
     {p : E β†’ FormalMultilinearSeries ℝ E F} {s : Set E} {x : E}
-    (hf : HasFtaylorSeriesUpToOn 1 f p (insert x s)) (hs : Convex ℝ s) (K : ℝβ‰₯0)
+    (hf : HasFTaylorSeriesUpToOn 1 f p (insert x s)) (hs : Convex ℝ s) (K : ℝβ‰₯0)
     (hK : β€–p x 1β€–β‚Š < K) : βˆƒ t ∈ 𝓝[s] x, LipschitzOnWith K f t :=
   by
   set f' := fun y => continuousMultilinearCurryFin1 ℝ E F (p y 1)
@@ -2214,17 +2214,17 @@ theorem HasFtaylorSeriesUpToOn.exists_lipschitzOnWith_of_nnnorm_lt {E F : Type _
   exact
     hs.exists_nhds_within_lipschitz_on_with_of_has_fderiv_within_at_of_nnnorm_lt
       (eventually_nhdsWithin_iff.2 <| eventually_of_forall hder) hcont K hK
-#align has_ftaylor_series_up_to_on.exists_lipschitz_on_with_of_nnnorm_lt HasFtaylorSeriesUpToOn.exists_lipschitzOnWith_of_nnnorm_lt
+#align has_ftaylor_series_up_to_on.exists_lipschitz_on_with_of_nnnorm_lt HasFTaylorSeriesUpToOn.exists_lipschitzOnWith_of_nnnorm_lt
 
 /-- If `f` has a formal Taylor series `p` up to order `1` on `{x} βˆͺ s`, where `s` is a convex set,
 then `f` is Lipschitz in a neighborhood of `x` within `s`. -/
-theorem HasFtaylorSeriesUpToOn.exists_lipschitzOnWith {E F : Type _} [NormedAddCommGroup E]
+theorem HasFTaylorSeriesUpToOn.exists_lipschitzOnWith {E F : Type _} [NormedAddCommGroup E]
     [NormedSpace ℝ E] [NormedAddCommGroup F] [NormedSpace ℝ F] {f : E β†’ F}
     {p : E β†’ FormalMultilinearSeries ℝ E F} {s : Set E} {x : E}
-    (hf : HasFtaylorSeriesUpToOn 1 f p (insert x s)) (hs : Convex ℝ s) :
+    (hf : HasFTaylorSeriesUpToOn 1 f p (insert x s)) (hs : Convex ℝ s) :
     βˆƒ K, βˆƒ t ∈ 𝓝[s] x, LipschitzOnWith K f t :=
   (exists_gt _).imp <| hf.exists_lipschitzOnWith_of_nnnorm_lt hs
-#align has_ftaylor_series_up_to_on.exists_lipschitz_on_with HasFtaylorSeriesUpToOn.exists_lipschitzOnWith
+#align has_ftaylor_series_up_to_on.exists_lipschitz_on_with HasFTaylorSeriesUpToOn.exists_lipschitzOnWith
 
 /-- If `f` is `C^1` within a conves set `s` at `x`, then it is Lipschitz on a neighborhood of `x`
 within `s`. -/
@@ -2235,7 +2235,7 @@ theorem ContDiffWithinAt.exists_lipschitzOnWith {E F : Type _} [NormedAddCommGro
   by
   rcases hf 1 le_rfl with ⟨t, hst, p, hp⟩
   rcases metric.mem_nhds_within_iff.mp hst with ⟨Ρ, Ρ0, hΡ⟩
-  replace hp : HasFtaylorSeriesUpToOn 1 f p (Metric.ball x Ρ ∩ insert x s) := hp.mono hΡ
+  replace hp : HasFTaylorSeriesUpToOn 1 f p (Metric.ball x Ρ ∩ insert x s) := hp.mono hΡ
   clear hst hΞ΅ t
   rw [← insert_eq_of_mem (Metric.mem_ball_self Ξ΅0), ← insert_inter_distrib] at hp
   rcases hp.exists_lipschitz_on_with ((convex_ball _ _).inter hs) with ⟨K, t, hst, hft⟩
@@ -2423,8 +2423,8 @@ variable [NormedSpace π•œ' F] [IsScalarTower π•œ π•œ' F]
 
 variable {p' : E β†’ FormalMultilinearSeries π•œ' E F}
 
-theorem HasFtaylorSeriesUpToOn.restrictScalars (h : HasFtaylorSeriesUpToOn n f p' s) :
-    HasFtaylorSeriesUpToOn n f (fun x => (p' x).restrictScalars π•œ) s :=
+theorem HasFTaylorSeriesUpToOn.restrictScalars (h : HasFTaylorSeriesUpToOn n f p' s) :
+    HasFTaylorSeriesUpToOn n f (fun x => (p' x).restrictScalars π•œ) s :=
   { zero_eq := fun x hx => h.zero_eq x hx
     fderivWithin := by
       intro m hm x hx
@@ -2432,7 +2432,7 @@ theorem HasFtaylorSeriesUpToOn.restrictScalars (h : HasFtaylorSeriesUpToOn n f p
           ((h.fderiv_within m hm x hx).restrictScalars π•œ)
     cont := fun m hm =>
       ContinuousMultilinearMap.continuous_restrictScalars.comp_continuousOn (h.cont m hm) }
-#align has_ftaylor_series_up_to_on.restrict_scalars HasFtaylorSeriesUpToOn.restrictScalars
+#align has_ftaylor_series_up_to_on.restrict_scalars HasFTaylorSeriesUpToOn.restrictScalars
 
 theorem ContDiffWithinAt.restrict_scalars (h : ContDiffWithinAt π•œ' n f s x) :
     ContDiffWithinAt π•œ n f s x := by
@@ -2462,16 +2462,16 @@ end RestrictScalars
 iterated derivatives of `f` and `g` when `B` is bilinear. This lemma is an auxiliary version
 assuming all spaces live in the same universe, to enable an induction. Use instead
 `continuous_linear_map.norm_iterated_fderiv_within_le_of_bilinear` that removes this assumption. -/
-theorem ContinuousLinearMap.norm_iteratedFderivWithin_le_of_bilinear_aux {Du Eu Fu Gu : Type u}
+theorem ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear_aux {Du Eu Fu Gu : Type u}
     [NormedAddCommGroup Du] [NormedSpace π•œ Du] [NormedAddCommGroup Eu] [NormedSpace π•œ Eu]
     [NormedAddCommGroup Fu] [NormedSpace π•œ Fu] [NormedAddCommGroup Gu] [NormedSpace π•œ Gu]
     (B : Eu β†’L[π•œ] Fu β†’L[π•œ] Gu) {f : Du β†’ Eu} {g : Du β†’ Fu} {n : β„•} {s : Set Du} {x : Du}
     (hf : ContDiffOn π•œ n f s) (hg : ContDiffOn π•œ n g s) (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) :
-    β€–iteratedFderivWithin π•œ n (fun y => B (f y) (g y)) s xβ€– ≀
+    β€–iteratedFDerivWithin π•œ n (fun y => B (f y) (g y)) s xβ€– ≀
       β€–Bβ€– *
         βˆ‘ i in Finset.range (n + 1),
-          (n.choose i : ℝ) * β€–iteratedFderivWithin π•œ i f s xβ€– *
-            β€–iteratedFderivWithin π•œ (n - i) g s xβ€– :=
+          (n.choose i : ℝ) * β€–iteratedFDerivWithin π•œ i f s xβ€– *
+            β€–iteratedFDerivWithin π•œ (n - i) g s xβ€– :=
   by
   /- We argue by induction on `n`. The bound is trivial for `n = 0`. For `n + 1`, we write
     the `(n+1)`-th derivative as the `n`-th derivative of the derivative `B f g' + B f' g`, and apply
@@ -2480,104 +2480,104 @@ theorem ContinuousLinearMap.norm_iteratedFderivWithin_le_of_bilinear_aux {Du Eu
     original spaces, which explains why we assume in the lemma that all spaces live in the same
     universe. -/
   induction' n with n IH generalizing Eu Fu Gu
-  Β· simp only [← mul_assoc, norm_iteratedFderivWithin_zero, Finset.range_one, Finset.sum_singleton,
+  Β· simp only [← mul_assoc, norm_iteratedFDerivWithin_zero, Finset.range_one, Finset.sum_singleton,
       Nat.choose_self, algebraMap.coe_one, one_mul]
     apply ((B (f x)).le_op_norm (g x)).trans
     apply mul_le_mul_of_nonneg_right _ (norm_nonneg _)
     exact B.le_op_norm (f x)
   Β· have In : (n : β„•βˆž) + 1 ≀ n.succ := by simp only [Nat.cast_succ, le_refl]
     have I1 :
-      β€–iteratedFderivWithin π•œ n (fun y : Du => B.precompR Du (f y) (fderivWithin π•œ g s y)) s xβ€– ≀
+      β€–iteratedFDerivWithin π•œ n (fun y : Du => B.precompR Du (f y) (fderivWithin π•œ g s y)) s xβ€– ≀
         β€–Bβ€– *
           βˆ‘ i : β„• in Finset.range (n + 1),
-            n.choose i * β€–iteratedFderivWithin π•œ i f s xβ€– *
-              β€–iteratedFderivWithin π•œ (n + 1 - i) g s xβ€– :=
+            n.choose i * β€–iteratedFDerivWithin π•œ i f s xβ€– *
+              β€–iteratedFDerivWithin π•œ (n + 1 - i) g s xβ€– :=
       calc
-        β€–iteratedFderivWithin π•œ n (fun y : Du => B.precompR Du (f y) (fderivWithin π•œ g s y)) s xβ€– ≀
+        β€–iteratedFDerivWithin π•œ n (fun y : Du => B.precompR Du (f y) (fderivWithin π•œ g s y)) s xβ€– ≀
             β€–B.precompR Duβ€– *
               βˆ‘ i : β„• in Finset.range (n + 1),
-                n.choose i * β€–iteratedFderivWithin π•œ i f s xβ€– *
-                  β€–iteratedFderivWithin π•œ (n - i) (fderivWithin π•œ g s) s xβ€– :=
+                n.choose i * β€–iteratedFDerivWithin π•œ i f s xβ€– *
+                  β€–iteratedFDerivWithin π•œ (n - i) (fderivWithin π•œ g s) s xβ€– :=
           IH _ (hf.of_le (Nat.cast_le.2 (Nat.le_succ n))) (hg.fderiv_within hs In)
         _ ≀
             β€–Bβ€– *
               βˆ‘ i : β„• in Finset.range (n + 1),
-                n.choose i * β€–iteratedFderivWithin π•œ i f s xβ€– *
-                  β€–iteratedFderivWithin π•œ (n - i) (fderivWithin π•œ g s) s xβ€– :=
+                n.choose i * β€–iteratedFDerivWithin π•œ i f s xβ€– *
+                  β€–iteratedFDerivWithin π•œ (n - i) (fderivWithin π•œ g s) s xβ€– :=
           (mul_le_mul_of_nonneg_right (B.norm_precompR_le Du)
             (Finset.sum_nonneg' fun i => by positivity))
         _ = _ := by
           congr 1
           apply Finset.sum_congr rfl fun i hi => _
           rw [Nat.succ_sub (Nat.lt_succ_iff.1 (Finset.mem_range.1 hi)),
-            iteratedFderivWithin_succ_eq_comp_right hs hx, LinearIsometryEquiv.norm_map]
+            iteratedFDerivWithin_succ_eq_comp_right hs hx, LinearIsometryEquiv.norm_map]
         
     have I2 :
-      β€–iteratedFderivWithin π•œ n (fun y : Du => B.precompL Du (fderivWithin π•œ f s y) (g y)) s xβ€– ≀
+      β€–iteratedFDerivWithin π•œ n (fun y : Du => B.precompL Du (fderivWithin π•œ f s y) (g y)) s xβ€– ≀
         β€–Bβ€– *
           βˆ‘ i : β„• in Finset.range (n + 1),
-            n.choose i * β€–iteratedFderivWithin π•œ (i + 1) f s xβ€– *
-              β€–iteratedFderivWithin π•œ (n - i) g s xβ€– :=
+            n.choose i * β€–iteratedFDerivWithin π•œ (i + 1) f s xβ€– *
+              β€–iteratedFDerivWithin π•œ (n - i) g s xβ€– :=
       calc
-        β€–iteratedFderivWithin π•œ n (fun y : Du => B.precompL Du (fderivWithin π•œ f s y) (g y)) s xβ€– ≀
+        β€–iteratedFDerivWithin π•œ n (fun y : Du => B.precompL Du (fderivWithin π•œ f s y) (g y)) s xβ€– ≀
             β€–B.precompL Duβ€– *
               βˆ‘ i : β„• in Finset.range (n + 1),
-                n.choose i * β€–iteratedFderivWithin π•œ i (fderivWithin π•œ f s) s xβ€– *
-                  β€–iteratedFderivWithin π•œ (n - i) g s xβ€– :=
+                n.choose i * β€–iteratedFDerivWithin π•œ i (fderivWithin π•œ f s) s xβ€– *
+                  β€–iteratedFDerivWithin π•œ (n - i) g s xβ€– :=
           IH _ (hf.fderiv_within hs In) (hg.of_le (Nat.cast_le.2 (Nat.le_succ n)))
         _ ≀
             β€–Bβ€– *
               βˆ‘ i : β„• in Finset.range (n + 1),
-                n.choose i * β€–iteratedFderivWithin π•œ i (fderivWithin π•œ f s) s xβ€– *
-                  β€–iteratedFderivWithin π•œ (n - i) g s xβ€– :=
+                n.choose i * β€–iteratedFDerivWithin π•œ i (fderivWithin π•œ f s) s xβ€– *
+                  β€–iteratedFDerivWithin π•œ (n - i) g s xβ€– :=
           (mul_le_mul_of_nonneg_right (B.norm_precompL_le Du)
             (Finset.sum_nonneg' fun i => by positivity))
         _ = _ := by
           congr 1
           apply Finset.sum_congr rfl fun i hi => _
-          rw [iteratedFderivWithin_succ_eq_comp_right hs hx, LinearIsometryEquiv.norm_map]
+          rw [iteratedFDerivWithin_succ_eq_comp_right hs hx, LinearIsometryEquiv.norm_map]
         
     have J :
-      iteratedFderivWithin π•œ n (fun y : Du => fderivWithin π•œ (fun y : Du => B (f y) (g y)) s y) s
+      iteratedFDerivWithin π•œ n (fun y : Du => fderivWithin π•œ (fun y : Du => B (f y) (g y)) s y) s
           x =
-        iteratedFderivWithin π•œ n
+        iteratedFDerivWithin π•œ n
           (fun y =>
             B.precompR Du (f y) (fderivWithin π•œ g s y) + B.precompL Du (fderivWithin π•œ f s y) (g y))
           s x :=
       by
-      apply iteratedFderivWithin_congr (fun y hy => _) hx
+      apply iteratedFDerivWithin_congr (fun y hy => _) hx
       have L : (1 : β„•βˆž) ≀ n.succ := by
         simpa only [ENat.coe_one, Nat.one_le_cast] using Nat.succ_pos n
       exact
         B.fderiv_within_of_bilinear (hf.differentiable_on L y hy) (hg.differentiable_on L y hy)
           (hs y hy)
-    rw [iteratedFderivWithin_succ_eq_comp_right hs hx, LinearIsometryEquiv.norm_map, J]
+    rw [iteratedFDerivWithin_succ_eq_comp_right hs hx, LinearIsometryEquiv.norm_map, J]
     have A : ContDiffOn π•œ n (fun y => B.precompR Du (f y) (fderivWithin π•œ g s y)) s :=
       (B.precompR Du).IsBoundedBilinearMap.ContDiff.comp_contDiff_onβ‚‚
         (hf.of_le (Nat.cast_le.2 (Nat.le_succ n))) (hg.fderiv_within hs In)
     have A' : ContDiffOn π•œ n (fun y => B.precompL Du (fderivWithin π•œ f s y) (g y)) s :=
       (B.precompL Du).IsBoundedBilinearMap.ContDiff.comp_contDiff_onβ‚‚ (hf.fderiv_within hs In)
         (hg.of_le (Nat.cast_le.2 (Nat.le_succ n)))
-    rw [iteratedFderivWithin_add_apply' A A' hs hx]
+    rw [iteratedFDerivWithin_add_apply' A A' hs hx]
     apply (norm_add_le _ _).trans ((add_le_add I1 I2).trans (le_of_eq _))
     simp_rw [← mul_add, mul_assoc]
     congr 1
     exact
       (Finset.sum_choose_succ_mul
-          (fun i j => β€–iteratedFderivWithin π•œ i f s xβ€– * β€–iteratedFderivWithin π•œ j g s xβ€–) n).symm
-#align continuous_linear_map.norm_iterated_fderiv_within_le_of_bilinear_aux ContinuousLinearMap.norm_iteratedFderivWithin_le_of_bilinear_aux
+          (fun i j => β€–iteratedFDerivWithin π•œ i f s xβ€– * β€–iteratedFDerivWithin π•œ j g s xβ€–) n).symm
+#align continuous_linear_map.norm_iterated_fderiv_within_le_of_bilinear_aux ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear_aux
 
 /-- Bounding the norm of the iterated derivative of `B (f x) (g x)` within a set in terms of the
 iterated derivatives of `f` and `g` when `B` is bilinear:
 `β€–D^n (x ↦ B (f x) (g x))β€– ≀ β€–Bβ€– βˆ‘_{k ≀ n} n.choose k β€–D^k fβ€– β€–D^{n-k} gβ€–` -/
-theorem ContinuousLinearMap.norm_iteratedFderivWithin_le_of_bilinear (B : E β†’L[π•œ] F β†’L[π•œ] G)
+theorem ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear (B : E β†’L[π•œ] F β†’L[π•œ] G)
     {f : D β†’ E} {g : D β†’ F} {N : β„•βˆž} {s : Set D} {x : D} (hf : ContDiffOn π•œ N f s)
     (hg : ContDiffOn π•œ N g s) (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) {n : β„•} (hn : (n : β„•βˆž) ≀ N) :
-    β€–iteratedFderivWithin π•œ n (fun y => B (f y) (g y)) s xβ€– ≀
+    β€–iteratedFDerivWithin π•œ n (fun y => B (f y) (g y)) s xβ€– ≀
       β€–Bβ€– *
         βˆ‘ i in Finset.range (n + 1),
-          (n.choose i : ℝ) * β€–iteratedFderivWithin π•œ i f s xβ€– *
-            β€–iteratedFderivWithin π•œ (n - i) g s xβ€– :=
+          (n.choose i : ℝ) * β€–iteratedFDerivWithin π•œ i f s xβ€– *
+            β€–iteratedFDerivWithin π•œ (n - i) g s xβ€– :=
   by
   /- We reduce the bound to the case where all spaces live in the same universe (in which we
     already have proved the result), by using linear isometries between the spaces and their `ulift`
@@ -2632,114 +2632,114 @@ theorem ContinuousLinearMap.norm_iteratedFderivWithin_le_of_bilinear (B : E β†’L
   have hgu : ContDiffOn π•œ n gu su :=
     isoF.symm.cont_diff.comp_cont_diff_on
       ((hg.of_le hn).compContinuousLinearMap (isoD : Du β†’L[π•œ] D))
-  have Nfu : βˆ€ i, β€–iteratedFderivWithin π•œ i fu su xuβ€– = β€–iteratedFderivWithin π•œ i f s xβ€– :=
+  have Nfu : βˆ€ i, β€–iteratedFDerivWithin π•œ i fu su xuβ€– = β€–iteratedFDerivWithin π•œ i f s xβ€– :=
     by
     intro i
-    rw [LinearIsometryEquiv.norm_iteratedFderivWithin_comp_left _ _ hsu hxu]
-    rw [LinearIsometryEquiv.norm_iteratedFderivWithin_comp_right _ _ hs, xu_x]
+    rw [LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_left _ _ hsu hxu]
+    rw [LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_right _ _ hs, xu_x]
     rwa [← xu_x] at hx
-  have Ngu : βˆ€ i, β€–iteratedFderivWithin π•œ i gu su xuβ€– = β€–iteratedFderivWithin π•œ i g s xβ€– :=
+  have Ngu : βˆ€ i, β€–iteratedFDerivWithin π•œ i gu su xuβ€– = β€–iteratedFDerivWithin π•œ i g s xβ€– :=
     by
     intro i
-    rw [LinearIsometryEquiv.norm_iteratedFderivWithin_comp_left _ _ hsu hxu]
-    rw [LinearIsometryEquiv.norm_iteratedFderivWithin_comp_right _ _ hs, xu_x]
+    rw [LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_left _ _ hsu hxu]
+    rw [LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_right _ _ hs, xu_x]
     rwa [← xu_x] at hx
   have NBu :
-    β€–iteratedFderivWithin π•œ n (fun y => Bu (fu y) (gu y)) su xuβ€– =
-      β€–iteratedFderivWithin π•œ n (fun y => B (f y) (g y)) s xβ€– :=
+    β€–iteratedFDerivWithin π•œ n (fun y => Bu (fu y) (gu y)) su xuβ€– =
+      β€–iteratedFDerivWithin π•œ n (fun y => B (f y) (g y)) s xβ€– :=
     by
     rw [Bu_eq]
-    rw [LinearIsometryEquiv.norm_iteratedFderivWithin_comp_left _ _ hsu hxu]
-    rw [LinearIsometryEquiv.norm_iteratedFderivWithin_comp_right _ _ hs, xu_x]
+    rw [LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_left _ _ hsu hxu]
+    rw [LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_right _ _ hs, xu_x]
     rwa [← xu_x] at hx
   -- state the bound for the lifted objects, and deduce the original bound from it.
   have :
-    β€–iteratedFderivWithin π•œ n (fun y => Bu (fu y) (gu y)) su xuβ€– ≀
+    β€–iteratedFDerivWithin π•œ n (fun y => Bu (fu y) (gu y)) su xuβ€– ≀
       β€–Buβ€– *
         βˆ‘ i in Finset.range (n + 1),
-          (n.choose i : ℝ) * β€–iteratedFderivWithin π•œ i fu su xuβ€– *
-            β€–iteratedFderivWithin π•œ (n - i) gu su xuβ€– :=
+          (n.choose i : ℝ) * β€–iteratedFDerivWithin π•œ i fu su xuβ€– *
+            β€–iteratedFDerivWithin π•œ (n - i) gu su xuβ€– :=
     Bu.norm_iterated_fderiv_within_le_of_bilinear_aux hfu hgu hsu hxu
   simp only [Nfu, Ngu, NBu] at this
   apply this.trans (mul_le_mul_of_nonneg_right Bu_le _)
   exact Finset.sum_nonneg' fun i => by positivity
-#align continuous_linear_map.norm_iterated_fderiv_within_le_of_bilinear ContinuousLinearMap.norm_iteratedFderivWithin_le_of_bilinear
+#align continuous_linear_map.norm_iterated_fderiv_within_le_of_bilinear ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear
 
 /-- Bounding the norm of the iterated derivative of `B (f x) (g x)` in terms of the
 iterated derivatives of `f` and `g` when `B` is bilinear:
 `β€–D^n (x ↦ B (f x) (g x))β€– ≀ β€–Bβ€– βˆ‘_{k ≀ n} n.choose k β€–D^k fβ€– β€–D^{n-k} gβ€–` -/
-theorem ContinuousLinearMap.norm_iteratedFderiv_le_of_bilinear (B : E β†’L[π•œ] F β†’L[π•œ] G) {f : D β†’ E}
+theorem ContinuousLinearMap.norm_iteratedFDeriv_le_of_bilinear (B : E β†’L[π•œ] F β†’L[π•œ] G) {f : D β†’ E}
     {g : D β†’ F} {N : β„•βˆž} (hf : ContDiff π•œ N f) (hg : ContDiff π•œ N g) (x : D) {n : β„•}
     (hn : (n : β„•βˆž) ≀ N) :
-    β€–iteratedFderiv π•œ n (fun y => B (f y) (g y)) xβ€– ≀
+    β€–iteratedFDeriv π•œ n (fun y => B (f y) (g y)) xβ€– ≀
       β€–Bβ€– *
         βˆ‘ i in Finset.range (n + 1),
-          (n.choose i : ℝ) * β€–iteratedFderiv π•œ i f xβ€– * β€–iteratedFderiv π•œ (n - i) g xβ€– :=
+          (n.choose i : ℝ) * β€–iteratedFDeriv π•œ i f xβ€– * β€–iteratedFDeriv π•œ (n - i) g xβ€– :=
   by
-  simp_rw [← iteratedFderivWithin_univ]
+  simp_rw [← iteratedFDerivWithin_univ]
   exact
     B.norm_iterated_fderiv_within_le_of_bilinear hf.cont_diff_on hg.cont_diff_on uniqueDiffOn_univ
       (mem_univ x) hn
-#align continuous_linear_map.norm_iterated_fderiv_le_of_bilinear ContinuousLinearMap.norm_iteratedFderiv_le_of_bilinear
+#align continuous_linear_map.norm_iterated_fderiv_le_of_bilinear ContinuousLinearMap.norm_iteratedFDeriv_le_of_bilinear
 
 /-- Bounding the norm of the iterated derivative of `B (f x) (g x)` within a set in terms of the
 iterated derivatives of `f` and `g` when `B` is bilinear of norm at most `1`:
 `β€–D^n (x ↦ B (f x) (g x))β€– ≀ βˆ‘_{k ≀ n} n.choose k β€–D^k fβ€– β€–D^{n-k} gβ€–` -/
-theorem ContinuousLinearMap.norm_iteratedFderivWithin_le_of_bilinear_of_le_one
+theorem ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear_of_le_one
     (B : E β†’L[π•œ] F β†’L[π•œ] G) {f : D β†’ E} {g : D β†’ F} {N : β„•βˆž} {s : Set D} {x : D}
     (hf : ContDiffOn π•œ N f s) (hg : ContDiffOn π•œ N g s) (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) {n : β„•}
     (hn : (n : β„•βˆž) ≀ N) (hB : β€–Bβ€– ≀ 1) :
-    β€–iteratedFderivWithin π•œ n (fun y => B (f y) (g y)) s xβ€– ≀
+    β€–iteratedFDerivWithin π•œ n (fun y => B (f y) (g y)) s xβ€– ≀
       βˆ‘ i in Finset.range (n + 1),
-        (n.choose i : ℝ) * β€–iteratedFderivWithin π•œ i f s xβ€– *
-          β€–iteratedFderivWithin π•œ (n - i) g s xβ€– :=
+        (n.choose i : ℝ) * β€–iteratedFDerivWithin π•œ i f s xβ€– *
+          β€–iteratedFDerivWithin π•œ (n - i) g s xβ€– :=
   by
   apply (B.norm_iterated_fderiv_within_le_of_bilinear hf hg hs hx hn).trans
   apply mul_le_of_le_one_left (Finset.sum_nonneg' fun i => _) hB
   positivity
-#align continuous_linear_map.norm_iterated_fderiv_within_le_of_bilinear_of_le_one ContinuousLinearMap.norm_iteratedFderivWithin_le_of_bilinear_of_le_one
+#align continuous_linear_map.norm_iterated_fderiv_within_le_of_bilinear_of_le_one ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear_of_le_one
 
 /-- Bounding the norm of the iterated derivative of `B (f x) (g x)` in terms of the
 iterated derivatives of `f` and `g` when `B` is bilinear of norm at most `1`:
 `β€–D^n (x ↦ B (f x) (g x))β€– ≀ βˆ‘_{k ≀ n} n.choose k β€–D^k fβ€– β€–D^{n-k} gβ€–` -/
-theorem ContinuousLinearMap.norm_iteratedFderiv_le_of_bilinear_of_le_one (B : E β†’L[π•œ] F β†’L[π•œ] G)
+theorem ContinuousLinearMap.norm_iteratedFDeriv_le_of_bilinear_of_le_one (B : E β†’L[π•œ] F β†’L[π•œ] G)
     {f : D β†’ E} {g : D β†’ F} {N : β„•βˆž} (hf : ContDiff π•œ N f) (hg : ContDiff π•œ N g) (x : D) {n : β„•}
     (hn : (n : β„•βˆž) ≀ N) (hB : β€–Bβ€– ≀ 1) :
-    β€–iteratedFderiv π•œ n (fun y => B (f y) (g y)) xβ€– ≀
+    β€–iteratedFDeriv π•œ n (fun y => B (f y) (g y)) xβ€– ≀
       βˆ‘ i in Finset.range (n + 1),
-        (n.choose i : ℝ) * β€–iteratedFderiv π•œ i f xβ€– * β€–iteratedFderiv π•œ (n - i) g xβ€– :=
+        (n.choose i : ℝ) * β€–iteratedFDeriv π•œ i f xβ€– * β€–iteratedFDeriv π•œ (n - i) g xβ€– :=
   by
-  simp_rw [← iteratedFderivWithin_univ]
+  simp_rw [← iteratedFDerivWithin_univ]
   exact
     B.norm_iterated_fderiv_within_le_of_bilinear_of_le_one hf.cont_diff_on hg.cont_diff_on
       uniqueDiffOn_univ (mem_univ x) hn hB
-#align continuous_linear_map.norm_iterated_fderiv_le_of_bilinear_of_le_one ContinuousLinearMap.norm_iteratedFderiv_le_of_bilinear_of_le_one
+#align continuous_linear_map.norm_iterated_fderiv_le_of_bilinear_of_le_one ContinuousLinearMap.norm_iteratedFDeriv_le_of_bilinear_of_le_one
 
 section
 
 variable {π•œ' : Type _} [NormedField π•œ'] [NormedAlgebra π•œ π•œ'] [NormedSpace π•œ' F]
   [IsScalarTower π•œ π•œ' F]
 
-theorem norm_iteratedFderivWithin_smul_le {f : E β†’ π•œ'} {g : E β†’ F} {N : β„•βˆž}
+theorem norm_iteratedFDerivWithin_smul_le {f : E β†’ π•œ'} {g : E β†’ F} {N : β„•βˆž}
     (hf : ContDiffOn π•œ N f s) (hg : ContDiffOn π•œ N g s) (hs : UniqueDiffOn π•œ s) {x : E} (hx : x ∈ s)
     {n : β„•} (hn : (n : β„•βˆž) ≀ N) :
-    β€–iteratedFderivWithin π•œ n (fun y => f y β€’ g y) s xβ€– ≀
+    β€–iteratedFDerivWithin π•œ n (fun y => f y β€’ g y) s xβ€– ≀
       βˆ‘ i in Finset.range (n + 1),
-        (n.choose i : ℝ) * β€–iteratedFderivWithin π•œ i f s xβ€– *
-          β€–iteratedFderivWithin π•œ (n - i) g s xβ€– :=
+        (n.choose i : ℝ) * β€–iteratedFDerivWithin π•œ i f s xβ€– *
+          β€–iteratedFDerivWithin π•œ (n - i) g s xβ€– :=
   (ContinuousLinearMap.lsmul π•œ π•œ' :
-        π•œ' β†’L[π•œ] F β†’L[π•œ] F).norm_iteratedFderivWithin_le_of_bilinear_of_le_one
+        π•œ' β†’L[π•œ] F β†’L[π•œ] F).norm_iteratedFDerivWithin_le_of_bilinear_of_le_one
     hf hg hs hx hn ContinuousLinearMap.op_norm_lsmul_le
-#align norm_iterated_fderiv_within_smul_le norm_iteratedFderivWithin_smul_le
+#align norm_iterated_fderiv_within_smul_le norm_iteratedFDerivWithin_smul_le
 
-theorem norm_iteratedFderiv_smul_le {f : E β†’ π•œ'} {g : E β†’ F} {N : β„•βˆž} (hf : ContDiff π•œ N f)
+theorem norm_iteratedFDeriv_smul_le {f : E β†’ π•œ'} {g : E β†’ F} {N : β„•βˆž} (hf : ContDiff π•œ N f)
     (hg : ContDiff π•œ N g) (x : E) {n : β„•} (hn : (n : β„•βˆž) ≀ N) :
-    β€–iteratedFderiv π•œ n (fun y => f y β€’ g y) xβ€– ≀
+    β€–iteratedFDeriv π•œ n (fun y => f y β€’ g y) xβ€– ≀
       βˆ‘ i in Finset.range (n + 1),
-        (n.choose i : ℝ) * β€–iteratedFderiv π•œ i f xβ€– * β€–iteratedFderiv π•œ (n - i) g xβ€– :=
-  (ContinuousLinearMap.lsmul π•œ π•œ' : π•œ' β†’L[π•œ] F β†’L[π•œ] F).norm_iteratedFderiv_le_of_bilinear_of_le_one
+        (n.choose i : ℝ) * β€–iteratedFDeriv π•œ i f xβ€– * β€–iteratedFDeriv π•œ (n - i) g xβ€– :=
+  (ContinuousLinearMap.lsmul π•œ π•œ' : π•œ' β†’L[π•œ] F β†’L[π•œ] F).norm_iteratedFDeriv_le_of_bilinear_of_le_one
     hf hg x hn ContinuousLinearMap.op_norm_lsmul_le
-#align norm_iterated_fderiv_smul_le norm_iteratedFderiv_smul_le
+#align norm_iterated_fderiv_smul_le norm_iteratedFDeriv_smul_le
 
 end
 
@@ -2747,29 +2747,29 @@ section
 
 variable {A : Type _} [NormedRing A] [NormedAlgebra π•œ A]
 
-theorem norm_iteratedFderivWithin_mul_le {f : E β†’ A} {g : E β†’ A} {N : β„•βˆž} (hf : ContDiffOn π•œ N f s)
+theorem norm_iteratedFDerivWithin_mul_le {f : E β†’ A} {g : E β†’ A} {N : β„•βˆž} (hf : ContDiffOn π•œ N f s)
     (hg : ContDiffOn π•œ N g s) (hs : UniqueDiffOn π•œ s) {x : E} (hx : x ∈ s) {n : β„•}
     (hn : (n : β„•βˆž) ≀ N) :
-    β€–iteratedFderivWithin π•œ n (fun y => f y * g y) s xβ€– ≀
+    β€–iteratedFDerivWithin π•œ n (fun y => f y * g y) s xβ€– ≀
       βˆ‘ i in Finset.range (n + 1),
-        (n.choose i : ℝ) * β€–iteratedFderivWithin π•œ i f s xβ€– *
-          β€–iteratedFderivWithin π•œ (n - i) g s xβ€– :=
+        (n.choose i : ℝ) * β€–iteratedFDerivWithin π•œ i f s xβ€– *
+          β€–iteratedFDerivWithin π•œ (n - i) g s xβ€– :=
   (ContinuousLinearMap.mul π•œ A :
-        A β†’L[π•œ] A β†’L[π•œ] A).norm_iteratedFderivWithin_le_of_bilinear_of_le_one
+        A β†’L[π•œ] A β†’L[π•œ] A).norm_iteratedFDerivWithin_le_of_bilinear_of_le_one
     hf hg hs hx hn (ContinuousLinearMap.op_norm_mul_le _ _)
-#align norm_iterated_fderiv_within_mul_le norm_iteratedFderivWithin_mul_le
+#align norm_iterated_fderiv_within_mul_le norm_iteratedFDerivWithin_mul_le
 
-theorem norm_iteratedFderiv_mul_le {f : E β†’ A} {g : E β†’ A} {N : β„•βˆž} (hf : ContDiff π•œ N f)
+theorem norm_iteratedFDeriv_mul_le {f : E β†’ A} {g : E β†’ A} {N : β„•βˆž} (hf : ContDiff π•œ N f)
     (hg : ContDiff π•œ N g) (x : E) {n : β„•} (hn : (n : β„•βˆž) ≀ N) :
-    β€–iteratedFderiv π•œ n (fun y => f y * g y) xβ€– ≀
+    β€–iteratedFDeriv π•œ n (fun y => f y * g y) xβ€– ≀
       βˆ‘ i in Finset.range (n + 1),
-        (n.choose i : ℝ) * β€–iteratedFderiv π•œ i f xβ€– * β€–iteratedFderiv π•œ (n - i) g xβ€– :=
+        (n.choose i : ℝ) * β€–iteratedFDeriv π•œ i f xβ€– * β€–iteratedFDeriv π•œ (n - i) g xβ€– :=
   by
-  simp_rw [← iteratedFderivWithin_univ]
+  simp_rw [← iteratedFDerivWithin_univ]
   exact
-    norm_iteratedFderivWithin_mul_le hf.cont_diff_on hg.cont_diff_on uniqueDiffOn_univ (mem_univ x)
+    norm_iteratedFDerivWithin_mul_le hf.cont_diff_on hg.cont_diff_on uniqueDiffOn_univ (mem_univ x)
       hn
-#align norm_iterated_fderiv_mul_le norm_iteratedFderiv_mul_le
+#align norm_iterated_fderiv_mul_le norm_iteratedFDeriv_mul_le
 
 end
 
@@ -2779,13 +2779,13 @@ of `g ∘ f` is bounded by `n! * C * D^n`.
 This lemma proves this estimate assuming additionally that two of the spaces live in the same
 universe, to make an induction possible. Use instead `norm_iterated_fderiv_within_comp_le` that
 removes this assumption. -/
-theorem norm_iteratedFderivWithin_comp_le_aux {Fu Gu : Type u} [NormedAddCommGroup Fu]
+theorem norm_iteratedFDerivWithin_comp_le_aux {Fu Gu : Type u} [NormedAddCommGroup Fu]
     [NormedSpace π•œ Fu] [NormedAddCommGroup Gu] [NormedSpace π•œ Gu] {g : Fu β†’ Gu} {f : E β†’ Fu} {n : β„•}
     {s : Set E} {t : Set Fu} {x : E} (hg : ContDiffOn π•œ n g t) (hf : ContDiffOn π•œ n f s)
     (ht : UniqueDiffOn π•œ t) (hs : UniqueDiffOn π•œ s) (hst : MapsTo f s t) (hx : x ∈ s) {C : ℝ}
-    {D : ℝ} (hC : βˆ€ i, i ≀ n β†’ β€–iteratedFderivWithin π•œ i g t (f x)β€– ≀ C)
-    (hD : βˆ€ i, 1 ≀ i β†’ i ≀ n β†’ β€–iteratedFderivWithin π•œ i f s xβ€– ≀ D ^ i) :
-    β€–iteratedFderivWithin π•œ n (g ∘ f) s xβ€– ≀ n ! * C * D ^ n :=
+    {D : ℝ} (hC : βˆ€ i, i ≀ n β†’ β€–iteratedFDerivWithin π•œ i g t (f x)β€– ≀ C)
+    (hD : βˆ€ i, 1 ≀ i β†’ i ≀ n β†’ β€–iteratedFDerivWithin π•œ i f s xβ€– ≀ D ^ i) :
+    β€–iteratedFDerivWithin π•œ n (g ∘ f) s xβ€– ≀ n ! * C * D ^ n :=
   by
   /- We argue by induction on `n`, using that `D^(n+1) (g ∘ f) = D^n (g ' ∘ f ⬝ f')`. The successive
     derivatives of `g' ∘ f` are controlled thanks to the inductive assumption, and those of `f'` are
@@ -2795,7 +2795,7 @@ theorem norm_iteratedFderivWithin_comp_le_aux {Fu Gu : Type u} [NormedAddCommGro
     on `D^n (g ' ∘ f ⬝ f')`. -/
   induction' n using Nat.case_strong_induction_on with n IH generalizing Gu
   Β·
-    simpa only [norm_iteratedFderivWithin_zero, Nat.factorial_zero, algebraMap.coe_one, one_mul,
+    simpa only [norm_iteratedFDerivWithin_zero, Nat.factorial_zero, algebraMap.coe_one, one_mul,
       pow_zero, mul_one] using hC 0 le_rfl
   have M : (n : β„•βˆž) < n.succ := Nat.cast_lt.2 n.lt_succ_self
   have Cnonneg : 0 ≀ C := (norm_nonneg _).trans (hC 0 bot_le)
@@ -2806,7 +2806,7 @@ theorem norm_iteratedFderivWithin_comp_le_aux {Fu Gu : Type u} [NormedAddCommGro
   -- use the inductive assumption to bound the derivatives of `g' ∘ f`.
   have I :
     βˆ€ i ∈ Finset.range (n + 1),
-      β€–iteratedFderivWithin π•œ i (fderivWithin π•œ g t ∘ f) s xβ€– ≀ i ! * C * D ^ i :=
+      β€–iteratedFDerivWithin π•œ i (fderivWithin π•œ g t ∘ f) s xβ€– ≀ i ! * C * D ^ i :=
     by
     intro i hi
     simp only [Finset.mem_range_succ_iff] at hi
@@ -2819,37 +2819,37 @@ theorem norm_iteratedFderivWithin_comp_le_aux {Fu Gu : Type u} [NormedAddCommGro
       exact add_le_add_right (Nat.cast_le.2 hi) _
     Β· intro j hj
       have :
-        β€–iteratedFderivWithin π•œ j (fderivWithin π•œ g t) t (f x)β€– =
-          β€–iteratedFderivWithin π•œ (j + 1) g t (f x)β€– :=
-        by rw [iteratedFderivWithin_succ_eq_comp_right ht (hst hx), LinearIsometryEquiv.norm_map]
+        β€–iteratedFDerivWithin π•œ j (fderivWithin π•œ g t) t (f x)β€– =
+          β€–iteratedFDerivWithin π•œ (j + 1) g t (f x)β€– :=
+        by rw [iteratedFDerivWithin_succ_eq_comp_right ht (hst hx), LinearIsometryEquiv.norm_map]
       rw [this]
       exact hC (j + 1) (add_le_add (hj.trans hi) le_rfl)
   -- reformulate `hD` as a bound for the derivatives of `f'`.
-  have J : βˆ€ i, β€–iteratedFderivWithin π•œ (n - i) (fderivWithin π•œ f s) s xβ€– ≀ D ^ (n - i + 1) :=
+  have J : βˆ€ i, β€–iteratedFDerivWithin π•œ (n - i) (fderivWithin π•œ f s) s xβ€– ≀ D ^ (n - i + 1) :=
     by
     intro i
     have :
-      β€–iteratedFderivWithin π•œ (n - i) (fderivWithin π•œ f s) s xβ€– =
-        β€–iteratedFderivWithin π•œ (n - i + 1) f s xβ€– :=
-      by rw [iteratedFderivWithin_succ_eq_comp_right hs hx, LinearIsometryEquiv.norm_map]
+      β€–iteratedFDerivWithin π•œ (n - i) (fderivWithin π•œ f s) s xβ€– =
+        β€–iteratedFDerivWithin π•œ (n - i + 1) f s xβ€– :=
+      by rw [iteratedFDerivWithin_succ_eq_comp_right hs hx, LinearIsometryEquiv.norm_map]
     rw [this]
     apply hD
     Β· simp only [le_add_iff_nonneg_left, zero_le']
     Β· apply Nat.succ_le_succ tsub_le_self
   -- Now put these together: first, notice that we have to bound `D^n (g' ∘ f ⬝ f')`.
   calc
-    β€–iteratedFderivWithin π•œ (n + 1) (g ∘ f) s xβ€– =
-        β€–iteratedFderivWithin π•œ n (fun y : E => fderivWithin π•œ (g ∘ f) s y) s xβ€– :=
-      by rw [iteratedFderivWithin_succ_eq_comp_right hs hx, LinearIsometryEquiv.norm_map]
+    β€–iteratedFDerivWithin π•œ (n + 1) (g ∘ f) s xβ€– =
+        β€–iteratedFDerivWithin π•œ n (fun y : E => fderivWithin π•œ (g ∘ f) s y) s xβ€– :=
+      by rw [iteratedFDerivWithin_succ_eq_comp_right hs hx, LinearIsometryEquiv.norm_map]
     _ =
-        β€–iteratedFderivWithin π•œ n
+        β€–iteratedFDerivWithin π•œ n
             (fun y : E =>
               ContinuousLinearMap.compL π•œ E Fu Gu (fderivWithin π•œ g t (f y)) (fderivWithin π•œ f s y))
             s xβ€– :=
       by
       have L : (1 : β„•βˆž) ≀ n.succ := by simpa only [ENat.coe_one, Nat.one_le_cast] using n.succ_pos
       congr 1
-      refine' iteratedFderivWithin_congr (fun y hy => _) hx _
+      refine' iteratedFDerivWithin_congr (fun y hy => _) hx _
       apply fderivWithin.comp _ _ _ hst (hs y hy)
       Β· exact hg.differentiable_on L _ (hst hy)
       Β· exact hf.differentiable_on L _ hy
@@ -2857,8 +2857,8 @@ theorem norm_iteratedFderivWithin_comp_le_aux {Fu Gu : Type u} [NormedAddCommGro
         -- for which we have bounds for the`n`-th derivative.
         _ ≀
         βˆ‘ i in Finset.range (n + 1),
-          (n.choose i : ℝ) * β€–iteratedFderivWithin π•œ i (fderivWithin π•œ g t ∘ f) s xβ€– *
-            β€–iteratedFderivWithin π•œ (n - i) (fderivWithin π•œ f s) s xβ€– :=
+          (n.choose i : ℝ) * β€–iteratedFDerivWithin π•œ i (fderivWithin π•œ g t ∘ f) s xβ€– *
+            β€–iteratedFDerivWithin π•œ (n - i) (fderivWithin π•œ f s) s xβ€– :=
       by
       have A : ContDiffOn π•œ n (fderivWithin π•œ g t ∘ f) s :=
         by
@@ -2870,7 +2870,7 @@ theorem norm_iteratedFderivWithin_comp_le_aux {Fu Gu : Type u} [NormedAddCommGro
         apply hf.fderiv_within hs
         simp only [Nat.cast_succ, le_refl]
       exact
-        (ContinuousLinearMap.compL π•œ E Fu Gu).norm_iteratedFderivWithin_le_of_bilinear_of_le_one A B
+        (ContinuousLinearMap.compL π•œ E Fu Gu).norm_iteratedFDerivWithin_le_of_bilinear_of_le_one A B
           hs hx le_rfl (ContinuousLinearMap.norm_compL_le π•œ E Fu Gu)
     -- bound each of the terms using the estimates on previous derivatives (that use the inductive
         -- assumption for `g' ∘ f`).
@@ -2912,17 +2912,17 @@ theorem norm_iteratedFderivWithin_comp_le_aux {Fu Gu : Type u} [NormedAddCommGro
       simp only [mul_assoc, mul_one, Finset.sum_const, Finset.card_range, nsmul_eq_mul,
         Nat.factorial_succ, Nat.cast_mul]
     
-#align norm_iterated_fderiv_within_comp_le_aux norm_iteratedFderivWithin_comp_le_aux
+#align norm_iterated_fderiv_within_comp_le_aux norm_iteratedFDerivWithin_comp_le_aux
 
 /-- If the derivatives within a set of `g` at `f x` are bounded by `C`, and the `i`-th derivative
 within a set of `f` at `x` is bounded by `D^i` for all `1 ≀ i ≀ n`, then the `n`-th derivative
 of `g ∘ f` is bounded by `n! * C * D^n`. -/
-theorem norm_iteratedFderivWithin_comp_le {g : F β†’ G} {f : E β†’ F} {n : β„•} {s : Set E} {t : Set F}
+theorem norm_iteratedFDerivWithin_comp_le {g : F β†’ G} {f : E β†’ F} {n : β„•} {s : Set E} {t : Set F}
     {x : E} {N : β„•βˆž} (hg : ContDiffOn π•œ N g t) (hf : ContDiffOn π•œ N f s) (hn : (n : β„•βˆž) ≀ N)
     (ht : UniqueDiffOn π•œ t) (hs : UniqueDiffOn π•œ s) (hst : MapsTo f s t) (hx : x ∈ s) {C : ℝ}
-    {D : ℝ} (hC : βˆ€ i, i ≀ n β†’ β€–iteratedFderivWithin π•œ i g t (f x)β€– ≀ C)
-    (hD : βˆ€ i, 1 ≀ i β†’ i ≀ n β†’ β€–iteratedFderivWithin π•œ i f s xβ€– ≀ D ^ i) :
-    β€–iteratedFderivWithin π•œ n (g ∘ f) s xβ€– ≀ n ! * C * D ^ n :=
+    {D : ℝ} (hC : βˆ€ i, i ≀ n β†’ β€–iteratedFDerivWithin π•œ i g t (f x)β€– ≀ C)
+    (hD : βˆ€ i, 1 ≀ i β†’ i ≀ n β†’ β€–iteratedFDerivWithin π•œ i f s xβ€– ≀ D ^ i) :
+    β€–iteratedFDerivWithin π•œ n (g ∘ f) s xβ€– ≀ n ! * C * D ^ n :=
   by
   /- We reduce the bound to the case where all spaces live in the same universe (in which we
     already have proved the result), by using linear isometries between the spaces and their `ulift`
@@ -2945,53 +2945,53 @@ theorem norm_iteratedFderivWithin_comp_le {g : F β†’ G} {f : E β†’ F} {n : β„•}
   have hgu : ContDiffOn π•œ n gu tu :=
     isoG.symm.cont_diff.comp_cont_diff_on
       ((hg.of_le hn).compContinuousLinearMap (isoF : Fu β†’L[π•œ] F))
-  have Nfu : βˆ€ i, β€–iteratedFderivWithin π•œ i fu s xβ€– = β€–iteratedFderivWithin π•œ i f s xβ€– :=
+  have Nfu : βˆ€ i, β€–iteratedFDerivWithin π•œ i fu s xβ€– = β€–iteratedFDerivWithin π•œ i f s xβ€– :=
     by
     intro i
-    rw [LinearIsometryEquiv.norm_iteratedFderivWithin_comp_left _ _ hs hx]
+    rw [LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_left _ _ hs hx]
   simp_rw [← Nfu] at hD
-  have Ngu : βˆ€ i, β€–iteratedFderivWithin π•œ i gu tu (fu x)β€– = β€–iteratedFderivWithin π•œ i g t (f x)β€– :=
+  have Ngu : βˆ€ i, β€–iteratedFDerivWithin π•œ i gu tu (fu x)β€– = β€–iteratedFDerivWithin π•œ i g t (f x)β€– :=
     by
     intro i
-    rw [LinearIsometryEquiv.norm_iteratedFderivWithin_comp_left _ _ htu (hstu hx)]
-    rw [LinearIsometryEquiv.norm_iteratedFderivWithin_comp_right _ _ ht, Ffu]
+    rw [LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_left _ _ htu (hstu hx)]
+    rw [LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_right _ _ ht, Ffu]
     rw [Ffu]
     exact hst hx
   simp_rw [← Ngu] at hC
-  have Nfgu : β€–iteratedFderivWithin π•œ n (g ∘ f) s xβ€– = β€–iteratedFderivWithin π•œ n (gu ∘ fu) s xβ€– :=
+  have Nfgu : β€–iteratedFDerivWithin π•œ n (g ∘ f) s xβ€– = β€–iteratedFDerivWithin π•œ n (gu ∘ fu) s xβ€– :=
     by
     have : gu ∘ fu = isoG.symm ∘ g ∘ f := by
       ext x
       simp only [comp_app, LinearIsometryEquiv.map_eq_iff, LinearIsometryEquiv.apply_symm_apply]
-    rw [this, LinearIsometryEquiv.norm_iteratedFderivWithin_comp_left _ _ hs hx]
+    rw [this, LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_left _ _ hs hx]
   -- deduce the required bound from the one for `gu ∘ fu`.
   rw [Nfgu]
-  exact norm_iteratedFderivWithin_comp_le_aux hgu hfu htu hs hstu hx hC hD
-#align norm_iterated_fderiv_within_comp_le norm_iteratedFderivWithin_comp_le
+  exact norm_iteratedFDerivWithin_comp_le_aux hgu hfu htu hs hstu hx hC hD
+#align norm_iterated_fderiv_within_comp_le norm_iteratedFDerivWithin_comp_le
 
 /-- If the derivatives of `g` at `f x` are bounded by `C`, and the `i`-th derivative
 of `f` at `x` is bounded by `D^i` for all `1 ≀ i ≀ n`, then the `n`-th derivative
 of `g ∘ f` is bounded by `n! * C * D^n`. -/
-theorem norm_iteratedFderiv_comp_le {g : F β†’ G} {f : E β†’ F} {n : β„•} {N : β„•βˆž} (hg : ContDiff π•œ N g)
+theorem norm_iteratedFDeriv_comp_le {g : F β†’ G} {f : E β†’ F} {n : β„•} {N : β„•βˆž} (hg : ContDiff π•œ N g)
     (hf : ContDiff π•œ N f) (hn : (n : β„•βˆž) ≀ N) (x : E) {C : ℝ} {D : ℝ}
-    (hC : βˆ€ i, i ≀ n β†’ β€–iteratedFderiv π•œ i g (f x)β€– ≀ C)
-    (hD : βˆ€ i, 1 ≀ i β†’ i ≀ n β†’ β€–iteratedFderiv π•œ i f xβ€– ≀ D ^ i) :
-    β€–iteratedFderiv π•œ n (g ∘ f) xβ€– ≀ n ! * C * D ^ n :=
+    (hC : βˆ€ i, i ≀ n β†’ β€–iteratedFDeriv π•œ i g (f x)β€– ≀ C)
+    (hD : βˆ€ i, 1 ≀ i β†’ i ≀ n β†’ β€–iteratedFDeriv π•œ i f xβ€– ≀ D ^ i) :
+    β€–iteratedFDeriv π•œ n (g ∘ f) xβ€– ≀ n ! * C * D ^ n :=
   by
-  simp_rw [← iteratedFderivWithin_univ] at hC hD⊒
+  simp_rw [← iteratedFDerivWithin_univ] at hC hD⊒
   exact
-    norm_iteratedFderivWithin_comp_le hg.cont_diff_on hf.cont_diff_on hn uniqueDiffOn_univ
+    norm_iteratedFDerivWithin_comp_le hg.cont_diff_on hf.cont_diff_on hn uniqueDiffOn_univ
       uniqueDiffOn_univ (maps_to_univ _ _) (mem_univ x) hC hD
-#align norm_iterated_fderiv_comp_le norm_iteratedFderiv_comp_le
+#align norm_iterated_fderiv_comp_le norm_iteratedFDeriv_comp_le
 
 section Apply
 
-theorem norm_iteratedFderivWithin_clm_apply {f : E β†’ F β†’L[π•œ] G} {g : E β†’ F} {s : Set E} {x : E}
+theorem norm_iteratedFDerivWithin_clm_apply {f : E β†’ F β†’L[π•œ] G} {g : E β†’ F} {s : Set E} {x : E}
     {N : β„•βˆž} {n : β„•} (hf : ContDiffOn π•œ N f s) (hg : ContDiffOn π•œ N g s) (hs : UniqueDiffOn π•œ s)
     (hx : x ∈ s) (hn : ↑n ≀ N) :
-    β€–iteratedFderivWithin π•œ n (fun y => (f y) (g y)) s xβ€– ≀
+    β€–iteratedFDerivWithin π•œ n (fun y => (f y) (g y)) s xβ€– ≀
       (Finset.range (n + 1)).Sum fun i =>
-        ↑(n.choose i) * β€–iteratedFderivWithin π•œ i f s xβ€– * β€–iteratedFderivWithin π•œ (n - i) g s xβ€– :=
+        ↑(n.choose i) * β€–iteratedFDerivWithin π•œ i f s xβ€– * β€–iteratedFDerivWithin π•œ (n - i) g s xβ€– :=
   by
   let B : (F β†’L[π•œ] G) β†’L[π•œ] F β†’L[π•œ] G := ContinuousLinearMap.flip (ContinuousLinearMap.apply π•œ G)
   have hB : β€–Bβ€– ≀ 1 :=
@@ -3000,42 +3000,42 @@ theorem norm_iteratedFderivWithin_clm_apply {f : E β†’ F β†’L[π•œ] G} {g : E 
     refine' ContinuousLinearMap.op_norm_le_bound _ zero_le_one fun f => _
     simp only [ContinuousLinearMap.coe_id', id.def, one_mul]
   exact B.norm_iterated_fderiv_within_le_of_bilinear_of_le_one hf hg hs hx hn hB
-#align norm_iterated_fderiv_within_clm_apply norm_iteratedFderivWithin_clm_apply
+#align norm_iterated_fderiv_within_clm_apply norm_iteratedFDerivWithin_clm_apply
 
-theorem norm_iteratedFderiv_clm_apply {f : E β†’ F β†’L[π•œ] G} {g : E β†’ F} {N : β„•βˆž} {n : β„•}
+theorem norm_iteratedFDeriv_clm_apply {f : E β†’ F β†’L[π•œ] G} {g : E β†’ F} {N : β„•βˆž} {n : β„•}
     (hf : ContDiff π•œ N f) (hg : ContDiff π•œ N g) (x : E) (hn : ↑n ≀ N) :
-    β€–iteratedFderiv π•œ n (fun y : E => (f y) (g y)) xβ€– ≀
+    β€–iteratedFDeriv π•œ n (fun y : E => (f y) (g y)) xβ€– ≀
       (Finset.range (n + 1)).Sum fun i : β„• =>
-        ↑(n.choose i) * β€–iteratedFderiv π•œ i f xβ€– * β€–iteratedFderiv π•œ (n - i) g xβ€– :=
+        ↑(n.choose i) * β€–iteratedFDeriv π•œ i f xβ€– * β€–iteratedFDeriv π•œ (n - i) g xβ€– :=
   by
-  simp only [← iteratedFderivWithin_univ]
+  simp only [← iteratedFDerivWithin_univ]
   exact
-    norm_iteratedFderivWithin_clm_apply hf.cont_diff_on hg.cont_diff_on uniqueDiffOn_univ
+    norm_iteratedFDerivWithin_clm_apply hf.cont_diff_on hg.cont_diff_on uniqueDiffOn_univ
       (Set.mem_univ x) hn
-#align norm_iterated_fderiv_clm_apply norm_iteratedFderiv_clm_apply
+#align norm_iterated_fderiv_clm_apply norm_iteratedFDeriv_clm_apply
 
-theorem norm_iteratedFderivWithin_clm_apply_const {f : E β†’ F β†’L[π•œ] G} {c : F} {s : Set E} {x : E}
+theorem norm_iteratedFDerivWithin_clm_apply_const {f : E β†’ F β†’L[π•œ] G} {c : F} {s : Set E} {x : E}
     {N : β„•βˆž} {n : β„•} (hf : ContDiffOn π•œ N f s) (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) (hn : ↑n ≀ N) :
-    β€–iteratedFderivWithin π•œ n (fun y : E => (f y) c) s xβ€– ≀
-      β€–cβ€– * β€–iteratedFderivWithin π•œ n f s xβ€– :=
+    β€–iteratedFDerivWithin π•œ n (fun y : E => (f y) c) s xβ€– ≀
+      β€–cβ€– * β€–iteratedFDerivWithin π•œ n f s xβ€– :=
   by
   let g : (F β†’L[π•œ] G) β†’L[π•œ] G := ContinuousLinearMap.apply π•œ G c
-  have h := g.norm_comp_continuous_multilinear_map_le (iteratedFderivWithin π•œ n f s x)
+  have h := g.norm_comp_continuous_multilinear_map_le (iteratedFDerivWithin π•œ n f s x)
   rw [← g.iterated_fderiv_within_comp_left hf hs hx hn] at h
   refine' h.trans (mul_le_mul_of_nonneg_right _ (norm_nonneg _))
   refine' g.op_norm_le_bound (norm_nonneg _) fun f => _
   rw [ContinuousLinearMap.apply_apply, mul_comm]
   exact f.le_op_norm c
-#align norm_iterated_fderiv_within_clm_apply_const norm_iteratedFderivWithin_clm_apply_const
+#align norm_iterated_fderiv_within_clm_apply_const norm_iteratedFDerivWithin_clm_apply_const
 
-theorem norm_iteratedFderiv_clm_apply_const {f : E β†’ F β†’L[π•œ] G} {c : F} {x : E} {N : β„•βˆž} {n : β„•}
+theorem norm_iteratedFDeriv_clm_apply_const {f : E β†’ F β†’L[π•œ] G} {c : F} {x : E} {N : β„•βˆž} {n : β„•}
     (hf : ContDiff π•œ N f) (hn : ↑n ≀ N) :
-    β€–iteratedFderiv π•œ n (fun y : E => (f y) c) xβ€– ≀ β€–cβ€– * β€–iteratedFderiv π•œ n f xβ€– :=
+    β€–iteratedFDeriv π•œ n (fun y : E => (f y) c) xβ€– ≀ β€–cβ€– * β€–iteratedFDeriv π•œ n f xβ€– :=
   by
-  simp only [← iteratedFderivWithin_univ]
+  simp only [← iteratedFDerivWithin_univ]
   refine'
-    norm_iteratedFderivWithin_clm_apply_const hf.cont_diff_on uniqueDiffOn_univ (Set.mem_univ x) hn
-#align norm_iterated_fderiv_clm_apply_const norm_iteratedFderiv_clm_apply_const
+    norm_iteratedFDerivWithin_clm_apply_const hf.cont_diff_on uniqueDiffOn_univ (Set.mem_univ x) hn
+#align norm_iterated_fderiv_clm_apply_const norm_iteratedFDeriv_clm_apply_const
 
 end Apply
 
Diff
@@ -44,7 +44,7 @@ derivative, differentiability, higher derivative, `C^n`, multilinear, Taylor ser
 
 noncomputable section
 
-open Classical BigOperators NNReal Nat
+open scoped Classical BigOperators NNReal Nat
 
 -- mathport name: «expr∞»
 local notation "∞" => (⊀ : β„•βˆž)
@@ -116,7 +116,7 @@ end Finset
 
 open Set Fin Filter Function
 
-open Topology
+open scoped Topology
 
 variable {π•œ : Type _} [NontriviallyNormedField π•œ] {D : Type uD} [NormedAddCommGroup D]
   [NormedSpace π•œ D] {E : Type uE} [NormedAddCommGroup E] [NormedSpace π•œ E] {F : Type uF}
Diff
@@ -131,8 +131,7 @@ variable {π•œ : Type _} [NontriviallyNormedField π•œ] {D : Type uD} [NormedAdd
 theorem iteratedFderiv_zero_fun {n : β„•} : (iteratedFderiv π•œ n fun x : E => (0 : F)) = 0 :=
   by
   induction' n with n IH
-  Β· ext m
-    simp
+  Β· ext m; simp
   Β· ext (x m)
     rw [iteratedFderiv_succ_apply_left, IH]
     change (fderiv π•œ (fun x : E => (0 : E[Γ—n]β†’L[π•œ] F)) x : E β†’ E[Γ—n]β†’L[π•œ] F) (m 0) (tail m) = _
@@ -171,31 +170,23 @@ theorem contDiffWithinAt_const {c : F} : ContDiffWithinAt π•œ n (fun x : E => c
 #align cont_diff_within_at_const contDiffWithinAt_const
 
 @[nontriviality]
-theorem contDiff_of_subsingleton [Subsingleton F] : ContDiff π•œ n f :=
-  by
-  rw [Subsingleton.elim f fun _ => 0]
-  exact contDiff_const
+theorem contDiff_of_subsingleton [Subsingleton F] : ContDiff π•œ n f := by
+  rw [Subsingleton.elim f fun _ => 0]; exact contDiff_const
 #align cont_diff_of_subsingleton contDiff_of_subsingleton
 
 @[nontriviality]
-theorem contDiffAt_of_subsingleton [Subsingleton F] : ContDiffAt π•œ n f x :=
-  by
-  rw [Subsingleton.elim f fun _ => 0]
-  exact contDiffAt_const
+theorem contDiffAt_of_subsingleton [Subsingleton F] : ContDiffAt π•œ n f x := by
+  rw [Subsingleton.elim f fun _ => 0]; exact contDiffAt_const
 #align cont_diff_at_of_subsingleton contDiffAt_of_subsingleton
 
 @[nontriviality]
-theorem contDiffWithinAt_of_subsingleton [Subsingleton F] : ContDiffWithinAt π•œ n f s x :=
-  by
-  rw [Subsingleton.elim f fun _ => 0]
-  exact contDiffWithinAt_const
+theorem contDiffWithinAt_of_subsingleton [Subsingleton F] : ContDiffWithinAt π•œ n f s x := by
+  rw [Subsingleton.elim f fun _ => 0]; exact contDiffWithinAt_const
 #align cont_diff_within_at_of_subsingleton contDiffWithinAt_of_subsingleton
 
 @[nontriviality]
-theorem contDiffOn_of_subsingleton [Subsingleton F] : ContDiffOn π•œ n f s :=
-  by
-  rw [Subsingleton.elim f fun _ => 0]
-  exact contDiffOn_const
+theorem contDiffOn_of_subsingleton [Subsingleton F] : ContDiffOn π•œ n f s := by
+  rw [Subsingleton.elim f fun _ => 0]; exact contDiffOn_const
 #align cont_diff_on_of_subsingleton contDiffOn_of_subsingleton
 
 theorem iteratedFderiv_succ_const (n : β„•) (c : F) : (iteratedFderiv π•œ (n + 1) fun y : E => c) = 0 :=
@@ -601,14 +592,9 @@ theorem ContinuousLinearEquiv.contDiffOn_comp_iff (e : G ≃L[π•œ] E) :
     ContDiffOn π•œ n (f ∘ e) (e ⁻¹' s) ↔ ContDiffOn π•œ n f s :=
   by
   refine' ⟨fun H => _, fun H => H.compContinuousLinearMap (e : G β†’L[π•œ] E)⟩
-  have A : f = (f ∘ e) ∘ e.symm := by
-    ext y
-    simp only [Function.comp_apply]
+  have A : f = (f ∘ e) ∘ e.symm := by ext y; simp only [Function.comp_apply];
     rw [e.apply_symm_apply y]
-  have B : e.symm ⁻¹' (e ⁻¹' s) = s :=
-    by
-    rw [← preimage_comp, e.self_comp_symm]
-    rfl
+  have B : e.symm ⁻¹' (e ⁻¹' s) = s := by rw [← preimage_comp, e.self_comp_symm]; rfl
   rw [A, ← B]
   exact H.comp_continuous_linear_map (e.symm : E β†’L[π•œ] G)
 #align continuous_linear_equiv.cont_diff_on_comp_iff ContinuousLinearEquiv.contDiffOn_comp_iff
@@ -629,9 +615,7 @@ theorem HasFtaylorSeriesUpToOn.prod (hf : HasFtaylorSeriesUpToOn n f p s) {g : E
   by
   set L := fun m => ContinuousMultilinearMap.prodL π•œ (fun i : Fin m => E) F G
   constructor
-  Β· intro x hx
-    rw [← hf.zero_eq x hx, ← hg.zero_eq x hx]
-    rfl
+  Β· intro x hx; rw [← hf.zero_eq x hx, ← hg.zero_eq x hx]; rfl
   Β· intro m hm x hx
     convert(L m).HasFDerivAt.comp_hasFDerivWithinAt x
         ((hf.fderiv_within m hm x hx).Prod (hg.fderiv_within m hm x hx))
@@ -1286,8 +1270,7 @@ theorem hasFtaylorSeriesUpToOn_pi :
     ContinuousMultilinearMap.piβ‚—α΅’ _ _
   refine' ⟨fun h i => _, fun h => ⟨fun x hx => _, _, _⟩⟩
   Β· convert h.continuous_linear_map_comp (pr i)
-    ext
-    rfl
+    ext; rfl
   Β· ext1 i
     exact (h i).zero_eq x hx
   Β· intro m hm x hx
@@ -1306,10 +1289,7 @@ theorem hasFtaylorSeriesUpToOn_pi' :
           (fun x m =>
             (@ContinuousLinearMap.proj π•œ _ ΞΉ F' _ _ _ i).compContinuousMultilinearMap (P' x m))
           s :=
-  by
-  convert hasFtaylorSeriesUpToOn_pi
-  ext
-  rfl
+  by convert hasFtaylorSeriesUpToOn_pi; ext; rfl
 #align has_ftaylor_series_up_to_on_pi' hasFtaylorSeriesUpToOn_pi'
 
 theorem contDiffWithinAt_pi :
@@ -1396,8 +1376,7 @@ theorem iteratedFderivWithin_add_apply {f g : E β†’ F} (hf : ContDiffOn π•œ i f
       iteratedFderivWithin π•œ i f s x + iteratedFderivWithin π•œ i g s x :=
   by
   induction' i with i hi generalizing x
-  Β· ext h
-    simp
+  Β· ext h; simp
   Β· ext h
     have hi' : (i : β„•βˆž) < i + 1 := with_top.coe_lt_coe.mpr (Nat.lt_succ_self _)
     have hdf : DifferentiableOn π•œ (iteratedFderivWithin π•œ i f s) s :=
@@ -1413,16 +1392,12 @@ theorem iteratedFderivWithin_add_apply {f g : E β†’ F} (hf : ContDiffOn π•œ i f
       _ =
           fderivWithin π•œ (iteratedFderivWithin π•œ i f s + iteratedFderivWithin π•œ i g s) s x (h 0)
             (Fin.tail h) :=
-        by
-        rw [fderivWithin_congr' (fun _ => hi hcdf hcdg) hx]
-        rfl
+        by rw [fderivWithin_congr' (fun _ => hi hcdf hcdg) hx]; rfl
       _ =
           (fderivWithin π•œ (iteratedFderivWithin π•œ i f s) s +
               fderivWithin π•œ (iteratedFderivWithin π•œ i g s) s)
             x (h 0) (Fin.tail h) :=
-        by
-        rw [Pi.add_def, fderivWithin_add (hu x hx) (hdf x hx) (hdg x hx)]
-        rfl
+        by rw [Pi.add_def, fderivWithin_add (hu x hx) (hdf x hx) (hdg x hx)]; rfl
       _ = (iteratedFderivWithin π•œ (i + 1) f s + iteratedFderivWithin π•œ (i + 1) g s) x h := rfl
       
 #align iterated_fderiv_within_add_apply iteratedFderivWithin_add_apply
@@ -1491,22 +1466,17 @@ theorem iteratedFderivWithin_neg_apply {f : E β†’ F} (hu : UniqueDiffOn π•œ s)
     iteratedFderivWithin π•œ i (-f) s x = -iteratedFderivWithin π•œ i f s x :=
   by
   induction' i with i hi generalizing x
-  Β· ext h
-    simp
+  Β· ext h; simp
   Β· ext h
     have hi' : (i : β„•βˆž) < i + 1 := with_top.coe_lt_coe.mpr (Nat.lt_succ_self _)
     calc
       iteratedFderivWithin π•œ (i + 1) (-f) s x h =
           fderivWithin π•œ (iteratedFderivWithin π•œ i (-f) s) s x (h 0) (Fin.tail h) :=
         rfl
-      _ = fderivWithin π•œ (-iteratedFderivWithin π•œ i f s) s x (h 0) (Fin.tail h) :=
-        by
-        rw [fderivWithin_congr' (@hi) hx]
-        rfl
-      _ = -(fderivWithin π•œ (iteratedFderivWithin π•œ i f s) s) x (h 0) (Fin.tail h) :=
-        by
-        rw [Pi.neg_def, fderivWithin_neg (hu x hx)]
-        rfl
+      _ = fderivWithin π•œ (-iteratedFderivWithin π•œ i f s) s x (h 0) (Fin.tail h) := by
+        rw [fderivWithin_congr' (@hi) hx]; rfl
+      _ = -(fderivWithin π•œ (iteratedFderivWithin π•œ i f s) s) x (h 0) (Fin.tail h) := by
+        rw [Pi.neg_def, fderivWithin_neg (hu x hx)]; rfl
       _ = -(iteratedFderivWithin π•œ (i + 1) f s) x h := rfl
       
 #align iterated_fderiv_within_neg_apply iteratedFderivWithin_neg_apply
@@ -1776,8 +1746,7 @@ theorem iteratedFderivWithin_const_smul_apply (hf : ContDiffOn π•œ i f s) (hu :
     (hx : x ∈ s) : iteratedFderivWithin π•œ i (a β€’ f) s x = a β€’ iteratedFderivWithin π•œ i f s x :=
   by
   induction' i with i hi generalizing x
-  Β· ext
-    simp
+  Β· ext; simp
   Β· ext h
     have hi' : (i : β„•βˆž) < i + 1 := with_top.coe_lt_coe.mpr (Nat.lt_succ_self _)
     have hdf : DifferentiableOn π•œ (iteratedFderivWithin π•œ i f s) s :=
@@ -1787,14 +1756,10 @@ theorem iteratedFderivWithin_const_smul_apply (hf : ContDiffOn π•œ i f s) (hu :
       iteratedFderivWithin π•œ (i + 1) (a β€’ f) s x h =
           fderivWithin π•œ (iteratedFderivWithin π•œ i (a β€’ f) s) s x (h 0) (Fin.tail h) :=
         rfl
-      _ = fderivWithin π•œ (a β€’ iteratedFderivWithin π•œ i f s) s x (h 0) (Fin.tail h) :=
-        by
-        rw [fderivWithin_congr' (fun _ => hi hcdf) hx]
-        rfl
-      _ = (a β€’ fderivWithin π•œ (iteratedFderivWithin π•œ i f s)) s x (h 0) (Fin.tail h) :=
-        by
-        rw [Pi.smul_def, fderivWithin_const_smul (hu x hx) (hdf x hx)]
-        rfl
+      _ = fderivWithin π•œ (a β€’ iteratedFderivWithin π•œ i f s) s x (h 0) (Fin.tail h) := by
+        rw [fderivWithin_congr' (fun _ => hi hcdf) hx]; rfl
+      _ = (a β€’ fderivWithin π•œ (iteratedFderivWithin π•œ i f s)) s x (h 0) (Fin.tail h) := by
+        rw [Pi.smul_def, fderivWithin_const_smul (hu x hx) (hdf x hx)]; rfl
       _ = a β€’ iteratedFderivWithin π•œ (i + 1) f s x h := rfl
       
 #align iterated_fderiv_within_const_smul_apply iteratedFderivWithin_const_smul_apply
@@ -1947,9 +1912,7 @@ theorem ContDiffAt.inv {f : E β†’ π•œ'} {n} (hf : ContDiffAt π•œ n f x) (hx :
 #align cont_diff_at.inv ContDiffAt.inv
 
 theorem ContDiff.inv {f : E β†’ π•œ'} {n} (hf : ContDiff π•œ n f) (h : βˆ€ x, f x β‰  0) :
-    ContDiff π•œ n fun x => (f x)⁻¹ :=
-  by
-  rw [contDiff_iff_contDiffAt]
+    ContDiff π•œ n fun x => (f x)⁻¹ := by rw [contDiff_iff_contDiffAt];
   exact fun x => hf.cont_diff_at.inv (h x)
 #align cont_diff.inv ContDiff.inv
 
@@ -2247,8 +2210,7 @@ theorem HasFtaylorSeriesUpToOn.exists_lipschitzOnWith_of_nnnorm_lt {E F : Type _
   have hcont : ContinuousWithinAt f' s x :=
     (continuousMultilinearCurryFin1 ℝ E F).ContinuousAt.comp_continuousWithinAt
       ((hf.cont _ le_rfl _ (mem_insert _ _)).mono (subset_insert x s))
-  replace hK : β€–f' xβ€–β‚Š < K
-  Β· simpa only [LinearIsometryEquiv.nnnorm_map]
+  replace hK : β€–f' xβ€–β‚Š < K; Β· simpa only [LinearIsometryEquiv.nnnorm_map]
   exact
     hs.exists_nhds_within_lipschitz_on_with_of_has_fderiv_within_at_of_nnnorm_lt
       (eventually_nhdsWithin_iff.2 <| eventually_of_forall hder) hcont K hK
@@ -2322,17 +2284,12 @@ theorem contDiffOn_succ_iff_derivWithin {n : β„•} (hs : UniqueDiffOn π•œ sβ‚‚)
   congr 2
   apply le_antisymm
   Β· intro h
-    have : derivWithin fβ‚‚ sβ‚‚ = (fun u : π•œ β†’L[π•œ] F => u 1) ∘ fderivWithin π•œ fβ‚‚ sβ‚‚ :=
-      by
-      ext x
-      rfl
+    have : derivWithin fβ‚‚ sβ‚‚ = (fun u : π•œ β†’L[π•œ] F => u 1) ∘ fderivWithin π•œ fβ‚‚ sβ‚‚ := by ext x; rfl
     simp only [this]
     apply ContDiff.comp_contDiffOn _ h
     exact (is_bounded_bilinear_map_apply.is_bounded_linear_map_left _).ContDiff
   Β· intro h
-    have : fderivWithin π•œ fβ‚‚ sβ‚‚ = smul_right (1 : π•œ β†’L[π•œ] π•œ) ∘ derivWithin fβ‚‚ sβ‚‚ :=
-      by
-      ext x
+    have : fderivWithin π•œ fβ‚‚ sβ‚‚ = smul_right (1 : π•œ β†’L[π•œ] π•œ) ∘ derivWithin fβ‚‚ sβ‚‚ := by ext x;
       simp [derivWithin]
     simp only [this]
     apply ContDiff.comp_contDiffOn _ h
@@ -2639,7 +2596,7 @@ theorem ContinuousLinearMap.norm_iteratedFderivWithin_le_of_bilinear (B : E β†’L
   -- lift the bilinear map `B` to a bilinear map `Bu` on the lifted spaces.
   let Buβ‚€ : Eu β†’L[π•œ] Fu β†’L[π•œ] G
   exact ((B.comp (isoE : Eu β†’L[π•œ] E)).flip.comp (isoF : Fu β†’L[π•œ] F)).flip
-  let Bu : Eu β†’L[π•œ] Fu β†’L[π•œ] Gu
+  let Bu : Eu β†’L[π•œ] Fu β†’L[π•œ] Gu;
   exact
     ContinuousLinearMap.compL π•œ Eu (Fu β†’L[π•œ] G) (Fu β†’L[π•œ] Gu)
       (ContinuousLinearMap.compL π•œ Fu G Gu (isoG.symm : G β†’L[π•œ] Gu)) Buβ‚€
Diff
@@ -4,11 +4,12 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: SΓ©bastien GouΓ«zel, Floris van Doorn
 
 ! This file was ported from Lean 3 source module analysis.calculus.cont_diff
-! leanprover-community/mathlib commit 3a69562db5a458db8322b190ec8d9a8bbd8a5b14
+! leanprover-community/mathlib commit 3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
 import Mathbin.Analysis.Calculus.ContDiffDef
+import Mathbin.Analysis.Calculus.Deriv.Inverse
 import Mathbin.Analysis.Calculus.MeanValue
 import Mathbin.Analysis.NormedSpace.FiniteDimension
 import Mathbin.Data.Nat.Choose.Cast
@@ -742,7 +743,6 @@ private theorem cont_diff_on.comp_same_univ {Eu : Type u} [NormedAddCommGroup Eu
       exact IH D C (subset_univ _)
   · rw [contDiffOn_top] at hf hg⊒
     exact fun n => Itop n (hg n) (hf n) st
-#align cont_diff_on.comp_same_univ cont_diff_on.comp_same_univ
 
 /-- The composition of `C^n` functions on domains is `C^n`. -/
 theorem ContDiffOn.comp {s : Set E} {t : Set F} {g : F β†’ G} {f : E β†’ F} (hg : ContDiffOn π•œ n g t)
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: SΓ©bastien GouΓ«zel, Floris van Doorn
 
 ! This file was ported from Lean 3 source module analysis.calculus.cont_diff
-! leanprover-community/mathlib commit 066ecdb4834c7a4693e0f0e5154935a6f3d3f90c
+! leanprover-community/mathlib commit 3a69562db5a458db8322b190ec8d9a8bbd8a5b14
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -355,7 +355,7 @@ theorem ContinuousLinearEquiv.iteratedFderivWithin_comp_left (g : F ≃L[π•œ] G
             g.comp_continuous_multilinear_mapL (fun j : Fin i => E)
               (iteratedFderivWithin π•œ i f s y))
           s x :=
-      fderivWithin_congr' (hs x hx) (fun y hy => IH hy) hx
+      fderivWithin_congr' (@IH) hx
     simp_rw [Z]
     rw [(g.comp_continuous_multilinear_mapL fun j : Fin i => E).comp_fderivWithin (hs x hx)]
     simp only [ContinuousLinearMap.coe_comp', ContinuousLinearEquiv.coe_coe, comp_app,
@@ -527,7 +527,7 @@ theorem ContinuousLinearEquiv.iteratedFderivWithin_comp_right (g : G ≃L[π•œ]
             ContinuousMultilinearMap.compContinuousLinearMapEquivL _ (fun _x : Fin i => g)
               (iteratedFderivWithin π•œ i f s (g y)))
           (g ⁻¹' s) x :=
-      fderivWithin_congr' (g.unique_diff_on_preimage_iff.2 hs x hx) (fun y hy => IH hy) hx
+      fderivWithin_congr' (@IH) hx
     rw [this]
     rw [ContinuousLinearEquiv.comp_fderivWithin _ (g.unique_diff_on_preimage_iff.2 hs x hx)]
     simp only [ContinuousLinearMap.coe_comp', ContinuousLinearEquiv.coe_coe, comp_app,
@@ -1414,13 +1414,15 @@ theorem iteratedFderivWithin_add_apply {f g : E β†’ F} (hf : ContDiffOn π•œ i f
           fderivWithin π•œ (iteratedFderivWithin π•œ i f s + iteratedFderivWithin π•œ i g s) s x (h 0)
             (Fin.tail h) :=
         by
-        congr 2
-        exact fderivWithin_congr (hu x hx) (fun _ => hi hcdf hcdg) (hi hcdf hcdg hx)
+        rw [fderivWithin_congr' (fun _ => hi hcdf hcdg) hx]
+        rfl
       _ =
           (fderivWithin π•œ (iteratedFderivWithin π•œ i f s) s +
               fderivWithin π•œ (iteratedFderivWithin π•œ i g s) s)
             x (h 0) (Fin.tail h) :=
-        by rw [Pi.add_def, fderivWithin_add (hu x hx) (hdf x hx) (hdg x hx)] <;> rfl
+        by
+        rw [Pi.add_def, fderivWithin_add (hu x hx) (hdf x hx) (hdg x hx)]
+        rfl
       _ = (iteratedFderivWithin π•œ (i + 1) f s + iteratedFderivWithin π•œ (i + 1) g s) x h := rfl
       
 #align iterated_fderiv_within_add_apply iteratedFderivWithin_add_apply
@@ -1499,10 +1501,12 @@ theorem iteratedFderivWithin_neg_apply {f : E β†’ F} (hu : UniqueDiffOn π•œ s)
         rfl
       _ = fderivWithin π•œ (-iteratedFderivWithin π•œ i f s) s x (h 0) (Fin.tail h) :=
         by
-        congr 2
-        exact fderivWithin_congr (hu x hx) (fun _ => hi) (hi hx)
-      _ = -(fderivWithin π•œ (iteratedFderivWithin π•œ i f s) s) x (h 0) (Fin.tail h) := by
-        rw [Pi.neg_def, fderivWithin_neg (hu x hx)] <;> rfl
+        rw [fderivWithin_congr' (@hi) hx]
+        rfl
+      _ = -(fderivWithin π•œ (iteratedFderivWithin π•œ i f s) s) x (h 0) (Fin.tail h) :=
+        by
+        rw [Pi.neg_def, fderivWithin_neg (hu x hx)]
+        rfl
       _ = -(iteratedFderivWithin π•œ (i + 1) f s) x h := rfl
       
 #align iterated_fderiv_within_neg_apply iteratedFderivWithin_neg_apply
@@ -1785,10 +1789,12 @@ theorem iteratedFderivWithin_const_smul_apply (hf : ContDiffOn π•œ i f s) (hu :
         rfl
       _ = fderivWithin π•œ (a β€’ iteratedFderivWithin π•œ i f s) s x (h 0) (Fin.tail h) :=
         by
-        congr 2
-        exact fderivWithin_congr (hu x hx) (fun _ => hi hcdf) (hi hcdf hx)
-      _ = (a β€’ fderivWithin π•œ (iteratedFderivWithin π•œ i f s)) s x (h 0) (Fin.tail h) := by
-        rw [Pi.smul_def, fderivWithin_const_smul (hu x hx) (hdf x hx)] <;> rfl
+        rw [fderivWithin_congr' (fun _ => hi hcdf) hx]
+        rfl
+      _ = (a β€’ fderivWithin π•œ (iteratedFderivWithin π•œ i f s)) s x (h 0) (Fin.tail h) :=
+        by
+        rw [Pi.smul_def, fderivWithin_const_smul (hu x hx) (hdf x hx)]
+        rfl
       _ = a β€’ iteratedFderivWithin π•œ (i + 1) f s x h := rfl
       
 #align iterated_fderiv_within_const_smul_apply iteratedFderivWithin_const_smul_apply
@@ -2582,7 +2588,7 @@ theorem ContinuousLinearMap.norm_iteratedFderivWithin_le_of_bilinear_aux {Du Eu
             B.precompR Du (f y) (fderivWithin π•œ g s y) + B.precompL Du (fderivWithin π•œ f s y) (g y))
           s x :=
       by
-      apply iteratedFderivWithin_congr hs (fun y hy => _) hx
+      apply iteratedFderivWithin_congr (fun y hy => _) hx
       have L : (1 : β„•βˆž) ≀ n.succ := by
         simpa only [ENat.coe_one, Nat.one_le_cast] using Nat.succ_pos n
       exact
@@ -2886,7 +2892,7 @@ theorem norm_iteratedFderivWithin_comp_le_aux {Fu Gu : Type u} [NormedAddCommGro
       by
       have L : (1 : β„•βˆž) ≀ n.succ := by simpa only [ENat.coe_one, Nat.one_le_cast] using n.succ_pos
       congr 1
-      apply iteratedFderivWithin_congr hs (fun y hy => _) hx
+      refine' iteratedFderivWithin_congr (fun y hy => _) hx _
       apply fderivWithin.comp _ _ _ hst (hs y hy)
       Β· exact hg.differentiable_on L _ (hst hy)
       Β· exact hf.differentiable_on L _ hy
Diff
@@ -281,7 +281,7 @@ theorem HasFtaylorSeriesUpToOn.continuousLinearMapComp (g : F β†’L[π•œ] G)
   constructor
   Β· exact fun x hx => congr_arg g (hf.zero_eq x hx)
   Β· intro m hm x hx
-    convert(L m).HasFderivAt.comp_hasFderivWithinAt x (hf.fderiv_within m hm x hx)
+    convert(L m).HasFDerivAt.comp_hasFDerivWithinAt x (hf.fderiv_within m hm x hx)
   Β· intro m hm
     convert(L m).Continuous.comp_continuousOn (hf.cont m hm)
 #align has_ftaylor_series_up_to_on.continuous_linear_map_comp HasFtaylorSeriesUpToOn.continuousLinearMapComp
@@ -458,7 +458,7 @@ theorem HasFtaylorSeriesUpToOn.compContinuousLinearMap (hf : HasFtaylorSeriesUpT
     rw [ContinuousLinearMap.map_zero]
     rfl
   Β· intro m hm x hx
-    convert(hA m).HasFderivAt.comp_hasFderivWithinAt x
+    convert(hA m).HasFDerivAt.comp_hasFDerivWithinAt x
         ((hf.fderiv_within m hm (g x) hx).comp x g.has_fderiv_within_at (subset.refl _))
     ext (y v)
     change p (g x) (Nat.succ m) (g ∘ cons y v) = p (g x) m.succ (cons (g y) (g ∘ v))
@@ -632,7 +632,7 @@ theorem HasFtaylorSeriesUpToOn.prod (hf : HasFtaylorSeriesUpToOn n f p s) {g : E
     rw [← hf.zero_eq x hx, ← hg.zero_eq x hx]
     rfl
   Β· intro m hm x hx
-    convert(L m).HasFderivAt.comp_hasFderivWithinAt x
+    convert(L m).HasFDerivAt.comp_hasFDerivWithinAt x
         ((hf.fderiv_within m hm x hx).Prod (hg.fderiv_within m hm x hx))
   Β· intro m hm
     exact (L m).Continuous.comp_continuousOn ((hf.cont m hm).Prod (hg.cont m hm))
@@ -710,9 +710,9 @@ private theorem cont_diff_on.comp_same_univ {Eu : Type u} [NormedAddCommGroup Eu
   induction' n using ENat.nat_induction with n IH Itop generalizing Eu Fu Gu
   · rw [contDiffOn_zero] at hf hg⊒
     exact ContinuousOn.comp hg hf st
-  · rw [contDiffOn_succ_iff_hasFderivWithinAt] at hg⊒
+  · rw [contDiffOn_succ_iff_hasFDerivWithinAt] at hg⊒
     intro x hx
-    rcases(contDiffOn_succ_iff_hasFderivWithinAt.1 hf) x hx with ⟨u, hu, f', hf', f'_diff⟩
+    rcases(contDiffOn_succ_iff_hasFDerivWithinAt.1 hf) x hx with ⟨u, hu, f', hf', f'_diff⟩
     rcases hg (f x) (st hx) with ⟨v, hv, g', hg', g'_diff⟩
     rw [insert_eq_of_mem hx] at hu⊒
     have xu : x ∈ u := mem_of_mem_nhdsWithin hx hu
@@ -729,7 +729,7 @@ private theorem cont_diff_on.comp_same_univ {Eu : Type u} [NormedAddCommGroup Eu
         exact (hf' x xu).DifferentiableWithinAt.ContinuousWithinAt.mono (inter_subset_right _ _)
       Β· apply nhdsWithin_mono _ _ hv
         exact subset.trans (image_subset_iff.mpr st) (subset_insert (f x) t)
-    show βˆ€ y ∈ w, HasFderivWithinAt (g ∘ f) ((g' (f y)).comp (f' y)) w y
+    show βˆ€ y ∈ w, HasFDerivWithinAt (g ∘ f) ((g' (f y)).comp (f' y)) w y
     · rintro y ⟨ys, yu, yv⟩
       exact (hg' (f y) yv).comp y ((hf' y yu).mono wu) wv
     show ContDiffOn π•œ n (fun y => (g' (f y)).comp (f' y)) w
@@ -1080,13 +1080,13 @@ theorem contDiff_prodAssoc_symm : ContDiff π•œ ⊀ <| (Equiv.prodAssoc E F G).s
 	`s βˆͺ {xβ‚€}`.
 	We need one additional condition, namely that `t` is a neighborhood of `g(xβ‚€)` within `g '' s`.
 	-/
-theorem ContDiffWithinAt.hasFderivWithinAt_nhds {f : E β†’ F β†’ G} {g : E β†’ F} {t : Set F} {n : β„•}
+theorem ContDiffWithinAt.hasFDerivWithinAt_nhds {f : E β†’ F β†’ G} {g : E β†’ F} {t : Set F} {n : β„•}
     {xβ‚€ : E} (hf : ContDiffWithinAt π•œ (n + 1) (uncurry f) (insert xβ‚€ s Γ—Λ’ t) (xβ‚€, g xβ‚€))
     (hg : ContDiffWithinAt π•œ n g s xβ‚€) (hgt : t ∈ 𝓝[g '' s] g xβ‚€) :
     βˆƒ v ∈ 𝓝[insert xβ‚€ s] xβ‚€,
       v βŠ† insert xβ‚€ s ∧
         βˆƒ f' : E β†’ F β†’L[π•œ] G,
-          (βˆ€ x ∈ v, HasFderivWithinAt (f x) (f' x) t (g x)) ∧
+          (βˆ€ x ∈ v, HasFDerivWithinAt (f x) (f' x) t (g x)) ∧
             ContDiffWithinAt π•œ n (fun x => f' x) s xβ‚€ :=
   by
   have hst : insert xβ‚€ s Γ—Λ’ t ∈ 𝓝[(fun x => (x, g x)) '' s] (xβ‚€, g xβ‚€) :=
@@ -1106,7 +1106,7 @@ theorem ContDiffWithinAt.hasFderivWithinAt_nhds {f : E β†’ F β†’ G} {g : E β†’ F
     refine' (hst.trans <| nhdsWithin_mono _ <| subset_insert _ _).trans hv
   Β· intro z hz
     have := hvf' (z, g z) hz.1
-    refine' this.comp _ (hasFderivAt_prod_mk_right _ _).HasFderivWithinAt _
+    refine' this.comp _ (hasFDerivAt_prod_mk_right _ _).HasFDerivWithinAt _
     exact maps_to'.mpr (image_prod_mk_subset_prod_right hz.2)
   Β·
     exact
@@ -1114,7 +1114,7 @@ theorem ContDiffWithinAt.hasFderivWithinAt_nhds {f : E β†’ F β†’ G} {g : E β†’ F
             (ContinuousLinearMap.compL π•œ F (E Γ— F) G).flip
               (ContinuousLinearMap.inr π•œ E F)).comp_of_mem
         xβ‚€ (cont_diff_within_at_id.prod hg) hst
-#align cont_diff_within_at.has_fderiv_within_at_nhds ContDiffWithinAt.hasFderivWithinAt_nhds
+#align cont_diff_within_at.has_fderiv_within_at_nhds ContDiffWithinAt.hasFDerivWithinAt_nhds
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 /-- The most general lemma stating that `x ↦ fderiv_within π•œ (f x) t (g x)` is `C^n`
@@ -1136,7 +1136,7 @@ theorem ContDiffWithinAt.fderiv_within'' {f : E β†’ F β†’ G} {g : E β†’ F} {t :
     by
     intro k hkm
     obtain ⟨v, hv, -, f', hvf', hf'⟩ :=
-      (hf.of_le <| (add_le_add_right hkm 1).trans hmn).hasFderivWithinAt_nhds (hg.of_le hkm) hgt
+      (hf.of_le <| (add_le_add_right hkm 1).trans hmn).hasFDerivWithinAt_nhds (hg.of_le hkm) hgt
     refine' hf'.congr_of_eventually_eq_insert _
     filter_upwards [hv, ht]
     exact fun y hy h2y => (hvf' y hy).fderivWithin h2y
@@ -1291,8 +1291,8 @@ theorem hasFtaylorSeriesUpToOn_pi :
   Β· ext1 i
     exact (h i).zero_eq x hx
   Β· intro m hm x hx
-    have := hasFderivWithinAt_pi.2 fun i => (h i).fderivWithin m hm x hx
-    convert(L m).HasFderivAt.comp_hasFderivWithinAt x this
+    have := hasFDerivWithinAt_pi.2 fun i => (h i).fderivWithin m hm x hx
+    convert(L m).HasFDerivAt.comp_hasFDerivWithinAt x this
   Β· intro m hm
     have := continuousOn_pi.2 fun i => (h i).cont m hm
     convert(L m).Continuous.comp_continuousOn this
@@ -1904,7 +1904,7 @@ theorem contDiffAt_ring_inverse [CompleteSpace R] (x : RΛ£) : ContDiffAt π•œ n
     · refine' ⟨{ y : R | IsUnit y }, x.nhds, _⟩
       rintro _ ⟨y, rfl⟩
       rw [inverse_unit]
-      exact hasFderivAt_ring_inverse y
+      exact hasFDerivAt_ring_inverse y
     Β·
       convert(mul_left_right_is_bounded_bilinear π•œ R).ContDiff.neg.comp_contDiffAt (x : R)
           (IH.prod IH)
@@ -2016,7 +2016,7 @@ This is one of the easy parts of the inverse function theorem: it assumes that w
 an inverse function. -/
 theorem LocalHomeomorph.contDiffAt_symm [CompleteSpace E] (f : LocalHomeomorph E F)
     {fβ‚€' : E ≃L[π•œ] F} {a : F} (ha : a ∈ f.target)
-    (hfβ‚€' : HasFderivAt f (fβ‚€' : E β†’L[π•œ] F) (f.symm a)) (hf : ContDiffAt π•œ n f (f.symm a)) :
+    (hfβ‚€' : HasFDerivAt f (fβ‚€' : E β†’L[π•œ] F) (f.symm a)) (hf : ContDiffAt π•œ n f (f.symm a)) :
     ContDiffAt π•œ n f.symm a :=
   by
   -- We prove this by induction on `n`
@@ -2043,7 +2043,7 @@ theorem LocalHomeomorph.contDiffAt_symm [CompleteSpace E] (f : LocalHomeomorph E
       Β· exact mem_inter ha (mem_preimage.mpr htf)
       intro x hx
       obtain ⟨hxu, e, he⟩ := htu hx.2
-      have h_deriv : HasFderivAt f (↑e) (f.symm x) :=
+      have h_deriv : HasFDerivAt f (↑e) (f.symm x) :=
         by
         rw [he]
         exact hff' (f.symm x) hxu
@@ -2073,7 +2073,7 @@ then `f.symm` is `n` times continuously differentiable.
 This is one of the easy parts of the inverse function theorem: it assumes that we already have
 an inverse function. -/
 theorem Homeomorph.contDiff_symm [CompleteSpace E] (f : E β‰ƒβ‚œ F) {fβ‚€' : E β†’ E ≃L[π•œ] F}
-    (hfβ‚€' : βˆ€ a, HasFderivAt f (fβ‚€' a : E β†’L[π•œ] F) a) (hf : ContDiff π•œ n (f : E β†’ F)) :
+    (hfβ‚€' : βˆ€ a, HasFDerivAt f (fβ‚€' a : E β†’L[π•œ] F) a) (hf : ContDiff π•œ n (f : E β†’ F)) :
     ContDiff π•œ n (f.symm : F β†’ E) :=
   contDiff_iff_contDiffAt.2 fun x =>
     f.toLocalHomeomorph.contDiffAt_symm (mem_univ x) (hfβ‚€' _) hf.ContDiffAt
@@ -2088,7 +2088,7 @@ an inverse function. -/
 theorem LocalHomeomorph.contDiffAt_symm_deriv [CompleteSpace π•œ] (f : LocalHomeomorph π•œ π•œ)
     {fβ‚€' a : π•œ} (hβ‚€ : fβ‚€' β‰  0) (ha : a ∈ f.target) (hfβ‚€' : HasDerivAt f fβ‚€' (f.symm a))
     (hf : ContDiffAt π•œ n f (f.symm a)) : ContDiffAt π•œ n f.symm a :=
-  f.contDiffAt_symm ha (hfβ‚€'.hasFderivAt_equiv hβ‚€) hf
+  f.contDiffAt_symm ha (hfβ‚€'.hasFDerivAt_equiv hβ‚€) hf
 #align local_homeomorph.cont_diff_at_symm_deriv LocalHomeomorph.contDiffAt_symm_deriv
 
 /-- Let `f` be an `n` times continuously differentiable homeomorphism of a nontrivially normed
@@ -2176,17 +2176,17 @@ variable {𝕂 : Type _} [IsROrC 𝕂] {E' : Type _} [NormedAddCommGroup E'] [No
 
 /-- If a function has a Taylor series at order at least 1, then at points in the interior of the
     domain of definition, the term of order 1 of this series is a strict derivative of `f`. -/
-theorem HasFtaylorSeriesUpToOn.hasStrictFderivAt {s : Set E'} {f : E' β†’ F'} {x : E'}
+theorem HasFtaylorSeriesUpToOn.hasStrictFDerivAt {s : Set E'} {f : E' β†’ F'} {x : E'}
     {p : E' β†’ FormalMultilinearSeries 𝕂 E' F'} (hf : HasFtaylorSeriesUpToOn n f p s) (hn : 1 ≀ n)
-    (hs : s ∈ 𝓝 x) : HasStrictFderivAt f ((continuousMultilinearCurryFin1 𝕂 E' F') (p x 1)) x :=
-  hasStrictFderivAt_of_hasFderivAt_of_continuousAt (hf.eventually_hasFderivAt hn hs) <|
+    (hs : s ∈ 𝓝 x) : HasStrictFDerivAt f ((continuousMultilinearCurryFin1 𝕂 E' F') (p x 1)) x :=
+  hasStrictFDerivAt_of_hasFDerivAt_of_continuousAt (hf.eventually_hasFDerivAt hn hs) <|
     (continuousMultilinearCurryFin1 𝕂 E' F').ContinuousAt.comp <| (hf.cont 1 hn).ContinuousAt hs
-#align has_ftaylor_series_up_to_on.has_strict_fderiv_at HasFtaylorSeriesUpToOn.hasStrictFderivAt
+#align has_ftaylor_series_up_to_on.has_strict_fderiv_at HasFtaylorSeriesUpToOn.hasStrictFDerivAt
 
 /-- If a function is `C^n` with `1 ≀ n` around a point, and its derivative at that point is given to
 us as `f'`, then `f'` is also a strict derivative. -/
 theorem ContDiffAt.has_strict_fderiv_at' {f : E' β†’ F'} {f' : E' β†’L[𝕂] F'} {x : E'}
-    (hf : ContDiffAt 𝕂 n f x) (hf' : HasFderivAt f f' x) (hn : 1 ≀ n) : HasStrictFderivAt f f' x :=
+    (hf : ContDiffAt 𝕂 n f x) (hf' : HasFDerivAt f f' x) (hn : 1 ≀ n) : HasStrictFDerivAt f f' x :=
   by
   rcases hf 1 hn with ⟨u, H, p, hp⟩
   simp only [nhdsWithin_univ, mem_univ, insert_eq_of_mem] at H
@@ -2203,23 +2203,23 @@ theorem ContDiffAt.has_strict_deriv_at' {f : 𝕂 β†’ F'} {f' : F'} {x : 𝕂} (
 
 /-- If a function is `C^n` with `1 ≀ n` around a point, then the derivative of `f` at this point
 is also a strict derivative. -/
-theorem ContDiffAt.hasStrictFderivAt {f : E' β†’ F'} {x : E'} (hf : ContDiffAt 𝕂 n f x) (hn : 1 ≀ n) :
-    HasStrictFderivAt f (fderiv 𝕂 f x) x :=
-  hf.has_strict_fderiv_at' (hf.DifferentiableAt hn).HasFderivAt hn
-#align cont_diff_at.has_strict_fderiv_at ContDiffAt.hasStrictFderivAt
+theorem ContDiffAt.hasStrictFDerivAt {f : E' β†’ F'} {x : E'} (hf : ContDiffAt 𝕂 n f x) (hn : 1 ≀ n) :
+    HasStrictFDerivAt f (fderiv 𝕂 f x) x :=
+  hf.has_strict_fderiv_at' (hf.DifferentiableAt hn).HasFDerivAt hn
+#align cont_diff_at.has_strict_fderiv_at ContDiffAt.hasStrictFDerivAt
 
 /-- If a function is `C^n` with `1 ≀ n` around a point, then the derivative of `f` at this point
 is also a strict derivative. -/
 theorem ContDiffAt.hasStrictDerivAt {f : 𝕂 β†’ F'} {x : 𝕂} (hf : ContDiffAt 𝕂 n f x) (hn : 1 ≀ n) :
     HasStrictDerivAt f (deriv f x) x :=
-  (hf.HasStrictFderivAt hn).HasStrictDerivAt
+  (hf.HasStrictFDerivAt hn).HasStrictDerivAt
 #align cont_diff_at.has_strict_deriv_at ContDiffAt.hasStrictDerivAt
 
 /-- If a function is `C^n` with `1 ≀ n`, then the derivative of `f` is also a strict derivative. -/
-theorem ContDiff.hasStrictFderivAt {f : E' β†’ F'} {x : E'} (hf : ContDiff 𝕂 n f) (hn : 1 ≀ n) :
-    HasStrictFderivAt f (fderiv 𝕂 f x) x :=
-  hf.ContDiffAt.HasStrictFderivAt hn
-#align cont_diff.has_strict_fderiv_at ContDiff.hasStrictFderivAt
+theorem ContDiff.hasStrictFDerivAt {f : E' β†’ F'} {x : E'} (hf : ContDiff 𝕂 n f) (hn : 1 ≀ n) :
+    HasStrictFDerivAt f (fderiv 𝕂 f x) x :=
+  hf.ContDiffAt.HasStrictFDerivAt hn
+#align cont_diff.has_strict_fderiv_at ContDiff.hasStrictFDerivAt
 
 /-- If a function is `C^n` with `1 ≀ n`, then the derivative of `f` is also a strict derivative. -/
 theorem ContDiff.hasStrictDerivAt {f : 𝕂 β†’ F'} {x : 𝕂} (hf : ContDiff 𝕂 n f) (hn : 1 ≀ n) :
@@ -2236,7 +2236,7 @@ theorem HasFtaylorSeriesUpToOn.exists_lipschitzOnWith_of_nnnorm_lt {E F : Type _
     (hK : β€–p x 1β€–β‚Š < K) : βˆƒ t ∈ 𝓝[s] x, LipschitzOnWith K f t :=
   by
   set f' := fun y => continuousMultilinearCurryFin1 ℝ E F (p y 1)
-  have hder : βˆ€ y ∈ s, HasFderivWithinAt f (f' y) s y := fun y hy =>
+  have hder : βˆ€ y ∈ s, HasFDerivWithinAt f (f' y) s y := fun y hy =>
     (hf.has_fderiv_within_at le_rfl (subset_insert x s hy)).mono (subset_insert x s)
   have hcont : ContinuousWithinAt f' s x :=
     (continuousMultilinearCurryFin1 ℝ E F).ContinuousAt.comp_continuousWithinAt
@@ -2280,13 +2280,13 @@ theorem ContDiffWithinAt.exists_lipschitzOnWith {E F : Type _} [NormedAddCommGro
 theorem ContDiffAt.exists_lipschitzOnWith_of_nnnorm_lt {f : E' β†’ F'} {x : E'}
     (hf : ContDiffAt 𝕂 1 f x) (K : ℝβ‰₯0) (hK : β€–fderiv 𝕂 f xβ€–β‚Š < K) :
     βˆƒ t ∈ 𝓝 x, LipschitzOnWith K f t :=
-  (hf.HasStrictFderivAt le_rfl).exists_lipschitzOnWith_of_nnnorm_lt K hK
+  (hf.HasStrictFDerivAt le_rfl).exists_lipschitzOnWith_of_nnnorm_lt K hK
 #align cont_diff_at.exists_lipschitz_on_with_of_nnnorm_lt ContDiffAt.exists_lipschitzOnWith_of_nnnorm_lt
 
 /-- If `f` is `C^1` at `x`, then `f` is Lipschitz in a neighborhood of `x`. -/
 theorem ContDiffAt.exists_lipschitzOnWith {f : E' β†’ F'} {x : E'} (hf : ContDiffAt 𝕂 1 f x) :
     βˆƒ K, βˆƒ t ∈ 𝓝 x, LipschitzOnWith K f t :=
-  (hf.HasStrictFderivAt le_rfl).exists_lipschitzOnWith
+  (hf.HasStrictFDerivAt le_rfl).exists_lipschitzOnWith
 #align cont_diff_at.exists_lipschitz_on_with ContDiffAt.exists_lipschitzOnWith
 
 end Real
@@ -2465,7 +2465,7 @@ theorem HasFtaylorSeriesUpToOn.restrictScalars (h : HasFtaylorSeriesUpToOn n f p
   { zero_eq := fun x hx => h.zero_eq x hx
     fderivWithin := by
       intro m hm x hx
-      convert(ContinuousMultilinearMap.restrictScalarsLinear π•œ).HasFderivAt.comp_hasFderivWithinAt _
+      convert(ContinuousMultilinearMap.restrictScalarsLinear π•œ).HasFDerivAt.comp_hasFDerivWithinAt _
           ((h.fderiv_within m hm x hx).restrictScalars π•œ)
     cont := fun m hm =>
       ContinuousMultilinearMap.continuous_restrictScalars.comp_continuousOn (h.cont m hm) }
Diff
@@ -560,7 +560,7 @@ theorem LinearIsometryEquiv.norm_iteratedFderivWithin_comp_right (g : G ≃ₗ
     iteratedFderivWithin π•œ i (f ∘ g) (g ⁻¹' s) x =
       (iteratedFderivWithin π•œ i f s (g x)).compContinuousLinearMap fun _ => g :=
     g.to_continuous_linear_equiv.iterated_fderiv_within_comp_right f hs hx i
-  rw [this, ContinuousMultilinearMap.norm_comp_continuous_linearIsometryEquiv]
+  rw [this, ContinuousMultilinearMap.norm_compContinuous_linearIsometryEquiv]
 #align linear_isometry_equiv.norm_iterated_fderiv_within_comp_right LinearIsometryEquiv.norm_iteratedFderivWithin_comp_right
 
 /-- Composition with a linear isometry on the right preserves the norm of the iterated derivative
Diff
@@ -1319,7 +1319,7 @@ theorem contDiffWithinAt_pi :
   refine' ⟨fun h i => h.continuousLinearMapComp (pr i), fun h m hm => _⟩
   choose u hux p hp using fun i => h i m hm
   exact
-    βŸ¨β‹‚ i, u i, Filter.interα΅’_mem.2 hux, _,
+    βŸ¨β‹‚ i, u i, Filter.iInter_mem.2 hux, _,
       hasFtaylorSeriesUpToOn_pi.2 fun i => (hp i).mono <| Inter_subset _ _⟩
 #align cont_diff_within_at_pi contDiffWithinAt_pi
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: SΓ©bastien GouΓ«zel, Floris van Doorn
 
 ! This file was ported from Lean 3 source module analysis.calculus.cont_diff
-! leanprover-community/mathlib commit aa68866e61a7f1f40e7d6c8b0116ebd6370525c3
+! leanprover-community/mathlib commit 066ecdb4834c7a4693e0f0e5154935a6f3d3f90c
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -2426,6 +2426,18 @@ theorem ContDiff.continuous_deriv (h : ContDiff π•œ n fβ‚‚) (hn : 1 ≀ n) : Co
   (contDiff_succ_iff_deriv.mp (h.of_le hn)).2.Continuous
 #align cont_diff.continuous_deriv ContDiff.continuous_deriv
 
+theorem ContDiff.iterate_deriv :
+    βˆ€ (n : β„•) {fβ‚‚ : π•œ β†’ F} (hf : ContDiff π•œ ∞ fβ‚‚), ContDiff π•œ ∞ ((deriv^[n]) fβ‚‚)
+  | 0, fβ‚‚, hf => hf
+  | n + 1, fβ‚‚, hf => ContDiff.iterate_deriv n (contDiff_top_iff_deriv.mp hf).2
+#align cont_diff.iterate_deriv ContDiff.iterate_deriv
+
+theorem ContDiff.iterate_deriv' (n : β„•) :
+    βˆ€ (k : β„•) {fβ‚‚ : π•œ β†’ F} (hf : ContDiff π•œ (n + k : β„•) fβ‚‚), ContDiff π•œ n ((deriv^[k]) fβ‚‚)
+  | 0, fβ‚‚, hf => hf
+  | n + 1, fβ‚‚, hf => ContDiff.iterate_deriv' n (contDiff_succ_iff_deriv.mp hf).2
+#align cont_diff.iterate_deriv' ContDiff.iterate_deriv'
+
 end deriv
 
 section RestrictScalars
Diff
@@ -4,19 +4,29 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: SΓ©bastien GouΓ«zel, Floris van Doorn
 
 ! This file was ported from Lean 3 source module analysis.calculus.cont_diff
-! leanprover-community/mathlib commit 323b7f2616426313505aae4e09ffbea6013862fc
+! leanprover-community/mathlib commit aa68866e61a7f1f40e7d6c8b0116ebd6370525c3
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
 import Mathbin.Analysis.Calculus.ContDiffDef
 import Mathbin.Analysis.Calculus.MeanValue
 import Mathbin.Analysis.NormedSpace.FiniteDimension
+import Mathbin.Data.Nat.Choose.Cast
 
 /-!
 # Higher differentiability of usual operations
 
 We prove that the usual operations (addition, multiplication, difference, composition, and
-so on) preserve `C^n` functions. We also expand the API aound `C^n` functions.
+so on) preserve `C^n` functions. We also expand the API around `C^n` functions.
+
+## Main results
+
+* `cont_diff.comp` states that the composition of two `C^n` functions is `C^n`.
+* `norm_iterated_fderiv_comp_le` gives the bound `n! * C * D ^ n` for the `n`-th derivative
+  of `g ∘ f` assuming that the derivatives of `g` are bounded by `C` and the `i`-th
+  derivative of `f` is bounded by `D ^ i`.
+
+Similar results are given for `C^n` functions on domains.
 
 ## Notations
 
@@ -33,7 +43,7 @@ derivative, differentiability, higher derivative, `C^n`, multilinear, Taylor ser
 
 noncomputable section
 
-open Classical BigOperators NNReal
+open Classical BigOperators NNReal Nat
 
 -- mathport name: «expr∞»
 local notation "∞" => (⊀ : β„•βˆž)
@@ -307,8 +317,7 @@ theorem ContDiff.continuousLinearMap_comp {f : E β†’ F} (g : F β†’L[π•œ] G) (hf
 /-- The iterated derivative within a set of the composition with a linear map on the left is
 obtained by applying the linear map to the iterated derivative. -/
 theorem ContinuousLinearMap.iteratedFderivWithin_comp_left {f : E β†’ F} (g : F β†’L[π•œ] G)
-    (hf : ContDiffOn π•œ n f s) (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) {i : β„•}
-    (hi : (i : WithTop β„•) ≀ n) :
+    (hf : ContDiffOn π•œ n f s) (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) {i : β„•} (hi : (i : β„•βˆž) ≀ n) :
     iteratedFderivWithin π•œ i (g ∘ f) s x =
       g.compContinuousMultilinearMap (iteratedFderivWithin π•œ i f s x) :=
   (((hf.ftaylorSeriesWithin hs).continuousLinearMapComp g).eq_ftaylor_series_of_uniqueDiffOn hi hs
@@ -318,7 +327,7 @@ theorem ContinuousLinearMap.iteratedFderivWithin_comp_left {f : E β†’ F} (g : F
 /-- The iterated derivative of the composition with a linear map on the left is
 obtained by applying the linear map to the iterated derivative. -/
 theorem ContinuousLinearMap.iteratedFderiv_comp_left {f : E β†’ F} (g : F β†’L[π•œ] G)
-    (hf : ContDiff π•œ n f) (x : E) {i : β„•} (hi : (i : WithTop β„•) ≀ n) :
+    (hf : ContDiff π•œ n f) (x : E) {i : β„•} (hi : (i : β„•βˆž) ≀ n) :
     iteratedFderiv π•œ i (g ∘ f) x = g.compContinuousMultilinearMap (iteratedFderiv π•œ i f x) :=
   by
   simp only [← iteratedFderivWithin_univ]
@@ -358,8 +367,7 @@ theorem ContinuousLinearEquiv.iteratedFderivWithin_comp_left (g : F ≃L[π•œ] G
 /-- Composition with a linear isometry on the left preserves the norm of the iterated
 derivative within a set. -/
 theorem LinearIsometry.norm_iteratedFderivWithin_comp_left {f : E β†’ F} (g : F β†’β‚—α΅’[π•œ] G)
-    (hf : ContDiffOn π•œ n f s) (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) {i : β„•}
-    (hi : (i : WithTop β„•) ≀ n) :
+    (hf : ContDiffOn π•œ n f s) (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) {i : β„•} (hi : (i : β„•βˆž) ≀ n) :
     β€–iteratedFderivWithin π•œ i (g ∘ f) s xβ€– = β€–iteratedFderivWithin π•œ i f s xβ€– :=
   by
   have :
@@ -373,7 +381,7 @@ theorem LinearIsometry.norm_iteratedFderivWithin_comp_left {f : E β†’ F} (g : F
 /-- Composition with a linear isometry on the left preserves the norm of the iterated
 derivative. -/
 theorem LinearIsometry.norm_iteratedFderiv_comp_left {f : E β†’ F} (g : F β†’β‚—α΅’[π•œ] G)
-    (hf : ContDiff π•œ n f) (x : E) {i : β„•} (hi : (i : WithTop β„•) ≀ n) :
+    (hf : ContDiff π•œ n f) (x : E) {i : β„•} (hi : (i : β„•βˆž) ≀ n) :
     β€–iteratedFderiv π•œ i (g ∘ f) xβ€– = β€–iteratedFderiv π•œ i f xβ€– :=
   by
   simp only [← iteratedFderivWithin_univ]
@@ -491,7 +499,7 @@ theorem ContDiff.comp_continuousLinearMap {f : E β†’ F} {g : G β†’L[π•œ] E} (hf
 obtained by composing the iterated derivative with the linear map. -/
 theorem ContinuousLinearMap.iteratedFderivWithin_comp_right {f : E β†’ F} (g : G β†’L[π•œ] E)
     (hf : ContDiffOn π•œ n f s) (hs : UniqueDiffOn π•œ s) (h's : UniqueDiffOn π•œ (g ⁻¹' s)) {x : G}
-    (hx : g x ∈ s) {i : β„•} (hi : (i : WithTop β„•) ≀ n) :
+    (hx : g x ∈ s) {i : β„•} (hi : (i : β„•βˆž) ≀ n) :
     iteratedFderivWithin π•œ i (f ∘ g) (g ⁻¹' s) x =
       (iteratedFderivWithin π•œ i f s (g x)).compContinuousLinearMap fun _ => g :=
   (((hf.ftaylorSeriesWithin hs).compContinuousLinearMap g).eq_ftaylor_series_of_uniqueDiffOn hi h's
@@ -532,7 +540,7 @@ theorem ContinuousLinearEquiv.iteratedFderivWithin_comp_right (g : G ≃L[π•œ]
 /-- The iterated derivative of the composition with a linear map on the right is
 obtained by composing the iterated derivative with the linear map. -/
 theorem ContinuousLinearMap.iteratedFderiv_comp_right (g : G β†’L[π•œ] E) {f : E β†’ F}
-    (hf : ContDiff π•œ n f) (x : G) {i : β„•} (hi : (i : WithTop β„•) ≀ n) :
+    (hf : ContDiff π•œ n f) (x : G) {i : β„•} (hi : (i : β„•βˆž) ≀ n) :
     iteratedFderiv π•œ i (f ∘ g) x =
       (iteratedFderiv π•œ i f (g x)).compContinuousLinearMap fun _ => g :=
   by
@@ -2502,7 +2510,7 @@ theorem ContinuousLinearMap.norm_iteratedFderivWithin_le_of_bilinear_aux {Du Eu
     apply ((B (f x)).le_op_norm (g x)).trans
     apply mul_le_mul_of_nonneg_right _ (norm_nonneg _)
     exact B.le_op_norm (f x)
-  Β· have In : (n : WithTop β„•) + 1 ≀ n.succ := by simp only [Nat.cast_succ, le_refl]
+  Β· have In : (n : β„•βˆž) + 1 ≀ n.succ := by simp only [Nat.cast_succ, le_refl]
     have I1 :
       β€–iteratedFderivWithin π•œ n (fun y : Du => B.precompR Du (f y) (fderivWithin π•œ g s y)) s xβ€– ≀
         β€–Bβ€– *
@@ -2563,7 +2571,7 @@ theorem ContinuousLinearMap.norm_iteratedFderivWithin_le_of_bilinear_aux {Du Eu
           s x :=
       by
       apply iteratedFderivWithin_congr hs (fun y hy => _) hx
-      have L : (1 : WithTop β„•) ≀ n.succ := by
+      have L : (1 : β„•βˆž) ≀ n.succ := by
         simpa only [ENat.coe_one, Nat.one_le_cast] using Nat.succ_pos n
       exact
         B.fderiv_within_of_bilinear (hf.differentiable_on L y hy) (hg.differentiable_on L y hy)
@@ -2588,9 +2596,8 @@ theorem ContinuousLinearMap.norm_iteratedFderivWithin_le_of_bilinear_aux {Du Eu
 iterated derivatives of `f` and `g` when `B` is bilinear:
 `β€–D^n (x ↦ B (f x) (g x))β€– ≀ β€–Bβ€– βˆ‘_{k ≀ n} n.choose k β€–D^k fβ€– β€–D^{n-k} gβ€–` -/
 theorem ContinuousLinearMap.norm_iteratedFderivWithin_le_of_bilinear (B : E β†’L[π•œ] F β†’L[π•œ] G)
-    {f : D β†’ E} {g : D β†’ F} {N : WithTop β„•} {s : Set D} {x : D} (hf : ContDiffOn π•œ N f s)
-    (hg : ContDiffOn π•œ N g s) (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) {n : β„•}
-    (hn : (n : WithTop β„•) ≀ N) :
+    {f : D β†’ E} {g : D β†’ F} {N : β„•βˆž} {s : Set D} {x : D} (hf : ContDiffOn π•œ N f s)
+    (hg : ContDiffOn π•œ N g s) (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) {n : β„•} (hn : (n : β„•βˆž) ≀ N) :
     β€–iteratedFderivWithin π•œ n (fun y => B (f y) (g y)) s xβ€– ≀
       β€–Bβ€– *
         βˆ‘ i in Finset.range (n + 1),
@@ -2687,8 +2694,8 @@ theorem ContinuousLinearMap.norm_iteratedFderivWithin_le_of_bilinear (B : E β†’L
 iterated derivatives of `f` and `g` when `B` is bilinear:
 `β€–D^n (x ↦ B (f x) (g x))β€– ≀ β€–Bβ€– βˆ‘_{k ≀ n} n.choose k β€–D^k fβ€– β€–D^{n-k} gβ€–` -/
 theorem ContinuousLinearMap.norm_iteratedFderiv_le_of_bilinear (B : E β†’L[π•œ] F β†’L[π•œ] G) {f : D β†’ E}
-    {g : D β†’ F} {N : WithTop β„•} (hf : ContDiff π•œ N f) (hg : ContDiff π•œ N g) (x : D) {n : β„•}
-    (hn : (n : WithTop β„•) ≀ N) :
+    {g : D β†’ F} {N : β„•βˆž} (hf : ContDiff π•œ N f) (hg : ContDiff π•œ N g) (x : D) {n : β„•}
+    (hn : (n : β„•βˆž) ≀ N) :
     β€–iteratedFderiv π•œ n (fun y => B (f y) (g y)) xβ€– ≀
       β€–Bβ€– *
         βˆ‘ i in Finset.range (n + 1),
@@ -2704,9 +2711,9 @@ theorem ContinuousLinearMap.norm_iteratedFderiv_le_of_bilinear (B : E β†’L[π•œ]
 iterated derivatives of `f` and `g` when `B` is bilinear of norm at most `1`:
 `β€–D^n (x ↦ B (f x) (g x))β€– ≀ βˆ‘_{k ≀ n} n.choose k β€–D^k fβ€– β€–D^{n-k} gβ€–` -/
 theorem ContinuousLinearMap.norm_iteratedFderivWithin_le_of_bilinear_of_le_one
-    (B : E β†’L[π•œ] F β†’L[π•œ] G) {f : D β†’ E} {g : D β†’ F} {N : WithTop β„•} {s : Set D} {x : D}
+    (B : E β†’L[π•œ] F β†’L[π•œ] G) {f : D β†’ E} {g : D β†’ F} {N : β„•βˆž} {s : Set D} {x : D}
     (hf : ContDiffOn π•œ N f s) (hg : ContDiffOn π•œ N g s) (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) {n : β„•}
-    (hn : (n : WithTop β„•) ≀ N) (hB : β€–Bβ€– ≀ 1) :
+    (hn : (n : β„•βˆž) ≀ N) (hB : β€–Bβ€– ≀ 1) :
     β€–iteratedFderivWithin π•œ n (fun y => B (f y) (g y)) s xβ€– ≀
       βˆ‘ i in Finset.range (n + 1),
         (n.choose i : ℝ) * β€–iteratedFderivWithin π•œ i f s xβ€– *
@@ -2721,8 +2728,8 @@ theorem ContinuousLinearMap.norm_iteratedFderivWithin_le_of_bilinear_of_le_one
 iterated derivatives of `f` and `g` when `B` is bilinear of norm at most `1`:
 `β€–D^n (x ↦ B (f x) (g x))β€– ≀ βˆ‘_{k ≀ n} n.choose k β€–D^k fβ€– β€–D^{n-k} gβ€–` -/
 theorem ContinuousLinearMap.norm_iteratedFderiv_le_of_bilinear_of_le_one (B : E β†’L[π•œ] F β†’L[π•œ] G)
-    {f : D β†’ E} {g : D β†’ F} {N : WithTop β„•} (hf : ContDiff π•œ N f) (hg : ContDiff π•œ N g) (x : D)
-    {n : β„•} (hn : (n : WithTop β„•) ≀ N) (hB : β€–Bβ€– ≀ 1) :
+    {f : D β†’ E} {g : D β†’ F} {N : β„•βˆž} (hf : ContDiff π•œ N f) (hg : ContDiff π•œ N g) (x : D) {n : β„•}
+    (hn : (n : β„•βˆž) ≀ N) (hB : β€–Bβ€– ≀ 1) :
     β€–iteratedFderiv π•œ n (fun y => B (f y) (g y)) xβ€– ≀
       βˆ‘ i in Finset.range (n + 1),
         (n.choose i : ℝ) * β€–iteratedFderiv π•œ i f xβ€– * β€–iteratedFderiv π•œ (n - i) g xβ€– :=
@@ -2738,9 +2745,9 @@ section
 variable {π•œ' : Type _} [NormedField π•œ'] [NormedAlgebra π•œ π•œ'] [NormedSpace π•œ' F]
   [IsScalarTower π•œ π•œ' F]
 
-theorem norm_iteratedFderivWithin_smul_le {f : E β†’ π•œ'} {g : E β†’ F} {N : WithTop β„•}
+theorem norm_iteratedFderivWithin_smul_le {f : E β†’ π•œ'} {g : E β†’ F} {N : β„•βˆž}
     (hf : ContDiffOn π•œ N f s) (hg : ContDiffOn π•œ N g s) (hs : UniqueDiffOn π•œ s) {x : E} (hx : x ∈ s)
-    {n : β„•} (hn : (n : WithTop β„•) ≀ N) :
+    {n : β„•} (hn : (n : β„•βˆž) ≀ N) :
     β€–iteratedFderivWithin π•œ n (fun y => f y β€’ g y) s xβ€– ≀
       βˆ‘ i in Finset.range (n + 1),
         (n.choose i : ℝ) * β€–iteratedFderivWithin π•œ i f s xβ€– *
@@ -2750,8 +2757,8 @@ theorem norm_iteratedFderivWithin_smul_le {f : E β†’ π•œ'} {g : E β†’ F} {N : W
     hf hg hs hx hn ContinuousLinearMap.op_norm_lsmul_le
 #align norm_iterated_fderiv_within_smul_le norm_iteratedFderivWithin_smul_le
 
-theorem norm_iteratedFderiv_smul_le {f : E β†’ π•œ'} {g : E β†’ F} {N : WithTop β„•} (hf : ContDiff π•œ N f)
-    (hg : ContDiff π•œ N g) (x : E) {n : β„•} (hn : (n : WithTop β„•) ≀ N) :
+theorem norm_iteratedFderiv_smul_le {f : E β†’ π•œ'} {g : E β†’ F} {N : β„•βˆž} (hf : ContDiff π•œ N f)
+    (hg : ContDiff π•œ N g) (x : E) {n : β„•} (hn : (n : β„•βˆž) ≀ N) :
     β€–iteratedFderiv π•œ n (fun y => f y β€’ g y) xβ€– ≀
       βˆ‘ i in Finset.range (n + 1),
         (n.choose i : ℝ) * β€–iteratedFderiv π•œ i f xβ€– * β€–iteratedFderiv π•œ (n - i) g xβ€– :=
@@ -2765,9 +2772,9 @@ section
 
 variable {A : Type _} [NormedRing A] [NormedAlgebra π•œ A]
 
-theorem norm_iteratedFderivWithin_mul_le {f : E β†’ A} {g : E β†’ A} {N : WithTop β„•}
-    (hf : ContDiffOn π•œ N f s) (hg : ContDiffOn π•œ N g s) (hs : UniqueDiffOn π•œ s) {x : E} (hx : x ∈ s)
-    {n : β„•} (hn : (n : WithTop β„•) ≀ N) :
+theorem norm_iteratedFderivWithin_mul_le {f : E β†’ A} {g : E β†’ A} {N : β„•βˆž} (hf : ContDiffOn π•œ N f s)
+    (hg : ContDiffOn π•œ N g s) (hs : UniqueDiffOn π•œ s) {x : E} (hx : x ∈ s) {n : β„•}
+    (hn : (n : β„•βˆž) ≀ N) :
     β€–iteratedFderivWithin π•œ n (fun y => f y * g y) s xβ€– ≀
       βˆ‘ i in Finset.range (n + 1),
         (n.choose i : ℝ) * β€–iteratedFderivWithin π•œ i f s xβ€– *
@@ -2777,8 +2784,8 @@ theorem norm_iteratedFderivWithin_mul_le {f : E β†’ A} {g : E β†’ A} {N : WithTo
     hf hg hs hx hn (ContinuousLinearMap.op_norm_mul_le _ _)
 #align norm_iterated_fderiv_within_mul_le norm_iteratedFderivWithin_mul_le
 
-theorem norm_iteratedFderiv_mul_le {f : E β†’ A} {g : E β†’ A} {N : WithTop β„•} (hf : ContDiff π•œ N f)
-    (hg : ContDiff π•œ N g) (x : E) {n : β„•} (hn : (n : WithTop β„•) ≀ N) :
+theorem norm_iteratedFderiv_mul_le {f : E β†’ A} {g : E β†’ A} {N : β„•βˆž} (hf : ContDiff π•œ N f)
+    (hg : ContDiff π•œ N g) (x : E) {n : β„•} (hn : (n : β„•βˆž) ≀ N) :
     β€–iteratedFderiv π•œ n (fun y => f y * g y) xβ€– ≀
       βˆ‘ i in Finset.range (n + 1),
         (n.choose i : ℝ) * β€–iteratedFderiv π•œ i f xβ€– * β€–iteratedFderiv π•œ (n - i) g xβ€– :=
@@ -2791,6 +2798,217 @@ theorem norm_iteratedFderiv_mul_le {f : E β†’ A} {g : E β†’ A} {N : WithTop β„•}
 
 end
 
+/-- If the derivatives within a set of `g` at `f x` are bounded by `C`, and the `i`-th derivative
+within a set of `f` at `x` is bounded by `D^i` for all `1 ≀ i ≀ n`, then the `n`-th derivative
+of `g ∘ f` is bounded by `n! * C * D^n`.
+This lemma proves this estimate assuming additionally that two of the spaces live in the same
+universe, to make an induction possible. Use instead `norm_iterated_fderiv_within_comp_le` that
+removes this assumption. -/
+theorem norm_iteratedFderivWithin_comp_le_aux {Fu Gu : Type u} [NormedAddCommGroup Fu]
+    [NormedSpace π•œ Fu] [NormedAddCommGroup Gu] [NormedSpace π•œ Gu] {g : Fu β†’ Gu} {f : E β†’ Fu} {n : β„•}
+    {s : Set E} {t : Set Fu} {x : E} (hg : ContDiffOn π•œ n g t) (hf : ContDiffOn π•œ n f s)
+    (ht : UniqueDiffOn π•œ t) (hs : UniqueDiffOn π•œ s) (hst : MapsTo f s t) (hx : x ∈ s) {C : ℝ}
+    {D : ℝ} (hC : βˆ€ i, i ≀ n β†’ β€–iteratedFderivWithin π•œ i g t (f x)β€– ≀ C)
+    (hD : βˆ€ i, 1 ≀ i β†’ i ≀ n β†’ β€–iteratedFderivWithin π•œ i f s xβ€– ≀ D ^ i) :
+    β€–iteratedFderivWithin π•œ n (g ∘ f) s xβ€– ≀ n ! * C * D ^ n :=
+  by
+  /- We argue by induction on `n`, using that `D^(n+1) (g ∘ f) = D^n (g ' ∘ f ⬝ f')`. The successive
+    derivatives of `g' ∘ f` are controlled thanks to the inductive assumption, and those of `f'` are
+    controlled by assumption.
+    As composition of linear maps is a bilinear map, one may use
+    `continuous_linear_map.norm_iterated_fderiv_le_of_bilinear_of_le_one` to get from these a bound
+    on `D^n (g ' ∘ f ⬝ f')`. -/
+  induction' n using Nat.case_strong_induction_on with n IH generalizing Gu
+  Β·
+    simpa only [norm_iteratedFderivWithin_zero, Nat.factorial_zero, algebraMap.coe_one, one_mul,
+      pow_zero, mul_one] using hC 0 le_rfl
+  have M : (n : β„•βˆž) < n.succ := Nat.cast_lt.2 n.lt_succ_self
+  have Cnonneg : 0 ≀ C := (norm_nonneg _).trans (hC 0 bot_le)
+  have Dnonneg : 0 ≀ D :=
+    by
+    have : 1 ≀ n + 1 := by simp only [le_add_iff_nonneg_left, zero_le']
+    simpa only [pow_one] using (norm_nonneg _).trans (hD 1 le_rfl this)
+  -- use the inductive assumption to bound the derivatives of `g' ∘ f`.
+  have I :
+    βˆ€ i ∈ Finset.range (n + 1),
+      β€–iteratedFderivWithin π•œ i (fderivWithin π•œ g t ∘ f) s xβ€– ≀ i ! * C * D ^ i :=
+    by
+    intro i hi
+    simp only [Finset.mem_range_succ_iff] at hi
+    apply IH i hi
+    apply hf.of_le (Nat.cast_le.2 (hi.trans n.le_succ))
+    Β· intro j hj h'j
+      exact hD j hj (h'j.trans (hi.trans n.le_succ))
+    Β· apply hg.fderiv_within ht
+      simp only [Nat.cast_succ]
+      exact add_le_add_right (Nat.cast_le.2 hi) _
+    Β· intro j hj
+      have :
+        β€–iteratedFderivWithin π•œ j (fderivWithin π•œ g t) t (f x)β€– =
+          β€–iteratedFderivWithin π•œ (j + 1) g t (f x)β€– :=
+        by rw [iteratedFderivWithin_succ_eq_comp_right ht (hst hx), LinearIsometryEquiv.norm_map]
+      rw [this]
+      exact hC (j + 1) (add_le_add (hj.trans hi) le_rfl)
+  -- reformulate `hD` as a bound for the derivatives of `f'`.
+  have J : βˆ€ i, β€–iteratedFderivWithin π•œ (n - i) (fderivWithin π•œ f s) s xβ€– ≀ D ^ (n - i + 1) :=
+    by
+    intro i
+    have :
+      β€–iteratedFderivWithin π•œ (n - i) (fderivWithin π•œ f s) s xβ€– =
+        β€–iteratedFderivWithin π•œ (n - i + 1) f s xβ€– :=
+      by rw [iteratedFderivWithin_succ_eq_comp_right hs hx, LinearIsometryEquiv.norm_map]
+    rw [this]
+    apply hD
+    Β· simp only [le_add_iff_nonneg_left, zero_le']
+    Β· apply Nat.succ_le_succ tsub_le_self
+  -- Now put these together: first, notice that we have to bound `D^n (g' ∘ f ⬝ f')`.
+  calc
+    β€–iteratedFderivWithin π•œ (n + 1) (g ∘ f) s xβ€– =
+        β€–iteratedFderivWithin π•œ n (fun y : E => fderivWithin π•œ (g ∘ f) s y) s xβ€– :=
+      by rw [iteratedFderivWithin_succ_eq_comp_right hs hx, LinearIsometryEquiv.norm_map]
+    _ =
+        β€–iteratedFderivWithin π•œ n
+            (fun y : E =>
+              ContinuousLinearMap.compL π•œ E Fu Gu (fderivWithin π•œ g t (f y)) (fderivWithin π•œ f s y))
+            s xβ€– :=
+      by
+      have L : (1 : β„•βˆž) ≀ n.succ := by simpa only [ENat.coe_one, Nat.one_le_cast] using n.succ_pos
+      congr 1
+      apply iteratedFderivWithin_congr hs (fun y hy => _) hx
+      apply fderivWithin.comp _ _ _ hst (hs y hy)
+      Β· exact hg.differentiable_on L _ (hst hy)
+      Β· exact hf.differentiable_on L _ hy
+    -- bound it using the fact that the composition of linear maps is a bilinear operation,
+        -- for which we have bounds for the`n`-th derivative.
+        _ ≀
+        βˆ‘ i in Finset.range (n + 1),
+          (n.choose i : ℝ) * β€–iteratedFderivWithin π•œ i (fderivWithin π•œ g t ∘ f) s xβ€– *
+            β€–iteratedFderivWithin π•œ (n - i) (fderivWithin π•œ f s) s xβ€– :=
+      by
+      have A : ContDiffOn π•œ n (fderivWithin π•œ g t ∘ f) s :=
+        by
+        apply ContDiffOn.comp _ (hf.of_le M.le) hst
+        apply hg.fderiv_within ht
+        simp only [Nat.cast_succ, le_refl]
+      have B : ContDiffOn π•œ n (fderivWithin π•œ f s) s :=
+        by
+        apply hf.fderiv_within hs
+        simp only [Nat.cast_succ, le_refl]
+      exact
+        (ContinuousLinearMap.compL π•œ E Fu Gu).norm_iteratedFderivWithin_le_of_bilinear_of_le_one A B
+          hs hx le_rfl (ContinuousLinearMap.norm_compL_le π•œ E Fu Gu)
+    -- bound each of the terms using the estimates on previous derivatives (that use the inductive
+        -- assumption for `g' ∘ f`).
+        _ ≀
+        βˆ‘ i in Finset.range (n + 1), (n.choose i : ℝ) * (i ! * C * D ^ i) * D ^ (n - i + 1) :=
+      by
+      apply Finset.sum_le_sum fun i hi => _
+      simp only [mul_assoc (n.choose i : ℝ)]
+      refine' mul_le_mul_of_nonneg_left _ (Nat.cast_nonneg _)
+      apply mul_le_mul (I i hi) (J i) (norm_nonneg _)
+      positivity
+    -- We are left with trivial algebraic manipulations to see that this is smaller than
+        -- the claimed bound.
+        _ =
+        βˆ‘ i in Finset.range (n + 1),
+          (n ! : ℝ) * (i !⁻¹ * i !) * C * (D ^ i * D ^ (n - i + 1)) * (n - i)!⁻¹ :=
+      by
+      apply Finset.sum_congr rfl fun i hi => _
+      simp only [Nat.cast_choose ℝ (Finset.mem_range_succ_iff.1 hi), div_eq_inv_mul, mul_inv]
+      ring
+    _ = βˆ‘ i in Finset.range (n + 1), (n ! : ℝ) * 1 * C * D ^ (n + 1) * (n - i)!⁻¹ :=
+      by
+      apply Finset.sum_congr rfl fun i hi => _
+      congr 2
+      Β· congr
+        apply inv_mul_cancel
+        simpa only [Ne.def, Nat.cast_eq_zero] using i.factorial_ne_zero
+      Β· rw [← pow_add]
+        congr 1
+        rw [Nat.add_succ, Nat.succ_inj']
+        exact Nat.add_sub_of_le (Finset.mem_range_succ_iff.1 hi)
+    _ ≀ βˆ‘ i in Finset.range (n + 1), (n ! : ℝ) * 1 * C * D ^ (n + 1) * 1 :=
+      by
+      apply Finset.sum_le_sum fun i hi => _
+      refine' mul_le_mul_of_nonneg_left _ (by positivity)
+      apply inv_le_one
+      simpa only [Nat.one_le_cast] using (n - i).factorial_pos
+    _ = (n + 1)! * C * D ^ (n + 1) := by
+      simp only [mul_assoc, mul_one, Finset.sum_const, Finset.card_range, nsmul_eq_mul,
+        Nat.factorial_succ, Nat.cast_mul]
+    
+#align norm_iterated_fderiv_within_comp_le_aux norm_iteratedFderivWithin_comp_le_aux
+
+/-- If the derivatives within a set of `g` at `f x` are bounded by `C`, and the `i`-th derivative
+within a set of `f` at `x` is bounded by `D^i` for all `1 ≀ i ≀ n`, then the `n`-th derivative
+of `g ∘ f` is bounded by `n! * C * D^n`. -/
+theorem norm_iteratedFderivWithin_comp_le {g : F β†’ G} {f : E β†’ F} {n : β„•} {s : Set E} {t : Set F}
+    {x : E} {N : β„•βˆž} (hg : ContDiffOn π•œ N g t) (hf : ContDiffOn π•œ N f s) (hn : (n : β„•βˆž) ≀ N)
+    (ht : UniqueDiffOn π•œ t) (hs : UniqueDiffOn π•œ s) (hst : MapsTo f s t) (hx : x ∈ s) {C : ℝ}
+    {D : ℝ} (hC : βˆ€ i, i ≀ n β†’ β€–iteratedFderivWithin π•œ i g t (f x)β€– ≀ C)
+    (hD : βˆ€ i, 1 ≀ i β†’ i ≀ n β†’ β€–iteratedFderivWithin π•œ i f s xβ€– ≀ D ^ i) :
+    β€–iteratedFderivWithin π•œ n (g ∘ f) s xβ€– ≀ n ! * C * D ^ n :=
+  by
+  /- We reduce the bound to the case where all spaces live in the same universe (in which we
+    already have proved the result), by using linear isometries between the spaces and their `ulift`
+    to a common universe. These linear isometries preserve the norm of the iterated derivative. -/
+  let Fu : Type max uF uG := ULift.{uG, uF} F
+  let Gu : Type max uF uG := ULift.{uF, uG} G
+  have isoF : Fu ≃ₗᡒ[π•œ] F := LinearIsometryEquiv.ulift π•œ F
+  have isoG : Gu ≃ₗᡒ[π•œ] G := LinearIsometryEquiv.ulift π•œ G
+  -- lift `f` and `g` to versions `fu` and `gu` on the lifted spaces.
+  let fu : E β†’ Fu := isoF.symm ∘ f
+  let gu : Fu β†’ Gu := isoG.symm ∘ g ∘ isoF
+  let tu := isoF ⁻¹' t
+  have htu : UniqueDiffOn π•œ tu := isoF.to_continuous_linear_equiv.unique_diff_on_preimage_iff.2 ht
+  have hstu : maps_to fu s tu := by
+    intro y hy
+    simpa only [mem_preimage, LinearIsometryEquiv.apply_symm_apply] using hst hy
+  have Ffu : isoF (fu x) = f x := by simp only [LinearIsometryEquiv.apply_symm_apply]
+  -- All norms are preserved by the lifting process.
+  have hfu : ContDiffOn π•œ n fu s := isoF.symm.cont_diff.comp_cont_diff_on (hf.of_le hn)
+  have hgu : ContDiffOn π•œ n gu tu :=
+    isoG.symm.cont_diff.comp_cont_diff_on
+      ((hg.of_le hn).compContinuousLinearMap (isoF : Fu β†’L[π•œ] F))
+  have Nfu : βˆ€ i, β€–iteratedFderivWithin π•œ i fu s xβ€– = β€–iteratedFderivWithin π•œ i f s xβ€– :=
+    by
+    intro i
+    rw [LinearIsometryEquiv.norm_iteratedFderivWithin_comp_left _ _ hs hx]
+  simp_rw [← Nfu] at hD
+  have Ngu : βˆ€ i, β€–iteratedFderivWithin π•œ i gu tu (fu x)β€– = β€–iteratedFderivWithin π•œ i g t (f x)β€– :=
+    by
+    intro i
+    rw [LinearIsometryEquiv.norm_iteratedFderivWithin_comp_left _ _ htu (hstu hx)]
+    rw [LinearIsometryEquiv.norm_iteratedFderivWithin_comp_right _ _ ht, Ffu]
+    rw [Ffu]
+    exact hst hx
+  simp_rw [← Ngu] at hC
+  have Nfgu : β€–iteratedFderivWithin π•œ n (g ∘ f) s xβ€– = β€–iteratedFderivWithin π•œ n (gu ∘ fu) s xβ€– :=
+    by
+    have : gu ∘ fu = isoG.symm ∘ g ∘ f := by
+      ext x
+      simp only [comp_app, LinearIsometryEquiv.map_eq_iff, LinearIsometryEquiv.apply_symm_apply]
+    rw [this, LinearIsometryEquiv.norm_iteratedFderivWithin_comp_left _ _ hs hx]
+  -- deduce the required bound from the one for `gu ∘ fu`.
+  rw [Nfgu]
+  exact norm_iteratedFderivWithin_comp_le_aux hgu hfu htu hs hstu hx hC hD
+#align norm_iterated_fderiv_within_comp_le norm_iteratedFderivWithin_comp_le
+
+/-- If the derivatives of `g` at `f x` are bounded by `C`, and the `i`-th derivative
+of `f` at `x` is bounded by `D^i` for all `1 ≀ i ≀ n`, then the `n`-th derivative
+of `g ∘ f` is bounded by `n! * C * D^n`. -/
+theorem norm_iteratedFderiv_comp_le {g : F β†’ G} {f : E β†’ F} {n : β„•} {N : β„•βˆž} (hg : ContDiff π•œ N g)
+    (hf : ContDiff π•œ N f) (hn : (n : β„•βˆž) ≀ N) (x : E) {C : ℝ} {D : ℝ}
+    (hC : βˆ€ i, i ≀ n β†’ β€–iteratedFderiv π•œ i g (f x)β€– ≀ C)
+    (hD : βˆ€ i, 1 ≀ i β†’ i ≀ n β†’ β€–iteratedFderiv π•œ i f xβ€– ≀ D ^ i) :
+    β€–iteratedFderiv π•œ n (g ∘ f) xβ€– ≀ n ! * C * D ^ n :=
+  by
+  simp_rw [← iteratedFderivWithin_univ] at hC hD⊒
+  exact
+    norm_iteratedFderivWithin_comp_le hg.cont_diff_on hf.cont_diff_on hn uniqueDiffOn_univ
+      uniqueDiffOn_univ (maps_to_univ _ _) (mem_univ x) hC hD
+#align norm_iterated_fderiv_comp_le norm_iteratedFderiv_comp_le
+
 section Apply
 
 theorem norm_iteratedFderivWithin_clm_apply {f : E β†’ F β†’L[π•œ] G} {g : E β†’ F} {s : Set E} {x : E}
Diff
@@ -40,7 +40,7 @@ local notation "∞" => (⊀ : β„•βˆž)
 
 universe u v w uD uE uF uG
 
-attribute [local instance]
+attribute [local instance 1001]
   NormedAddCommGroup.toAddCommGroup NormedSpace.toModule' AddCommGroup.toAddCommMonoid
 
 namespace Finset
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: SΓ©bastien GouΓ«zel, Floris van Doorn
 
 ! This file was ported from Lean 3 source module analysis.calculus.cont_diff
-! leanprover-community/mathlib commit 91862a6001a8b6ae3f261cdd8eea42f6ac596886
+! leanprover-community/mathlib commit 323b7f2616426313505aae4e09ffbea6013862fc
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -187,6 +187,20 @@ theorem contDiffOn_of_subsingleton [Subsingleton F] : ContDiffOn π•œ n f s :=
   exact contDiffOn_const
 #align cont_diff_on_of_subsingleton contDiffOn_of_subsingleton
 
+theorem iteratedFderiv_succ_const (n : β„•) (c : F) : (iteratedFderiv π•œ (n + 1) fun y : E => c) = 0 :=
+  by
+  ext (x m)
+  simp only [iteratedFderiv_succ_apply_right, fderiv_const, Pi.zero_apply, iteratedFderiv_zero_fun,
+    ContinuousMultilinearMap.zero_apply, ContinuousLinearMap.zero_apply]
+#align iterated_fderiv_succ_const iteratedFderiv_succ_const
+
+theorem iteratedFderiv_const_of_ne {n : β„•} (hn : n β‰  0) (c : F) :
+    (iteratedFderiv π•œ n fun y : E => c) = 0 :=
+  by
+  cases' Nat.exists_eq_succ_of_ne_zero hn with k hk
+  rw [hk, iteratedFderiv_succ_const]
+#align iterated_fderiv_const_of_ne iteratedFderiv_const_of_ne
+
 /-! ### Smoothness of linear functions -/
 
 
@@ -2777,3 +2791,58 @@ theorem norm_iteratedFderiv_mul_le {f : E β†’ A} {g : E β†’ A} {N : WithTop β„•}
 
 end
 
+section Apply
+
+theorem norm_iteratedFderivWithin_clm_apply {f : E β†’ F β†’L[π•œ] G} {g : E β†’ F} {s : Set E} {x : E}
+    {N : β„•βˆž} {n : β„•} (hf : ContDiffOn π•œ N f s) (hg : ContDiffOn π•œ N g s) (hs : UniqueDiffOn π•œ s)
+    (hx : x ∈ s) (hn : ↑n ≀ N) :
+    β€–iteratedFderivWithin π•œ n (fun y => (f y) (g y)) s xβ€– ≀
+      (Finset.range (n + 1)).Sum fun i =>
+        ↑(n.choose i) * β€–iteratedFderivWithin π•œ i f s xβ€– * β€–iteratedFderivWithin π•œ (n - i) g s xβ€– :=
+  by
+  let B : (F β†’L[π•œ] G) β†’L[π•œ] F β†’L[π•œ] G := ContinuousLinearMap.flip (ContinuousLinearMap.apply π•œ G)
+  have hB : β€–Bβ€– ≀ 1 :=
+    by
+    simp only [ContinuousLinearMap.op_norm_flip, ContinuousLinearMap.apply]
+    refine' ContinuousLinearMap.op_norm_le_bound _ zero_le_one fun f => _
+    simp only [ContinuousLinearMap.coe_id', id.def, one_mul]
+  exact B.norm_iterated_fderiv_within_le_of_bilinear_of_le_one hf hg hs hx hn hB
+#align norm_iterated_fderiv_within_clm_apply norm_iteratedFderivWithin_clm_apply
+
+theorem norm_iteratedFderiv_clm_apply {f : E β†’ F β†’L[π•œ] G} {g : E β†’ F} {N : β„•βˆž} {n : β„•}
+    (hf : ContDiff π•œ N f) (hg : ContDiff π•œ N g) (x : E) (hn : ↑n ≀ N) :
+    β€–iteratedFderiv π•œ n (fun y : E => (f y) (g y)) xβ€– ≀
+      (Finset.range (n + 1)).Sum fun i : β„• =>
+        ↑(n.choose i) * β€–iteratedFderiv π•œ i f xβ€– * β€–iteratedFderiv π•œ (n - i) g xβ€– :=
+  by
+  simp only [← iteratedFderivWithin_univ]
+  exact
+    norm_iteratedFderivWithin_clm_apply hf.cont_diff_on hg.cont_diff_on uniqueDiffOn_univ
+      (Set.mem_univ x) hn
+#align norm_iterated_fderiv_clm_apply norm_iteratedFderiv_clm_apply
+
+theorem norm_iteratedFderivWithin_clm_apply_const {f : E β†’ F β†’L[π•œ] G} {c : F} {s : Set E} {x : E}
+    {N : β„•βˆž} {n : β„•} (hf : ContDiffOn π•œ N f s) (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) (hn : ↑n ≀ N) :
+    β€–iteratedFderivWithin π•œ n (fun y : E => (f y) c) s xβ€– ≀
+      β€–cβ€– * β€–iteratedFderivWithin π•œ n f s xβ€– :=
+  by
+  let g : (F β†’L[π•œ] G) β†’L[π•œ] G := ContinuousLinearMap.apply π•œ G c
+  have h := g.norm_comp_continuous_multilinear_map_le (iteratedFderivWithin π•œ n f s x)
+  rw [← g.iterated_fderiv_within_comp_left hf hs hx hn] at h
+  refine' h.trans (mul_le_mul_of_nonneg_right _ (norm_nonneg _))
+  refine' g.op_norm_le_bound (norm_nonneg _) fun f => _
+  rw [ContinuousLinearMap.apply_apply, mul_comm]
+  exact f.le_op_norm c
+#align norm_iterated_fderiv_within_clm_apply_const norm_iteratedFderivWithin_clm_apply_const
+
+theorem norm_iteratedFderiv_clm_apply_const {f : E β†’ F β†’L[π•œ] G} {c : F} {x : E} {N : β„•βˆž} {n : β„•}
+    (hf : ContDiff π•œ N f) (hn : ↑n ≀ N) :
+    β€–iteratedFderiv π•œ n (fun y : E => (f y) c) xβ€– ≀ β€–cβ€– * β€–iteratedFderiv π•œ n f xβ€– :=
+  by
+  simp only [← iteratedFderivWithin_univ]
+  refine'
+    norm_iteratedFderivWithin_clm_apply_const hf.cont_diff_on uniqueDiffOn_univ (Set.mem_univ x) hn
+#align norm_iterated_fderiv_clm_apply_const norm_iteratedFderiv_clm_apply_const
+
+end Apply
+
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: SΓ©bastien GouΓ«zel, Floris van Doorn
 
 ! This file was ported from Lean 3 source module analysis.calculus.cont_diff
-! leanprover-community/mathlib commit 0187644979f2d3e10a06e916a869c994facd9a87
+! leanprover-community/mathlib commit 91862a6001a8b6ae3f261cdd8eea42f6ac596886
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -38,20 +38,80 @@ open Classical BigOperators NNReal
 -- mathport name: «expr∞»
 local notation "∞" => (⊀ : β„•βˆž)
 
-universe u v w uE uF uG
+universe u v w uD uE uF uG
 
 attribute [local instance]
   NormedAddCommGroup.toAddCommGroup NormedSpace.toModule' AddCommGroup.toAddCommMonoid
 
+namespace Finset
+
+-- TODO porting note: move the next two lemmas to the file `data.nat.choose.sum`
+/-- The sum of `(n+1).choose i * f i (n+1-i)` can be split into two sums at rank `n`,
+respectively of `n.choose i * f i (n+1-i)` and `n.choose i * f (i+1) (n-i)`. -/
+theorem sum_choose_succ_mul {R : Type _} [Semiring R] (f : β„• β†’ β„• β†’ R) (n : β„•) :
+    (βˆ‘ i in range (n + 2), ((n + 1).choose i : R) * f i (n + 1 - i)) =
+      (βˆ‘ i in range (n + 1), (n.choose i : R) * f i (n + 1 - i)) +
+        βˆ‘ i in range (n + 1), (n.choose i : R) * f (i + 1) (n - i) :=
+  by
+  have A :
+    (βˆ‘ i in range (n + 1), (n.choose (i + 1) : R) * f (i + 1) (n - i)) + f 0 (n + 1) =
+      βˆ‘ i in range (n + 1), n.choose i * f i (n + 1 - i) :=
+    by
+    rw [Finset.sum_range_succ, Finset.sum_range_succ']
+    simp only [Nat.choose_succ_self, algebraMap.coe_zero, MulZeroClass.zero_mul, add_zero,
+      Nat.succ_sub_succ_eq_sub, Nat.choose_zero_right, algebraMap.coe_one, one_mul, tsub_zero]
+  calc
+    (βˆ‘ i in Finset.range (n + 2), ((n + 1).choose i : R) * f i (n + 1 - i)) =
+        (βˆ‘ i in Finset.range (n + 1), ((n + 1).choose (i + 1) : R) * f (i + 1) (n + 1 - (i + 1))) +
+          f 0 (n + 1 - 0) :=
+      by
+      rw [Finset.sum_range_succ']
+      simp only [Nat.choose_zero_right, algebraMap.coe_one, one_mul]
+    _ =
+        (βˆ‘ i in Finset.range (n + 1), (n.choose i : R) * f i (n + 1 - i)) +
+          βˆ‘ i in Finset.range (n + 1), n.choose i * f (i + 1) (n - i) :=
+      by
+      simp only [Nat.choose_succ_succ, Nat.cast_add, Nat.succ_sub_succ_eq_sub, tsub_zero, add_mul]
+      rw [Finset.sum_add_distrib, ← A]
+      abel
+    
+#align finset.sum_choose_succ_mul Finset.sum_choose_succ_mul
+
+/-- The sum along the antidiagonal of `(n+1).choose i * f i j` can be split into two sums along the
+antidiagonal at rank `n`, respectively of `n.choose i * f i (j+1)` and `n.choose j * f (i+1) j`. -/
+theorem sum_antidiagonal_choose_succ_mul {R : Type _} [Semiring R] (f : β„• β†’ β„• β†’ R) (n : β„•) :
+    (βˆ‘ ij in Nat.antidiagonal (n + 1), ((n + 1).choose ij.1 : R) * f ij.1 ij.2) =
+      (βˆ‘ ij in Nat.antidiagonal n, (n.choose ij.1 : R) * f ij.1 (ij.2 + 1)) +
+        βˆ‘ ij in Nat.antidiagonal n, (n.choose ij.2 : R) * f (ij.1 + 1) ij.2 :=
+  by
+  convert sum_choose_succ_mul f n using 1
+  Β· exact nat.sum_antidiagonal_eq_sum_range_succ (fun i j => ((n + 1).choose i : R) * f i j) (n + 1)
+  congr 1
+  Β· rw [nat.sum_antidiagonal_eq_sum_range_succ (fun i j => (n.choose i : R) * f i (j + 1)) n]
+    apply Finset.sum_congr rfl fun i hi => _
+    have : n + 1 - i = n - i + 1 := Nat.sub_add_comm (Nat.lt_succ_iff.1 (Finset.mem_range.1 hi))
+    simp only [this]
+  Β· suffices H :
+      (βˆ‘ ij in nat.antidiagonal n, (n.choose ij.2 : R) * f (ij.1 + 1) ij.2) =
+        βˆ‘ ij in nat.antidiagonal n, (n.choose ij.1 : R) * f (ij.1 + 1) ij.2
+    Β· rw [H, nat.sum_antidiagonal_eq_sum_range_succ (fun i j => (n.choose i : R) * f (i + 1) j) n]
+    apply Finset.sum_congr rfl fun i hi => _
+    congr 2
+    apply Nat.choose_symm_of_eq_add
+    rw [← nat.mem_antidiagonal.1 hi, add_comm]
+#align finset.sum_antidiagonal_choose_succ_mul Finset.sum_antidiagonal_choose_succ_mul
+
+end Finset
+
 open Set Fin Filter Function
 
 open Topology
 
-variable {π•œ : Type _} [NontriviallyNormedField π•œ] {E : Type uE} [NormedAddCommGroup E]
-  [NormedSpace π•œ E] {F : Type uF} [NormedAddCommGroup F] [NormedSpace π•œ F] {G : Type uG}
-  [NormedAddCommGroup G] [NormedSpace π•œ G] {X : Type _} [NormedAddCommGroup X] [NormedSpace π•œ X]
-  {s s₁ t u : Set E} {f f₁ : E β†’ F} {g : F β†’ G} {x xβ‚€ : E} {c : F} {b : E Γ— F β†’ G} {m n : β„•βˆž}
-  {p : E β†’ FormalMultilinearSeries π•œ E F}
+variable {π•œ : Type _} [NontriviallyNormedField π•œ] {D : Type uD} [NormedAddCommGroup D]
+  [NormedSpace π•œ D] {E : Type uE} [NormedAddCommGroup E] [NormedSpace π•œ E] {F : Type uF}
+  [NormedAddCommGroup F] [NormedSpace π•œ F] {G : Type uG} [NormedAddCommGroup G] [NormedSpace π•œ G]
+  {X : Type _} [NormedAddCommGroup X] [NormedSpace π•œ X] {s s₁ t u : Set E} {f f₁ : E β†’ F}
+  {g : F β†’ G} {x xβ‚€ : E} {c : F} {b : E Γ— F β†’ G} {m n : β„•βˆž} {p : E β†’ FormalMultilinearSeries π•œ E F}
 
 /-! ### Constants -/
 
@@ -2398,3 +2458,322 @@ theorem ContDiff.restrict_scalars (h : ContDiff π•œ' n f) : ContDiff π•œ n f :
 
 end RestrictScalars
 
+/-!## Quantitative bounds -/
+
+
+/-- Bounding the norm of the iterated derivative of `B (f x) (g x)` within a set in terms of the
+iterated derivatives of `f` and `g` when `B` is bilinear. This lemma is an auxiliary version
+assuming all spaces live in the same universe, to enable an induction. Use instead
+`continuous_linear_map.norm_iterated_fderiv_within_le_of_bilinear` that removes this assumption. -/
+theorem ContinuousLinearMap.norm_iteratedFderivWithin_le_of_bilinear_aux {Du Eu Fu Gu : Type u}
+    [NormedAddCommGroup Du] [NormedSpace π•œ Du] [NormedAddCommGroup Eu] [NormedSpace π•œ Eu]
+    [NormedAddCommGroup Fu] [NormedSpace π•œ Fu] [NormedAddCommGroup Gu] [NormedSpace π•œ Gu]
+    (B : Eu β†’L[π•œ] Fu β†’L[π•œ] Gu) {f : Du β†’ Eu} {g : Du β†’ Fu} {n : β„•} {s : Set Du} {x : Du}
+    (hf : ContDiffOn π•œ n f s) (hg : ContDiffOn π•œ n g s) (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) :
+    β€–iteratedFderivWithin π•œ n (fun y => B (f y) (g y)) s xβ€– ≀
+      β€–Bβ€– *
+        βˆ‘ i in Finset.range (n + 1),
+          (n.choose i : ℝ) * β€–iteratedFderivWithin π•œ i f s xβ€– *
+            β€–iteratedFderivWithin π•œ (n - i) g s xβ€– :=
+  by
+  /- We argue by induction on `n`. The bound is trivial for `n = 0`. For `n + 1`, we write
+    the `(n+1)`-th derivative as the `n`-th derivative of the derivative `B f g' + B f' g`, and apply
+    the inductive assumption to each of those two terms. For this induction to make sense,
+    the spaces of linear maps that appear in the induction should be in the same universe as the
+    original spaces, which explains why we assume in the lemma that all spaces live in the same
+    universe. -/
+  induction' n with n IH generalizing Eu Fu Gu
+  Β· simp only [← mul_assoc, norm_iteratedFderivWithin_zero, Finset.range_one, Finset.sum_singleton,
+      Nat.choose_self, algebraMap.coe_one, one_mul]
+    apply ((B (f x)).le_op_norm (g x)).trans
+    apply mul_le_mul_of_nonneg_right _ (norm_nonneg _)
+    exact B.le_op_norm (f x)
+  Β· have In : (n : WithTop β„•) + 1 ≀ n.succ := by simp only [Nat.cast_succ, le_refl]
+    have I1 :
+      β€–iteratedFderivWithin π•œ n (fun y : Du => B.precompR Du (f y) (fderivWithin π•œ g s y)) s xβ€– ≀
+        β€–Bβ€– *
+          βˆ‘ i : β„• in Finset.range (n + 1),
+            n.choose i * β€–iteratedFderivWithin π•œ i f s xβ€– *
+              β€–iteratedFderivWithin π•œ (n + 1 - i) g s xβ€– :=
+      calc
+        β€–iteratedFderivWithin π•œ n (fun y : Du => B.precompR Du (f y) (fderivWithin π•œ g s y)) s xβ€– ≀
+            β€–B.precompR Duβ€– *
+              βˆ‘ i : β„• in Finset.range (n + 1),
+                n.choose i * β€–iteratedFderivWithin π•œ i f s xβ€– *
+                  β€–iteratedFderivWithin π•œ (n - i) (fderivWithin π•œ g s) s xβ€– :=
+          IH _ (hf.of_le (Nat.cast_le.2 (Nat.le_succ n))) (hg.fderiv_within hs In)
+        _ ≀
+            β€–Bβ€– *
+              βˆ‘ i : β„• in Finset.range (n + 1),
+                n.choose i * β€–iteratedFderivWithin π•œ i f s xβ€– *
+                  β€–iteratedFderivWithin π•œ (n - i) (fderivWithin π•œ g s) s xβ€– :=
+          (mul_le_mul_of_nonneg_right (B.norm_precompR_le Du)
+            (Finset.sum_nonneg' fun i => by positivity))
+        _ = _ := by
+          congr 1
+          apply Finset.sum_congr rfl fun i hi => _
+          rw [Nat.succ_sub (Nat.lt_succ_iff.1 (Finset.mem_range.1 hi)),
+            iteratedFderivWithin_succ_eq_comp_right hs hx, LinearIsometryEquiv.norm_map]
+        
+    have I2 :
+      β€–iteratedFderivWithin π•œ n (fun y : Du => B.precompL Du (fderivWithin π•œ f s y) (g y)) s xβ€– ≀
+        β€–Bβ€– *
+          βˆ‘ i : β„• in Finset.range (n + 1),
+            n.choose i * β€–iteratedFderivWithin π•œ (i + 1) f s xβ€– *
+              β€–iteratedFderivWithin π•œ (n - i) g s xβ€– :=
+      calc
+        β€–iteratedFderivWithin π•œ n (fun y : Du => B.precompL Du (fderivWithin π•œ f s y) (g y)) s xβ€– ≀
+            β€–B.precompL Duβ€– *
+              βˆ‘ i : β„• in Finset.range (n + 1),
+                n.choose i * β€–iteratedFderivWithin π•œ i (fderivWithin π•œ f s) s xβ€– *
+                  β€–iteratedFderivWithin π•œ (n - i) g s xβ€– :=
+          IH _ (hf.fderiv_within hs In) (hg.of_le (Nat.cast_le.2 (Nat.le_succ n)))
+        _ ≀
+            β€–Bβ€– *
+              βˆ‘ i : β„• in Finset.range (n + 1),
+                n.choose i * β€–iteratedFderivWithin π•œ i (fderivWithin π•œ f s) s xβ€– *
+                  β€–iteratedFderivWithin π•œ (n - i) g s xβ€– :=
+          (mul_le_mul_of_nonneg_right (B.norm_precompL_le Du)
+            (Finset.sum_nonneg' fun i => by positivity))
+        _ = _ := by
+          congr 1
+          apply Finset.sum_congr rfl fun i hi => _
+          rw [iteratedFderivWithin_succ_eq_comp_right hs hx, LinearIsometryEquiv.norm_map]
+        
+    have J :
+      iteratedFderivWithin π•œ n (fun y : Du => fderivWithin π•œ (fun y : Du => B (f y) (g y)) s y) s
+          x =
+        iteratedFderivWithin π•œ n
+          (fun y =>
+            B.precompR Du (f y) (fderivWithin π•œ g s y) + B.precompL Du (fderivWithin π•œ f s y) (g y))
+          s x :=
+      by
+      apply iteratedFderivWithin_congr hs (fun y hy => _) hx
+      have L : (1 : WithTop β„•) ≀ n.succ := by
+        simpa only [ENat.coe_one, Nat.one_le_cast] using Nat.succ_pos n
+      exact
+        B.fderiv_within_of_bilinear (hf.differentiable_on L y hy) (hg.differentiable_on L y hy)
+          (hs y hy)
+    rw [iteratedFderivWithin_succ_eq_comp_right hs hx, LinearIsometryEquiv.norm_map, J]
+    have A : ContDiffOn π•œ n (fun y => B.precompR Du (f y) (fderivWithin π•œ g s y)) s :=
+      (B.precompR Du).IsBoundedBilinearMap.ContDiff.comp_contDiff_onβ‚‚
+        (hf.of_le (Nat.cast_le.2 (Nat.le_succ n))) (hg.fderiv_within hs In)
+    have A' : ContDiffOn π•œ n (fun y => B.precompL Du (fderivWithin π•œ f s y) (g y)) s :=
+      (B.precompL Du).IsBoundedBilinearMap.ContDiff.comp_contDiff_onβ‚‚ (hf.fderiv_within hs In)
+        (hg.of_le (Nat.cast_le.2 (Nat.le_succ n)))
+    rw [iteratedFderivWithin_add_apply' A A' hs hx]
+    apply (norm_add_le _ _).trans ((add_le_add I1 I2).trans (le_of_eq _))
+    simp_rw [← mul_add, mul_assoc]
+    congr 1
+    exact
+      (Finset.sum_choose_succ_mul
+          (fun i j => β€–iteratedFderivWithin π•œ i f s xβ€– * β€–iteratedFderivWithin π•œ j g s xβ€–) n).symm
+#align continuous_linear_map.norm_iterated_fderiv_within_le_of_bilinear_aux ContinuousLinearMap.norm_iteratedFderivWithin_le_of_bilinear_aux
+
+/-- Bounding the norm of the iterated derivative of `B (f x) (g x)` within a set in terms of the
+iterated derivatives of `f` and `g` when `B` is bilinear:
+`β€–D^n (x ↦ B (f x) (g x))β€– ≀ β€–Bβ€– βˆ‘_{k ≀ n} n.choose k β€–D^k fβ€– β€–D^{n-k} gβ€–` -/
+theorem ContinuousLinearMap.norm_iteratedFderivWithin_le_of_bilinear (B : E β†’L[π•œ] F β†’L[π•œ] G)
+    {f : D β†’ E} {g : D β†’ F} {N : WithTop β„•} {s : Set D} {x : D} (hf : ContDiffOn π•œ N f s)
+    (hg : ContDiffOn π•œ N g s) (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) {n : β„•}
+    (hn : (n : WithTop β„•) ≀ N) :
+    β€–iteratedFderivWithin π•œ n (fun y => B (f y) (g y)) s xβ€– ≀
+      β€–Bβ€– *
+        βˆ‘ i in Finset.range (n + 1),
+          (n.choose i : ℝ) * β€–iteratedFderivWithin π•œ i f s xβ€– *
+            β€–iteratedFderivWithin π•œ (n - i) g s xβ€– :=
+  by
+  /- We reduce the bound to the case where all spaces live in the same universe (in which we
+    already have proved the result), by using linear isometries between the spaces and their `ulift`
+    to a common universe. These linear isometries preserve the norm of the iterated derivative. -/
+  let Du : Type max uD uE uF uG := ULift.{max uE uF uG, uD} D
+  let Eu : Type max uD uE uF uG := ULift.{max uD uF uG, uE} E
+  let Fu : Type max uD uE uF uG := ULift.{max uD uE uG, uF} F
+  let Gu : Type max uD uE uF uG := ULift.{max uD uE uF, uG} G
+  have isoD : Du ≃ₗᡒ[π•œ] D := LinearIsometryEquiv.ulift π•œ D
+  have isoE : Eu ≃ₗᡒ[π•œ] E := LinearIsometryEquiv.ulift π•œ E
+  have isoF : Fu ≃ₗᡒ[π•œ] F := LinearIsometryEquiv.ulift π•œ F
+  have isoG : Gu ≃ₗᡒ[π•œ] G := LinearIsometryEquiv.ulift π•œ G
+  -- lift `f` and `g` to versions `fu` and `gu` on the lifted spaces.
+  let fu : Du β†’ Eu := isoE.symm ∘ f ∘ isoD
+  let gu : Du β†’ Fu := isoF.symm ∘ g ∘ isoD
+  -- lift the bilinear map `B` to a bilinear map `Bu` on the lifted spaces.
+  let Buβ‚€ : Eu β†’L[π•œ] Fu β†’L[π•œ] G
+  exact ((B.comp (isoE : Eu β†’L[π•œ] E)).flip.comp (isoF : Fu β†’L[π•œ] F)).flip
+  let Bu : Eu β†’L[π•œ] Fu β†’L[π•œ] Gu
+  exact
+    ContinuousLinearMap.compL π•œ Eu (Fu β†’L[π•œ] G) (Fu β†’L[π•œ] Gu)
+      (ContinuousLinearMap.compL π•œ Fu G Gu (isoG.symm : G β†’L[π•œ] Gu)) Buβ‚€
+  have Bu_eq : (fun y => Bu (fu y) (gu y)) = isoG.symm ∘ (fun y => B (f y) (g y)) ∘ isoD :=
+    by
+    ext1 y
+    simp only [Bu, ContinuousLinearMap.compL_apply, Function.comp_apply,
+      ContinuousLinearMap.coe_comp', LinearIsometryEquiv.coe_coe'', ContinuousLinearMap.flip_apply,
+      LinearIsometryEquiv.apply_symm_apply]
+  -- All norms are preserved by the lifting process.
+  have Bu_le : β€–Buβ€– ≀ β€–Bβ€– :=
+    by
+    refine' ContinuousLinearMap.op_norm_le_bound _ (norm_nonneg _) fun y => _
+    refine' ContinuousLinearMap.op_norm_le_bound _ (by positivity) fun x => _
+    simp only [Bu, ContinuousLinearMap.compL_apply, ContinuousLinearMap.coe_comp',
+      Function.comp_apply, LinearIsometryEquiv.coe_coe'', ContinuousLinearMap.flip_apply,
+      LinearIsometryEquiv.norm_map]
+    calc
+      β€–B (isoE y) (isoF x)β€– ≀ β€–B (isoE y)β€– * β€–isoF xβ€– := ContinuousLinearMap.le_op_norm _ _
+      _ ≀ β€–Bβ€– * β€–isoE yβ€– * β€–isoF xβ€– :=
+        (mul_le_mul_of_nonneg_right (ContinuousLinearMap.le_op_norm _ _) (norm_nonneg _))
+      _ = β€–Bβ€– * β€–yβ€– * β€–xβ€– := by simp only [LinearIsometryEquiv.norm_map]
+      
+  let su := isoD ⁻¹' s
+  have hsu : UniqueDiffOn π•œ su := isoD.to_continuous_linear_equiv.unique_diff_on_preimage_iff.2 hs
+  let xu := isoD.symm x
+  have hxu : xu ∈ su := by
+    simpa only [Set.mem_preimage, LinearIsometryEquiv.apply_symm_apply] using hx
+  have xu_x : isoD xu = x := by simp only [LinearIsometryEquiv.apply_symm_apply]
+  have hfu : ContDiffOn π•œ n fu su :=
+    isoE.symm.cont_diff.comp_cont_diff_on
+      ((hf.of_le hn).compContinuousLinearMap (isoD : Du β†’L[π•œ] D))
+  have hgu : ContDiffOn π•œ n gu su :=
+    isoF.symm.cont_diff.comp_cont_diff_on
+      ((hg.of_le hn).compContinuousLinearMap (isoD : Du β†’L[π•œ] D))
+  have Nfu : βˆ€ i, β€–iteratedFderivWithin π•œ i fu su xuβ€– = β€–iteratedFderivWithin π•œ i f s xβ€– :=
+    by
+    intro i
+    rw [LinearIsometryEquiv.norm_iteratedFderivWithin_comp_left _ _ hsu hxu]
+    rw [LinearIsometryEquiv.norm_iteratedFderivWithin_comp_right _ _ hs, xu_x]
+    rwa [← xu_x] at hx
+  have Ngu : βˆ€ i, β€–iteratedFderivWithin π•œ i gu su xuβ€– = β€–iteratedFderivWithin π•œ i g s xβ€– :=
+    by
+    intro i
+    rw [LinearIsometryEquiv.norm_iteratedFderivWithin_comp_left _ _ hsu hxu]
+    rw [LinearIsometryEquiv.norm_iteratedFderivWithin_comp_right _ _ hs, xu_x]
+    rwa [← xu_x] at hx
+  have NBu :
+    β€–iteratedFderivWithin π•œ n (fun y => Bu (fu y) (gu y)) su xuβ€– =
+      β€–iteratedFderivWithin π•œ n (fun y => B (f y) (g y)) s xβ€– :=
+    by
+    rw [Bu_eq]
+    rw [LinearIsometryEquiv.norm_iteratedFderivWithin_comp_left _ _ hsu hxu]
+    rw [LinearIsometryEquiv.norm_iteratedFderivWithin_comp_right _ _ hs, xu_x]
+    rwa [← xu_x] at hx
+  -- state the bound for the lifted objects, and deduce the original bound from it.
+  have :
+    β€–iteratedFderivWithin π•œ n (fun y => Bu (fu y) (gu y)) su xuβ€– ≀
+      β€–Buβ€– *
+        βˆ‘ i in Finset.range (n + 1),
+          (n.choose i : ℝ) * β€–iteratedFderivWithin π•œ i fu su xuβ€– *
+            β€–iteratedFderivWithin π•œ (n - i) gu su xuβ€– :=
+    Bu.norm_iterated_fderiv_within_le_of_bilinear_aux hfu hgu hsu hxu
+  simp only [Nfu, Ngu, NBu] at this
+  apply this.trans (mul_le_mul_of_nonneg_right Bu_le _)
+  exact Finset.sum_nonneg' fun i => by positivity
+#align continuous_linear_map.norm_iterated_fderiv_within_le_of_bilinear ContinuousLinearMap.norm_iteratedFderivWithin_le_of_bilinear
+
+/-- Bounding the norm of the iterated derivative of `B (f x) (g x)` in terms of the
+iterated derivatives of `f` and `g` when `B` is bilinear:
+`β€–D^n (x ↦ B (f x) (g x))β€– ≀ β€–Bβ€– βˆ‘_{k ≀ n} n.choose k β€–D^k fβ€– β€–D^{n-k} gβ€–` -/
+theorem ContinuousLinearMap.norm_iteratedFderiv_le_of_bilinear (B : E β†’L[π•œ] F β†’L[π•œ] G) {f : D β†’ E}
+    {g : D β†’ F} {N : WithTop β„•} (hf : ContDiff π•œ N f) (hg : ContDiff π•œ N g) (x : D) {n : β„•}
+    (hn : (n : WithTop β„•) ≀ N) :
+    β€–iteratedFderiv π•œ n (fun y => B (f y) (g y)) xβ€– ≀
+      β€–Bβ€– *
+        βˆ‘ i in Finset.range (n + 1),
+          (n.choose i : ℝ) * β€–iteratedFderiv π•œ i f xβ€– * β€–iteratedFderiv π•œ (n - i) g xβ€– :=
+  by
+  simp_rw [← iteratedFderivWithin_univ]
+  exact
+    B.norm_iterated_fderiv_within_le_of_bilinear hf.cont_diff_on hg.cont_diff_on uniqueDiffOn_univ
+      (mem_univ x) hn
+#align continuous_linear_map.norm_iterated_fderiv_le_of_bilinear ContinuousLinearMap.norm_iteratedFderiv_le_of_bilinear
+
+/-- Bounding the norm of the iterated derivative of `B (f x) (g x)` within a set in terms of the
+iterated derivatives of `f` and `g` when `B` is bilinear of norm at most `1`:
+`β€–D^n (x ↦ B (f x) (g x))β€– ≀ βˆ‘_{k ≀ n} n.choose k β€–D^k fβ€– β€–D^{n-k} gβ€–` -/
+theorem ContinuousLinearMap.norm_iteratedFderivWithin_le_of_bilinear_of_le_one
+    (B : E β†’L[π•œ] F β†’L[π•œ] G) {f : D β†’ E} {g : D β†’ F} {N : WithTop β„•} {s : Set D} {x : D}
+    (hf : ContDiffOn π•œ N f s) (hg : ContDiffOn π•œ N g s) (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) {n : β„•}
+    (hn : (n : WithTop β„•) ≀ N) (hB : β€–Bβ€– ≀ 1) :
+    β€–iteratedFderivWithin π•œ n (fun y => B (f y) (g y)) s xβ€– ≀
+      βˆ‘ i in Finset.range (n + 1),
+        (n.choose i : ℝ) * β€–iteratedFderivWithin π•œ i f s xβ€– *
+          β€–iteratedFderivWithin π•œ (n - i) g s xβ€– :=
+  by
+  apply (B.norm_iterated_fderiv_within_le_of_bilinear hf hg hs hx hn).trans
+  apply mul_le_of_le_one_left (Finset.sum_nonneg' fun i => _) hB
+  positivity
+#align continuous_linear_map.norm_iterated_fderiv_within_le_of_bilinear_of_le_one ContinuousLinearMap.norm_iteratedFderivWithin_le_of_bilinear_of_le_one
+
+/-- Bounding the norm of the iterated derivative of `B (f x) (g x)` in terms of the
+iterated derivatives of `f` and `g` when `B` is bilinear of norm at most `1`:
+`β€–D^n (x ↦ B (f x) (g x))β€– ≀ βˆ‘_{k ≀ n} n.choose k β€–D^k fβ€– β€–D^{n-k} gβ€–` -/
+theorem ContinuousLinearMap.norm_iteratedFderiv_le_of_bilinear_of_le_one (B : E β†’L[π•œ] F β†’L[π•œ] G)
+    {f : D β†’ E} {g : D β†’ F} {N : WithTop β„•} (hf : ContDiff π•œ N f) (hg : ContDiff π•œ N g) (x : D)
+    {n : β„•} (hn : (n : WithTop β„•) ≀ N) (hB : β€–Bβ€– ≀ 1) :
+    β€–iteratedFderiv π•œ n (fun y => B (f y) (g y)) xβ€– ≀
+      βˆ‘ i in Finset.range (n + 1),
+        (n.choose i : ℝ) * β€–iteratedFderiv π•œ i f xβ€– * β€–iteratedFderiv π•œ (n - i) g xβ€– :=
+  by
+  simp_rw [← iteratedFderivWithin_univ]
+  exact
+    B.norm_iterated_fderiv_within_le_of_bilinear_of_le_one hf.cont_diff_on hg.cont_diff_on
+      uniqueDiffOn_univ (mem_univ x) hn hB
+#align continuous_linear_map.norm_iterated_fderiv_le_of_bilinear_of_le_one ContinuousLinearMap.norm_iteratedFderiv_le_of_bilinear_of_le_one
+
+section
+
+variable {π•œ' : Type _} [NormedField π•œ'] [NormedAlgebra π•œ π•œ'] [NormedSpace π•œ' F]
+  [IsScalarTower π•œ π•œ' F]
+
+theorem norm_iteratedFderivWithin_smul_le {f : E β†’ π•œ'} {g : E β†’ F} {N : WithTop β„•}
+    (hf : ContDiffOn π•œ N f s) (hg : ContDiffOn π•œ N g s) (hs : UniqueDiffOn π•œ s) {x : E} (hx : x ∈ s)
+    {n : β„•} (hn : (n : WithTop β„•) ≀ N) :
+    β€–iteratedFderivWithin π•œ n (fun y => f y β€’ g y) s xβ€– ≀
+      βˆ‘ i in Finset.range (n + 1),
+        (n.choose i : ℝ) * β€–iteratedFderivWithin π•œ i f s xβ€– *
+          β€–iteratedFderivWithin π•œ (n - i) g s xβ€– :=
+  (ContinuousLinearMap.lsmul π•œ π•œ' :
+        π•œ' β†’L[π•œ] F β†’L[π•œ] F).norm_iteratedFderivWithin_le_of_bilinear_of_le_one
+    hf hg hs hx hn ContinuousLinearMap.op_norm_lsmul_le
+#align norm_iterated_fderiv_within_smul_le norm_iteratedFderivWithin_smul_le
+
+theorem norm_iteratedFderiv_smul_le {f : E β†’ π•œ'} {g : E β†’ F} {N : WithTop β„•} (hf : ContDiff π•œ N f)
+    (hg : ContDiff π•œ N g) (x : E) {n : β„•} (hn : (n : WithTop β„•) ≀ N) :
+    β€–iteratedFderiv π•œ n (fun y => f y β€’ g y) xβ€– ≀
+      βˆ‘ i in Finset.range (n + 1),
+        (n.choose i : ℝ) * β€–iteratedFderiv π•œ i f xβ€– * β€–iteratedFderiv π•œ (n - i) g xβ€– :=
+  (ContinuousLinearMap.lsmul π•œ π•œ' : π•œ' β†’L[π•œ] F β†’L[π•œ] F).norm_iteratedFderiv_le_of_bilinear_of_le_one
+    hf hg x hn ContinuousLinearMap.op_norm_lsmul_le
+#align norm_iterated_fderiv_smul_le norm_iteratedFderiv_smul_le
+
+end
+
+section
+
+variable {A : Type _} [NormedRing A] [NormedAlgebra π•œ A]
+
+theorem norm_iteratedFderivWithin_mul_le {f : E β†’ A} {g : E β†’ A} {N : WithTop β„•}
+    (hf : ContDiffOn π•œ N f s) (hg : ContDiffOn π•œ N g s) (hs : UniqueDiffOn π•œ s) {x : E} (hx : x ∈ s)
+    {n : β„•} (hn : (n : WithTop β„•) ≀ N) :
+    β€–iteratedFderivWithin π•œ n (fun y => f y * g y) s xβ€– ≀
+      βˆ‘ i in Finset.range (n + 1),
+        (n.choose i : ℝ) * β€–iteratedFderivWithin π•œ i f s xβ€– *
+          β€–iteratedFderivWithin π•œ (n - i) g s xβ€– :=
+  (ContinuousLinearMap.mul π•œ A :
+        A β†’L[π•œ] A β†’L[π•œ] A).norm_iteratedFderivWithin_le_of_bilinear_of_le_one
+    hf hg hs hx hn (ContinuousLinearMap.op_norm_mul_le _ _)
+#align norm_iterated_fderiv_within_mul_le norm_iteratedFderivWithin_mul_le
+
+theorem norm_iteratedFderiv_mul_le {f : E β†’ A} {g : E β†’ A} {N : WithTop β„•} (hf : ContDiff π•œ N f)
+    (hg : ContDiff π•œ N g) (x : E) {n : β„•} (hn : (n : WithTop β„•) ≀ N) :
+    β€–iteratedFderiv π•œ n (fun y => f y * g y) xβ€– ≀
+      βˆ‘ i in Finset.range (n + 1),
+        (n.choose i : ℝ) * β€–iteratedFderiv π•œ i f xβ€– * β€–iteratedFderiv π•œ (n - i) g xβ€– :=
+  by
+  simp_rw [← iteratedFderivWithin_univ]
+  exact
+    norm_iteratedFderivWithin_mul_le hf.cont_diff_on hg.cont_diff_on uniqueDiffOn_univ (mem_univ x)
+      hn
+#align norm_iterated_fderiv_mul_le norm_iteratedFderiv_mul_le
+
+end
+
Diff
@@ -1,10 +1,10 @@
 /-
 Copyright (c) 2019 SΓ©bastien GouΓ«zel. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
-Authors: SΓ©bastien GouΓ«zel
+Authors: SΓ©bastien GouΓ«zel, Floris van Doorn
 
 ! This file was ported from Lean 3 source module analysis.calculus.cont_diff
-! leanprover-community/mathlib commit dd6388c44e6f6b4547070b887c5905d5cfe6c9f8
+! leanprover-community/mathlib commit 0187644979f2d3e10a06e916a869c994facd9a87
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
Diff
@@ -4,153 +4,19 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: SΓ©bastien GouΓ«zel
 
 ! This file was ported from Lean 3 source module analysis.calculus.cont_diff
-! leanprover-community/mathlib commit 8c8c544bf24ced19b1e76c34bb3262bdae620f82
+! leanprover-community/mathlib commit dd6388c44e6f6b4547070b887c5905d5cfe6c9f8
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
+import Mathbin.Analysis.Calculus.ContDiffDef
 import Mathbin.Analysis.Calculus.MeanValue
 import Mathbin.Analysis.NormedSpace.FiniteDimension
-import Mathbin.Analysis.NormedSpace.Multilinear
-import Mathbin.Analysis.Calculus.FormalMultilinearSeries
-import Mathbin.Data.Enat.Basic
-import Mathbin.Tactic.Congrm
 
 /-!
-# Higher differentiability
-
-A function is `C^1` on a domain if it is differentiable there, and its derivative is continuous.
-By induction, it is `C^n` if it is `C^{n-1}` and its (n-1)-th derivative is `C^1` there or,
-equivalently, if it is `C^1` and its derivative is `C^{n-1}`.
-Finally, it is `C^∞` if it is `C^n` for all n.
-
-We formalize these notions by defining iteratively the `n+1`-th derivative of a function as the
-derivative of the `n`-th derivative. It is called `iterated_fderiv π•œ n f x` where `π•œ` is the
-field, `n` is the number of iterations, `f` is the function and `x` is the point, and it is given
-as an `n`-multilinear map. We also define a version `iterated_fderiv_within` relative to a domain,
-as well as predicates `cont_diff_within_at`, `cont_diff_at`, `cont_diff_on` and
-`cont_diff` saying that the function is `C^n` within a set at a point, at a point, on a set
-and on the whole space respectively.
-
-To avoid the issue of choice when choosing a derivative in sets where the derivative is not
-necessarily unique, `cont_diff_on` is not defined directly in terms of the
-regularity of the specific choice `iterated_fderiv_within π•œ n f s` inside `s`, but in terms of the
-existence of a nice sequence of derivatives, expressed with a predicate
-`has_ftaylor_series_up_to_on`.
-
-We prove basic properties of these notions.
-
-## Main definitions and results
-Let `f : E β†’ F` be a map between normed vector spaces over a nontrivially normed field `π•œ`.
-
-* `has_ftaylor_series_up_to n f p`: expresses that the formal multilinear series `p` is a sequence
-  of iterated derivatives of `f`, up to the `n`-th term (where `n` is a natural number or `∞`).
-* `has_ftaylor_series_up_to_on n f p s`: same thing, but inside a set `s`. The notion of derivative
-  is now taken inside `s`. In particular, derivatives don't have to be unique.
-* `cont_diff π•œ n f`: expresses that `f` is `C^n`, i.e., it admits a Taylor series up to
-  rank `n`.
-* `cont_diff_on π•œ n f s`: expresses that `f` is `C^n` in `s`.
-* `cont_diff_at π•œ n f x`: expresses that `f` is `C^n` around `x`.
-* `cont_diff_within_at π•œ n f s x`: expresses that `f` is `C^n` around `x` within the set `s`.
-* `iterated_fderiv_within π•œ n f s x` is an `n`-th derivative of `f` over the field `π•œ` on the
-  set `s` at the point `x`. It is a continuous multilinear map from `E^n` to `F`, defined as a
-  derivative within `s` of `iterated_fderiv_within π•œ (n-1) f s` if one exists, and `0` otherwise.
-* `iterated_fderiv π•œ n f x` is the `n`-th derivative of `f` over the field `π•œ` at the point `x`.
-  It is a continuous multilinear map from `E^n` to `F`, defined as a derivative of
-  `iterated_fderiv π•œ (n-1) f` if one exists, and `0` otherwise.
-
-In sets of unique differentiability, `cont_diff_on π•œ n f s` can be expressed in terms of the
-properties of `iterated_fderiv_within π•œ m f s` for `m ≀ n`. In the whole space,
-`cont_diff π•œ n f` can be expressed in terms of the properties of `iterated_fderiv π•œ m f`
-for `m ≀ n`.
-
-We also prove that the usual operations (addition, multiplication, difference, composition, and
-so on) preserve `C^n` functions.
-
-## Implementation notes
-
-The definitions in this file are designed to work on any field `π•œ`. They are sometimes slightly more
-complicated than the naive definitions one would guess from the intuition over the real or complex
-numbers, but they are designed to circumvent the lack of gluing properties and partitions of unity
-in general. In the usual situations, they coincide with the usual definitions.
-
-### Definition of `C^n` functions in domains
-
-One could define `C^n` functions in a domain `s` by fixing an arbitrary choice of derivatives (this
-is what we do with `iterated_fderiv_within`) and requiring that all these derivatives up to `n` are
-continuous. If the derivative is not unique, this could lead to strange behavior like two `C^n`
-functions `f` and `g` on `s` whose sum is not `C^n`. A better definition is thus to say that a
-function is `C^n` inside `s` if it admits a sequence of derivatives up to `n` inside `s`.
-
-This definition still has the problem that a function which is locally `C^n` would not need to
-be `C^n`, as different choices of sequences of derivatives around different points might possibly
-not be glued together to give a globally defined sequence of derivatives. (Note that this issue
-can not happen over reals, thanks to partition of unity, but the behavior over a general field is
-not so clear, and we want a definition for general fields). Also, there are locality
-problems for the order parameter: one could image a function which, for each `n`, has a nice
-sequence of derivatives up to order `n`, but they do not coincide for varying `n` and can therefore
-not be glued to give rise to an infinite sequence of derivatives. This would give a function
-which is `C^n` for all `n`, but not `C^∞`. We solve this issue by putting locality conditions
-in space and order in our definition of `cont_diff_within_at` and `cont_diff_on`.
-The resulting definition is slightly more complicated to work with (in fact not so much), but it
-gives rise to completely satisfactory theorems.
-
-For instance, with this definition, a real function which is `C^m` (but not better) on `(-1/m, 1/m)`
-for each natural `m` is by definition `C^∞` at `0`.
-
-There is another issue with the definition of `cont_diff_within_at π•œ n f s x`. We can
-require the existence and good behavior of derivatives up to order `n` on a neighborhood of `x`
-within `s`. However, this does not imply continuity or differentiability within `s` of the function
-at `x` when `x` does not belong to `s`. Therefore, we require such existence and good behavior on
-a neighborhood of `x` within `s βˆͺ {x}` (which appears as `insert x s` in this file).
-
-### Side of the composition, and universe issues
-
-With a naΓ―ve direct definition, the `n`-th derivative of a function belongs to the space
-`E β†’L[π•œ] (E β†’L[π•œ] (E ... F)...)))` where there are n iterations of `E β†’L[π•œ]`. This space
-may also be seen as the space of continuous multilinear functions on `n` copies of `E` with
-values in `F`, by uncurrying. This is the point of view that is usually adopted in textbooks,
-and that we also use. This means that the definition and the first proofs are slightly involved,
-as one has to keep track of the uncurrying operation. The uncurrying can be done from the
-left or from the right, amounting to defining the `n+1`-th derivative either as the derivative of
-the `n`-th derivative, or as the `n`-th derivative of the derivative.
-For proofs, it would be more convenient to use the latter approach (from the right),
-as it means to prove things at the `n+1`-th step we only need to understand well enough the
-derivative in `E β†’L[π•œ] F` (contrary to the approach from the left, where one would need to know
-enough on the `n`-th derivative to deduce things on the `n+1`-th derivative).
-
-However, the definition from the right leads to a universe polymorphism problem: if we define
-`iterated_fderiv π•œ (n + 1) f x = iterated_fderiv π•œ n (fderiv π•œ f) x` by induction, we need to
-generalize over all spaces (as `f` and `fderiv π•œ f` don't take values in the same space). It is
-only possible to generalize over all spaces in some fixed universe in an inductive definition.
-For `f : E β†’ F`, then `fderiv π•œ f` is a map `E β†’ (E β†’L[π•œ] F)`. Therefore, the definition will only
-work if `F` and `E β†’L[π•œ] F` are in the same universe.
-
-This issue does not appear with the definition from the left, where one does not need to generalize
-over all spaces. Therefore, we use the definition from the left. This means some proofs later on
-become a little bit more complicated: to prove that a function is `C^n`, the most efficient approach
-is to exhibit a formula for its `n`-th derivative and prove it is continuous (contrary to the
-inductive approach where one would prove smoothness statements without giving a formula for the
-derivative). In the end, this approach is still satisfactory as it is good to have formulas for the
-iterated derivatives in various constructions.
-
-One point where we depart from this explicit approach is in the proof of smoothness of a
-composition: there is a formula for the `n`-th derivative of a composition (FaΓ  di Bruno's formula),
-but it is very complicated and barely usable, while the inductive proof is very simple. Thus, we
-give the inductive proof. As explained above, it works by generalizing over the target space, hence
-it only works well if all spaces belong to the same universe. To get the general version, we lift
-things to a common universe using a trick.
-
-### Variables management
-
-The textbook definitions and proofs use various identifications and abuse of notations, for instance
-when saying that the natural space in which the derivative lives, i.e.,
-`E β†’L[π•œ] (E β†’L[π•œ] ( ... β†’L[π•œ] F))`, is the same as a space of multilinear maps. When doing things
-formally, we need to provide explicit maps for these identifications, and chase some diagrams to see
-everything is compatible with the identifications. In particular, one needs to check that taking the
-derivative and then doing the identification, or first doing the identification and then taking the
-derivative, gives the same result. The key point for this is that taking the derivative commutes
-with continuous linear equivalences. Therefore, we need to implement all our identifications with
-continuous linear equivs.
+# Higher differentiability of usual operations
+
+We prove that the usual operations (addition, multiplication, difference, composition, and
+so on) preserve `C^n` functions. We also expand the API aound `C^n` functions.
 
 ## Notations
 
@@ -172,7 +38,7 @@ open Classical BigOperators NNReal
 -- mathport name: «expr∞»
 local notation "∞" => (⊀ : β„•βˆž)
 
-universe u v w
+universe u v w uE uF uG
 
 attribute [local instance]
   NormedAddCommGroup.toAddCommGroup NormedSpace.toModule' AddCommGroup.toAddCommMonoid
@@ -181,1565 +47,11 @@ open Set Fin Filter Function
 
 open Topology
 
-variable {π•œ : Type _} [NontriviallyNormedField π•œ] {E : Type _} [NormedAddCommGroup E]
-  [NormedSpace π•œ E] {F : Type _} [NormedAddCommGroup F] [NormedSpace π•œ F] {G : Type _}
+variable {π•œ : Type _} [NontriviallyNormedField π•œ] {E : Type uE} [NormedAddCommGroup E]
+  [NormedSpace π•œ E] {F : Type uF} [NormedAddCommGroup F] [NormedSpace π•œ F] {G : Type uG}
   [NormedAddCommGroup G] [NormedSpace π•œ G] {X : Type _} [NormedAddCommGroup X] [NormedSpace π•œ X]
   {s s₁ t u : Set E} {f f₁ : E β†’ F} {g : F β†’ G} {x xβ‚€ : E} {c : F} {b : E Γ— F β†’ G} {m n : β„•βˆž}
-
-/-! ### Functions with a Taylor series on a domain -/
-
-
-variable {p : E β†’ FormalMultilinearSeries π•œ E F}
-
-/-- `has_ftaylor_series_up_to_on n f p s` registers the fact that `p 0 = f` and `p (m+1)` is a
-derivative of `p m` for `m < n`, and is continuous for `m ≀ n`. This is a predicate analogous to
-`has_fderiv_within_at` but for higher order derivatives. -/
-structure HasFtaylorSeriesUpToOn (n : β„•βˆž) (f : E β†’ F) (p : E β†’ FormalMultilinearSeries π•œ E F)
-  (s : Set E) : Prop where
-  zero_eq : βˆ€ x ∈ s, (p x 0).uncurry0 = f x
-  fderivWithin :
-    βˆ€ (m : β„•) (hm : (m : β„•βˆž) < n),
-      βˆ€ x ∈ s, HasFderivWithinAt (fun y => p y m) (p x m.succ).curryLeft s x
-  cont : βˆ€ (m : β„•) (hm : (m : β„•βˆž) ≀ n), ContinuousOn (fun x => p x m) s
-#align has_ftaylor_series_up_to_on HasFtaylorSeriesUpToOn
-
-theorem HasFtaylorSeriesUpToOn.zero_eq' (h : HasFtaylorSeriesUpToOn n f p s) {x : E} (hx : x ∈ s) :
-    p x 0 = (continuousMultilinearCurryFin0 π•œ E F).symm (f x) :=
-  by
-  rw [← h.zero_eq x hx]
-  symm
-  exact ContinuousMultilinearMap.uncurry0_curry0 _
-#align has_ftaylor_series_up_to_on.zero_eq' HasFtaylorSeriesUpToOn.zero_eq'
-
-/-- If two functions coincide on a set `s`, then a Taylor series for the first one is as well a
-Taylor series for the second one. -/
-theorem HasFtaylorSeriesUpToOn.congr (h : HasFtaylorSeriesUpToOn n f p s)
-    (h₁ : βˆ€ x ∈ s, f₁ x = f x) : HasFtaylorSeriesUpToOn n f₁ p s :=
-  by
-  refine' ⟨fun x hx => _, h.fderiv_within, h.cont⟩
-  rw [h₁ x hx]
-  exact h.zero_eq x hx
-#align has_ftaylor_series_up_to_on.congr HasFtaylorSeriesUpToOn.congr
-
-theorem HasFtaylorSeriesUpToOn.mono (h : HasFtaylorSeriesUpToOn n f p s) {t : Set E} (hst : t βŠ† s) :
-    HasFtaylorSeriesUpToOn n f p t :=
-  ⟨fun x hx => h.zero_eq x (hst hx), fun m hm x hx => (h.fderivWithin m hm x (hst hx)).mono hst,
-    fun m hm => (h.cont m hm).mono hst⟩
-#align has_ftaylor_series_up_to_on.mono HasFtaylorSeriesUpToOn.mono
-
-theorem HasFtaylorSeriesUpToOn.ofLe (h : HasFtaylorSeriesUpToOn n f p s) (hmn : m ≀ n) :
-    HasFtaylorSeriesUpToOn m f p s :=
-  ⟨h.zero_eq, fun k hk x hx => h.fderivWithin k (lt_of_lt_of_le hk hmn) x hx, fun k hk =>
-    h.cont k (le_trans hk hmn)⟩
-#align has_ftaylor_series_up_to_on.of_le HasFtaylorSeriesUpToOn.ofLe
-
-theorem HasFtaylorSeriesUpToOn.continuousOn (h : HasFtaylorSeriesUpToOn n f p s) :
-    ContinuousOn f s :=
-  by
-  have := (h.cont 0 bot_le).congr fun x hx => (h.zero_eq' hx).symm
-  rwa [LinearIsometryEquiv.comp_continuousOn_iff] at this
-#align has_ftaylor_series_up_to_on.continuous_on HasFtaylorSeriesUpToOn.continuousOn
-
-theorem hasFtaylorSeriesUpToOn_zero_iff :
-    HasFtaylorSeriesUpToOn 0 f p s ↔ ContinuousOn f s ∧ βˆ€ x ∈ s, (p x 0).uncurry0 = f x :=
-  by
-  refine'
-    ⟨fun H => ⟨H.ContinuousOn, H.zero_eq⟩, fun H =>
-      ⟨H.2, fun m hm => False.elim (not_le.2 hm bot_le), _⟩⟩
-  intro m hm
-  obtain rfl : m = 0 := by exact_mod_cast hm.antisymm (zero_le _)
-  have : βˆ€ x ∈ s, p x 0 = (continuousMultilinearCurryFin0 π•œ E F).symm (f x) :=
-    by
-    intro x hx
-    rw [← H.2 x hx]
-    symm
-    exact ContinuousMultilinearMap.uncurry0_curry0 _
-  rw [continuousOn_congr this, LinearIsometryEquiv.comp_continuousOn_iff]
-  exact H.1
-#align has_ftaylor_series_up_to_on_zero_iff hasFtaylorSeriesUpToOn_zero_iff
-
-theorem hasFtaylorSeriesUpToOn_top_iff :
-    HasFtaylorSeriesUpToOn ∞ f p s ↔ βˆ€ n : β„•, HasFtaylorSeriesUpToOn n f p s :=
-  by
-  constructor
-  Β· intro H n
-    exact H.of_le le_top
-  Β· intro H
-    constructor
-    Β· exact (H 0).zero_eq
-    Β· intro m hm
-      apply (H m.succ).fderivWithin m (WithTop.coe_lt_coe.2 (lt_add_one m))
-    Β· intro m hm
-      apply (H m).cont m le_rfl
-#align has_ftaylor_series_up_to_on_top_iff hasFtaylorSeriesUpToOn_top_iff
-
-/-- If a function has a Taylor series at order at least `1`, then the term of order `1` of this
-series is a derivative of `f`. -/
-theorem HasFtaylorSeriesUpToOn.hasFderivWithinAt (h : HasFtaylorSeriesUpToOn n f p s) (hn : 1 ≀ n)
-    (hx : x ∈ s) : HasFderivWithinAt f (continuousMultilinearCurryFin1 π•œ E F (p x 1)) s x :=
-  by
-  have A : βˆ€ y ∈ s, f y = (continuousMultilinearCurryFin0 π•œ E F) (p y 0) :=
-    by
-    intro y hy
-    rw [← h.zero_eq y hy]
-    rfl
-  suffices H :
-    HasFderivWithinAt (fun y => continuousMultilinearCurryFin0 π•œ E F (p y 0))
-      (continuousMultilinearCurryFin1 π•œ E F (p x 1)) s x
-  Β· exact H.congr A (A x hx)
-  rw [LinearIsometryEquiv.comp_hasFderivWithinAt_iff']
-  have : ((0 : β„•) : β„•βˆž) < n := lt_of_lt_of_le (WithTop.coe_lt_coe.2 Nat.zero_lt_one) hn
-  convert h.fderiv_within _ this x hx
-  ext (y v)
-  change (p x 1) (snoc 0 y) = (p x 1) (cons y v)
-  unfold_coes
-  congr with i
-  rw [Unique.eq_default i]
-  rfl
-#align has_ftaylor_series_up_to_on.has_fderiv_within_at HasFtaylorSeriesUpToOn.hasFderivWithinAt
-
-theorem HasFtaylorSeriesUpToOn.differentiableOn (h : HasFtaylorSeriesUpToOn n f p s) (hn : 1 ≀ n) :
-    DifferentiableOn π•œ f s := fun x hx => (h.HasFderivWithinAt hn hx).DifferentiableWithinAt
-#align has_ftaylor_series_up_to_on.differentiable_on HasFtaylorSeriesUpToOn.differentiableOn
-
-/-- If a function has a Taylor series at order at least `1` on a neighborhood of `x`, then the term
-of order `1` of this series is a derivative of `f` at `x`. -/
-theorem HasFtaylorSeriesUpToOn.hasFderivAt (h : HasFtaylorSeriesUpToOn n f p s) (hn : 1 ≀ n)
-    (hx : s ∈ 𝓝 x) : HasFderivAt f (continuousMultilinearCurryFin1 π•œ E F (p x 1)) x :=
-  (h.HasFderivWithinAt hn (mem_of_mem_nhds hx)).HasFderivAt hx
-#align has_ftaylor_series_up_to_on.has_fderiv_at HasFtaylorSeriesUpToOn.hasFderivAt
-
-/-- If a function has a Taylor series at order at least `1` on a neighborhood of `x`, then
-in a neighborhood of `x`, the term of order `1` of this series is a derivative of `f`. -/
-theorem HasFtaylorSeriesUpToOn.eventually_hasFderivAt (h : HasFtaylorSeriesUpToOn n f p s)
-    (hn : 1 ≀ n) (hx : s ∈ 𝓝 x) :
-    βˆ€αΆ  y in 𝓝 x, HasFderivAt f (continuousMultilinearCurryFin1 π•œ E F (p y 1)) y :=
-  (eventually_eventually_nhds.2 hx).mono fun y hy => h.HasFderivAt hn hy
-#align has_ftaylor_series_up_to_on.eventually_has_fderiv_at HasFtaylorSeriesUpToOn.eventually_hasFderivAt
-
-/-- If a function has a Taylor series at order at least `1` on a neighborhood of `x`, then
-it is differentiable at `x`. -/
-theorem HasFtaylorSeriesUpToOn.differentiableAt (h : HasFtaylorSeriesUpToOn n f p s) (hn : 1 ≀ n)
-    (hx : s ∈ 𝓝 x) : DifferentiableAt π•œ f x :=
-  (h.HasFderivAt hn hx).DifferentiableAt
-#align has_ftaylor_series_up_to_on.differentiable_at HasFtaylorSeriesUpToOn.differentiableAt
-
-/-- `p` is a Taylor series of `f` up to `n+1` if and only if `p` is a Taylor series up to `n`, and
-`p (n + 1)` is a derivative of `p n`. -/
-theorem hasFtaylorSeriesUpToOn_succ_iff_left {n : β„•} :
-    HasFtaylorSeriesUpToOn (n + 1) f p s ↔
-      HasFtaylorSeriesUpToOn n f p s ∧
-        (βˆ€ x ∈ s, HasFderivWithinAt (fun y => p y n) (p x n.succ).curryLeft s x) ∧
-          ContinuousOn (fun x => p x (n + 1)) s :=
-  by
-  constructor
-  Β· intro h
-    exact
-      ⟨h.of_le (WithTop.coe_le_coe.2 (Nat.le_succ n)),
-        h.fderiv_within _ (WithTop.coe_lt_coe.2 (lt_add_one n)), h.cont (n + 1) le_rfl⟩
-  Β· intro h
-    constructor
-    Β· exact h.1.zero_eq
-    Β· intro m hm
-      by_cases h' : m < n
-      Β· exact h.1.fderivWithin m (WithTop.coe_lt_coe.2 h')
-      Β· have : m = n := Nat.eq_of_lt_succ_of_not_lt (WithTop.coe_lt_coe.1 hm) h'
-        rw [this]
-        exact h.2.1
-    Β· intro m hm
-      by_cases h' : m ≀ n
-      Β· apply h.1.cont m (WithTop.coe_le_coe.2 h')
-      Β· have : m = n + 1 := le_antisymm (WithTop.coe_le_coe.1 hm) (not_le.1 h')
-        rw [this]
-        exact h.2.2
-#align has_ftaylor_series_up_to_on_succ_iff_left hasFtaylorSeriesUpToOn_succ_iff_left
-
-/-- `p` is a Taylor series of `f` up to `n+1` if and only if `p.shift` is a Taylor series up to `n`
-for `p 1`, which is a derivative of `f`. -/
-theorem hasFtaylorSeriesUpToOn_succ_iff_right {n : β„•} :
-    HasFtaylorSeriesUpToOn (n + 1 : β„•) f p s ↔
-      (βˆ€ x ∈ s, (p x 0).uncurry0 = f x) ∧
-        (βˆ€ x ∈ s, HasFderivWithinAt (fun y => p y 0) (p x 1).curryLeft s x) ∧
-          HasFtaylorSeriesUpToOn n (fun x => continuousMultilinearCurryFin1 π•œ E F (p x 1))
-            (fun x => (p x).shift) s :=
-  by
-  constructor
-  Β· intro H
-    refine' ⟨H.zero_eq, H.fderiv_within 0 (WithTop.coe_lt_coe.2 (Nat.succ_pos n)), _⟩
-    constructor
-    Β· intro x hx
-      rfl
-    Β· intro m(hm : (m : β„•βˆž) < n)x(hx : x ∈ s)
-      have A : (m.succ : β„•βˆž) < n.succ :=
-        by
-        rw [WithTop.coe_lt_coe] at hm⊒
-        exact nat.lt_succ_iff.mpr hm
-      change
-        HasFderivWithinAt
-          ((continuousMultilinearCurryRightEquiv' π•œ m E F).symm ∘ fun y : E => p y m.succ)
-          (p x m.succ.succ).curryRight.curryLeft s x
-      rw [LinearIsometryEquiv.comp_hasFderivWithinAt_iff']
-      convert H.fderiv_within _ A x hx
-      ext (y v)
-      change
-        (p x m.succ.succ) (snoc (cons y (init v)) (v (last _))) =
-          (p x (Nat.succ (Nat.succ m))) (cons y v)
-      rw [← cons_snoc_eq_snoc_cons, snoc_init_self]
-    Β· intro m(hm : (m : β„•βˆž) ≀ n)
-      have A : (m.succ : β„•βˆž) ≀ n.succ :=
-        by
-        rw [WithTop.coe_le_coe] at hm⊒
-        exact nat.pred_le_iff.mp hm
-      change
-        ContinuousOn
-          ((continuousMultilinearCurryRightEquiv' π•œ m E F).symm ∘ fun y : E => p y m.succ) s
-      rw [LinearIsometryEquiv.comp_continuousOn_iff]
-      exact H.cont _ A
-  · rintro ⟨Hzero_eq, Hfderiv_zero, Htaylor⟩
-    constructor
-    Β· exact Hzero_eq
-    Β· intro m(hm : (m : β„•βˆž) < n.succ)x(hx : x ∈ s)
-      cases m
-      Β· exact Hfderiv_zero x hx
-      Β· have A : (m : β„•βˆž) < n := by
-          rw [WithTop.coe_lt_coe] at hm⊒
-          exact Nat.lt_of_succ_lt_succ hm
-        have :
-          HasFderivWithinAt
-            ((continuousMultilinearCurryRightEquiv' π•œ m E F).symm ∘ fun y : E => p y m.succ)
-            ((p x).shift m.succ).curryLeft s x :=
-          Htaylor.fderiv_within _ A x hx
-        rw [LinearIsometryEquiv.comp_hasFderivWithinAt_iff'] at this
-        convert this
-        ext (y v)
-        change
-          (p x (Nat.succ (Nat.succ m))) (cons y v) =
-            (p x m.succ.succ) (snoc (cons y (init v)) (v (last _)))
-        rw [← cons_snoc_eq_snoc_cons, snoc_init_self]
-    Β· intro m(hm : (m : β„•βˆž) ≀ n.succ)
-      cases m
-      Β· have : DifferentiableOn π•œ (fun x => p x 0) s := fun x hx =>
-          (Hfderiv_zero x hx).DifferentiableWithinAt
-        exact this.continuous_on
-      Β· have A : (m : β„•βˆž) ≀ n := by
-          rw [WithTop.coe_le_coe] at hm⊒
-          exact nat.lt_succ_iff.mp hm
-        have :
-          ContinuousOn
-            ((continuousMultilinearCurryRightEquiv' π•œ m E F).symm ∘ fun y : E => p y m.succ) s :=
-          Htaylor.cont _ A
-        rwa [LinearIsometryEquiv.comp_continuousOn_iff] at this
-#align has_ftaylor_series_up_to_on_succ_iff_right hasFtaylorSeriesUpToOn_succ_iff_right
-
-/-! ### Smooth functions within a set around a point -/
-
-
-variable (π•œ)
-
-/-- A function is continuously differentiable up to order `n` within a set `s` at a point `x` if
-it admits continuous derivatives up to order `n` in a neighborhood of `x` in `s βˆͺ {x}`.
-For `n = ∞`, we only require that this holds up to any finite order (where the neighborhood may
-depend on the finite order we consider).
-
-For instance, a real function which is `C^m` on `(-1/m, 1/m)` for each natural `m`, but not
-better, is `C^∞` at `0` within `univ`.
--/
-def ContDiffWithinAt (n : β„•βˆž) (f : E β†’ F) (s : Set E) (x : E) : Prop :=
-  βˆ€ m : β„•,
-    (m : β„•βˆž) ≀ n β†’
-      βˆƒ u ∈ 𝓝[insert x s] x, βˆƒ p : E β†’ FormalMultilinearSeries π•œ E F, HasFtaylorSeriesUpToOn m f p u
-#align cont_diff_within_at ContDiffWithinAt
-
-variable {π•œ}
-
-theorem contDiffWithinAt_nat {n : β„•} :
-    ContDiffWithinAt π•œ n f s x ↔
-      βˆƒ u ∈ 𝓝[insert x s] x,
-        βˆƒ p : E β†’ FormalMultilinearSeries π•œ E F, HasFtaylorSeriesUpToOn n f p u :=
-  ⟨fun H => H n le_rfl, fun ⟨u, hu, p, hp⟩ m hm => ⟨u, hu, p, hp.of_le hm⟩⟩
-#align cont_diff_within_at_nat contDiffWithinAt_nat
-
-theorem ContDiffWithinAt.of_le (h : ContDiffWithinAt π•œ n f s x) (hmn : m ≀ n) :
-    ContDiffWithinAt π•œ m f s x := fun k hk => h k (le_trans hk hmn)
-#align cont_diff_within_at.of_le ContDiffWithinAt.of_le
-
-theorem contDiffWithinAt_iff_forall_nat_le :
-    ContDiffWithinAt π•œ n f s x ↔ βˆ€ m : β„•, ↑m ≀ n β†’ ContDiffWithinAt π•œ m f s x :=
-  ⟨fun H m hm => H.of_le hm, fun H m hm => H m hm _ le_rfl⟩
-#align cont_diff_within_at_iff_forall_nat_le contDiffWithinAt_iff_forall_nat_le
-
-theorem contDiffWithinAt_top : ContDiffWithinAt π•œ ∞ f s x ↔ βˆ€ n : β„•, ContDiffWithinAt π•œ n f s x :=
-  contDiffWithinAt_iff_forall_nat_le.trans <| by simp only [forall_prop_of_true, le_top]
-#align cont_diff_within_at_top contDiffWithinAt_top
-
-theorem ContDiffWithinAt.continuousWithinAt (h : ContDiffWithinAt π•œ n f s x) :
-    ContinuousWithinAt f s x :=
-  by
-  rcases h 0 bot_le with ⟨u, hu, p, H⟩
-  rw [mem_nhdsWithin_insert] at hu
-  exact (H.continuous_on.continuous_within_at hu.1).mono_of_mem hu.2
-#align cont_diff_within_at.continuous_within_at ContDiffWithinAt.continuousWithinAt
-
-theorem ContDiffWithinAt.congr_of_eventuallyEq (h : ContDiffWithinAt π•œ n f s x)
-    (h₁ : f₁ =αΆ [𝓝[s] x] f) (hx : f₁ x = f x) : ContDiffWithinAt π•œ n f₁ s x := fun m hm =>
-  let ⟨u, hu, p, H⟩ := h m hm
-  ⟨{ x ∈ u | f₁ x = f x }, Filter.inter_mem hu (mem_nhdsWithin_insert.2 ⟨hx, hβ‚βŸ©), p,
-    (H.mono (sep_subset _ _)).congr fun _ => And.right⟩
-#align cont_diff_within_at.congr_of_eventually_eq ContDiffWithinAt.congr_of_eventuallyEq
-
-theorem ContDiffWithinAt.congr_of_eventuallyEq_insert (h : ContDiffWithinAt π•œ n f s x)
-    (h₁ : f₁ =αΆ [𝓝[insert x s] x] f) : ContDiffWithinAt π•œ n f₁ s x :=
-  h.congr_of_eventuallyEq (nhdsWithin_mono x (subset_insert x s) h₁)
-    (mem_of_mem_nhdsWithin (mem_insert x s) h₁ : _)
-#align cont_diff_within_at.congr_of_eventually_eq_insert ContDiffWithinAt.congr_of_eventuallyEq_insert
-
-theorem ContDiffWithinAt.congr_of_eventually_eq' (h : ContDiffWithinAt π•œ n f s x)
-    (h₁ : f₁ =αΆ [𝓝[s] x] f) (hx : x ∈ s) : ContDiffWithinAt π•œ n f₁ s x :=
-  h.congr_of_eventuallyEq h₁ <| h₁.self_of_nhdsWithin hx
-#align cont_diff_within_at.congr_of_eventually_eq' ContDiffWithinAt.congr_of_eventually_eq'
-
-theorem Filter.EventuallyEq.contDiffWithinAt_iff (h₁ : f₁ =αΆ [𝓝[s] x] f) (hx : f₁ x = f x) :
-    ContDiffWithinAt π•œ n f₁ s x ↔ ContDiffWithinAt π•œ n f s x :=
-  ⟨fun H => ContDiffWithinAt.congr_of_eventuallyEq H h₁.symm hx.symm, fun H =>
-    H.congr_of_eventuallyEq h₁ hx⟩
-#align filter.eventually_eq.cont_diff_within_at_iff Filter.EventuallyEq.contDiffWithinAt_iff
-
-theorem ContDiffWithinAt.congr (h : ContDiffWithinAt π•œ n f s x) (h₁ : βˆ€ y ∈ s, f₁ y = f y)
-    (hx : f₁ x = f x) : ContDiffWithinAt π•œ n f₁ s x :=
-  h.congr_of_eventuallyEq (Filter.eventuallyEq_of_mem self_mem_nhdsWithin h₁) hx
-#align cont_diff_within_at.congr ContDiffWithinAt.congr
-
-theorem ContDiffWithinAt.congr' (h : ContDiffWithinAt π•œ n f s x) (h₁ : βˆ€ y ∈ s, f₁ y = f y)
-    (hx : x ∈ s) : ContDiffWithinAt π•œ n f₁ s x :=
-  h.congr h₁ (h₁ _ hx)
-#align cont_diff_within_at.congr' ContDiffWithinAt.congr'
-
-theorem ContDiffWithinAt.mono_of_mem (h : ContDiffWithinAt π•œ n f s x) {t : Set E}
-    (hst : s ∈ 𝓝[t] x) : ContDiffWithinAt π•œ n f t x :=
-  by
-  intro m hm
-  rcases h m hm with ⟨u, hu, p, H⟩
-  exact ⟨u, nhdsWithin_le_of_mem (insert_mem_nhdsWithin_insert hst) hu, p, H⟩
-#align cont_diff_within_at.mono_of_mem ContDiffWithinAt.mono_of_mem
-
-theorem ContDiffWithinAt.mono (h : ContDiffWithinAt π•œ n f s x) {t : Set E} (hst : t βŠ† s) :
-    ContDiffWithinAt π•œ n f t x :=
-  h.mono_of_mem <| Filter.mem_of_superset self_mem_nhdsWithin hst
-#align cont_diff_within_at.mono ContDiffWithinAt.mono
-
-theorem ContDiffWithinAt.congr_nhds (h : ContDiffWithinAt π•œ n f s x) {t : Set E}
-    (hst : 𝓝[s] x = 𝓝[t] x) : ContDiffWithinAt π•œ n f t x :=
-  h.mono_of_mem <| hst β–Έ self_mem_nhdsWithin
-#align cont_diff_within_at.congr_nhds ContDiffWithinAt.congr_nhds
-
-theorem contDiffWithinAt_congr_nhds {t : Set E} (hst : 𝓝[s] x = 𝓝[t] x) :
-    ContDiffWithinAt π•œ n f s x ↔ ContDiffWithinAt π•œ n f t x :=
-  ⟨fun h => h.congr_nhds hst, fun h => h.congr_nhds hst.symm⟩
-#align cont_diff_within_at_congr_nhds contDiffWithinAt_congr_nhds
-
-theorem contDiffWithinAt_inter' (h : t ∈ 𝓝[s] x) :
-    ContDiffWithinAt π•œ n f (s ∩ t) x ↔ ContDiffWithinAt π•œ n f s x :=
-  contDiffWithinAt_congr_nhds <| Eq.symm <| nhdsWithin_restrict'' _ h
-#align cont_diff_within_at_inter' contDiffWithinAt_inter'
-
-theorem contDiffWithinAt_inter (h : t ∈ 𝓝 x) :
-    ContDiffWithinAt π•œ n f (s ∩ t) x ↔ ContDiffWithinAt π•œ n f s x :=
-  contDiffWithinAt_inter' (mem_nhdsWithin_of_mem_nhds h)
-#align cont_diff_within_at_inter contDiffWithinAt_inter
-
-theorem contDiffWithinAt_insert {y : E} :
-    ContDiffWithinAt π•œ n f (insert y s) x ↔ ContDiffWithinAt π•œ n f s x :=
-  by
-  simp_rw [ContDiffWithinAt]
-  rcases eq_or_ne x y with (rfl | h)
-  Β· simp_rw [insert_eq_of_mem (mem_insert _ _)]
-  simp_rw [insert_comm x y, nhdsWithin_insert_of_ne h]
-#align cont_diff_within_at_insert contDiffWithinAt_insert
-
-alias contDiffWithinAt_insert ↔ ContDiffWithinAt.of_insert ContDiffWithinAt.insert'
-#align cont_diff_within_at.of_insert ContDiffWithinAt.of_insert
-#align cont_diff_within_at.insert' ContDiffWithinAt.insert'
-
-theorem ContDiffWithinAt.insert (h : ContDiffWithinAt π•œ n f s x) :
-    ContDiffWithinAt π•œ n f (insert x s) x :=
-  h.insert'
-#align cont_diff_within_at.insert ContDiffWithinAt.insert
-
-/-- If a function is `C^n` within a set at a point, with `n β‰₯ 1`, then it is differentiable
-within this set at this point. -/
-theorem ContDiffWithinAt.differentiable_within_at' (h : ContDiffWithinAt π•œ n f s x) (hn : 1 ≀ n) :
-    DifferentiableWithinAt π•œ f (insert x s) x :=
-  by
-  rcases h 1 hn with ⟨u, hu, p, H⟩
-  rcases mem_nhdsWithin.1 hu with ⟨t, t_open, xt, tu⟩
-  rw [inter_comm] at tu
-  have := ((H.mono tu).DifferentiableOn le_rfl) x ⟨mem_insert x s, xt⟩
-  exact (differentiableWithinAt_inter (IsOpen.mem_nhds t_open xt)).1 this
-#align cont_diff_within_at.differentiable_within_at' ContDiffWithinAt.differentiable_within_at'
-
-theorem ContDiffWithinAt.differentiableWithinAt (h : ContDiffWithinAt π•œ n f s x) (hn : 1 ≀ n) :
-    DifferentiableWithinAt π•œ f s x :=
-  (h.differentiable_within_at' hn).mono (subset_insert x s)
-#align cont_diff_within_at.differentiable_within_at ContDiffWithinAt.differentiableWithinAt
-
-/-- A function is `C^(n + 1)` on a domain iff locally, it has a derivative which is `C^n`. -/
-theorem contDiffWithinAt_succ_iff_hasFderivWithinAt {n : β„•} :
-    ContDiffWithinAt π•œ (n + 1 : β„•) f s x ↔
-      βˆƒ u ∈ 𝓝[insert x s] x,
-        βˆƒ f' : E β†’ E β†’L[π•œ] F,
-          (βˆ€ x ∈ u, HasFderivWithinAt f (f' x) u x) ∧ ContDiffWithinAt π•œ n f' u x :=
-  by
-  constructor
-  Β· intro h
-    rcases h n.succ le_rfl with ⟨u, hu, p, Hp⟩
-    refine'
-      ⟨u, hu, fun y => (continuousMultilinearCurryFin1 π•œ E F) (p y 1), fun y hy =>
-        Hp.has_fderiv_within_at (WithTop.coe_le_coe.2 (Nat.le_add_left 1 n)) hy, _⟩
-    intro m hm
-    refine' ⟨u, _, fun y : E => (p y).shift, _⟩
-    Β· convert self_mem_nhdsWithin
-      have : x ∈ insert x s := by simp
-      exact insert_eq_of_mem (mem_of_mem_nhdsWithin this hu)
-    Β· rw [hasFtaylorSeriesUpToOn_succ_iff_right] at Hp
-      exact Hp.2.2.of_le hm
-  · rintro ⟨u, hu, f', f'_eq_deriv, Hf'⟩
-    rw [contDiffWithinAt_nat]
-    rcases Hf' n le_rfl with ⟨v, hv, p', Hp'⟩
-    refine' ⟨v ∩ u, _, fun x => (p' x).unshift (f x), _⟩
-    Β· apply Filter.inter_mem _ hu
-      apply nhdsWithin_le_of_mem hu
-      exact nhdsWithin_mono _ (subset_insert x u) hv
-    Β· rw [hasFtaylorSeriesUpToOn_succ_iff_right]
-      refine' ⟨fun y hy => rfl, fun y hy => _, _⟩
-      Β· change
-          HasFderivWithinAt (fun z => (continuousMultilinearCurryFin0 π•œ E F).symm (f z))
-            (FormalMultilinearSeries.unshift (p' y) (f y) 1).curryLeft (v ∩ u) y
-        rw [LinearIsometryEquiv.comp_hasFderivWithinAt_iff']
-        convert(f'_eq_deriv y hy.2).mono (inter_subset_right v u)
-        rw [← Hp'.zero_eq y hy.1]
-        ext z
-        change
-          ((p' y 0) (init (@cons 0 (fun i => E) z 0))) (@cons 0 (fun i => E) z 0 (last 0)) =
-            ((p' y 0) 0) z
-        unfold_coes
-        congr
-      Β· convert(Hp'.mono (inter_subset_left v u)).congr fun x hx => Hp'.zero_eq x hx.1
-        Β· ext (x y)
-          change p' x 0 (init (@snoc 0 (fun i : Fin 1 => E) 0 y)) y = p' x 0 0 y
-          rw [init_snoc]
-        Β· ext (x k v y)
-          change
-            p' x k (init (@snoc k (fun i : Fin k.succ => E) v y))
-                (@snoc k (fun i : Fin k.succ => E) v y (last k)) =
-              p' x k v y
-          rw [snoc_last, init_snoc]
-#align cont_diff_within_at_succ_iff_has_fderiv_within_at contDiffWithinAt_succ_iff_hasFderivWithinAt
-
-/-- A version of `cont_diff_within_at_succ_iff_has_fderiv_within_at` where all derivatives
-  are taken within the same set. -/
-theorem contDiffWithinAt_succ_iff_has_fderiv_within_at' {n : β„•} :
-    ContDiffWithinAt π•œ (n + 1 : β„•) f s x ↔
-      βˆƒ u ∈ 𝓝[insert x s] x,
-        u βŠ† insert x s ∧
-          βˆƒ f' : E β†’ E β†’L[π•œ] F,
-            (βˆ€ x ∈ u, HasFderivWithinAt f (f' x) s x) ∧ ContDiffWithinAt π•œ n f' s x :=
-  by
-  refine' ⟨fun hf => _, _⟩
-  · obtain ⟨u, hu, f', huf', hf'⟩ := cont_diff_within_at_succ_iff_has_fderiv_within_at.mp hf
-    obtain ⟨w, hw, hxw, hwu⟩ := mem_nhds_within.mp hu
-    rw [inter_comm] at hwu
-    refine'
-      ⟨insert x s ∩ w, inter_mem_nhdsWithin _ (hw.mem_nhds hxw), inter_subset_left _ _, f',
-        fun y hy => _, _⟩
-    Β· refine' ((huf' y <| hwu hy).mono hwu).mono_of_mem _
-      refine' mem_of_superset _ (inter_subset_inter_left _ (subset_insert _ _))
-      refine' inter_mem_nhdsWithin _ (hw.mem_nhds hy.2)
-    Β· exact hf'.mono_of_mem (nhdsWithin_mono _ (subset_insert _ _) hu)
-  Β· rw [← contDiffWithinAt_insert, contDiffWithinAt_succ_iff_hasFderivWithinAt,
-      insert_eq_of_mem (mem_insert _ _)]
-    rintro ⟨u, hu, hus, f', huf', hf'⟩
-    refine' ⟨u, hu, f', fun y hy => (huf' y hy).insert'.mono hus, hf'.insert.mono hus⟩
-#align cont_diff_within_at_succ_iff_has_fderiv_within_at' contDiffWithinAt_succ_iff_has_fderiv_within_at'
-
-/-! ### Smooth functions within a set -/
-
-
-variable (π•œ)
-
-/-- A function is continuously differentiable up to `n` on `s` if, for any point `x` in `s`, it
-admits continuous derivatives up to order `n` on a neighborhood of `x` in `s`.
-
-For `n = ∞`, we only require that this holds up to any finite order (where the neighborhood may
-depend on the finite order we consider).
--/
-def ContDiffOn (n : β„•βˆž) (f : E β†’ F) (s : Set E) : Prop :=
-  βˆ€ x ∈ s, ContDiffWithinAt π•œ n f s x
-#align cont_diff_on ContDiffOn
-
-variable {π•œ}
-
-theorem ContDiffOn.contDiffWithinAt (h : ContDiffOn π•œ n f s) (hx : x ∈ s) :
-    ContDiffWithinAt π•œ n f s x :=
-  h x hx
-#align cont_diff_on.cont_diff_within_at ContDiffOn.contDiffWithinAt
-
-theorem ContDiffWithinAt.contDiffOn {m : β„•} (hm : (m : β„•βˆž) ≀ n) (h : ContDiffWithinAt π•œ n f s x) :
-    βˆƒ u ∈ 𝓝[insert x s] x, u βŠ† insert x s ∧ ContDiffOn π•œ m f u :=
-  by
-  rcases h m hm with ⟨u, u_nhd, p, hp⟩
-  refine' ⟨u ∩ insert x s, Filter.inter_mem u_nhd self_mem_nhdsWithin, inter_subset_right _ _, _⟩
-  intro y hy m' hm'
-  refine' ⟨u ∩ insert x s, _, p, (hp.mono (inter_subset_left _ _)).of_le hm'⟩
-  convert self_mem_nhdsWithin
-  exact insert_eq_of_mem hy
-#align cont_diff_within_at.cont_diff_on ContDiffWithinAt.contDiffOn
-
-protected theorem ContDiffWithinAt.eventually {n : β„•} (h : ContDiffWithinAt π•œ n f s x) :
-    βˆ€αΆ  y in 𝓝[insert x s] x, ContDiffWithinAt π•œ n f s y :=
-  by
-  rcases h.cont_diff_on le_rfl with ⟨u, hu, hu_sub, hd⟩
-  have : βˆ€αΆ  y : E in 𝓝[insert x s] x, u ∈ 𝓝[insert x s] y ∧ y ∈ u :=
-    (eventually_nhdsWithin_nhdsWithin.2 hu).And hu
-  refine' this.mono fun y hy => (hd y hy.2).mono_of_mem _
-  exact nhdsWithin_mono y (subset_insert _ _) hy.1
-#align cont_diff_within_at.eventually ContDiffWithinAt.eventually
-
-theorem ContDiffOn.of_le (h : ContDiffOn π•œ n f s) (hmn : m ≀ n) : ContDiffOn π•œ m f s := fun x hx =>
-  (h x hx).of_le hmn
-#align cont_diff_on.of_le ContDiffOn.of_le
-
-theorem ContDiffOn.of_succ {n : β„•} (h : ContDiffOn π•œ (n + 1) f s) : ContDiffOn π•œ n f s :=
-  h.of_le <| WithTop.coe_le_coe.mpr le_self_add
-#align cont_diff_on.of_succ ContDiffOn.of_succ
-
-theorem ContDiffOn.one_of_succ {n : β„•} (h : ContDiffOn π•œ (n + 1) f s) : ContDiffOn π•œ 1 f s :=
-  h.of_le <| WithTop.coe_le_coe.mpr le_add_self
-#align cont_diff_on.one_of_succ ContDiffOn.one_of_succ
-
-theorem contDiffOn_iff_forall_nat_le : ContDiffOn π•œ n f s ↔ βˆ€ m : β„•, ↑m ≀ n β†’ ContDiffOn π•œ m f s :=
-  ⟨fun H m hm => H.of_le hm, fun H x hx m hm => H m hm x hx m le_rfl⟩
-#align cont_diff_on_iff_forall_nat_le contDiffOn_iff_forall_nat_le
-
-theorem contDiffOn_top : ContDiffOn π•œ ∞ f s ↔ βˆ€ n : β„•, ContDiffOn π•œ n f s :=
-  contDiffOn_iff_forall_nat_le.trans <| by simp only [le_top, forall_prop_of_true]
-#align cont_diff_on_top contDiffOn_top
-
-theorem contDiffOn_all_iff_nat : (βˆ€ n, ContDiffOn π•œ n f s) ↔ βˆ€ n : β„•, ContDiffOn π•œ n f s :=
-  by
-  refine' ⟨fun H n => H n, _⟩
-  rintro H (_ | n)
-  exacts[contDiffOn_top.2 H, H n]
-#align cont_diff_on_all_iff_nat contDiffOn_all_iff_nat
-
-theorem ContDiffOn.continuousOn (h : ContDiffOn π•œ n f s) : ContinuousOn f s := fun x hx =>
-  (h x hx).ContinuousWithinAt
-#align cont_diff_on.continuous_on ContDiffOn.continuousOn
-
-theorem ContDiffOn.congr (h : ContDiffOn π•œ n f s) (h₁ : βˆ€ x ∈ s, f₁ x = f x) :
-    ContDiffOn π•œ n f₁ s := fun x hx => (h x hx).congr h₁ (h₁ x hx)
-#align cont_diff_on.congr ContDiffOn.congr
-
-theorem contDiffOn_congr (h₁ : βˆ€ x ∈ s, f₁ x = f x) : ContDiffOn π•œ n f₁ s ↔ ContDiffOn π•œ n f s :=
-  ⟨fun H => H.congr fun x hx => (h₁ x hx).symm, fun H => H.congr hβ‚βŸ©
-#align cont_diff_on_congr contDiffOn_congr
-
-theorem ContDiffOn.mono (h : ContDiffOn π•œ n f s) {t : Set E} (hst : t βŠ† s) : ContDiffOn π•œ n f t :=
-  fun x hx => (h x (hst hx)).mono hst
-#align cont_diff_on.mono ContDiffOn.mono
-
-theorem ContDiffOn.congr_mono (hf : ContDiffOn π•œ n f s) (h₁ : βˆ€ x ∈ s₁, f₁ x = f x) (hs : s₁ βŠ† s) :
-    ContDiffOn π•œ n f₁ s₁ :=
-  (hf.mono hs).congr h₁
-#align cont_diff_on.congr_mono ContDiffOn.congr_mono
-
-/-- If a function is `C^n` on a set with `n β‰₯ 1`, then it is differentiable there. -/
-theorem ContDiffOn.differentiableOn (h : ContDiffOn π•œ n f s) (hn : 1 ≀ n) :
-    DifferentiableOn π•œ f s := fun x hx => (h x hx).DifferentiableWithinAt hn
-#align cont_diff_on.differentiable_on ContDiffOn.differentiableOn
-
-/-- If a function is `C^n` around each point in a set, then it is `C^n` on the set. -/
-theorem contDiffOn_of_locally_contDiffOn
-    (h : βˆ€ x ∈ s, βˆƒ u, IsOpen u ∧ x ∈ u ∧ ContDiffOn π•œ n f (s ∩ u)) : ContDiffOn π•œ n f s :=
-  by
-  intro x xs
-  rcases h x xs with ⟨u, u_open, xu, hu⟩
-  apply (contDiffWithinAt_inter _).1 (hu x ⟨xs, xu⟩)
-  exact IsOpen.mem_nhds u_open xu
-#align cont_diff_on_of_locally_cont_diff_on contDiffOn_of_locally_contDiffOn
-
-/-- A function is `C^(n + 1)` on a domain iff locally, it has a derivative which is `C^n`. -/
-theorem contDiffOn_succ_iff_hasFderivWithinAt {n : β„•} :
-    ContDiffOn π•œ (n + 1 : β„•) f s ↔
-      βˆ€ x ∈ s,
-        βˆƒ u ∈ 𝓝[insert x s] x,
-          βˆƒ f' : E β†’ E β†’L[π•œ] F, (βˆ€ x ∈ u, HasFderivWithinAt f (f' x) u x) ∧ ContDiffOn π•œ n f' u :=
-  by
-  constructor
-  Β· intro h x hx
-    rcases(h x hx) n.succ le_rfl with ⟨u, hu, p, Hp⟩
-    refine'
-      ⟨u, hu, fun y => (continuousMultilinearCurryFin1 π•œ E F) (p y 1), fun y hy =>
-        Hp.has_fderiv_within_at (WithTop.coe_le_coe.2 (Nat.le_add_left 1 n)) hy, _⟩
-    rw [hasFtaylorSeriesUpToOn_succ_iff_right] at Hp
-    intro z hz m hm
-    refine' ⟨u, _, fun x : E => (p x).shift, Hp.2.2.of_le hm⟩
-    convert self_mem_nhdsWithin
-    exact insert_eq_of_mem hz
-  Β· intro h x hx
-    rw [contDiffWithinAt_succ_iff_hasFderivWithinAt]
-    rcases h x hx with ⟨u, u_nhbd, f', hu, hf'⟩
-    have : x ∈ u := mem_of_mem_nhdsWithin (mem_insert _ _) u_nhbd
-    exact ⟨u, u_nhbd, f', hu, hf' x this⟩
-#align cont_diff_on_succ_iff_has_fderiv_within_at contDiffOn_succ_iff_hasFderivWithinAt
-
-/-! ### Iterated derivative within a set -/
-
-
-variable (π•œ)
-
-/-- The `n`-th derivative of a function along a set, defined inductively by saying that the `n+1`-th
-derivative of `f` is the derivative of the `n`-th derivative of `f` along this set, together with
-an uncurrying step to see it as a multilinear map in `n+1` variables..
--/
-noncomputable def iteratedFderivWithin (n : β„•) (f : E β†’ F) (s : Set E) : E β†’ E[Γ—n]β†’L[π•œ] F :=
-  Nat.recOn n (fun x => ContinuousMultilinearMap.curry0 π•œ E (f x)) fun n rec x =>
-    ContinuousLinearMap.uncurryLeft (fderivWithin π•œ rec s x)
-#align iterated_fderiv_within iteratedFderivWithin
-
-/-- Formal Taylor series associated to a function within a set. -/
-def ftaylorSeriesWithin (f : E β†’ F) (s : Set E) (x : E) : FormalMultilinearSeries π•œ E F := fun n =>
-  iteratedFderivWithin π•œ n f s x
-#align ftaylor_series_within ftaylorSeriesWithin
-
-variable {π•œ}
-
-@[simp]
-theorem iteratedFderivWithin_zero_apply (m : Fin 0 β†’ E) :
-    (iteratedFderivWithin π•œ 0 f s x : (Fin 0 β†’ E) β†’ F) m = f x :=
-  rfl
-#align iterated_fderiv_within_zero_apply iteratedFderivWithin_zero_apply
-
-theorem iteratedFderivWithin_zero_eq_comp :
-    iteratedFderivWithin π•œ 0 f s = (continuousMultilinearCurryFin0 π•œ E F).symm ∘ f :=
-  rfl
-#align iterated_fderiv_within_zero_eq_comp iteratedFderivWithin_zero_eq_comp
-
-theorem norm_iteratedFderivWithin_zero : β€–iteratedFderivWithin π•œ 0 f s xβ€– = β€–f xβ€– := by
-  rw [iteratedFderivWithin_zero_eq_comp, LinearIsometryEquiv.norm_map]
-#align norm_iterated_fderiv_within_zero norm_iteratedFderivWithin_zero
-
-theorem iteratedFderivWithin_succ_apply_left {n : β„•} (m : Fin (n + 1) β†’ E) :
-    (iteratedFderivWithin π•œ (n + 1) f s x : (Fin (n + 1) β†’ E) β†’ F) m =
-      (fderivWithin π•œ (iteratedFderivWithin π•œ n f s) s x : E β†’ E[Γ—n]β†’L[π•œ] F) (m 0) (tail m) :=
-  rfl
-#align iterated_fderiv_within_succ_apply_left iteratedFderivWithin_succ_apply_left
-
-/-- Writing explicitly the `n+1`-th derivative as the composition of a currying linear equiv,
-and the derivative of the `n`-th derivative. -/
-theorem iteratedFderivWithin_succ_eq_comp_left {n : β„•} :
-    iteratedFderivWithin π•œ (n + 1) f s =
-      continuousMultilinearCurryLeftEquiv π•œ (fun i : Fin (n + 1) => E) F ∘
-        fderivWithin π•œ (iteratedFderivWithin π•œ n f s) s :=
-  rfl
-#align iterated_fderiv_within_succ_eq_comp_left iteratedFderivWithin_succ_eq_comp_left
-
-theorem norm_fderivWithin_iteratedFderivWithin {n : β„•} :
-    β€–fderivWithin π•œ (iteratedFderivWithin π•œ n f s) s xβ€– = β€–iteratedFderivWithin π•œ (n + 1) f s xβ€– :=
-  by rw [iteratedFderivWithin_succ_eq_comp_left, LinearIsometryEquiv.norm_map]
-#align norm_fderiv_within_iterated_fderiv_within norm_fderivWithin_iteratedFderivWithin
-
-theorem iteratedFderivWithin_succ_apply_right {n : β„•} (hs : UniqueDiffOn π•œ s) (hx : x ∈ s)
-    (m : Fin (n + 1) β†’ E) :
-    (iteratedFderivWithin π•œ (n + 1) f s x : (Fin (n + 1) β†’ E) β†’ F) m =
-      iteratedFderivWithin π•œ n (fun y => fderivWithin π•œ f s y) s x (init m) (m (last n)) :=
-  by
-  induction' n with n IH generalizing x
-  Β· rw [iteratedFderivWithin_succ_eq_comp_left, iteratedFderivWithin_zero_eq_comp,
-      iteratedFderivWithin_zero_apply, Function.comp_apply,
-      LinearIsometryEquiv.comp_fderivWithin _ (hs x hx)]
-    rfl
-  Β· let I := continuousMultilinearCurryRightEquiv' π•œ n E F
-    have A :
-      βˆ€ y ∈ s,
-        iteratedFderivWithin π•œ n.succ f s y =
-          (I ∘ iteratedFderivWithin π•œ n (fun y => fderivWithin π•œ f s y) s) y :=
-      by
-      intro y hy
-      ext m
-      rw [@IH m y hy]
-      rfl
-    calc
-      (iteratedFderivWithin π•œ (n + 2) f s x : (Fin (n + 2) β†’ E) β†’ F) m =
-          (fderivWithin π•œ (iteratedFderivWithin π•œ n.succ f s) s x : E β†’ E[Γ—n + 1]β†’L[π•œ] F) (m 0)
-            (tail m) :=
-        rfl
-      _ =
-          (fderivWithin π•œ (I ∘ iteratedFderivWithin π•œ n (fderivWithin π•œ f s) s) s x :
-              E β†’ E[Γ—n + 1]β†’L[π•œ] F)
-            (m 0) (tail m) :=
-        by rw [fderivWithin_congr (hs x hx) A (A x hx)]
-      _ =
-          (I ∘ fderivWithin π•œ (iteratedFderivWithin π•œ n (fderivWithin π•œ f s) s) s x :
-              E β†’ E[Γ—n + 1]β†’L[π•œ] F)
-            (m 0) (tail m) :=
-        by
-        rw [LinearIsometryEquiv.comp_fderivWithin _ (hs x hx)]
-        rfl
-      _ =
-          (fderivWithin π•œ (iteratedFderivWithin π•œ n (fun y => fderivWithin π•œ f s y) s) s x :
-              E β†’ E[Γ—n]β†’L[π•œ] E β†’L[π•œ] F)
-            (m 0) (init (tail m)) ((tail m) (last n)) :=
-        rfl
-      _ =
-          iteratedFderivWithin π•œ (Nat.succ n) (fun y => fderivWithin π•œ f s y) s x (init m)
-            (m (last (n + 1))) :=
-        by
-        rw [iteratedFderivWithin_succ_apply_left, tail_init_eq_init_tail]
-        rfl
-      
-#align iterated_fderiv_within_succ_apply_right iteratedFderivWithin_succ_apply_right
-
-/-- Writing explicitly the `n+1`-th derivative as the composition of a currying linear equiv,
-and the `n`-th derivative of the derivative. -/
-theorem iteratedFderivWithin_succ_eq_comp_right {n : β„•} (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) :
-    iteratedFderivWithin π•œ (n + 1) f s x =
-      (continuousMultilinearCurryRightEquiv' π•œ n E F ∘
-          iteratedFderivWithin π•œ n (fun y => fderivWithin π•œ f s y) s)
-        x :=
-  by
-  ext m
-  rw [iteratedFderivWithin_succ_apply_right hs hx]
-  rfl
-#align iterated_fderiv_within_succ_eq_comp_right iteratedFderivWithin_succ_eq_comp_right
-
-theorem norm_iteratedFderivWithin_fderivWithin {n : β„•} (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) :
-    β€–iteratedFderivWithin π•œ n (fderivWithin π•œ f s) s xβ€– = β€–iteratedFderivWithin π•œ (n + 1) f s xβ€– :=
-  by rw [iteratedFderivWithin_succ_eq_comp_right hs hx, LinearIsometryEquiv.norm_map]
-#align norm_iterated_fderiv_within_fderiv_within norm_iteratedFderivWithin_fderivWithin
-
-@[simp]
-theorem iteratedFderivWithin_one_apply (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) (m : Fin 1 β†’ E) :
-    (iteratedFderivWithin π•œ 1 f s x : (Fin 1 β†’ E) β†’ F) m = (fderivWithin π•œ f s x : E β†’ F) (m 0) :=
-  by
-  rw [iteratedFderivWithin_succ_apply_right hs hx, iteratedFderivWithin_zero_apply]
-  rfl
-#align iterated_fderiv_within_one_apply iteratedFderivWithin_one_apply
-
-/-- If two functions coincide on a set `s` of unique differentiability, then their iterated
-differentials within this set coincide. -/
-theorem iteratedFderivWithin_congr {n : β„•} (hs : UniqueDiffOn π•œ s) (hL : βˆ€ y ∈ s, f₁ y = f y)
-    (hx : x ∈ s) : iteratedFderivWithin π•œ n f₁ s x = iteratedFderivWithin π•œ n f s x :=
-  by
-  induction' n with n IH generalizing x
-  Β· ext m
-    simp [hL x hx]
-  Β· have :
-      fderivWithin π•œ (fun y => iteratedFderivWithin π•œ n f₁ s y) s x =
-        fderivWithin π•œ (fun y => iteratedFderivWithin π•œ n f s y) s x :=
-      fderivWithin_congr (hs x hx) (fun y hy => IH hy) (IH hx)
-    ext m
-    rw [iteratedFderivWithin_succ_apply_left, iteratedFderivWithin_succ_apply_left, this]
-#align iterated_fderiv_within_congr iteratedFderivWithin_congr
-
-/-- The iterated differential within a set `s` at a point `x` is not modified if one intersects
-`s` with an open set containing `x`. -/
-theorem iteratedFderivWithin_inter_open {n : β„•} (hu : IsOpen u) (hs : UniqueDiffOn π•œ (s ∩ u))
-    (hx : x ∈ s ∩ u) : iteratedFderivWithin π•œ n f (s ∩ u) x = iteratedFderivWithin π•œ n f s x :=
-  by
-  induction' n with n IH generalizing x
-  Β· ext m
-    simp
-  Β· have A :
-      fderivWithin π•œ (fun y => iteratedFderivWithin π•œ n f (s ∩ u) y) (s ∩ u) x =
-        fderivWithin π•œ (fun y => iteratedFderivWithin π•œ n f s y) (s ∩ u) x :=
-      fderivWithin_congr (hs x hx) (fun y hy => IH hy) (IH hx)
-    have B :
-      fderivWithin π•œ (fun y => iteratedFderivWithin π•œ n f s y) (s ∩ u) x =
-        fderivWithin π•œ (fun y => iteratedFderivWithin π•œ n f s y) s x :=
-      fderivWithin_inter (IsOpen.mem_nhds hu hx.2)
-        ((uniqueDiffWithinAt_inter (IsOpen.mem_nhds hu hx.2)).1 (hs x hx))
-    ext m
-    rw [iteratedFderivWithin_succ_apply_left, iteratedFderivWithin_succ_apply_left, A, B]
-#align iterated_fderiv_within_inter_open iteratedFderivWithin_inter_open
-
-/-- The iterated differential within a set `s` at a point `x` is not modified if one intersects
-`s` with a neighborhood of `x` within `s`. -/
-theorem iteratedFderivWithin_inter' {n : β„•} (hu : u ∈ 𝓝[s] x) (hs : UniqueDiffOn π•œ s) (xs : x ∈ s) :
-    iteratedFderivWithin π•œ n f (s ∩ u) x = iteratedFderivWithin π•œ n f s x :=
-  by
-  obtain ⟨v, v_open, xv, vu⟩ : βˆƒ v, IsOpen v ∧ x ∈ v ∧ v ∩ s βŠ† u := mem_nhdsWithin.1 hu
-  have A : s ∩ u ∩ v = s ∩ v :=
-    by
-    apply subset.antisymm (inter_subset_inter (inter_subset_left _ _) (subset.refl _))
-    exact fun y ⟨ys, yv⟩ => ⟨⟨ys, vu ⟨yv, ys⟩⟩, yv⟩
-  have : iteratedFderivWithin π•œ n f (s ∩ v) x = iteratedFderivWithin π•œ n f s x :=
-    iteratedFderivWithin_inter_open v_open (hs.inter v_open) ⟨xs, xv⟩
-  rw [← this]
-  have : iteratedFderivWithin π•œ n f (s ∩ u ∩ v) x = iteratedFderivWithin π•œ n f (s ∩ u) x :=
-    by
-    refine' iteratedFderivWithin_inter_open v_open _ ⟨⟨xs, vu ⟨xv, xs⟩⟩, xv⟩
-    rw [A]
-    exact hs.inter v_open
-  rw [A] at this
-  rw [← this]
-#align iterated_fderiv_within_inter' iteratedFderivWithin_inter'
-
-/-- The iterated differential within a set `s` at a point `x` is not modified if one intersects
-`s` with a neighborhood of `x`. -/
-theorem iteratedFderivWithin_inter {n : β„•} (hu : u ∈ 𝓝 x) (hs : UniqueDiffOn π•œ s) (xs : x ∈ s) :
-    iteratedFderivWithin π•œ n f (s ∩ u) x = iteratedFderivWithin π•œ n f s x :=
-  iteratedFderivWithin_inter' (mem_nhdsWithin_of_mem_nhds hu) hs xs
-#align iterated_fderiv_within_inter iteratedFderivWithin_inter
-
-@[simp]
-theorem contDiffOn_zero : ContDiffOn π•œ 0 f s ↔ ContinuousOn f s :=
-  by
-  refine' ⟨fun H => H.ContinuousOn, fun H => _⟩
-  intro x hx m hm
-  have : (m : β„•βˆž) = 0 := le_antisymm hm bot_le
-  rw [this]
-  refine' ⟨insert x s, self_mem_nhdsWithin, ftaylorSeriesWithin π•œ f s, _⟩
-  rw [hasFtaylorSeriesUpToOn_zero_iff]
-  exact ⟨by rwa [insert_eq_of_mem hx], fun x hx => by simp [ftaylorSeriesWithin]⟩
-#align cont_diff_on_zero contDiffOn_zero
-
-theorem contDiffWithinAt_zero (hx : x ∈ s) :
-    ContDiffWithinAt π•œ 0 f s x ↔ βˆƒ u ∈ 𝓝[s] x, ContinuousOn f (s ∩ u) :=
-  by
-  constructor
-  Β· intro h
-    obtain ⟨u, H, p, hp⟩ := h 0 (by norm_num)
-    refine' ⟨u, _, _⟩
-    Β· simpa [hx] using H
-    Β· simp only [WithTop.coe_zero, hasFtaylorSeriesUpToOn_zero_iff] at hp
-      exact hp.1.mono (inter_subset_right s u)
-  · rintro ⟨u, H, hu⟩
-    rw [← contDiffWithinAt_inter' H]
-    have h' : x ∈ s ∩ u := ⟨hx, mem_of_mem_nhdsWithin hx H⟩
-    exact (cont_diff_on_zero.mpr hu).ContDiffWithinAt h'
-#align cont_diff_within_at_zero contDiffWithinAt_zero
-
-/-- On a set with unique differentiability, any choice of iterated differential has to coincide
-with the one we have chosen in `iterated_fderiv_within π•œ m f s`. -/
-theorem HasFtaylorSeriesUpToOn.eq_ftaylor_series_of_uniqueDiffOn
-    (h : HasFtaylorSeriesUpToOn n f p s) {m : β„•} (hmn : (m : β„•βˆž) ≀ n) (hs : UniqueDiffOn π•œ s)
-    (hx : x ∈ s) : p x m = iteratedFderivWithin π•œ m f s x :=
-  by
-  induction' m with m IH generalizing x
-  Β· rw [h.zero_eq' hx, iteratedFderivWithin_zero_eq_comp]
-  Β· have A : (m : β„•βˆž) < n := lt_of_lt_of_le (WithTop.coe_lt_coe.2 (lt_add_one m)) hmn
-    have :
-      HasFderivWithinAt (fun y : E => iteratedFderivWithin π•œ m f s y)
-        (ContinuousMultilinearMap.curryLeft (p x (Nat.succ m))) s x :=
-      (h.fderiv_within m A x hx).congr (fun y hy => (IH (le_of_lt A) hy).symm)
-        (IH (le_of_lt A) hx).symm
-    rw [iteratedFderivWithin_succ_eq_comp_left, Function.comp_apply, this.fderiv_within (hs x hx)]
-    exact (ContinuousMultilinearMap.uncurry_curryLeft _).symm
-#align has_ftaylor_series_up_to_on.eq_ftaylor_series_of_unique_diff_on HasFtaylorSeriesUpToOn.eq_ftaylor_series_of_uniqueDiffOn
-
-/-- When a function is `C^n` in a set `s` of unique differentiability, it admits
-`ftaylor_series_within π•œ f s` as a Taylor series up to order `n` in `s`. -/
-theorem ContDiffOn.ftaylorSeriesWithin (h : ContDiffOn π•œ n f s) (hs : UniqueDiffOn π•œ s) :
-    HasFtaylorSeriesUpToOn n f (ftaylorSeriesWithin π•œ f s) s :=
-  by
-  constructor
-  Β· intro x hx
-    simp only [ftaylorSeriesWithin, ContinuousMultilinearMap.uncurry0_apply,
-      iteratedFderivWithin_zero_apply]
-  Β· intro m hm x hx
-    rcases(h x hx) m.succ (ENat.add_one_le_of_lt hm) with ⟨u, hu, p, Hp⟩
-    rw [insert_eq_of_mem hx] at hu
-    rcases mem_nhdsWithin.1 hu with ⟨o, o_open, xo, ho⟩
-    rw [inter_comm] at ho
-    have : p x m.succ = ftaylorSeriesWithin π•œ f s x m.succ :=
-      by
-      change p x m.succ = iteratedFderivWithin π•œ m.succ f s x
-      rw [← iteratedFderivWithin_inter (IsOpen.mem_nhds o_open xo) hs hx]
-      exact (Hp.mono ho).eq_ftaylor_series_of_uniqueDiffOn le_rfl (hs.inter o_open) ⟨hx, xo⟩
-    rw [← this, ← hasFderivWithinAt_inter (IsOpen.mem_nhds o_open xo)]
-    have A : βˆ€ y ∈ s ∩ o, p y m = ftaylorSeriesWithin π•œ f s y m :=
-      by
-      rintro y ⟨hy, yo⟩
-      change p y m = iteratedFderivWithin π•œ m f s y
-      rw [← iteratedFderivWithin_inter (IsOpen.mem_nhds o_open yo) hs hy]
-      exact
-        (Hp.mono ho).eq_ftaylor_series_of_uniqueDiffOn (WithTop.coe_le_coe.2 (Nat.le_succ m))
-          (hs.inter o_open) ⟨hy, yo⟩
-    exact
-      ((Hp.mono ho).fderivWithin m (WithTop.coe_lt_coe.2 (lt_add_one m)) x ⟨hx, xo⟩).congr
-        (fun y hy => (A y hy).symm) (A x ⟨hx, xo⟩).symm
-  Β· intro m hm
-    apply continuousOn_of_locally_continuousOn
-    intro x hx
-    rcases h x hx m hm with ⟨u, hu, p, Hp⟩
-    rcases mem_nhdsWithin.1 hu with ⟨o, o_open, xo, ho⟩
-    rw [insert_eq_of_mem hx] at ho
-    rw [inter_comm] at ho
-    refine' ⟨o, o_open, xo, _⟩
-    have A : βˆ€ y ∈ s ∩ o, p y m = ftaylorSeriesWithin π•œ f s y m :=
-      by
-      rintro y ⟨hy, yo⟩
-      change p y m = iteratedFderivWithin π•œ m f s y
-      rw [← iteratedFderivWithin_inter (IsOpen.mem_nhds o_open yo) hs hy]
-      exact (Hp.mono ho).eq_ftaylor_series_of_uniqueDiffOn le_rfl (hs.inter o_open) ⟨hy, yo⟩
-    exact ((Hp.mono ho).cont m le_rfl).congr fun y hy => (A y hy).symm
-#align cont_diff_on.ftaylor_series_within ContDiffOn.ftaylorSeriesWithin
-
-theorem contDiffOn_of_continuousOn_differentiableOn
-    (Hcont : βˆ€ m : β„•, (m : β„•βˆž) ≀ n β†’ ContinuousOn (fun x => iteratedFderivWithin π•œ m f s x) s)
-    (Hdiff :
-      βˆ€ m : β„•, (m : β„•βˆž) < n β†’ DifferentiableOn π•œ (fun x => iteratedFderivWithin π•œ m f s x) s) :
-    ContDiffOn π•œ n f s := by
-  intro x hx m hm
-  rw [insert_eq_of_mem hx]
-  refine' ⟨s, self_mem_nhdsWithin, ftaylorSeriesWithin π•œ f s, _⟩
-  constructor
-  Β· intro y hy
-    simp only [ftaylorSeriesWithin, ContinuousMultilinearMap.uncurry0_apply,
-      iteratedFderivWithin_zero_apply]
-  Β· intro k hk y hy
-    convert(Hdiff k (lt_of_lt_of_le hk hm) y hy).HasFderivWithinAt
-    simp only [ftaylorSeriesWithin, iteratedFderivWithin_succ_eq_comp_left,
-      ContinuousLinearEquiv.coe_apply, Function.comp_apply, coeFn_coeBase]
-    exact ContinuousLinearMap.curry_uncurryLeft _
-  Β· intro k hk
-    exact Hcont k (le_trans hk hm)
-#align cont_diff_on_of_continuous_on_differentiable_on contDiffOn_of_continuousOn_differentiableOn
-
-theorem contDiffOn_of_differentiableOn
-    (h : βˆ€ m : β„•, (m : β„•βˆž) ≀ n β†’ DifferentiableOn π•œ (iteratedFderivWithin π•œ m f s) s) :
-    ContDiffOn π•œ n f s :=
-  contDiffOn_of_continuousOn_differentiableOn (fun m hm => (h m hm).ContinuousOn) fun m hm =>
-    h m (le_of_lt hm)
-#align cont_diff_on_of_differentiable_on contDiffOn_of_differentiableOn
-
-theorem ContDiffOn.continuousOn_iteratedFderivWithin {m : β„•} (h : ContDiffOn π•œ n f s)
-    (hmn : (m : β„•βˆž) ≀ n) (hs : UniqueDiffOn π•œ s) : ContinuousOn (iteratedFderivWithin π•œ m f s) s :=
-  (h.ftaylorSeriesWithin hs).cont m hmn
-#align cont_diff_on.continuous_on_iterated_fderiv_within ContDiffOn.continuousOn_iteratedFderivWithin
-
-theorem ContDiffOn.differentiableOn_iteratedFderivWithin {m : β„•} (h : ContDiffOn π•œ n f s)
-    (hmn : (m : β„•βˆž) < n) (hs : UniqueDiffOn π•œ s) :
-    DifferentiableOn π•œ (iteratedFderivWithin π•œ m f s) s := fun x hx =>
-  ((h.ftaylorSeriesWithin hs).fderivWithin m hmn x hx).DifferentiableWithinAt
-#align cont_diff_on.differentiable_on_iterated_fderiv_within ContDiffOn.differentiableOn_iteratedFderivWithin
-
-theorem contDiffOn_iff_continuousOn_differentiableOn (hs : UniqueDiffOn π•œ s) :
-    ContDiffOn π•œ n f s ↔
-      (βˆ€ m : β„•, (m : β„•βˆž) ≀ n β†’ ContinuousOn (fun x => iteratedFderivWithin π•œ m f s x) s) ∧
-        βˆ€ m : β„•, (m : β„•βˆž) < n β†’ DifferentiableOn π•œ (fun x => iteratedFderivWithin π•œ m f s x) s :=
-  by
-  constructor
-  Β· intro h
-    constructor
-    Β· intro m hm
-      exact h.continuous_on_iterated_fderiv_within hm hs
-    Β· intro m hm
-      exact h.differentiable_on_iterated_fderiv_within hm hs
-  Β· intro h
-    exact contDiffOn_of_continuousOn_differentiableOn h.1 h.2
-#align cont_diff_on_iff_continuous_on_differentiable_on contDiffOn_iff_continuousOn_differentiableOn
-
-theorem contDiffOn_succ_of_fderivWithin {n : β„•} (hf : DifferentiableOn π•œ f s)
-    (h : ContDiffOn π•œ n (fun y => fderivWithin π•œ f s y) s) : ContDiffOn π•œ (n + 1 : β„•) f s :=
-  by
-  intro x hx
-  rw [contDiffWithinAt_succ_iff_hasFderivWithinAt, insert_eq_of_mem hx]
-  exact
-    ⟨s, self_mem_nhdsWithin, fderivWithin π•œ f s, fun y hy => (hf y hy).HasFderivWithinAt, h x hx⟩
-#align cont_diff_on_succ_of_fderiv_within contDiffOn_succ_of_fderivWithin
-
-/-- A function is `C^(n + 1)` on a domain with unique derivatives if and only if it is
-differentiable there, and its derivative (expressed with `fderiv_within`) is `C^n`. -/
-theorem contDiffOn_succ_iff_fderivWithin {n : β„•} (hs : UniqueDiffOn π•œ s) :
-    ContDiffOn π•œ (n + 1 : β„•) f s ↔
-      DifferentiableOn π•œ f s ∧ ContDiffOn π•œ n (fun y => fderivWithin π•œ f s y) s :=
-  by
-  refine' ⟨fun H => _, fun h => contDiffOn_succ_of_fderivWithin h.1 h.2⟩
-  refine' ⟨H.differentiable_on (WithTop.coe_le_coe.2 (Nat.le_add_left 1 n)), fun x hx => _⟩
-  rcases contDiffWithinAt_succ_iff_hasFderivWithinAt.1 (H x hx) with ⟨u, hu, f', hff', hf'⟩
-  rcases mem_nhdsWithin.1 hu with ⟨o, o_open, xo, ho⟩
-  rw [inter_comm, insert_eq_of_mem hx] at ho
-  have := hf'.mono ho
-  rw [contDiffWithinAt_inter' (mem_nhdsWithin_of_mem_nhds (IsOpen.mem_nhds o_open xo))] at this
-  apply this.congr_of_eventually_eq' _ hx
-  have : o ∩ s ∈ 𝓝[s] x := mem_nhdsWithin.2 ⟨o, o_open, xo, subset.refl _⟩
-  rw [inter_comm] at this
-  apply Filter.eventuallyEq_of_mem this fun y hy => _
-  have A : fderivWithin π•œ f (s ∩ o) y = f' y :=
-    ((hff' y (ho hy)).mono ho).fderivWithin (hs.inter o_open y hy)
-  rwa [fderivWithin_inter (IsOpen.mem_nhds o_open hy.2) (hs y hy.1)] at A
-#align cont_diff_on_succ_iff_fderiv_within contDiffOn_succ_iff_fderivWithin
-
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:73:14: unsupported tactic `congrm #[[expr «expr ∧ »(_, _)]] -/
-/-- A function is `C^(n + 1)` on an open domain if and only if it is
-differentiable there, and its derivative (expressed with `fderiv`) is `C^n`. -/
-theorem contDiffOn_succ_iff_fderiv_of_open {n : β„•} (hs : IsOpen s) :
-    ContDiffOn π•œ (n + 1 : β„•) f s ↔
-      DifferentiableOn π•œ f s ∧ ContDiffOn π•œ n (fun y => fderiv π•œ f y) s :=
-  by
-  rw [contDiffOn_succ_iff_fderivWithin hs.unique_diff_on]
-  trace
-    "./././Mathport/Syntax/Translate/Tactic/Builtin.lean:73:14: unsupported tactic `congrm #[[expr «expr ∧ »(_, _)]]"
-  apply contDiffOn_congr
-  intro x hx
-  exact fderivWithin_of_open hs hx
-#align cont_diff_on_succ_iff_fderiv_of_open contDiffOn_succ_iff_fderiv_of_open
-
-/-- A function is `C^∞` on a domain with unique derivatives if and only if it is differentiable
-there, and its derivative (expressed with `fderiv_within`) is `C^∞`. -/
-theorem contDiffOn_top_iff_fderivWithin (hs : UniqueDiffOn π•œ s) :
-    ContDiffOn π•œ ∞ f s ↔
-      DifferentiableOn π•œ f s ∧ ContDiffOn π•œ ∞ (fun y => fderivWithin π•œ f s y) s :=
-  by
-  constructor
-  Β· intro h
-    refine' ⟨h.differentiable_on le_top, _⟩
-    apply contDiffOn_top.2 fun n => ((contDiffOn_succ_iff_fderivWithin hs).1 _).2
-    exact h.of_le le_top
-  Β· intro h
-    refine' contDiffOn_top.2 fun n => _
-    have A : (n : β„•βˆž) ≀ ∞ := le_top
-    apply ((contDiffOn_succ_iff_fderivWithin hs).2 ⟨h.1, h.2.of_le A⟩).of_le
-    exact WithTop.coe_le_coe.2 (Nat.le_succ n)
-#align cont_diff_on_top_iff_fderiv_within contDiffOn_top_iff_fderivWithin
-
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:73:14: unsupported tactic `congrm #[[expr «expr ∧ »(_, _)]] -/
-/-- A function is `C^∞` on an open domain if and only if it is differentiable there, and its
-derivative (expressed with `fderiv`) is `C^∞`. -/
-theorem contDiffOn_top_iff_fderiv_of_open (hs : IsOpen s) :
-    ContDiffOn π•œ ∞ f s ↔ DifferentiableOn π•œ f s ∧ ContDiffOn π•œ ∞ (fun y => fderiv π•œ f y) s :=
-  by
-  rw [contDiffOn_top_iff_fderivWithin hs.unique_diff_on]
-  trace
-    "./././Mathport/Syntax/Translate/Tactic/Builtin.lean:73:14: unsupported tactic `congrm #[[expr «expr ∧ »(_, _)]]"
-  apply contDiffOn_congr
-  intro x hx
-  exact fderivWithin_of_open hs hx
-#align cont_diff_on_top_iff_fderiv_of_open contDiffOn_top_iff_fderiv_of_open
-
-theorem ContDiffOn.fderivWithin (hf : ContDiffOn π•œ n f s) (hs : UniqueDiffOn π•œ s)
-    (hmn : m + 1 ≀ n) : ContDiffOn π•œ m (fun y => fderivWithin π•œ f s y) s :=
-  by
-  cases m
-  Β· change ∞ + 1 ≀ n at hmn
-    have : n = ∞ := by simpa using hmn
-    rw [this] at hf
-    exact ((contDiffOn_top_iff_fderivWithin hs).1 hf).2
-  Β· change (m.succ : β„•βˆž) ≀ n at hmn
-    exact ((contDiffOn_succ_iff_fderivWithin hs).1 (hf.of_le hmn)).2
-#align cont_diff_on.fderiv_within ContDiffOn.fderivWithin
-
-theorem ContDiffOn.fderiv_of_open (hf : ContDiffOn π•œ n f s) (hs : IsOpen s) (hmn : m + 1 ≀ n) :
-    ContDiffOn π•œ m (fun y => fderiv π•œ f y) s :=
-  (hf.fderivWithin hs.UniqueDiffOn hmn).congr fun x hx => (fderivWithin_of_open hs hx).symm
-#align cont_diff_on.fderiv_of_open ContDiffOn.fderiv_of_open
-
-theorem ContDiffOn.continuousOn_fderivWithin (h : ContDiffOn π•œ n f s) (hs : UniqueDiffOn π•œ s)
-    (hn : 1 ≀ n) : ContinuousOn (fun x => fderivWithin π•œ f s x) s :=
-  ((contDiffOn_succ_iff_fderivWithin hs).1 (h.of_le hn)).2.ContinuousOn
-#align cont_diff_on.continuous_on_fderiv_within ContDiffOn.continuousOn_fderivWithin
-
-theorem ContDiffOn.continuousOn_fderiv_of_open (h : ContDiffOn π•œ n f s) (hs : IsOpen s)
-    (hn : 1 ≀ n) : ContinuousOn (fun x => fderiv π•œ f x) s :=
-  ((contDiffOn_succ_iff_fderiv_of_open hs).1 (h.of_le hn)).2.ContinuousOn
-#align cont_diff_on.continuous_on_fderiv_of_open ContDiffOn.continuousOn_fderiv_of_open
-
-/-! ### Functions with a Taylor series on the whole space -/
-
-
-/-- `has_ftaylor_series_up_to n f p` registers the fact that `p 0 = f` and `p (m+1)` is a
-derivative of `p m` for `m < n`, and is continuous for `m ≀ n`. This is a predicate analogous to
-`has_fderiv_at` but for higher order derivatives. -/
-structure HasFtaylorSeriesUpTo (n : β„•βˆž) (f : E β†’ F) (p : E β†’ FormalMultilinearSeries π•œ E F) :
-  Prop where
-  zero_eq : βˆ€ x, (p x 0).uncurry0 = f x
-  fderiv : βˆ€ (m : β„•) (hm : (m : β„•βˆž) < n), βˆ€ x, HasFderivAt (fun y => p y m) (p x m.succ).curryLeft x
-  cont : βˆ€ (m : β„•) (hm : (m : β„•βˆž) ≀ n), Continuous fun x => p x m
-#align has_ftaylor_series_up_to HasFtaylorSeriesUpTo
-
-theorem HasFtaylorSeriesUpTo.zero_eq' (h : HasFtaylorSeriesUpTo n f p) (x : E) :
-    p x 0 = (continuousMultilinearCurryFin0 π•œ E F).symm (f x) :=
-  by
-  rw [← h.zero_eq x]
-  symm
-  exact ContinuousMultilinearMap.uncurry0_curry0 _
-#align has_ftaylor_series_up_to.zero_eq' HasFtaylorSeriesUpTo.zero_eq'
-
-theorem hasFtaylorSeriesUpToOn_univ_iff :
-    HasFtaylorSeriesUpToOn n f p univ ↔ HasFtaylorSeriesUpTo n f p :=
-  by
-  constructor
-  Β· intro H
-    constructor
-    Β· exact fun x => H.zero_eq x (mem_univ x)
-    Β· intro m hm x
-      rw [← hasFderivWithinAt_univ]
-      exact H.fderiv_within m hm x (mem_univ x)
-    Β· intro m hm
-      rw [continuous_iff_continuousOn_univ]
-      exact H.cont m hm
-  Β· intro H
-    constructor
-    Β· exact fun x hx => H.zero_eq x
-    Β· intro m hm x hx
-      rw [hasFderivWithinAt_univ]
-      exact H.fderiv m hm x
-    Β· intro m hm
-      rw [← continuous_iff_continuousOn_univ]
-      exact H.cont m hm
-#align has_ftaylor_series_up_to_on_univ_iff hasFtaylorSeriesUpToOn_univ_iff
-
-theorem HasFtaylorSeriesUpTo.hasFtaylorSeriesUpToOn (h : HasFtaylorSeriesUpTo n f p) (s : Set E) :
-    HasFtaylorSeriesUpToOn n f p s :=
-  (hasFtaylorSeriesUpToOn_univ_iff.2 h).mono (subset_univ _)
-#align has_ftaylor_series_up_to.has_ftaylor_series_up_to_on HasFtaylorSeriesUpTo.hasFtaylorSeriesUpToOn
-
-theorem HasFtaylorSeriesUpTo.ofLe (h : HasFtaylorSeriesUpTo n f p) (hmn : m ≀ n) :
-    HasFtaylorSeriesUpTo m f p :=
-  by
-  rw [← hasFtaylorSeriesUpToOn_univ_iff] at h⊒
-  exact h.of_le hmn
-#align has_ftaylor_series_up_to.of_le HasFtaylorSeriesUpTo.ofLe
-
-theorem HasFtaylorSeriesUpTo.continuous (h : HasFtaylorSeriesUpTo n f p) : Continuous f :=
-  by
-  rw [← hasFtaylorSeriesUpToOn_univ_iff] at h
-  rw [continuous_iff_continuousOn_univ]
-  exact h.continuous_on
-#align has_ftaylor_series_up_to.continuous HasFtaylorSeriesUpTo.continuous
-
-theorem hasFtaylorSeriesUpTo_zero_iff :
-    HasFtaylorSeriesUpTo 0 f p ↔ Continuous f ∧ βˆ€ x, (p x 0).uncurry0 = f x := by
-  simp [has_ftaylor_series_up_to_on_univ_iff.symm, continuous_iff_continuousOn_univ,
-    hasFtaylorSeriesUpToOn_zero_iff]
-#align has_ftaylor_series_up_to_zero_iff hasFtaylorSeriesUpTo_zero_iff
-
-/-- If a function has a Taylor series at order at least `1`, then the term of order `1` of this
-series is a derivative of `f`. -/
-theorem HasFtaylorSeriesUpTo.hasFderivAt (h : HasFtaylorSeriesUpTo n f p) (hn : 1 ≀ n) (x : E) :
-    HasFderivAt f (continuousMultilinearCurryFin1 π•œ E F (p x 1)) x :=
-  by
-  rw [← hasFderivWithinAt_univ]
-  exact (hasFtaylorSeriesUpToOn_univ_iff.2 h).HasFderivWithinAt hn (mem_univ _)
-#align has_ftaylor_series_up_to.has_fderiv_at HasFtaylorSeriesUpTo.hasFderivAt
-
-theorem HasFtaylorSeriesUpTo.differentiable (h : HasFtaylorSeriesUpTo n f p) (hn : 1 ≀ n) :
-    Differentiable π•œ f := fun x => (h.HasFderivAt hn x).DifferentiableAt
-#align has_ftaylor_series_up_to.differentiable HasFtaylorSeriesUpTo.differentiable
-
-/-- `p` is a Taylor series of `f` up to `n+1` if and only if `p.shift` is a Taylor series up to `n`
-for `p 1`, which is a derivative of `f`. -/
-theorem hasFtaylorSeriesUpTo_succ_iff_right {n : β„•} :
-    HasFtaylorSeriesUpTo (n + 1 : β„•) f p ↔
-      (βˆ€ x, (p x 0).uncurry0 = f x) ∧
-        (βˆ€ x, HasFderivAt (fun y => p y 0) (p x 1).curryLeft x) ∧
-          HasFtaylorSeriesUpTo n (fun x => continuousMultilinearCurryFin1 π•œ E F (p x 1)) fun x =>
-            (p x).shift :=
-  by
-  simp only [hasFtaylorSeriesUpToOn_succ_iff_right, ← hasFtaylorSeriesUpToOn_univ_iff, mem_univ,
-    forall_true_left, hasFderivWithinAt_univ]
-#align has_ftaylor_series_up_to_succ_iff_right hasFtaylorSeriesUpTo_succ_iff_right
-
-/-! ### Smooth functions at a point -/
-
-
-variable (π•œ)
-
-/-- A function is continuously differentiable up to `n` at a point `x` if, for any integer `k ≀ n`,
-there is a neighborhood of `x` where `f` admits derivatives up to order `n`, which are continuous.
--/
-def ContDiffAt (n : β„•βˆž) (f : E β†’ F) (x : E) : Prop :=
-  ContDiffWithinAt π•œ n f univ x
-#align cont_diff_at ContDiffAt
-
-variable {π•œ}
-
-theorem contDiffWithinAt_univ : ContDiffWithinAt π•œ n f univ x ↔ ContDiffAt π•œ n f x :=
-  Iff.rfl
-#align cont_diff_within_at_univ contDiffWithinAt_univ
-
-theorem contDiffAt_top : ContDiffAt π•œ ∞ f x ↔ βˆ€ n : β„•, ContDiffAt π•œ n f x := by
-  simp [← contDiffWithinAt_univ, contDiffWithinAt_top]
-#align cont_diff_at_top contDiffAt_top
-
-theorem ContDiffAt.contDiffWithinAt (h : ContDiffAt π•œ n f x) : ContDiffWithinAt π•œ n f s x :=
-  h.mono (subset_univ _)
-#align cont_diff_at.cont_diff_within_at ContDiffAt.contDiffWithinAt
-
-theorem ContDiffWithinAt.contDiffAt (h : ContDiffWithinAt π•œ n f s x) (hx : s ∈ 𝓝 x) :
-    ContDiffAt π•œ n f x := by rwa [ContDiffAt, ← contDiffWithinAt_inter hx, univ_inter]
-#align cont_diff_within_at.cont_diff_at ContDiffWithinAt.contDiffAt
-
-theorem ContDiffAt.congr_of_eventuallyEq (h : ContDiffAt π•œ n f x) (hg : f₁ =αΆ [𝓝 x] f) :
-    ContDiffAt π•œ n f₁ x :=
-  h.congr_of_eventually_eq' (by rwa [nhdsWithin_univ]) (mem_univ x)
-#align cont_diff_at.congr_of_eventually_eq ContDiffAt.congr_of_eventuallyEq
-
-theorem ContDiffAt.of_le (h : ContDiffAt π•œ n f x) (hmn : m ≀ n) : ContDiffAt π•œ m f x :=
-  h.of_le hmn
-#align cont_diff_at.of_le ContDiffAt.of_le
-
-theorem ContDiffAt.continuousAt (h : ContDiffAt π•œ n f x) : ContinuousAt f x := by
-  simpa [continuousWithinAt_univ] using h.continuous_within_at
-#align cont_diff_at.continuous_at ContDiffAt.continuousAt
-
-/-- If a function is `C^n` with `n β‰₯ 1` at a point, then it is differentiable there. -/
-theorem ContDiffAt.differentiableAt (h : ContDiffAt π•œ n f x) (hn : 1 ≀ n) :
-    DifferentiableAt π•œ f x := by
-  simpa [hn, differentiableWithinAt_univ] using h.differentiable_within_at
-#align cont_diff_at.differentiable_at ContDiffAt.differentiableAt
-
-/-- A function is `C^(n + 1)` at a point iff locally, it has a derivative which is `C^n`. -/
-theorem contDiffAt_succ_iff_hasFderivAt {n : β„•} :
-    ContDiffAt π•œ (n + 1 : β„•) f x ↔
-      βˆƒ f' : E β†’ E β†’L[π•œ] F, (βˆƒ u ∈ 𝓝 x, βˆ€ x ∈ u, HasFderivAt f (f' x) x) ∧ ContDiffAt π•œ n f' x :=
-  by
-  rw [← contDiffWithinAt_univ, contDiffWithinAt_succ_iff_hasFderivWithinAt]
-  simp only [nhdsWithin_univ, exists_prop, mem_univ, insert_eq_of_mem]
-  constructor
-  · rintro ⟨u, H, f', h_fderiv, h_cont_diff⟩
-    rcases mem_nhds_iff.mp H with ⟨t, htu, ht, hxt⟩
-    refine' ⟨f', ⟨t, _⟩, h_cont_diff.cont_diff_at H⟩
-    refine' ⟨mem_nhds_iff.mpr ⟨t, subset.rfl, ht, hxt⟩, _⟩
-    intro y hyt
-    refine' (h_fderiv y (htu hyt)).HasFderivAt _
-    exact mem_nhds_iff.mpr ⟨t, htu, ht, hyt⟩
-  · rintro ⟨f', ⟨u, H, h_fderiv⟩, h_cont_diff⟩
-    refine' ⟨u, H, f', _, h_cont_diff.cont_diff_within_at⟩
-    intro x hxu
-    exact (h_fderiv x hxu).HasFderivWithinAt
-#align cont_diff_at_succ_iff_has_fderiv_at contDiffAt_succ_iff_hasFderivAt
-
-protected theorem ContDiffAt.eventually {n : β„•} (h : ContDiffAt π•œ n f x) :
-    βˆ€αΆ  y in 𝓝 x, ContDiffAt π•œ n f y := by simpa [nhdsWithin_univ] using h.eventually
-#align cont_diff_at.eventually ContDiffAt.eventually
-
-/-! ### Smooth functions -/
-
-
-variable (π•œ)
-
-/-- A function is continuously differentiable up to `n` if it admits derivatives up to
-order `n`, which are continuous. Contrary to the case of definitions in domains (where derivatives
-might not be unique) we do not need to localize the definition in space or time.
--/
-def ContDiff (n : β„•βˆž) (f : E β†’ F) : Prop :=
-  βˆƒ p : E β†’ FormalMultilinearSeries π•œ E F, HasFtaylorSeriesUpTo n f p
-#align cont_diff ContDiff
-
-variable {π•œ}
-
-theorem contDiffOn_univ : ContDiffOn π•œ n f univ ↔ ContDiff π•œ n f :=
-  by
-  constructor
-  Β· intro H
-    use ftaylorSeriesWithin π•œ f univ
-    rw [← hasFtaylorSeriesUpToOn_univ_iff]
-    exact H.ftaylor_series_within uniqueDiffOn_univ
-  · rintro ⟨p, hp⟩ x hx m hm
-    exact ⟨univ, Filter.univ_sets _, p, (hp.has_ftaylor_series_up_to_on univ).of_le hm⟩
-#align cont_diff_on_univ contDiffOn_univ
-
-theorem contDiff_iff_contDiffAt : ContDiff π•œ n f ↔ βˆ€ x, ContDiffAt π•œ n f x := by
-  simp [← contDiffOn_univ, ContDiffOn, ContDiffAt]
-#align cont_diff_iff_cont_diff_at contDiff_iff_contDiffAt
-
-theorem ContDiff.contDiffAt (h : ContDiff π•œ n f) : ContDiffAt π•œ n f x :=
-  contDiff_iff_contDiffAt.1 h x
-#align cont_diff.cont_diff_at ContDiff.contDiffAt
-
-theorem ContDiff.contDiffWithinAt (h : ContDiff π•œ n f) : ContDiffWithinAt π•œ n f s x :=
-  h.ContDiffAt.ContDiffWithinAt
-#align cont_diff.cont_diff_within_at ContDiff.contDiffWithinAt
-
-theorem contDiff_top : ContDiff π•œ ∞ f ↔ βˆ€ n : β„•, ContDiff π•œ n f := by
-  simp [cont_diff_on_univ.symm, contDiffOn_top]
-#align cont_diff_top contDiff_top
-
-theorem contDiff_all_iff_nat : (βˆ€ n, ContDiff π•œ n f) ↔ βˆ€ n : β„•, ContDiff π•œ n f := by
-  simp only [← contDiffOn_univ, contDiffOn_all_iff_nat]
-#align cont_diff_all_iff_nat contDiff_all_iff_nat
-
-theorem ContDiff.contDiffOn (h : ContDiff π•œ n f) : ContDiffOn π•œ n f s :=
-  (contDiffOn_univ.2 h).mono (subset_univ _)
-#align cont_diff.cont_diff_on ContDiff.contDiffOn
-
-@[simp]
-theorem contDiff_zero : ContDiff π•œ 0 f ↔ Continuous f :=
-  by
-  rw [← contDiffOn_univ, continuous_iff_continuousOn_univ]
-  exact contDiffOn_zero
-#align cont_diff_zero contDiff_zero
-
-theorem contDiffAt_zero : ContDiffAt π•œ 0 f x ↔ βˆƒ u ∈ 𝓝 x, ContinuousOn f u :=
-  by
-  rw [← contDiffWithinAt_univ]
-  simp [contDiffWithinAt_zero, nhdsWithin_univ]
-#align cont_diff_at_zero contDiffAt_zero
-
-theorem contDiffAt_one_iff :
-    ContDiffAt π•œ 1 f x ↔
-      βˆƒ f' : E β†’ E β†’L[π•œ] F, βˆƒ u ∈ 𝓝 x, ContinuousOn f' u ∧ βˆ€ x ∈ u, HasFderivAt f (f' x) x :=
-  by
-  simp_rw [show (1 : β„•βˆž) = (0 + 1 : β„•) from (zero_add 1).symm, contDiffAt_succ_iff_hasFderivAt,
-    show ((0 : β„•) : β„•βˆž) = 0 from rfl, contDiffAt_zero,
-    exists_mem_and_iff antitone_bforall antitone_continuousOn, and_comm']
-#align cont_diff_at_one_iff contDiffAt_one_iff
-
-theorem ContDiff.of_le (h : ContDiff π•œ n f) (hmn : m ≀ n) : ContDiff π•œ m f :=
-  contDiffOn_univ.1 <| (contDiffOn_univ.2 h).of_le hmn
-#align cont_diff.of_le ContDiff.of_le
-
-theorem ContDiff.of_succ {n : β„•} (h : ContDiff π•œ (n + 1) f) : ContDiff π•œ n f :=
-  h.of_le <| WithTop.coe_le_coe.mpr le_self_add
-#align cont_diff.of_succ ContDiff.of_succ
-
-theorem ContDiff.one_of_succ {n : β„•} (h : ContDiff π•œ (n + 1) f) : ContDiff π•œ 1 f :=
-  h.of_le <| WithTop.coe_le_coe.mpr le_add_self
-#align cont_diff.one_of_succ ContDiff.one_of_succ
-
-theorem ContDiff.continuous (h : ContDiff π•œ n f) : Continuous f :=
-  contDiff_zero.1 (h.of_le bot_le)
-#align cont_diff.continuous ContDiff.continuous
-
-/-- If a function is `C^n` with `n β‰₯ 1`, then it is differentiable. -/
-theorem ContDiff.differentiable (h : ContDiff π•œ n f) (hn : 1 ≀ n) : Differentiable π•œ f :=
-  differentiableOn_univ.1 <| (contDiffOn_univ.2 h).DifferentiableOn hn
-#align cont_diff.differentiable ContDiff.differentiable
-
-theorem contDiff_iff_forall_nat_le : ContDiff π•œ n f ↔ βˆ€ m : β„•, ↑m ≀ n β†’ ContDiff π•œ m f :=
-  by
-  simp_rw [← contDiffOn_univ]
-  exact contDiffOn_iff_forall_nat_le
-#align cont_diff_iff_forall_nat_le contDiff_iff_forall_nat_le
-
-/-! ### Iterated derivative -/
-
-
-variable (π•œ)
-
-/-- The `n`-th derivative of a function, as a multilinear map, defined inductively. -/
-noncomputable def iteratedFderiv (n : β„•) (f : E β†’ F) : E β†’ E[Γ—n]β†’L[π•œ] F :=
-  Nat.recOn n (fun x => ContinuousMultilinearMap.curry0 π•œ E (f x)) fun n rec x =>
-    ContinuousLinearMap.uncurryLeft (fderiv π•œ rec x)
-#align iterated_fderiv iteratedFderiv
-
-/-- Formal Taylor series associated to a function within a set. -/
-def ftaylorSeries (f : E β†’ F) (x : E) : FormalMultilinearSeries π•œ E F := fun n =>
-  iteratedFderiv π•œ n f x
-#align ftaylor_series ftaylorSeries
-
-variable {π•œ}
-
-@[simp]
-theorem iteratedFderiv_zero_apply (m : Fin 0 β†’ E) :
-    (iteratedFderiv π•œ 0 f x : (Fin 0 β†’ E) β†’ F) m = f x :=
-  rfl
-#align iterated_fderiv_zero_apply iteratedFderiv_zero_apply
-
-theorem iteratedFderiv_zero_eq_comp :
-    iteratedFderiv π•œ 0 f = (continuousMultilinearCurryFin0 π•œ E F).symm ∘ f :=
-  rfl
-#align iterated_fderiv_zero_eq_comp iteratedFderiv_zero_eq_comp
-
-theorem norm_iteratedFderiv_zero : β€–iteratedFderiv π•œ 0 f xβ€– = β€–f xβ€– := by
-  rw [iteratedFderiv_zero_eq_comp, LinearIsometryEquiv.norm_map]
-#align norm_iterated_fderiv_zero norm_iteratedFderiv_zero
-
-theorem iteratedFderiv_with_zero_eq : iteratedFderivWithin π•œ 0 f s = iteratedFderiv π•œ 0 f :=
-  by
-  ext
-  rfl
-#align iterated_fderiv_with_zero_eq iteratedFderiv_with_zero_eq
-
-theorem iteratedFderiv_succ_apply_left {n : β„•} (m : Fin (n + 1) β†’ E) :
-    (iteratedFderiv π•œ (n + 1) f x : (Fin (n + 1) β†’ E) β†’ F) m =
-      (fderiv π•œ (iteratedFderiv π•œ n f) x : E β†’ E[Γ—n]β†’L[π•œ] F) (m 0) (tail m) :=
-  rfl
-#align iterated_fderiv_succ_apply_left iteratedFderiv_succ_apply_left
-
-/-- Writing explicitly the `n+1`-th derivative as the composition of a currying linear equiv,
-and the derivative of the `n`-th derivative. -/
-theorem iteratedFderiv_succ_eq_comp_left {n : β„•} :
-    iteratedFderiv π•œ (n + 1) f =
-      continuousMultilinearCurryLeftEquiv π•œ (fun i : Fin (n + 1) => E) F ∘
-        fderiv π•œ (iteratedFderiv π•œ n f) :=
-  rfl
-#align iterated_fderiv_succ_eq_comp_left iteratedFderiv_succ_eq_comp_left
-
-/-- Writing explicitly the derivative of the `n`-th derivative as the composition of a currying
-linear equiv, and the `n + 1`-th derivative. -/
-theorem fderiv_iteratedFderiv {n : β„•} :
-    fderiv π•œ (iteratedFderiv π•œ n f) =
-      (continuousMultilinearCurryLeftEquiv π•œ (fun i : Fin (n + 1) => E) F).symm ∘
-        iteratedFderiv π•œ (n + 1) f :=
-  by
-  rw [iteratedFderiv_succ_eq_comp_left]
-  ext1 x
-  simp only [Function.comp_apply, LinearIsometryEquiv.symm_apply_apply]
-#align fderiv_iterated_fderiv fderiv_iteratedFderiv
-
-theorem HasCompactSupport.iteratedFderiv (hf : HasCompactSupport f) (n : β„•) :
-    HasCompactSupport (iteratedFderiv π•œ n f) :=
-  by
-  induction' n with n IH
-  Β· rw [iteratedFderiv_zero_eq_comp]
-    apply hf.comp_left
-    exact LinearIsometryEquiv.map_zero _
-  Β· rw [iteratedFderiv_succ_eq_comp_left]
-    apply (IH.fderiv π•œ).compLeft
-    exact LinearIsometryEquiv.map_zero _
-#align has_compact_support.iterated_fderiv HasCompactSupport.iteratedFderiv
-
-theorem norm_fderiv_iteratedFderiv {n : β„•} :
-    β€–fderiv π•œ (iteratedFderiv π•œ n f) xβ€– = β€–iteratedFderiv π•œ (n + 1) f xβ€– := by
-  rw [iteratedFderiv_succ_eq_comp_left, LinearIsometryEquiv.norm_map]
-#align norm_fderiv_iterated_fderiv norm_fderiv_iteratedFderiv
-
-theorem iteratedFderivWithin_univ {n : β„•} :
-    iteratedFderivWithin π•œ n f univ = iteratedFderiv π•œ n f :=
-  by
-  induction' n with n IH
-  Β· ext x
-    simp
-  Β· ext (x m)
-    rw [iteratedFderiv_succ_apply_left, iteratedFderivWithin_succ_apply_left, IH, fderivWithin_univ]
-#align iterated_fderiv_within_univ iteratedFderivWithin_univ
-
-/-- In an open set, the iterated derivative within this set coincides with the global iterated
-derivative. -/
-theorem iteratedFderivWithin_of_isOpen (n : β„•) (hs : IsOpen s) :
-    EqOn (iteratedFderivWithin π•œ n f s) (iteratedFderiv π•œ n f) s :=
-  by
-  induction' n with n IH
-  Β· intro x hx
-    ext1 m
-    simp only [iteratedFderivWithin_zero_apply, iteratedFderiv_zero_apply]
-  Β· intro x hx
-    rw [iteratedFderiv_succ_eq_comp_left, iteratedFderivWithin_succ_eq_comp_left]
-    dsimp
-    congr 1
-    rw [fderivWithin_of_open hs hx]
-    apply Filter.EventuallyEq.fderiv_eq
-    filter_upwards [hs.mem_nhds hx]
-    exact IH
-#align iterated_fderiv_within_of_is_open iteratedFderivWithin_of_isOpen
-
-theorem ftaylorSeriesWithin_univ : ftaylorSeriesWithin π•œ f univ = ftaylorSeries π•œ f :=
-  by
-  ext1 x; ext1 n
-  change iteratedFderivWithin π•œ n f univ x = iteratedFderiv π•œ n f x
-  rw [iteratedFderivWithin_univ]
-#align ftaylor_series_within_univ ftaylorSeriesWithin_univ
-
-theorem iteratedFderiv_succ_apply_right {n : β„•} (m : Fin (n + 1) β†’ E) :
-    (iteratedFderiv π•œ (n + 1) f x : (Fin (n + 1) β†’ E) β†’ F) m =
-      iteratedFderiv π•œ n (fun y => fderiv π•œ f y) x (init m) (m (last n)) :=
-  by
-  rw [← iteratedFderivWithin_univ, ← iteratedFderivWithin_univ, ← fderivWithin_univ]
-  exact iteratedFderivWithin_succ_apply_right uniqueDiffOn_univ (mem_univ _) _
-#align iterated_fderiv_succ_apply_right iteratedFderiv_succ_apply_right
-
-/-- Writing explicitly the `n+1`-th derivative as the composition of a currying linear equiv,
-and the `n`-th derivative of the derivative. -/
-theorem iteratedFderiv_succ_eq_comp_right {n : β„•} :
-    iteratedFderiv π•œ (n + 1) f x =
-      (continuousMultilinearCurryRightEquiv' π•œ n E F ∘ iteratedFderiv π•œ n fun y => fderiv π•œ f y)
-        x :=
-  by
-  ext m
-  rw [iteratedFderiv_succ_apply_right]
-  rfl
-#align iterated_fderiv_succ_eq_comp_right iteratedFderiv_succ_eq_comp_right
-
-theorem norm_iteratedFderiv_fderiv {n : β„•} :
-    β€–iteratedFderiv π•œ n (fderiv π•œ f) xβ€– = β€–iteratedFderiv π•œ (n + 1) f xβ€– := by
-  rw [iteratedFderiv_succ_eq_comp_right, LinearIsometryEquiv.norm_map]
-#align norm_iterated_fderiv_fderiv norm_iteratedFderiv_fderiv
-
-@[simp]
-theorem iteratedFderiv_one_apply (m : Fin 1 β†’ E) :
-    (iteratedFderiv π•œ 1 f x : (Fin 1 β†’ E) β†’ F) m = (fderiv π•œ f x : E β†’ F) (m 0) :=
-  by
-  rw [iteratedFderiv_succ_apply_right, iteratedFderiv_zero_apply]
-  rfl
-#align iterated_fderiv_one_apply iteratedFderiv_one_apply
-
-/-- When a function is `C^n` in a set `s` of unique differentiability, it admits
-`ftaylor_series_within π•œ f s` as a Taylor series up to order `n` in `s`. -/
-theorem contDiff_on_iff_ftaylorSeries :
-    ContDiff π•œ n f ↔ HasFtaylorSeriesUpTo n f (ftaylorSeries π•œ f) :=
-  by
-  constructor
-  Β· rw [← contDiffOn_univ, ← hasFtaylorSeriesUpToOn_univ_iff, ← ftaylorSeriesWithin_univ]
-    exact fun h => ContDiffOn.ftaylorSeriesWithin h uniqueDiffOn_univ
-  Β· intro h
-    exact ⟨ftaylorSeries π•œ f, h⟩
-#align cont_diff_on_iff_ftaylor_series contDiff_on_iff_ftaylorSeries
-
-theorem contDiff_iff_continuous_differentiable :
-    ContDiff π•œ n f ↔
-      (βˆ€ m : β„•, (m : β„•βˆž) ≀ n β†’ Continuous fun x => iteratedFderiv π•œ m f x) ∧
-        βˆ€ m : β„•, (m : β„•βˆž) < n β†’ Differentiable π•œ fun x => iteratedFderiv π•œ m f x :=
-  by
-  simp [cont_diff_on_univ.symm, continuous_iff_continuousOn_univ, differentiable_on_univ.symm,
-    iteratedFderivWithin_univ, contDiffOn_iff_continuousOn_differentiableOn uniqueDiffOn_univ]
-#align cont_diff_iff_continuous_differentiable contDiff_iff_continuous_differentiable
-
-/-- If `f` is `C^n` then its `m`-times iterated derivative is continuous for `m ≀ n`. -/
-theorem ContDiff.continuous_iteratedFderiv {m : β„•} (hm : (m : β„•βˆž) ≀ n) (hf : ContDiff π•œ n f) :
-    Continuous fun x => iteratedFderiv π•œ m f x :=
-  (contDiff_iff_continuous_differentiable.mp hf).1 m hm
-#align cont_diff.continuous_iterated_fderiv ContDiff.continuous_iteratedFderiv
-
-/-- If `f` is `C^n` then its `m`-times iterated derivative is differentiable for `m < n`. -/
-theorem ContDiff.differentiable_iteratedFderiv {m : β„•} (hm : (m : β„•βˆž) < n) (hf : ContDiff π•œ n f) :
-    Differentiable π•œ fun x => iteratedFderiv π•œ m f x :=
-  (contDiff_iff_continuous_differentiable.mp hf).2 m hm
-#align cont_diff.differentiable_iterated_fderiv ContDiff.differentiable_iteratedFderiv
-
-theorem contDiff_of_differentiable_iteratedFderiv
-    (h : βˆ€ m : β„•, (m : β„•βˆž) ≀ n β†’ Differentiable π•œ (iteratedFderiv π•œ m f)) : ContDiff π•œ n f :=
-  contDiff_iff_continuous_differentiable.2
-    ⟨fun m hm => (h m hm).Continuous, fun m hm => h m (le_of_lt hm)⟩
-#align cont_diff_of_differentiable_iterated_fderiv contDiff_of_differentiable_iteratedFderiv
-
-/-- A function is `C^(n + 1)` if and only if it is differentiable,
-and its derivative (formulated in terms of `fderiv`) is `C^n`. -/
-theorem contDiff_succ_iff_fderiv {n : β„•} :
-    ContDiff π•œ (n + 1 : β„•) f ↔ Differentiable π•œ f ∧ ContDiff π•œ n fun y => fderiv π•œ f y := by
-  simp only [← contDiffOn_univ, ← differentiableOn_univ, ← fderivWithin_univ,
-    contDiffOn_succ_iff_fderivWithin uniqueDiffOn_univ]
-#align cont_diff_succ_iff_fderiv contDiff_succ_iff_fderiv
-
-theorem contDiff_one_iff_fderiv : ContDiff π•œ 1 f ↔ Differentiable π•œ f ∧ Continuous (fderiv π•œ f) :=
-  contDiff_succ_iff_fderiv.trans <| Iff.rfl.And contDiff_zero
-#align cont_diff_one_iff_fderiv contDiff_one_iff_fderiv
-
-/-- A function is `C^∞` if and only if it is differentiable,
-and its derivative (formulated in terms of `fderiv`) is `C^∞`. -/
-theorem contDiff_top_iff_fderiv :
-    ContDiff π•œ ∞ f ↔ Differentiable π•œ f ∧ ContDiff π•œ ∞ fun y => fderiv π•œ f y :=
-  by
-  simp only [← contDiffOn_univ, ← differentiableOn_univ, ← fderivWithin_univ]
-  rw [contDiffOn_top_iff_fderivWithin uniqueDiffOn_univ]
-#align cont_diff_top_iff_fderiv contDiff_top_iff_fderiv
-
-theorem ContDiff.continuous_fderiv (h : ContDiff π•œ n f) (hn : 1 ≀ n) :
-    Continuous fun x => fderiv π•œ f x :=
-  (contDiff_succ_iff_fderiv.1 (h.of_le hn)).2.Continuous
-#align cont_diff.continuous_fderiv ContDiff.continuous_fderiv
-
-/-- If a function is at least `C^1`, its bundled derivative (mapping `(x, v)` to `Df(x) v`) is
-continuous. -/
-theorem ContDiff.continuous_fderiv_apply (h : ContDiff π•œ n f) (hn : 1 ≀ n) :
-    Continuous fun p : E Γ— E => (fderiv π•œ f p.1 : E β†’ F) p.2 :=
-  have A : Continuous fun q : (E β†’L[π•œ] F) Γ— E => q.1 q.2 := isBoundedBilinearMapApply.Continuous
-  have B : Continuous fun p : E Γ— E => (fderiv π•œ f p.1, p.2) :=
-    ((h.continuous_fderiv hn).comp continuous_fst).prod_mk continuous_snd
-  A.comp B
-#align cont_diff.continuous_fderiv_apply ContDiff.continuous_fderiv_apply
+  {p : E β†’ FormalMultilinearSeries π•œ E F}
 
 /-! ### Constants -/
 
@@ -1918,6 +230,105 @@ theorem ContDiff.continuousLinearMap_comp {f : E β†’ F} (g : F β†’L[π•œ] G) (hf
   contDiffOn_univ.1 <| ContDiffOn.continuousLinearMap_comp _ (contDiffOn_univ.2 hf)
 #align cont_diff.continuous_linear_map_comp ContDiff.continuousLinearMap_comp
 
+/-- The iterated derivative within a set of the composition with a linear map on the left is
+obtained by applying the linear map to the iterated derivative. -/
+theorem ContinuousLinearMap.iteratedFderivWithin_comp_left {f : E β†’ F} (g : F β†’L[π•œ] G)
+    (hf : ContDiffOn π•œ n f s) (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) {i : β„•}
+    (hi : (i : WithTop β„•) ≀ n) :
+    iteratedFderivWithin π•œ i (g ∘ f) s x =
+      g.compContinuousMultilinearMap (iteratedFderivWithin π•œ i f s x) :=
+  (((hf.ftaylorSeriesWithin hs).continuousLinearMapComp g).eq_ftaylor_series_of_uniqueDiffOn hi hs
+      hx).symm
+#align continuous_linear_map.iterated_fderiv_within_comp_left ContinuousLinearMap.iteratedFderivWithin_comp_left
+
+/-- The iterated derivative of the composition with a linear map on the left is
+obtained by applying the linear map to the iterated derivative. -/
+theorem ContinuousLinearMap.iteratedFderiv_comp_left {f : E β†’ F} (g : F β†’L[π•œ] G)
+    (hf : ContDiff π•œ n f) (x : E) {i : β„•} (hi : (i : WithTop β„•) ≀ n) :
+    iteratedFderiv π•œ i (g ∘ f) x = g.compContinuousMultilinearMap (iteratedFderiv π•œ i f x) :=
+  by
+  simp only [← iteratedFderivWithin_univ]
+  exact g.iterated_fderiv_within_comp_left hf.cont_diff_on uniqueDiffOn_univ (mem_univ x) hi
+#align continuous_linear_map.iterated_fderiv_comp_left ContinuousLinearMap.iteratedFderiv_comp_left
+
+/-- The iterated derivative within a set of the composition with a linear equiv on the left is
+obtained by applying the linear equiv to the iterated derivative. This is true without
+differentiability assumptions. -/
+theorem ContinuousLinearEquiv.iteratedFderivWithin_comp_left (g : F ≃L[π•œ] G) (f : E β†’ F)
+    (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) (i : β„•) :
+    iteratedFderivWithin π•œ i (g ∘ f) s x =
+      (g : F β†’L[π•œ] G).compContinuousMultilinearMap (iteratedFderivWithin π•œ i f s x) :=
+  by
+  induction' i with i IH generalizing x
+  Β· ext1 m
+    simp only [iteratedFderivWithin_zero_apply, ContinuousLinearEquiv.coe_coe,
+      ContinuousLinearMap.compContinuousMultilinearMap_coe, EmbeddingLike.apply_eq_iff_eq]
+  Β· ext1 m
+    rw [iteratedFderivWithin_succ_apply_left]
+    have Z :
+      fderivWithin π•œ (iteratedFderivWithin π•œ i (g ∘ f) s) s x =
+        fderivWithin π•œ
+          (fun y =>
+            g.comp_continuous_multilinear_mapL (fun j : Fin i => E)
+              (iteratedFderivWithin π•œ i f s y))
+          s x :=
+      fderivWithin_congr' (hs x hx) (fun y hy => IH hy) hx
+    simp_rw [Z]
+    rw [(g.comp_continuous_multilinear_mapL fun j : Fin i => E).comp_fderivWithin (hs x hx)]
+    simp only [ContinuousLinearMap.coe_comp', ContinuousLinearEquiv.coe_coe, comp_app,
+      ContinuousLinearEquiv.compContinuousMultilinearMapL_apply,
+      ContinuousLinearMap.compContinuousMultilinearMap_coe, EmbeddingLike.apply_eq_iff_eq]
+    rw [iteratedFderivWithin_succ_apply_left]
+#align continuous_linear_equiv.iterated_fderiv_within_comp_left ContinuousLinearEquiv.iteratedFderivWithin_comp_left
+
+/-- Composition with a linear isometry on the left preserves the norm of the iterated
+derivative within a set. -/
+theorem LinearIsometry.norm_iteratedFderivWithin_comp_left {f : E β†’ F} (g : F β†’β‚—α΅’[π•œ] G)
+    (hf : ContDiffOn π•œ n f s) (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) {i : β„•}
+    (hi : (i : WithTop β„•) ≀ n) :
+    β€–iteratedFderivWithin π•œ i (g ∘ f) s xβ€– = β€–iteratedFderivWithin π•œ i f s xβ€– :=
+  by
+  have :
+    iteratedFderivWithin π•œ i (g ∘ f) s x =
+      g.to_continuous_linear_map.comp_continuous_multilinear_map (iteratedFderivWithin π•œ i f s x) :=
+    g.to_continuous_linear_map.iterated_fderiv_within_comp_left hf hs hx hi
+  rw [this]
+  apply LinearIsometry.norm_compContinuousMultilinearMap
+#align linear_isometry.norm_iterated_fderiv_within_comp_left LinearIsometry.norm_iteratedFderivWithin_comp_left
+
+/-- Composition with a linear isometry on the left preserves the norm of the iterated
+derivative. -/
+theorem LinearIsometry.norm_iteratedFderiv_comp_left {f : E β†’ F} (g : F β†’β‚—α΅’[π•œ] G)
+    (hf : ContDiff π•œ n f) (x : E) {i : β„•} (hi : (i : WithTop β„•) ≀ n) :
+    β€–iteratedFderiv π•œ i (g ∘ f) xβ€– = β€–iteratedFderiv π•œ i f xβ€– :=
+  by
+  simp only [← iteratedFderivWithin_univ]
+  exact g.norm_iterated_fderiv_within_comp_left hf.cont_diff_on uniqueDiffOn_univ (mem_univ x) hi
+#align linear_isometry.norm_iterated_fderiv_comp_left LinearIsometry.norm_iteratedFderiv_comp_left
+
+/-- Composition with a linear isometry equiv on the left preserves the norm of the iterated
+derivative within a set. -/
+theorem LinearIsometryEquiv.norm_iteratedFderivWithin_comp_left (g : F ≃ₗᡒ[π•œ] G) (f : E β†’ F)
+    (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) (i : β„•) :
+    β€–iteratedFderivWithin π•œ i (g ∘ f) s xβ€– = β€–iteratedFderivWithin π•œ i f s xβ€– :=
+  by
+  have :
+    iteratedFderivWithin π•œ i (g ∘ f) s x =
+      (g : F β†’L[π•œ] G).compContinuousMultilinearMap (iteratedFderivWithin π•œ i f s x) :=
+    g.to_continuous_linear_equiv.iterated_fderiv_within_comp_left f hs hx i
+  rw [this]
+  apply LinearIsometry.norm_compContinuousMultilinearMap g.to_linear_isometry
+#align linear_isometry_equiv.norm_iterated_fderiv_within_comp_left LinearIsometryEquiv.norm_iteratedFderivWithin_comp_left
+
+/-- Composition with a linear isometry equiv on the left preserves the norm of the iterated
+derivative. -/
+theorem LinearIsometryEquiv.norm_iteratedFderiv_comp_left (g : F ≃ₗᡒ[π•œ] G) (f : E β†’ F) (x : E)
+    (i : β„•) : β€–iteratedFderiv π•œ i (g ∘ f) xβ€– = β€–iteratedFderiv π•œ i f xβ€– :=
+  by
+  rw [← iteratedFderivWithin_univ, ← iteratedFderivWithin_univ]
+  apply g.norm_iterated_fderiv_within_comp_left f uniqueDiffOn_univ (mem_univ x) i
+#align linear_isometry_equiv.norm_iterated_fderiv_comp_left LinearIsometryEquiv.norm_iteratedFderiv_comp_left
+
 /-- Composition by continuous linear equivs on the left respects higher differentiability at a
 point in a domain. -/
 theorem ContinuousLinearEquiv.comp_contDiffWithinAt_iff (e : F ≃L[π•œ] G) :
@@ -2002,6 +413,83 @@ theorem ContDiff.comp_continuousLinearMap {f : E β†’ F} {g : G β†’L[π•œ] E} (hf
   contDiffOn_univ.1 <| ContDiffOn.comp_continuousLinearMap (contDiffOn_univ.2 hf) _
 #align cont_diff.comp_continuous_linear_map ContDiff.comp_continuousLinearMap
 
+/-- The iterated derivative within a set of the composition with a linear map on the right is
+obtained by composing the iterated derivative with the linear map. -/
+theorem ContinuousLinearMap.iteratedFderivWithin_comp_right {f : E β†’ F} (g : G β†’L[π•œ] E)
+    (hf : ContDiffOn π•œ n f s) (hs : UniqueDiffOn π•œ s) (h's : UniqueDiffOn π•œ (g ⁻¹' s)) {x : G}
+    (hx : g x ∈ s) {i : β„•} (hi : (i : WithTop β„•) ≀ n) :
+    iteratedFderivWithin π•œ i (f ∘ g) (g ⁻¹' s) x =
+      (iteratedFderivWithin π•œ i f s (g x)).compContinuousLinearMap fun _ => g :=
+  (((hf.ftaylorSeriesWithin hs).compContinuousLinearMap g).eq_ftaylor_series_of_uniqueDiffOn hi h's
+      hx).symm
+#align continuous_linear_map.iterated_fderiv_within_comp_right ContinuousLinearMap.iteratedFderivWithin_comp_right
+
+/-- The iterated derivative within a set of the composition with a linear equiv on the right is
+obtained by composing the iterated derivative with the linear equiv. -/
+theorem ContinuousLinearEquiv.iteratedFderivWithin_comp_right (g : G ≃L[π•œ] E) (f : E β†’ F)
+    (hs : UniqueDiffOn π•œ s) {x : G} (hx : g x ∈ s) (i : β„•) :
+    iteratedFderivWithin π•œ i (f ∘ g) (g ⁻¹' s) x =
+      (iteratedFderivWithin π•œ i f s (g x)).compContinuousLinearMap fun _ => g :=
+  by
+  induction' i with i IH generalizing x
+  Β· ext1 m
+    simp only [iteratedFderivWithin_zero_apply,
+      ContinuousMultilinearMap.compContinuousLinearMap_apply]
+  Β· ext1 m
+    simp only [ContinuousMultilinearMap.compContinuousLinearMap_apply,
+      ContinuousLinearEquiv.coe_coe, iteratedFderivWithin_succ_apply_left]
+    have :
+      fderivWithin π•œ (iteratedFderivWithin π•œ i (f ∘ ⇑g) (⇑g ⁻¹' s)) (⇑g ⁻¹' s) x =
+        fderivWithin π•œ
+          (fun y =>
+            ContinuousMultilinearMap.compContinuousLinearMapEquivL _ (fun _x : Fin i => g)
+              (iteratedFderivWithin π•œ i f s (g y)))
+          (g ⁻¹' s) x :=
+      fderivWithin_congr' (g.unique_diff_on_preimage_iff.2 hs x hx) (fun y hy => IH hy) hx
+    rw [this]
+    rw [ContinuousLinearEquiv.comp_fderivWithin _ (g.unique_diff_on_preimage_iff.2 hs x hx)]
+    simp only [ContinuousLinearMap.coe_comp', ContinuousLinearEquiv.coe_coe, comp_app,
+      ContinuousMultilinearMap.compContinuousLinearMapEquivL_apply,
+      ContinuousMultilinearMap.compContinuousLinearMap_apply]
+    rw [ContinuousLinearEquiv.comp_right_fderivWithin _ (g.unique_diff_on_preimage_iff.2 hs x hx)]
+    rfl
+#align continuous_linear_equiv.iterated_fderiv_within_comp_right ContinuousLinearEquiv.iteratedFderivWithin_comp_right
+
+/-- The iterated derivative of the composition with a linear map on the right is
+obtained by composing the iterated derivative with the linear map. -/
+theorem ContinuousLinearMap.iteratedFderiv_comp_right (g : G β†’L[π•œ] E) {f : E β†’ F}
+    (hf : ContDiff π•œ n f) (x : G) {i : β„•} (hi : (i : WithTop β„•) ≀ n) :
+    iteratedFderiv π•œ i (f ∘ g) x =
+      (iteratedFderiv π•œ i f (g x)).compContinuousLinearMap fun _ => g :=
+  by
+  simp only [← iteratedFderivWithin_univ]
+  apply
+    g.iterated_fderiv_within_comp_right hf.cont_diff_on uniqueDiffOn_univ uniqueDiffOn_univ
+      (mem_univ _) hi
+#align continuous_linear_map.iterated_fderiv_comp_right ContinuousLinearMap.iteratedFderiv_comp_right
+
+/-- Composition with a linear isometry on the right preserves the norm of the iterated derivative
+within a set. -/
+theorem LinearIsometryEquiv.norm_iteratedFderivWithin_comp_right (g : G ≃ₗᡒ[π•œ] E) (f : E β†’ F)
+    (hs : UniqueDiffOn π•œ s) {x : G} (hx : g x ∈ s) (i : β„•) :
+    β€–iteratedFderivWithin π•œ i (f ∘ g) (g ⁻¹' s) xβ€– = β€–iteratedFderivWithin π•œ i f s (g x)β€– :=
+  by
+  have :
+    iteratedFderivWithin π•œ i (f ∘ g) (g ⁻¹' s) x =
+      (iteratedFderivWithin π•œ i f s (g x)).compContinuousLinearMap fun _ => g :=
+    g.to_continuous_linear_equiv.iterated_fderiv_within_comp_right f hs hx i
+  rw [this, ContinuousMultilinearMap.norm_comp_continuous_linearIsometryEquiv]
+#align linear_isometry_equiv.norm_iterated_fderiv_within_comp_right LinearIsometryEquiv.norm_iteratedFderivWithin_comp_right
+
+/-- Composition with a linear isometry on the right preserves the norm of the iterated derivative
+within a set. -/
+theorem LinearIsometryEquiv.norm_iteratedFderiv_comp_right (g : G ≃ₗᡒ[π•œ] E) (f : E β†’ F) (x : G)
+    (i : β„•) : β€–iteratedFderiv π•œ i (f ∘ g) xβ€– = β€–iteratedFderiv π•œ i f (g x)β€– :=
+  by
+  simp only [← iteratedFderivWithin_univ]
+  apply g.norm_iterated_fderiv_within_comp_right f uniqueDiffOn_univ (mem_univ (g x)) i
+#align linear_isometry_equiv.norm_iterated_fderiv_comp_right LinearIsometryEquiv.norm_iteratedFderiv_comp_right
+
 /-- Composition by continuous linear equivs on the right respects higher differentiability at a
 point in a domain. -/
 theorem ContinuousLinearEquiv.contDiffWithinAt_comp_iff (e : G ≃L[π•œ] E) :
@@ -2179,22 +667,14 @@ theorem ContDiffOn.comp {s : Set E} {t : Set F} {g : F β†’ G} {f : E β†’ F} (hg
     (hf : ContDiffOn π•œ n f s) (st : s βŠ† f ⁻¹' t) : ContDiffOn π•œ n (g ∘ f) s :=
   by
   /- we lift all the spaces to a common universe, as we have already proved the result in this
-    situation. For the lift, we use the trick that `H` is isomorphic through a
-    continuous linear equiv to `continuous_multilinear_map π•œ (Ξ» (i : fin 0), (E Γ— F Γ— G)) H`, and
-    continuous linear equivs respect smoothness classes. -/
-  let Eu := ContinuousMultilinearMap π•œ (fun i : Fin 0 => E Γ— F Γ— G) E
-  letI : NormedAddCommGroup Eu := by infer_instance
-  letI : NormedSpace π•œ Eu := by infer_instance
-  let Fu := ContinuousMultilinearMap π•œ (fun i : Fin 0 => E Γ— F Γ— G) F
-  letI : NormedAddCommGroup Fu := by infer_instance
-  letI : NormedSpace π•œ Fu := by infer_instance
-  let Gu := ContinuousMultilinearMap π•œ (fun i : Fin 0 => E Γ— F Γ— G) G
-  letI : NormedAddCommGroup Gu := by infer_instance
-  letI : NormedSpace π•œ Gu := by infer_instance
+    situation. -/
+  let Eu : Type max uE uF uG := ULift E
+  let Fu : Type max uE uF uG := ULift.{max uE uG, uF} F
+  let Gu : Type max uE uF uG := ULift.{max uE uF, uG} G
   -- declare the isomorphisms
-  let isoE : Eu ≃L[π•œ] E := continuousMultilinearCurryFin0 π•œ (E Γ— F Γ— G) E
-  let isoF : Fu ≃L[π•œ] F := continuousMultilinearCurryFin0 π•œ (E Γ— F Γ— G) F
-  let isoG : Gu ≃L[π•œ] G := continuousMultilinearCurryFin0 π•œ (E Γ— F Γ— G) G
+  have isoE : Eu ≃L[π•œ] E := ContinuousLinearEquiv.ulift
+  have isoF : Fu ≃L[π•œ] F := ContinuousLinearEquiv.ulift
+  have isoG : Gu ≃L[π•œ] G := ContinuousLinearEquiv.ulift
   -- lift the functions to the new spaces, check smoothness there, and then go back.
   let fu : Eu β†’ Fu := (isoF.symm ∘ f) ∘ isoE
   have fu_diff : ContDiffOn π•œ n fu (isoE ⁻¹' s) := by
@@ -2630,7 +1110,7 @@ theorem ContDiffWithinAt.fderivWithin_right (hf : ContDiffWithinAt π•œ n f s x
 #align cont_diff_within_at.fderiv_within_right ContDiffWithinAt.fderivWithin_right
 
 /-- `x ↦ fderiv π•œ (f x) (g x)` is smooth at `xβ‚€`. -/
-theorem ContDiffAt.contDiffAt_fderiv {f : E β†’ F β†’ G} {g : E β†’ F} {n : β„•βˆž}
+theorem ContDiffAt.fderiv {f : E β†’ F β†’ G} {g : E β†’ F} {n : β„•βˆž}
     (hf : ContDiffAt π•œ n (Function.uncurry f) (xβ‚€, g xβ‚€)) (hg : ContDiffAt π•œ m g xβ‚€)
     (hmn : m + 1 ≀ n) : ContDiffAt π•œ m (fun x => fderiv π•œ (f x) (g x)) xβ‚€ :=
   by
@@ -2640,15 +1120,27 @@ theorem ContDiffAt.contDiffAt_fderiv {f : E β†’ F β†’ G} {g : E β†’ F} {n : β„•
           hmn (mem_univ xβ‚€) _).ContDiffAt
       univ_mem
   rw [preimage_univ]
-#align cont_diff_at.cont_diff_at_fderiv ContDiffAt.contDiffAt_fderiv
+#align cont_diff_at.fderiv ContDiffAt.fderiv
+
+/-- `fderiv π•œ f` is smooth at `xβ‚€`. -/
+theorem ContDiffAt.fderiv_right (hf : ContDiffAt π•œ n f xβ‚€) (hmn : (m + 1 : β„•βˆž) ≀ n) :
+    ContDiffAt π•œ m (fderiv π•œ f) xβ‚€ :=
+  ContDiffAt.fderiv (ContDiffAt.comp (xβ‚€, xβ‚€) hf contDiffAt_snd) contDiffAt_id hmn
+#align cont_diff_at.fderiv_right ContDiffAt.fderiv_right
 
 /-- `x ↦ fderiv π•œ (f x) (g x)` is smooth. -/
 theorem ContDiff.fderiv {f : E β†’ F β†’ G} {g : E β†’ F} {n m : β„•βˆž}
     (hf : ContDiff π•œ m <| Function.uncurry f) (hg : ContDiff π•œ n g) (hnm : n + 1 ≀ m) :
     ContDiff π•œ n fun x => fderiv π•œ (f x) (g x) :=
-  contDiff_iff_contDiffAt.mpr fun x => hf.ContDiffAt.contDiffAt_fderiv hg.ContDiffAt hnm
+  contDiff_iff_contDiffAt.mpr fun x => hf.ContDiffAt.fderiv hg.ContDiffAt hnm
 #align cont_diff.fderiv ContDiff.fderiv
 
+/-- `fderiv π•œ f` is smooth. -/
+theorem ContDiff.fderiv_right (hf : ContDiff π•œ n f) (hmn : (m + 1 : β„•βˆž) ≀ n) :
+    ContDiff π•œ m (fderiv π•œ f) :=
+  contDiff_iff_contDiffAt.mpr fun x => hf.ContDiffAt.fderiv_right hmn
+#align cont_diff.fderiv_right ContDiff.fderiv_right
+
 /-- `x ↦ fderiv π•œ (f x) (g x)` is continuous. -/
 theorem Continuous.fderiv {f : E β†’ F β†’ G} {g : E β†’ F} {n : β„•βˆž}
     (hf : ContDiff π•œ n <| Function.uncurry f) (hg : Continuous g) (hn : 1 ≀ n) :
@@ -2813,6 +1305,9 @@ theorem ContDiffOn.add {s : Set E} {f g : E β†’ F} (hf : ContDiffOn π•œ n f s)
 
 variable {i : β„•}
 
+/-- The iterated derivative of the sum of two functions is the sum of the iterated derivatives.
+See also `iterated_fderiv_within_add_apply'`, which uses the spelling `(Ξ» x, f x + g x)`
+instead of `f + g`. -/
 theorem iteratedFderivWithin_add_apply {f g : E β†’ F} (hf : ContDiffOn π•œ i f s)
     (hg : ContDiffOn π•œ i g s) (hu : UniqueDiffOn π•œ s) (hx : x ∈ s) :
     iteratedFderivWithin π•œ i (f + g) s x =
@@ -2848,6 +1343,17 @@ theorem iteratedFderivWithin_add_apply {f g : E β†’ F} (hf : ContDiffOn π•œ i f
       
 #align iterated_fderiv_within_add_apply iteratedFderivWithin_add_apply
 
+/-- The iterated derivative of the sum of two functions is the sum of the iterated derivatives.
+This is the same as `iterated_fderiv_within_add_apply`, but using the spelling `(Ξ» x, f x + g x)`
+instead of `f + g`, which can be handy for some rewrites.
+TODO: use one form consistently. -/
+theorem iteratedFderivWithin_add_apply' {f g : E β†’ F} (hf : ContDiffOn π•œ i f s)
+    (hg : ContDiffOn π•œ i g s) (hu : UniqueDiffOn π•œ s) (hx : x ∈ s) :
+    iteratedFderivWithin π•œ i (fun x => f x + g x) s x =
+      iteratedFderivWithin π•œ i f s x + iteratedFderivWithin π•œ i g s x :=
+  iteratedFderivWithin_add_apply hf hg hu hx
+#align iterated_fderiv_within_add_apply' iteratedFderivWithin_add_apply'
+
 theorem iteratedFderiv_add_apply {i : β„•} {f g : E β†’ F} (hf : ContDiff π•œ i f) (hg : ContDiff π•œ i g) :
     iteratedFderiv π•œ i (f + g) x = iteratedFderiv π•œ i f x + iteratedFderiv π•œ i g x :=
   by
@@ -2855,6 +1361,12 @@ theorem iteratedFderiv_add_apply {i : β„•} {f g : E β†’ F} (hf : ContDiff π•œ i
   exact iteratedFderivWithin_add_apply hf hg uniqueDiffOn_univ (Set.mem_univ _)
 #align iterated_fderiv_add_apply iteratedFderiv_add_apply
 
+theorem iteratedFderiv_add_apply' {i : β„•} {f g : E β†’ F} (hf : ContDiff π•œ i f)
+    (hg : ContDiff π•œ i g) :
+    iteratedFderiv π•œ i (fun x => f x + g x) x = iteratedFderiv π•œ i f x + iteratedFderiv π•œ i g x :=
+  iteratedFderiv_add_apply hf hg
+#align iterated_fderiv_add_apply' iteratedFderiv_add_apply'
+
 end Add
 
 /-! ### Negative -/
Diff
@@ -615,7 +615,7 @@ theorem contDiffWithinAt_succ_iff_hasFderivWithinAt {n : β„•} :
           HasFderivWithinAt (fun z => (continuousMultilinearCurryFin0 π•œ E F).symm (f z))
             (FormalMultilinearSeries.unshift (p' y) (f y) 1).curryLeft (v ∩ u) y
         rw [LinearIsometryEquiv.comp_hasFderivWithinAt_iff']
-        convert (f'_eq_deriv y hy.2).mono (inter_subset_right v u)
+        convert(f'_eq_deriv y hy.2).mono (inter_subset_right v u)
         rw [← Hp'.zero_eq y hy.1]
         ext z
         change
@@ -623,7 +623,7 @@ theorem contDiffWithinAt_succ_iff_hasFderivWithinAt {n : β„•} :
             ((p' y 0) 0) z
         unfold_coes
         congr
-      Β· convert (Hp'.mono (inter_subset_left v u)).congr fun x hx => Hp'.zero_eq x hx.1
+      Β· convert(Hp'.mono (inter_subset_left v u)).congr fun x hx => Hp'.zero_eq x hx.1
         Β· ext (x y)
           change p' x 0 (init (@snoc 0 (fun i : Fin 1 => E) 0 y)) y = p' x 0 0 y
           rw [init_snoc]
@@ -1098,7 +1098,7 @@ theorem contDiffOn_of_continuousOn_differentiableOn
     simp only [ftaylorSeriesWithin, ContinuousMultilinearMap.uncurry0_apply,
       iteratedFderivWithin_zero_apply]
   Β· intro k hk y hy
-    convert (Hdiff k (lt_of_lt_of_le hk hm) y hy).HasFderivWithinAt
+    convert(Hdiff k (lt_of_lt_of_le hk hm) y hy).HasFderivWithinAt
     simp only [ftaylorSeriesWithin, iteratedFderivWithin_succ_eq_comp_left,
       ContinuousLinearEquiv.coe_apply, Function.comp_apply, coeFn_coeBase]
     exact ContinuousLinearMap.curry_uncurryLeft _
@@ -1885,9 +1885,9 @@ theorem HasFtaylorSeriesUpToOn.continuousLinearMapComp (g : F β†’L[π•œ] G)
   constructor
   Β· exact fun x hx => congr_arg g (hf.zero_eq x hx)
   Β· intro m hm x hx
-    convert (L m).HasFderivAt.comp_hasFderivWithinAt x (hf.fderiv_within m hm x hx)
+    convert(L m).HasFderivAt.comp_hasFderivWithinAt x (hf.fderiv_within m hm x hx)
   Β· intro m hm
-    convert (L m).Continuous.comp_continuousOn (hf.cont m hm)
+    convert(L m).Continuous.comp_continuousOn (hf.cont m hm)
 #align has_ftaylor_series_up_to_on.continuous_linear_map_comp HasFtaylorSeriesUpToOn.continuousLinearMapComp
 
 /-- Composition by continuous linear maps on the left preserves `C^n` functions in a domain
@@ -1965,8 +1965,7 @@ theorem HasFtaylorSeriesUpToOn.compContinuousLinearMap (hf : HasFtaylorSeriesUpT
     rw [ContinuousLinearMap.map_zero]
     rfl
   Β· intro m hm x hx
-    convert
-      (hA m).HasFderivAt.comp_hasFderivWithinAt x
+    convert(hA m).HasFderivAt.comp_hasFderivWithinAt x
         ((hf.fderiv_within m hm (g x) hx).comp x g.has_fderiv_within_at (subset.refl _))
     ext (y v)
     change p (g x) (Nat.succ m) (g ∘ cons y v) = p (g x) m.succ (cons (g y) (g ∘ v))
@@ -2063,8 +2062,7 @@ theorem HasFtaylorSeriesUpToOn.prod (hf : HasFtaylorSeriesUpToOn n f p s) {g : E
     rw [← hf.zero_eq x hx, ← hg.zero_eq x hx]
     rfl
   Β· intro m hm x hx
-    convert
-      (L m).HasFderivAt.comp_hasFderivWithinAt x
+    convert(L m).HasFderivAt.comp_hasFderivWithinAt x
         ((hf.fderiv_within m hm x hx).Prod (hg.fderiv_within m hm x hx))
   Β· intro m hm
     exact (L m).Continuous.comp_continuousOn ((hf.cont m hm).Prod (hg.cont m hm))
@@ -2720,10 +2718,10 @@ theorem hasFtaylorSeriesUpToOn_pi :
     exact (h i).zero_eq x hx
   Β· intro m hm x hx
     have := hasFderivWithinAt_pi.2 fun i => (h i).fderivWithin m hm x hx
-    convert (L m).HasFderivAt.comp_hasFderivWithinAt x this
+    convert(L m).HasFderivAt.comp_hasFderivWithinAt x this
   Β· intro m hm
     have := continuousOn_pi.2 fun i => (h i).cont m hm
-    convert (L m).Continuous.comp_continuousOn this
+    convert(L m).Continuous.comp_continuousOn this
 #align has_ftaylor_series_up_to_on_pi hasFtaylorSeriesUpToOn_pi
 
 @[simp]
@@ -3314,8 +3312,8 @@ theorem contDiffAt_ring_inverse [CompleteSpace R] (x : RΛ£) : ContDiffAt π•œ n
       rw [inverse_unit]
       exact hasFderivAt_ring_inverse y
     Β·
-      convert
-        (mul_left_right_is_bounded_bilinear π•œ R).ContDiff.neg.comp_contDiffAt (x : R) (IH.prod IH)
+      convert(mul_left_right_is_bounded_bilinear π•œ R).ContDiff.neg.comp_contDiffAt (x : R)
+          (IH.prod IH)
   Β· exact cont_diff_at_top.mpr Itop
 #align cont_diff_at_ring_inverse contDiffAt_ring_inverse
 
@@ -3861,8 +3859,7 @@ theorem HasFtaylorSeriesUpToOn.restrictScalars (h : HasFtaylorSeriesUpToOn n f p
   { zero_eq := fun x hx => h.zero_eq x hx
     fderivWithin := by
       intro m hm x hx
-      convert
-        (ContinuousMultilinearMap.restrictScalarsLinear π•œ).HasFderivAt.comp_hasFderivWithinAt _
+      convert(ContinuousMultilinearMap.restrictScalarsLinear π•œ).HasFderivAt.comp_hasFderivWithinAt _
           ((h.fderiv_within m hm x hx).restrictScalars π•œ)
     cont := fun m hm =>
       ContinuousMultilinearMap.continuous_restrictScalars.comp_continuousOn (h.cont m hm) }
Diff
@@ -1171,7 +1171,7 @@ theorem contDiffOn_succ_iff_fderivWithin {n : β„•} (hs : UniqueDiffOn π•œ s) :
   rwa [fderivWithin_inter (IsOpen.mem_nhds o_open hy.2) (hs y hy.1)] at A
 #align cont_diff_on_succ_iff_fderiv_within contDiffOn_succ_iff_fderivWithin
 
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:76:14: unsupported tactic `congrm #[[expr «expr ∧ »(_, _)]] -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:73:14: unsupported tactic `congrm #[[expr «expr ∧ »(_, _)]] -/
 /-- A function is `C^(n + 1)` on an open domain if and only if it is
 differentiable there, and its derivative (expressed with `fderiv`) is `C^n`. -/
 theorem contDiffOn_succ_iff_fderiv_of_open {n : β„•} (hs : IsOpen s) :
@@ -1180,7 +1180,7 @@ theorem contDiffOn_succ_iff_fderiv_of_open {n : β„•} (hs : IsOpen s) :
   by
   rw [contDiffOn_succ_iff_fderivWithin hs.unique_diff_on]
   trace
-    "./././Mathport/Syntax/Translate/Tactic/Builtin.lean:76:14: unsupported tactic `congrm #[[expr «expr ∧ »(_, _)]]"
+    "./././Mathport/Syntax/Translate/Tactic/Builtin.lean:73:14: unsupported tactic `congrm #[[expr «expr ∧ »(_, _)]]"
   apply contDiffOn_congr
   intro x hx
   exact fderivWithin_of_open hs hx
@@ -1204,7 +1204,7 @@ theorem contDiffOn_top_iff_fderivWithin (hs : UniqueDiffOn π•œ s) :
     exact WithTop.coe_le_coe.2 (Nat.le_succ n)
 #align cont_diff_on_top_iff_fderiv_within contDiffOn_top_iff_fderivWithin
 
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:76:14: unsupported tactic `congrm #[[expr «expr ∧ »(_, _)]] -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:73:14: unsupported tactic `congrm #[[expr «expr ∧ »(_, _)]] -/
 /-- A function is `C^∞` on an open domain if and only if it is differentiable there, and its
 derivative (expressed with `fderiv`) is `C^∞`. -/
 theorem contDiffOn_top_iff_fderiv_of_open (hs : IsOpen s) :
@@ -1212,7 +1212,7 @@ theorem contDiffOn_top_iff_fderiv_of_open (hs : IsOpen s) :
   by
   rw [contDiffOn_top_iff_fderivWithin hs.unique_diff_on]
   trace
-    "./././Mathport/Syntax/Translate/Tactic/Builtin.lean:76:14: unsupported tactic `congrm #[[expr «expr ∧ »(_, _)]]"
+    "./././Mathport/Syntax/Translate/Tactic/Builtin.lean:73:14: unsupported tactic `congrm #[[expr «expr ∧ »(_, _)]]"
   apply contDiffOn_congr
   intro x hx
   exact fderivWithin_of_open hs hx
@@ -3742,7 +3742,7 @@ theorem contDiffOn_succ_iff_derivWithin {n : β„•} (hs : UniqueDiffOn π•œ sβ‚‚)
     exact (this.is_bounded_linear_map_right _).ContDiff
 #align cont_diff_on_succ_iff_deriv_within contDiffOn_succ_iff_derivWithin
 
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:76:14: unsupported tactic `congrm #[[expr «expr ∧ »(_, _)]] -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:73:14: unsupported tactic `congrm #[[expr «expr ∧ »(_, _)]] -/
 /-- A function is `C^(n + 1)` on an open domain if and only if it is
 differentiable there, and its derivative (formulated with `deriv`) is `C^n`. -/
 theorem contDiffOn_succ_iff_deriv_of_open {n : β„•} (hs : IsOpen sβ‚‚) :
@@ -3750,7 +3750,7 @@ theorem contDiffOn_succ_iff_deriv_of_open {n : β„•} (hs : IsOpen sβ‚‚) :
   by
   rw [contDiffOn_succ_iff_derivWithin hs.unique_diff_on]
   trace
-    "./././Mathport/Syntax/Translate/Tactic/Builtin.lean:76:14: unsupported tactic `congrm #[[expr «expr ∧ »(_, _)]]"
+    "./././Mathport/Syntax/Translate/Tactic/Builtin.lean:73:14: unsupported tactic `congrm #[[expr «expr ∧ »(_, _)]]"
   exact contDiffOn_congr fun _ => derivWithin_of_open hs
 #align cont_diff_on_succ_iff_deriv_of_open contDiffOn_succ_iff_deriv_of_open
 
@@ -3771,7 +3771,7 @@ theorem contDiffOn_top_iff_derivWithin (hs : UniqueDiffOn π•œ sβ‚‚) :
     exact WithTop.coe_le_coe.2 (Nat.le_succ n)
 #align cont_diff_on_top_iff_deriv_within contDiffOn_top_iff_derivWithin
 
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:76:14: unsupported tactic `congrm #[[expr «expr ∧ »(_, _)]] -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:73:14: unsupported tactic `congrm #[[expr «expr ∧ »(_, _)]] -/
 /-- A function is `C^∞` on an open domain if and only if it is differentiable
 there, and its derivative (formulated with `deriv`) is `C^∞`. -/
 theorem contDiffOn_top_iff_deriv_of_open (hs : IsOpen sβ‚‚) :
@@ -3779,7 +3779,7 @@ theorem contDiffOn_top_iff_deriv_of_open (hs : IsOpen sβ‚‚) :
   by
   rw [contDiffOn_top_iff_derivWithin hs.unique_diff_on]
   trace
-    "./././Mathport/Syntax/Translate/Tactic/Builtin.lean:76:14: unsupported tactic `congrm #[[expr «expr ∧ »(_, _)]]"
+    "./././Mathport/Syntax/Translate/Tactic/Builtin.lean:73:14: unsupported tactic `congrm #[[expr «expr ∧ »(_, _)]]"
   exact contDiffOn_congr fun _ => derivWithin_of_open hs
 #align cont_diff_on_top_iff_deriv_of_open contDiffOn_top_iff_deriv_of_open
 

Changes in mathlib4

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

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

Diff
@@ -607,19 +607,19 @@ private theorem ContDiffOn.comp_same_univ {Eu : Type u} [NormedAddCommGroup Eu]
     have wu : w βŠ† u := fun y hy => hy.2.1
     have ws : w βŠ† s := fun y hy => hy.1
     refine' ⟨w, _, fun y => (g' (f y)).comp (f' y), _, _⟩
-    show w ∈ 𝓝[s] x
-    Β· apply Filter.inter_mem self_mem_nhdsWithin
+    Β· show w ∈ 𝓝[s] x
+      apply Filter.inter_mem self_mem_nhdsWithin
       apply Filter.inter_mem hu
       apply ContinuousWithinAt.preimage_mem_nhdsWithin'
       Β· rw [← continuousWithinAt_inter' hu]
         exact (hf' x xu).differentiableWithinAt.continuousWithinAt.mono (inter_subset_right _ _)
       Β· apply nhdsWithin_mono _ _ hv
         exact Subset.trans (image_subset_iff.mpr st) (subset_insert (f x) t)
-    show βˆ€ y ∈ w, HasFDerivWithinAt (g ∘ f) ((g' (f y)).comp (f' y)) w y
-    · rintro y ⟨-, yu, yv⟩
+    Β· show βˆ€ y ∈ w, HasFDerivWithinAt (g ∘ f) ((g' (f y)).comp (f' y)) w y
+      rintro y ⟨-, yu, yv⟩
       exact (hg' (f y) yv).comp y ((hf' y yu).mono wu) wv
-    show ContDiffOn π•œ n (fun y => (g' (f y)).comp (f' y)) w
-    Β· have A : ContDiffOn π•œ n (fun y => g' (f y)) w :=
+    Β· show ContDiffOn π•œ n (fun y => (g' (f y)).comp (f' y)) w
+      have A : ContDiffOn π•œ n (fun y => g' (f y)) w :=
         IH g'_diff ((hf.of_le (WithTop.coe_le_coe.2 (Nat.le_succ n))).mono ws) wv
       have B : ContDiffOn π•œ n f' w := f'_diff.mono wu
       have C : ContDiffOn π•œ n (fun y => (g' (f y), f' y)) w := A.prod B
feat: norm estimates for various operators in linear algebra (#12150)

There is a technical issue: I need to register two local instances to be even able to state the norm estimates. The issue is typeclass inference getting stuck in complicated types of linear maps...

Diff
@@ -1673,6 +1673,10 @@ theorem iteratedFDeriv_const_smul_apply {x : E} (hf : ContDiff π•œ i f) :
   exact iteratedFDerivWithin_const_smul_apply hf uniqueDiffOn_univ (Set.mem_univ _)
 #align iterated_fderiv_const_smul_apply iteratedFDeriv_const_smul_apply
 
+theorem iteratedFDeriv_const_smul_apply' {x : E} (hf : ContDiff π•œ i f) :
+    iteratedFDeriv π•œ i (fun x ↦ a β€’ f x) x = a β€’ iteratedFDeriv π•œ i f x :=
+  iteratedFDeriv_const_smul_apply hf
+
 end ConstSMul
 
 /-! ### Cartesian product of two functions -/
chore: avoid id.def (adaptation for nightly-2024-03-27) (#11829)

Co-authored-by: Ruben Van de Velde <65514131+Ruben-VandeVelde@users.noreply.github.com>

Diff
@@ -544,7 +544,7 @@ theorem norm_iteratedFDerivWithin_clm_apply {f : E β†’ F β†’L[π•œ] G} {g : E 
   have hB : β€–Bβ€– ≀ 1 := by
     simp only [B, ContinuousLinearMap.opNorm_flip, ContinuousLinearMap.apply]
     refine' ContinuousLinearMap.opNorm_le_bound _ zero_le_one fun f => _
-    simp only [ContinuousLinearMap.coe_id', id.def, one_mul]
+    simp only [ContinuousLinearMap.coe_id', id, one_mul]
     rfl
   exact B.norm_iteratedFDerivWithin_le_of_bilinear_of_le_one hf hg hs hx hn hB
 #align norm_iterated_fderiv_within_clm_apply norm_iteratedFDerivWithin_clm_apply
feat(Topology/Algebra/StrongTopology): introduce type synonym for abstract topologies on CLM (#11470)
Diff
@@ -155,36 +155,14 @@ theorem ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear (B : E β†’L
       (ContinuousLinearMap.compL π•œ Fu G Gu (isoG.symm : G β†’L[π•œ] Gu)) Buβ‚€ := rfl
   have Bu_eq : (fun y => Bu (fu y) (gu y)) = isoG.symm ∘ (fun y => B (f y) (g y)) ∘ isoD := by
     ext1 y
-    -- Porting note: the two blocks of `rw`s below were
-    -- ```
-    -- simp only [ContinuousLinearMap.compL_apply, Function.comp_apply,
-    --   ContinuousLinearMap.coe_comp', LinearIsometryEquiv.coe_coe'',
-    --   ContinuousLinearMap.flip_apply, LinearIsometryEquiv.apply_symm_apply]
-    -- ```
-    rw [hBu]
-    iterate 2 rw [ContinuousLinearMap.compL_apply, ContinuousLinearMap.coe_comp',
-      Function.comp_apply]
-    rw [hBuβ‚€]
-    iterate 2 rw [ContinuousLinearMap.flip_apply, ContinuousLinearMap.coe_comp',
-      Function.comp_apply]
-    rw [hfu, Function.comp_apply, LinearIsometryEquiv.coe_coe'', LinearIsometryEquiv.coe_coe'',
-      LinearIsometryEquiv.apply_symm_apply isoE, Function.comp_apply,
-      hgu, LinearIsometryEquiv.coe_coe'', Function.comp_apply,
-      LinearIsometryEquiv.apply_symm_apply isoF]
-    simp only [Function.comp_apply]
+    simp [hBu, hBuβ‚€, hfu, hgu]
   -- All norms are preserved by the lifting process.
   have Bu_le : β€–Buβ€– ≀ β€–Bβ€– := by
     refine' ContinuousLinearMap.opNorm_le_bound _ (norm_nonneg _) fun y => _
     refine' ContinuousLinearMap.opNorm_le_bound _ (by positivity) fun x => _
-    set_option tactic.skipAssignedInstances false in
-    simp only [Bu, ContinuousLinearMap.compL_apply, ContinuousLinearMap.coe_comp',
-      Function.comp_apply, LinearIsometryEquiv.coe_coe'', ContinuousLinearMap.flip_apply,
+    simp only [hBu, hBuβ‚€, compL_apply, coe_comp', Function.comp_apply,
+      ContinuousLinearEquiv.coe_coe, LinearIsometryEquiv.coe_coe, flip_apply,
       LinearIsometryEquiv.norm_map]
-    rw [ContinuousLinearMap.coe_comp', Function.comp_apply, ContinuousLinearMap.compL_apply,
-      ContinuousLinearMap.coe_comp', Function.comp_apply]
-    iterate 2 rw [ContinuousLinearMap.flip_apply, ContinuousLinearMap.coe_comp',
-      Function.comp_apply]
-    simp only [LinearIsometryEquiv.coe_coe'', LinearIsometryEquiv.norm_map]
     calc
       β€–B (isoE y) (isoF x)β€– ≀ β€–B (isoE y)β€– * β€–isoF xβ€– := ContinuousLinearMap.le_opNorm _ _
       _ ≀ β€–Bβ€– * β€–isoE yβ€– * β€–isoF xβ€– := by gcongr; apply ContinuousLinearMap.le_opNorm
style: replace '.-/' by '. -/' (#11938)

Purely automatic replacement. If this is in any way controversial; I'm happy to just close this PR.

Diff
@@ -550,7 +550,7 @@ theorem ContDiffAt.prod {f : E β†’ F} {g : E β†’ G} (hf : ContDiffAt π•œ n f x)
     ContDiffWithinAt.prod (contDiffWithinAt_univ.2 hf) (contDiffWithinAt_univ.2 hg)
 #align cont_diff_at.prod ContDiffAt.prod
 
-/-- The cartesian product of `C^n` functions is `C^n`.-/
+/-- The cartesian product of `C^n` functions is `C^n`. -/
 theorem ContDiff.prod {f : E β†’ F} {g : E β†’ G} (hf : ContDiff π•œ n f) (hg : ContDiff π•œ n g) :
     ContDiff π•œ n fun x : E => (f x, g x) :=
   contDiffOn_univ.1 <| ContDiffOn.prod (contDiffOn_univ.2 hf) (contDiffOn_univ.2 hg)
chore: avoid Ne.def (adaptation for nightly-2024-03-27) (#11801)
Diff
@@ -476,7 +476,7 @@ theorem norm_iteratedFDerivWithin_comp_le_aux {Fu Gu : Type u} [NormedAddCommGro
     _ = βˆ‘ i in Finset.range (n + 1), (n ! : ℝ) * 1 * C * D ^ (n + 1) * ((n - i)! : ℝ)⁻¹ := by
       congr! with i hi
       Β· apply inv_mul_cancel
-        simpa only [Ne.def, Nat.cast_eq_zero] using i.factorial_ne_zero
+        simpa only [Ne, Nat.cast_eq_zero] using i.factorial_ne_zero
       Β· rw [← pow_add]
         congr 1
         rw [Nat.add_succ, Nat.succ_inj']
change the order of operation in zsmulRec and nsmulRec (#11451)

We change the following field in the definition of an additive commutative monoid:

 nsmul_succ : βˆ€ (n : β„•) (x : G),
-  AddMonoid.nsmul (n + 1) x = x + AddMonoid.nsmul n x
+  AddMonoid.nsmul (n + 1) x = AddMonoid.nsmul n x + x

where the latter is more natural

We adjust the definitions of ^ in monoids, groups, etc. Originally there was a warning comment about why this natural order was preferred

use x * npowRec n x and not npowRec n x * x in the definition to make sure that definitional unfolding of npowRec is blocked, to avoid deep recursion issues.

but it seems to no longer apply.

Remarks on the PR :

  • pow_succ and pow_succ' have switched their meanings.
  • Most of the time, the proofs were adjusted by priming/unpriming one lemma, or exchanging left and right; a few proofs were more complicated to adjust.
  • In particular, [Mathlib/NumberTheory/RamificationInertia.lean] used Ideal.IsPrime.mul_mem_pow which is defined in [Mathlib/RingTheory/DedekindDomain/Ideal.lean]. Changing the order of operation forced me to add the symmetric lemma Ideal.IsPrime.mem_pow_mul.
  • the docstring for Cauchy condensation test in [Mathlib/Analysis/PSeries.lean] was mathematically incorrect, I added the mention that the function is antitone.
Diff
@@ -1543,7 +1543,7 @@ theorem contDiff_prod {t : Finset ΞΉ} {f : ΞΉ β†’ E β†’ 𝔸'} (h : βˆ€ i ∈ t,
 
 theorem ContDiff.pow {f : E β†’ 𝔸} (hf : ContDiff π•œ n f) : βˆ€ m : β„•, ContDiff π•œ n fun x => f x ^ m
   | 0 => by simpa using contDiff_const
-  | m + 1 => by simpa [pow_succ] using hf.mul (hf.pow m)
+  | m + 1 => by simpa [pow_succ] using (hf.pow m).mul hf
 #align cont_diff.pow ContDiff.pow
 
 theorem ContDiffWithinAt.pow {f : E β†’ 𝔸} (hf : ContDiffWithinAt π•œ n f s x) (m : β„•) :
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
@@ -26,7 +26,7 @@ section Real
   its extension fields such as `β„‚`).
 -/
 
-variable {n : β„•βˆž} {𝕂 : Type*} [IsROrC 𝕂] {E' : Type*} [NormedAddCommGroup E'] [NormedSpace 𝕂 E']
+variable {n : β„•βˆž} {𝕂 : Type*} [RCLike 𝕂] {E' : Type*} [NormedAddCommGroup E'] [NormedSpace 𝕂 E']
   {F' : Type*} [NormedAddCommGroup F'] [NormedSpace 𝕂 F']
 
 /-- If a function has a Taylor series at order at least 1, then at points in the interior of the
golf: replace some apply foo.mpr by rw [foo] (#11515)

Sometimes, that line can be golfed into the next line. Inspired by a comment of @loefflerd; any decisions are my own.

Diff
@@ -1765,7 +1765,7 @@ theorem contDiffAt_ring_inverse [CompleteSpace R] (x : RΛ£) :
       · rintro _ ⟨x', rfl⟩
         exact (inverse_continuousAt x').continuousWithinAt
       Β· simp [ftaylorSeriesWithin]
-  Β· apply contDiffAt_succ_iff_hasFDerivAt.mpr
+  Β· rw [contDiffAt_succ_iff_hasFDerivAt]
     refine' ⟨fun x : R => -mulLeftRight π•œ R (inverse x) (inverse x), _, _⟩
     · refine' ⟨{ y : R | IsUnit y }, x.nhds, _⟩
       rintro _ ⟨y, rfl⟩
@@ -1883,7 +1883,7 @@ theorem PartialHomeomorph.contDiffAt_symm [CompleteSpace E] (f : PartialHomeomor
   Β· rw [contDiffAt_zero]
     exact ⟨f.target, IsOpen.mem_nhds f.open_target ha, f.continuousOn_invFun⟩
   · obtain ⟨f', ⟨u, hu, hff'⟩, hf'⟩ := contDiffAt_succ_iff_hasFDerivAt.mp hf
-    apply contDiffAt_succ_iff_hasFDerivAt.mpr
+    rw [contDiffAt_succ_iff_hasFDerivAt]
     -- For showing `n.succ` times continuous differentiability (the main inductive step), it
     -- suffices to produce the derivative and show that it is `n` times continuously differentiable
     have eq_fβ‚€' : f' (f.symm a) = fβ‚€' := (hff' (f.symm a) (mem_of_mem_nhds hu)).unique hfβ‚€'
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
@@ -859,7 +859,6 @@ theorem contDiffWithinAt_snd {s : Set (E Γ— F)} {p : E Γ— F} :
 section NAry
 
 variable {E₁ Eβ‚‚ E₃ Eβ‚„ : Type*}
-
 variable [NormedAddCommGroup E₁] [NormedAddCommGroup Eβ‚‚] [NormedAddCommGroup E₃]
   [NormedAddCommGroup Eβ‚„] [NormedSpace π•œ E₁] [NormedSpace π•œ Eβ‚‚] [NormedSpace π•œ E₃]
   [NormedSpace π•œ Eβ‚„]
@@ -1629,7 +1628,6 @@ Porting note (#11215): TODO: generalize results in this section.
 section ConstSMul
 
 variable {R : Type*} [Semiring R] [Module R F] [SMulCommClass π•œ R F]
-
 variable [ContinuousConstSMul R F]
 
 -- The scalar multiplication with a constant is smooth.
@@ -1682,7 +1680,6 @@ end ConstSMul
 section Prod_map
 
 variable {E' : Type*} [NormedAddCommGroup E'] [NormedSpace π•œ E']
-
 variable {F' : Type*} [NormedAddCommGroup F'] [NormedSpace π•œ F']
 
 /-- The product map of two `C^n` functions within a set at a point is `C^n`
@@ -2140,11 +2137,8 @@ over `π•œ`.
 variable (π•œ) {π•œ' : Type*} [NontriviallyNormedField π•œ']
 -- Porting note: this couldn't be on the same line as the binder type update of `π•œ`
 variable [NormedAlgebra π•œ π•œ']
-
 variable [NormedSpace π•œ' E] [IsScalarTower π•œ π•œ' E]
-
 variable [NormedSpace π•œ' F] [IsScalarTower π•œ π•œ' F]
-
 variable {p' : E β†’ FormalMultilinearSeries π•œ' E F}
 
 theorem HasFTaylorSeriesUpToOn.restrictScalars (h : HasFTaylorSeriesUpToOn n f p' s) :
fix: add DecidableEq to two lemmas (#11376)
Diff
@@ -1230,7 +1230,8 @@ theorem contDiff_pi : ContDiff π•œ n Ξ¦ ↔ βˆ€ i, ContDiff π•œ n fun x => Ξ¦
   simp only [← contDiffOn_univ, contDiffOn_pi]
 #align cont_diff_pi contDiff_pi
 
-theorem contDiff_update (k : β„•βˆž) (x : βˆ€ i, F' i) (i : ΞΉ) : ContDiff π•œ k (update x i) := by
+theorem contDiff_update [DecidableEq ΞΉ] (k : β„•βˆž) (x : βˆ€ i, F' i) (i : ΞΉ) :
+    ContDiff π•œ k (update x i) := by
   rw [contDiff_pi]
   intro j
   dsimp [Function.update]
@@ -1240,7 +1241,8 @@ theorem contDiff_update (k : β„•βˆž) (x : βˆ€ i, F' i) (i : ΞΉ) : ContDiff π•œ
   Β· exact contDiff_const
 
 variable (F') in
-theorem contDiff_single (k : β„•βˆž) (i : ΞΉ) : ContDiff π•œ k (Pi.single i : F' i β†’ βˆ€ i, F' i) :=
+theorem contDiff_single [DecidableEq ΞΉ] (k : β„•βˆž) (i : ΞΉ) :
+    ContDiff π•œ k (Pi.single i : F' i β†’ βˆ€ i, F' i) :=
   contDiff_update k 0 i
 
 variable (π•œ E)
chore: classify todo porting notes (#11216)

Classifies by adding issue number #11215 to porting notes claiming "TODO".

Diff
@@ -1365,7 +1365,7 @@ theorem ContDiffOn.neg {s : Set E} {f : E β†’ F} (hf : ContDiffOn π•œ n f s) :
 
 variable {i : β„•}
 
--- Porting note: TODO: define `Neg` instance on `ContinuousLinearEquiv`,
+-- Porting note (#11215): TODO: define `Neg` instance on `ContinuousLinearEquiv`,
 -- prove it from `ContinuousLinearEquiv.iteratedFDerivWithin_comp_left`
 theorem iteratedFDerivWithin_neg_apply {f : E β†’ F} (hu : UniqueDiffOn π•œ s) (hx : x ∈ s) :
     iteratedFDerivWithin π•œ i (-f) s x = -iteratedFDerivWithin π•œ i f s x := by
@@ -1617,7 +1617,7 @@ end SMul
 
 /-! ### Constant scalar multiplication
 
-Porting note: TODO: generalize results in this section.
+Porting note (#11215): TODO: generalize results in this section.
 
 1. It should be possible to assume `[Monoid R] [DistribMulAction R F] [SMulCommClass π•œ R F]`.
 2. If `c` is a unit (or `R` is a group), then one can drop `ContDiff*` assumptions in some
chore: move Mathlib to v4.7.0-rc1 (#11162)

This is a very large PR, but it has been reviewed piecemeal already in PRs to the bump/v4.7.0 branch as we update to intermediate nightlies.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Kyle Miller <kmill31415@gmail.com> Co-authored-by: damiano <adomani@gmail.com>

Diff
@@ -176,6 +176,7 @@ theorem ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear (B : E β†’L
   have Bu_le : β€–Buβ€– ≀ β€–Bβ€– := by
     refine' ContinuousLinearMap.opNorm_le_bound _ (norm_nonneg _) fun y => _
     refine' ContinuousLinearMap.opNorm_le_bound _ (by positivity) fun x => _
+    set_option tactic.skipAssignedInstances false in
     simp only [Bu, ContinuousLinearMap.compL_apply, ContinuousLinearMap.coe_comp',
       Function.comp_apply, LinearIsometryEquiv.coe_coe'', ContinuousLinearMap.flip_apply,
       LinearIsometryEquiv.norm_map]
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
@@ -466,7 +466,7 @@ theorem norm_iteratedFDerivWithin_comp_le_aux {Fu Gu : Type u} [NormedAddCommGro
     -- We are left with trivial algebraic manipulations to see that this is smaller than
     -- the claimed bound.
     _ = βˆ‘ i in Finset.range (n + 1),
-      -- porting note: had to insert a few more explicit type ascriptions in this and similar
+      -- Porting note: had to insert a few more explicit type ascriptions in this and similar
       -- expressions.
         (n ! : ℝ) * ((i ! : ℝ)⁻¹ * i !) * C * (D ^ i * D ^ (n - i + 1)) * ((n - i)! : ℝ)⁻¹ := by
       congr! 1 with i hi
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
@@ -912,7 +912,7 @@ theorem ContDiffOn.clm_apply {f : E β†’ F β†’L[π•œ] G} {g : E β†’ F} {n : β„•
   isBoundedBilinearMap_apply.contDiff.comp_contDiff_onβ‚‚ hf hg
 #align cont_diff_on.clm_apply ContDiffOn.clm_apply
 
--- porting note: In Lean 3 we had to give implicit arguments in proofs like the following,
+-- Porting note: In Lean 3 we had to give implicit arguments in proofs like the following,
 -- to speed up elaboration. In Lean 4 this isn't necessary anymore.
 theorem ContDiff.smulRight {f : E β†’ F β†’L[π•œ] π•œ} {g : E β†’ G} {n : β„•βˆž} (hf : ContDiff π•œ n f)
     (hg : ContDiff π•œ n g) : ContDiff π•œ n fun x => (f x).smulRight (g x) :=
@@ -1365,7 +1365,7 @@ theorem ContDiffOn.neg {s : Set E} {f : E β†’ F} (hf : ContDiffOn π•œ n f s) :
 
 variable {i : β„•}
 
--- porting note: TODO: define `Neg` instance on `ContinuousLinearEquiv`,
+-- Porting note: TODO: define `Neg` instance on `ContinuousLinearEquiv`,
 -- prove it from `ContinuousLinearEquiv.iteratedFDerivWithin_comp_left`
 theorem iteratedFDerivWithin_neg_apply {f : E β†’ F} (hu : UniqueDiffOn π•œ s) (hx : x ∈ s) :
     iteratedFDerivWithin π•œ i (-f) s x = -iteratedFDerivWithin π•œ i f s x := by
@@ -1745,7 +1745,7 @@ end Prod_map
 section AlgebraInverse
 
 variable (π•œ) {R : Type*} [NormedRing R]
--- porting note: this couldn't be on the same line as the binder type update of `π•œ`
+-- Porting note: this couldn't be on the same line as the binder type update of `π•œ`
 variable [NormedAlgebra π•œ R]
 
 open NormedRing ContinuousLinearMap Ring
@@ -2136,7 +2136,7 @@ over `π•œ`.
 
 
 variable (π•œ) {π•œ' : Type*} [NontriviallyNormedField π•œ']
--- porting note: this couldn't be on the same line as the binder type update of `π•œ`
+-- Porting note: this couldn't be on the same line as the binder type update of `π•œ`
 variable [NormedAlgebra π•œ π•œ']
 
 variable [NormedSpace π•œ' E] [IsScalarTower π•œ π•œ' E]
@@ -2149,7 +2149,7 @@ theorem HasFTaylorSeriesUpToOn.restrictScalars (h : HasFTaylorSeriesUpToOn n f p
     HasFTaylorSeriesUpToOn n f (fun x => (p' x).restrictScalars π•œ) s where
   zero_eq x hx := h.zero_eq x hx
   fderivWithin m hm x hx := by
-    simpa only using -- porting note: added `by simpa only using`
+    simpa only using -- Porting note: added `by simpa only using`
       (ContinuousMultilinearMap.restrictScalarsLinear π•œ).hasFDerivAt.comp_hasFDerivWithinAt x <|
         (h.fderivWithin m hm x hx).restrictScalars π•œ
   cont m hm := ContinuousMultilinearMap.continuous_restrictScalars.comp_continuousOn (h.cont m hm)
feat: Add norm_iteratedFDeriv_prod_le using Sym (#10022)

add (iterated) deriv for prod

  • Add HasFDerivAt + variants for Finset.prod (and ContinuousMultilinearMap.mkPiAlgebra)
  • Add missing iteratedFDerivWithin equivalents for zero, const (resolves a todo in Analysis.Calculus.ContDiff.Basic)
  • Add iteratedFDeriv[Within]_sum for symmetry
  • Add a couple of convenience lemmas for Sym and Finset.{prod,sum}
Diff
@@ -4,7 +4,9 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: SΓ©bastien GouΓ«zel, Floris van Doorn
 -/
 import Mathlib.Analysis.Calculus.ContDiff.Basic
+import Mathlib.Data.Finset.Sym
 import Mathlib.Data.Nat.Choose.Cast
+import Mathlib.Data.Nat.Choose.Multinomial
 
 #align_import analysis.calculus.cont_diff from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
 
@@ -290,7 +292,8 @@ end
 
 section
 
-variable {A : Type*} [NormedRing A] [NormedAlgebra π•œ A]
+variable {ΞΉ : Type*} {A : Type*} [NormedRing A] [NormedAlgebra π•œ A] {A' : Type*} [NormedCommRing A']
+  [NormedAlgebra π•œ A']
 
 theorem norm_iteratedFDerivWithin_mul_le {f : E β†’ A} {g : E β†’ A} {N : β„•βˆž} (hf : ContDiffOn π•œ N f s)
     (hg : ContDiffOn π•œ N g s) (hs : UniqueDiffOn π•œ s) {x : E} (hx : x ∈ s) {n : β„•}
@@ -311,6 +314,62 @@ theorem norm_iteratedFDeriv_mul_le {f : E β†’ A} {g : E β†’ A} {N : β„•βˆž} (hf
     hf.contDiffOn hg.contDiffOn uniqueDiffOn_univ (mem_univ x) hn
 #align norm_iterated_fderiv_mul_le norm_iteratedFDeriv_mul_le
 
+-- TODO: Add `norm_iteratedFDeriv[Within]_list_prod_le` for non-commutative `NormedRing A`.
+
+theorem norm_iteratedFDerivWithin_prod_le [DecidableEq ΞΉ] [NormOneClass A'] {u : Finset ΞΉ}
+    {f : ΞΉ β†’ E β†’ A'} {N : β„•βˆž} (hf : βˆ€ i ∈ u, ContDiffOn π•œ N (f i) s) (hs : UniqueDiffOn π•œ s) {x : E}
+    (hx : x ∈ s) {n : β„•} (hn : (n : β„•βˆž) ≀ N) :
+    β€–iteratedFDerivWithin π•œ n (∏ j in u, f j Β·) s xβ€– ≀
+      βˆ‘ p in u.sym n, (p : Multiset ΞΉ).multinomial *
+        ∏ j in u, β€–iteratedFDerivWithin π•œ (Multiset.count j p) (f j) s xβ€– := by
+  induction u using Finset.induction generalizing n with
+  | empty =>
+    cases n with
+    | zero => simp [Sym.eq_nil_of_card_zero]
+    | succ n => simp [iteratedFDerivWithin_succ_const _ _ hs hx]
+  | @insert i u hi IH =>
+    conv => lhs; simp only [Finset.prod_insert hi]
+    simp only [Finset.mem_insert, forall_eq_or_imp] at hf
+    refine le_trans (norm_iteratedFDerivWithin_mul_le hf.1 (contDiffOn_prod hf.2) hs hx hn) ?_
+    rw [← Finset.sum_coe_sort (Finset.sym _ _)]
+    rw [Finset.sum_equiv (Finset.symInsertEquiv hi) (t := Finset.univ)
+      (g := (fun v ↦ v.multinomial *
+          ∏ j in insert i u, β€–iteratedFDerivWithin π•œ (v.count j) (f j) s xβ€–) ∘
+        Sym.toMultiset ∘ Subtype.val ∘ (Finset.symInsertEquiv hi).symm)
+      (by simp) (by simp only [← comp_apply (g := Finset.symInsertEquiv hi), comp.assoc]; simp)]
+    rw [← Finset.univ_sigma_univ, Finset.sum_sigma, Finset.sum_range]
+    simp only [comp_apply, Finset.symInsertEquiv_symm_apply_coe]
+    refine Finset.sum_le_sum ?_
+    intro m _
+    specialize IH hf.2 (n := n - m) (le_trans (WithTop.coe_le_coe.mpr (n.sub_le m)) hn)
+    refine le_trans (mul_le_mul_of_nonneg_left IH (by simp [mul_nonneg])) ?_
+    rw [Finset.mul_sum, ← Finset.sum_coe_sort]
+    refine Finset.sum_le_sum ?_
+    simp only [Finset.mem_univ, forall_true_left, Subtype.forall, Finset.mem_sym_iff]
+    intro p hp
+    refine le_of_eq ?_
+    rw [Finset.prod_insert hi]
+    have hip : i βˆ‰ p := mt (hp i) hi
+    rw [Sym.count_coe_fill_self_of_not_mem hip, Sym.multinomial_coe_fill_of_not_mem hip]
+    suffices ∏ j in u, β€–iteratedFDerivWithin π•œ (Multiset.count j p) (f j) s xβ€– =
+        ∏ j in u, β€–iteratedFDerivWithin π•œ (Multiset.count j (Sym.fill i m p)) (f j) s xβ€– by
+      rw [this, Nat.cast_mul]
+      ring
+    refine Finset.prod_congr rfl ?_
+    intro j hj
+    have hji : j β‰  i := mt (Β· β–Έ hj) hi
+    rw [Sym.count_coe_fill_of_ne hji]
+
+theorem norm_iteratedFDeriv_prod_le [DecidableEq ΞΉ] [NormOneClass A'] {u : Finset ΞΉ}
+    {f : ΞΉ β†’ E β†’ A'} {N : β„•βˆž} (hf : βˆ€ i ∈ u, ContDiff π•œ N (f i)) {x : E} {n : β„•}
+    (hn : (n : β„•βˆž) ≀ N) :
+    β€–iteratedFDeriv π•œ n (∏ j in u, f j Β·) xβ€– ≀
+      βˆ‘ p in u.sym n, (p : Multiset ΞΉ).multinomial *
+        ∏ j in u, β€–iteratedFDeriv π•œ ((p : Multiset ΞΉ).count j) (f j) xβ€– := by
+  simpa [iteratedFDerivWithin_univ] using
+    norm_iteratedFDerivWithin_prod_le (fun i hi ↦ (hf i hi).contDiffOn) uniqueDiffOn_univ
+      (mem_univ x) hn
+
 end
 
 /-- If the derivatives within a set of `g` at `f x` are bounded by `C`, and the `i`-th derivative
chore: prepare Lean version bump with explicit simp (#10999)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -95,7 +95,7 @@ theorem HasFTaylorSeriesUpToOn.exists_lipschitzOnWith_of_nnnorm_lt {E F : Type*}
   have hcont : ContinuousWithinAt f' s x :=
     (continuousMultilinearCurryFin1 ℝ E F).continuousAt.comp_continuousWithinAt
       ((hf.cont _ le_rfl _ (mem_insert _ _)).mono (subset_insert x s))
-  replace hK : β€–f' xβ€–β‚Š < K := by simpa only [LinearIsometryEquiv.nnnorm_map]
+  replace hK : β€–f' xβ€–β‚Š < K := by simpa only [f', LinearIsometryEquiv.nnnorm_map]
   exact
     hs.exists_nhdsWithin_lipschitzOnWith_of_hasFDerivWithinAt_of_nnnorm_lt
       (eventually_nhdsWithin_iff.2 <| eventually_of_forall hder) hcont K hK
chore: prepare Lean version bump with explicit simp (#10999)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -174,7 +174,7 @@ theorem ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear (B : E β†’L
   have Bu_le : β€–Buβ€– ≀ β€–Bβ€– := by
     refine' ContinuousLinearMap.opNorm_le_bound _ (norm_nonneg _) fun y => _
     refine' ContinuousLinearMap.opNorm_le_bound _ (by positivity) fun x => _
-    simp only [ContinuousLinearMap.compL_apply, ContinuousLinearMap.coe_comp',
+    simp only [Bu, ContinuousLinearMap.compL_apply, ContinuousLinearMap.coe_comp',
       Function.comp_apply, LinearIsometryEquiv.coe_coe'', ContinuousLinearMap.flip_apply,
       LinearIsometryEquiv.norm_map]
     rw [ContinuousLinearMap.coe_comp', Function.comp_apply, ContinuousLinearMap.compL_apply,
@@ -190,8 +190,8 @@ theorem ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear (B : E β†’L
   have hsu : UniqueDiffOn π•œ su := isoD.toContinuousLinearEquiv.uniqueDiffOn_preimage_iff.2 hs
   let xu := isoD.symm x
   have hxu : xu ∈ su := by
-    simpa only [Set.mem_preimage, LinearIsometryEquiv.apply_symm_apply] using hx
-  have xu_x : isoD xu = x := by simp only [LinearIsometryEquiv.apply_symm_apply]
+    simpa only [xu, su, Set.mem_preimage, LinearIsometryEquiv.apply_symm_apply] using hx
+  have xu_x : isoD xu = x := by simp only [xu, LinearIsometryEquiv.apply_symm_apply]
   have hfu : ContDiffOn π•œ n fu su :=
     isoE.symm.contDiff.comp_contDiffOn
       ((hf.of_le hn).comp_continuousLinearMap (isoD : Du β†’L[π•œ] D))
@@ -452,8 +452,9 @@ theorem norm_iteratedFDerivWithin_comp_le {g : F β†’ G} {f : E β†’ F} {n : β„•}
   let tu := isoF ⁻¹' t
   have htu : UniqueDiffOn π•œ tu := isoF.toContinuousLinearEquiv.uniqueDiffOn_preimage_iff.2 ht
   have hstu : MapsTo fu s tu := fun y hy ↦ by
-    simpa only [mem_preimage, comp_apply, LinearIsometryEquiv.apply_symm_apply] using hst hy
-  have Ffu : isoF (fu x) = f x := by simp only [comp_apply, LinearIsometryEquiv.apply_symm_apply]
+    simpa only [fu, tu, mem_preimage, comp_apply, LinearIsometryEquiv.apply_symm_apply] using hst hy
+  have Ffu : isoF (fu x) = f x := by
+    simp only [fu, comp_apply, LinearIsometryEquiv.apply_symm_apply]
   -- All norms are preserved by the lifting process.
   have hfu : ContDiffOn π•œ n fu s := isoF.symm.contDiff.comp_contDiffOn (hf.of_le hn)
   have hgu : ContDiffOn π•œ n gu tu :=
@@ -473,7 +474,8 @@ theorem norm_iteratedFDerivWithin_comp_le {g : F β†’ G} {f : E β†’ F} {n : β„•}
       β€–iteratedFDerivWithin π•œ n (g ∘ f) s xβ€– = β€–iteratedFDerivWithin π•œ n (gu ∘ fu) s xβ€– := by
     have : gu ∘ fu = isoG.symm ∘ g ∘ f := by
       ext x
-      simp only [comp_apply, LinearIsometryEquiv.map_eq_iff, LinearIsometryEquiv.apply_symm_apply]
+      simp only [fu, gu, comp_apply, LinearIsometryEquiv.map_eq_iff,
+        LinearIsometryEquiv.apply_symm_apply]
     rw [this, LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_left _ _ hs hx]
   -- deduce the required bound from the one for `gu ∘ fu`.
   rw [Nfgu]
@@ -502,7 +504,7 @@ theorem norm_iteratedFDerivWithin_clm_apply {f : E β†’ F β†’L[π•œ] G} {g : E 
         β€–iteratedFDerivWithin π•œ (n - i) g s xβ€– := by
   let B : (F β†’L[π•œ] G) β†’L[π•œ] F β†’L[π•œ] G := ContinuousLinearMap.flip (ContinuousLinearMap.apply π•œ G)
   have hB : β€–Bβ€– ≀ 1 := by
-    simp only [ContinuousLinearMap.opNorm_flip, ContinuousLinearMap.apply]
+    simp only [B, ContinuousLinearMap.opNorm_flip, ContinuousLinearMap.apply]
     refine' ContinuousLinearMap.opNorm_le_bound _ zero_le_one fun f => _
     simp only [ContinuousLinearMap.coe_id', id.def, one_mul]
     rfl
chore: prepare Lean version bump with explicit simp (#10999)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -651,12 +651,12 @@ theorem ContDiffOn.comp {s : Set E} {t : Set F} {g : F β†’ G} {f : E β†’ F} (hg
   have main : ContDiffOn π•œ n (gu ∘ fu) (isoE ⁻¹' s) := by
     apply ContDiffOn.comp_same_univ gu_diff fu_diff
     intro y hy
-    simp only [ContinuousLinearEquiv.coe_apply, Function.comp_apply, mem_preimage]
+    simp only [fu, ContinuousLinearEquiv.coe_apply, Function.comp_apply, mem_preimage]
     rw [isoF.apply_symm_apply (f (isoE y))]
     exact st hy
   have : gu ∘ fu = (isoG.symm ∘ g ∘ f) ∘ isoE := by
     ext y
-    simp only [Function.comp_apply]
+    simp only [fu, gu, Function.comp_apply]
     rw [isoF.apply_symm_apply (f (isoE y))]
   rwa [this, isoE.contDiffOn_comp_iff, isoG.symm.comp_contDiffOn_iff] at main
 #align cont_diff_on.comp ContDiffOn.comp
@@ -1859,7 +1859,7 @@ theorem contDiffAt_map_inverse [CompleteSpace E] (e : E ≃L[π•œ] F) :
   have hβ‚‚ : ContDiff π•œ n Oβ‚‚ := contDiff_const.clm_comp contDiff_id
   refine' h₁.contDiffAt.comp _ (ContDiffAt.comp _ _ hβ‚‚.contDiffAt)
   convert contDiffAt_ring_inverse π•œ (1 : (E β†’L[π•œ] E)Λ£)
-  simp [one_def]
+  simp [Oβ‚‚, one_def]
 #align cont_diff_at_map_inverse contDiffAt_map_inverse
 
 end MapInverse
feat: Positivity extension for Finset.sum (#10538)

Also define a new aesop rule-set and an auxiliary metaprogram proveFinsetNonempty for dealing with Finset.Nonempty conditions.

From LeanAPAP

Co-authored-by: Alex J. Best <alex.j.best@gmail.com>

Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Alex J Best <alex.j.best@gmail.com>

Diff
@@ -69,8 +69,7 @@ theorem ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear_aux {Du Eu
           IH _ (hf.of_le (Nat.cast_le.2 (Nat.le_succ n))) (hg.fderivWithin hs In)
         _ ≀ β€–Bβ€– * βˆ‘ i : β„• in Finset.range (n + 1), n.choose i * β€–iteratedFDerivWithin π•œ i f s xβ€– *
               β€–iteratedFDerivWithin π•œ (n - i) (fderivWithin π•œ g s) s xβ€– :=
-          (mul_le_mul_of_nonneg_right (B.norm_precompR_le Du)
-            (Finset.sum_nonneg' fun i => by positivity))
+            mul_le_mul_of_nonneg_right (B.norm_precompR_le Du) (by positivity)
         _ = _ := by
           congr 1
           apply Finset.sum_congr rfl fun i hi => ?_
@@ -92,8 +91,7 @@ theorem ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear_aux {Du Eu
         _ ≀ β€–Bβ€– * βˆ‘ i : β„• in Finset.range (n + 1),
             n.choose i * β€–iteratedFDerivWithin π•œ i (fderivWithin π•œ f s) s xβ€– *
               β€–iteratedFDerivWithin π•œ (n - i) g s xβ€– :=
-          (mul_le_mul_of_nonneg_right (B.norm_precompL_le Du)
-            (Finset.sum_nonneg' fun i => by positivity))
+            mul_le_mul_of_nonneg_right (B.norm_precompL_le Du) (by positivity)
         _ = _ := by
           congr 1
           apply Finset.sum_congr rfl fun i _ => ?_
@@ -223,8 +221,7 @@ theorem ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear (B : E β†’L
         β€–iteratedFDerivWithin π•œ (n - i) gu su xuβ€– :=
     Bu.norm_iteratedFDerivWithin_le_of_bilinear_aux hfu hgu hsu hxu
   simp only [Nfu, Ngu, NBu] at this
-  apply this.trans (mul_le_mul_of_nonneg_right Bu_le ?_)
-  exact Finset.sum_nonneg' fun i => by positivity
+  exact this.trans (mul_le_mul_of_nonneg_right Bu_le (by positivity))
 #align continuous_linear_map.norm_iterated_fderiv_within_le_of_bilinear ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear
 
 /-- Bounding the norm of the iterated derivative of `B (f x) (g x)` in terms of the
@@ -250,8 +247,7 @@ theorem ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear_of_le_one
       βˆ‘ i in Finset.range (n + 1), (n.choose i : ℝ) * β€–iteratedFDerivWithin π•œ i f s xβ€– *
         β€–iteratedFDerivWithin π•œ (n - i) g s xβ€– := by
   apply (B.norm_iteratedFDerivWithin_le_of_bilinear hf hg hs hx hn).trans
-  apply mul_le_of_le_one_left (Finset.sum_nonneg' fun i => ?_) hB
-  positivity
+  exact mul_le_of_le_one_left (by positivity) hB
 #align continuous_linear_map.norm_iterated_fderiv_within_le_of_bilinear_of_le_one ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear_of_le_one
 
 /-- Bounding the norm of the iterated derivative of `B (f x) (g x)` in terms of the
chore: remove terminal, terminal refines (#10762)

I replaced a few "terminal" refine/refine's with exact.

The strategy was very simple-minded: essentially any refine whose following line had smaller indentation got replaced by exact and then I cleaned up the mess.

This PR certainly leaves some further terminal refines, but maybe the current change is beneficial.

Diff
@@ -1005,7 +1005,7 @@ theorem ContDiffWithinAt.hasFDerivWithinAt_nhds {f : E β†’ F β†’ G} {g : E β†’ F
     refine' mem_nhdsWithin_insert.mpr ⟨this, _⟩
     refine' (continuousWithinAt_id.prod hg.continuousWithinAt).preimage_mem_nhdsWithin' _
     rw [← nhdsWithin_le_iff] at hst hv ⊒
-    refine' (hst.trans <| nhdsWithin_mono _ <| subset_insert _ _).trans hv
+    exact (hst.trans <| nhdsWithin_mono _ <| subset_insert _ _).trans hv
   Β· intro z hz
     have := hvf' (z, g z) hz.1
     refine' this.comp _ (hasFDerivAt_prod_mk_right _ _).hasFDerivWithinAt _
@@ -1670,7 +1670,7 @@ theorem iteratedFDerivWithin_const_smul_apply (hf : ContDiffOn π•œ i f s) (hu :
 theorem iteratedFDeriv_const_smul_apply {x : E} (hf : ContDiff π•œ i f) :
     iteratedFDeriv π•œ i (a β€’ f) x = a β€’ iteratedFDeriv π•œ i f x := by
   simp_rw [← contDiffOn_univ, ← iteratedFDerivWithin_univ] at *
-  refine' iteratedFDerivWithin_const_smul_apply hf uniqueDiffOn_univ (Set.mem_univ _)
+  exact iteratedFDerivWithin_const_smul_apply hf uniqueDiffOn_univ (Set.mem_univ _)
 #align iterated_fderiv_const_smul_apply iteratedFDeriv_const_smul_apply
 
 end ConstSMul
feat: Basic theorems for iteratedFDerivWithin (#10733)

Basic theorems for iteratedFDerivWithin

Diff
@@ -58,17 +58,21 @@ variable {π•œ : Type*} [NontriviallyNormedField π•œ] {D : Type uD} [NormedAddC
 
 /-! ### Constants -/
 
--- porting note: TODO: prove `HasFTaylorSeriesUpToOn` theorems for zero and a constant
-
 @[simp]
-theorem iteratedFDeriv_zero_fun {n : β„•} : (iteratedFDeriv π•œ n fun _ : E => (0 : F)) = 0 := by
-  induction' n with n IH
-  Β· ext m; simp
-  Β· ext x m
-    rw [iteratedFDeriv_succ_apply_left, IH]
-    change (fderiv π•œ (fun _ : E => (0 : E[Γ—n]β†’L[π•œ] F)) x : E β†’ E[Γ—n]β†’L[π•œ] F) (m 0) (tail m) = _
-    rw [fderiv_const]
+theorem iteratedFDerivWithin_zero_fun (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) {i : β„•} :
+    iteratedFDerivWithin π•œ i (fun _ : E ↦ (0 : F)) s x = 0 := by
+  induction i generalizing x with
+  | zero => ext; simp
+  | succ i IH =>
+    ext m
+    rw [iteratedFDerivWithin_succ_apply_left, fderivWithin_congr (fun _ ↦ IH) (IH hx)]
+    rw [fderivWithin_const_apply _ (hs x hx)]
     rfl
+
+@[simp]
+theorem iteratedFDeriv_zero_fun {n : β„•} : (iteratedFDeriv π•œ n fun _ : E ↦ (0 : F)) = 0 :=
+  funext fun x ↦ by simpa [← iteratedFDerivWithin_univ] using
+    iteratedFDerivWithin_zero_fun uniqueDiffOn_univ (mem_univ x)
 #align iterated_fderiv_zero_fun iteratedFDeriv_zero_fun
 
 theorem contDiff_zero_fun : ContDiff π•œ n fun _ : E => (0 : F) :=
@@ -119,18 +123,31 @@ theorem contDiffOn_of_subsingleton [Subsingleton F] : ContDiffOn π•œ n f s := b
   rw [Subsingleton.elim f fun _ => 0]; exact contDiffOn_const
 #align cont_diff_on_of_subsingleton contDiffOn_of_subsingleton
 
--- porting note: TODO: add a `fderivWithin` version
+theorem iteratedFDerivWithin_succ_const (n : β„•) (c : F) (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) :
+    iteratedFDerivWithin π•œ (n + 1) (fun _ : E ↦ c) s x = 0 := by
+  ext m
+  rw [iteratedFDerivWithin_succ_apply_right hs hx]
+  rw [iteratedFDerivWithin_congr (fun y hy ↦ fderivWithin_const_apply c (hs y hy)) hx]
+  rw [iteratedFDerivWithin_zero_fun hs hx]
+  simp [ContinuousMultilinearMap.zero_apply (R := π•œ)]
+
 theorem iteratedFDeriv_succ_const (n : β„•) (c : F) :
-    (iteratedFDeriv π•œ (n + 1) fun _ : E => c) = 0 := by
-  ext x
-  simp only [iteratedFDeriv_succ_eq_comp_right, fderiv_const, Pi.zero_apply,
-    iteratedFDeriv_zero_fun, comp_apply, LinearIsometryEquiv.map_zero]
+    (iteratedFDeriv π•œ (n + 1) fun _ : E ↦ c) = 0 :=
+  funext fun x ↦ by simpa [← iteratedFDerivWithin_univ] using
+    iteratedFDerivWithin_succ_const n c uniqueDiffOn_univ (mem_univ x)
 #align iterated_fderiv_succ_const iteratedFDeriv_succ_const
 
+theorem iteratedFDerivWithin_const_of_ne {n : β„•} (hn : n β‰  0) (c : F)
+    (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) :
+    iteratedFDerivWithin π•œ n (fun _ : E ↦ c) s x = 0 := by
+  cases n with
+  | zero => contradiction
+  | succ n => exact iteratedFDerivWithin_succ_const n c hs hx
+
 theorem iteratedFDeriv_const_of_ne {n : β„•} (hn : n β‰  0) (c : F) :
-    (iteratedFDeriv π•œ n fun _ : E => c) = 0 := by
-  cases' Nat.exists_eq_succ_of_ne_zero hn with k hk
-  rw [hk, iteratedFDeriv_succ_const]
+    (iteratedFDeriv π•œ n fun _ : E ↦ c) = 0 :=
+  funext fun x ↦ by simpa [← iteratedFDerivWithin_univ] using
+    iteratedFDerivWithin_const_of_ne hn c uniqueDiffOn_univ (mem_univ x)
 #align iterated_fderiv_const_of_ne iteratedFDeriv_const_of_ne
 
 /-! ### Smoothness of linear functions -/
@@ -1429,6 +1446,23 @@ theorem ContDiff.sum {ΞΉ : Type*} {f : ΞΉ β†’ E β†’ F} {s : Finset ΞΉ}
   simp only [← contDiffOn_univ] at *; exact ContDiffOn.sum h
 #align cont_diff.sum ContDiff.sum
 
+theorem iteratedFDerivWithin_sum_apply {ΞΉ : Type*} {f : ΞΉ β†’ E β†’ F} {u : Finset ΞΉ} {i : β„•} {x : E}
+    (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) (h : βˆ€ j ∈ u, ContDiffOn π•œ i (f j) s) :
+    iteratedFDerivWithin π•œ i (βˆ‘ j in u, f j Β·) s x =
+      βˆ‘ j in u, iteratedFDerivWithin π•œ i (f j) s x := by
+  induction u using Finset.cons_induction with
+  | empty => ext; simp [hs, hx]
+  | @cons a u ha IH =>
+    simp only [Finset.mem_cons, forall_eq_or_imp] at h
+    simp only [Finset.sum_cons]
+    rw [iteratedFDerivWithin_add_apply' h.1 (ContDiffOn.sum h.2) hs hx, IH h.2]
+
+theorem iteratedFDeriv_sum {ΞΉ : Type*} {f : ΞΉ β†’ E β†’ F} {u : Finset ΞΉ} {i : β„•}
+    (h : βˆ€ j ∈ u, ContDiff π•œ i (f j)) :
+    iteratedFDeriv π•œ i (βˆ‘ j in u, f j Β·) = βˆ‘ j in u, iteratedFDeriv π•œ i (f j) :=
+  funext fun x ↦ by simpa [iteratedFDerivWithin_univ] using
+    iteratedFDerivWithin_sum_apply uniqueDiffOn_univ (mem_univ x) fun j hj ↦ (h j hj).contDiffOn
+
 /-! ### Product of two functions -/
 
 section MulProd
chore: replace Lean 3 syntax Ξ» x, in doc comments (#10727)

Use Lean 4 syntax fun x ↦ instead, matching the style guide. This is close to exhaustive for doc comments; mathlib has about 460 remaining uses of Ξ» (not all in Lean 3 syntax).

Diff
@@ -562,7 +562,7 @@ in any universe in `u, v, w, max u v, max v w, max u v w`, but it would be extre
 lead to a lot of duplication. Instead, we formulate the above proof when all spaces live in the same
 universe (where everything is fine), and then we deduce the general result by lifting all our spaces
 to a common universe. We use the trick that any space `H` is isomorphic through a continuous linear
-equiv to `ContinuousMultilinearMap (Ξ» (i : Fin 0), E Γ— F Γ— G) H` to change the universe level,
+equiv to `ContinuousMultilinearMap (fun (i : Fin 0) ↦ E Γ— F Γ— G) H` to change the universe level,
 and then argue that composing with such a linear equiv does not change the fact of being `C^n`,
 which we have already proved previously.
 -/
chore: remove stream-of-consciousness uses of have, replace and suffices (#10640)

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

This follows on from #6964.

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

Diff
@@ -95,7 +95,7 @@ theorem HasFTaylorSeriesUpToOn.exists_lipschitzOnWith_of_nnnorm_lt {E F : Type*}
   have hcont : ContinuousWithinAt f' s x :=
     (continuousMultilinearCurryFin1 ℝ E F).continuousAt.comp_continuousWithinAt
       ((hf.cont _ le_rfl _ (mem_insert _ _)).mono (subset_insert x s))
-  replace hK : β€–f' xβ€–β‚Š < K; Β· simpa only [LinearIsometryEquiv.nnnorm_map]
+  replace hK : β€–f' xβ€–β‚Š < K := by simpa only [LinearIsometryEquiv.nnnorm_map]
   exact
     hs.exists_nhdsWithin_lipschitzOnWith_of_hasFDerivWithinAt_of_nnnorm_lt
       (eventually_nhdsWithin_iff.2 <| eventually_of_forall hder) hcont K hK
chore: remove stream-of-consciousness uses of have, replace and suffices (#10640)

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

This follows on from #6964.

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

Diff
@@ -11,9 +11,11 @@ import Mathlib.Data.Nat.Choose.Cast
 /-!
 # Bounds on higher derivatives
 
+`norm_iteratedFDeriv_comp_le` gives the bound `n! * C * D ^ n` for the `n`-th derivative
+  of `g ∘ f` assuming that the derivatives of `g` are bounded by `C` and the `i`-th
+  derivative of `f` is bounded by `D ^ i`.
 -/
 
-
 noncomputable section
 
 open scoped Classical BigOperators NNReal Nat
@@ -146,8 +148,8 @@ theorem ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear (B : E β†’L
   -- lift the bilinear map `B` to a bilinear map `Bu` on the lifted spaces.
   set Buβ‚€ : Eu β†’L[π•œ] Fu β†’L[π•œ] G := ((B.comp (isoE : Eu β†’L[π•œ] E)).flip.comp (isoF : Fu β†’L[π•œ] F)).flip
     with hBuβ‚€
-  let Bu : Eu β†’L[π•œ] Fu β†’L[π•œ] Gu;
-  exact ContinuousLinearMap.compL π•œ Eu (Fu β†’L[π•œ] G) (Fu β†’L[π•œ] Gu)
+  let Bu : Eu β†’L[π•œ] Fu β†’L[π•œ] Gu :=
+   ContinuousLinearMap.compL π•œ Eu (Fu β†’L[π•œ] G) (Fu β†’L[π•œ] Gu)
     (ContinuousLinearMap.compL π•œ Fu G Gu (isoG.symm : G β†’L[π•œ] Gu)) Buβ‚€
   have hBu : Bu = ContinuousLinearMap.compL π•œ Eu (Fu β†’L[π•œ] G) (Fu β†’L[π•œ] Gu)
       (ContinuousLinearMap.compL π•œ Fu G Gu (isoG.symm : G β†’L[π•œ] Gu)) Buβ‚€ := rfl
@@ -344,8 +346,8 @@ theorem norm_iteratedFDerivWithin_comp_le_aux {Fu Gu : Type u} [NormedAddCommGro
     simpa only [pow_one] using (norm_nonneg _).trans (hD 1 le_rfl this)
   -- use the inductive assumption to bound the derivatives of `g' ∘ f`.
   have I : βˆ€ i ∈ Finset.range (n + 1),
-      β€–iteratedFDerivWithin π•œ i (fderivWithin π•œ g t ∘ f) s xβ€– ≀ i ! * C * D ^ i
-  Β· intro i hi
+      β€–iteratedFDerivWithin π•œ i (fderivWithin π•œ g t ∘ f) s xβ€– ≀ i ! * C * D ^ i := by
+    intro i hi
     simp only [Finset.mem_range_succ_iff] at hi
     apply IH i hi
     Β· apply hg.fderivWithin ht
@@ -365,8 +367,8 @@ theorem norm_iteratedFDerivWithin_comp_le_aux {Fu Gu : Type u} [NormedAddCommGro
   have J : βˆ€ i, β€–iteratedFDerivWithin π•œ (n - i) (fderivWithin π•œ f s) s xβ€– ≀ D ^ (n - i + 1) := by
     intro i
     have : β€–iteratedFDerivWithin π•œ (n - i) (fderivWithin π•œ f s) s xβ€– =
-        β€–iteratedFDerivWithin π•œ (n - i + 1) f s xβ€–
-    Β· rw [iteratedFDerivWithin_succ_eq_comp_right hs hx, comp_apply, LinearIsometryEquiv.norm_map]
+        β€–iteratedFDerivWithin π•œ (n - i + 1) f s xβ€– := by
+      rw [iteratedFDerivWithin_succ_eq_comp_right hs hx, comp_apply, LinearIsometryEquiv.norm_map]
     rw [this]
     apply hD
     Β· simp only [le_add_iff_nonneg_left, zero_le']
chore: remove stream-of-consciousness uses of have, replace and suffices (#10640)

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

This follows on from #6964.

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

Diff
@@ -19,9 +19,6 @@ so on) preserve `C^n` functions. We also expand the API around `C^n` functions.
 ## Main results
 
 * `ContDiff.comp` states that the composition of two `C^n` functions is `C^n`.
-* `norm_iteratedFDeriv_comp_le` gives the bound `n! * C * D ^ n` for the `n`-th derivative
-  of `g ∘ f` assuming that the derivatives of `g` are bounded by `C` and the `i`-th
-  derivative of `f` is bounded by `D ^ i`.
 
 Similar results are given for `C^n` functions on domains.
 
@@ -1982,14 +1979,14 @@ theorem contDiffOn_succ_iff_derivWithin {n : β„•} (hs : UniqueDiffOn π•œ sβ‚‚)
   intro _
   constructor
   Β· intro h
-    have : derivWithin fβ‚‚ sβ‚‚ = (fun u : π•œ β†’L[π•œ] F => u 1) ∘ fderivWithin π•œ fβ‚‚ sβ‚‚
-    Β· ext x; rfl
+    have : derivWithin fβ‚‚ sβ‚‚ = (fun u : π•œ β†’L[π•œ] F => u 1) ∘ fderivWithin π•œ fβ‚‚ sβ‚‚ := by
+      ext x; rfl
     simp_rw [this]
     apply ContDiff.comp_contDiffOn _ h
     exact (isBoundedBilinearMap_apply.isBoundedLinearMap_left _).contDiff
   Β· intro h
-    have : fderivWithin π•œ fβ‚‚ sβ‚‚ = smulRight (1 : π•œ β†’L[π•œ] π•œ) ∘ derivWithin fβ‚‚ sβ‚‚
-    Β· ext x; simp [derivWithin]
+    have : fderivWithin π•œ fβ‚‚ sβ‚‚ = smulRight (1 : π•œ β†’L[π•œ] π•œ) ∘ derivWithin fβ‚‚ sβ‚‚ := by
+      ext x; simp [derivWithin]
     simp only [this]
     apply ContDiff.comp_contDiffOn _ h
     have : IsBoundedBilinearMap π•œ fun _ : (π•œ β†’L[π•œ] π•œ) Γ— F => _ := isBoundedBilinearMap_smulRight
feat: fderiv of ContinuousMultilinearMap applied to const; use for SchwartzMap.iteratedPDeriv (#9576)

add ContinuousMultilinearMap.apply; use for fderiv, iteratedFDeriv, SchwartzMap.iteratedPDeriv

Defining ContinuousMultilinearMap.apply as a CLM (using existing proof of continuity) enables the proof that the application of a ContinuousMultilinearMap to a constant commutes with differentiation.

This closes a todo in Mathlib/Analysis/Distribution/SchwartzSpace.lean.

Co-authored-by: Jack Valmadre <jvlmdr@users.noreply.github.com>

Diff
@@ -907,6 +907,40 @@ theorem ContDiff.smulRight {f : E β†’ F β†’L[π•œ] π•œ} {g : E β†’ G} {n : β„•
 
 end SpecificBilinearMaps
 
+section ClmApplyConst
+
+/-- Application of a `ContinuousLinearMap` to a constant commutes with `iteratedFDerivWithin`. -/
+theorem iteratedFDerivWithin_clm_apply_const_apply
+    {s : Set E} (hs : UniqueDiffOn π•œ s) {n : β„•βˆž} {c : E β†’ F β†’L[π•œ] G} (hc : ContDiffOn π•œ n c s)
+    {i : β„•} (hi : i ≀ n) {x : E} (hx : x ∈ s) {u : F} {m : Fin i β†’ E} :
+    (iteratedFDerivWithin π•œ i (fun y ↦ (c y) u) s x) m = (iteratedFDerivWithin π•œ i c s x) m u := by
+  induction i generalizing x with
+  | zero => simp
+  | succ i ih =>
+    replace hi : i < n := lt_of_lt_of_le (by norm_cast; simp) hi
+    have h_deriv_apply : DifferentiableOn π•œ (iteratedFDerivWithin π•œ i (fun y ↦ (c y) u) s) s :=
+      (hc.clm_apply contDiffOn_const).differentiableOn_iteratedFDerivWithin hi hs
+    have h_deriv : DifferentiableOn π•œ (iteratedFDerivWithin π•œ i c s) s :=
+      hc.differentiableOn_iteratedFDerivWithin hi hs
+    simp only [iteratedFDerivWithin_succ_apply_left]
+    rw [← fderivWithin_continuousMultilinear_apply_const_apply (hs x hx) (h_deriv_apply x hx)]
+    rw [fderivWithin_congr' (fun x hx ↦ ih hi.le hx) hx]
+    rw [fderivWithin_clm_apply (hs x hx) (h_deriv.continuousMultilinear_apply_const _ x hx)
+      (differentiableWithinAt_const u)]
+    rw [fderivWithin_const_apply _ (hs x hx)]
+    simp only [ContinuousLinearMap.flip_apply, ContinuousLinearMap.comp_zero, zero_add]
+    rw [fderivWithin_continuousMultilinear_apply_const_apply (hs x hx) (h_deriv x hx)]
+
+/-- Application of a `ContinuousLinearMap` to a constant commutes with `iteratedFDeriv`. -/
+theorem iteratedFDeriv_clm_apply_const_apply
+    {n : β„•βˆž} {c : E β†’ F β†’L[π•œ] G} (hc : ContDiff π•œ n c)
+    {i : β„•} (hi : i ≀ n) {x : E} {u : F} {m : Fin i β†’ E} :
+    (iteratedFDeriv π•œ i (fun y ↦ (c y) u) x) m = (iteratedFDeriv π•œ i c x) m u := by
+  simp only [← iteratedFDerivWithin_univ]
+  exact iteratedFDerivWithin_clm_apply_const_apply uniqueDiffOn_univ hc.contDiffOn hi (mem_univ _)
+
+end ClmApplyConst
+
 /-- The natural equivalence `(E Γ— F) Γ— G ≃ E Γ— (F Γ— G)` is smooth.
 
 Warning: if you think you need this lemma, it is likely that you can simplify your proof by
chore: rename op_norm to opNorm (#10185)

Co-authored-by: adomani <adomani@gmail.com>

Diff
@@ -50,7 +50,7 @@ theorem ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear_aux {Du Eu
   induction' n with n IH generalizing Eu Fu Gu
   Β· simp only [Nat.zero_eq, norm_iteratedFDerivWithin_zero, zero_add, Finset.range_one,
       Finset.sum_singleton, Nat.choose_self, Nat.cast_one, one_mul, Nat.sub_zero, ← mul_assoc]
-    apply B.le_op_normβ‚‚
+    apply B.le_opNormβ‚‚
   Β· have In : (n : β„•βˆž) + 1 ≀ n.succ := by simp only [Nat.cast_succ, le_refl]
     -- Porting note: the next line is a hack allowing Lean to find the operator norm instance.
     let norm := @ContinuousLinearMap.hasOpNorm _ _ Eu ((Du β†’L[π•œ] Fu) β†’L[π•œ] Du β†’L[π•œ] Gu) _ _ _ _ _ _
@@ -172,8 +172,8 @@ theorem ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear (B : E β†’L
     simp only [Function.comp_apply]
   -- All norms are preserved by the lifting process.
   have Bu_le : β€–Buβ€– ≀ β€–Bβ€– := by
-    refine' ContinuousLinearMap.op_norm_le_bound _ (norm_nonneg _) fun y => _
-    refine' ContinuousLinearMap.op_norm_le_bound _ (by positivity) fun x => _
+    refine' ContinuousLinearMap.opNorm_le_bound _ (norm_nonneg _) fun y => _
+    refine' ContinuousLinearMap.opNorm_le_bound _ (by positivity) fun x => _
     simp only [ContinuousLinearMap.compL_apply, ContinuousLinearMap.coe_comp',
       Function.comp_apply, LinearIsometryEquiv.coe_coe'', ContinuousLinearMap.flip_apply,
       LinearIsometryEquiv.norm_map]
@@ -183,8 +183,8 @@ theorem ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear (B : E β†’L
       Function.comp_apply]
     simp only [LinearIsometryEquiv.coe_coe'', LinearIsometryEquiv.norm_map]
     calc
-      β€–B (isoE y) (isoF x)β€– ≀ β€–B (isoE y)β€– * β€–isoF xβ€– := ContinuousLinearMap.le_op_norm _ _
-      _ ≀ β€–Bβ€– * β€–isoE yβ€– * β€–isoF xβ€– := by gcongr; apply ContinuousLinearMap.le_op_norm
+      β€–B (isoE y) (isoF x)β€– ≀ β€–B (isoE y)β€– * β€–isoF xβ€– := ContinuousLinearMap.le_opNorm _ _
+      _ ≀ β€–Bβ€– * β€–isoE yβ€– * β€–isoF xβ€– := by gcongr; apply ContinuousLinearMap.le_opNorm
       _ = β€–Bβ€– * β€–yβ€– * β€–xβ€– := by simp only [LinearIsometryEquiv.norm_map]
   let su := isoD ⁻¹' s
   have hsu : UniqueDiffOn π•œ su := isoD.toContinuousLinearEquiv.uniqueDiffOn_preimage_iff.2 hs
@@ -277,7 +277,7 @@ theorem norm_iteratedFDerivWithin_smul_le {f : E β†’ π•œ'} {g : E β†’ F} {N : 
         β€–iteratedFDerivWithin π•œ (n - i) g s xβ€– :=
   (ContinuousLinearMap.lsmul π•œ π•œ' :
     π•œ' β†’L[π•œ] F β†’L[π•œ] F).norm_iteratedFDerivWithin_le_of_bilinear_of_le_one
-      hf hg hs hx hn ContinuousLinearMap.op_norm_lsmul_le
+      hf hg hs hx hn ContinuousLinearMap.opNorm_lsmul_le
 #align norm_iterated_fderiv_within_smul_le norm_iteratedFDerivWithin_smul_le
 
 theorem norm_iteratedFDeriv_smul_le {f : E β†’ π•œ'} {g : E β†’ F} {N : β„•βˆž} (hf : ContDiff π•œ N f)
@@ -285,7 +285,7 @@ theorem norm_iteratedFDeriv_smul_le {f : E β†’ π•œ'} {g : E β†’ F} {N : β„•βˆž}
     β€–iteratedFDeriv π•œ n (fun y => f y β€’ g y) xβ€– ≀ βˆ‘ i in Finset.range (n + 1),
       (n.choose i : ℝ) * β€–iteratedFDeriv π•œ i f xβ€– * β€–iteratedFDeriv π•œ (n - i) g xβ€– :=
   (ContinuousLinearMap.lsmul π•œ π•œ' : π•œ' β†’L[π•œ] F β†’L[π•œ] F).norm_iteratedFDeriv_le_of_bilinear_of_le_one
-    hf hg x hn ContinuousLinearMap.op_norm_lsmul_le
+    hf hg x hn ContinuousLinearMap.opNorm_lsmul_le
 #align norm_iterated_fderiv_smul_le norm_iteratedFDeriv_smul_le
 
 end
@@ -301,7 +301,7 @@ theorem norm_iteratedFDerivWithin_mul_le {f : E β†’ A} {g : E β†’ A} {N : β„•βˆž
         β€–iteratedFDerivWithin π•œ (n - i) g s xβ€– :=
   (ContinuousLinearMap.mul π•œ A :
     A β†’L[π•œ] A β†’L[π•œ] A).norm_iteratedFDerivWithin_le_of_bilinear_of_le_one
-      hf hg hs hx hn (ContinuousLinearMap.op_norm_mul_le _ _)
+      hf hg hs hx hn (ContinuousLinearMap.opNorm_mul_le _ _)
 #align norm_iterated_fderiv_within_mul_le norm_iteratedFDerivWithin_mul_le
 
 theorem norm_iteratedFDeriv_mul_le {f : E β†’ A} {g : E β†’ A} {N : β„•βˆž} (hf : ContDiff π•œ N f)
@@ -504,8 +504,8 @@ theorem norm_iteratedFDerivWithin_clm_apply {f : E β†’ F β†’L[π•œ] G} {g : E 
         β€–iteratedFDerivWithin π•œ (n - i) g s xβ€– := by
   let B : (F β†’L[π•œ] G) β†’L[π•œ] F β†’L[π•œ] G := ContinuousLinearMap.flip (ContinuousLinearMap.apply π•œ G)
   have hB : β€–Bβ€– ≀ 1 := by
-    simp only [ContinuousLinearMap.op_norm_flip, ContinuousLinearMap.apply]
-    refine' ContinuousLinearMap.op_norm_le_bound _ zero_le_one fun f => _
+    simp only [ContinuousLinearMap.opNorm_flip, ContinuousLinearMap.apply]
+    refine' ContinuousLinearMap.opNorm_le_bound _ zero_le_one fun f => _
     simp only [ContinuousLinearMap.coe_id', id.def, one_mul]
     rfl
   exact B.norm_iteratedFDerivWithin_le_of_bilinear_of_le_one hf hg hs hx hn hB
@@ -528,9 +528,9 @@ theorem norm_iteratedFDerivWithin_clm_apply_const {f : E β†’ F β†’L[π•œ] G} {c
   have h := g.norm_compContinuousMultilinearMap_le (iteratedFDerivWithin π•œ n f s x)
   rw [← g.iteratedFDerivWithin_comp_left hf hs hx hn] at h
   refine' h.trans (mul_le_mul_of_nonneg_right _ (norm_nonneg _))
-  refine' g.op_norm_le_bound (norm_nonneg _) fun f => _
+  refine' g.opNorm_le_bound (norm_nonneg _) fun f => _
   rw [ContinuousLinearMap.apply_apply, mul_comm]
-  exact f.le_op_norm c
+  exact f.le_opNorm c
 #align norm_iterated_fderiv_within_clm_apply_const norm_iteratedFDerivWithin_clm_apply_const
 
 theorem norm_iteratedFDeriv_clm_apply_const {f : E β†’ F β†’L[π•œ] G} {c : F} {x : E} {N : β„•βˆž} {n : β„•}
chore: remove detrital heartbeat bumps (#10191)

With multiple changes, it is a good time to check if existing set_option maxHeartbeats and set_option synthInstance.maxHeartbeats remain necessary. This brings the number of files with such down from 23 to 9. Most are straight deletions though I did change one proof.

Diff
@@ -120,7 +120,6 @@ theorem ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear_aux {Du Eu
       (fun i j => β€–iteratedFDerivWithin π•œ i f s xβ€– * β€–iteratedFDerivWithin π•œ j g s xβ€–) n).symm
 #align continuous_linear_map.norm_iterated_fderiv_within_le_of_bilinear_aux ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear_aux
 
-set_option maxHeartbeats 700000 in -- 3.5Γ— the default limit
 /-- Bounding the norm of the iterated derivative of `B (f x) (g x)` within a set in terms of the
 iterated derivatives of `f` and `g` when `B` is bilinear:
 `β€–D^n (x ↦ B (f x) (g x))β€– ≀ β€–Bβ€– βˆ‘_{k ≀ n} n.choose k β€–D^k fβ€– β€–D^{n-k} gβ€–` -/
chore: reduce imports (#9830)

This uses the improved shake script from #9772 to reduce imports across mathlib. The corresponding noshake.json file has been added to #9772.

Co-authored-by: Mario Carneiro <di.gama@gmail.com>

Diff
@@ -3,7 +3,7 @@ Copyright (c) 2019 SΓ©bastien GouΓ«zel. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: SΓ©bastien GouΓ«zel, Floris van Doorn
 -/
-import Mathlib.Analysis.Calculus.ContDiff.Basic
+import Mathlib.Analysis.Calculus.ContDiff.Defs
 import Mathlib.Analysis.Calculus.MeanValue
 
 #align_import analysis.calculus.cont_diff from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
chore(Function): rename some lemmas (#9738)
  • Merge Function.left_id and Function.comp.left_id into Function.id_comp.
  • Merge Function.right_id and Function.comp.right_id into Function.comp_id.
  • Merge Function.comp_const_right and Function.comp_const into Function.comp_const, use explicit arguments.
  • Move Function.const_comp to Mathlib.Init.Function, use explicit arguments.
Diff
@@ -39,7 +39,7 @@ theorem contDiffOn_clm_apply {n : β„•βˆž} {f : E β†’ F β†’L[π•œ] G} {s : Set E}
   have hd : d = finrank π•œ (Fin d β†’ π•œ) := (finrank_fin_fun π•œ).symm
   let e₁ := ContinuousLinearEquiv.ofFinrankEq hd
   let eβ‚‚ := (e₁.arrowCongr (1 : G ≃L[π•œ] G)).trans (ContinuousLinearEquiv.piRing (Fin d))
-  rw [← comp.left_id f, ← eβ‚‚.symm_comp_self]
+  rw [← id_comp f, ← eβ‚‚.symm_comp_self]
   exact eβ‚‚.symm.contDiff.comp_contDiffOn (contDiffOn_pi.mpr fun i => h _)
 #align cont_diff_on_clm_apply contDiffOn_clm_apply
 
chore(*): drop $/<| before fun (#9361)

Subset of #9319

Diff
@@ -1910,7 +1910,7 @@ def restrContDiff (f : PartialHomeomorph E F) (n : β„•) : PartialHomeomorph E F
   haveI H : f.IsImage {x | ContDiffAt π•œ n f x ∧ ContDiffAt π•œ n f.symm (f x)}
       {y | ContDiffAt π•œ n f.symm y ∧ ContDiffAt π•œ n f (f.symm y)} := fun x hx ↦ by
     simp [hx, and_comm]
-  H.restr <| isOpen_iff_mem_nhds.2 <| fun x ⟨hxs, hxf, hxf'⟩ ↦
+  H.restr <| isOpen_iff_mem_nhds.2 fun x ⟨hxs, hxf, hxf'⟩ ↦
     inter_mem (f.open_source.mem_nhds hxs) <| hxf.eventually.and <|
     f.continuousAt hxs hxf'.eventually
 
chore: audit remaining uses of "local homeomorphism" in comments (#9245)

Almost all of them should speak about partial homeomorphisms instead. In two cases, I decided removing the "local" was clearer than adding "partial".

Follow-up to #8982; complements #9238.

Diff
@@ -1899,7 +1899,7 @@ namespace PartialHomeomorph
 
 variable (π•œ)
 
-/-- Restrict a local homeomorphism to the subsets of the source and target
+/-- Restrict a partial homeomorphism to the subsets of the source and target
 that consist of points `x ∈ f.source`, `y = f x ∈ f.target`
 such that `f` is `C^n` at `x` and `f.symm` is `C^n` at `y`.
 
chore: Nsmul -> NSMul, Zpow -> ZPow, etc (#9067)

Normalising to naming convention rule number 6.

Diff
@@ -1516,7 +1516,7 @@ end MulProd
 
 /-! ### Scalar multiplication -/
 
-section Smul
+section SMul
 
 -- The scalar multiplication is smooth.
 theorem contDiff_smul : ContDiff π•œ n fun p : π•œ Γ— F => p.1 β€’ p.2 :=
@@ -1548,7 +1548,7 @@ theorem ContDiffOn.smul {s : Set E} {f : E β†’ π•œ} {g : E β†’ F} (hf : ContDif
   (hf x hx).smul (hg x hx)
 #align cont_diff_on.smul ContDiffOn.smul
 
-end Smul
+end SMul
 
 /-! ### Constant scalar multiplication
 
@@ -1559,7 +1559,7 @@ Porting note: TODO: generalize results in this section.
   lemmas.
 -/
 
-section ConstSmul
+section ConstSMul
 
 variable {R : Type*} [Semiring R] [Module R F] [SMulCommClass π•œ R F]
 
@@ -1608,7 +1608,7 @@ theorem iteratedFDeriv_const_smul_apply {x : E} (hf : ContDiff π•œ i f) :
   refine' iteratedFDerivWithin_const_smul_apply hf uniqueDiffOn_univ (Set.mem_univ _)
 #align iterated_fderiv_const_smul_apply iteratedFDeriv_const_smul_apply
 
-end ConstSmul
+end ConstSMul
 
 /-! ### Cartesian product of two functions -/
 
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
@@ -1810,7 +1810,7 @@ then `f.symm` is `n` times continuously differentiable at the point `a`.
 
 This is one of the easy parts of the inverse function theorem: it assumes that we already have
 an inverse function. -/
-theorem LocalHomeomorph.contDiffAt_symm [CompleteSpace E] (f : LocalHomeomorph E F)
+theorem PartialHomeomorph.contDiffAt_symm [CompleteSpace E] (f : PartialHomeomorph E F)
     {fβ‚€' : E ≃L[π•œ] F} {a : F} (ha : a ∈ f.target)
     (hfβ‚€' : HasFDerivAt f (fβ‚€' : E β†’L[π•œ] F) (f.symm a)) (hf : ContDiffAt π•œ n f (f.symm a)) :
     ContDiffAt π•œ n f.symm a := by
@@ -1855,7 +1855,7 @@ theorem LocalHomeomorph.contDiffAt_symm [CompleteSpace E] (f : LocalHomeomorph E
   Β· refine' contDiffAt_top.mpr _
     intro n
     exact Itop n (contDiffAt_top.mp hf n)
-#align local_homeomorph.cont_diff_at_symm LocalHomeomorph.contDiffAt_symm
+#align local_homeomorph.cont_diff_at_symm PartialHomeomorph.contDiffAt_symm
 
 /-- If `f` is an `n` times continuously differentiable homeomorphism,
 and if the derivative of `f` at each point is a continuous linear equivalence,
@@ -1867,7 +1867,7 @@ theorem Homeomorph.contDiff_symm [CompleteSpace E] (f : E β‰ƒβ‚œ F) {fβ‚€' : E 
     (hfβ‚€' : βˆ€ a, HasFDerivAt f (fβ‚€' a : E β†’L[π•œ] F) a) (hf : ContDiff π•œ n (f : E β†’ F)) :
     ContDiff π•œ n (f.symm : F β†’ E) :=
   contDiff_iff_contDiffAt.2 fun x =>
-    f.toLocalHomeomorph.contDiffAt_symm (mem_univ x) (hfβ‚€' _) hf.contDiffAt
+    f.toPartialHomeomorph.contDiffAt_symm (mem_univ x) (hfβ‚€' _) hf.contDiffAt
 #align homeomorph.cont_diff_symm Homeomorph.contDiff_symm
 
 /-- Let `f` be a local homeomorphism of a nontrivially normed field, let `a` be a point in its
@@ -1876,11 +1876,11 @@ target. if `f` is `n` times continuously differentiable at `f.symm a`, and if th
 
 This is one of the easy parts of the inverse function theorem: it assumes that we already have
 an inverse function. -/
-theorem LocalHomeomorph.contDiffAt_symm_deriv [CompleteSpace π•œ] (f : LocalHomeomorph π•œ π•œ)
+theorem PartialHomeomorph.contDiffAt_symm_deriv [CompleteSpace π•œ] (f : PartialHomeomorph π•œ π•œ)
     {fβ‚€' a : π•œ} (hβ‚€ : fβ‚€' β‰  0) (ha : a ∈ f.target) (hfβ‚€' : HasDerivAt f fβ‚€' (f.symm a))
     (hf : ContDiffAt π•œ n f (f.symm a)) : ContDiffAt π•œ n f.symm a :=
   f.contDiffAt_symm ha (hfβ‚€'.hasFDerivAt_equiv hβ‚€) hf
-#align local_homeomorph.cont_diff_at_symm_deriv LocalHomeomorph.contDiffAt_symm_deriv
+#align local_homeomorph.cont_diff_at_symm_deriv PartialHomeomorph.contDiffAt_symm_deriv
 
 /-- Let `f` be an `n` times continuously differentiable homeomorphism of a nontrivially normed
 field.  Suppose that the derivative of `f` is never equal to zero. Then `f.symm` is `n` times
@@ -1892,10 +1892,10 @@ theorem Homeomorph.contDiff_symm_deriv [CompleteSpace π•œ] (f : π•œ β‰ƒβ‚œ 
     (hβ‚€ : βˆ€ x, f' x β‰  0) (hf' : βˆ€ x, HasDerivAt f (f' x) x) (hf : ContDiff π•œ n (f : π•œ β†’ π•œ)) :
     ContDiff π•œ n (f.symm : π•œ β†’ π•œ) :=
   contDiff_iff_contDiffAt.2 fun x =>
-    f.toLocalHomeomorph.contDiffAt_symm_deriv (hβ‚€ _) (mem_univ x) (hf' _) hf.contDiffAt
+    f.toPartialHomeomorph.contDiffAt_symm_deriv (hβ‚€ _) (mem_univ x) (hf' _) hf.contDiffAt
 #align homeomorph.cont_diff_symm_deriv Homeomorph.contDiff_symm_deriv
 
-namespace LocalHomeomorph
+namespace PartialHomeomorph
 
 variable (π•œ)
 
@@ -1906,7 +1906,7 @@ such that `f` is `C^n` at `x` and `f.symm` is `C^n` at `y`.
 Note that `n` is a natural number, not `∞`,
 because the set of points of `C^∞`-smoothness of `f` is not guaranteed to be open. -/
 @[simps! apply symm_apply source target]
-def restrContDiff (f : LocalHomeomorph E F) (n : β„•) : LocalHomeomorph E F :=
+def restrContDiff (f : PartialHomeomorph E F) (n : β„•) : PartialHomeomorph E F :=
   haveI H : f.IsImage {x | ContDiffAt π•œ n f x ∧ ContDiffAt π•œ n f.symm (f x)}
       {y | ContDiffAt π•œ n f.symm y ∧ ContDiffAt π•œ n f (f.symm y)} := fun x hx ↦ by
     simp [hx, and_comm]
@@ -1914,13 +1914,13 @@ def restrContDiff (f : LocalHomeomorph E F) (n : β„•) : LocalHomeomorph E F :=
     inter_mem (f.open_source.mem_nhds hxs) <| hxf.eventually.and <|
     f.continuousAt hxs hxf'.eventually
 
-lemma contDiffOn_restrContDiff_source (f : LocalHomeomorph E F) (n : β„•) :
+lemma contDiffOn_restrContDiff_source (f : PartialHomeomorph E F) (n : β„•) :
     ContDiffOn π•œ n f (f.restrContDiff π•œ n).source := fun _x hx ↦ hx.2.1.contDiffWithinAt
 
-lemma contDiffOn_restrContDiff_target (f : LocalHomeomorph E F) (n : β„•) :
+lemma contDiffOn_restrContDiff_target (f : PartialHomeomorph E F) (n : β„•) :
     ContDiffOn π•œ n f.symm (f.restrContDiff π•œ n).target := fun _x hx ↦ hx.2.1.contDiffWithinAt
 
-end LocalHomeomorph
+end PartialHomeomorph
 
 end FunctionInverse
 
chore: rename {LocalHomeomorph,ChartedSpace}.continuous_{to,inv}Fun fields to continuousOn_{to,inv}Fun (#8848)

They have type ContinuousOn ..., hence should be named accordingly. Suggested by @fpvandoorn in #8736.

Diff
@@ -1817,7 +1817,7 @@ theorem LocalHomeomorph.contDiffAt_symm [CompleteSpace E] (f : LocalHomeomorph E
   -- We prove this by induction on `n`
   induction' n using ENat.nat_induction with n IH Itop
   Β· rw [contDiffAt_zero]
-    exact ⟨f.target, IsOpen.mem_nhds f.open_target ha, f.continuous_invFun⟩
+    exact ⟨f.target, IsOpen.mem_nhds f.open_target ha, f.continuousOn_invFun⟩
   · obtain ⟨f', ⟨u, hu, hff'⟩, hf'⟩ := contDiffAt_succ_iff_hasFDerivAt.mp hf
     apply contDiffAt_succ_iff_hasFDerivAt.mpr
     -- For showing `n.succ` times continuous differentiability (the main inductive step), it
refactor: replace some [@foo](https://github.com/foo) _ _ _ _ _ ... by named arguments (#8702)

Using Lean4's named arguments, we manage to remove a few hard-to-read explicit function calls [@foo](https://github.com/foo) _ _ _ _ _ ... which used to be necessary in Lean3.

Occasionally, this results in slightly longer code. The benefit of named arguments is readability, as well as to reduce the brittleness of the code when the argument order is changed.

Co-authored-by: Michael Rothgang <rothgami@math.hu-berlin.de>

Diff
@@ -1437,7 +1437,7 @@ theorem ContDiff.mul {f g : E β†’ 𝔸} (hf : ContDiff π•œ n f) (hg : ContDiff
 theorem contDiffWithinAt_prod' {t : Finset ΞΉ} {f : ΞΉ β†’ E β†’ 𝔸'}
     (h : βˆ€ i ∈ t, ContDiffWithinAt π•œ n (f i) s x) : ContDiffWithinAt π•œ n (∏ i in t, f i) s x :=
   Finset.prod_induction f (fun f => ContDiffWithinAt π•œ n f s x) (fun _ _ => ContDiffWithinAt.mul)
-    (@contDiffWithinAt_const _ _ _ _ _ _ _ _ _ _ _ 1) h
+    (contDiffWithinAt_const (c := 1)) h
 #align cont_diff_within_at_prod' contDiffWithinAt_prod'
 
 theorem contDiffWithinAt_prod {t : Finset ΞΉ} {f : ΞΉ β†’ E β†’ 𝔸'}
feat(ContDiff): define LocalHomeomorph.restrContDiff (#8605)

Restrict the source and the target of a local homeomorphism to the sets where both f and f.symm are C^n.

Diff
@@ -1895,6 +1895,33 @@ theorem Homeomorph.contDiff_symm_deriv [CompleteSpace π•œ] (f : π•œ β‰ƒβ‚œ 
     f.toLocalHomeomorph.contDiffAt_symm_deriv (hβ‚€ _) (mem_univ x) (hf' _) hf.contDiffAt
 #align homeomorph.cont_diff_symm_deriv Homeomorph.contDiff_symm_deriv
 
+namespace LocalHomeomorph
+
+variable (π•œ)
+
+/-- Restrict a local homeomorphism to the subsets of the source and target
+that consist of points `x ∈ f.source`, `y = f x ∈ f.target`
+such that `f` is `C^n` at `x` and `f.symm` is `C^n` at `y`.
+
+Note that `n` is a natural number, not `∞`,
+because the set of points of `C^∞`-smoothness of `f` is not guaranteed to be open. -/
+@[simps! apply symm_apply source target]
+def restrContDiff (f : LocalHomeomorph E F) (n : β„•) : LocalHomeomorph E F :=
+  haveI H : f.IsImage {x | ContDiffAt π•œ n f x ∧ ContDiffAt π•œ n f.symm (f x)}
+      {y | ContDiffAt π•œ n f.symm y ∧ ContDiffAt π•œ n f (f.symm y)} := fun x hx ↦ by
+    simp [hx, and_comm]
+  H.restr <| isOpen_iff_mem_nhds.2 <| fun x ⟨hxs, hxf, hxf'⟩ ↦
+    inter_mem (f.open_source.mem_nhds hxs) <| hxf.eventually.and <|
+    f.continuousAt hxs hxf'.eventually
+
+lemma contDiffOn_restrContDiff_source (f : LocalHomeomorph E F) (n : β„•) :
+    ContDiffOn π•œ n f (f.restrContDiff π•œ n).source := fun _x hx ↦ hx.2.1.contDiffWithinAt
+
+lemma contDiffOn_restrContDiff_target (f : LocalHomeomorph E F) (n : β„•) :
+    ContDiffOn π•œ n f.symm (f.restrContDiff π•œ n).target := fun _x hx ↦ hx.2.1.contDiffWithinAt
+
+end LocalHomeomorph
+
 end FunctionInverse
 
 section deriv
chore: rename lemmas containing "of_open" to match the naming convention (#8229)

Mostly, this means replacing "of_open" by "of_isOpen". A few lemmas names were misleading and are corrected differently. Zulip discussion.

Diff
@@ -1833,7 +1833,7 @@ theorem LocalHomeomorph.contDiffAt_symm [CompleteSpace E] (f : LocalHomeomorph E
       obtain ⟨t, htu, ht, htf⟩ := mem_nhds_iff.mp (Filter.inter_mem hu h_nhds)
       use f.target ∩ f.symm ⁻¹' t
       refine' ⟨IsOpen.mem_nhds _ _, _⟩
-      Β· exact f.preimage_open_of_open_symm ht
+      Β· exact f.isOpen_inter_preimage_symm ht
       Β· exact mem_inter ha (mem_preimage.mpr htf)
       intro x hx
       obtain ⟨hxu, e, he⟩ := htu hx.2
@@ -1937,11 +1937,11 @@ theorem contDiffOn_succ_iff_derivWithin {n : β„•} (hs : UniqueDiffOn π•œ sβ‚‚)
 
 /-- A function is `C^(n + 1)` on an open domain if and only if it is
 differentiable there, and its derivative (formulated with `deriv`) is `C^n`. -/
-theorem contDiffOn_succ_iff_deriv_of_open {n : β„•} (hs : IsOpen sβ‚‚) :
+theorem contDiffOn_succ_iff_deriv_of_isOpen {n : β„•} (hs : IsOpen sβ‚‚) :
     ContDiffOn π•œ (n + 1 : β„•) fβ‚‚ sβ‚‚ ↔ DifferentiableOn π•œ fβ‚‚ sβ‚‚ ∧ ContDiffOn π•œ n (deriv fβ‚‚) sβ‚‚ := by
   rw [contDiffOn_succ_iff_derivWithin hs.uniqueDiffOn]
-  exact Iff.rfl.and (contDiffOn_congr fun _ => derivWithin_of_open hs)
-#align cont_diff_on_succ_iff_deriv_of_open contDiffOn_succ_iff_deriv_of_open
+  exact Iff.rfl.and (contDiffOn_congr fun _ => derivWithin_of_isOpen hs)
+#align cont_diff_on_succ_iff_deriv_of_open contDiffOn_succ_iff_deriv_of_isOpen
 
 /-- A function is `C^∞` on a domain with unique derivatives if and only if it is differentiable
 there, and its derivative (formulated with `derivWithin`) is `C^∞`. -/
@@ -1961,11 +1961,11 @@ theorem contDiffOn_top_iff_derivWithin (hs : UniqueDiffOn π•œ sβ‚‚) :
 
 /-- A function is `C^∞` on an open domain if and only if it is differentiable
 there, and its derivative (formulated with `deriv`) is `C^∞`. -/
-theorem contDiffOn_top_iff_deriv_of_open (hs : IsOpen sβ‚‚) :
+theorem contDiffOn_top_iff_deriv_of_isOpen (hs : IsOpen sβ‚‚) :
     ContDiffOn π•œ ∞ fβ‚‚ sβ‚‚ ↔ DifferentiableOn π•œ fβ‚‚ sβ‚‚ ∧ ContDiffOn π•œ ∞ (deriv fβ‚‚) sβ‚‚ := by
   rw [contDiffOn_top_iff_derivWithin hs.uniqueDiffOn]
-  exact Iff.rfl.and <| contDiffOn_congr fun _ => derivWithin_of_open hs
-#align cont_diff_on_top_iff_deriv_of_open contDiffOn_top_iff_deriv_of_open
+  exact Iff.rfl.and <| contDiffOn_congr fun _ => derivWithin_of_isOpen hs
+#align cont_diff_on_top_iff_deriv_of_open contDiffOn_top_iff_deriv_of_isOpen
 
 protected theorem ContDiffOn.derivWithin (hf : ContDiffOn π•œ n fβ‚‚ sβ‚‚) (hs : UniqueDiffOn π•œ sβ‚‚)
     (hmn : m + 1 ≀ n) : ContDiffOn π•œ m (derivWithin fβ‚‚ sβ‚‚) sβ‚‚ := by
@@ -1978,26 +1978,26 @@ protected theorem ContDiffOn.derivWithin (hf : ContDiffOn π•œ n fβ‚‚ sβ‚‚) (hs
     exact ((contDiffOn_succ_iff_derivWithin hs).1 (hf.of_le hmn)).2
 #align cont_diff_on.deriv_within ContDiffOn.derivWithin
 
-theorem ContDiffOn.deriv_of_open (hf : ContDiffOn π•œ n fβ‚‚ sβ‚‚) (hs : IsOpen sβ‚‚) (hmn : m + 1 ≀ n) :
+theorem ContDiffOn.deriv_of_isOpen (hf : ContDiffOn π•œ n fβ‚‚ sβ‚‚) (hs : IsOpen sβ‚‚) (hmn : m + 1 ≀ n) :
     ContDiffOn π•œ m (deriv fβ‚‚) sβ‚‚ :=
-  (hf.derivWithin hs.uniqueDiffOn hmn).congr fun _ hx => (derivWithin_of_open hs hx).symm
-#align cont_diff_on.deriv_of_open ContDiffOn.deriv_of_open
+  (hf.derivWithin hs.uniqueDiffOn hmn).congr fun _ hx => (derivWithin_of_isOpen hs hx).symm
+#align cont_diff_on.deriv_of_open ContDiffOn.deriv_of_isOpen
 
 theorem ContDiffOn.continuousOn_derivWithin (h : ContDiffOn π•œ n fβ‚‚ sβ‚‚) (hs : UniqueDiffOn π•œ sβ‚‚)
     (hn : 1 ≀ n) : ContinuousOn (derivWithin fβ‚‚ sβ‚‚) sβ‚‚ :=
   ((contDiffOn_succ_iff_derivWithin hs).1 (h.of_le hn)).2.continuousOn
 #align cont_diff_on.continuous_on_deriv_within ContDiffOn.continuousOn_derivWithin
 
-theorem ContDiffOn.continuousOn_deriv_of_open (h : ContDiffOn π•œ n fβ‚‚ sβ‚‚) (hs : IsOpen sβ‚‚)
+theorem ContDiffOn.continuousOn_deriv_of_isOpen (h : ContDiffOn π•œ n fβ‚‚ sβ‚‚) (hs : IsOpen sβ‚‚)
     (hn : 1 ≀ n) : ContinuousOn (deriv fβ‚‚) sβ‚‚ :=
-  ((contDiffOn_succ_iff_deriv_of_open hs).1 (h.of_le hn)).2.continuousOn
-#align cont_diff_on.continuous_on_deriv_of_open ContDiffOn.continuousOn_deriv_of_open
+  ((contDiffOn_succ_iff_deriv_of_isOpen hs).1 (h.of_le hn)).2.continuousOn
+#align cont_diff_on.continuous_on_deriv_of_open ContDiffOn.continuousOn_deriv_of_isOpen
 
 /-- A function is `C^(n + 1)` if and only if it is differentiable,
   and its derivative (formulated in terms of `deriv`) is `C^n`. -/
 theorem contDiff_succ_iff_deriv {n : β„•} :
     ContDiff π•œ (n + 1 : β„•) fβ‚‚ ↔ Differentiable π•œ fβ‚‚ ∧ ContDiff π•œ n (deriv fβ‚‚) := by
-  simp only [← contDiffOn_univ, contDiffOn_succ_iff_deriv_of_open, isOpen_univ,
+  simp only [← contDiffOn_univ, contDiffOn_succ_iff_deriv_of_isOpen, isOpen_univ,
     differentiableOn_univ]
 #align cont_diff_succ_iff_deriv contDiff_succ_iff_deriv
 
feat: golf using gcongr throughout the library (#8752)

Following on from previous gcongr golfing PRs #4702 and #4784.

This is a replacement for #7901: this round of golfs, first introduced there, there exposed some performance issues in gcongr, hopefully fixed by #8731, and I am opening a new PR so that the performance can be checked against current master rather than master at the time of #7901.

Diff
@@ -185,8 +185,7 @@ theorem ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear (B : E β†’L
     simp only [LinearIsometryEquiv.coe_coe'', LinearIsometryEquiv.norm_map]
     calc
       β€–B (isoE y) (isoF x)β€– ≀ β€–B (isoE y)β€– * β€–isoF xβ€– := ContinuousLinearMap.le_op_norm _ _
-      _ ≀ β€–Bβ€– * β€–isoE yβ€– * β€–isoF xβ€– :=
-        (mul_le_mul_of_nonneg_right (ContinuousLinearMap.le_op_norm _ _) (norm_nonneg _))
+      _ ≀ β€–Bβ€– * β€–isoE yβ€– * β€–isoF xβ€– := by gcongr; apply ContinuousLinearMap.le_op_norm
       _ = β€–Bβ€– * β€–yβ€– * β€–xβ€– := by simp only [LinearIsometryEquiv.norm_map]
   let su := isoD ⁻¹' s
   have hsu : UniqueDiffOn π•œ su := isoD.toContinuousLinearEquiv.uniqueDiffOn_preimage_iff.2 hs
@@ -404,33 +403,29 @@ theorem norm_iteratedFDerivWithin_comp_le_aux {Fu Gu : Type u} [NormedAddCommGro
     -- bound each of the terms using the estimates on previous derivatives (that use the inductive
     -- assumption for `g' ∘ f`).
     _ ≀ βˆ‘ i in Finset.range (n + 1), (n.choose i : ℝ) * (i ! * C * D ^ i) * D ^ (n - i + 1) := by
-      apply Finset.sum_le_sum fun i hi => ?_
-      simp only [mul_assoc (n.choose i : ℝ)]
-      refine' mul_le_mul_of_nonneg_left _ (Nat.cast_nonneg _)
-      apply mul_le_mul (I i hi) (J i) (norm_nonneg _)
-      positivity
+      gcongr with i hi
+      Β· simp only [mul_assoc (n.choose i : ℝ)]
+        exact I i hi
+      Β· exact J i
     -- We are left with trivial algebraic manipulations to see that this is smaller than
     -- the claimed bound.
     _ = βˆ‘ i in Finset.range (n + 1),
       -- porting note: had to insert a few more explicit type ascriptions in this and similar
       -- expressions.
         (n ! : ℝ) * ((i ! : ℝ)⁻¹ * i !) * C * (D ^ i * D ^ (n - i + 1)) * ((n - i)! : ℝ)⁻¹ := by
-      apply Finset.sum_congr rfl fun i hi => ?_
+      congr! 1 with i hi
       simp only [Nat.cast_choose ℝ (Finset.mem_range_succ_iff.1 hi), div_eq_inv_mul, mul_inv]
       ring
     _ = βˆ‘ i in Finset.range (n + 1), (n ! : ℝ) * 1 * C * D ^ (n + 1) * ((n - i)! : ℝ)⁻¹ := by
-      apply Finset.sum_congr rfl fun i hi => ?_
-      congr 2
-      Β· congr
-        apply inv_mul_cancel
+      congr! with i hi
+      Β· apply inv_mul_cancel
         simpa only [Ne.def, Nat.cast_eq_zero] using i.factorial_ne_zero
       Β· rw [← pow_add]
         congr 1
         rw [Nat.add_succ, Nat.succ_inj']
         exact Nat.add_sub_of_le (Finset.mem_range_succ_iff.1 hi)
     _ ≀ βˆ‘ i in Finset.range (n + 1), (n ! : ℝ) * 1 * C * D ^ (n + 1) * 1 := by
-      apply Finset.sum_le_sum fun i _hi => ?_
-      refine' mul_le_mul_of_nonneg_left _ (by positivity)
+      gcongr with i
       apply inv_le_one
       simpa only [Nat.one_le_cast] using (n - i).factorial_pos
     _ = (n + 1)! * C * D ^ (n + 1) := by
chore: cleanup imports of Analysis.Calculus.ContDiff (#8354)

Not moving anything around this time, just postponing imports.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -4,6 +4,8 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: SΓ©bastien GouΓ«zel, Floris van Doorn
 -/
 import Mathlib.Analysis.Calculus.ContDiff.Defs
+import Mathlib.Analysis.Calculus.FDeriv.Add
+import Mathlib.Analysis.Calculus.FDeriv.Mul
 import Mathlib.Analysis.Calculus.Deriv.Inverse
 
 #align_import analysis.calculus.cont_diff from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
chore: split Mathlib.Analysis.Calculus.ContDiff.Basic (#8344)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

chore: split Mathlib.Analysis.Calculus.ContDiff.Basic (#8344)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

chore: split Mathlib.Analysis.Calculus.ContDiff.Basic (#8344)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

chore: split Mathlib.Analysis.Calculus.ContDiff.Basic (#8344)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -5,9 +5,6 @@ Authors: SΓ©bastien GouΓ«zel, Floris van Doorn
 -/
 import Mathlib.Analysis.Calculus.ContDiff.Defs
 import Mathlib.Analysis.Calculus.Deriv.Inverse
-import Mathlib.Analysis.Calculus.MeanValue
-import Mathlib.Analysis.NormedSpace.FiniteDimension
-import Mathlib.Data.Nat.Choose.Cast
 
 #align_import analysis.calculus.cont_diff from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
 
@@ -1898,202 +1895,6 @@ theorem Homeomorph.contDiff_symm_deriv [CompleteSpace π•œ] (f : π•œ β‰ƒβ‚œ 
 
 end FunctionInverse
 
-/-! ### Finite dimensional results -/
-
-
-section FiniteDimensional
-
-open Function FiniteDimensional
-
-variable [CompleteSpace π•œ]
-
-/-- A family of continuous linear maps is `C^n` on `s` if all its applications are. -/
-theorem contDiffOn_clm_apply {n : β„•βˆž} {f : E β†’ F β†’L[π•œ] G} {s : Set E} [FiniteDimensional π•œ F] :
-    ContDiffOn π•œ n f s ↔ βˆ€ y, ContDiffOn π•œ n (fun x => f x y) s := by
-  refine' ⟨fun h y => h.clm_apply contDiffOn_const, fun h => _⟩
-  let d := finrank π•œ F
-  have hd : d = finrank π•œ (Fin d β†’ π•œ) := (finrank_fin_fun π•œ).symm
-  let e₁ := ContinuousLinearEquiv.ofFinrankEq hd
-  let eβ‚‚ := (e₁.arrowCongr (1 : G ≃L[π•œ] G)).trans (ContinuousLinearEquiv.piRing (Fin d))
-  rw [← comp.left_id f, ← eβ‚‚.symm_comp_self]
-  exact eβ‚‚.symm.contDiff.comp_contDiffOn (contDiffOn_pi.mpr fun i => h _)
-#align cont_diff_on_clm_apply contDiffOn_clm_apply
-
-theorem contDiff_clm_apply_iff {n : β„•βˆž} {f : E β†’ F β†’L[π•œ] G} [FiniteDimensional π•œ F] :
-    ContDiff π•œ n f ↔ βˆ€ y, ContDiff π•œ n fun x => f x y := by
-  simp_rw [← contDiffOn_univ, contDiffOn_clm_apply]
-#align cont_diff_clm_apply_iff contDiff_clm_apply_iff
-
-/-- This is a useful lemma to prove that a certain operation preserves functions being `C^n`.
-When you do induction on `n`, this gives a useful characterization of a function being `C^(n+1)`,
-assuming you have already computed the derivative. The advantage of this version over
-`contDiff_succ_iff_fderiv` is that both occurrences of `ContDiff` are for functions with the same
-domain and codomain (`E` and `F`). This is not the case for `contDiff_succ_iff_fderiv`, which
-often requires an inconvenient need to generalize `F`, which results in universe issues
-(see the discussion in the section of `ContDiff.comp`).
-
-This lemma avoids these universe issues, but only applies for finite dimensional `E`. -/
-theorem contDiff_succ_iff_fderiv_apply [FiniteDimensional π•œ E] {n : β„•} {f : E β†’ F} :
-    ContDiff π•œ (n + 1 : β„•) f ↔ Differentiable π•œ f ∧ βˆ€ y, ContDiff π•œ n fun x => fderiv π•œ f x y := by
-  rw [contDiff_succ_iff_fderiv, contDiff_clm_apply_iff]
-#align cont_diff_succ_iff_fderiv_apply contDiff_succ_iff_fderiv_apply
-
-theorem contDiffOn_succ_of_fderiv_apply [FiniteDimensional π•œ E] {n : β„•} {f : E β†’ F} {s : Set E}
-    (hf : DifferentiableOn π•œ f s) (h : βˆ€ y, ContDiffOn π•œ n (fun x => fderivWithin π•œ f s x y) s) :
-    ContDiffOn π•œ (n + 1 : β„•) f s :=
-  contDiffOn_succ_of_fderivWithin hf <| contDiffOn_clm_apply.mpr h
-#align cont_diff_on_succ_of_fderiv_apply contDiffOn_succ_of_fderiv_apply
-
-theorem contDiffOn_succ_iff_fderiv_apply [FiniteDimensional π•œ E] {n : β„•} {f : E β†’ F} {s : Set E}
-    (hs : UniqueDiffOn π•œ s) :
-    ContDiffOn π•œ (n + 1 : β„•) f s ↔
-      DifferentiableOn π•œ f s ∧ βˆ€ y, ContDiffOn π•œ n (fun x => fderivWithin π•œ f s x y) s :=
-  by rw [contDiffOn_succ_iff_fderivWithin hs, contDiffOn_clm_apply]
-#align cont_diff_on_succ_iff_fderiv_apply contDiffOn_succ_iff_fderiv_apply
-
-end FiniteDimensional
-
-section Real
-
-/-!
-### Results over `ℝ` or `β„‚`
-  The results in this section rely on the Mean Value Theorem, and therefore hold only over `ℝ` (and
-  its extension fields such as `β„‚`).
--/
-
-
-variable {𝕂 : Type*} [IsROrC 𝕂] {E' : Type*} [NormedAddCommGroup E'] [NormedSpace 𝕂 E']
-  {F' : Type*} [NormedAddCommGroup F'] [NormedSpace 𝕂 F']
-
-/-- If a function has a Taylor series at order at least 1, then at points in the interior of the
-    domain of definition, the term of order 1 of this series is a strict derivative of `f`. -/
-theorem HasFTaylorSeriesUpToOn.hasStrictFDerivAt {s : Set E'} {f : E' β†’ F'} {x : E'}
-    {p : E' β†’ FormalMultilinearSeries 𝕂 E' F'} (hf : HasFTaylorSeriesUpToOn n f p s) (hn : 1 ≀ n)
-    (hs : s ∈ 𝓝 x) : HasStrictFDerivAt f ((continuousMultilinearCurryFin1 𝕂 E' F') (p x 1)) x :=
-  hasStrictFDerivAt_of_hasFDerivAt_of_continuousAt (hf.eventually_hasFDerivAt hn hs) <|
-    (continuousMultilinearCurryFin1 𝕂 E' F').continuousAt.comp <| (hf.cont 1 hn).continuousAt hs
-#align has_ftaylor_series_up_to_on.has_strict_fderiv_at HasFTaylorSeriesUpToOn.hasStrictFDerivAt
-
-/-- If a function is `C^n` with `1 ≀ n` around a point, and its derivative at that point is given to
-us as `f'`, then `f'` is also a strict derivative. -/
-theorem ContDiffAt.hasStrictFDerivAt' {f : E' β†’ F'} {f' : E' β†’L[𝕂] F'} {x : E'}
-    (hf : ContDiffAt 𝕂 n f x) (hf' : HasFDerivAt f f' x) (hn : 1 ≀ n) :
-    HasStrictFDerivAt f f' x := by
-  rcases hf 1 hn with ⟨u, H, p, hp⟩
-  simp only [nhdsWithin_univ, mem_univ, insert_eq_of_mem] at H
-  have := hp.hasStrictFDerivAt le_rfl H
-  rwa [hf'.unique this.hasFDerivAt]
-#align cont_diff_at.has_strict_fderiv_at' ContDiffAt.hasStrictFDerivAt'
-
-/-- If a function is `C^n` with `1 ≀ n` around a point, and its derivative at that point is given to
-us as `f'`, then `f'` is also a strict derivative. -/
-theorem ContDiffAt.hasStrictDerivAt' {f : 𝕂 β†’ F'} {f' : F'} {x : 𝕂} (hf : ContDiffAt 𝕂 n f x)
-    (hf' : HasDerivAt f f' x) (hn : 1 ≀ n) : HasStrictDerivAt f f' x :=
-  hf.hasStrictFDerivAt' hf' hn
-#align cont_diff_at.has_strict_deriv_at' ContDiffAt.hasStrictDerivAt'
-
-/-- If a function is `C^n` with `1 ≀ n` around a point, then the derivative of `f` at this point
-is also a strict derivative. -/
-theorem ContDiffAt.hasStrictFDerivAt {f : E' β†’ F'} {x : E'} (hf : ContDiffAt 𝕂 n f x) (hn : 1 ≀ n) :
-    HasStrictFDerivAt f (fderiv 𝕂 f x) x :=
-  hf.hasStrictFDerivAt' (hf.differentiableAt hn).hasFDerivAt hn
-#align cont_diff_at.has_strict_fderiv_at ContDiffAt.hasStrictFDerivAt
-
-/-- If a function is `C^n` with `1 ≀ n` around a point, then the derivative of `f` at this point
-is also a strict derivative. -/
-theorem ContDiffAt.hasStrictDerivAt {f : 𝕂 β†’ F'} {x : 𝕂} (hf : ContDiffAt 𝕂 n f x) (hn : 1 ≀ n) :
-    HasStrictDerivAt f (deriv f x) x :=
-  (hf.hasStrictFDerivAt hn).hasStrictDerivAt
-#align cont_diff_at.has_strict_deriv_at ContDiffAt.hasStrictDerivAt
-
-/-- If a function is `C^n` with `1 ≀ n`, then the derivative of `f` is also a strict derivative. -/
-theorem ContDiff.hasStrictFDerivAt {f : E' β†’ F'} {x : E'} (hf : ContDiff 𝕂 n f) (hn : 1 ≀ n) :
-    HasStrictFDerivAt f (fderiv 𝕂 f x) x :=
-  hf.contDiffAt.hasStrictFDerivAt hn
-#align cont_diff.has_strict_fderiv_at ContDiff.hasStrictFDerivAt
-
-/-- If a function is `C^n` with `1 ≀ n`, then the derivative of `f` is also a strict derivative. -/
-theorem ContDiff.hasStrictDerivAt {f : 𝕂 β†’ F'} {x : 𝕂} (hf : ContDiff 𝕂 n f) (hn : 1 ≀ n) :
-    HasStrictDerivAt f (deriv f x) x :=
-  hf.contDiffAt.hasStrictDerivAt hn
-#align cont_diff.has_strict_deriv_at ContDiff.hasStrictDerivAt
-
-/-- If `f` has a formal Taylor series `p` up to order `1` on `{x} βˆͺ s`, where `s` is a convex set,
-and `β€–p x 1β€–β‚Š < K`, then `f` is `K`-Lipschitz in a neighborhood of `x` within `s`. -/
-theorem HasFTaylorSeriesUpToOn.exists_lipschitzOnWith_of_nnnorm_lt {E F : Type*}
-    [NormedAddCommGroup E] [NormedSpace ℝ E] [NormedAddCommGroup F] [NormedSpace ℝ F] {f : E β†’ F}
-    {p : E β†’ FormalMultilinearSeries ℝ E F} {s : Set E} {x : E}
-    (hf : HasFTaylorSeriesUpToOn 1 f p (insert x s)) (hs : Convex ℝ s) (K : ℝβ‰₯0)
-    (hK : β€–p x 1β€–β‚Š < K) : βˆƒ t ∈ 𝓝[s] x, LipschitzOnWith K f t := by
-  set f' := fun y => continuousMultilinearCurryFin1 ℝ E F (p y 1)
-  have hder : βˆ€ y ∈ s, HasFDerivWithinAt f (f' y) s y := fun y hy =>
-    (hf.hasFDerivWithinAt le_rfl (subset_insert x s hy)).mono (subset_insert x s)
-  have hcont : ContinuousWithinAt f' s x :=
-    (continuousMultilinearCurryFin1 ℝ E F).continuousAt.comp_continuousWithinAt
-      ((hf.cont _ le_rfl _ (mem_insert _ _)).mono (subset_insert x s))
-  replace hK : β€–f' xβ€–β‚Š < K; Β· simpa only [LinearIsometryEquiv.nnnorm_map]
-  exact
-    hs.exists_nhdsWithin_lipschitzOnWith_of_hasFDerivWithinAt_of_nnnorm_lt
-      (eventually_nhdsWithin_iff.2 <| eventually_of_forall hder) hcont K hK
-#align has_ftaylor_series_up_to_on.exists_lipschitz_on_with_of_nnnorm_lt HasFTaylorSeriesUpToOn.exists_lipschitzOnWith_of_nnnorm_lt
-
-/-- If `f` has a formal Taylor series `p` up to order `1` on `{x} βˆͺ s`, where `s` is a convex set,
-then `f` is Lipschitz in a neighborhood of `x` within `s`. -/
-theorem HasFTaylorSeriesUpToOn.exists_lipschitzOnWith {E F : Type*} [NormedAddCommGroup E]
-    [NormedSpace ℝ E] [NormedAddCommGroup F] [NormedSpace ℝ F] {f : E β†’ F}
-    {p : E β†’ FormalMultilinearSeries ℝ E F} {s : Set E} {x : E}
-    (hf : HasFTaylorSeriesUpToOn 1 f p (insert x s)) (hs : Convex ℝ s) :
-    βˆƒ K, βˆƒ t ∈ 𝓝[s] x, LipschitzOnWith K f t :=
-  (exists_gt _).imp <| hf.exists_lipschitzOnWith_of_nnnorm_lt hs
-#align has_ftaylor_series_up_to_on.exists_lipschitz_on_with HasFTaylorSeriesUpToOn.exists_lipschitzOnWith
-
-/-- If `f` is `C^1` within a convex set `s` at `x`, then it is Lipschitz on a neighborhood of `x`
-within `s`. -/
-theorem ContDiffWithinAt.exists_lipschitzOnWith {E F : Type*} [NormedAddCommGroup E]
-    [NormedSpace ℝ E] [NormedAddCommGroup F] [NormedSpace ℝ F] {f : E β†’ F} {s : Set E} {x : E}
-    (hf : ContDiffWithinAt ℝ 1 f s x) (hs : Convex ℝ s) :
-    βˆƒ K : ℝβ‰₯0, βˆƒ t ∈ 𝓝[s] x, LipschitzOnWith K f t := by
-  rcases hf 1 le_rfl with ⟨t, hst, p, hp⟩
-  rcases Metric.mem_nhdsWithin_iff.mp hst with ⟨Ρ, Ρ0, hΡ⟩
-  replace hp : HasFTaylorSeriesUpToOn 1 f p (Metric.ball x Ρ ∩ insert x s) := hp.mono hΡ
-  clear hst hΞ΅ t
-  rw [← insert_eq_of_mem (Metric.mem_ball_self Ξ΅0), ← insert_inter_distrib] at hp
-  rcases hp.exists_lipschitzOnWith ((convex_ball _ _).inter hs) with ⟨K, t, hst, hft⟩
-  rw [inter_comm, ← nhdsWithin_restrict' _ (Metric.ball_mem_nhds _ Ξ΅0)] at hst
-  exact ⟨K, t, hst, hft⟩
-#align cont_diff_within_at.exists_lipschitz_on_with ContDiffWithinAt.exists_lipschitzOnWith
-
-/-- If `f` is `C^1` at `x` and `K > β€–fderiv 𝕂 f xβ€–`, then `f` is `K`-Lipschitz in a neighborhood of
-`x`. -/
-theorem ContDiffAt.exists_lipschitzOnWith_of_nnnorm_lt {f : E' β†’ F'} {x : E'}
-    (hf : ContDiffAt 𝕂 1 f x) (K : ℝβ‰₯0) (hK : β€–fderiv 𝕂 f xβ€–β‚Š < K) :
-    βˆƒ t ∈ 𝓝 x, LipschitzOnWith K f t :=
-  (hf.hasStrictFDerivAt le_rfl).exists_lipschitzOnWith_of_nnnorm_lt K hK
-#align cont_diff_at.exists_lipschitz_on_with_of_nnnorm_lt ContDiffAt.exists_lipschitzOnWith_of_nnnorm_lt
-
-/-- If `f` is `C^1` at `x`, then `f` is Lipschitz in a neighborhood of `x`. -/
-theorem ContDiffAt.exists_lipschitzOnWith {f : E' β†’ F'} {x : E'} (hf : ContDiffAt 𝕂 1 f x) :
-    βˆƒ K, βˆƒ t ∈ 𝓝 x, LipschitzOnWith K f t :=
-  (hf.hasStrictFDerivAt le_rfl).exists_lipschitzOnWith
-#align cont_diff_at.exists_lipschitz_on_with ContDiffAt.exists_lipschitzOnWith
-
-/-- If `f` is `C^1`, it is locally Lipschitz. -/
-lemma ContDiff.locallyLipschitz {f : E' β†’ F'} (hf : ContDiff 𝕂 1 f) : LocallyLipschitz f := by
-  intro x
-  rcases hf.contDiffAt.exists_lipschitzOnWith with ⟨K, t, ht, hf⟩
-  use K, t
-
-/-- A `C^1` function with compact support is Lipschitz. -/
-theorem ContDiff.lipschitzWith_of_hasCompactSupport {f : E' β†’ F'} {n : β„•βˆž}
-    (hf : HasCompactSupport f) (h'f : ContDiff 𝕂 n f) (hn : 1 ≀ n) :
-    βˆƒ C, LipschitzWith C f := by
-  obtain ⟨C, hC⟩ := (hf.fderiv 𝕂).exists_bound_of_continuous (h'f.continuous_fderiv hn)
-  refine ⟨⟨max C 0, le_max_right _ _⟩, ?_⟩
-  apply lipschitzWith_of_nnnorm_fderiv_le (h'f.differentiable hn) (fun x ↦ ?_)
-  simp [← NNReal.coe_le_coe, hC x]
-
-end Real
-
 section deriv
 
 /-!
@@ -2279,525 +2080,3 @@ theorem ContDiff.restrict_scalars (h : ContDiff π•œ' n f) : ContDiff π•œ n f :
 #align cont_diff.restrict_scalars ContDiff.restrict_scalars
 
 end RestrictScalars
-
-/-!## Quantitative bounds -/
-
-/-- Bounding the norm of the iterated derivative of `B (f x) (g x)` within a set in terms of the
-iterated derivatives of `f` and `g` when `B` is bilinear. This lemma is an auxiliary version
-assuming all spaces live in the same universe, to enable an induction. Use instead
-`ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear` that removes this assumption. -/
-theorem ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear_aux {Du Eu Fu Gu : Type u}
-    [NormedAddCommGroup Du] [NormedSpace π•œ Du] [NormedAddCommGroup Eu] [NormedSpace π•œ Eu]
-    [NormedAddCommGroup Fu] [NormedSpace π•œ Fu] [NormedAddCommGroup Gu] [NormedSpace π•œ Gu]
-    (B : Eu β†’L[π•œ] Fu β†’L[π•œ] Gu) {f : Du β†’ Eu} {g : Du β†’ Fu} {n : β„•} {s : Set Du} {x : Du}
-    (hf : ContDiffOn π•œ n f s) (hg : ContDiffOn π•œ n g s) (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) :
-    β€–iteratedFDerivWithin π•œ n (fun y => B (f y) (g y)) s xβ€– ≀
-      β€–Bβ€– * βˆ‘ i in Finset.range (n + 1), (n.choose i : ℝ) * β€–iteratedFDerivWithin π•œ i f s xβ€– *
-        β€–iteratedFDerivWithin π•œ (n - i) g s xβ€– := by
-  /- We argue by induction on `n`. The bound is trivial for `n = 0`. For `n + 1`, we write
-    the `(n+1)`-th derivative as the `n`-th derivative of the derivative `B f g' + B f' g`,
-    and apply the inductive assumption to each of those two terms. For this induction to make sense,
-    the spaces of linear maps that appear in the induction should be in the same universe as the
-    original spaces, which explains why we assume in the lemma that all spaces live in the same
-    universe. -/
-  induction' n with n IH generalizing Eu Fu Gu
-  Β· simp only [Nat.zero_eq, norm_iteratedFDerivWithin_zero, zero_add, Finset.range_one,
-      Finset.sum_singleton, Nat.choose_self, Nat.cast_one, one_mul, Nat.sub_zero, ← mul_assoc]
-    apply B.le_op_normβ‚‚
-  Β· have In : (n : β„•βˆž) + 1 ≀ n.succ := by simp only [Nat.cast_succ, le_refl]
-    -- Porting note: the next line is a hack allowing Lean to find the operator norm instance.
-    let norm := @ContinuousLinearMap.hasOpNorm _ _ Eu ((Du β†’L[π•œ] Fu) β†’L[π•œ] Du β†’L[π•œ] Gu) _ _ _ _ _ _
-      (RingHom.id π•œ)
-    have I1 :
-        β€–iteratedFDerivWithin π•œ n (fun y : Du => B.precompR Du (f y) (fderivWithin π•œ g s y)) s xβ€– ≀
-          β€–Bβ€– * βˆ‘ i : β„• in Finset.range (n + 1), n.choose i * β€–iteratedFDerivWithin π•œ i f s xβ€– *
-            β€–iteratedFDerivWithin π•œ (n + 1 - i) g s xβ€– := by
-      calc
-        β€–iteratedFDerivWithin π•œ n (fun y : Du => B.precompR Du (f y) (fderivWithin π•œ g s y)) s xβ€– ≀
-            β€–B.precompR Duβ€– * βˆ‘ i : β„• in Finset.range (n + 1),
-              n.choose i * β€–iteratedFDerivWithin π•œ i f s xβ€– *
-                β€–iteratedFDerivWithin π•œ (n - i) (fderivWithin π•œ g s) s xβ€– :=
-          IH _ (hf.of_le (Nat.cast_le.2 (Nat.le_succ n))) (hg.fderivWithin hs In)
-        _ ≀ β€–Bβ€– * βˆ‘ i : β„• in Finset.range (n + 1), n.choose i * β€–iteratedFDerivWithin π•œ i f s xβ€– *
-              β€–iteratedFDerivWithin π•œ (n - i) (fderivWithin π•œ g s) s xβ€– :=
-          (mul_le_mul_of_nonneg_right (B.norm_precompR_le Du)
-            (Finset.sum_nonneg' fun i => by positivity))
-        _ = _ := by
-          congr 1
-          apply Finset.sum_congr rfl fun i hi => ?_
-          rw [Nat.succ_sub (Nat.lt_succ_iff.1 (Finset.mem_range.1 hi)),
-            ← norm_iteratedFDerivWithin_fderivWithin hs hx]
-    -- Porting note: the next line is a hack allowing Lean to find the operator norm instance.
-    let norm := @ContinuousLinearMap.hasOpNorm _ _ (Du β†’L[π•œ] Eu) (Fu β†’L[π•œ] Du β†’L[π•œ] Gu) _ _ _ _ _ _
-      (RingHom.id π•œ)
-    have I2 :
-        β€–iteratedFDerivWithin π•œ n (fun y : Du => B.precompL Du (fderivWithin π•œ f s y) (g y)) s xβ€– ≀
-        β€–Bβ€– * βˆ‘ i : β„• in Finset.range (n + 1), n.choose i * β€–iteratedFDerivWithin π•œ (i + 1) f s xβ€– *
-          β€–iteratedFDerivWithin π•œ (n - i) g s xβ€– :=
-      calc
-        β€–iteratedFDerivWithin π•œ n (fun y : Du => B.precompL Du (fderivWithin π•œ f s y) (g y)) s xβ€– ≀
-            β€–B.precompL Duβ€– * βˆ‘ i : β„• in Finset.range (n + 1),
-              n.choose i * β€–iteratedFDerivWithin π•œ i (fderivWithin π•œ f s) s xβ€– *
-                β€–iteratedFDerivWithin π•œ (n - i) g s xβ€– :=
-          IH _ (hf.fderivWithin hs In) (hg.of_le (Nat.cast_le.2 (Nat.le_succ n)))
-        _ ≀ β€–Bβ€– * βˆ‘ i : β„• in Finset.range (n + 1),
-            n.choose i * β€–iteratedFDerivWithin π•œ i (fderivWithin π•œ f s) s xβ€– *
-              β€–iteratedFDerivWithin π•œ (n - i) g s xβ€– :=
-          (mul_le_mul_of_nonneg_right (B.norm_precompL_le Du)
-            (Finset.sum_nonneg' fun i => by positivity))
-        _ = _ := by
-          congr 1
-          apply Finset.sum_congr rfl fun i _ => ?_
-          rw [← norm_iteratedFDerivWithin_fderivWithin hs hx]
-    have J : iteratedFDerivWithin π•œ n
-        (fun y : Du => fderivWithin π•œ (fun y : Du => B (f y) (g y)) s y) s x =
-          iteratedFDerivWithin π•œ n (fun y => B.precompR Du (f y)
-            (fderivWithin π•œ g s y) + B.precompL Du (fderivWithin π•œ f s y) (g y)) s x := by
-      apply iteratedFDerivWithin_congr (fun y hy => ?_) hx
-      have L : (1 : β„•βˆž) ≀ n.succ := by
-        simpa only [ENat.coe_one, Nat.one_le_cast] using Nat.succ_pos n
-      exact B.fderivWithin_of_bilinear (hf.differentiableOn L y hy) (hg.differentiableOn L y hy)
-        (hs y hy)
-    rw [← norm_iteratedFDerivWithin_fderivWithin hs hx, J]
-    have A : ContDiffOn π•œ n (fun y => B.precompR Du (f y) (fderivWithin π•œ g s y)) s :=
-      (B.precompR Du).isBoundedBilinearMap.contDiff.comp_contDiff_onβ‚‚
-        (hf.of_le (Nat.cast_le.2 (Nat.le_succ n))) (hg.fderivWithin hs In)
-    have A' : ContDiffOn π•œ n (fun y => B.precompL Du (fderivWithin π•œ f s y) (g y)) s :=
-      (B.precompL Du).isBoundedBilinearMap.contDiff.comp_contDiff_onβ‚‚ (hf.fderivWithin hs In)
-        (hg.of_le (Nat.cast_le.2 (Nat.le_succ n)))
-    rw [iteratedFDerivWithin_add_apply' A A' hs hx]
-    apply (norm_add_le _ _).trans ((add_le_add I1 I2).trans (le_of_eq ?_))
-    simp_rw [← mul_add, mul_assoc]
-    congr 1
-    exact (Finset.sum_choose_succ_mul
-      (fun i j => β€–iteratedFDerivWithin π•œ i f s xβ€– * β€–iteratedFDerivWithin π•œ j g s xβ€–) n).symm
-#align continuous_linear_map.norm_iterated_fderiv_within_le_of_bilinear_aux ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear_aux
-
-set_option maxHeartbeats 700000 in -- 3.5Γ— the default limit
-/-- Bounding the norm of the iterated derivative of `B (f x) (g x)` within a set in terms of the
-iterated derivatives of `f` and `g` when `B` is bilinear:
-`β€–D^n (x ↦ B (f x) (g x))β€– ≀ β€–Bβ€– βˆ‘_{k ≀ n} n.choose k β€–D^k fβ€– β€–D^{n-k} gβ€–` -/
-theorem ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear (B : E β†’L[π•œ] F β†’L[π•œ] G)
-    {f : D β†’ E} {g : D β†’ F} {N : β„•βˆž} {s : Set D} {x : D} (hf : ContDiffOn π•œ N f s)
-    (hg : ContDiffOn π•œ N g s) (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) {n : β„•} (hn : (n : β„•βˆž) ≀ N) :
-    β€–iteratedFDerivWithin π•œ n (fun y => B (f y) (g y)) s xβ€– ≀
-      β€–Bβ€– * βˆ‘ i in Finset.range (n + 1), (n.choose i : ℝ) * β€–iteratedFDerivWithin π•œ i f s xβ€– *
-        β€–iteratedFDerivWithin π•œ (n - i) g s xβ€– := by
-  /- We reduce the bound to the case where all spaces live in the same universe (in which we
-    already have proved the result), by using linear isometries between the spaces and their `ULift`
-    to a common universe. These linear isometries preserve the norm of the iterated derivative. -/
-  let Du : Type max uD uE uF uG := ULift.{max uE uF uG, uD} D
-  let Eu : Type max uD uE uF uG := ULift.{max uD uF uG, uE} E
-  let Fu : Type max uD uE uF uG := ULift.{max uD uE uG, uF} F
-  let Gu : Type max uD uE uF uG := ULift.{max uD uE uF, uG} G
-  have isoD : Du ≃ₗᡒ[π•œ] D := LinearIsometryEquiv.ulift π•œ D
-  have isoE : Eu ≃ₗᡒ[π•œ] E := LinearIsometryEquiv.ulift π•œ E
-  have isoF : Fu ≃ₗᡒ[π•œ] F := LinearIsometryEquiv.ulift π•œ F
-  have isoG : Gu ≃ₗᡒ[π•œ] G := LinearIsometryEquiv.ulift π•œ G
-  -- lift `f` and `g` to versions `fu` and `gu` on the lifted spaces.
-  set fu : Du β†’ Eu := isoE.symm ∘ f ∘ isoD with hfu
-  set gu : Du β†’ Fu := isoF.symm ∘ g ∘ isoD with hgu
-  -- lift the bilinear map `B` to a bilinear map `Bu` on the lifted spaces.
-  set Buβ‚€ : Eu β†’L[π•œ] Fu β†’L[π•œ] G := ((B.comp (isoE : Eu β†’L[π•œ] E)).flip.comp (isoF : Fu β†’L[π•œ] F)).flip
-    with hBuβ‚€
-  let Bu : Eu β†’L[π•œ] Fu β†’L[π•œ] Gu;
-  exact ContinuousLinearMap.compL π•œ Eu (Fu β†’L[π•œ] G) (Fu β†’L[π•œ] Gu)
-    (ContinuousLinearMap.compL π•œ Fu G Gu (isoG.symm : G β†’L[π•œ] Gu)) Buβ‚€
-  have hBu : Bu = ContinuousLinearMap.compL π•œ Eu (Fu β†’L[π•œ] G) (Fu β†’L[π•œ] Gu)
-      (ContinuousLinearMap.compL π•œ Fu G Gu (isoG.symm : G β†’L[π•œ] Gu)) Buβ‚€ := rfl
-  have Bu_eq : (fun y => Bu (fu y) (gu y)) = isoG.symm ∘ (fun y => B (f y) (g y)) ∘ isoD := by
-    ext1 y
-    -- Porting note: the two blocks of `rw`s below were
-    -- ```
-    -- simp only [ContinuousLinearMap.compL_apply, Function.comp_apply,
-    --   ContinuousLinearMap.coe_comp', LinearIsometryEquiv.coe_coe'',
-    --   ContinuousLinearMap.flip_apply, LinearIsometryEquiv.apply_symm_apply]
-    -- ```
-    rw [hBu]
-    iterate 2 rw [ContinuousLinearMap.compL_apply, ContinuousLinearMap.coe_comp',
-      Function.comp_apply]
-    rw [hBuβ‚€]
-    iterate 2 rw [ContinuousLinearMap.flip_apply, ContinuousLinearMap.coe_comp',
-      Function.comp_apply]
-    rw [hfu, Function.comp_apply, LinearIsometryEquiv.coe_coe'', LinearIsometryEquiv.coe_coe'',
-      LinearIsometryEquiv.apply_symm_apply isoE, Function.comp_apply,
-      hgu, LinearIsometryEquiv.coe_coe'', Function.comp_apply,
-      LinearIsometryEquiv.apply_symm_apply isoF]
-    simp only [Function.comp_apply]
-  -- All norms are preserved by the lifting process.
-  have Bu_le : β€–Buβ€– ≀ β€–Bβ€– := by
-    refine' ContinuousLinearMap.op_norm_le_bound _ (norm_nonneg _) fun y => _
-    refine' ContinuousLinearMap.op_norm_le_bound _ (by positivity) fun x => _
-    simp only [ContinuousLinearMap.compL_apply, ContinuousLinearMap.coe_comp',
-      Function.comp_apply, LinearIsometryEquiv.coe_coe'', ContinuousLinearMap.flip_apply,
-      LinearIsometryEquiv.norm_map]
-    rw [ContinuousLinearMap.coe_comp', Function.comp_apply, ContinuousLinearMap.compL_apply,
-      ContinuousLinearMap.coe_comp', Function.comp_apply]
-    iterate 2 rw [ContinuousLinearMap.flip_apply, ContinuousLinearMap.coe_comp',
-      Function.comp_apply]
-    simp only [LinearIsometryEquiv.coe_coe'', LinearIsometryEquiv.norm_map]
-    calc
-      β€–B (isoE y) (isoF x)β€– ≀ β€–B (isoE y)β€– * β€–isoF xβ€– := ContinuousLinearMap.le_op_norm _ _
-      _ ≀ β€–Bβ€– * β€–isoE yβ€– * β€–isoF xβ€– :=
-        (mul_le_mul_of_nonneg_right (ContinuousLinearMap.le_op_norm _ _) (norm_nonneg _))
-      _ = β€–Bβ€– * β€–yβ€– * β€–xβ€– := by simp only [LinearIsometryEquiv.norm_map]
-  let su := isoD ⁻¹' s
-  have hsu : UniqueDiffOn π•œ su := isoD.toContinuousLinearEquiv.uniqueDiffOn_preimage_iff.2 hs
-  let xu := isoD.symm x
-  have hxu : xu ∈ su := by
-    simpa only [Set.mem_preimage, LinearIsometryEquiv.apply_symm_apply] using hx
-  have xu_x : isoD xu = x := by simp only [LinearIsometryEquiv.apply_symm_apply]
-  have hfu : ContDiffOn π•œ n fu su :=
-    isoE.symm.contDiff.comp_contDiffOn
-      ((hf.of_le hn).comp_continuousLinearMap (isoD : Du β†’L[π•œ] D))
-  have hgu : ContDiffOn π•œ n gu su :=
-    isoF.symm.contDiff.comp_contDiffOn
-      ((hg.of_le hn).comp_continuousLinearMap (isoD : Du β†’L[π•œ] D))
-  have Nfu : βˆ€ i, β€–iteratedFDerivWithin π•œ i fu su xuβ€– = β€–iteratedFDerivWithin π•œ i f s xβ€– := by
-    intro i
-    rw [LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_left _ _ hsu hxu]
-    rw [LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_right _ _ hs, xu_x]
-    rwa [← xu_x] at hx
-  have Ngu : βˆ€ i, β€–iteratedFDerivWithin π•œ i gu su xuβ€– = β€–iteratedFDerivWithin π•œ i g s xβ€– := by
-    intro i
-    rw [LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_left _ _ hsu hxu]
-    rw [LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_right _ _ hs, xu_x]
-    rwa [← xu_x] at hx
-  have NBu :
-    β€–iteratedFDerivWithin π•œ n (fun y => Bu (fu y) (gu y)) su xuβ€– =
-      β€–iteratedFDerivWithin π•œ n (fun y => B (f y) (g y)) s xβ€– := by
-    rw [Bu_eq]
-    rw [LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_left _ _ hsu hxu]
-    rw [LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_right _ _ hs, xu_x]
-    rwa [← xu_x] at hx
-  -- state the bound for the lifted objects, and deduce the original bound from it.
-  have : β€–iteratedFDerivWithin π•œ n (fun y => Bu (fu y) (gu y)) su xuβ€– ≀
-      β€–Buβ€– * βˆ‘ i in Finset.range (n + 1), (n.choose i : ℝ) * β€–iteratedFDerivWithin π•œ i fu su xuβ€– *
-        β€–iteratedFDerivWithin π•œ (n - i) gu su xuβ€– :=
-    Bu.norm_iteratedFDerivWithin_le_of_bilinear_aux hfu hgu hsu hxu
-  simp only [Nfu, Ngu, NBu] at this
-  apply this.trans (mul_le_mul_of_nonneg_right Bu_le ?_)
-  exact Finset.sum_nonneg' fun i => by positivity
-#align continuous_linear_map.norm_iterated_fderiv_within_le_of_bilinear ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear
-
-/-- Bounding the norm of the iterated derivative of `B (f x) (g x)` in terms of the
-iterated derivatives of `f` and `g` when `B` is bilinear:
-`β€–D^n (x ↦ B (f x) (g x))β€– ≀ β€–Bβ€– βˆ‘_{k ≀ n} n.choose k β€–D^k fβ€– β€–D^{n-k} gβ€–` -/
-theorem ContinuousLinearMap.norm_iteratedFDeriv_le_of_bilinear (B : E β†’L[π•œ] F β†’L[π•œ] G) {f : D β†’ E}
-    {g : D β†’ F} {N : β„•βˆž} (hf : ContDiff π•œ N f) (hg : ContDiff π•œ N g) (x : D) {n : β„•}
-    (hn : (n : β„•βˆž) ≀ N) :
-    β€–iteratedFDeriv π•œ n (fun y => B (f y) (g y)) xβ€– ≀ β€–Bβ€– * βˆ‘ i in Finset.range (n + 1),
-      (n.choose i : ℝ) * β€–iteratedFDeriv π•œ i f xβ€– * β€–iteratedFDeriv π•œ (n - i) g xβ€– := by
-  simp_rw [← iteratedFDerivWithin_univ]
-  exact B.norm_iteratedFDerivWithin_le_of_bilinear hf.contDiffOn hg.contDiffOn uniqueDiffOn_univ
-    (mem_univ x) hn
-#align continuous_linear_map.norm_iterated_fderiv_le_of_bilinear ContinuousLinearMap.norm_iteratedFDeriv_le_of_bilinear
-
-/-- Bounding the norm of the iterated derivative of `B (f x) (g x)` within a set in terms of the
-iterated derivatives of `f` and `g` when `B` is bilinear of norm at most `1`:
-`β€–D^n (x ↦ B (f x) (g x))β€– ≀ βˆ‘_{k ≀ n} n.choose k β€–D^k fβ€– β€–D^{n-k} gβ€–` -/
-theorem ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear_of_le_one
-    (B : E β†’L[π•œ] F β†’L[π•œ] G) {f : D β†’ E} {g : D β†’ F} {N : β„•βˆž} {s : Set D} {x : D}
-    (hf : ContDiffOn π•œ N f s) (hg : ContDiffOn π•œ N g s) (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) {n : β„•}
-    (hn : (n : β„•βˆž) ≀ N) (hB : β€–Bβ€– ≀ 1) : β€–iteratedFDerivWithin π•œ n (fun y => B (f y) (g y)) s xβ€– ≀
-      βˆ‘ i in Finset.range (n + 1), (n.choose i : ℝ) * β€–iteratedFDerivWithin π•œ i f s xβ€– *
-        β€–iteratedFDerivWithin π•œ (n - i) g s xβ€– := by
-  apply (B.norm_iteratedFDerivWithin_le_of_bilinear hf hg hs hx hn).trans
-  apply mul_le_of_le_one_left (Finset.sum_nonneg' fun i => ?_) hB
-  positivity
-#align continuous_linear_map.norm_iterated_fderiv_within_le_of_bilinear_of_le_one ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear_of_le_one
-
-/-- Bounding the norm of the iterated derivative of `B (f x) (g x)` in terms of the
-iterated derivatives of `f` and `g` when `B` is bilinear of norm at most `1`:
-`β€–D^n (x ↦ B (f x) (g x))β€– ≀ βˆ‘_{k ≀ n} n.choose k β€–D^k fβ€– β€–D^{n-k} gβ€–` -/
-theorem ContinuousLinearMap.norm_iteratedFDeriv_le_of_bilinear_of_le_one (B : E β†’L[π•œ] F β†’L[π•œ] G)
-    {f : D β†’ E} {g : D β†’ F} {N : β„•βˆž} (hf : ContDiff π•œ N f) (hg : ContDiff π•œ N g) (x : D) {n : β„•}
-    (hn : (n : β„•βˆž) ≀ N) (hB : β€–Bβ€– ≀ 1) : β€–iteratedFDeriv π•œ n (fun y => B (f y) (g y)) xβ€– ≀
-      βˆ‘ i in Finset.range (n + 1),
-        (n.choose i : ℝ) * β€–iteratedFDeriv π•œ i f xβ€– * β€–iteratedFDeriv π•œ (n - i) g xβ€– := by
-  simp_rw [← iteratedFDerivWithin_univ]
-  exact B.norm_iteratedFDerivWithin_le_of_bilinear_of_le_one hf.contDiffOn hg.contDiffOn
-    uniqueDiffOn_univ (mem_univ x) hn hB
-#align continuous_linear_map.norm_iterated_fderiv_le_of_bilinear_of_le_one ContinuousLinearMap.norm_iteratedFDeriv_le_of_bilinear_of_le_one
-
-section
-
-variable {π•œ' : Type*} [NormedField π•œ'] [NormedAlgebra π•œ π•œ'] [NormedSpace π•œ' F]
-  [IsScalarTower π•œ π•œ' F]
-
-theorem norm_iteratedFDerivWithin_smul_le {f : E β†’ π•œ'} {g : E β†’ F} {N : β„•βˆž}
-    (hf : ContDiffOn π•œ N f s) (hg : ContDiffOn π•œ N g s) (hs : UniqueDiffOn π•œ s) {x : E} (hx : x ∈ s)
-    {n : β„•} (hn : (n : β„•βˆž) ≀ N) : β€–iteratedFDerivWithin π•œ n (fun y => f y β€’ g y) s xβ€– ≀
-      βˆ‘ i in Finset.range (n + 1), (n.choose i : ℝ) * β€–iteratedFDerivWithin π•œ i f s xβ€– *
-        β€–iteratedFDerivWithin π•œ (n - i) g s xβ€– :=
-  (ContinuousLinearMap.lsmul π•œ π•œ' :
-    π•œ' β†’L[π•œ] F β†’L[π•œ] F).norm_iteratedFDerivWithin_le_of_bilinear_of_le_one
-      hf hg hs hx hn ContinuousLinearMap.op_norm_lsmul_le
-#align norm_iterated_fderiv_within_smul_le norm_iteratedFDerivWithin_smul_le
-
-theorem norm_iteratedFDeriv_smul_le {f : E β†’ π•œ'} {g : E β†’ F} {N : β„•βˆž} (hf : ContDiff π•œ N f)
-    (hg : ContDiff π•œ N g) (x : E) {n : β„•} (hn : (n : β„•βˆž) ≀ N) :
-    β€–iteratedFDeriv π•œ n (fun y => f y β€’ g y) xβ€– ≀ βˆ‘ i in Finset.range (n + 1),
-      (n.choose i : ℝ) * β€–iteratedFDeriv π•œ i f xβ€– * β€–iteratedFDeriv π•œ (n - i) g xβ€– :=
-  (ContinuousLinearMap.lsmul π•œ π•œ' : π•œ' β†’L[π•œ] F β†’L[π•œ] F).norm_iteratedFDeriv_le_of_bilinear_of_le_one
-    hf hg x hn ContinuousLinearMap.op_norm_lsmul_le
-#align norm_iterated_fderiv_smul_le norm_iteratedFDeriv_smul_le
-
-end
-
-section
-
-variable {A : Type*} [NormedRing A] [NormedAlgebra π•œ A]
-
-theorem norm_iteratedFDerivWithin_mul_le {f : E β†’ A} {g : E β†’ A} {N : β„•βˆž} (hf : ContDiffOn π•œ N f s)
-    (hg : ContDiffOn π•œ N g s) (hs : UniqueDiffOn π•œ s) {x : E} (hx : x ∈ s) {n : β„•}
-    (hn : (n : β„•βˆž) ≀ N) : β€–iteratedFDerivWithin π•œ n (fun y => f y * g y) s xβ€– ≀
-      βˆ‘ i in Finset.range (n + 1), (n.choose i : ℝ) * β€–iteratedFDerivWithin π•œ i f s xβ€– *
-        β€–iteratedFDerivWithin π•œ (n - i) g s xβ€– :=
-  (ContinuousLinearMap.mul π•œ A :
-    A β†’L[π•œ] A β†’L[π•œ] A).norm_iteratedFDerivWithin_le_of_bilinear_of_le_one
-      hf hg hs hx hn (ContinuousLinearMap.op_norm_mul_le _ _)
-#align norm_iterated_fderiv_within_mul_le norm_iteratedFDerivWithin_mul_le
-
-theorem norm_iteratedFDeriv_mul_le {f : E β†’ A} {g : E β†’ A} {N : β„•βˆž} (hf : ContDiff π•œ N f)
-    (hg : ContDiff π•œ N g) (x : E) {n : β„•} (hn : (n : β„•βˆž) ≀ N) :
-    β€–iteratedFDeriv π•œ n (fun y => f y * g y) xβ€– ≀ βˆ‘ i in Finset.range (n + 1),
-      (n.choose i : ℝ) * β€–iteratedFDeriv π•œ i f xβ€– * β€–iteratedFDeriv π•œ (n - i) g xβ€– := by
-  simp_rw [← iteratedFDerivWithin_univ]
-  exact norm_iteratedFDerivWithin_mul_le
-    hf.contDiffOn hg.contDiffOn uniqueDiffOn_univ (mem_univ x) hn
-#align norm_iterated_fderiv_mul_le norm_iteratedFDeriv_mul_le
-
-end
-
-/-- If the derivatives within a set of `g` at `f x` are bounded by `C`, and the `i`-th derivative
-within a set of `f` at `x` is bounded by `D^i` for all `1 ≀ i ≀ n`, then the `n`-th derivative
-of `g ∘ f` is bounded by `n! * C * D^n`.
-This lemma proves this estimate assuming additionally that two of the spaces live in the same
-universe, to make an induction possible. Use instead `norm_iteratedFDerivWithin_comp_le` that
-removes this assumption. -/
-theorem norm_iteratedFDerivWithin_comp_le_aux {Fu Gu : Type u} [NormedAddCommGroup Fu]
-    [NormedSpace π•œ Fu] [NormedAddCommGroup Gu] [NormedSpace π•œ Gu] {g : Fu β†’ Gu} {f : E β†’ Fu} {n : β„•}
-    {s : Set E} {t : Set Fu} {x : E} (hg : ContDiffOn π•œ n g t) (hf : ContDiffOn π•œ n f s)
-    (ht : UniqueDiffOn π•œ t) (hs : UniqueDiffOn π•œ s) (hst : MapsTo f s t) (hx : x ∈ s) {C : ℝ}
-    {D : ℝ} (hC : βˆ€ i, i ≀ n β†’ β€–iteratedFDerivWithin π•œ i g t (f x)β€– ≀ C)
-    (hD : βˆ€ i, 1 ≀ i β†’ i ≀ n β†’ β€–iteratedFDerivWithin π•œ i f s xβ€– ≀ D ^ i) :
-    β€–iteratedFDerivWithin π•œ n (g ∘ f) s xβ€– ≀ n ! * C * D ^ n := by
-  /- We argue by induction on `n`, using that `D^(n+1) (g ∘ f) = D^n (g ' ∘ f ⬝ f')`. The successive
-    derivatives of `g' ∘ f` are controlled thanks to the inductive assumption, and those of `f'` are
-    controlled by assumption.
-    As composition of linear maps is a bilinear map, one may use
-    `ContinuousLinearMap.norm_iteratedFDeriv_le_of_bilinear_of_le_one` to get from these a bound
-    on `D^n (g ' ∘ f ⬝ f')`. -/
-  induction' n using Nat.case_strong_induction_on with n IH generalizing Gu
-  Β· simpa [norm_iteratedFDerivWithin_zero, Nat.factorial_zero, algebraMap.coe_one, one_mul,
-      pow_zero, mul_one, comp_apply] using hC 0 le_rfl
-  have M : (n : β„•βˆž) < n.succ := Nat.cast_lt.2 n.lt_succ_self
-  have Cnonneg : 0 ≀ C := (norm_nonneg _).trans (hC 0 bot_le)
-  have Dnonneg : 0 ≀ D := by
-    have : 1 ≀ n + 1 := by simp only [le_add_iff_nonneg_left, zero_le']
-    simpa only [pow_one] using (norm_nonneg _).trans (hD 1 le_rfl this)
-  -- use the inductive assumption to bound the derivatives of `g' ∘ f`.
-  have I : βˆ€ i ∈ Finset.range (n + 1),
-      β€–iteratedFDerivWithin π•œ i (fderivWithin π•œ g t ∘ f) s xβ€– ≀ i ! * C * D ^ i
-  Β· intro i hi
-    simp only [Finset.mem_range_succ_iff] at hi
-    apply IH i hi
-    Β· apply hg.fderivWithin ht
-      simp only [Nat.cast_succ]
-      exact add_le_add_right (Nat.cast_le.2 hi) _
-    Β· apply hf.of_le (Nat.cast_le.2 (hi.trans n.le_succ))
-    Β· intro j hj
-      have : β€–iteratedFDerivWithin π•œ j (fderivWithin π•œ g t) t (f x)β€– =
-          β€–iteratedFDerivWithin π•œ (j + 1) g t (f x)β€– :=
-        by rw [iteratedFDerivWithin_succ_eq_comp_right ht (hst hx), comp_apply,
-          LinearIsometryEquiv.norm_map]
-      rw [this]
-      exact hC (j + 1) (add_le_add (hj.trans hi) le_rfl)
-    Β· intro j hj h'j
-      exact hD j hj (h'j.trans (hi.trans n.le_succ))
-  -- reformulate `hD` as a bound for the derivatives of `f'`.
-  have J : βˆ€ i, β€–iteratedFDerivWithin π•œ (n - i) (fderivWithin π•œ f s) s xβ€– ≀ D ^ (n - i + 1) := by
-    intro i
-    have : β€–iteratedFDerivWithin π•œ (n - i) (fderivWithin π•œ f s) s xβ€– =
-        β€–iteratedFDerivWithin π•œ (n - i + 1) f s xβ€–
-    Β· rw [iteratedFDerivWithin_succ_eq_comp_right hs hx, comp_apply, LinearIsometryEquiv.norm_map]
-    rw [this]
-    apply hD
-    Β· simp only [le_add_iff_nonneg_left, zero_le']
-    Β· apply Nat.succ_le_succ tsub_le_self
-  -- Now put these together: first, notice that we have to bound `D^n (g' ∘ f ⬝ f')`.
-  calc
-    β€–iteratedFDerivWithin π•œ (n + 1) (g ∘ f) s xβ€– =
-        β€–iteratedFDerivWithin π•œ n (fun y : E => fderivWithin π•œ (g ∘ f) s y) s xβ€– := by
-      rw [iteratedFDerivWithin_succ_eq_comp_right hs hx, comp_apply,
-        LinearIsometryEquiv.norm_map]
-    _ = β€–iteratedFDerivWithin π•œ n (fun y : E => ContinuousLinearMap.compL π•œ E Fu Gu
-        (fderivWithin π•œ g t (f y)) (fderivWithin π•œ f s y)) s xβ€– := by
-      have L : (1 : β„•βˆž) ≀ n.succ := by simpa only [ENat.coe_one, Nat.one_le_cast] using n.succ_pos
-      congr 1
-      refine' iteratedFDerivWithin_congr (fun y hy => _) hx _
-      apply fderivWithin.comp _ _ _ hst (hs y hy)
-      Β· exact hg.differentiableOn L _ (hst hy)
-      Β· exact hf.differentiableOn L _ hy
-    -- bound it using the fact that the composition of linear maps is a bilinear operation,
-    -- for which we have bounds for the`n`-th derivative.
-    _ ≀ βˆ‘ i in Finset.range (n + 1),
-        (n.choose i : ℝ) * β€–iteratedFDerivWithin π•œ i (fderivWithin π•œ g t ∘ f) s xβ€– *
-          β€–iteratedFDerivWithin π•œ (n - i) (fderivWithin π•œ f s) s xβ€– := by
-      have A : ContDiffOn π•œ n (fderivWithin π•œ g t ∘ f) s := by
-        apply ContDiffOn.comp _ (hf.of_le M.le) hst
-        apply hg.fderivWithin ht
-        simp only [Nat.cast_succ, le_refl]
-      have B : ContDiffOn π•œ n (fderivWithin π•œ f s) s := by
-        apply hf.fderivWithin hs
-        simp only [Nat.cast_succ, le_refl]
-      exact (ContinuousLinearMap.compL π•œ E Fu Gu).norm_iteratedFDerivWithin_le_of_bilinear_of_le_one
-        A B hs hx le_rfl (ContinuousLinearMap.norm_compL_le π•œ E Fu Gu)
-    -- bound each of the terms using the estimates on previous derivatives (that use the inductive
-    -- assumption for `g' ∘ f`).
-    _ ≀ βˆ‘ i in Finset.range (n + 1), (n.choose i : ℝ) * (i ! * C * D ^ i) * D ^ (n - i + 1) := by
-      apply Finset.sum_le_sum fun i hi => ?_
-      simp only [mul_assoc (n.choose i : ℝ)]
-      refine' mul_le_mul_of_nonneg_left _ (Nat.cast_nonneg _)
-      apply mul_le_mul (I i hi) (J i) (norm_nonneg _)
-      positivity
-    -- We are left with trivial algebraic manipulations to see that this is smaller than
-    -- the claimed bound.
-    _ = βˆ‘ i in Finset.range (n + 1),
-      -- porting note: had to insert a few more explicit type ascriptions in this and similar
-      -- expressions.
-        (n ! : ℝ) * ((i ! : ℝ)⁻¹ * i !) * C * (D ^ i * D ^ (n - i + 1)) * ((n - i)! : ℝ)⁻¹ := by
-      apply Finset.sum_congr rfl fun i hi => ?_
-      simp only [Nat.cast_choose ℝ (Finset.mem_range_succ_iff.1 hi), div_eq_inv_mul, mul_inv]
-      ring
-    _ = βˆ‘ i in Finset.range (n + 1), (n ! : ℝ) * 1 * C * D ^ (n + 1) * ((n - i)! : ℝ)⁻¹ := by
-      apply Finset.sum_congr rfl fun i hi => ?_
-      congr 2
-      Β· congr
-        apply inv_mul_cancel
-        simpa only [Ne.def, Nat.cast_eq_zero] using i.factorial_ne_zero
-      Β· rw [← pow_add]
-        congr 1
-        rw [Nat.add_succ, Nat.succ_inj']
-        exact Nat.add_sub_of_le (Finset.mem_range_succ_iff.1 hi)
-    _ ≀ βˆ‘ i in Finset.range (n + 1), (n ! : ℝ) * 1 * C * D ^ (n + 1) * 1 := by
-      apply Finset.sum_le_sum fun i _hi => ?_
-      refine' mul_le_mul_of_nonneg_left _ (by positivity)
-      apply inv_le_one
-      simpa only [Nat.one_le_cast] using (n - i).factorial_pos
-    _ = (n + 1)! * C * D ^ (n + 1) := by
-      simp only [mul_assoc, mul_one, Finset.sum_const, Finset.card_range, nsmul_eq_mul,
-        Nat.factorial_succ, Nat.cast_mul]
-#align norm_iterated_fderiv_within_comp_le_aux norm_iteratedFDerivWithin_comp_le_aux
-
-/-- If the derivatives within a set of `g` at `f x` are bounded by `C`, and the `i`-th derivative
-within a set of `f` at `x` is bounded by `D^i` for all `1 ≀ i ≀ n`, then the `n`-th derivative
-of `g ∘ f` is bounded by `n! * C * D^n`. -/
-theorem norm_iteratedFDerivWithin_comp_le {g : F β†’ G} {f : E β†’ F} {n : β„•} {s : Set E} {t : Set F}
-    {x : E} {N : β„•βˆž} (hg : ContDiffOn π•œ N g t) (hf : ContDiffOn π•œ N f s) (hn : (n : β„•βˆž) ≀ N)
-    (ht : UniqueDiffOn π•œ t) (hs : UniqueDiffOn π•œ s) (hst : MapsTo f s t) (hx : x ∈ s) {C : ℝ}
-    {D : ℝ} (hC : βˆ€ i, i ≀ n β†’ β€–iteratedFDerivWithin π•œ i g t (f x)β€– ≀ C)
-    (hD : βˆ€ i, 1 ≀ i β†’ i ≀ n β†’ β€–iteratedFDerivWithin π•œ i f s xβ€– ≀ D ^ i) :
-    β€–iteratedFDerivWithin π•œ n (g ∘ f) s xβ€– ≀ n ! * C * D ^ n := by
-  /- We reduce the bound to the case where all spaces live in the same universe (in which we
-    already have proved the result), by using linear isometries between the spaces and their `ULift`
-    to a common universe. These linear isometries preserve the norm of the iterated derivative. -/
-  let Fu : Type max uF uG := ULift.{uG, uF} F
-  let Gu : Type max uF uG := ULift.{uF, uG} G
-  have isoF : Fu ≃ₗᡒ[π•œ] F := LinearIsometryEquiv.ulift π•œ F
-  have isoG : Gu ≃ₗᡒ[π•œ] G := LinearIsometryEquiv.ulift π•œ G
-  -- lift `f` and `g` to versions `fu` and `gu` on the lifted spaces.
-  let fu : E β†’ Fu := isoF.symm ∘ f
-  let gu : Fu β†’ Gu := isoG.symm ∘ g ∘ isoF
-  let tu := isoF ⁻¹' t
-  have htu : UniqueDiffOn π•œ tu := isoF.toContinuousLinearEquiv.uniqueDiffOn_preimage_iff.2 ht
-  have hstu : MapsTo fu s tu := fun y hy ↦ by
-    simpa only [mem_preimage, comp_apply, LinearIsometryEquiv.apply_symm_apply] using hst hy
-  have Ffu : isoF (fu x) = f x := by simp only [comp_apply, LinearIsometryEquiv.apply_symm_apply]
-  -- All norms are preserved by the lifting process.
-  have hfu : ContDiffOn π•œ n fu s := isoF.symm.contDiff.comp_contDiffOn (hf.of_le hn)
-  have hgu : ContDiffOn π•œ n gu tu :=
-    isoG.symm.contDiff.comp_contDiffOn
-      ((hg.of_le hn).comp_continuousLinearMap (isoF : Fu β†’L[π•œ] F))
-  have Nfu : βˆ€ i, β€–iteratedFDerivWithin π•œ i fu s xβ€– = β€–iteratedFDerivWithin π•œ i f s xβ€– := fun i ↦ by
-    rw [LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_left _ _ hs hx]
-  simp_rw [← Nfu] at hD
-  have Ngu : βˆ€ i,
-      β€–iteratedFDerivWithin π•œ i gu tu (fu x)β€– = β€–iteratedFDerivWithin π•œ i g t (f x)β€– := fun i ↦ by
-    rw [LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_left _ _ htu (hstu hx)]
-    rw [LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_right _ _ ht, Ffu]
-    rw [Ffu]
-    exact hst hx
-  simp_rw [← Ngu] at hC
-  have Nfgu :
-      β€–iteratedFDerivWithin π•œ n (g ∘ f) s xβ€– = β€–iteratedFDerivWithin π•œ n (gu ∘ fu) s xβ€– := by
-    have : gu ∘ fu = isoG.symm ∘ g ∘ f := by
-      ext x
-      simp only [comp_apply, LinearIsometryEquiv.map_eq_iff, LinearIsometryEquiv.apply_symm_apply]
-    rw [this, LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_left _ _ hs hx]
-  -- deduce the required bound from the one for `gu ∘ fu`.
-  rw [Nfgu]
-  exact norm_iteratedFDerivWithin_comp_le_aux hgu hfu htu hs hstu hx hC hD
-#align norm_iterated_fderiv_within_comp_le norm_iteratedFDerivWithin_comp_le
-
-/-- If the derivatives of `g` at `f x` are bounded by `C`, and the `i`-th derivative
-of `f` at `x` is bounded by `D^i` for all `1 ≀ i ≀ n`, then the `n`-th derivative
-of `g ∘ f` is bounded by `n! * C * D^n`. -/
-theorem norm_iteratedFDeriv_comp_le {g : F β†’ G} {f : E β†’ F} {n : β„•} {N : β„•βˆž} (hg : ContDiff π•œ N g)
-    (hf : ContDiff π•œ N f) (hn : (n : β„•βˆž) ≀ N) (x : E) {C : ℝ} {D : ℝ}
-    (hC : βˆ€ i, i ≀ n β†’ β€–iteratedFDeriv π•œ i g (f x)β€– ≀ C)
-    (hD : βˆ€ i, 1 ≀ i β†’ i ≀ n β†’ β€–iteratedFDeriv π•œ i f xβ€– ≀ D ^ i) :
-    β€–iteratedFDeriv π•œ n (g ∘ f) xβ€– ≀ n ! * C * D ^ n := by
-  simp_rw [← iteratedFDerivWithin_univ] at hC hD ⊒
-  exact norm_iteratedFDerivWithin_comp_le hg.contDiffOn hf.contDiffOn hn uniqueDiffOn_univ
-    uniqueDiffOn_univ (mapsTo_univ _ _) (mem_univ x) hC hD
-#align norm_iterated_fderiv_comp_le norm_iteratedFDeriv_comp_le
-
-section Apply
-
-theorem norm_iteratedFDerivWithin_clm_apply {f : E β†’ F β†’L[π•œ] G} {g : E β†’ F} {s : Set E} {x : E}
-    {N : β„•βˆž} {n : β„•} (hf : ContDiffOn π•œ N f s) (hg : ContDiffOn π•œ N g s) (hs : UniqueDiffOn π•œ s)
-    (hx : x ∈ s) (hn : ↑n ≀ N) : β€–iteratedFDerivWithin π•œ n (fun y => (f y) (g y)) s xβ€– ≀
-      βˆ‘ i in Finset.range (n + 1), ↑(n.choose i) * β€–iteratedFDerivWithin π•œ i f s xβ€– *
-        β€–iteratedFDerivWithin π•œ (n - i) g s xβ€– := by
-  let B : (F β†’L[π•œ] G) β†’L[π•œ] F β†’L[π•œ] G := ContinuousLinearMap.flip (ContinuousLinearMap.apply π•œ G)
-  have hB : β€–Bβ€– ≀ 1 := by
-    simp only [ContinuousLinearMap.op_norm_flip, ContinuousLinearMap.apply]
-    refine' ContinuousLinearMap.op_norm_le_bound _ zero_le_one fun f => _
-    simp only [ContinuousLinearMap.coe_id', id.def, one_mul]
-    rfl
-  exact B.norm_iteratedFDerivWithin_le_of_bilinear_of_le_one hf hg hs hx hn hB
-#align norm_iterated_fderiv_within_clm_apply norm_iteratedFDerivWithin_clm_apply
-
-theorem norm_iteratedFDeriv_clm_apply {f : E β†’ F β†’L[π•œ] G} {g : E β†’ F} {N : β„•βˆž} {n : β„•}
-    (hf : ContDiff π•œ N f) (hg : ContDiff π•œ N g) (x : E) (hn : ↑n ≀ N) :
-    β€–iteratedFDeriv π•œ n (fun y : E => (f y) (g y)) xβ€– ≀ βˆ‘ i in Finset.range (n + 1),
-      ↑(n.choose i) * β€–iteratedFDeriv π•œ i f xβ€– * β€–iteratedFDeriv π•œ (n - i) g xβ€– := by
-  simp only [← iteratedFDerivWithin_univ]
-  exact norm_iteratedFDerivWithin_clm_apply hf.contDiffOn hg.contDiffOn uniqueDiffOn_univ
-    (Set.mem_univ x) hn
-#align norm_iterated_fderiv_clm_apply norm_iteratedFDeriv_clm_apply
-
-theorem norm_iteratedFDerivWithin_clm_apply_const {f : E β†’ F β†’L[π•œ] G} {c : F} {s : Set E} {x : E}
-    {N : β„•βˆž} {n : β„•} (hf : ContDiffOn π•œ N f s) (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) (hn : ↑n ≀ N) :
-    β€–iteratedFDerivWithin π•œ n (fun y : E => (f y) c) s xβ€– ≀
-      β€–cβ€– * β€–iteratedFDerivWithin π•œ n f s xβ€– := by
-  let g : (F β†’L[π•œ] G) β†’L[π•œ] G := ContinuousLinearMap.apply π•œ G c
-  have h := g.norm_compContinuousMultilinearMap_le (iteratedFDerivWithin π•œ n f s x)
-  rw [← g.iteratedFDerivWithin_comp_left hf hs hx hn] at h
-  refine' h.trans (mul_le_mul_of_nonneg_right _ (norm_nonneg _))
-  refine' g.op_norm_le_bound (norm_nonneg _) fun f => _
-  rw [ContinuousLinearMap.apply_apply, mul_comm]
-  exact f.le_op_norm c
-#align norm_iterated_fderiv_within_clm_apply_const norm_iteratedFDerivWithin_clm_apply_const
-
-theorem norm_iteratedFDeriv_clm_apply_const {f : E β†’ F β†’L[π•œ] G} {c : F} {x : E} {N : β„•βˆž} {n : β„•}
-    (hf : ContDiff π•œ N f) (hn : ↑n ≀ N) :
-    β€–iteratedFDeriv π•œ n (fun y : E => (f y) c) xβ€– ≀ β€–cβ€– * β€–iteratedFDeriv π•œ n f xβ€– := by
-  simp only [← iteratedFDerivWithin_univ]
-  exact norm_iteratedFDerivWithin_clm_apply_const hf.contDiffOn uniqueDiffOn_univ
-    (Set.mem_univ x) hn
-#align norm_iterated_fderiv_clm_apply_const norm_iteratedFDeriv_clm_apply_const
-
-end Apply
chore: move Analysis/ContDiff to Analysis/ContDiff/Basic to make room for splitting (#8337)

No changes to content, or splitting, just a rename so there is room for more files.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -3,7 +3,7 @@ Copyright (c) 2019 SΓ©bastien GouΓ«zel. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: SΓ©bastien GouΓ«zel, Floris van Doorn
 -/
-import Mathlib.Analysis.Calculus.ContDiffDef
+import Mathlib.Analysis.Calculus.ContDiff.Defs
 import Mathlib.Analysis.Calculus.Deriv.Inverse
 import Mathlib.Analysis.Calculus.MeanValue
 import Mathlib.Analysis.NormedSpace.FiniteDimension
chore: missing spaces after rcases, convert and congrm (#7725)

Replace rcases( with rcases (. Same thing for convert( and congrm(. No other change.

Diff
@@ -1146,10 +1146,10 @@ theorem hasFTaylorSeriesUpToOn_pi :
     exact (h i).zero_eq x hx
   Β· intro m hm x hx
     have := hasFDerivWithinAt_pi.2 fun i => (h i).fderivWithin m hm x hx
-    convert(L m).hasFDerivAt.comp_hasFDerivWithinAt x this
+    convert (L m).hasFDerivAt.comp_hasFDerivWithinAt x this
   Β· intro m hm
     have := continuousOn_pi.2 fun i => (h i).cont m hm
-    convert(L m).continuous.comp_continuousOn this
+    convert (L m).continuous.comp_continuousOn this
 #align has_ftaylor_series_up_to_on_pi hasFTaylorSeriesUpToOn_pi
 
 @[simp]
feat: lemmas about derivatives (#7683)
  • From the Sobolev project

Co-authored-by: Heather Macbeth 25316162+hrmacbeth@users.noreply.github.com

Diff
@@ -1183,6 +1183,19 @@ theorem contDiff_pi : ContDiff π•œ n Ξ¦ ↔ βˆ€ i, ContDiff π•œ n fun x => Ξ¦
   simp only [← contDiffOn_univ, contDiffOn_pi]
 #align cont_diff_pi contDiff_pi
 
+theorem contDiff_update (k : β„•βˆž) (x : βˆ€ i, F' i) (i : ΞΉ) : ContDiff π•œ k (update x i) := by
+  rw [contDiff_pi]
+  intro j
+  dsimp [Function.update]
+  split_ifs with h
+  Β· subst h
+    exact contDiff_id
+  Β· exact contDiff_const
+
+variable (F') in
+theorem contDiff_single (k : β„•βˆž) (i : ΞΉ) : ContDiff π•œ k (Pi.single i : F' i β†’ βˆ€ i, F' i) :=
+  contDiff_update k 0 i
+
 variable (π•œ E)
 
 theorem contDiff_apply (i : ΞΉ) : ContDiff π•œ n fun f : ΞΉ β†’ E => f i :=
feat: locally Lipschitz maps (#7314)

Define locally Lipschitz maps and show their basic properties. In particular, they are continuous and stable under composition and products. As an application, we conclude that CΒΉ maps are locally Lipschitz.

Co-authored-by: grunweg <grunweg@posteo.de>

Diff
@@ -2064,6 +2064,12 @@ theorem ContDiffAt.exists_lipschitzOnWith {f : E' β†’ F'} {x : E'} (hf : ContDif
   (hf.hasStrictFDerivAt le_rfl).exists_lipschitzOnWith
 #align cont_diff_at.exists_lipschitz_on_with ContDiffAt.exists_lipschitzOnWith
 
+/-- If `f` is `C^1`, it is locally Lipschitz. -/
+lemma ContDiff.locallyLipschitz {f : E' β†’ F'} (hf : ContDiff 𝕂 1 f) : LocallyLipschitz f := by
+  intro x
+  rcases hf.contDiffAt.exists_lipschitzOnWith with ⟨K, t, ht, hf⟩
+  use K, t
+
 /-- A `C^1` function with compact support is Lipschitz. -/
 theorem ContDiff.lipschitzWith_of_hasCompactSupport {f : E' β†’ F'} {n : β„•βˆž}
     (hf : HasCompactSupport f) (h'f : ContDiff 𝕂 n f) (hn : 1 ≀ n) :
chore: tidy various files (#7343)
Diff
@@ -84,7 +84,7 @@ theorem contDiff_zero_fun : ContDiff π•œ n fun _ : E => (0 : F) :=
 /-- Constants are `C^∞`.
 -/
 theorem contDiff_const {c : F} : ContDiff π•œ n fun _ : E => c := by
-  suffices h : ContDiff π•œ ∞ fun _ : E => c; Β· exact h.of_le le_top
+  suffices h : ContDiff π•œ ∞ fun _ : E => c from h.of_le le_top
   rw [contDiff_top_iff_fderiv]
   refine' ⟨differentiable_const c, _⟩
   rw [fderiv_const]
@@ -142,7 +142,7 @@ theorem iteratedFDeriv_const_of_ne {n : β„•} (hn : n β‰  0) (c : F) :
 /-- Unbundled bounded linear functions are `C^∞`.
 -/
 theorem IsBoundedLinearMap.contDiff (hf : IsBoundedLinearMap π•œ f) : ContDiff π•œ n f := by
-  suffices h : ContDiff π•œ ∞ f; Β· exact h.of_le le_top
+  suffices h : ContDiff π•œ ∞ f from h.of_le le_top
   rw [contDiff_top_iff_fderiv]
   refine' ⟨hf.differentiable, _⟩
   simp_rw [hf.fderiv]
@@ -186,7 +186,7 @@ theorem contDiffOn_id {s} : ContDiffOn π•œ n (id : E β†’ E) s :=
 /-- Bilinear functions are `C^∞`.
 -/
 theorem IsBoundedBilinearMap.contDiff (hb : IsBoundedBilinearMap π•œ b) : ContDiff π•œ n b := by
-  suffices h : ContDiff π•œ ∞ b; Β· exact h.of_le le_top
+  suffices h : ContDiff π•œ ∞ b from h.of_le le_top
   rw [contDiff_top_iff_fderiv]
   refine' ⟨hb.differentiable, _⟩
   simp only [hb.fderiv]
@@ -429,8 +429,8 @@ theorem ContinuousLinearEquiv.iteratedFDerivWithin_comp_right (g : G ≃L[π•œ]
     simp only [ContinuousLinearMap.coe_comp', ContinuousLinearEquiv.coe_coe, comp_apply,
       ContinuousMultilinearMap.compContinuousLinearMapEquivL_apply,
       ContinuousMultilinearMap.compContinuousLinearMap_apply]
-    rw [ContinuousLinearEquiv.comp_right_fderivWithin _ (g.uniqueDiffOn_preimage_iff.2 hs x hx)]
-    rfl
+    rw [ContinuousLinearEquiv.comp_right_fderivWithin _ (g.uniqueDiffOn_preimage_iff.2 hs x hx),
+      ContinuousLinearMap.coe_comp', coe_coe, comp_apply, tail_def, tail_def]
 #align continuous_linear_equiv.iterated_fderiv_within_comp_right ContinuousLinearEquiv.iteratedFDerivWithin_comp_right
 
 /-- The iterated derivative of the composition with a linear map on the right is
feat: the linear span of a separable set is separable (#7115)
Diff
@@ -2064,6 +2064,15 @@ theorem ContDiffAt.exists_lipschitzOnWith {f : E' β†’ F'} {x : E'} (hf : ContDif
   (hf.hasStrictFDerivAt le_rfl).exists_lipschitzOnWith
 #align cont_diff_at.exists_lipschitz_on_with ContDiffAt.exists_lipschitzOnWith
 
+/-- A `C^1` function with compact support is Lipschitz. -/
+theorem ContDiff.lipschitzWith_of_hasCompactSupport {f : E' β†’ F'} {n : β„•βˆž}
+    (hf : HasCompactSupport f) (h'f : ContDiff 𝕂 n f) (hn : 1 ≀ n) :
+    βˆƒ C, LipschitzWith C f := by
+  obtain ⟨C, hC⟩ := (hf.fderiv 𝕂).exists_bound_of_continuous (h'f.continuous_fderiv hn)
+  refine ⟨⟨max C 0, le_max_right _ _⟩, ?_⟩
+  apply lipschitzWith_of_nnnorm_fderiv_le (h'f.differentiable hn) (fun x ↦ ?_)
+  simp [← NNReal.coe_le_coe, hC x]
+
 end Real
 
 section deriv
chore: update/remove heart beat bumps (#6860)

We clean up heart beat bumps after #6474.

Diff
@@ -2345,7 +2345,7 @@ theorem ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear_aux {Du Eu
       (fun i j => β€–iteratedFDerivWithin π•œ i f s xβ€– * β€–iteratedFDerivWithin π•œ j g s xβ€–) n).symm
 #align continuous_linear_map.norm_iterated_fderiv_within_le_of_bilinear_aux ContinuousLinearMap.norm_iteratedFDerivWithin_le_of_bilinear_aux
 
-set_option maxHeartbeats 900000 in -- 4.5Γ— the default limit
+set_option maxHeartbeats 700000 in -- 3.5Γ— the default limit
 /-- Bounding the norm of the iterated derivative of `B (f x) (g x)` within a set in terms of the
 iterated derivatives of `f` and `g` when `B` is bilinear:
 `β€–D^n (x ↦ B (f x) (g x))β€– ≀ β€–Bβ€– βˆ‘_{k ≀ n} n.choose k β€–D^k fβ€– β€–D^{n-k} gβ€–` -/
@@ -2542,7 +2542,6 @@ theorem norm_iteratedFDeriv_mul_le {f : E β†’ A} {g : E β†’ A} {N : β„•βˆž} (hf
 
 end
 
-set_option maxHeartbeats 300000 in
 /-- If the derivatives within a set of `g` at `f x` are bounded by `C`, and the `i`-th derivative
 within a set of `f` at `x` is bounded by `D^i` for all `1 ≀ i ≀ n`, then the `n`-th derivative
 of `g ∘ f` is bounded by `n! * C * D^n`.
chore: rename isBoundedBilinearMapApply to isBoundedBilinearMap_apply (#6963)
Diff
@@ -891,12 +891,12 @@ theorem ContDiffOn.clm_comp {g : X β†’ F β†’L[π•œ] G} {f : X β†’ E β†’L[π•œ] F
 
 theorem ContDiff.clm_apply {f : E β†’ F β†’L[π•œ] G} {g : E β†’ F} {n : β„•βˆž} (hf : ContDiff π•œ n f)
     (hg : ContDiff π•œ n g) : ContDiff π•œ n fun x => (f x) (g x) :=
-  isBoundedBilinearMapApply.contDiff.compβ‚‚ hf hg
+  isBoundedBilinearMap_apply.contDiff.compβ‚‚ hf hg
 #align cont_diff.clm_apply ContDiff.clm_apply
 
 theorem ContDiffOn.clm_apply {f : E β†’ F β†’L[π•œ] G} {g : E β†’ F} {n : β„•βˆž} (hf : ContDiffOn π•œ n f s)
     (hg : ContDiffOn π•œ n g s) : ContDiffOn π•œ n (fun x => (f x) (g x)) s :=
-  isBoundedBilinearMapApply.contDiff.comp_contDiff_onβ‚‚ hf hg
+  isBoundedBilinearMap_apply.contDiff.comp_contDiff_onβ‚‚ hf hg
 #align cont_diff_on.clm_apply ContDiffOn.clm_apply
 
 -- porting note: In Lean 3 we had to give implicit arguments in proofs like the following,
@@ -2094,7 +2094,7 @@ theorem contDiffOn_succ_iff_derivWithin {n : β„•} (hs : UniqueDiffOn π•œ sβ‚‚)
     Β· ext x; rfl
     simp_rw [this]
     apply ContDiff.comp_contDiffOn _ h
-    exact (isBoundedBilinearMapApply.isBoundedLinearMap_left _).contDiff
+    exact (isBoundedBilinearMap_apply.isBoundedLinearMap_left _).contDiff
   Β· intro h
     have : fderivWithin π•œ fβ‚‚ sβ‚‚ = smulRight (1 : π•œ β†’L[π•œ] π•œ) ∘ derivWithin fβ‚‚ sβ‚‚
     Β· ext x; simp [derivWithin]
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
@@ -54,10 +54,10 @@ open Set Fin Filter Function
 
 open scoped Topology
 
-variable {π•œ : Type _} [NontriviallyNormedField π•œ] {D : Type uD} [NormedAddCommGroup D]
+variable {π•œ : Type*} [NontriviallyNormedField π•œ] {D : Type uD} [NormedAddCommGroup D]
   [NormedSpace π•œ D] {E : Type uE} [NormedAddCommGroup E] [NormedSpace π•œ E] {F : Type uF}
   [NormedAddCommGroup F] [NormedSpace π•œ F] {G : Type uG} [NormedAddCommGroup G] [NormedSpace π•œ G]
-  {X : Type _} [NormedAddCommGroup X] [NormedSpace π•œ X] {s s₁ t u : Set E} {f f₁ : E β†’ F}
+  {X : Type*} [NormedAddCommGroup X] [NormedSpace π•œ X] {s s₁ t u : Set E} {f f₁ : E β†’ F}
   {g : F β†’ G} {x xβ‚€ : E} {c : F} {b : E Γ— F β†’ G} {m n : β„•βˆž} {p : E β†’ FormalMultilinearSeries π•œ E F}
 
 /-! ### Constants -/
@@ -845,7 +845,7 @@ theorem contDiffWithinAt_snd {s : Set (E Γ— F)} {p : E Γ— F} :
 
 section NAry
 
-variable {E₁ Eβ‚‚ E₃ Eβ‚„ : Type _}
+variable {E₁ Eβ‚‚ E₃ Eβ‚„ : Type*}
 
 variable [NormedAddCommGroup E₁] [NormedAddCommGroup Eβ‚‚] [NormedAddCommGroup E₃]
   [NormedAddCommGroup Eβ‚„] [NormedSpace π•œ E₁] [NormedSpace π•œ Eβ‚‚] [NormedSpace π•œ E₃]
@@ -1128,7 +1128,7 @@ theorem ContDiff.contDiff_fderiv_apply {f : E β†’ F} (hf : ContDiff π•œ n f) (h
 
 section Pi
 
-variable {ΞΉ ΞΉ' : Type _} [Fintype ΞΉ] [Fintype ΞΉ'] {F' : ΞΉ β†’ Type _} [βˆ€ i, NormedAddCommGroup (F' i)]
+variable {ΞΉ ΞΉ' : Type*} [Fintype ΞΉ] [Fintype ΞΉ'] {F' : ΞΉ β†’ Type*} [βˆ€ i, NormedAddCommGroup (F' i)]
   [βˆ€ i, NormedSpace π•œ (F' i)] {Ο† : βˆ€ i, E β†’ F' i} {p' : βˆ€ i, E β†’ FormalMultilinearSeries π•œ E (F' i)}
   {Ξ¦ : E β†’ βˆ€ i, F' i} {P' : E β†’ FormalMultilinearSeries π•œ E (βˆ€ i, F' i)}
 
@@ -1358,7 +1358,7 @@ theorem ContDiff.sub {f g : E β†’ F} (hf : ContDiff π•œ n f) (hg : ContDiff 
 
 /-! ### Sum of finitely many functions -/
 
-theorem ContDiffWithinAt.sum {ΞΉ : Type _} {f : ΞΉ β†’ E β†’ F} {s : Finset ΞΉ} {t : Set E} {x : E}
+theorem ContDiffWithinAt.sum {ΞΉ : Type*} {f : ΞΉ β†’ E β†’ F} {s : Finset ΞΉ} {t : Set E} {x : E}
     (h : βˆ€ i ∈ s, ContDiffWithinAt π•œ n (fun x => f i x) t x) :
     ContDiffWithinAt π•œ n (fun x => βˆ‘ i in s, f i x) t x := by
   classical
@@ -1369,19 +1369,19 @@ theorem ContDiffWithinAt.sum {ΞΉ : Type _} {f : ΞΉ β†’ E β†’ F} {s : Finset ΞΉ}
         (IH fun j hj => h _ (Finset.mem_insert_of_mem hj))
 #align cont_diff_within_at.sum ContDiffWithinAt.sum
 
-theorem ContDiffAt.sum {ΞΉ : Type _} {f : ΞΉ β†’ E β†’ F} {s : Finset ΞΉ} {x : E}
+theorem ContDiffAt.sum {ΞΉ : Type*} {f : ΞΉ β†’ E β†’ F} {s : Finset ΞΉ} {x : E}
     (h : βˆ€ i ∈ s, ContDiffAt π•œ n (fun x => f i x) x) :
     ContDiffAt π•œ n (fun x => βˆ‘ i in s, f i x) x := by
   rw [← contDiffWithinAt_univ] at *; exact ContDiffWithinAt.sum h
 #align cont_diff_at.sum ContDiffAt.sum
 
-theorem ContDiffOn.sum {ΞΉ : Type _} {f : ΞΉ β†’ E β†’ F} {s : Finset ΞΉ} {t : Set E}
+theorem ContDiffOn.sum {ΞΉ : Type*} {f : ΞΉ β†’ E β†’ F} {s : Finset ΞΉ} {t : Set E}
     (h : βˆ€ i ∈ s, ContDiffOn π•œ n (fun x => f i x) t) :
     ContDiffOn π•œ n (fun x => βˆ‘ i in s, f i x) t := fun x hx =>
   ContDiffWithinAt.sum fun i hi => h i hi x hx
 #align cont_diff_on.sum ContDiffOn.sum
 
-theorem ContDiff.sum {ΞΉ : Type _} {f : ΞΉ β†’ E β†’ F} {s : Finset ΞΉ}
+theorem ContDiff.sum {ΞΉ : Type*} {f : ΞΉ β†’ E β†’ F} {s : Finset ΞΉ}
     (h : βˆ€ i ∈ s, ContDiff π•œ n fun x => f i x) : ContDiff π•œ n fun x => βˆ‘ i in s, f i x := by
   simp only [← contDiffOn_univ] at *; exact ContDiffOn.sum h
 #align cont_diff.sum ContDiff.sum
@@ -1390,7 +1390,7 @@ theorem ContDiff.sum {ΞΉ : Type _} {f : ΞΉ β†’ E β†’ F} {s : Finset ΞΉ}
 
 section MulProd
 
-variable {𝔸 𝔸' ΞΉ π•œ' : Type _} [NormedRing 𝔸] [NormedAlgebra π•œ 𝔸] [NormedCommRing 𝔸']
+variable {𝔸 𝔸' ΞΉ π•œ' : Type*} [NormedRing 𝔸] [NormedAlgebra π•œ 𝔸] [NormedCommRing 𝔸']
   [NormedAlgebra π•œ 𝔸'] [NormedField π•œ'] [NormedAlgebra π•œ π•œ']
 
 -- The product is smooth.
@@ -1549,7 +1549,7 @@ Porting note: TODO: generalize results in this section.
 
 section ConstSmul
 
-variable {R : Type _} [Semiring R] [Module R F] [SMulCommClass π•œ R F]
+variable {R : Type*} [Semiring R] [Module R F] [SMulCommClass π•œ R F]
 
 variable [ContinuousConstSMul R F]
 
@@ -1602,9 +1602,9 @@ end ConstSmul
 
 section Prod_map
 
-variable {E' : Type _} [NormedAddCommGroup E'] [NormedSpace π•œ E']
+variable {E' : Type*} [NormedAddCommGroup E'] [NormedSpace π•œ E']
 
-variable {F' : Type _} [NormedAddCommGroup F'] [NormedSpace π•œ F']
+variable {F' : Type*} [NormedAddCommGroup F'] [NormedSpace π•œ F']
 
 /-- The product map of two `C^n` functions within a set at a point is `C^n`
 within the product set at the product point. -/
@@ -1622,7 +1622,7 @@ theorem ContDiffWithinAt.prod_map {s : Set E} {t : Set E'} {f : E β†’ F} {g : E'
 #align cont_diff_within_at.prod_map ContDiffWithinAt.prod_map
 
 /-- The product map of two `C^n` functions on a set is `C^n` on the product set. -/
-theorem ContDiffOn.prod_map {E' : Type _} [NormedAddCommGroup E'] [NormedSpace π•œ E'] {F' : Type _}
+theorem ContDiffOn.prod_map {E' : Type*} [NormedAddCommGroup E'] [NormedSpace π•œ E'] {F' : Type*}
     [NormedAddCommGroup F'] [NormedSpace π•œ F'] {s : Set E} {t : Set E'} {f : E β†’ F} {g : E' β†’ F'}
     (hf : ContDiffOn π•œ n f s) (hg : ContDiffOn π•œ n g t) : ContDiffOn π•œ n (Prod.map f g) (s Γ—Λ’ t) :=
   (hf.comp contDiffOn_fst (prod_subset_preimage_fst _ _)).prod
@@ -1667,7 +1667,7 @@ end Prod_map
 
 section AlgebraInverse
 
-variable (π•œ) {R : Type _} [NormedRing R]
+variable (π•œ) {R : Type*} [NormedRing R]
 -- porting note: this couldn't be on the same line as the binder type update of `π•œ`
 variable [NormedAlgebra π•œ R]
 
@@ -1700,7 +1700,7 @@ theorem contDiffAt_ring_inverse [CompleteSpace R] (x : RΛ£) :
   Β· exact contDiffAt_top.mpr Itop
 #align cont_diff_at_ring_inverse contDiffAt_ring_inverse
 
-variable {π•œ' : Type _} [NormedField π•œ'] [NormedAlgebra π•œ π•œ'] [CompleteSpace π•œ']
+variable {π•œ' : Type*} [NormedField π•œ'] [NormedAlgebra π•œ π•œ'] [CompleteSpace π•œ']
 
 theorem contDiffAt_inv {x : π•œ'} (hx : x β‰  0) {n} : ContDiffAt π•œ n Inv.inv x := by
   simpa only [Ring.inverse_eq_inv'] using contDiffAt_ring_inverse π•œ (Units.mk0 x hx)
@@ -1949,8 +1949,8 @@ section Real
 -/
 
 
-variable {𝕂 : Type _} [IsROrC 𝕂] {E' : Type _} [NormedAddCommGroup E'] [NormedSpace 𝕂 E']
-  {F' : Type _} [NormedAddCommGroup F'] [NormedSpace 𝕂 F']
+variable {𝕂 : Type*} [IsROrC 𝕂] {E' : Type*} [NormedAddCommGroup E'] [NormedSpace 𝕂 E']
+  {F' : Type*} [NormedAddCommGroup F'] [NormedSpace 𝕂 F']
 
 /-- If a function has a Taylor series at order at least 1, then at points in the interior of the
     domain of definition, the term of order 1 of this series is a strict derivative of `f`. -/
@@ -2007,7 +2007,7 @@ theorem ContDiff.hasStrictDerivAt {f : 𝕂 β†’ F'} {x : 𝕂} (hf : ContDiff 
 
 /-- If `f` has a formal Taylor series `p` up to order `1` on `{x} βˆͺ s`, where `s` is a convex set,
 and `β€–p x 1β€–β‚Š < K`, then `f` is `K`-Lipschitz in a neighborhood of `x` within `s`. -/
-theorem HasFTaylorSeriesUpToOn.exists_lipschitzOnWith_of_nnnorm_lt {E F : Type _}
+theorem HasFTaylorSeriesUpToOn.exists_lipschitzOnWith_of_nnnorm_lt {E F : Type*}
     [NormedAddCommGroup E] [NormedSpace ℝ E] [NormedAddCommGroup F] [NormedSpace ℝ F] {f : E β†’ F}
     {p : E β†’ FormalMultilinearSeries ℝ E F} {s : Set E} {x : E}
     (hf : HasFTaylorSeriesUpToOn 1 f p (insert x s)) (hs : Convex ℝ s) (K : ℝβ‰₯0)
@@ -2026,7 +2026,7 @@ theorem HasFTaylorSeriesUpToOn.exists_lipschitzOnWith_of_nnnorm_lt {E F : Type _
 
 /-- If `f` has a formal Taylor series `p` up to order `1` on `{x} βˆͺ s`, where `s` is a convex set,
 then `f` is Lipschitz in a neighborhood of `x` within `s`. -/
-theorem HasFTaylorSeriesUpToOn.exists_lipschitzOnWith {E F : Type _} [NormedAddCommGroup E]
+theorem HasFTaylorSeriesUpToOn.exists_lipschitzOnWith {E F : Type*} [NormedAddCommGroup E]
     [NormedSpace ℝ E] [NormedAddCommGroup F] [NormedSpace ℝ F] {f : E β†’ F}
     {p : E β†’ FormalMultilinearSeries ℝ E F} {s : Set E} {x : E}
     (hf : HasFTaylorSeriesUpToOn 1 f p (insert x s)) (hs : Convex ℝ s) :
@@ -2036,7 +2036,7 @@ theorem HasFTaylorSeriesUpToOn.exists_lipschitzOnWith {E F : Type _} [NormedAddC
 
 /-- If `f` is `C^1` within a convex set `s` at `x`, then it is Lipschitz on a neighborhood of `x`
 within `s`. -/
-theorem ContDiffWithinAt.exists_lipschitzOnWith {E F : Type _} [NormedAddCommGroup E]
+theorem ContDiffWithinAt.exists_lipschitzOnWith {E F : Type*} [NormedAddCommGroup E]
     [NormedSpace ℝ E] [NormedAddCommGroup F] [NormedSpace ℝ F] {f : E β†’ F} {s : Set E} {x : E}
     (hf : ContDiffWithinAt ℝ 1 f s x) (hs : Convex ℝ s) :
     βˆƒ K : ℝβ‰₯0, βˆƒ t ∈ 𝓝[s] x, LipschitzOnWith K f t := by
@@ -2212,7 +2212,7 @@ over `π•œ`.
 -/
 
 
-variable (π•œ) {π•œ' : Type _} [NontriviallyNormedField π•œ']
+variable (π•œ) {π•œ' : Type*} [NontriviallyNormedField π•œ']
 -- porting note: this couldn't be on the same line as the binder type update of `π•œ`
 variable [NormedAlgebra π•œ π•œ']
 
@@ -2494,7 +2494,7 @@ theorem ContinuousLinearMap.norm_iteratedFDeriv_le_of_bilinear_of_le_one (B : E
 
 section
 
-variable {π•œ' : Type _} [NormedField π•œ'] [NormedAlgebra π•œ π•œ'] [NormedSpace π•œ' F]
+variable {π•œ' : Type*} [NormedField π•œ'] [NormedAlgebra π•œ π•œ'] [NormedSpace π•œ' F]
   [IsScalarTower π•œ π•œ' F]
 
 theorem norm_iteratedFDerivWithin_smul_le {f : E β†’ π•œ'} {g : E β†’ F} {N : β„•βˆž}
@@ -2519,7 +2519,7 @@ end
 
 section
 
-variable {A : Type _} [NormedRing A] [NormedAlgebra π•œ A]
+variable {A : Type*} [NormedRing A] [NormedAlgebra π•œ A]
 
 theorem norm_iteratedFDerivWithin_mul_le {f : E β†’ A} {g : E β†’ A} {N : β„•βˆž} (hf : ContDiffOn π•œ N f s)
     (hg : ContDiffOn π•œ N g s) (hs : UniqueDiffOn π•œ s) {x : E} (hx : x ∈ s) {n : β„•}
feat: n-th derivative of C^{n+p} map is C^p (#6101)
Diff
@@ -1034,6 +1034,18 @@ theorem ContDiffWithinAt.fderivWithin_right (hf : ContDiffWithinAt π•œ n f s x
     contDiffWithinAt_id hs hmn hxβ‚€s (by rw [preimage_id'])
 #align cont_diff_within_at.fderiv_within_right ContDiffWithinAt.fderivWithin_right
 
+-- TODO: can we make a version of `ContDiffWithinAt.fderivWithin` for iterated derivatives?
+theorem ContDiffWithinAt.iteratedFderivWithin_right {i : β„•} (hf : ContDiffWithinAt π•œ n f s xβ‚€)
+    (hs : UniqueDiffOn π•œ s) (hmn : (m + i : β„•βˆž) ≀ n) (hxβ‚€s : xβ‚€ ∈ s) :
+    ContDiffWithinAt π•œ m (iteratedFDerivWithin π•œ i f s) s xβ‚€ := by
+  induction' i with i hi generalizing m
+  Β· rw [Nat.zero_eq, ENat.coe_zero, add_zero] at hmn
+    exact (hf.of_le hmn).continuousLinearMap_comp
+      ((continuousMultilinearCurryFin0 π•œ E F).symm : _ β†’L[π•œ] E [Γ—0]β†’L[π•œ] F)
+  Β· rw [Nat.cast_succ, add_comm _ 1, ← add_assoc] at hmn
+    exact ((hi hmn).fderivWithin_right hs le_rfl hxβ‚€s).continuousLinearMap_comp
+      (continuousMultilinearCurryLeftEquiv π•œ (fun _ : Fin (i+1) ↦ E) F : _ β†’L[π•œ] E [Γ—(i+1)]β†’L[π•œ] F)
+
 /-- `x ↦ fderiv π•œ (f x) (g x)` is smooth at `xβ‚€`. -/
 protected theorem ContDiffAt.fderiv {f : E β†’ F β†’ G} {g : E β†’ F} {n : β„•βˆž}
     (hf : ContDiffAt π•œ n (Function.uncurry f) (xβ‚€, g xβ‚€)) (hg : ContDiffAt π•œ m g xβ‚€)
@@ -1050,6 +1062,11 @@ theorem ContDiffAt.fderiv_right (hf : ContDiffAt π•œ n f xβ‚€) (hmn : (m + 1 :
   ContDiffAt.fderiv (ContDiffAt.comp (xβ‚€, xβ‚€) hf contDiffAt_snd) contDiffAt_id hmn
 #align cont_diff_at.fderiv_right ContDiffAt.fderiv_right
 
+theorem ContDiffAt.iteratedFDeriv_right {i : β„•} (hf : ContDiffAt π•œ n f xβ‚€)
+    (hmn : (m + i : β„•βˆž) ≀ n) : ContDiffAt π•œ m (iteratedFDeriv π•œ i f) xβ‚€ := by
+  rw [← iteratedFDerivWithin_univ, ← contDiffWithinAt_univ] at *
+  exact hf.iteratedFderivWithin_right uniqueDiffOn_univ hmn trivial
+
 /-- `x ↦ fderiv π•œ (f x) (g x)` is smooth. -/
 protected theorem ContDiff.fderiv {f : E β†’ F β†’ G} {g : E β†’ F} {n m : β„•βˆž}
     (hf : ContDiff π•œ m <| Function.uncurry f) (hg : ContDiff π•œ n g) (hnm : n + 1 ≀ m) :
@@ -1063,6 +1080,10 @@ theorem ContDiff.fderiv_right (hf : ContDiff π•œ n f) (hmn : (m + 1 : β„•βˆž) 
   contDiff_iff_contDiffAt.mpr fun _x => hf.contDiffAt.fderiv_right hmn
 #align cont_diff.fderiv_right ContDiff.fderiv_right
 
+theorem ContDiff.iteratedFDeriv_right {i : β„•} (hf : ContDiff π•œ n f)
+    (hmn : (m + i : β„•βˆž) ≀ n) : ContDiff π•œ m (iteratedFDeriv π•œ i f) :=
+  contDiff_iff_contDiffAt.mpr fun _x => hf.contDiffAt.iteratedFDeriv_right hmn
+
 /-- `x ↦ fderiv π•œ (f x) (g x)` is continuous. -/
 theorem Continuous.fderiv {f : E β†’ F β†’ G} {g : E β†’ F} {n : β„•βˆž}
     (hf : ContDiff π•œ n <| Function.uncurry f) (hg : Continuous g) (hn : 1 ≀ n) :
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,11 +2,6 @@
 Copyright (c) 2019 SΓ©bastien GouΓ«zel. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: SΓ©bastien GouΓ«zel, Floris van Doorn
-
-! This file was ported from Lean 3 source module analysis.calculus.cont_diff
-! leanprover-community/mathlib commit 3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Analysis.Calculus.ContDiffDef
 import Mathlib.Analysis.Calculus.Deriv.Inverse
@@ -14,6 +9,8 @@ import Mathlib.Analysis.Calculus.MeanValue
 import Mathlib.Analysis.NormedSpace.FiniteDimension
 import Mathlib.Data.Nat.Choose.Cast
 
+#align_import analysis.calculus.cont_diff from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
+
 /-!
 # Higher differentiability of usual operations
 
fix: change compl precedence (#5586)

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

Diff
@@ -1688,7 +1688,7 @@ theorem contDiffAt_inv {x : π•œ'} (hx : x β‰  0) {n} : ContDiffAt π•œ n Inv.in
   simpa only [Ring.inverse_eq_inv'] using contDiffAt_ring_inverse π•œ (Units.mk0 x hx)
 #align cont_diff_at_inv contDiffAt_inv
 
-theorem contDiffOn_inv {n} : ContDiffOn π•œ n (Inv.inv : π•œ' β†’ π•œ') ({0}ᢜ) := fun _ hx =>
+theorem contDiffOn_inv {n} : ContDiffOn π•œ n (Inv.inv : π•œ' β†’ π•œ') {0}ᢜ := fun _ hx =>
   (contDiffAt_inv π•œ hx).contDiffWithinAt
 #align cont_diff_on_inv contDiffOn_inv
 
fix precedence of Nat.iterate (#5589)
Diff
@@ -2169,13 +2169,13 @@ theorem ContDiff.continuous_deriv (h : ContDiff π•œ n fβ‚‚) (hn : 1 ≀ n) : Co
 #align cont_diff.continuous_deriv ContDiff.continuous_deriv
 
 theorem ContDiff.iterate_deriv :
-    βˆ€ (n : β„•) {fβ‚‚ : π•œ β†’ F}, ContDiff π•œ ∞ fβ‚‚ β†’ ContDiff π•œ ∞ ((deriv^[n]) fβ‚‚)
+    βˆ€ (n : β„•) {fβ‚‚ : π•œ β†’ F}, ContDiff π•œ ∞ fβ‚‚ β†’ ContDiff π•œ ∞ (deriv^[n] fβ‚‚)
   | 0,     _, hf => hf
   | n + 1, _, hf => ContDiff.iterate_deriv n (contDiff_top_iff_deriv.mp hf).2
 #align cont_diff.iterate_deriv ContDiff.iterate_deriv
 
 theorem ContDiff.iterate_deriv' (n : β„•) :
-    βˆ€ (k : β„•) {fβ‚‚ : π•œ β†’ F}, ContDiff π•œ (n + k : β„•) fβ‚‚ β†’ ContDiff π•œ n ((deriv^[k]) fβ‚‚)
+    βˆ€ (k : β„•) {fβ‚‚ : π•œ β†’ F}, ContDiff π•œ (n + k : β„•) fβ‚‚ β†’ ContDiff π•œ n (deriv^[k] fβ‚‚)
   | 0,     _, hf => hf
   | k + 1, _, hf => ContDiff.iterate_deriv' _ k (contDiff_succ_iff_deriv.mp hf).2
 #align cont_diff.iterate_deriv' ContDiff.iterate_deriv'
feat: don't re-elaborate terms in set (#5386)

Fix the set tactic to not time out when dealing with slow to elaborate terms and many local hypotheses.

The root cause of this is that the rewrite [blah] at * tactic causes blah to be elaborated again and again for each local hypothesis, this is possibly a core issue that should be fixed separately, but in set we have the elaborated term already so we can just use it.

We also add some functionality to simply test / demonstrate failures when elaboration takes too long, namely sleepAtLeastHeartbeats and a sleep_heartbeats tactic.

@urkud was facing some slow running set's in https://github.com/leanprover-community/mathlib4/pull/4912, see https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Timeout.20in.20.60set.20.2E.2E.20with.60/near/367958828 that this issue was minimized from and should fix.

Some other linter failures show up due to changes to the set internals so fix these too.

Co-authored-by: Jeremy Tan Jie Rui <reddeloostw@gmail.com>

Diff
@@ -506,7 +506,7 @@ product of `f` and `g` admits the cartesian product of `p` and `q` as a Taylor s
 theorem HasFTaylorSeriesUpToOn.prod (hf : HasFTaylorSeriesUpToOn n f p s) {g : E β†’ G}
     {q : E β†’ FormalMultilinearSeries π•œ E G} (hg : HasFTaylorSeriesUpToOn n g q s) :
     HasFTaylorSeriesUpToOn n (fun y => (f y, g y)) (fun y k => (p y k).prod (q y k)) s := by
-  set L := fun m => ContinuousMultilinearMap.prodL π•œ (fun i : Fin m => E) F G
+  set L := fun m => ContinuousMultilinearMap.prodL π•œ (fun _ : Fin m => E) F G
   constructor
   Β· intro x hx; rw [← hf.zero_eq x hx, ← hg.zero_eq x hx]; rfl
   Β· intro m hm x hx
chore: clean up spacing around at and goals (#5387)

Changes are of the form

  • some_tactic at h⊒ -> some_tactic at h ⊒
  • some_tactic at h -> some_tactic at h
Diff
@@ -584,7 +584,7 @@ private theorem ContDiffOn.comp_same_univ {Eu : Type u} [NormedAddCommGroup Eu]
     (hg : ContDiffOn π•œ n g t) (hf : ContDiffOn π•œ n f s) (st : s βŠ† f ⁻¹' t) :
     ContDiffOn π•œ n (g ∘ f) s := by
   induction' n using ENat.nat_induction with n IH Itop generalizing Eu Fu Gu
-  · rw [contDiffOn_zero] at hf hg⊒
+  · rw [contDiffOn_zero] at hf hg ⊒
     exact ContinuousOn.comp hg hf st
   · rw [contDiffOn_succ_iff_hasFDerivWithinAt] at hg ⊒
     intro x hx
chore: remove superfluous parentheses in calls to ext (#5258)

Co-authored-by: Xavier Roblot <46200072+xroblot@users.noreply.github.com> Co-authored-by: Joël Riou <joel.riou@universite-paris-saclay.fr> Co-authored-by: Riccardo Brasca <riccardo.brasca@gmail.com> Co-authored-by: Yury G. Kudryashov <urkud@urkud.name> Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Jeremy Tan Jie Rui <reddeloostw@gmail.com> Co-authored-by: Pol'tta / Miyahara Kō <pol_tta@outlook.jp> Co-authored-by: Jason Yuen <jason_yuen2007@hotmail.com> Co-authored-by: Mario Carneiro <di.gama@gmail.com> Co-authored-by: Jireh Loreaux <loreaujy@gmail.com> Co-authored-by: Ruben Van de Velde <65514131+Ruben-VandeVelde@users.noreply.github.com> Co-authored-by: Kyle Miller <kmill31415@gmail.com> Co-authored-by: Heather Macbeth <25316162+hrmacbeth@users.noreply.github.com> Co-authored-by: Jujian Zhang <jujian.zhang1998@outlook.com> Co-authored-by: Yaël Dillies <yael.dillies@gmail.com>

Diff
@@ -71,7 +71,7 @@ variable {π•œ : Type _} [NontriviallyNormedField π•œ] {D : Type uD} [NormedAdd
 theorem iteratedFDeriv_zero_fun {n : β„•} : (iteratedFDeriv π•œ n fun _ : E => (0 : F)) = 0 := by
   induction' n with n IH
   Β· ext m; simp
-  Β· ext (x m)
+  Β· ext x m
     rw [iteratedFDeriv_succ_apply_left, IH]
     change (fderiv π•œ (fun _ : E => (0 : E[Γ—n]β†’L[π•œ] F)) x : E β†’ E[Γ—n]β†’L[π•œ] F) (m 0) (tail m) = _
     rw [fderiv_const]
@@ -369,7 +369,7 @@ theorem HasFTaylorSeriesUpToOn.compContinuousLinearMap (hf : HasFTaylorSeriesUpT
   Β· intro m hm x hx
     convert (hA m).hasFDerivAt.comp_hasFDerivWithinAt x
         ((hf.fderivWithin m hm (g x) hx).comp x g.hasFDerivWithinAt (Subset.refl _))
-    ext (y v)
+    ext y v
     change p (g x) (Nat.succ m) (g ∘ cons y v) = p (g x) m.succ (cons (g y) (g ∘ v))
     rw [comp_cons]
   Β· intro m hm
chore: fix backtick in docs (#5077)

I wrote a script to find lines that contain an odd number of backticks

Diff
@@ -932,12 +932,12 @@ theorem contDiff_prodAssoc_symm : ContDiff π•œ ⊀ <| (Equiv.prodAssoc E F G).s
 /-! ### Bundled derivatives are smooth -/
 
 /-- One direction of `contDiffWithinAt_succ_iff_hasFDerivWithinAt`, but where all derivatives
-taken within the same set. Version for partial derivatives / functions with parameters.  f x` is a
+taken within the same set. Version for partial derivatives / functions with parameters.  `f x` is a
 `C^n+1` family of functions and `g x` is a `C^n` family of points, then the derivative of `f x` at
 `g x` depends in a `C^n` way on `x`. We give a general version of this fact relative to sets which
-may not have unique derivatives, in the following form.  If `f : E Γ— F β†’ G` is `C^n+1` at `(xβ‚€,
-g(xβ‚€))` in `(s βˆͺ {xβ‚€}) Γ— t βŠ† E Γ— F` and `g : E β†’ F` is `C^n` at `xβ‚€` within some set `s βŠ† E`, then
-there is a function `f' : E β†’ F β†’L[π•œ] G` that is `C^n` at `xβ‚€` within `s` such that for all `x`
+may not have unique derivatives, in the following form.  If `f : E Γ— F β†’ G` is `C^n+1` at
+`(xβ‚€, g(xβ‚€))` in `(s βˆͺ {xβ‚€}) Γ— t βŠ† E Γ— F` and `g : E β†’ F` is `C^n` at `xβ‚€` within some set `s βŠ† E`,
+then there is a function `f' : E β†’ F β†’L[π•œ] G` that is `C^n` at `xβ‚€` within `s` such that for all `x`
 sufficiently close to `xβ‚€` within `s βˆͺ {xβ‚€}` the function `y ↦ f x y` has derivative `f' x` at `g x`
 within `t βŠ† F`.  For convenience, we return an explicit set of `x`'s where this holds that is a
 subset of `s βˆͺ {xβ‚€}`.  We need one additional condition, namely that `t` is a neighborhood of
chore: convert lambda in docs to fun (#5045)

Found with git grep -n "Ξ» [a-zA-Z_ ]*,"

Diff
@@ -1219,7 +1219,7 @@ theorem ContDiffOn.add {s : Set E} {f g : E β†’ F} (hf : ContDiffOn π•œ n f s)
 variable {i : β„•}
 
 /-- The iterated derivative of the sum of two functions is the sum of the iterated derivatives.
-See also `iteratedFDerivWithin_add_apply'`, which uses the spelling `(Ξ» x, f x + g x)`
+See also `iteratedFDerivWithin_add_apply'`, which uses the spelling `(fun x ↦ f x + g x)`
 instead of `f + g`. -/
 theorem iteratedFDerivWithin_add_apply {f g : E β†’ F} (hf : ContDiffOn π•œ i f s)
     (hg : ContDiffOn π•œ i g s) (hu : UniqueDiffOn π•œ s) (hx : x ∈ s) :
@@ -1230,7 +1230,7 @@ theorem iteratedFDerivWithin_add_apply {f g : E β†’ F} (hf : ContDiffOn π•œ i f
 #align iterated_fderiv_within_add_apply iteratedFDerivWithin_add_apply
 
 /-- The iterated derivative of the sum of two functions is the sum of the iterated derivatives.
-This is the same as `iteratedFDerivWithin_add_apply`, but using the spelling `(Ξ» x, f x + g x)`
+This is the same as `iteratedFDerivWithin_add_apply`, but using the spelling `(fun x ↦ f x + g x)`
 instead of `f + g`, which can be handy for some rewrites.
 TODO: use one form consistently. -/
 theorem iteratedFDerivWithin_add_apply' {f g : E β†’ F} (hf : ContDiffOn π•œ i f s)
chore: fix many typos (#4967)

These are all doc fixes

Diff
@@ -1896,7 +1896,7 @@ theorem contDiff_clm_apply_iff {n : β„•βˆž} {f : E β†’ F β†’L[π•œ] G} [FiniteDi
 /-- This is a useful lemma to prove that a certain operation preserves functions being `C^n`.
 When you do induction on `n`, this gives a useful characterization of a function being `C^(n+1)`,
 assuming you have already computed the derivative. The advantage of this version over
-`contDiff_succ_iff_fderiv` is that both occurences of `ContDiff` are for functions with the same
+`contDiff_succ_iff_fderiv` is that both occurrences of `ContDiff` are for functions with the same
 domain and codomain (`E` and `F`). This is not the case for `contDiff_succ_iff_fderiv`, which
 often requires an inconvenient need to generalize `F`, which results in universe issues
 (see the discussion in the section of `ContDiff.comp`).
@@ -2016,7 +2016,7 @@ theorem HasFTaylorSeriesUpToOn.exists_lipschitzOnWith {E F : Type _} [NormedAddC
   (exists_gt _).imp <| hf.exists_lipschitzOnWith_of_nnnorm_lt hs
 #align has_ftaylor_series_up_to_on.exists_lipschitz_on_with HasFTaylorSeriesUpToOn.exists_lipschitzOnWith
 
-/-- If `f` is `C^1` within a conves set `s` at `x`, then it is Lipschitz on a neighborhood of `x`
+/-- If `f` is `C^1` within a convex set `s` at `x`, then it is Lipschitz on a neighborhood of `x`
 within `s`. -/
 theorem ContDiffWithinAt.exists_lipschitzOnWith {E F : Type _} [NormedAddCommGroup E]
     [NormedSpace ℝ E] [NormedAddCommGroup F] [NormedSpace ℝ F] {f : E β†’ F} {s : Set E} {x : E}
feat: port Analysis.Calculus.ContDiff (#4532)

Co-authored-by: Floris van Doorn <fpvdoorn@gmail.com> Co-authored-by: Patrick Massot <patrickmassot@free.fr> Co-authored-by: Ruben Van de Velde <65514131+Ruben-VandeVelde@users.noreply.github.com> Co-authored-by: Parcly Taxel <reddeloostw@gmail.com>

Dependencies 12 + 872

873 files ported (98.6%)
386207 lines ported (98.6%)
Show graph

The unported dependencies are

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