geometry.manifold.mfderivMathlib.Geometry.Manifold.MFDeriv.Defs

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)

(last sync)

refactor: redefine bundle.total_space (#19221)
  • Use a custom structure for bundle.total_space.
    • Use bundle.total_space.mk instead of bundle.total_space_mk.
    • Use bundle.total_space.to_prod instead of equiv.sigma_equiv_prod.
    • Use bundle.total_space.mk' (scoped notation) to specify F.
    • Rename bundle.trivial.proj_snd to bundle.total_space.trivial_snd to allow dot notation. Should we just use bundle.total_space.snd since bundle.trivial is now reducible?
  • Add an unused argument to bundle.total_space.
  • Make bundle.trivial and bundle.continuous_linear_map reducible.
  • Drop instances that are no longer needed.
Diff
@@ -688,15 +688,9 @@ end
 @[simp, mfld_simps] lemma tangent_map_within_proj {p : tangent_bundle I M} :
   (tangent_map_within I I' f s p).proj = f p.proj := rfl
 
-@[simp, mfld_simps] lemma tangent_map_within_fst {p : tangent_bundle I M} :
-  (tangent_map_within I I' f s p).1 = f p.1 := rfl
-
 @[simp, mfld_simps] lemma tangent_map_proj {p : tangent_bundle I M} :
   (tangent_map I I' f p).proj = f p.proj := rfl
 
-@[simp, mfld_simps] lemma tangent_map_fst {p : tangent_bundle I M} :
-  (tangent_map I I' f p).1 = f p.1 := rfl
-
 omit Is I's
 
 lemma mdifferentiable_within_at.prod_mk {f : M → M'} {g : M → M''}
@@ -841,8 +835,7 @@ lemma tangent_map_within_congr (h : ∀ x ∈ s, f x = f₁ x)
   (p : tangent_bundle I M) (hp : p.1 ∈ s) (hs : unique_mdiff_within_at I s p.1) :
   tangent_map_within I I' f s p = tangent_map_within I I' f₁ s p :=
 begin
-  simp only [tangent_map_within, h p.fst hp, true_and, eq_self_iff_true, heq_iff_eq,
-    sigma.mk.inj_iff],
+  simp only [tangent_map_within, h p.1 hp, true_and, eq_self_iff_true, heq_iff_eq],
   congr' 1,
   exact mfderiv_within_congr hs h (h _ hp)
 end
@@ -1344,17 +1337,17 @@ lemma mfderiv_within_fst {s : set (M × M')} {x : M × M'}
 by { rw mdifferentiable.mfderiv_within (mdifferentiable_at_fst I I') hxs, exact mfderiv_fst I I' }
 
 @[simp, mfld_simps] lemma tangent_map_prod_fst {p : tangent_bundle (I.prod I') (M × M')} :
-  tangent_map (I.prod I') I prod.fst p = total_space_mk p.proj.1 p.2.1 :=
+  tangent_map (I.prod I') I prod.fst p = ⟨p.proj.1, p.2.1⟩ :=
 by simp [tangent_map]
 
 lemma tangent_map_within_prod_fst {s : set (M × M')} {p : tangent_bundle (I.prod I') (M × M')}
   (hs : unique_mdiff_within_at (I.prod I') s p.proj) :
-  tangent_map_within (I.prod I') I prod.fst s p = total_space_mk p.proj.1 p.2.1 :=
+  tangent_map_within (I.prod I') I prod.fst s p = ⟨p.proj.1, p.2.1⟩ :=
 begin
   simp only [tangent_map_within],
-  rw mfderiv_within_fst,
-  { rcases p, refl },
-  { exact hs }
+  rw mfderiv_within_fst _ _ hs,
+  rcases p,
+  exact ⟨rfl, heq.rfl⟩
 end
 
 lemma has_mfderiv_at_snd (x : M × M') :
@@ -1400,16 +1393,16 @@ lemma mfderiv_within_snd {s : set (M × M')} {x : M × M'}
 by { rw mdifferentiable.mfderiv_within (mdifferentiable_at_snd I I') hxs, exact mfderiv_snd I I' }
 
 @[simp, mfld_simps] lemma tangent_map_prod_snd {p : tangent_bundle (I.prod I') (M × M')} :
-  tangent_map (I.prod I') I' prod.snd p = total_space_mk p.proj.2 p.2.2 :=
+  tangent_map (I.prod I') I' prod.snd p = ⟨p.proj.2, p.2.2⟩ :=
 by simp [tangent_map]
 
 lemma tangent_map_within_prod_snd {s : set (M × M')} {p : tangent_bundle (I.prod I') (M × M')}
   (hs : unique_mdiff_within_at (I.prod I') s p.proj) :
-  tangent_map_within (I.prod I') I' prod.snd s p = total_space_mk p.proj.2 p.2.2 :=
+  tangent_map_within (I.prod I') I' prod.snd s p = ⟨p.proj.2, p.2.2⟩ :=
 begin
   simp only [tangent_map_within],
   rw mfderiv_within_snd,
-  { rcases p, refl },
+  { rcases p, split; refl },
   { exact hs }
 end
 
@@ -1716,7 +1709,7 @@ mdifferentiable_of_mem_atlas _ (chart_mem_atlas _ _)
 the identification between the tangent bundle of the model space and the product space. -/
 lemma tangent_map_chart {p q : tangent_bundle I M} (h : q.1 ∈ (chart_at H p.1).source) :
   tangent_map I I (chart_at H p.1) q =
-  (equiv.sigma_equiv_prod _ _).symm
+  (total_space.to_prod _ _).symm
     ((chart_at (model_prod H E) p : tangent_bundle I M → model_prod H E) q) :=
 begin
   dsimp [tangent_map],
@@ -1732,14 +1725,14 @@ lemma tangent_map_chart_symm {p : tangent_bundle I M} {q : tangent_bundle I H}
   (h : q.1 ∈ (chart_at H p.1).target) :
   tangent_map I I (chart_at H p.1).symm q =
   ((chart_at (model_prod H E) p).symm : model_prod H E → tangent_bundle I M)
-    ((equiv.sigma_equiv_prod H E) q) :=
+    ((total_space.to_prod H E) q) :=
 begin
   dsimp only [tangent_map],
   rw mdifferentiable_at.mfderiv (mdifferentiable_at_atlas_symm _ (chart_mem_atlas _ _) h),
   -- a trivial instance is needed after the rewrite, handle it right now.
   rotate, { apply_instance },
   simp only [continuous_linear_map.coe_coe, tangent_bundle.chart_at, h,
-    tangent_bundle_core, chart_at, sigma.mk.inj_iff] with mfld_simps,
+    tangent_bundle_core, chart_at, total_space.to_prod_apply] with mfld_simps,
 end
 
 end charts
@@ -2004,23 +1997,23 @@ end
 
 open bundle
 variables {F : Type*} [normed_add_comm_group F] [normed_space 𝕜 F]
-  (Z : M → Type*) [topological_space (total_space Z)] [∀ b, topological_space (Z b)]
+  (Z : M → Type*) [topological_space (total_space F Z)] [∀ b, topological_space (Z b)]
   [∀ b, add_comm_monoid (Z b)] [∀ b, module 𝕜 (Z b)]
   [fiber_bundle F Z] [vector_bundle 𝕜 F Z] [smooth_vector_bundle F Z I]
 
 /-- In a smooth fiber bundle, the preimage under the projection of a set with
 unique differential in the basis also has unique differential. -/
 lemma unique_mdiff_on.smooth_bundle_preimage (hs : unique_mdiff_on I s) :
-  unique_mdiff_on (I.prod (𝓘(𝕜, F))) (π Z ⁻¹' s) :=
+  unique_mdiff_on (I.prod (𝓘(𝕜, F))) (π F Z ⁻¹' s) :=
 begin
   /- Using a chart (and the fact that unique differentiability is invariant under charts), we
   reduce the situation to the model space, where we can use the fact that products respect
   unique differentiability. -/
   assume p hp,
-  replace hp : p.fst ∈ s, by simpa only with mfld_simps using hp,
+  replace hp : p.1 ∈ s, by simpa only with mfld_simps using hp,
   let e₀ := chart_at H p.1,
   let e := chart_at (model_prod H F) p,
-  have h2s : ∀ x, x ∈ e.target ∩ e.symm ⁻¹' (π Z ⁻¹' s) ↔
+  have h2s : ∀ x, x ∈ e.target ∩ e.symm ⁻¹' (π F Z ⁻¹' s) ↔
     (x.1 ∈ e₀.target ∧ (e₀.symm) x.1 ∈ (trivialization_at F Z p.1).base_set) ∧ (e₀.symm) x.1 ∈ s,
   { intro x,
     have A : x ∈ e.target ↔ x.1 ∈ e₀.target ∧
@@ -2032,13 +2025,13 @@ begin
     simp only [fiber_bundle.charted_space_chart_at_symm_fst p x hx] with mfld_simps },
   -- It suffices to prove unique differentiability in a chart
   suffices h : unique_mdiff_on (I.prod (𝓘(𝕜, F)))
-    (e.target ∩ e.symm ⁻¹' (π Z ⁻¹' s)),
+    (e.target ∩ e.symm ⁻¹' (π F Z ⁻¹' s)),
   { have A : unique_mdiff_on (I.prod (𝓘(𝕜, F))) (e.symm.target ∩
-      e.symm.symm ⁻¹' (e.target ∩ e.symm⁻¹' (π Z ⁻¹' s))),
+      e.symm.symm ⁻¹' (e.target ∩ e.symm⁻¹' (π F Z ⁻¹' s))),
     { apply h.unique_mdiff_on_preimage,
       exact (mdifferentiable_of_mem_atlas _ (chart_mem_atlas _ _)).symm,
       apply_instance },
-    have : p ∈ e.symm.target ∩ e.symm.symm ⁻¹' (e.target ∩ e.symm⁻¹' (π Z ⁻¹' s)),
+    have : p ∈ e.symm.target ∩ e.symm.symm ⁻¹' (e.target ∩ e.symm⁻¹' (π F Z ⁻¹' s)),
     { simp only [e, hp] with mfld_simps },
     apply (A _ this).mono,
     assume q hq,
@@ -2047,7 +2040,7 @@ begin
   assume q hq,
   simp only [unique_mdiff_within_at, model_with_corners.prod, -preimage_inter] with mfld_simps,
   have : 𝓝[(I.symm ⁻¹' (e₀.target ∩ e₀.symm⁻¹' s) ∩ range I) ×ˢ univ] (I q.1, q.2) ≤
-    𝓝[(λ (p : E × F), (I.symm p.1, p.snd)) ⁻¹' (e.target ∩ e.symm ⁻¹' (π Z ⁻¹' s)) ∩
+    𝓝[(λ (p : E × F), (I.symm p.1, p.snd)) ⁻¹' (e.target ∩ e.symm ⁻¹' (π F Z ⁻¹' s)) ∩
       (range I ×ˢ univ)] (I q.1, q.2),
   { rw [nhds_within_le_iff, mem_nhds_within],
     refine ⟨(λ (p : E × F), (I.symm p.1, p.snd)) ⁻¹' e.target, _, _, _⟩,
@@ -2076,7 +2069,7 @@ begin
 end
 
 lemma unique_mdiff_on.tangent_bundle_proj_preimage (hs : unique_mdiff_on I s):
-  unique_mdiff_on I.tangent (π (tangent_space I) ⁻¹' s) :=
+  unique_mdiff_on I.tangent (π E (tangent_space I) ⁻¹' s) :=
 hs.smooth_bundle_preimage _
 
 end unique_mdiff

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(first ported)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -154,7 +154,7 @@ theorem differentiable_within_at_localInvariantProp :
       intro s x f e he hx h
       rw [DifferentiableWithinAtProp] at h ⊢
       have : I x = (I ∘ e.symm ∘ I.symm) (I (e x)) := by simp only [hx, mfld_simps]
-      rw [this] at h 
+      rw [this] at h
       have : I (e x) ∈ I.symm ⁻¹' e.target ∩ Set.range I := by simp only [hx, mfld_simps]
       have := (mem_groupoid_of_pregroupoid.2 he).2.ContDiffWithinAt this
       convert (h.comp' _ (this.differentiable_within_at le_top)).mono_of_mem _ using 1
@@ -168,7 +168,7 @@ theorem differentiable_within_at_localInvariantProp :
       intro s x f g h hx hf
       apply hf.congr
       · intro y hy
-        simp only [mfld_simps] at hy 
+        simp only [mfld_simps] at hy
         simp only [h, hy, mfld_simps]
       · simp only [hx, mfld_simps]
     left_invariance' := by
@@ -179,7 +179,7 @@ theorem differentiable_within_at_localInvariantProp :
       have := (mem_groupoid_of_pregroupoid.2 he').1.ContDiffWithinAt A
       convert (this.differentiable_within_at le_top).comp _ h _
       · ext y; simp only [mfld_simps]
-      · intro y hy; simp only [mfld_simps] at hy ; simpa only [hy, mfld_simps] using hs hy.1 }
+      · intro y hy; simp only [mfld_simps] at hy; simpa only [hy, mfld_simps] using hs hy.1 }
 #align differentiable_within_at_local_invariant_prop differentiable_within_at_localInvariantProp
 -/
 
@@ -417,7 +417,7 @@ theorem UniqueMDiffWithinAt.inter (hs : UniqueMDiffWithinAt I s x) (ht : t ∈ 
 theorem IsOpen.uniqueMDiffWithinAt (xs : x ∈ s) (hs : IsOpen s) : UniqueMDiffWithinAt I s x :=
   by
   have := UniqueMDiffWithinAt.inter (uniqueMDiffWithinAt_univ I) (IsOpen.mem_nhds hs xs)
-  rwa [univ_inter] at this 
+  rwa [univ_inter] at this
 #align is_open.unique_mdiff_within_at IsOpen.uniqueMDiffWithinAt
 -/
 
@@ -549,7 +549,7 @@ theorem hasMFDerivWithinAt_univ : HasMFDerivWithinAt I I' f univ x f' ↔ HasMFD
 #print hasMFDerivAt_unique /-
 theorem hasMFDerivAt_unique (h₀ : HasMFDerivAt I I' f x f₀') (h₁ : HasMFDerivAt I I' f x f₁') :
     f₀' = f₁' := by
-  rw [← hasMFDerivWithinAt_univ] at h₀ h₁ 
+  rw [← hasMFDerivWithinAt_univ] at h₀ h₁
   exact (uniqueMDiffWithinAt_univ I).Eq h₀ h₁
 #align has_mfderiv_at_unique hasMFDerivAt_unique
 -/
@@ -595,7 +595,7 @@ theorem HasMFDerivWithinAt.mono_of_mem (h : HasMFDerivWithinAt I I' f s x f') (h
 #print HasMFDerivWithinAt.hasMFDerivAt /-
 theorem HasMFDerivWithinAt.hasMFDerivAt (h : HasMFDerivWithinAt I I' f s x f') (hs : s ∈ 𝓝 x) :
     HasMFDerivAt I I' f x f' := by
-  rwa [← univ_inter s, hasMFDerivWithinAt_inter hs, hasMFDerivWithinAt_univ] at h 
+  rwa [← univ_inter s, hasMFDerivWithinAt_inter hs, hasMFDerivWithinAt_univ] at h
 #align has_mfderiv_within_at.has_mfderiv_at HasMFDerivWithinAt.hasMFDerivAt
 -/
 
@@ -713,7 +713,7 @@ theorem MDifferentiableWithinAt.mdifferentiableAt (h : MDifferentiableWithinAt I
     (hs : s ∈ 𝓝 x) : MDifferentiableAt I I' f x :=
   by
   have : s = univ ∩ s := by rw [univ_inter]
-  rwa [this, mdifferentiableWithinAt_inter hs, mdifferentiableWithinAt_univ] at h 
+  rwa [this, mdifferentiableWithinAt_inter hs, mdifferentiableWithinAt_univ] at h
 #align mdifferentiable_within_at.mdifferentiable_at MDifferentiableWithinAt.mdifferentiableAt
 -/
 
@@ -838,7 +838,7 @@ theorem tangentMapWithin_univ : tangentMapWithin I I' f univ = tangentMap I I' f
 theorem tangentMapWithin_eq_tangentMap {p : TangentBundle I M} (hs : UniqueMDiffWithinAt I s p.1)
     (h : MDifferentiableAt I I' f p.1) : tangentMapWithin I I' f s p = tangentMap I I' f p :=
   by
-  rw [← mdifferentiableWithinAt_univ] at h 
+  rw [← mdifferentiableWithinAt_univ] at h
   rw [← tangentMapWithin_univ]
   exact tangentMapWithin_subset (subset_univ _) hs h
 #align tangent_map_within_eq_tangent_map tangentMapWithin_eq_tangentMap
@@ -1057,7 +1057,7 @@ theorem Filter.EventuallyEq.mfderiv_eq (hL : f₁ =ᶠ[𝓝 x] f) :
   by
   have A : f₁ x = f x := (mem_of_mem_nhds hL : _)
   rw [← mfderivWithin_univ, ← mfderivWithin_univ]
-  rw [← nhdsWithin_univ] at hL 
+  rw [← nhdsWithin_univ] at hL
   exact hL.mfderiv_within_eq (uniqueMDiffWithinAt_univ I) A
 #align filter.eventually_eq.mfderiv_eq Filter.EventuallyEq.mfderiv_eq
 -/
@@ -1118,10 +1118,10 @@ theorem HasMFDerivWithinAt.comp (hg : HasMFDerivWithinAt I' I'' g u (f x) g')
     rw [← hasFDerivWithinAt_inter' this, ← extChartAt_preimage_inter_eq] at hf ⊢
     have : writtenInExtChartAt I I' x f ((extChartAt I x) x) = (extChartAt I' (f x)) (f x) := by
       simp only [mfld_simps]
-    rw [← this] at hg 
+    rw [← this] at hg
     apply HasFDerivWithinAt.comp ((extChartAt I x) x) hg.2 hf.2 _
     intro y hy
-    simp only [mfld_simps] at hy 
+    simp only [mfld_simps] at hy
     have : f (((chart_at H x).symm : H → M) (I.symm y)) ∈ u := hst hy.1.1
     simp only [hy, this, mfld_simps]
   apply A.congr_of_eventually_eq (writtenInExtChartAt_comp hf.1)
@@ -1378,7 +1378,7 @@ theorem mfderivWithin_eq_fderivWithin :
   by_cases h : MDifferentiableWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') f s x
   · simp only [mfderivWithin, h, if_pos, mfld_simps]
   · simp only [mfderivWithin, h, if_neg, not_false_iff]
-    rw [mdifferentiableWithinAt_iff_differentiableWithinAt] at h 
+    rw [mdifferentiableWithinAt_iff_differentiableWithinAt] at h
     exact (fderivWithin_zero_of_not_differentiableWithinAt h).symm
 #align mfderiv_within_eq_fderiv_within mfderivWithin_eq_fderivWithin
 -/
@@ -1895,7 +1895,7 @@ theorem mfderiv_prod_eq_add {f : M × M' → M''} {p : M × M'}
           mfderiv (I.Prod I') I'' (fun z : M × M' => f (p.1, z.2)) p :=
   by
   dsimp only
-  rw [← @Prod.mk.eta _ _ p] at hf 
+  rw [← @Prod.mk.eta _ _ p] at hf
   rw [mfderiv_comp_of_eq hf ((mdifferentiableAt_fst I I').prod_mk (mdifferentiableAt_const _ _))
       rfl,
     mfderiv_comp_of_eq hf ((mdifferentiableAt_const _ _).prod_mk (mdifferentiableAt_snd I I')) rfl,
@@ -2026,7 +2026,7 @@ theorem mfderiv_neg (f : M → E') (x : M) :
   simp_rw [mfderiv]
   by_cases hf : MDifferentiableAt I 𝓘(𝕜, E') f x
   · exact hf.has_mfderiv_at.neg.mfderiv
-  · rw [if_neg hf]; rw [← mdifferentiableAt_neg] at hf ; rw [if_neg hf, neg_zero]
+  · rw [if_neg hf]; rw [← mdifferentiableAt_neg] at hf; rw [if_neg hf, neg_zero]
 #align mfderiv_neg mfderiv_neg
 -/
 
@@ -2215,8 +2215,8 @@ theorem mdifferentiableAt_atlas (h : e ∈ atlas H M) {x : M} (hx : x ∈ e.sour
       (I.symm ⁻¹' ((chart_at H x).symm.trans e).source ∩ range I) :=
     this.1
   have B := A.differentiable_on le_top (I ((chart_at H x : M → H) x)) mem
-  simp only [mfld_simps] at B 
-  rw [inter_comm, differentiableWithinAt_inter] at B 
+  simp only [mfld_simps] at B
+  rw [inter_comm, differentiableWithinAt_inter] at B
   · simpa only [mfld_simps]
   · apply IsOpen.mem_nhds ((PartialHomeomorph.open_source _).Preimage I.continuous_symm) mem.1
 #align mdifferentiable_at_atlas mdifferentiableAt_atlas
@@ -2242,8 +2242,8 @@ theorem mdifferentiableAt_atlas_symm (h : e ∈ atlas H M) {x : H} (hx : x ∈ e
       (I.symm ⁻¹' (e.symm.trans (chart_at H (e.symm x))).source ∩ range I) :=
     this.1
   have B := A.differentiable_on le_top (I x) mem
-  simp only [mfld_simps] at B 
-  rw [inter_comm, differentiableWithinAt_inter] at B 
+  simp only [mfld_simps] at B
+  rw [inter_comm, differentiableWithinAt_inter] at B
   · simpa only [mfld_simps]
   · apply IsOpen.mem_nhds ((PartialHomeomorph.open_source _).Preimage I.continuous_symm) mem.1
 #align mdifferentiable_at_atlas_symm mdifferentiableAt_atlas_symm
@@ -2430,11 +2430,11 @@ theorem trans (he' : e'.MDifferentiable I' I'') : (e.trans e').MDifferentiable I
   by
   constructor
   · intro x hx
-    simp only [mfld_simps] at hx 
+    simp only [mfld_simps] at hx
     exact
       ((he'.mdifferentiable_at hx.2).comp _ (he.mdifferentiable_at hx.1)).MDifferentiableWithinAt
   · intro x hx
-    simp only [mfld_simps] at hx 
+    simp only [mfld_simps] at hx
     exact
       ((he.symm.mdifferentiable_at hx.2).comp _
           (he'.symm.mdifferentiable_at hx.1)).MDifferentiableWithinAt
@@ -2526,7 +2526,7 @@ theorem UniqueMDiffOn.uniqueMDiffOn_preimage [SmoothManifoldWithCorners I' M']
       apply e.continuous_on.preimage_open_of_open e.open_source (isOpen_extChartAt_source I' x)
       simp only [z_source, zx, mfld_simps]
     have := this.inter S
-    rw [uniqueMDiffWithinAt_iff] at this 
+    rw [uniqueMDiffWithinAt_iff] at this
     exact this
   -- denote by `G` the change of coordinate, i.e., the composition of the two extended charts and
   -- of `e`
@@ -2564,7 +2564,7 @@ theorem UniqueMDiffOn.uniqueMDiffOn_preimage [SmoothManifoldWithCorners I' M']
       (G '' (F.symm ⁻¹' (s ∩ (e.source ∩ e ⁻¹' (extChartAt I' x).source)) ∩ F.target)) (G (F z)) :=
     D₂.unique_diff_within_at B C
   have : G (F z) = (extChartAt I' x) x := by dsimp [G, F]; simp only [hx.1, mfld_simps]
-  rw [this] at key 
+  rw [this] at key
   apply key.mono
   show
     G '' (F.symm ⁻¹' (s ∩ (e.source ∩ e ⁻¹' (extChartAt I' x).source)) ∩ F.target) ⊆
@@ -2583,7 +2583,7 @@ theorem UniqueMDiffOn.uniqueDiffOn_target_inter (hs : UniqueMDiffOn I s) (x : M)
   -- this is just a reformulation of `unique_mdiff_on.unique_mdiff_on_preimage`, using as `e`
   -- the local chart at `x`.
   intro z hz
-  simp only [mfld_simps] at hz 
+  simp only [mfld_simps] at hz
   have : (chart_at H x).MDifferentiable I I := mdifferentiable_chart _ _
   have T := (hs.unique_mdiff_on_preimage this) (I.symm z)
   simp only [hz.left.left, hz.left.right, hz.right, UniqueMDiffWithinAt, mfld_simps] at T ⊢
@@ -2658,7 +2658,7 @@ theorem UniqueMDiffOn.smooth_bundle_preimage (hs : UniqueMDiffOn I s) :
       simp only [e, hp, mfld_simps]
     apply (A _ this).mono
     intro q hq
-    simp only [e, PartialHomeomorph.left_inv _ hq.1, mfld_simps] at hq 
+    simp only [e, PartialHomeomorph.left_inv _ hq.1, mfld_simps] at hq
     simp only [hq, mfld_simps]
   intro q hq
   simp only [UniqueMDiffWithinAt, ModelWithCorners.prod, -preimage_inter, mfld_simps]
@@ -2671,15 +2671,15 @@ theorem UniqueMDiffOn.smooth_bundle_preimage (hs : UniqueMDiffOn I s) :
     rw [nhdsWithin_le_iff, mem_nhdsWithin]
     refine' ⟨(fun p : E × F => (I.symm p.1, p.snd)) ⁻¹' e.target, _, _, _⟩
     · exact e.open_target.preimage (I.continuous_symm.prod_map continuous_id)
-    · simp only [Prod.mk.eta, mfld_simps] at hq 
+    · simp only [Prod.mk.eta, mfld_simps] at hq
       simp only [Prod.mk.eta, hq, mfld_simps]
     rintro x hx
-    simp only [mfld_simps] at hx 
+    simp only [mfld_simps] at hx
     have h2x := hx
-    simp only [e, FiberBundle.chartedSpace_chartAt, Trivialization.mem_target, mfld_simps] at h2x 
+    simp only [e, FiberBundle.chartedSpace_chartAt, Trivialization.mem_target, mfld_simps] at h2x
     simp only [h2s, hx, h2x, -preimage_inter, mfld_simps]
   refine' UniqueDiffWithinAt.mono_nhds _ this
-  rw [h2s] at hq 
+  rw [h2s] at hq
   -- apply unique differentiability of products to conclude
   apply UniqueDiffOn.prod _ uniqueDiffOn_univ
   · simp only [hq, mfld_simps]
@@ -2689,9 +2689,9 @@ theorem UniqueMDiffOn.smooth_bundle_preimage (hs : UniqueMDiffOn I s) :
       apply hs.unique_mdiff_on_preimage
       exact mdifferentiable_of_mem_atlas _ (chart_mem_atlas _ _)
       infer_instance
-    simp only [UniqueMDiffOn, UniqueMDiffWithinAt, preimage_inter, mfld_simps] at A 
+    simp only [UniqueMDiffOn, UniqueMDiffWithinAt, preimage_inter, mfld_simps] at A
     have B := A (I.symm x) hx.1.1 hx.1.2
-    rwa [← preimage_inter, ModelWithCorners.right_inv _ hx.2] at B 
+    rwa [← preimage_inter, ModelWithCorners.right_inv _ hx.2] at B
 #align unique_mdiff_on.smooth_bundle_preimage UniqueMDiffOn.smooth_bundle_preimage
 -/
 
Diff
@@ -1854,7 +1854,10 @@ variable {I I' I''}
 theorem MDifferentiableAt.mfderiv_prod {f : M → M'} {g : M → M''} {x : M}
     (hf : MDifferentiableAt I I' f x) (hg : MDifferentiableAt I I'' g x) :
     mfderiv I (I'.Prod I'') (fun x => (f x, g x)) x = (mfderiv I I' f x).Prod (mfderiv I I'' g x) :=
-  by classical
+  by
+  classical
+  simp_rw [mfderiv, if_pos (hf.prod_mk hg), if_pos hf, if_pos hg]
+  exact hf.2.fderivWithin_prod hg.2 (I.unique_diff _ (mem_range_self _))
 #align mdifferentiable_at.mfderiv_prod MDifferentiableAt.mfderiv_prod
 -/
 
Diff
@@ -1854,10 +1854,7 @@ variable {I I' I''}
 theorem MDifferentiableAt.mfderiv_prod {f : M → M'} {g : M → M''} {x : M}
     (hf : MDifferentiableAt I I' f x) (hg : MDifferentiableAt I I'' g x) :
     mfderiv I (I'.Prod I'') (fun x => (f x, g x)) x = (mfderiv I I' f x).Prod (mfderiv I I'' g x) :=
-  by
-  classical
-  simp_rw [mfderiv, if_pos (hf.prod_mk hg), if_pos hf, if_pos hg]
-  exact hf.2.fderivWithin_prod hg.2 (I.unique_diff _ (mem_range_self _))
+  by classical
 #align mdifferentiable_at.mfderiv_prod MDifferentiableAt.mfderiv_prod
 -/
 
Diff
@@ -266,11 +266,11 @@ def MDifferentiable (f : M → M') :=
 #align mdifferentiable MDifferentiable
 -/
 
-#print LocalHomeomorph.MDifferentiable /-
+#print PartialHomeomorph.MDifferentiable /-
 /-- Prop registering if a local homeomorphism is a local diffeomorphism on its source -/
-def LocalHomeomorph.MDifferentiable (f : LocalHomeomorph M M') :=
+def PartialHomeomorph.MDifferentiable (f : PartialHomeomorph M M') :=
   MDifferentiableOn I I' f f.source ∧ MDifferentiableOn I' I f.symm f.target
-#align local_homeomorph.mdifferentiable LocalHomeomorph.MDifferentiable
+#align local_homeomorph.mdifferentiable PartialHomeomorph.MDifferentiable
 -/
 
 variable [SmoothManifoldWithCorners I M] [SmoothManifoldWithCorners I' M']
@@ -2198,7 +2198,7 @@ end ModelWithCorners
 
 section Charts
 
-variable {e : LocalHomeomorph M H}
+variable {e : PartialHomeomorph M H}
 
 #print mdifferentiableAt_atlas /-
 theorem mdifferentiableAt_atlas (h : e ∈ atlas H M) {x : M} (hx : x ∈ e.source) :
@@ -2218,7 +2218,7 @@ theorem mdifferentiableAt_atlas (h : e ∈ atlas H M) {x : M} (hx : x ∈ e.sour
   simp only [mfld_simps] at B 
   rw [inter_comm, differentiableWithinAt_inter] at B 
   · simpa only [mfld_simps]
-  · apply IsOpen.mem_nhds ((LocalHomeomorph.open_source _).Preimage I.continuous_symm) mem.1
+  · apply IsOpen.mem_nhds ((PartialHomeomorph.open_source _).Preimage I.continuous_symm) mem.1
 #align mdifferentiable_at_atlas mdifferentiableAt_atlas
 -/
 
@@ -2245,7 +2245,7 @@ theorem mdifferentiableAt_atlas_symm (h : e ∈ atlas H M) {x : H} (hx : x ∈ e
   simp only [mfld_simps] at B 
   rw [inter_comm, differentiableWithinAt_inter] at B 
   · simpa only [mfld_simps]
-  · apply IsOpen.mem_nhds ((LocalHomeomorph.open_source _).Preimage I.continuous_symm) mem.1
+  · apply IsOpen.mem_nhds ((PartialHomeomorph.open_source _).Preimage I.continuous_symm) mem.1
 #align mdifferentiable_at_atlas_symm mdifferentiableAt_atlas_symm
 -/
 
@@ -2309,7 +2309,7 @@ end SpecificFunctions
 /-! ### Differentiable local homeomorphisms -/
 
 
-namespace LocalHomeomorph.MDifferentiable
+namespace PartialHomeomorph.MDifferentiable
 
 variable {𝕜 : Type _} [NontriviallyNormedField 𝕜] {E : Type _} [NormedAddCommGroup E]
   [NormedSpace 𝕜 E] {H : Type _} [TopologicalSpace H] {I : ModelWithCorners 𝕜 E H} {M : Type _}
@@ -2317,31 +2317,31 @@ variable {𝕜 : Type _} [NontriviallyNormedField 𝕜] {E : Type _} [NormedAddC
   {H' : Type _} [TopologicalSpace H'] {I' : ModelWithCorners 𝕜 E' H'} {M' : Type _}
   [TopologicalSpace M'] [ChartedSpace H' M'] {E'' : Type _} [NormedAddCommGroup E'']
   [NormedSpace 𝕜 E''] {H'' : Type _} [TopologicalSpace H''] {I'' : ModelWithCorners 𝕜 E'' H''}
-  {M'' : Type _} [TopologicalSpace M''] [ChartedSpace H'' M''] {e : LocalHomeomorph M M'}
-  (he : e.MDifferentiable I I') {e' : LocalHomeomorph M' M''}
+  {M'' : Type _} [TopologicalSpace M''] [ChartedSpace H'' M''] {e : PartialHomeomorph M M'}
+  (he : e.MDifferentiable I I') {e' : PartialHomeomorph M' M''}
 
-#print LocalHomeomorph.MDifferentiable.symm /-
+#print PartialHomeomorph.MDifferentiable.symm /-
 theorem symm : e.symm.MDifferentiable I' I :=
   ⟨he.2, he.1⟩
-#align local_homeomorph.mdifferentiable.symm LocalHomeomorph.MDifferentiable.symm
+#align local_homeomorph.mdifferentiable.symm PartialHomeomorph.MDifferentiable.symm
 -/
 
-#print LocalHomeomorph.MDifferentiable.mdifferentiableAt /-
+#print PartialHomeomorph.MDifferentiable.mdifferentiableAt /-
 protected theorem mdifferentiableAt {x : M} (hx : x ∈ e.source) : MDifferentiableAt I I' e x :=
   (he.1 x hx).MDifferentiableAt (IsOpen.mem_nhds e.open_source hx)
-#align local_homeomorph.mdifferentiable.mdifferentiable_at LocalHomeomorph.MDifferentiable.mdifferentiableAt
+#align local_homeomorph.mdifferentiable.mdifferentiable_at PartialHomeomorph.MDifferentiable.mdifferentiableAt
 -/
 
-#print LocalHomeomorph.MDifferentiable.mdifferentiableAt_symm /-
+#print PartialHomeomorph.MDifferentiable.mdifferentiableAt_symm /-
 theorem mdifferentiableAt_symm {x : M'} (hx : x ∈ e.target) : MDifferentiableAt I' I e.symm x :=
   (he.2 x hx).MDifferentiableAt (IsOpen.mem_nhds e.open_target hx)
-#align local_homeomorph.mdifferentiable.mdifferentiable_at_symm LocalHomeomorph.MDifferentiable.mdifferentiableAt_symm
+#align local_homeomorph.mdifferentiable.mdifferentiable_at_symm PartialHomeomorph.MDifferentiable.mdifferentiableAt_symm
 -/
 
 variable [SmoothManifoldWithCorners I M] [SmoothManifoldWithCorners I' M']
   [SmoothManifoldWithCorners I'' M'']
 
-#print LocalHomeomorph.MDifferentiable.symm_comp_deriv /-
+#print PartialHomeomorph.MDifferentiable.symm_comp_deriv /-
 theorem symm_comp_deriv {x : M} (hx : x ∈ e.source) :
     (mfderiv I' I e.symm (e x)).comp (mfderiv I I' e x) =
       ContinuousLinearMap.id 𝕜 (TangentSpace I x) :=
@@ -2354,18 +2354,18 @@ theorem symm_comp_deriv {x : M} (hx : x ∈ e.source) :
   apply Filter.EventuallyEq.mfderiv_eq
   have : e.source ∈ 𝓝 x := IsOpen.mem_nhds e.open_source hx
   exact Filter.mem_of_superset this (by mfld_set_tac)
-#align local_homeomorph.mdifferentiable.symm_comp_deriv LocalHomeomorph.MDifferentiable.symm_comp_deriv
+#align local_homeomorph.mdifferentiable.symm_comp_deriv PartialHomeomorph.MDifferentiable.symm_comp_deriv
 -/
 
-#print LocalHomeomorph.MDifferentiable.comp_symm_deriv /-
+#print PartialHomeomorph.MDifferentiable.comp_symm_deriv /-
 theorem comp_symm_deriv {x : M'} (hx : x ∈ e.target) :
     (mfderiv I I' e (e.symm x)).comp (mfderiv I' I e.symm x) =
       ContinuousLinearMap.id 𝕜 (TangentSpace I' x) :=
   he.symm.symm_comp_deriv hx
-#align local_homeomorph.mdifferentiable.comp_symm_deriv LocalHomeomorph.MDifferentiable.comp_symm_deriv
+#align local_homeomorph.mdifferentiable.comp_symm_deriv PartialHomeomorph.MDifferentiable.comp_symm_deriv
 -/
 
-#print LocalHomeomorph.MDifferentiable.mfderiv /-
+#print PartialHomeomorph.MDifferentiable.mfderiv /-
 /-- The derivative of a differentiable local homeomorphism, as a continuous linear equivalence
 between the tangent spaces at `x` and `e x`. -/
 protected def mfderiv {x : M} (hx : x ∈ e.source) : TangentSpace I x ≃L[𝕜] TangentSpace I' (e x) :=
@@ -2386,46 +2386,46 @@ protected def mfderiv {x : M} (hx : x ∈ e.source) : TangentSpace I x ≃L[𝕜
       conv_rhs => rw [← this, ← he.comp_symm_deriv (e.map_source hx)]
       rw [e.left_inv hx]
       rfl }
-#align local_homeomorph.mdifferentiable.mfderiv LocalHomeomorph.MDifferentiable.mfderiv
+#align local_homeomorph.mdifferentiable.mfderiv PartialHomeomorph.MDifferentiable.mfderiv
 -/
 
-#print LocalHomeomorph.MDifferentiable.mfderiv_bijective /-
+#print PartialHomeomorph.MDifferentiable.mfderiv_bijective /-
 theorem mfderiv_bijective {x : M} (hx : x ∈ e.source) : Function.Bijective (mfderiv I I' e x) :=
   (he.mfderiv hx).Bijective
-#align local_homeomorph.mdifferentiable.mfderiv_bijective LocalHomeomorph.MDifferentiable.mfderiv_bijective
+#align local_homeomorph.mdifferentiable.mfderiv_bijective PartialHomeomorph.MDifferentiable.mfderiv_bijective
 -/
 
-#print LocalHomeomorph.MDifferentiable.mfderiv_injective /-
+#print PartialHomeomorph.MDifferentiable.mfderiv_injective /-
 theorem mfderiv_injective {x : M} (hx : x ∈ e.source) : Function.Injective (mfderiv I I' e x) :=
   (he.mfderiv hx).Injective
-#align local_homeomorph.mdifferentiable.mfderiv_injective LocalHomeomorph.MDifferentiable.mfderiv_injective
+#align local_homeomorph.mdifferentiable.mfderiv_injective PartialHomeomorph.MDifferentiable.mfderiv_injective
 -/
 
-#print LocalHomeomorph.MDifferentiable.mfderiv_surjective /-
+#print PartialHomeomorph.MDifferentiable.mfderiv_surjective /-
 theorem mfderiv_surjective {x : M} (hx : x ∈ e.source) : Function.Surjective (mfderiv I I' e x) :=
   (he.mfderiv hx).Surjective
-#align local_homeomorph.mdifferentiable.mfderiv_surjective LocalHomeomorph.MDifferentiable.mfderiv_surjective
+#align local_homeomorph.mdifferentiable.mfderiv_surjective PartialHomeomorph.MDifferentiable.mfderiv_surjective
 -/
 
-#print LocalHomeomorph.MDifferentiable.ker_mfderiv_eq_bot /-
+#print PartialHomeomorph.MDifferentiable.ker_mfderiv_eq_bot /-
 theorem ker_mfderiv_eq_bot {x : M} (hx : x ∈ e.source) : LinearMap.ker (mfderiv I I' e x) = ⊥ :=
   (he.mfderiv hx).toLinearEquiv.ker
-#align local_homeomorph.mdifferentiable.ker_mfderiv_eq_bot LocalHomeomorph.MDifferentiable.ker_mfderiv_eq_bot
+#align local_homeomorph.mdifferentiable.ker_mfderiv_eq_bot PartialHomeomorph.MDifferentiable.ker_mfderiv_eq_bot
 -/
 
-#print LocalHomeomorph.MDifferentiable.range_mfderiv_eq_top /-
+#print PartialHomeomorph.MDifferentiable.range_mfderiv_eq_top /-
 theorem range_mfderiv_eq_top {x : M} (hx : x ∈ e.source) : LinearMap.range (mfderiv I I' e x) = ⊤ :=
   (he.mfderiv hx).toLinearEquiv.range
-#align local_homeomorph.mdifferentiable.range_mfderiv_eq_top LocalHomeomorph.MDifferentiable.range_mfderiv_eq_top
+#align local_homeomorph.mdifferentiable.range_mfderiv_eq_top PartialHomeomorph.MDifferentiable.range_mfderiv_eq_top
 -/
 
-#print LocalHomeomorph.MDifferentiable.range_mfderiv_eq_univ /-
+#print PartialHomeomorph.MDifferentiable.range_mfderiv_eq_univ /-
 theorem range_mfderiv_eq_univ {x : M} (hx : x ∈ e.source) : range (mfderiv I I' e x) = univ :=
   (he.mfderiv_surjective hx).range_eq
-#align local_homeomorph.mdifferentiable.range_mfderiv_eq_univ LocalHomeomorph.MDifferentiable.range_mfderiv_eq_univ
+#align local_homeomorph.mdifferentiable.range_mfderiv_eq_univ PartialHomeomorph.MDifferentiable.range_mfderiv_eq_univ
 -/
 
-#print LocalHomeomorph.MDifferentiable.trans /-
+#print PartialHomeomorph.MDifferentiable.trans /-
 theorem trans (he' : e'.MDifferentiable I' I'') : (e.trans e').MDifferentiable I I'' :=
   by
   constructor
@@ -2438,10 +2438,10 @@ theorem trans (he' : e'.MDifferentiable I' I'') : (e.trans e').MDifferentiable I
     exact
       ((he.symm.mdifferentiable_at hx.2).comp _
           (he'.symm.mdifferentiable_at hx.1)).MDifferentiableWithinAt
-#align local_homeomorph.mdifferentiable.trans LocalHomeomorph.MDifferentiable.trans
+#align local_homeomorph.mdifferentiable.trans PartialHomeomorph.MDifferentiable.trans
 -/
 
-end LocalHomeomorph.MDifferentiable
+end PartialHomeomorph.MDifferentiable
 
 /-! ### Differentiability of `ext_chart_at` -/
 
@@ -2498,7 +2498,7 @@ variable {𝕜 : Type _} [NontriviallyNormedField 𝕜] {E : Type _} [NormedAddC
 /-- If a set has the unique differential property, then its image under a local
 diffeomorphism also has the unique differential property. -/
 theorem UniqueMDiffOn.uniqueMDiffOn_preimage [SmoothManifoldWithCorners I' M']
-    (hs : UniqueMDiffOn I s) {e : LocalHomeomorph M M'} (he : e.MDifferentiable I I') :
+    (hs : UniqueMDiffOn I s) {e : PartialHomeomorph M M'} (he : e.MDifferentiable I I') :
     UniqueMDiffOn I' (e.target ∩ e.symm ⁻¹' s) :=
   by
   /- Start from a point `x` in the image, and let `z` be its preimage. Then the unique
@@ -2658,7 +2658,7 @@ theorem UniqueMDiffOn.smooth_bundle_preimage (hs : UniqueMDiffOn I s) :
       simp only [e, hp, mfld_simps]
     apply (A _ this).mono
     intro q hq
-    simp only [e, LocalHomeomorph.left_inv _ hq.1, mfld_simps] at hq 
+    simp only [e, PartialHomeomorph.left_inv _ hq.1, mfld_simps] at hq 
     simp only [hq, mfld_simps]
   intro q hq
   simp only [UniqueMDiffWithinAt, ModelWithCorners.prod, -preimage_inter, mfld_simps]
Diff
@@ -3,7 +3,7 @@ Copyright (c) 2020 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.Geometry.Manifold.VectorBundle.Tangent
+import Geometry.Manifold.VectorBundle.Tangent
 
 #align_import geometry.manifold.mfderiv from "leanprover-community/mathlib"@"e473c3198bb41f68560cab68a0529c854b618833"
 
Diff
@@ -585,11 +585,11 @@ theorem HasMFDerivWithinAt.union (hs : HasMFDerivWithinAt I I' f s x f')
 #align has_mfderiv_within_at.union HasMFDerivWithinAt.union
 -/
 
-#print HasMFDerivWithinAt.nhdsWithin /-
-theorem HasMFDerivWithinAt.nhdsWithin (h : HasMFDerivWithinAt I I' f s x f') (ht : s ∈ 𝓝[t] x) :
+#print HasMFDerivWithinAt.mono_of_mem /-
+theorem HasMFDerivWithinAt.mono_of_mem (h : HasMFDerivWithinAt I I' f s x f') (ht : s ∈ 𝓝[t] x) :
     HasMFDerivWithinAt I I' f t x f' :=
   (hasMFDerivWithinAt_inter' ht).1 (h.mono (inter_subset_right _ _))
-#align has_mfderiv_within_at.nhds_within HasMFDerivWithinAt.nhdsWithin
+#align has_mfderiv_within_at.nhds_within HasMFDerivWithinAt.mono_of_mem
 -/
 
 #print HasMFDerivWithinAt.hasMFDerivAt /-
Diff
@@ -1264,8 +1264,8 @@ theorem uniqueMDiffWithinAt_iff_uniqueDiffWithinAt :
 #align unique_mdiff_within_at_iff_unique_diff_within_at uniqueMDiffWithinAt_iff_uniqueDiffWithinAt
 -/
 
-alias uniqueMDiffWithinAt_iff_uniqueDiffWithinAt ↔ UniqueMDiffWithinAt.uniqueDiffWithinAt
-  UniqueDiffWithinAt.uniqueMDiffWithinAt
+alias ⟨UniqueMDiffWithinAt.uniqueDiffWithinAt, UniqueDiffWithinAt.uniqueMDiffWithinAt⟩ :=
+  uniqueMDiffWithinAt_iff_uniqueDiffWithinAt
 #align unique_mdiff_within_at.unique_diff_within_at UniqueMDiffWithinAt.uniqueDiffWithinAt
 #align unique_diff_within_at.unique_mdiff_within_at UniqueDiffWithinAt.uniqueMDiffWithinAt
 
@@ -1275,7 +1275,7 @@ theorem uniqueMDiffOn_iff_uniqueDiffOn : UniqueMDiffOn 𝓘(𝕜, E) s ↔ Uniqu
 #align unique_mdiff_on_iff_unique_diff_on uniqueMDiffOn_iff_uniqueDiffOn
 -/
 
-alias uniqueMDiffOn_iff_uniqueDiffOn ↔ UniqueMDiffOn.uniqueDiffOn UniqueDiffOn.uniqueMDiffOn
+alias ⟨UniqueMDiffOn.uniqueDiffOn, UniqueDiffOn.uniqueMDiffOn⟩ := uniqueMDiffOn_iff_uniqueDiffOn
 #align unique_mdiff_on.unique_diff_on UniqueMDiffOn.uniqueDiffOn
 #align unique_diff_on.unique_mdiff_on UniqueDiffOn.uniqueMDiffOn
 
@@ -1294,8 +1294,8 @@ theorem hasMFDerivWithinAt_iff_hasFDerivWithinAt {f'} :
 #align has_mfderiv_within_at_iff_has_fderiv_within_at hasMFDerivWithinAt_iff_hasFDerivWithinAt
 -/
 
-alias hasMFDerivWithinAt_iff_hasFDerivWithinAt ↔ HasMFDerivWithinAt.hasFDerivWithinAt
-  HasFDerivWithinAt.hasMFDerivWithinAt
+alias ⟨HasMFDerivWithinAt.hasFDerivWithinAt, HasFDerivWithinAt.hasMFDerivWithinAt⟩ :=
+  hasMFDerivWithinAt_iff_hasFDerivWithinAt
 #align has_mfderiv_within_at.has_fderiv_within_at HasMFDerivWithinAt.hasFDerivWithinAt
 #align has_fderiv_within_at.has_mfderiv_within_at HasFDerivWithinAt.hasMFDerivWithinAt
 
@@ -1306,7 +1306,7 @@ theorem hasMFDerivAt_iff_hasFDerivAt {f'} :
 #align has_mfderiv_at_iff_has_fderiv_at hasMFDerivAt_iff_hasFDerivAt
 -/
 
-alias hasMFDerivAt_iff_hasFDerivAt ↔ HasMFDerivAt.hasFDerivAt HasFDerivAt.hasMFDerivAt
+alias ⟨HasMFDerivAt.hasFDerivAt, HasFDerivAt.hasMFDerivAt⟩ := hasMFDerivAt_iff_hasFDerivAt
 #align has_mfderiv_at.has_fderiv_at HasMFDerivAt.hasFDerivAt
 #align has_fderiv_at.has_mfderiv_at HasFDerivAt.hasMFDerivAt
 
@@ -1321,8 +1321,9 @@ theorem mdifferentiableWithinAt_iff_differentiableWithinAt :
 #align mdifferentiable_within_at_iff_differentiable_within_at mdifferentiableWithinAt_iff_differentiableWithinAt
 -/
 
-alias mdifferentiableWithinAt_iff_differentiableWithinAt ↔
-  MDifferentiableWithinAt.differentiableWithinAt DifferentiableWithinAt.mdifferentiableWithinAt
+alias ⟨MDifferentiableWithinAt.differentiableWithinAt,
+  DifferentiableWithinAt.mdifferentiableWithinAt⟩ :=
+  mdifferentiableWithinAt_iff_differentiableWithinAt
 #align mdifferentiable_within_at.differentiable_within_at MDifferentiableWithinAt.differentiableWithinAt
 #align differentiable_within_at.mdifferentiable_within_at DifferentiableWithinAt.mdifferentiableWithinAt
 
@@ -1336,8 +1337,8 @@ theorem mdifferentiableAt_iff_differentiableAt :
 #align mdifferentiable_at_iff_differentiable_at mdifferentiableAt_iff_differentiableAt
 -/
 
-alias mdifferentiableAt_iff_differentiableAt ↔ MDifferentiableAt.differentiableAt
-  DifferentiableAt.mdifferentiableAt
+alias ⟨MDifferentiableAt.differentiableAt, DifferentiableAt.mdifferentiableAt⟩ :=
+  mdifferentiableAt_iff_differentiableAt
 #align mdifferentiable_at.differentiable_at MDifferentiableAt.differentiableAt
 #align differentiable_at.mdifferentiable_at DifferentiableAt.mdifferentiableAt
 
@@ -1350,8 +1351,8 @@ theorem mdifferentiableOn_iff_differentiableOn :
 #align mdifferentiable_on_iff_differentiable_on mdifferentiableOn_iff_differentiableOn
 -/
 
-alias mdifferentiableOn_iff_differentiableOn ↔ MDifferentiableOn.differentiableOn
-  DifferentiableOn.mdifferentiableOn
+alias ⟨MDifferentiableOn.differentiableOn, DifferentiableOn.mdifferentiableOn⟩ :=
+  mdifferentiableOn_iff_differentiableOn
 #align mdifferentiable_on.differentiable_on MDifferentiableOn.differentiableOn
 #align differentiable_on.mdifferentiable_on DifferentiableOn.mdifferentiableOn
 
@@ -1363,8 +1364,8 @@ theorem mdifferentiable_iff_differentiable :
 #align mdifferentiable_iff_differentiable mdifferentiable_iff_differentiable
 -/
 
-alias mdifferentiable_iff_differentiable ↔ MDifferentiable.differentiable
-  Differentiable.mdifferentiable
+alias ⟨MDifferentiable.differentiable, Differentiable.mdifferentiable⟩ :=
+  mdifferentiable_iff_differentiable
 #align mdifferentiable.differentiable MDifferentiable.differentiable
 #align differentiable.mdifferentiable Differentiable.mdifferentiable
 
Diff
@@ -2,14 +2,11 @@
 Copyright (c) 2020 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 geometry.manifold.mfderiv
-! leanprover-community/mathlib commit e473c3198bb41f68560cab68a0529c854b618833
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Geometry.Manifold.VectorBundle.Tangent
 
+#align_import geometry.manifold.mfderiv from "leanprover-community/mathlib"@"e473c3198bb41f68560cab68a0529c854b618833"
+
 /-!
 # The derivative of functions between smooth manifolds
 
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 geometry.manifold.mfderiv
-! leanprover-community/mathlib commit 08b63ab58a6ec1157ebeafcbbe6c7a3fb3c9f6d5
+! leanprover-community/mathlib commit e473c3198bb41f68560cab68a0529c854b618833
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -855,13 +855,6 @@ theorem tangentMapWithin_proj {p : TangentBundle I M} :
 #align tangent_map_within_proj tangentMapWithin_proj
 -/
 
-#print tangentMapWithin_fst /-
-@[simp, mfld_simps]
-theorem tangentMapWithin_fst {p : TangentBundle I M} : (tangentMapWithin I I' f s p).1 = f p.1 :=
-  rfl
-#align tangent_map_within_fst tangentMapWithin_fst
--/
-
 #print tangentMap_proj /-
 @[simp, mfld_simps]
 theorem tangentMap_proj {p : TangentBundle I M} : (tangentMap I I' f p).proj = f p.proj :=
@@ -869,13 +862,6 @@ theorem tangentMap_proj {p : TangentBundle I M} : (tangentMap I I' f p).proj = f
 #align tangent_map_proj tangentMap_proj
 -/
 
-#print tangentMap_fst /-
-@[simp, mfld_simps]
-theorem tangentMap_fst {p : TangentBundle I M} : (tangentMap I I' f p).1 = f p.1 :=
-  rfl
-#align tangent_map_fst tangentMap_fst
--/
-
 #print MDifferentiableWithinAt.prod_mk /-
 theorem MDifferentiableWithinAt.prod_mk {f : M → M'} {g : M → M''}
     (hf : MDifferentiableWithinAt I I' f s x) (hg : MDifferentiableWithinAt I I'' g s x) :
@@ -1062,8 +1048,7 @@ theorem tangentMapWithin_congr (h : ∀ x ∈ s, f x = f₁ x) (p : TangentBundl
     (hs : UniqueMDiffWithinAt I s p.1) :
     tangentMapWithin I I' f s p = tangentMapWithin I I' f₁ s p :=
   by
-  simp only [tangentMapWithin, h p.fst hp, true_and_iff, eq_self_iff_true, heq_iff_eq,
-    Sigma.mk.inj_iff]
+  simp only [tangentMapWithin, h p.1 hp, true_and_iff, eq_self_iff_true, heq_iff_eq]
   congr 1
   exact mfderivWithin_congr hs h (h _ hp)
 #align tangent_map_within_congr tangentMapWithin_congr
@@ -1762,19 +1747,19 @@ theorem mfderivWithin_fst {s : Set (M × M')} {x : M × M'}
 #print tangentMap_prod_fst /-
 @[simp, mfld_simps]
 theorem tangentMap_prod_fst {p : TangentBundle (I.Prod I') (M × M')} :
-    tangentMap (I.Prod I') I Prod.fst p = totalSpaceMk p.proj.1 p.2.1 := by simp [tangentMap]
+    tangentMap (I.Prod I') I Prod.fst p = ⟨p.proj.1, p.2.1⟩ := by simp [tangentMap]
 #align tangent_map_prod_fst tangentMap_prod_fst
 -/
 
 #print tangentMapWithin_prod_fst /-
 theorem tangentMapWithin_prod_fst {s : Set (M × M')} {p : TangentBundle (I.Prod I') (M × M')}
     (hs : UniqueMDiffWithinAt (I.Prod I') s p.proj) :
-    tangentMapWithin (I.Prod I') I Prod.fst s p = totalSpaceMk p.proj.1 p.2.1 :=
+    tangentMapWithin (I.Prod I') I Prod.fst s p = ⟨p.proj.1, p.2.1⟩ :=
   by
   simp only [tangentMapWithin]
-  rw [mfderivWithin_fst]
-  · rcases p with ⟨⟩; rfl
-  · exact hs
+  rw [mfderivWithin_fst _ _ hs]
+  rcases p with ⟨⟩
+  exact ⟨rfl, HEq.rfl⟩
 #align tangent_map_within_prod_fst tangentMapWithin_prod_fst
 -/
 
@@ -1849,18 +1834,18 @@ theorem mfderivWithin_snd {s : Set (M × M')} {x : M × M'}
 #print tangentMap_prod_snd /-
 @[simp, mfld_simps]
 theorem tangentMap_prod_snd {p : TangentBundle (I.Prod I') (M × M')} :
-    tangentMap (I.Prod I') I' Prod.snd p = totalSpaceMk p.proj.2 p.2.2 := by simp [tangentMap]
+    tangentMap (I.Prod I') I' Prod.snd p = ⟨p.proj.2, p.2.2⟩ := by simp [tangentMap]
 #align tangent_map_prod_snd tangentMap_prod_snd
 -/
 
 #print tangentMapWithin_prod_snd /-
 theorem tangentMapWithin_prod_snd {s : Set (M × M')} {p : TangentBundle (I.Prod I') (M × M')}
     (hs : UniqueMDiffWithinAt (I.Prod I') s p.proj) :
-    tangentMapWithin (I.Prod I') I' Prod.snd s p = totalSpaceMk p.proj.2 p.2.2 :=
+    tangentMapWithin (I.Prod I') I' Prod.snd s p = ⟨p.proj.2, p.2.2⟩ :=
   by
   simp only [tangentMapWithin]
   rw [mfderivWithin_snd]
-  · rcases p with ⟨⟩; rfl
+  · rcases p with ⟨⟩; constructor <;> rfl
   · exact hs
 #align tangent_map_within_prod_snd tangentMapWithin_prod_snd
 -/
@@ -2289,7 +2274,7 @@ theorem mdifferentiable_chart (x : M) : (chartAt H x).MDifferentiable I I :=
 the identification between the tangent bundle of the model space and the product space. -/
 theorem tangentMap_chart {p q : TangentBundle I M} (h : q.1 ∈ (chartAt H p.1).source) :
     tangentMap I I (chartAt H p.1) q =
-      (Equiv.sigmaEquivProd _ _).symm
+      (TotalSpace.toProd _ _).symm
         ((chartAt (ModelProd H E) p : TangentBundle I M → ModelProd H E) q) :=
   by
   dsimp [tangentMap]
@@ -2307,7 +2292,7 @@ theorem tangentMap_chart_symm {p : TangentBundle I M} {q : TangentBundle I H}
     (h : q.1 ∈ (chartAt H p.1).target) :
     tangentMap I I (chartAt H p.1).symm q =
       ((chartAt (ModelProd H E) p).symm : ModelProd H E → TangentBundle I M)
-        ((Equiv.sigmaEquivProd H E) q) :=
+        ((TotalSpace.toProd H E) q) :=
   by
   dsimp only [tangentMap]
   rw [MDifferentiableAt.mfderiv (mdifferentiableAt_atlas_symm _ (chart_mem_atlas _ _) h)]
@@ -2315,7 +2300,7 @@ theorem tangentMap_chart_symm {p : TangentBundle I M} {q : TangentBundle I H}
   rotate_left;
   · infer_instance
   simp only [ContinuousLinearMap.coe_coe, TangentBundle.chartAt, h, tangentBundleCore, chart_at,
-    Sigma.mk.inj_iff, mfld_simps]
+    total_space.to_prod_apply, mfld_simps]
 #align tangent_map_chart_symm tangentMap_chart_symm
 -/
 
@@ -2631,7 +2616,7 @@ theorem UniqueMDiffOn.uniqueDiffOn_inter_preimage (hs : UniqueMDiffOn I s) (x :
 open Bundle
 
 variable {F : Type _} [NormedAddCommGroup F] [NormedSpace 𝕜 F] (Z : M → Type _)
-  [TopologicalSpace (TotalSpace Z)] [∀ b, TopologicalSpace (Z b)] [∀ b, AddCommMonoid (Z b)]
+  [TopologicalSpace (TotalSpace F Z)] [∀ b, TopologicalSpace (Z b)] [∀ b, AddCommMonoid (Z b)]
   [∀ b, Module 𝕜 (Z b)] [FiberBundle F Z] [VectorBundle 𝕜 F Z] [SmoothVectorBundle F Z I]
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
@@ -2640,18 +2625,18 @@ variable {F : Type _} [NormedAddCommGroup F] [NormedSpace 𝕜 F] (Z : M → Typ
 /-- In a smooth fiber bundle, the preimage under the projection of a set with
 unique differential in the basis also has unique differential. -/
 theorem UniqueMDiffOn.smooth_bundle_preimage (hs : UniqueMDiffOn I s) :
-    UniqueMDiffOn (I.Prod 𝓘(𝕜, F)) (π Z ⁻¹' s) :=
+    UniqueMDiffOn (I.Prod 𝓘(𝕜, F)) (π F Z ⁻¹' s) :=
   by
   /- Using a chart (and the fact that unique differentiability is invariant under charts), we
     reduce the situation to the model space, where we can use the fact that products respect
     unique differentiability. -/
   intro p hp
-  replace hp : p.fst ∈ s; · simpa only [mfld_simps] using hp
+  replace hp : p.1 ∈ s; · simpa only [mfld_simps] using hp
   let e₀ := chart_at H p.1
   let e := chart_at (ModelProd H F) p
   have h2s :
     ∀ x,
-      x ∈ e.target ∩ e.symm ⁻¹' (π Z ⁻¹' s) ↔
+      x ∈ e.target ∩ e.symm ⁻¹' (π F Z ⁻¹' s) ↔
         (x.1 ∈ e₀.target ∧ e₀.symm x.1 ∈ (trivialization_at F Z p.1).baseSet) ∧ e₀.symm x.1 ∈ s :=
     by
     intro x
@@ -2663,15 +2648,15 @@ theorem UniqueMDiffOn.smooth_bundle_preimage (hs : UniqueMDiffOn I s) :
     intro hx
     simp only [FiberBundle.chartedSpace_chartAt_symm_fst p x hx, mfld_simps]
   -- It suffices to prove unique differentiability in a chart
-  suffices h : UniqueMDiffOn (I.prod 𝓘(𝕜, F)) (e.target ∩ e.symm ⁻¹' (π Z ⁻¹' s))
+  suffices h : UniqueMDiffOn (I.prod 𝓘(𝕜, F)) (e.target ∩ e.symm ⁻¹' (π F Z ⁻¹' s))
   · have A :
       UniqueMDiffOn (I.prod 𝓘(𝕜, F))
-        (e.symm.target ∩ e.symm.symm ⁻¹' (e.target ∩ e.symm ⁻¹' (π Z ⁻¹' s))) :=
+        (e.symm.target ∩ e.symm.symm ⁻¹' (e.target ∩ e.symm ⁻¹' (π F Z ⁻¹' s))) :=
       by
       apply h.unique_mdiff_on_preimage
       exact (mdifferentiable_of_mem_atlas _ (chart_mem_atlas _ _)).symm
       infer_instance
-    have : p ∈ e.symm.target ∩ e.symm.symm ⁻¹' (e.target ∩ e.symm ⁻¹' (π Z ⁻¹' s)) := by
+    have : p ∈ e.symm.target ∩ e.symm.symm ⁻¹' (e.target ∩ e.symm ⁻¹' (π F Z ⁻¹' s)) := by
       simp only [e, hp, mfld_simps]
     apply (A _ this).mono
     intro q hq
@@ -2681,7 +2666,7 @@ theorem UniqueMDiffOn.smooth_bundle_preimage (hs : UniqueMDiffOn I s) :
   simp only [UniqueMDiffWithinAt, ModelWithCorners.prod, -preimage_inter, mfld_simps]
   have :
     𝓝[(I.symm ⁻¹' (e₀.target ∩ e₀.symm ⁻¹' s) ∩ range I) ×ˢ univ] (I q.1, q.2) ≤
-      𝓝[(fun p : E × F => (I.symm p.1, p.snd)) ⁻¹' (e.target ∩ e.symm ⁻¹' (π Z ⁻¹' s)) ∩
+      𝓝[(fun p : E × F => (I.symm p.1, p.snd)) ⁻¹' (e.target ∩ e.symm ⁻¹' (π F Z ⁻¹' s)) ∩
           range I ×ˢ univ]
         (I q.1, q.2) :=
     by
@@ -2714,7 +2699,7 @@ theorem UniqueMDiffOn.smooth_bundle_preimage (hs : UniqueMDiffOn I s) :
 
 #print UniqueMDiffOn.tangentBundle_proj_preimage /-
 theorem UniqueMDiffOn.tangentBundle_proj_preimage (hs : UniqueMDiffOn I s) :
-    UniqueMDiffOn I.tangent (π (TangentSpace I) ⁻¹' s) :=
+    UniqueMDiffOn I.tangent (π E (TangentSpace I) ⁻¹' s) :=
   hs.smooth_bundle_preimage _
 #align unique_mdiff_on.tangent_bundle_proj_preimage UniqueMDiffOn.tangentBundle_proj_preimage
 -/
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 geometry.manifold.mfderiv
-! leanprover-community/mathlib commit e354e865255654389cc46e6032160238df2e0f40
+! leanprover-community/mathlib commit 08b63ab58a6ec1157ebeafcbbe6c7a3fb3c9f6d5
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -13,6 +13,9 @@ import Mathbin.Geometry.Manifold.VectorBundle.Tangent
 /-!
 # The derivative of functions between smooth manifolds
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 Let `M` and `M'` be two smooth manifolds with corners over a field `𝕜` (with respective models with
 corners `I` on `(E, H)` and `I'` on `(E', H')`), and let `f : M → M'`. We define the
 derivative of the function at a point, within a set or along the whole space, mimicking the API
Diff
@@ -125,13 +125,16 @@ variable {𝕜 : Type _} [NontriviallyNormedField 𝕜] {E : Type _} [NormedAddC
   {H' : Type _} [TopologicalSpace H'] (I' : ModelWithCorners 𝕜 E' H') {M' : Type _}
   [TopologicalSpace M'] [ChartedSpace H' M']
 
+#print DifferentiableWithinAtProp /-
 /-- Property in the model space of a model with corners of being differentiable within at set at a
 point, when read in the model vector space. This property will be lifted to manifolds to define
 differentiable functions between manifolds. -/
 def DifferentiableWithinAtProp (f : H → H') (s : Set H) (x : H) : Prop :=
   DifferentiableWithinAt 𝕜 (I' ∘ f ∘ I.symm) (⇑I.symm ⁻¹' s ∩ Set.range I) (I x)
 #align differentiable_within_at_prop DifferentiableWithinAtProp
+-/
 
+#print differentiable_within_at_localInvariantProp /-
 /-- Being differentiable in the model space is a local property, invariant under smooth maps.
 Therefore, it will lift nicely to manifolds. -/
 theorem differentiable_within_at_localInvariantProp :
@@ -178,18 +181,24 @@ theorem differentiable_within_at_localInvariantProp :
       · ext y; simp only [mfld_simps]
       · intro y hy; simp only [mfld_simps] at hy ; simpa only [hy, mfld_simps] using hs hy.1 }
 #align differentiable_within_at_local_invariant_prop differentiable_within_at_localInvariantProp
+-/
 
+#print UniqueMDiffWithinAt /-
 /-- Predicate ensuring that, at a point and within a set, a function can have at most one
 derivative. This is expressed using the preferred chart at the considered point. -/
-def UniqueMdiffWithinAt (s : Set M) (x : M) :=
+def UniqueMDiffWithinAt (s : Set M) (x : M) :=
   UniqueDiffWithinAt 𝕜 ((extChartAt I x).symm ⁻¹' s ∩ range I) ((extChartAt I x) x)
-#align unique_mdiff_within_at UniqueMdiffWithinAt
+#align unique_mdiff_within_at UniqueMDiffWithinAt
+-/
 
+#print UniqueMDiffOn /-
 /-- Predicate ensuring that, at all points of a set, a function can have at most one derivative. -/
-def UniqueMdiffOn (s : Set M) :=
-  ∀ x ∈ s, UniqueMdiffWithinAt I s x
-#align unique_mdiff_on UniqueMdiffOn
+def UniqueMDiffOn (s : Set M) :=
+  ∀ x ∈ s, UniqueMDiffWithinAt I s x
+#align unique_mdiff_on UniqueMDiffOn
+-/
 
+#print MDifferentiableWithinAt /-
 /-- `mdifferentiable_within_at I I' f s x` indicates that the function `f` between manifolds
 has a derivative at the point `x` within the set `s`.
 This is a generalization of `differentiable_within_at` to manifolds.
@@ -198,17 +207,21 @@ We require continuity in the definition, as otherwise points close to `x` in `s`
 `f` outside of the chart domain around `f x`. Then the chart could do anything to the image points,
 and in particular by coincidence `written_in_ext_chart_at I I' x f` could be differentiable, while
 this would not mean anything relevant. -/
-def MdifferentiableWithinAt (f : M → M') (s : Set M) (x : M) :=
+def MDifferentiableWithinAt (f : M → M') (s : Set M) (x : M) :=
   ContinuousWithinAt f s x ∧
     DifferentiableWithinAt 𝕜 (writtenInExtChartAt I I' x f) ((extChartAt I x).symm ⁻¹' s ∩ range I)
       ((extChartAt I x) x)
-#align mdifferentiable_within_at MdifferentiableWithinAt
+#align mdifferentiable_within_at MDifferentiableWithinAt
+-/
 
+#print mdifferentiableWithinAt_iff_liftPropWithinAt /-
 theorem mdifferentiableWithinAt_iff_liftPropWithinAt (f : M → M') (s : Set M) (x : M) :
-    MdifferentiableWithinAt I I' f s x ↔ LiftPropWithinAt (DifferentiableWithinAtProp I I') f s x :=
+    MDifferentiableWithinAt I I' f s x ↔ LiftPropWithinAt (DifferentiableWithinAtProp I I') f s x :=
   by rfl
 #align mdifferentiable_within_at_iff_lift_prop_within_at mdifferentiableWithinAt_iff_liftPropWithinAt
+-/
 
+#print MDifferentiableAt /-
 /-- `mdifferentiable_at I I' f x` indicates that the function `f` between manifolds
 has a derivative at the point `x`.
 This is a generalization of `differentiable_at` to manifolds.
@@ -217,42 +230,52 @@ We require continuity in the definition, as otherwise points close to `x` could
 `f` outside of the chart domain around `f x`. Then the chart could do anything to the image points,
 and in particular by coincidence `written_in_ext_chart_at I I' x f` could be differentiable, while
 this would not mean anything relevant. -/
-def MdifferentiableAt (f : M → M') (x : M) :=
+def MDifferentiableAt (f : M → M') (x : M) :=
   ContinuousAt f x ∧
     DifferentiableWithinAt 𝕜 (writtenInExtChartAt I I' x f) (range I) ((extChartAt I x) x)
-#align mdifferentiable_at MdifferentiableAt
+#align mdifferentiable_at MDifferentiableAt
+-/
 
 /- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:73:14: unsupported tactic `congrm #[[expr «expr ∧ »(_, _)]] -/
+#print mdifferentiableAt_iff_liftPropAt /-
 theorem mdifferentiableAt_iff_liftPropAt (f : M → M') (x : M) :
-    MdifferentiableAt I I' f x ↔ LiftPropAt (DifferentiableWithinAtProp I I') f x :=
+    MDifferentiableAt I I' f x ↔ LiftPropAt (DifferentiableWithinAtProp I I') f x :=
   by
   trace
     "./././Mathport/Syntax/Translate/Tactic/Builtin.lean:73:14: unsupported tactic `congrm #[[expr «expr ∧ »(_, _)]]"
   · rw [continuousWithinAt_univ]
   · simp [DifferentiableWithinAtProp, Set.univ_inter]
 #align mdifferentiable_at_iff_lift_prop_at mdifferentiableAt_iff_liftPropAt
+-/
 
+#print MDifferentiableOn /-
 /-- `mdifferentiable_on I I' f s` indicates that the function `f` between manifolds
 has a derivative within `s` at all points of `s`.
 This is a generalization of `differentiable_on` to manifolds. -/
-def MdifferentiableOn (f : M → M') (s : Set M) :=
-  ∀ x ∈ s, MdifferentiableWithinAt I I' f s x
-#align mdifferentiable_on MdifferentiableOn
+def MDifferentiableOn (f : M → M') (s : Set M) :=
+  ∀ x ∈ s, MDifferentiableWithinAt I I' f s x
+#align mdifferentiable_on MDifferentiableOn
+-/
 
+#print MDifferentiable /-
 /-- `mdifferentiable I I' f` indicates that the function `f` between manifolds
 has a derivative everywhere.
 This is a generalization of `differentiable` to manifolds. -/
-def Mdifferentiable (f : M → M') :=
-  ∀ x, MdifferentiableAt I I' f x
-#align mdifferentiable Mdifferentiable
+def MDifferentiable (f : M → M') :=
+  ∀ x, MDifferentiableAt I I' f x
+#align mdifferentiable MDifferentiable
+-/
 
+#print LocalHomeomorph.MDifferentiable /-
 /-- Prop registering if a local homeomorphism is a local diffeomorphism on its source -/
-def LocalHomeomorph.Mdifferentiable (f : LocalHomeomorph M M') :=
-  MdifferentiableOn I I' f f.source ∧ MdifferentiableOn I' I f.symm f.target
-#align local_homeomorph.mdifferentiable LocalHomeomorph.Mdifferentiable
+def LocalHomeomorph.MDifferentiable (f : LocalHomeomorph M M') :=
+  MDifferentiableOn I I' f f.source ∧ MDifferentiableOn I' I f.symm f.target
+#align local_homeomorph.mdifferentiable LocalHomeomorph.MDifferentiable
+-/
 
 variable [SmoothManifoldWithCorners I M] [SmoothManifoldWithCorners I' M']
 
+#print HasMFDerivWithinAt /-
 /-- `has_mfderiv_within_at I I' f s x f'` indicates that the function `f` between manifolds
 has, at the point `x` and within the set `s`, the derivative `f'`. Here, `f'` is a continuous linear
 map from the tangent space at `x` to the tangent space at `f x`.
@@ -264,13 +287,15 @@ We require continuity in the definition, as otherwise points close to `x` in `s`
 `f` outside of the chart domain around `f x`. Then the chart could do anything to the image points,
 and in particular by coincidence `written_in_ext_chart_at I I' x f` could be differentiable, while
 this would not mean anything relevant. -/
-def HasMfderivWithinAt (f : M → M') (s : Set M) (x : M)
+def HasMFDerivWithinAt (f : M → M') (s : Set M) (x : M)
     (f' : TangentSpace I x →L[𝕜] TangentSpace I' (f x)) :=
   ContinuousWithinAt f s x ∧
     HasFDerivWithinAt (writtenInExtChartAt I I' x f : E → E') f'
       ((extChartAt I x).symm ⁻¹' s ∩ range I) ((extChartAt I x) x)
-#align has_mfderiv_within_at HasMfderivWithinAt
+#align has_mfderiv_within_at HasMFDerivWithinAt
+-/
 
+#print HasMFDerivAt /-
 /-- `has_mfderiv_at I I' f x f'` indicates that the function `f` between manifolds
 has, at the point `x`, the derivative `f'`. Here, `f'` is a continuous linear
 map from the tangent space at `x` to the tangent space at `f x`.
@@ -279,40 +304,49 @@ We require continuity in the definition, as otherwise points close to `x` `s` co
 `f` outside of the chart domain around `f x`. Then the chart could do anything to the image points,
 and in particular by coincidence `written_in_ext_chart_at I I' x f` could be differentiable, while
 this would not mean anything relevant. -/
-def HasMfderivAt (f : M → M') (x : M) (f' : TangentSpace I x →L[𝕜] TangentSpace I' (f x)) :=
+def HasMFDerivAt (f : M → M') (x : M) (f' : TangentSpace I x →L[𝕜] TangentSpace I' (f x)) :=
   ContinuousAt f x ∧
     HasFDerivWithinAt (writtenInExtChartAt I I' x f : E → E') f' (range I) ((extChartAt I x) x)
-#align has_mfderiv_at HasMfderivAt
+#align has_mfderiv_at HasMFDerivAt
+-/
 
+#print mfderivWithin /-
 /-- Let `f` be a function between two smooth manifolds. Then `mfderiv_within I I' f s x` is the
 derivative of `f` at `x` within `s`, as a continuous linear map from the tangent space at `x` to the
 tangent space at `f x`. -/
 def mfderivWithin (f : M → M') (s : Set M) (x : M) : TangentSpace I x →L[𝕜] TangentSpace I' (f x) :=
-  if MdifferentiableWithinAt I I' f s x then
+  if MDifferentiableWithinAt I I' f s x then
     (fderivWithin 𝕜 (writtenInExtChartAt I I' x f) ((extChartAt I x).symm ⁻¹' s ∩ range I)
         ((extChartAt I x) x) :
       _)
   else 0
 #align mfderiv_within mfderivWithin
+-/
 
+#print mfderiv /-
 /-- Let `f` be a function between two smooth manifolds. Then `mfderiv I I' f x` is the derivative of
 `f` at `x`, as a continuous linear map from the tangent space at `x` to the tangent space at
 `f x`. -/
 def mfderiv (f : M → M') (x : M) : TangentSpace I x →L[𝕜] TangentSpace I' (f x) :=
-  if MdifferentiableAt I I' f x then
+  if MDifferentiableAt I I' f x then
     (fderivWithin 𝕜 (writtenInExtChartAt I I' x f : E → E') (range I) ((extChartAt I x) x) : _)
   else 0
 #align mfderiv mfderiv
+-/
 
+#print tangentMapWithin /-
 /-- The derivative within a set, as a map between the tangent bundles -/
 def tangentMapWithin (f : M → M') (s : Set M) : TangentBundle I M → TangentBundle I' M' := fun p =>
   ⟨f p.1, (mfderivWithin I I' f s p.1 : TangentSpace I p.1 → TangentSpace I' (f p.1)) p.2⟩
 #align tangent_map_within tangentMapWithin
+-/
 
+#print tangentMap /-
 /-- The derivative, as a map between the tangent bundles -/
 def tangentMap (f : M → M') : TangentBundle I M → TangentBundle I' M' := fun p =>
   ⟨f p.1, (mfderiv I I' f p.1 : TangentSpace I p.1 → TangentSpace I' (f p.1)) p.2⟩
 #align tangent_map tangentMap
+-/
 
 end DerivativesDefinitions
 
@@ -332,60 +366,78 @@ variable {𝕜 : Type _} [NontriviallyNormedField 𝕜] {E : Type _} [NormedAddC
   {I'' : ModelWithCorners 𝕜 E'' H''} {M'' : Type _} [TopologicalSpace M''] [ChartedSpace H'' M'']
   {f f₀ f₁ : M → M'} {x : M} {s t : Set M} {g : M' → M''} {u : Set M'}
 
-theorem uniqueMdiffWithinAt_univ : UniqueMdiffWithinAt I univ x :=
+#print uniqueMDiffWithinAt_univ /-
+theorem uniqueMDiffWithinAt_univ : UniqueMDiffWithinAt I univ x :=
   by
-  unfold UniqueMdiffWithinAt
+  unfold UniqueMDiffWithinAt
   simp only [preimage_univ, univ_inter]
   exact I.unique_diff _ (mem_range_self _)
-#align unique_mdiff_within_at_univ uniqueMdiffWithinAt_univ
+#align unique_mdiff_within_at_univ uniqueMDiffWithinAt_univ
+-/
 
 variable {I}
 
-theorem uniqueMdiffWithinAt_iff {s : Set M} {x : M} :
-    UniqueMdiffWithinAt I s x ↔
+#print uniqueMDiffWithinAt_iff /-
+theorem uniqueMDiffWithinAt_iff {s : Set M} {x : M} :
+    UniqueMDiffWithinAt I s x ↔
       UniqueDiffWithinAt 𝕜 ((extChartAt I x).symm ⁻¹' s ∩ (extChartAt I x).target)
         ((extChartAt I x) x) :=
   by
   apply uniqueDiffWithinAt_congr
   rw [nhdsWithin_inter, nhdsWithin_inter, nhdsWithin_extChartAt_target_eq]
-#align unique_mdiff_within_at_iff uniqueMdiffWithinAt_iff
+#align unique_mdiff_within_at_iff uniqueMDiffWithinAt_iff
+-/
 
-theorem UniqueMdiffWithinAt.mono (h : UniqueMdiffWithinAt I s x) (st : s ⊆ t) :
-    UniqueMdiffWithinAt I t x :=
+#print UniqueMDiffWithinAt.mono /-
+theorem UniqueMDiffWithinAt.mono (h : UniqueMDiffWithinAt I s x) (st : s ⊆ t) :
+    UniqueMDiffWithinAt I t x :=
   UniqueDiffWithinAt.mono h <| inter_subset_inter (preimage_mono st) (Subset.refl _)
-#align unique_mdiff_within_at.mono UniqueMdiffWithinAt.mono
+#align unique_mdiff_within_at.mono UniqueMDiffWithinAt.mono
+-/
 
-theorem UniqueMdiffWithinAt.inter' (hs : UniqueMdiffWithinAt I s x) (ht : t ∈ 𝓝[s] x) :
-    UniqueMdiffWithinAt I (s ∩ t) x :=
+#print UniqueMDiffWithinAt.inter' /-
+theorem UniqueMDiffWithinAt.inter' (hs : UniqueMDiffWithinAt I s x) (ht : t ∈ 𝓝[s] x) :
+    UniqueMDiffWithinAt I (s ∩ t) x :=
   by
-  rw [UniqueMdiffWithinAt, extChartAt_preimage_inter_eq]
+  rw [UniqueMDiffWithinAt, extChartAt_preimage_inter_eq]
   exact UniqueDiffWithinAt.inter' hs (extChartAt_preimage_mem_nhdsWithin I x ht)
-#align unique_mdiff_within_at.inter' UniqueMdiffWithinAt.inter'
+#align unique_mdiff_within_at.inter' UniqueMDiffWithinAt.inter'
+-/
 
-theorem UniqueMdiffWithinAt.inter (hs : UniqueMdiffWithinAt I s x) (ht : t ∈ 𝓝 x) :
-    UniqueMdiffWithinAt I (s ∩ t) x :=
+#print UniqueMDiffWithinAt.inter /-
+theorem UniqueMDiffWithinAt.inter (hs : UniqueMDiffWithinAt I s x) (ht : t ∈ 𝓝 x) :
+    UniqueMDiffWithinAt I (s ∩ t) x :=
   by
-  rw [UniqueMdiffWithinAt, extChartAt_preimage_inter_eq]
+  rw [UniqueMDiffWithinAt, extChartAt_preimage_inter_eq]
   exact UniqueDiffWithinAt.inter hs (extChartAt_preimage_mem_nhds I x ht)
-#align unique_mdiff_within_at.inter UniqueMdiffWithinAt.inter
+#align unique_mdiff_within_at.inter UniqueMDiffWithinAt.inter
+-/
 
-theorem IsOpen.uniqueMdiffWithinAt (xs : x ∈ s) (hs : IsOpen s) : UniqueMdiffWithinAt I s x :=
+#print IsOpen.uniqueMDiffWithinAt /-
+theorem IsOpen.uniqueMDiffWithinAt (xs : x ∈ s) (hs : IsOpen s) : UniqueMDiffWithinAt I s x :=
   by
-  have := UniqueMdiffWithinAt.inter (uniqueMdiffWithinAt_univ I) (IsOpen.mem_nhds hs xs)
+  have := UniqueMDiffWithinAt.inter (uniqueMDiffWithinAt_univ I) (IsOpen.mem_nhds hs xs)
   rwa [univ_inter] at this 
-#align is_open.unique_mdiff_within_at IsOpen.uniqueMdiffWithinAt
+#align is_open.unique_mdiff_within_at IsOpen.uniqueMDiffWithinAt
+-/
 
-theorem UniqueMdiffOn.inter (hs : UniqueMdiffOn I s) (ht : IsOpen t) : UniqueMdiffOn I (s ∩ t) :=
-  fun x hx => UniqueMdiffWithinAt.inter (hs _ hx.1) (IsOpen.mem_nhds ht hx.2)
-#align unique_mdiff_on.inter UniqueMdiffOn.inter
+#print UniqueMDiffOn.inter /-
+theorem UniqueMDiffOn.inter (hs : UniqueMDiffOn I s) (ht : IsOpen t) : UniqueMDiffOn I (s ∩ t) :=
+  fun x hx => UniqueMDiffWithinAt.inter (hs _ hx.1) (IsOpen.mem_nhds ht hx.2)
+#align unique_mdiff_on.inter UniqueMDiffOn.inter
+-/
 
-theorem IsOpen.uniqueMdiffOn (hs : IsOpen s) : UniqueMdiffOn I s := fun x hx =>
-  IsOpen.uniqueMdiffWithinAt hx hs
-#align is_open.unique_mdiff_on IsOpen.uniqueMdiffOn
+#print IsOpen.uniqueMDiffOn /-
+theorem IsOpen.uniqueMDiffOn (hs : IsOpen s) : UniqueMDiffOn I s := fun x hx =>
+  IsOpen.uniqueMDiffWithinAt hx hs
+#align is_open.unique_mdiff_on IsOpen.uniqueMDiffOn
+-/
 
-theorem uniqueMdiffOn_univ : UniqueMdiffOn I (univ : Set M) :=
-  isOpen_univ.UniqueMdiffOn
-#align unique_mdiff_on_univ uniqueMdiffOn_univ
+#print uniqueMDiffOn_univ /-
+theorem uniqueMDiffOn_univ : UniqueMDiffOn I (univ : Set M) :=
+  isOpen_univ.UniqueMDiffOn
+#align unique_mdiff_on_univ uniqueMDiffOn_univ
+-/
 
 /- We name the typeclass variables related to `smooth_manifold_with_corners` structure as they are
 necessary in lemmas mentioning the derivative, but not in lemmas about differentiability, so we
@@ -395,16 +447,20 @@ variable [Is : SmoothManifoldWithCorners I M] [I's : SmoothManifoldWithCorners I
   {f' f₀' f₁' : TangentSpace I x →L[𝕜] TangentSpace I' (f x)}
   {g' : TangentSpace I' (f x) →L[𝕜] TangentSpace I'' (g (f x))}
 
+#print UniqueMDiffWithinAt.eq /-
 /-- `unique_mdiff_within_at` achieves its goal: it implies the uniqueness of the derivative. -/
-theorem UniqueMdiffWithinAt.eq (U : UniqueMdiffWithinAt I s x)
-    (h : HasMfderivWithinAt I I' f s x f') (h₁ : HasMfderivWithinAt I I' f s x f₁') : f' = f₁' :=
+theorem UniqueMDiffWithinAt.eq (U : UniqueMDiffWithinAt I s x)
+    (h : HasMFDerivWithinAt I I' f s x f') (h₁ : HasMFDerivWithinAt I I' f s x f₁') : f' = f₁' :=
   U.Eq h.2 h₁.2
-#align unique_mdiff_within_at.eq UniqueMdiffWithinAt.eq
+#align unique_mdiff_within_at.eq UniqueMDiffWithinAt.eq
+-/
 
-theorem UniqueMdiffOn.eq (U : UniqueMdiffOn I s) (hx : x ∈ s) (h : HasMfderivWithinAt I I' f s x f')
-    (h₁ : HasMfderivWithinAt I I' f s x f₁') : f' = f₁' :=
-  UniqueMdiffWithinAt.eq (U _ hx) h h₁
-#align unique_mdiff_on.eq UniqueMdiffOn.eq
+#print UniqueMDiffOn.eq /-
+theorem UniqueMDiffOn.eq (U : UniqueMDiffOn I s) (hx : x ∈ s) (h : HasMFDerivWithinAt I I' f s x f')
+    (h₁ : HasMFDerivWithinAt I I' f s x f₁') : f' = f₁' :=
+  UniqueMDiffWithinAt.eq (U _ hx) h h₁
+#align unique_mdiff_on.eq UniqueMDiffOn.eq
+-/
 
 /-!
 ### General lemmas on derivatives of functions between manifolds
@@ -413,8 +469,9 @@ We mimick the API for functions between vector spaces
 -/
 
 
+#print mdifferentiableWithinAt_iff /-
 theorem mdifferentiableWithinAt_iff {f : M → M'} {s : Set M} {x : M} :
-    MdifferentiableWithinAt I I' f s x ↔
+    MDifferentiableWithinAt I I' f s x ↔
       ContinuousWithinAt f s x ∧
         DifferentiableWithinAt 𝕜 (writtenInExtChartAt I I' x f)
           ((extChartAt I x).target ∩ (extChartAt I x).symm ⁻¹' s) ((extChartAt I x) x) :=
@@ -423,12 +480,14 @@ theorem mdifferentiableWithinAt_iff {f : M → M'} {s : Set M} {x : M} :
   rw [inter_comm]
   simp only [HasFDerivWithinAt, nhdsWithin_inter, nhdsWithin_extChartAt_target_eq]
 #align mdifferentiable_within_at_iff mdifferentiableWithinAt_iff
+-/
 
+#print mdifferentiableWithinAt_iff_of_mem_source /-
 /-- One can reformulate differentiability within a set at a point as continuity within this set at
 this point, and differentiability in any chart containing that point. -/
 theorem mdifferentiableWithinAt_iff_of_mem_source {x' : M} {y : M'}
     (hx : x' ∈ (ChartedSpace.chartAt H x).source) (hy : f x' ∈ (ChartedSpace.chartAt H' y).source) :
-    MdifferentiableWithinAt I I' f s x' ↔
+    MDifferentiableWithinAt I I' f s x' ↔
       ContinuousWithinAt f s x' ∧
         DifferentiableWithinAt 𝕜 (extChartAt I' y ∘ f ∘ (extChartAt I x).symm)
           ((extChartAt I x).symm ⁻¹' s ∩ Set.range I) ((extChartAt I x) x') :=
@@ -436,194 +495,258 @@ theorem mdifferentiableWithinAt_iff_of_mem_source {x' : M} {y : M'}
     (StructureGroupoid.chart_mem_maximalAtlas _ x) hx (StructureGroupoid.chart_mem_maximalAtlas _ y)
     hy
 #align mdifferentiable_within_at_iff_of_mem_source mdifferentiableWithinAt_iff_of_mem_source
+-/
 
+#print mfderivWithin_zero_of_not_mdifferentiableWithinAt /-
 theorem mfderivWithin_zero_of_not_mdifferentiableWithinAt
-    (h : ¬MdifferentiableWithinAt I I' f s x) : mfderivWithin I I' f s x = 0 := by
+    (h : ¬MDifferentiableWithinAt I I' f s x) : mfderivWithin I I' f s x = 0 := by
   simp only [mfderivWithin, h, if_neg, not_false_iff]
 #align mfderiv_within_zero_of_not_mdifferentiable_within_at mfderivWithin_zero_of_not_mdifferentiableWithinAt
+-/
 
-theorem mfderiv_zero_of_not_mdifferentiableAt (h : ¬MdifferentiableAt I I' f x) :
+#print mfderiv_zero_of_not_mdifferentiableAt /-
+theorem mfderiv_zero_of_not_mdifferentiableAt (h : ¬MDifferentiableAt I I' f x) :
     mfderiv I I' f x = 0 := by simp only [mfderiv, h, if_neg, not_false_iff]
 #align mfderiv_zero_of_not_mdifferentiable_at mfderiv_zero_of_not_mdifferentiableAt
+-/
 
-theorem HasMfderivWithinAt.mono (h : HasMfderivWithinAt I I' f t x f') (hst : s ⊆ t) :
-    HasMfderivWithinAt I I' f s x f' :=
+#print HasMFDerivWithinAt.mono /-
+theorem HasMFDerivWithinAt.mono (h : HasMFDerivWithinAt I I' f t x f') (hst : s ⊆ t) :
+    HasMFDerivWithinAt I I' f s x f' :=
   ⟨ContinuousWithinAt.mono h.1 hst,
     HasFDerivWithinAt.mono h.2 (inter_subset_inter (preimage_mono hst) (Subset.refl _))⟩
-#align has_mfderiv_within_at.mono HasMfderivWithinAt.mono
+#align has_mfderiv_within_at.mono HasMFDerivWithinAt.mono
+-/
 
-theorem HasMfderivAt.hasMfderivWithinAt (h : HasMfderivAt I I' f x f') :
-    HasMfderivWithinAt I I' f s x f' :=
+#print HasMFDerivAt.hasMFDerivWithinAt /-
+theorem HasMFDerivAt.hasMFDerivWithinAt (h : HasMFDerivAt I I' f x f') :
+    HasMFDerivWithinAt I I' f s x f' :=
   ⟨ContinuousAt.continuousWithinAt h.1, HasFDerivWithinAt.mono h.2 (inter_subset_right _ _)⟩
-#align has_mfderiv_at.has_mfderiv_within_at HasMfderivAt.hasMfderivWithinAt
+#align has_mfderiv_at.has_mfderiv_within_at HasMFDerivAt.hasMFDerivWithinAt
+-/
 
-theorem HasMfderivWithinAt.mdifferentiableWithinAt (h : HasMfderivWithinAt I I' f s x f') :
-    MdifferentiableWithinAt I I' f s x :=
+#print HasMFDerivWithinAt.mdifferentiableWithinAt /-
+theorem HasMFDerivWithinAt.mdifferentiableWithinAt (h : HasMFDerivWithinAt I I' f s x f') :
+    MDifferentiableWithinAt I I' f s x :=
   ⟨h.1, ⟨f', h.2⟩⟩
-#align has_mfderiv_within_at.mdifferentiable_within_at HasMfderivWithinAt.mdifferentiableWithinAt
+#align has_mfderiv_within_at.mdifferentiable_within_at HasMFDerivWithinAt.mdifferentiableWithinAt
+-/
 
-theorem HasMfderivAt.mdifferentiableAt (h : HasMfderivAt I I' f x f') :
-    MdifferentiableAt I I' f x :=
+#print HasMFDerivAt.mdifferentiableAt /-
+theorem HasMFDerivAt.mdifferentiableAt (h : HasMFDerivAt I I' f x f') :
+    MDifferentiableAt I I' f x :=
   ⟨h.1, ⟨f', h.2⟩⟩
-#align has_mfderiv_at.mdifferentiable_at HasMfderivAt.mdifferentiableAt
+#align has_mfderiv_at.mdifferentiable_at HasMFDerivAt.mdifferentiableAt
+-/
 
+#print hasMFDerivWithinAt_univ /-
 @[simp, mfld_simps]
-theorem hasMfderivWithinAt_univ : HasMfderivWithinAt I I' f univ x f' ↔ HasMfderivAt I I' f x f' :=
-  by simp only [HasMfderivWithinAt, HasMfderivAt, continuousWithinAt_univ, mfld_simps]
-#align has_mfderiv_within_at_univ hasMfderivWithinAt_univ
+theorem hasMFDerivWithinAt_univ : HasMFDerivWithinAt I I' f univ x f' ↔ HasMFDerivAt I I' f x f' :=
+  by simp only [HasMFDerivWithinAt, HasMFDerivAt, continuousWithinAt_univ, mfld_simps]
+#align has_mfderiv_within_at_univ hasMFDerivWithinAt_univ
+-/
 
-theorem hasMfderivAt_unique (h₀ : HasMfderivAt I I' f x f₀') (h₁ : HasMfderivAt I I' f x f₁') :
+#print hasMFDerivAt_unique /-
+theorem hasMFDerivAt_unique (h₀ : HasMFDerivAt I I' f x f₀') (h₁ : HasMFDerivAt I I' f x f₁') :
     f₀' = f₁' := by
-  rw [← hasMfderivWithinAt_univ] at h₀ h₁ 
-  exact (uniqueMdiffWithinAt_univ I).Eq h₀ h₁
-#align has_mfderiv_at_unique hasMfderivAt_unique
+  rw [← hasMFDerivWithinAt_univ] at h₀ h₁ 
+  exact (uniqueMDiffWithinAt_univ I).Eq h₀ h₁
+#align has_mfderiv_at_unique hasMFDerivAt_unique
+-/
 
-theorem hasMfderivWithinAt_inter' (h : t ∈ 𝓝[s] x) :
-    HasMfderivWithinAt I I' f (s ∩ t) x f' ↔ HasMfderivWithinAt I I' f s x f' :=
+#print hasMFDerivWithinAt_inter' /-
+theorem hasMFDerivWithinAt_inter' (h : t ∈ 𝓝[s] x) :
+    HasMFDerivWithinAt I I' f (s ∩ t) x f' ↔ HasMFDerivWithinAt I I' f s x f' :=
   by
-  rw [HasMfderivWithinAt, HasMfderivWithinAt, extChartAt_preimage_inter_eq,
+  rw [HasMFDerivWithinAt, HasMFDerivWithinAt, extChartAt_preimage_inter_eq,
     hasFDerivWithinAt_inter', continuousWithinAt_inter' h]
   exact extChartAt_preimage_mem_nhdsWithin I x h
-#align has_mfderiv_within_at_inter' hasMfderivWithinAt_inter'
+#align has_mfderiv_within_at_inter' hasMFDerivWithinAt_inter'
+-/
 
-theorem hasMfderivWithinAt_inter (h : t ∈ 𝓝 x) :
-    HasMfderivWithinAt I I' f (s ∩ t) x f' ↔ HasMfderivWithinAt I I' f s x f' :=
+#print hasMFDerivWithinAt_inter /-
+theorem hasMFDerivWithinAt_inter (h : t ∈ 𝓝 x) :
+    HasMFDerivWithinAt I I' f (s ∩ t) x f' ↔ HasMFDerivWithinAt I I' f s x f' :=
   by
-  rw [HasMfderivWithinAt, HasMfderivWithinAt, extChartAt_preimage_inter_eq, hasFDerivWithinAt_inter,
+  rw [HasMFDerivWithinAt, HasMFDerivWithinAt, extChartAt_preimage_inter_eq, hasFDerivWithinAt_inter,
     continuousWithinAt_inter h]
   exact extChartAt_preimage_mem_nhds I x h
-#align has_mfderiv_within_at_inter hasMfderivWithinAt_inter
+#align has_mfderiv_within_at_inter hasMFDerivWithinAt_inter
+-/
 
-theorem HasMfderivWithinAt.union (hs : HasMfderivWithinAt I I' f s x f')
-    (ht : HasMfderivWithinAt I I' f t x f') : HasMfderivWithinAt I I' f (s ∪ t) x f' :=
+#print HasMFDerivWithinAt.union /-
+theorem HasMFDerivWithinAt.union (hs : HasMFDerivWithinAt I I' f s x f')
+    (ht : HasMFDerivWithinAt I I' f t x f') : HasMFDerivWithinAt I I' f (s ∪ t) x f' :=
   by
   constructor
   · exact ContinuousWithinAt.union hs.1 ht.1
   · convert HasFDerivWithinAt.union hs.2 ht.2
     simp only [union_inter_distrib_right, preimage_union]
-#align has_mfderiv_within_at.union HasMfderivWithinAt.union
+#align has_mfderiv_within_at.union HasMFDerivWithinAt.union
+-/
 
-theorem HasMfderivWithinAt.nhdsWithin (h : HasMfderivWithinAt I I' f s x f') (ht : s ∈ 𝓝[t] x) :
-    HasMfderivWithinAt I I' f t x f' :=
-  (hasMfderivWithinAt_inter' ht).1 (h.mono (inter_subset_right _ _))
-#align has_mfderiv_within_at.nhds_within HasMfderivWithinAt.nhdsWithin
+#print HasMFDerivWithinAt.nhdsWithin /-
+theorem HasMFDerivWithinAt.nhdsWithin (h : HasMFDerivWithinAt I I' f s x f') (ht : s ∈ 𝓝[t] x) :
+    HasMFDerivWithinAt I I' f t x f' :=
+  (hasMFDerivWithinAt_inter' ht).1 (h.mono (inter_subset_right _ _))
+#align has_mfderiv_within_at.nhds_within HasMFDerivWithinAt.nhdsWithin
+-/
 
-theorem HasMfderivWithinAt.hasMfderivAt (h : HasMfderivWithinAt I I' f s x f') (hs : s ∈ 𝓝 x) :
-    HasMfderivAt I I' f x f' := by
-  rwa [← univ_inter s, hasMfderivWithinAt_inter hs, hasMfderivWithinAt_univ] at h 
-#align has_mfderiv_within_at.has_mfderiv_at HasMfderivWithinAt.hasMfderivAt
+#print HasMFDerivWithinAt.hasMFDerivAt /-
+theorem HasMFDerivWithinAt.hasMFDerivAt (h : HasMFDerivWithinAt I I' f s x f') (hs : s ∈ 𝓝 x) :
+    HasMFDerivAt I I' f x f' := by
+  rwa [← univ_inter s, hasMFDerivWithinAt_inter hs, hasMFDerivWithinAt_univ] at h 
+#align has_mfderiv_within_at.has_mfderiv_at HasMFDerivWithinAt.hasMFDerivAt
+-/
 
-theorem MdifferentiableWithinAt.hasMfderivWithinAt (h : MdifferentiableWithinAt I I' f s x) :
-    HasMfderivWithinAt I I' f s x (mfderivWithin I I' f s x) :=
+#print MDifferentiableWithinAt.hasMFDerivWithinAt /-
+theorem MDifferentiableWithinAt.hasMFDerivWithinAt (h : MDifferentiableWithinAt I I' f s x) :
+    HasMFDerivWithinAt I I' f s x (mfderivWithin I I' f s x) :=
   by
   refine' ⟨h.1, _⟩
   simp only [mfderivWithin, h, if_pos, mfld_simps]
   exact DifferentiableWithinAt.hasFDerivWithinAt h.2
-#align mdifferentiable_within_at.has_mfderiv_within_at MdifferentiableWithinAt.hasMfderivWithinAt
+#align mdifferentiable_within_at.has_mfderiv_within_at MDifferentiableWithinAt.hasMFDerivWithinAt
+-/
 
-theorem MdifferentiableWithinAt.mfderivWithin (h : MdifferentiableWithinAt I I' f s x) :
+#print MDifferentiableWithinAt.mfderivWithin /-
+theorem MDifferentiableWithinAt.mfderivWithin (h : MDifferentiableWithinAt I I' f s x) :
     mfderivWithin I I' f s x =
       fderivWithin 𝕜 (writtenInExtChartAt I I' x f : _) ((extChartAt I x).symm ⁻¹' s ∩ range I)
         ((extChartAt I x) x) :=
   by simp only [mfderivWithin, h, if_pos]
-#align mdifferentiable_within_at.mfderiv_within MdifferentiableWithinAt.mfderivWithin
+#align mdifferentiable_within_at.mfderiv_within MDifferentiableWithinAt.mfderivWithin
+-/
 
-theorem MdifferentiableAt.hasMfderivAt (h : MdifferentiableAt I I' f x) :
-    HasMfderivAt I I' f x (mfderiv I I' f x) :=
+#print MDifferentiableAt.hasMFDerivAt /-
+theorem MDifferentiableAt.hasMFDerivAt (h : MDifferentiableAt I I' f x) :
+    HasMFDerivAt I I' f x (mfderiv I I' f x) :=
   by
   refine' ⟨h.1, _⟩
   simp only [mfderiv, h, if_pos, mfld_simps]
   exact DifferentiableWithinAt.hasFDerivWithinAt h.2
-#align mdifferentiable_at.has_mfderiv_at MdifferentiableAt.hasMfderivAt
+#align mdifferentiable_at.has_mfderiv_at MDifferentiableAt.hasMFDerivAt
+-/
 
-theorem MdifferentiableAt.mfderiv (h : MdifferentiableAt I I' f x) :
+#print MDifferentiableAt.mfderiv /-
+theorem MDifferentiableAt.mfderiv (h : MDifferentiableAt I I' f x) :
     mfderiv I I' f x =
       fderivWithin 𝕜 (writtenInExtChartAt I I' x f : _) (range I) ((extChartAt I x) x) :=
   by simp only [mfderiv, h, if_pos]
-#align mdifferentiable_at.mfderiv MdifferentiableAt.mfderiv
+#align mdifferentiable_at.mfderiv MDifferentiableAt.mfderiv
+-/
 
-theorem HasMfderivAt.mfderiv (h : HasMfderivAt I I' f x f') : mfderiv I I' f x = f' :=
-  (hasMfderivAt_unique h h.MdifferentiableAt.HasMfderivAt).symm
-#align has_mfderiv_at.mfderiv HasMfderivAt.mfderiv
+#print HasMFDerivAt.mfderiv /-
+theorem HasMFDerivAt.mfderiv (h : HasMFDerivAt I I' f x f') : mfderiv I I' f x = f' :=
+  (hasMFDerivAt_unique h h.MDifferentiableAt.HasMFDerivAt).symm
+#align has_mfderiv_at.mfderiv HasMFDerivAt.mfderiv
+-/
 
-theorem HasMfderivWithinAt.mfderivWithin (h : HasMfderivWithinAt I I' f s x f')
-    (hxs : UniqueMdiffWithinAt I s x) : mfderivWithin I I' f s x = f' := by ext;
+#print HasMFDerivWithinAt.mfderivWithin /-
+theorem HasMFDerivWithinAt.mfderivWithin (h : HasMFDerivWithinAt I I' f s x f')
+    (hxs : UniqueMDiffWithinAt I s x) : mfderivWithin I I' f s x = f' := by ext;
   rw [hxs.eq h h.mdifferentiable_within_at.has_mfderiv_within_at]
-#align has_mfderiv_within_at.mfderiv_within HasMfderivWithinAt.mfderivWithin
+#align has_mfderiv_within_at.mfderiv_within HasMFDerivWithinAt.mfderivWithin
+-/
 
-theorem Mdifferentiable.mfderivWithin (h : MdifferentiableAt I I' f x)
-    (hxs : UniqueMdiffWithinAt I s x) : mfderivWithin I I' f s x = mfderiv I I' f x :=
+#print MDifferentiable.mfderivWithin /-
+theorem MDifferentiable.mfderivWithin (h : MDifferentiableAt I I' f x)
+    (hxs : UniqueMDiffWithinAt I s x) : mfderivWithin I I' f s x = mfderiv I I' f x :=
   by
-  apply HasMfderivWithinAt.mfderivWithin _ hxs
+  apply HasMFDerivWithinAt.mfderivWithin _ hxs
   exact h.has_mfderiv_at.has_mfderiv_within_at
-#align mdifferentiable.mfderiv_within Mdifferentiable.mfderivWithin
+#align mdifferentiable.mfderiv_within MDifferentiable.mfderivWithin
+-/
 
-theorem mfderivWithin_subset (st : s ⊆ t) (hs : UniqueMdiffWithinAt I s x)
-    (h : MdifferentiableWithinAt I I' f t x) :
+#print mfderivWithin_subset /-
+theorem mfderivWithin_subset (st : s ⊆ t) (hs : UniqueMDiffWithinAt I s x)
+    (h : MDifferentiableWithinAt I I' f t x) :
     mfderivWithin I I' f s x = mfderivWithin I I' f t x :=
-  ((MdifferentiableWithinAt.hasMfderivWithinAt h).mono st).mfderivWithin hs
+  ((MDifferentiableWithinAt.hasMFDerivWithinAt h).mono st).mfderivWithin hs
 #align mfderiv_within_subset mfderivWithin_subset
+-/
 
-theorem MdifferentiableWithinAt.mono (hst : s ⊆ t) (h : MdifferentiableWithinAt I I' f t x) :
-    MdifferentiableWithinAt I I' f s x :=
+#print MDifferentiableWithinAt.mono /-
+theorem MDifferentiableWithinAt.mono (hst : s ⊆ t) (h : MDifferentiableWithinAt I I' f t x) :
+    MDifferentiableWithinAt I I' f s x :=
   ⟨ContinuousWithinAt.mono h.1 hst,
     DifferentiableWithinAt.mono h.2 (inter_subset_inter (preimage_mono hst) (Subset.refl _))⟩
-#align mdifferentiable_within_at.mono MdifferentiableWithinAt.mono
+#align mdifferentiable_within_at.mono MDifferentiableWithinAt.mono
+-/
 
+#print mdifferentiableWithinAt_univ /-
 theorem mdifferentiableWithinAt_univ :
-    MdifferentiableWithinAt I I' f univ x ↔ MdifferentiableAt I I' f x := by
-  simp only [MdifferentiableWithinAt, MdifferentiableAt, continuousWithinAt_univ, mfld_simps]
+    MDifferentiableWithinAt I I' f univ x ↔ MDifferentiableAt I I' f x := by
+  simp only [MDifferentiableWithinAt, MDifferentiableAt, continuousWithinAt_univ, mfld_simps]
 #align mdifferentiable_within_at_univ mdifferentiableWithinAt_univ
+-/
 
+#print mdifferentiableWithinAt_inter /-
 theorem mdifferentiableWithinAt_inter (ht : t ∈ 𝓝 x) :
-    MdifferentiableWithinAt I I' f (s ∩ t) x ↔ MdifferentiableWithinAt I I' f s x :=
+    MDifferentiableWithinAt I I' f (s ∩ t) x ↔ MDifferentiableWithinAt I I' f s x :=
   by
-  rw [MdifferentiableWithinAt, MdifferentiableWithinAt, extChartAt_preimage_inter_eq,
+  rw [MDifferentiableWithinAt, MDifferentiableWithinAt, extChartAt_preimage_inter_eq,
     differentiableWithinAt_inter, continuousWithinAt_inter ht]
   exact extChartAt_preimage_mem_nhds I x ht
 #align mdifferentiable_within_at_inter mdifferentiableWithinAt_inter
+-/
 
+#print mdifferentiableWithinAt_inter' /-
 theorem mdifferentiableWithinAt_inter' (ht : t ∈ 𝓝[s] x) :
-    MdifferentiableWithinAt I I' f (s ∩ t) x ↔ MdifferentiableWithinAt I I' f s x :=
+    MDifferentiableWithinAt I I' f (s ∩ t) x ↔ MDifferentiableWithinAt I I' f s x :=
   by
-  rw [MdifferentiableWithinAt, MdifferentiableWithinAt, extChartAt_preimage_inter_eq,
+  rw [MDifferentiableWithinAt, MDifferentiableWithinAt, extChartAt_preimage_inter_eq,
     differentiableWithinAt_inter', continuousWithinAt_inter' ht]
   exact extChartAt_preimage_mem_nhdsWithin I x ht
 #align mdifferentiable_within_at_inter' mdifferentiableWithinAt_inter'
+-/
 
-theorem MdifferentiableAt.mdifferentiableWithinAt (h : MdifferentiableAt I I' f x) :
-    MdifferentiableWithinAt I I' f s x :=
-  MdifferentiableWithinAt.mono (subset_univ _) (mdifferentiableWithinAt_univ.2 h)
-#align mdifferentiable_at.mdifferentiable_within_at MdifferentiableAt.mdifferentiableWithinAt
+#print MDifferentiableAt.mdifferentiableWithinAt /-
+theorem MDifferentiableAt.mdifferentiableWithinAt (h : MDifferentiableAt I I' f x) :
+    MDifferentiableWithinAt I I' f s x :=
+  MDifferentiableWithinAt.mono (subset_univ _) (mdifferentiableWithinAt_univ.2 h)
+#align mdifferentiable_at.mdifferentiable_within_at MDifferentiableAt.mdifferentiableWithinAt
+-/
 
-theorem MdifferentiableWithinAt.mdifferentiableAt (h : MdifferentiableWithinAt I I' f s x)
-    (hs : s ∈ 𝓝 x) : MdifferentiableAt I I' f x :=
+#print MDifferentiableWithinAt.mdifferentiableAt /-
+theorem MDifferentiableWithinAt.mdifferentiableAt (h : MDifferentiableWithinAt I I' f s x)
+    (hs : s ∈ 𝓝 x) : MDifferentiableAt I I' f x :=
   by
   have : s = univ ∩ s := by rw [univ_inter]
   rwa [this, mdifferentiableWithinAt_inter hs, mdifferentiableWithinAt_univ] at h 
-#align mdifferentiable_within_at.mdifferentiable_at MdifferentiableWithinAt.mdifferentiableAt
+#align mdifferentiable_within_at.mdifferentiable_at MDifferentiableWithinAt.mdifferentiableAt
+-/
 
-theorem MdifferentiableOn.mono (h : MdifferentiableOn I I' f t) (st : s ⊆ t) :
-    MdifferentiableOn I I' f s := fun x hx => (h x (st hx)).mono st
-#align mdifferentiable_on.mono MdifferentiableOn.mono
+#print MDifferentiableOn.mono /-
+theorem MDifferentiableOn.mono (h : MDifferentiableOn I I' f t) (st : s ⊆ t) :
+    MDifferentiableOn I I' f s := fun x hx => (h x (st hx)).mono st
+#align mdifferentiable_on.mono MDifferentiableOn.mono
+-/
 
-theorem mdifferentiableOn_univ : MdifferentiableOn I I' f univ ↔ Mdifferentiable I I' f := by
-  simp only [MdifferentiableOn, mdifferentiableWithinAt_univ, mfld_simps]; rfl
+#print mdifferentiableOn_univ /-
+theorem mdifferentiableOn_univ : MDifferentiableOn I I' f univ ↔ MDifferentiable I I' f := by
+  simp only [MDifferentiableOn, mdifferentiableWithinAt_univ, mfld_simps]; rfl
 #align mdifferentiable_on_univ mdifferentiableOn_univ
+-/
 
-theorem Mdifferentiable.mdifferentiableOn (h : Mdifferentiable I I' f) :
-    MdifferentiableOn I I' f s :=
+#print MDifferentiable.mdifferentiableOn /-
+theorem MDifferentiable.mdifferentiableOn (h : MDifferentiable I I' f) :
+    MDifferentiableOn I I' f s :=
   (mdifferentiableOn_univ.2 h).mono (subset_univ _)
-#align mdifferentiable.mdifferentiable_on Mdifferentiable.mdifferentiableOn
+#align mdifferentiable.mdifferentiable_on MDifferentiable.mdifferentiableOn
+-/
 
+#print mdifferentiableOn_of_locally_mdifferentiableOn /-
 theorem mdifferentiableOn_of_locally_mdifferentiableOn
-    (h : ∀ x ∈ s, ∃ u, IsOpen u ∧ x ∈ u ∧ MdifferentiableOn I I' f (s ∩ u)) :
-    MdifferentiableOn I I' f s := by
+    (h : ∀ x ∈ s, ∃ u, IsOpen u ∧ x ∈ u ∧ MDifferentiableOn I I' f (s ∩ u)) :
+    MDifferentiableOn I I' f s := by
   intro x xs
   rcases h x xs with ⟨t, t_open, xt, ht⟩
   exact (mdifferentiableWithinAt_inter (IsOpen.mem_nhds t_open xt)).1 (ht x ⟨xs, xt⟩)
 #align mdifferentiable_on_of_locally_mdifferentiable_on mdifferentiableOn_of_locally_mdifferentiableOn
+-/
 
+#print mfderivWithin_univ /-
 @[simp, mfld_simps]
 theorem mfderivWithin_univ : mfderivWithin I I' f univ = mfderiv I I' f :=
   by
@@ -631,16 +754,20 @@ theorem mfderivWithin_univ : mfderivWithin I I' f univ = mfderiv I I' f :=
   simp only [mfderivWithin, mfderiv, mfld_simps]
   rw [mdifferentiableWithinAt_univ]
 #align mfderiv_within_univ mfderivWithin_univ
+-/
 
+#print mfderivWithin_inter /-
 theorem mfderivWithin_inter (ht : t ∈ 𝓝 x) :
     mfderivWithin I I' f (s ∩ t) x = mfderivWithin I I' f s x := by
   rw [mfderivWithin, mfderivWithin, extChartAt_preimage_inter_eq, mdifferentiableWithinAt_inter ht,
     fderivWithin_inter (extChartAt_preimage_mem_nhds I x ht)]
 #align mfderiv_within_inter mfderivWithin_inter
+-/
 
+#print mdifferentiableAt_iff_of_mem_source /-
 theorem mdifferentiableAt_iff_of_mem_source {x' : M} {y : M'}
     (hx : x' ∈ (ChartedSpace.chartAt H x).source) (hy : f x' ∈ (ChartedSpace.chartAt H' y).source) :
-    MdifferentiableAt I I' f x' ↔
+    MDifferentiableAt I I' f x' ↔
       ContinuousAt f x' ∧
         DifferentiableWithinAt 𝕜 (extChartAt I' y ∘ f ∘ (extChartAt I x).symm) (Set.range I)
           ((extChartAt I x) x') :=
@@ -648,129 +775,173 @@ theorem mdifferentiableAt_iff_of_mem_source {x' : M} {y : M'}
     (mdifferentiableWithinAt_iff_of_mem_source hx hy).trans <| by
       rw [continuousWithinAt_univ, Set.preimage_univ, Set.univ_inter]
 #align mdifferentiable_at_iff_of_mem_source mdifferentiableAt_iff_of_mem_source
+-/
 
 /-! ### Deriving continuity from differentiability on manifolds -/
 
 
-theorem HasMfderivWithinAt.continuousWithinAt (h : HasMfderivWithinAt I I' f s x f') :
+#print HasMFDerivWithinAt.continuousWithinAt /-
+theorem HasMFDerivWithinAt.continuousWithinAt (h : HasMFDerivWithinAt I I' f s x f') :
     ContinuousWithinAt f s x :=
   h.1
-#align has_mfderiv_within_at.continuous_within_at HasMfderivWithinAt.continuousWithinAt
+#align has_mfderiv_within_at.continuous_within_at HasMFDerivWithinAt.continuousWithinAt
+-/
 
-theorem HasMfderivAt.continuousAt (h : HasMfderivAt I I' f x f') : ContinuousAt f x :=
+#print HasMFDerivAt.continuousAt /-
+theorem HasMFDerivAt.continuousAt (h : HasMFDerivAt I I' f x f') : ContinuousAt f x :=
   h.1
-#align has_mfderiv_at.continuous_at HasMfderivAt.continuousAt
+#align has_mfderiv_at.continuous_at HasMFDerivAt.continuousAt
+-/
 
-theorem MdifferentiableWithinAt.continuousWithinAt (h : MdifferentiableWithinAt I I' f s x) :
+#print MDifferentiableWithinAt.continuousWithinAt /-
+theorem MDifferentiableWithinAt.continuousWithinAt (h : MDifferentiableWithinAt I I' f s x) :
     ContinuousWithinAt f s x :=
   h.1
-#align mdifferentiable_within_at.continuous_within_at MdifferentiableWithinAt.continuousWithinAt
+#align mdifferentiable_within_at.continuous_within_at MDifferentiableWithinAt.continuousWithinAt
+-/
 
-theorem MdifferentiableAt.continuousAt (h : MdifferentiableAt I I' f x) : ContinuousAt f x :=
+#print MDifferentiableAt.continuousAt /-
+theorem MDifferentiableAt.continuousAt (h : MDifferentiableAt I I' f x) : ContinuousAt f x :=
   h.1
-#align mdifferentiable_at.continuous_at MdifferentiableAt.continuousAt
+#align mdifferentiable_at.continuous_at MDifferentiableAt.continuousAt
+-/
 
-theorem MdifferentiableOn.continuousOn (h : MdifferentiableOn I I' f s) : ContinuousOn f s :=
+#print MDifferentiableOn.continuousOn /-
+theorem MDifferentiableOn.continuousOn (h : MDifferentiableOn I I' f s) : ContinuousOn f s :=
   fun x hx => (h x hx).ContinuousWithinAt
-#align mdifferentiable_on.continuous_on MdifferentiableOn.continuousOn
+#align mdifferentiable_on.continuous_on MDifferentiableOn.continuousOn
+-/
 
-theorem Mdifferentiable.continuous (h : Mdifferentiable I I' f) : Continuous f :=
+#print MDifferentiable.continuous /-
+theorem MDifferentiable.continuous (h : MDifferentiable I I' f) : Continuous f :=
   continuous_iff_continuousAt.2 fun x => (h x).ContinuousAt
-#align mdifferentiable.continuous Mdifferentiable.continuous
+#align mdifferentiable.continuous MDifferentiable.continuous
+-/
 
+#print tangentMapWithin_subset /-
 theorem tangentMapWithin_subset {p : TangentBundle I M} (st : s ⊆ t)
-    (hs : UniqueMdiffWithinAt I s p.1) (h : MdifferentiableWithinAt I I' f t p.1) :
+    (hs : UniqueMDiffWithinAt I s p.1) (h : MDifferentiableWithinAt I I' f t p.1) :
     tangentMapWithin I I' f s p = tangentMapWithin I I' f t p :=
   by
   simp only [tangentMapWithin, mfld_simps]
   rw [mfderivWithin_subset st hs h]
 #align tangent_map_within_subset tangentMapWithin_subset
+-/
 
+#print tangentMapWithin_univ /-
 theorem tangentMapWithin_univ : tangentMapWithin I I' f univ = tangentMap I I' f := by ext p : 1;
   simp only [tangentMapWithin, tangentMap, mfld_simps]
 #align tangent_map_within_univ tangentMapWithin_univ
+-/
 
-theorem tangentMapWithin_eq_tangentMap {p : TangentBundle I M} (hs : UniqueMdiffWithinAt I s p.1)
-    (h : MdifferentiableAt I I' f p.1) : tangentMapWithin I I' f s p = tangentMap I I' f p :=
+#print tangentMapWithin_eq_tangentMap /-
+theorem tangentMapWithin_eq_tangentMap {p : TangentBundle I M} (hs : UniqueMDiffWithinAt I s p.1)
+    (h : MDifferentiableAt I I' f p.1) : tangentMapWithin I I' f s p = tangentMap I I' f p :=
   by
   rw [← mdifferentiableWithinAt_univ] at h 
   rw [← tangentMapWithin_univ]
   exact tangentMapWithin_subset (subset_univ _) hs h
 #align tangent_map_within_eq_tangent_map tangentMapWithin_eq_tangentMap
+-/
 
+#print tangentMapWithin_proj /-
 @[simp, mfld_simps]
 theorem tangentMapWithin_proj {p : TangentBundle I M} :
     (tangentMapWithin I I' f s p).proj = f p.proj :=
   rfl
 #align tangent_map_within_proj tangentMapWithin_proj
+-/
 
+#print tangentMapWithin_fst /-
 @[simp, mfld_simps]
 theorem tangentMapWithin_fst {p : TangentBundle I M} : (tangentMapWithin I I' f s p).1 = f p.1 :=
   rfl
 #align tangent_map_within_fst tangentMapWithin_fst
+-/
 
+#print tangentMap_proj /-
 @[simp, mfld_simps]
 theorem tangentMap_proj {p : TangentBundle I M} : (tangentMap I I' f p).proj = f p.proj :=
   rfl
 #align tangent_map_proj tangentMap_proj
+-/
 
+#print tangentMap_fst /-
 @[simp, mfld_simps]
 theorem tangentMap_fst {p : TangentBundle I M} : (tangentMap I I' f p).1 = f p.1 :=
   rfl
 #align tangent_map_fst tangentMap_fst
+-/
 
-theorem MdifferentiableWithinAt.prod_mk {f : M → M'} {g : M → M''}
-    (hf : MdifferentiableWithinAt I I' f s x) (hg : MdifferentiableWithinAt I I'' g s x) :
-    MdifferentiableWithinAt I (I'.Prod I'') (fun x => (f x, g x)) s x :=
+#print MDifferentiableWithinAt.prod_mk /-
+theorem MDifferentiableWithinAt.prod_mk {f : M → M'} {g : M → M''}
+    (hf : MDifferentiableWithinAt I I' f s x) (hg : MDifferentiableWithinAt I I'' g s x) :
+    MDifferentiableWithinAt I (I'.Prod I'') (fun x => (f x, g x)) s x :=
   ⟨hf.1.Prod hg.1, hf.2.Prod hg.2⟩
-#align mdifferentiable_within_at.prod_mk MdifferentiableWithinAt.prod_mk
+#align mdifferentiable_within_at.prod_mk MDifferentiableWithinAt.prod_mk
+-/
 
-theorem MdifferentiableAt.prod_mk {f : M → M'} {g : M → M''} (hf : MdifferentiableAt I I' f x)
-    (hg : MdifferentiableAt I I'' g x) :
-    MdifferentiableAt I (I'.Prod I'') (fun x => (f x, g x)) x :=
+#print MDifferentiableAt.prod_mk /-
+theorem MDifferentiableAt.prod_mk {f : M → M'} {g : M → M''} (hf : MDifferentiableAt I I' f x)
+    (hg : MDifferentiableAt I I'' g x) :
+    MDifferentiableAt I (I'.Prod I'') (fun x => (f x, g x)) x :=
   ⟨hf.1.Prod hg.1, hf.2.Prod hg.2⟩
-#align mdifferentiable_at.prod_mk MdifferentiableAt.prod_mk
+#align mdifferentiable_at.prod_mk MDifferentiableAt.prod_mk
+-/
 
-theorem MdifferentiableOn.prod_mk {f : M → M'} {g : M → M''} (hf : MdifferentiableOn I I' f s)
-    (hg : MdifferentiableOn I I'' g s) :
-    MdifferentiableOn I (I'.Prod I'') (fun x => (f x, g x)) s := fun x hx =>
+#print MDifferentiableOn.prod_mk /-
+theorem MDifferentiableOn.prod_mk {f : M → M'} {g : M → M''} (hf : MDifferentiableOn I I' f s)
+    (hg : MDifferentiableOn I I'' g s) :
+    MDifferentiableOn I (I'.Prod I'') (fun x => (f x, g x)) s := fun x hx =>
   (hf x hx).prod_mk (hg x hx)
-#align mdifferentiable_on.prod_mk MdifferentiableOn.prod_mk
+#align mdifferentiable_on.prod_mk MDifferentiableOn.prod_mk
+-/
 
-theorem Mdifferentiable.prod_mk {f : M → M'} {g : M → M''} (hf : Mdifferentiable I I' f)
-    (hg : Mdifferentiable I I'' g) : Mdifferentiable I (I'.Prod I'') fun x => (f x, g x) := fun x =>
+#print MDifferentiable.prod_mk /-
+theorem MDifferentiable.prod_mk {f : M → M'} {g : M → M''} (hf : MDifferentiable I I' f)
+    (hg : MDifferentiable I I'' g) : MDifferentiable I (I'.Prod I'') fun x => (f x, g x) := fun x =>
   (hf x).prod_mk (hg x)
-#align mdifferentiable.prod_mk Mdifferentiable.prod_mk
+#align mdifferentiable.prod_mk MDifferentiable.prod_mk
+-/
 
-theorem MdifferentiableWithinAt.prod_mk_space {f : M → E'} {g : M → E''}
-    (hf : MdifferentiableWithinAt I 𝓘(𝕜, E') f s x)
-    (hg : MdifferentiableWithinAt I 𝓘(𝕜, E'') g s x) :
-    MdifferentiableWithinAt I 𝓘(𝕜, E' × E'') (fun x => (f x, g x)) s x :=
+#print MDifferentiableWithinAt.prod_mk_space /-
+theorem MDifferentiableWithinAt.prod_mk_space {f : M → E'} {g : M → E''}
+    (hf : MDifferentiableWithinAt I 𝓘(𝕜, E') f s x)
+    (hg : MDifferentiableWithinAt I 𝓘(𝕜, E'') g s x) :
+    MDifferentiableWithinAt I 𝓘(𝕜, E' × E'') (fun x => (f x, g x)) s x :=
   ⟨hf.1.Prod hg.1, hf.2.Prod hg.2⟩
-#align mdifferentiable_within_at.prod_mk_space MdifferentiableWithinAt.prod_mk_space
+#align mdifferentiable_within_at.prod_mk_space MDifferentiableWithinAt.prod_mk_space
+-/
 
-theorem MdifferentiableAt.prod_mk_space {f : M → E'} {g : M → E''}
-    (hf : MdifferentiableAt I 𝓘(𝕜, E') f x) (hg : MdifferentiableAt I 𝓘(𝕜, E'') g x) :
-    MdifferentiableAt I 𝓘(𝕜, E' × E'') (fun x => (f x, g x)) x :=
+#print MDifferentiableAt.prod_mk_space /-
+theorem MDifferentiableAt.prod_mk_space {f : M → E'} {g : M → E''}
+    (hf : MDifferentiableAt I 𝓘(𝕜, E') f x) (hg : MDifferentiableAt I 𝓘(𝕜, E'') g x) :
+    MDifferentiableAt I 𝓘(𝕜, E' × E'') (fun x => (f x, g x)) x :=
   ⟨hf.1.Prod hg.1, hf.2.Prod hg.2⟩
-#align mdifferentiable_at.prod_mk_space MdifferentiableAt.prod_mk_space
+#align mdifferentiable_at.prod_mk_space MDifferentiableAt.prod_mk_space
+-/
 
-theorem MdifferentiableOn.prod_mk_space {f : M → E'} {g : M → E''}
-    (hf : MdifferentiableOn I 𝓘(𝕜, E') f s) (hg : MdifferentiableOn I 𝓘(𝕜, E'') g s) :
-    MdifferentiableOn I 𝓘(𝕜, E' × E'') (fun x => (f x, g x)) s := fun x hx =>
+#print MDifferentiableOn.prod_mk_space /-
+theorem MDifferentiableOn.prod_mk_space {f : M → E'} {g : M → E''}
+    (hf : MDifferentiableOn I 𝓘(𝕜, E') f s) (hg : MDifferentiableOn I 𝓘(𝕜, E'') g s) :
+    MDifferentiableOn I 𝓘(𝕜, E' × E'') (fun x => (f x, g x)) s := fun x hx =>
   (hf x hx).prod_mk_space (hg x hx)
-#align mdifferentiable_on.prod_mk_space MdifferentiableOn.prod_mk_space
+#align mdifferentiable_on.prod_mk_space MDifferentiableOn.prod_mk_space
+-/
 
-theorem Mdifferentiable.prod_mk_space {f : M → E'} {g : M → E''} (hf : Mdifferentiable I 𝓘(𝕜, E') f)
-    (hg : Mdifferentiable I 𝓘(𝕜, E'') g) : Mdifferentiable I 𝓘(𝕜, E' × E'') fun x => (f x, g x) :=
+#print MDifferentiable.prod_mk_space /-
+theorem MDifferentiable.prod_mk_space {f : M → E'} {g : M → E''} (hf : MDifferentiable I 𝓘(𝕜, E') f)
+    (hg : MDifferentiable I 𝓘(𝕜, E'') g) : MDifferentiable I 𝓘(𝕜, E' × E'') fun x => (f x, g x) :=
   fun x => (hf x).prod_mk_space (hg x)
-#align mdifferentiable.prod_mk_space Mdifferentiable.prod_mk_space
+#align mdifferentiable.prod_mk_space MDifferentiable.prod_mk_space
+-/
 
 /-! ### Congruence lemmas for derivatives on manifolds -/
 
 
-theorem HasMfderivWithinAt.congr_of_eventuallyEq (h : HasMfderivWithinAt I I' f s x f')
-    (h₁ : f₁ =ᶠ[𝓝[s] x] f) (hx : f₁ x = f x) : HasMfderivWithinAt I I' f₁ s x f' :=
+#print HasMFDerivWithinAt.congr_of_eventuallyEq /-
+theorem HasMFDerivWithinAt.congr_of_eventuallyEq (h : HasMFDerivWithinAt I I' f s x f')
+    (h₁ : f₁ =ᶠ[𝓝[s] x] f) (hx : f₁ x = f x) : HasMFDerivWithinAt I I' f₁ s x f' :=
   by
   refine' ⟨ContinuousWithinAt.congr_of_eventuallyEq h.1 h₁ hx, _⟩
   apply HasFDerivWithinAt.congr_of_eventuallyEq h.2
@@ -781,30 +952,38 @@ theorem HasMfderivWithinAt.congr_of_eventuallyEq (h : HasMfderivWithinAt I I' f
     apply Filter.mem_of_superset this fun y => _
     simp (config := { contextual := true }) only [hx, mfld_simps]
   · simp only [hx, mfld_simps]
-#align has_mfderiv_within_at.congr_of_eventually_eq HasMfderivWithinAt.congr_of_eventuallyEq
+#align has_mfderiv_within_at.congr_of_eventually_eq HasMFDerivWithinAt.congr_of_eventuallyEq
+-/
 
-theorem HasMfderivWithinAt.congr_mono (h : HasMfderivWithinAt I I' f s x f')
-    (ht : ∀ x ∈ t, f₁ x = f x) (hx : f₁ x = f x) (h₁ : t ⊆ s) : HasMfderivWithinAt I I' f₁ t x f' :=
+#print HasMFDerivWithinAt.congr_mono /-
+theorem HasMFDerivWithinAt.congr_mono (h : HasMFDerivWithinAt I I' f s x f')
+    (ht : ∀ x ∈ t, f₁ x = f x) (hx : f₁ x = f x) (h₁ : t ⊆ s) : HasMFDerivWithinAt I I' f₁ t x f' :=
   (h.mono h₁).congr_of_eventuallyEq (Filter.mem_inf_of_right ht) hx
-#align has_mfderiv_within_at.congr_mono HasMfderivWithinAt.congr_mono
+#align has_mfderiv_within_at.congr_mono HasMFDerivWithinAt.congr_mono
+-/
 
-theorem HasMfderivAt.congr_of_eventuallyEq (h : HasMfderivAt I I' f x f') (h₁ : f₁ =ᶠ[𝓝 x] f) :
-    HasMfderivAt I I' f₁ x f' :=
+#print HasMFDerivAt.congr_of_eventuallyEq /-
+theorem HasMFDerivAt.congr_of_eventuallyEq (h : HasMFDerivAt I I' f x f') (h₁ : f₁ =ᶠ[𝓝 x] f) :
+    HasMFDerivAt I I' f₁ x f' :=
   by
-  rw [← hasMfderivWithinAt_univ] at h ⊢
+  rw [← hasMFDerivWithinAt_univ] at h ⊢
   apply h.congr_of_eventually_eq _ (mem_of_mem_nhds h₁ : _)
   rwa [nhdsWithin_univ]
-#align has_mfderiv_at.congr_of_eventually_eq HasMfderivAt.congr_of_eventuallyEq
+#align has_mfderiv_at.congr_of_eventually_eq HasMFDerivAt.congr_of_eventuallyEq
+-/
 
-theorem MdifferentiableWithinAt.congr_of_eventuallyEq (h : MdifferentiableWithinAt I I' f s x)
-    (h₁ : f₁ =ᶠ[𝓝[s] x] f) (hx : f₁ x = f x) : MdifferentiableWithinAt I I' f₁ s x :=
-  (h.HasMfderivWithinAt.congr_of_eventuallyEq h₁ hx).MdifferentiableWithinAt
-#align mdifferentiable_within_at.congr_of_eventually_eq MdifferentiableWithinAt.congr_of_eventuallyEq
+#print MDifferentiableWithinAt.congr_of_eventuallyEq /-
+theorem MDifferentiableWithinAt.congr_of_eventuallyEq (h : MDifferentiableWithinAt I I' f s x)
+    (h₁ : f₁ =ᶠ[𝓝[s] x] f) (hx : f₁ x = f x) : MDifferentiableWithinAt I I' f₁ s x :=
+  (h.HasMFDerivWithinAt.congr_of_eventuallyEq h₁ hx).MDifferentiableWithinAt
+#align mdifferentiable_within_at.congr_of_eventually_eq MDifferentiableWithinAt.congr_of_eventuallyEq
+-/
 
 variable (I I')
 
+#print Filter.EventuallyEq.mdifferentiableWithinAt_iff /-
 theorem Filter.EventuallyEq.mdifferentiableWithinAt_iff (h₁ : f₁ =ᶠ[𝓝[s] x] f) (hx : f₁ x = f x) :
-    MdifferentiableWithinAt I I' f s x ↔ MdifferentiableWithinAt I I' f₁ s x :=
+    MDifferentiableWithinAt I I' f s x ↔ MDifferentiableWithinAt I I' f₁ s x :=
   by
   constructor
   · intro h
@@ -815,53 +994,69 @@ theorem Filter.EventuallyEq.mdifferentiableWithinAt_iff (h₁ : f₁ =ᶠ[𝓝[s
     intro y
     apply Eq.symm
 #align filter.eventually_eq.mdifferentiable_within_at_iff Filter.EventuallyEq.mdifferentiableWithinAt_iff
+-/
 
 variable {I I'}
 
-theorem MdifferentiableWithinAt.congr_mono (h : MdifferentiableWithinAt I I' f s x)
+#print MDifferentiableWithinAt.congr_mono /-
+theorem MDifferentiableWithinAt.congr_mono (h : MDifferentiableWithinAt I I' f s x)
     (ht : ∀ x ∈ t, f₁ x = f x) (hx : f₁ x = f x) (h₁ : t ⊆ s) :
-    MdifferentiableWithinAt I I' f₁ t x :=
-  (HasMfderivWithinAt.congr_mono h.HasMfderivWithinAt ht hx h₁).MdifferentiableWithinAt
-#align mdifferentiable_within_at.congr_mono MdifferentiableWithinAt.congr_mono
+    MDifferentiableWithinAt I I' f₁ t x :=
+  (HasMFDerivWithinAt.congr_mono h.HasMFDerivWithinAt ht hx h₁).MDifferentiableWithinAt
+#align mdifferentiable_within_at.congr_mono MDifferentiableWithinAt.congr_mono
+-/
 
-theorem MdifferentiableWithinAt.congr (h : MdifferentiableWithinAt I I' f s x)
-    (ht : ∀ x ∈ s, f₁ x = f x) (hx : f₁ x = f x) : MdifferentiableWithinAt I I' f₁ s x :=
-  (HasMfderivWithinAt.congr_mono h.HasMfderivWithinAt ht hx (Subset.refl _)).MdifferentiableWithinAt
-#align mdifferentiable_within_at.congr MdifferentiableWithinAt.congr
+#print MDifferentiableWithinAt.congr /-
+theorem MDifferentiableWithinAt.congr (h : MDifferentiableWithinAt I I' f s x)
+    (ht : ∀ x ∈ s, f₁ x = f x) (hx : f₁ x = f x) : MDifferentiableWithinAt I I' f₁ s x :=
+  (HasMFDerivWithinAt.congr_mono h.HasMFDerivWithinAt ht hx (Subset.refl _)).MDifferentiableWithinAt
+#align mdifferentiable_within_at.congr MDifferentiableWithinAt.congr
+-/
 
-theorem MdifferentiableOn.congr_mono (h : MdifferentiableOn I I' f s) (h' : ∀ x ∈ t, f₁ x = f x)
-    (h₁ : t ⊆ s) : MdifferentiableOn I I' f₁ t := fun x hx =>
+#print MDifferentiableOn.congr_mono /-
+theorem MDifferentiableOn.congr_mono (h : MDifferentiableOn I I' f s) (h' : ∀ x ∈ t, f₁ x = f x)
+    (h₁ : t ⊆ s) : MDifferentiableOn I I' f₁ t := fun x hx =>
   (h x (h₁ hx)).congr_mono h' (h' x hx) h₁
-#align mdifferentiable_on.congr_mono MdifferentiableOn.congr_mono
+#align mdifferentiable_on.congr_mono MDifferentiableOn.congr_mono
+-/
 
-theorem MdifferentiableAt.congr_of_eventuallyEq (h : MdifferentiableAt I I' f x)
-    (hL : f₁ =ᶠ[𝓝 x] f) : MdifferentiableAt I I' f₁ x :=
-  (h.HasMfderivAt.congr_of_eventuallyEq hL).MdifferentiableAt
-#align mdifferentiable_at.congr_of_eventually_eq MdifferentiableAt.congr_of_eventuallyEq
+#print MDifferentiableAt.congr_of_eventuallyEq /-
+theorem MDifferentiableAt.congr_of_eventuallyEq (h : MDifferentiableAt I I' f x)
+    (hL : f₁ =ᶠ[𝓝 x] f) : MDifferentiableAt I I' f₁ x :=
+  (h.HasMFDerivAt.congr_of_eventuallyEq hL).MDifferentiableAt
+#align mdifferentiable_at.congr_of_eventually_eq MDifferentiableAt.congr_of_eventuallyEq
+-/
 
-theorem MdifferentiableWithinAt.mfderivWithin_congr_mono (h : MdifferentiableWithinAt I I' f s x)
-    (hs : ∀ x ∈ t, f₁ x = f x) (hx : f₁ x = f x) (hxt : UniqueMdiffWithinAt I t x) (h₁ : t ⊆ s) :
+#print MDifferentiableWithinAt.mfderivWithin_congr_mono /-
+theorem MDifferentiableWithinAt.mfderivWithin_congr_mono (h : MDifferentiableWithinAt I I' f s x)
+    (hs : ∀ x ∈ t, f₁ x = f x) (hx : f₁ x = f x) (hxt : UniqueMDiffWithinAt I t x) (h₁ : t ⊆ s) :
     mfderivWithin I I' f₁ t x = (mfderivWithin I I' f s x : _) :=
-  (HasMfderivWithinAt.congr_mono h.HasMfderivWithinAt hs hx h₁).mfderivWithin hxt
-#align mdifferentiable_within_at.mfderiv_within_congr_mono MdifferentiableWithinAt.mfderivWithin_congr_mono
+  (HasMFDerivWithinAt.congr_mono h.HasMFDerivWithinAt hs hx h₁).mfderivWithin hxt
+#align mdifferentiable_within_at.mfderiv_within_congr_mono MDifferentiableWithinAt.mfderivWithin_congr_mono
+-/
 
-theorem Filter.EventuallyEq.mfderivWithin_eq (hs : UniqueMdiffWithinAt I s x) (hL : f₁ =ᶠ[𝓝[s] x] f)
+#print Filter.EventuallyEq.mfderivWithin_eq /-
+theorem Filter.EventuallyEq.mfderivWithin_eq (hs : UniqueMDiffWithinAt I s x) (hL : f₁ =ᶠ[𝓝[s] x] f)
     (hx : f₁ x = f x) : mfderivWithin I I' f₁ s x = (mfderivWithin I I' f s x : _) :=
   by
-  by_cases h : MdifferentiableWithinAt I I' f s x
+  by_cases h : MDifferentiableWithinAt I I' f s x
   · exact (h.has_mfderiv_within_at.congr_of_eventuallyEq hL hx).mfderivWithin hs
   · unfold mfderivWithin
     rw [if_neg h, if_neg]
     rwa [← hL.mdifferentiable_within_at_iff I I' hx]
 #align filter.eventually_eq.mfderiv_within_eq Filter.EventuallyEq.mfderivWithin_eq
+-/
 
-theorem mfderivWithin_congr (hs : UniqueMdiffWithinAt I s x) (hL : ∀ x ∈ s, f₁ x = f x)
+#print mfderivWithin_congr /-
+theorem mfderivWithin_congr (hs : UniqueMDiffWithinAt I s x) (hL : ∀ x ∈ s, f₁ x = f x)
     (hx : f₁ x = f x) : mfderivWithin I I' f₁ s x = (mfderivWithin I I' f s x : _) :=
   Filter.EventuallyEq.mfderivWithin_eq hs (Filter.eventuallyEq_of_mem self_mem_nhdsWithin hL) hx
 #align mfderiv_within_congr mfderivWithin_congr
+-/
 
+#print tangentMapWithin_congr /-
 theorem tangentMapWithin_congr (h : ∀ x ∈ s, f x = f₁ x) (p : TangentBundle I M) (hp : p.1 ∈ s)
-    (hs : UniqueMdiffWithinAt I s p.1) :
+    (hs : UniqueMDiffWithinAt I s p.1) :
     tangentMapWithin I I' f s p = tangentMapWithin I I' f₁ s p :=
   by
   simp only [tangentMapWithin, h p.fst hp, true_and_iff, eq_self_iff_true, heq_iff_eq,
@@ -869,32 +1064,40 @@ theorem tangentMapWithin_congr (h : ∀ x ∈ s, f x = f₁ x) (p : TangentBundl
   congr 1
   exact mfderivWithin_congr hs h (h _ hp)
 #align tangent_map_within_congr tangentMapWithin_congr
+-/
 
+#print Filter.EventuallyEq.mfderiv_eq /-
 theorem Filter.EventuallyEq.mfderiv_eq (hL : f₁ =ᶠ[𝓝 x] f) :
     mfderiv I I' f₁ x = (mfderiv I I' f x : _) :=
   by
   have A : f₁ x = f x := (mem_of_mem_nhds hL : _)
   rw [← mfderivWithin_univ, ← mfderivWithin_univ]
   rw [← nhdsWithin_univ] at hL 
-  exact hL.mfderiv_within_eq (uniqueMdiffWithinAt_univ I) A
+  exact hL.mfderiv_within_eq (uniqueMDiffWithinAt_univ I) A
 #align filter.eventually_eq.mfderiv_eq Filter.EventuallyEq.mfderiv_eq
+-/
 
+#print mfderiv_congr_point /-
 /-- A congruence lemma for `mfderiv`, (ab)using the fact that `tangent_space I' (f x)` is
 definitionally equal to `E'`. -/
 theorem mfderiv_congr_point {x' : M} (h : x = x') :
     @Eq (E →L[𝕜] E') (mfderiv I I' f x) (mfderiv I I' f x') := by subst h
 #align mfderiv_congr_point mfderiv_congr_point
+-/
 
+#print mfderiv_congr /-
 /-- A congruence lemma for `mfderiv`, (ab)using the fact that `tangent_space I' (f x)` is
 definitionally equal to `E'`. -/
 theorem mfderiv_congr {f' : M → M'} (h : f = f') :
     @Eq (E →L[𝕜] E') (mfderiv I I' f x) (mfderiv I I' f' x) := by subst h
 #align mfderiv_congr mfderiv_congr
+-/
 
 /-! ### Composition lemmas -/
 
 
-theorem written_in_ext_chart_comp (h : ContinuousWithinAt f s x) :
+#print writtenInExtChartAt_comp /-
+theorem writtenInExtChartAt_comp (h : ContinuousWithinAt f s x) :
     {y |
         writtenInExtChartAt I I'' x (g ∘ f) y =
           (writtenInExtChartAt I' I'' (f x) g ∘ writtenInExtChartAt I I' x f) y} ∈
@@ -905,13 +1108,15 @@ theorem written_in_ext_chart_comp (h : ContinuousWithinAt f s x) :
       (extChartAt_preimage_mem_nhdsWithin I x
         (h.preimage_mem_nhds_within (extChartAt_source_mem_nhds _ _)))
   mfld_set_tac
-#align written_in_ext_chart_comp written_in_ext_chart_comp
+#align written_in_ext_chart_comp writtenInExtChartAt_comp
+-/
 
 variable (x)
 
-theorem HasMfderivWithinAt.comp (hg : HasMfderivWithinAt I' I'' g u (f x) g')
-    (hf : HasMfderivWithinAt I I' f s x f') (hst : s ⊆ f ⁻¹' u) :
-    HasMfderivWithinAt I I'' (g ∘ f) s x (g'.comp f') :=
+#print HasMFDerivWithinAt.comp /-
+theorem HasMFDerivWithinAt.comp (hg : HasMFDerivWithinAt I' I'' g u (f x) g')
+    (hf : HasMFDerivWithinAt I I' f s x f') (hst : s ⊆ f ⁻¹' u) :
+    HasMFDerivWithinAt I I'' (g ∘ f) s x (g'.comp f') :=
   by
   refine' ⟨ContinuousWithinAt.comp hg.1 hf.1 hst, _⟩
   have A :
@@ -924,7 +1129,7 @@ theorem HasMfderivWithinAt.comp (hg : HasMfderivWithinAt I' I'' g u (f x) g')
         𝓝[(extChartAt I x).symm ⁻¹' s ∩ range I] (extChartAt I x) x :=
       extChartAt_preimage_mem_nhdsWithin I x
         (hf.1.preimage_mem_nhdsWithin (extChartAt_source_mem_nhds _ _))
-    unfold HasMfderivWithinAt at *
+    unfold HasMFDerivWithinAt at *
     rw [← hasFDerivWithinAt_inter' this, ← extChartAt_preimage_inter_eq] at hf ⊢
     have : writtenInExtChartAt I I' x f ((extChartAt I x) x) = (extChartAt I' (f x)) (f x) := by
       simp only [mfld_simps]
@@ -934,75 +1139,95 @@ theorem HasMfderivWithinAt.comp (hg : HasMfderivWithinAt I' I'' g u (f x) g')
     simp only [mfld_simps] at hy 
     have : f (((chart_at H x).symm : H → M) (I.symm y)) ∈ u := hst hy.1.1
     simp only [hy, this, mfld_simps]
-  apply A.congr_of_eventually_eq (written_in_ext_chart_comp hf.1)
+  apply A.congr_of_eventually_eq (writtenInExtChartAt_comp hf.1)
   simp only [mfld_simps]
-#align has_mfderiv_within_at.comp HasMfderivWithinAt.comp
+#align has_mfderiv_within_at.comp HasMFDerivWithinAt.comp
+-/
 
+#print HasMFDerivAt.comp /-
 /-- The chain rule. -/
-theorem HasMfderivAt.comp (hg : HasMfderivAt I' I'' g (f x) g') (hf : HasMfderivAt I I' f x f') :
-    HasMfderivAt I I'' (g ∘ f) x (g'.comp f') :=
+theorem HasMFDerivAt.comp (hg : HasMFDerivAt I' I'' g (f x) g') (hf : HasMFDerivAt I I' f x f') :
+    HasMFDerivAt I I'' (g ∘ f) x (g'.comp f') :=
   by
-  rw [← hasMfderivWithinAt_univ] at *
-  exact HasMfderivWithinAt.comp x (hg.mono (subset_univ _)) hf subset_preimage_univ
-#align has_mfderiv_at.comp HasMfderivAt.comp
+  rw [← hasMFDerivWithinAt_univ] at *
+  exact HasMFDerivWithinAt.comp x (hg.mono (subset_univ _)) hf subset_preimage_univ
+#align has_mfderiv_at.comp HasMFDerivAt.comp
+-/
 
-theorem HasMfderivAt.comp_hasMfderivWithinAt (hg : HasMfderivAt I' I'' g (f x) g')
-    (hf : HasMfderivWithinAt I I' f s x f') : HasMfderivWithinAt I I'' (g ∘ f) s x (g'.comp f') :=
+#print HasMFDerivAt.comp_hasMFDerivWithinAt /-
+theorem HasMFDerivAt.comp_hasMFDerivWithinAt (hg : HasMFDerivAt I' I'' g (f x) g')
+    (hf : HasMFDerivWithinAt I I' f s x f') : HasMFDerivWithinAt I I'' (g ∘ f) s x (g'.comp f') :=
   by
-  rw [← hasMfderivWithinAt_univ] at *
-  exact HasMfderivWithinAt.comp x (hg.mono (subset_univ _)) hf subset_preimage_univ
-#align has_mfderiv_at.comp_has_mfderiv_within_at HasMfderivAt.comp_hasMfderivWithinAt
+  rw [← hasMFDerivWithinAt_univ] at *
+  exact HasMFDerivWithinAt.comp x (hg.mono (subset_univ _)) hf subset_preimage_univ
+#align has_mfderiv_at.comp_has_mfderiv_within_at HasMFDerivAt.comp_hasMFDerivWithinAt
+-/
 
-theorem MdifferentiableWithinAt.comp (hg : MdifferentiableWithinAt I' I'' g u (f x))
-    (hf : MdifferentiableWithinAt I I' f s x) (h : s ⊆ f ⁻¹' u) :
-    MdifferentiableWithinAt I I'' (g ∘ f) s x :=
+#print MDifferentiableWithinAt.comp /-
+theorem MDifferentiableWithinAt.comp (hg : MDifferentiableWithinAt I' I'' g u (f x))
+    (hf : MDifferentiableWithinAt I I' f s x) (h : s ⊆ f ⁻¹' u) :
+    MDifferentiableWithinAt I I'' (g ∘ f) s x :=
   by
   rcases hf.2 with ⟨f', hf'⟩
-  have F : HasMfderivWithinAt I I' f s x f' := ⟨hf.1, hf'⟩
+  have F : HasMFDerivWithinAt I I' f s x f' := ⟨hf.1, hf'⟩
   rcases hg.2 with ⟨g', hg'⟩
-  have G : HasMfderivWithinAt I' I'' g u (f x) g' := ⟨hg.1, hg'⟩
-  exact (HasMfderivWithinAt.comp x G F h).MdifferentiableWithinAt
-#align mdifferentiable_within_at.comp MdifferentiableWithinAt.comp
+  have G : HasMFDerivWithinAt I' I'' g u (f x) g' := ⟨hg.1, hg'⟩
+  exact (HasMFDerivWithinAt.comp x G F h).MDifferentiableWithinAt
+#align mdifferentiable_within_at.comp MDifferentiableWithinAt.comp
+-/
 
-theorem MdifferentiableAt.comp (hg : MdifferentiableAt I' I'' g (f x))
-    (hf : MdifferentiableAt I I' f x) : MdifferentiableAt I I'' (g ∘ f) x :=
-  (hg.HasMfderivAt.comp x hf.HasMfderivAt).MdifferentiableAt
-#align mdifferentiable_at.comp MdifferentiableAt.comp
+#print MDifferentiableAt.comp /-
+theorem MDifferentiableAt.comp (hg : MDifferentiableAt I' I'' g (f x))
+    (hf : MDifferentiableAt I I' f x) : MDifferentiableAt I I'' (g ∘ f) x :=
+  (hg.HasMFDerivAt.comp x hf.HasMFDerivAt).MDifferentiableAt
+#align mdifferentiable_at.comp MDifferentiableAt.comp
+-/
 
-theorem mfderivWithin_comp (hg : MdifferentiableWithinAt I' I'' g u (f x))
-    (hf : MdifferentiableWithinAt I I' f s x) (h : s ⊆ f ⁻¹' u) (hxs : UniqueMdiffWithinAt I s x) :
+#print mfderivWithin_comp /-
+theorem mfderivWithin_comp (hg : MDifferentiableWithinAt I' I'' g u (f x))
+    (hf : MDifferentiableWithinAt I I' f s x) (h : s ⊆ f ⁻¹' u) (hxs : UniqueMDiffWithinAt I s x) :
     mfderivWithin I I'' (g ∘ f) s x =
       (mfderivWithin I' I'' g u (f x)).comp (mfderivWithin I I' f s x) :=
   by
-  apply HasMfderivWithinAt.mfderivWithin _ hxs
-  exact HasMfderivWithinAt.comp x hg.has_mfderiv_within_at hf.has_mfderiv_within_at h
+  apply HasMFDerivWithinAt.mfderivWithin _ hxs
+  exact HasMFDerivWithinAt.comp x hg.has_mfderiv_within_at hf.has_mfderiv_within_at h
 #align mfderiv_within_comp mfderivWithin_comp
+-/
 
-theorem mfderiv_comp (hg : MdifferentiableAt I' I'' g (f x)) (hf : MdifferentiableAt I I' f x) :
+#print mfderiv_comp /-
+theorem mfderiv_comp (hg : MDifferentiableAt I' I'' g (f x)) (hf : MDifferentiableAt I I' f x) :
     mfderiv I I'' (g ∘ f) x = (mfderiv I' I'' g (f x)).comp (mfderiv I I' f x) :=
   by
-  apply HasMfderivAt.mfderiv
-  exact HasMfderivAt.comp x hg.has_mfderiv_at hf.has_mfderiv_at
+  apply HasMFDerivAt.mfderiv
+  exact HasMFDerivAt.comp x hg.has_mfderiv_at hf.has_mfderiv_at
 #align mfderiv_comp mfderiv_comp
+-/
 
-theorem mfderiv_comp_of_eq {x : M} {y : M'} (hg : MdifferentiableAt I' I'' g y)
-    (hf : MdifferentiableAt I I' f x) (hy : f x = y) :
+#print mfderiv_comp_of_eq /-
+theorem mfderiv_comp_of_eq {x : M} {y : M'} (hg : MDifferentiableAt I' I'' g y)
+    (hf : MDifferentiableAt I I' f x) (hy : f x = y) :
     mfderiv I I'' (g ∘ f) x = (mfderiv I' I'' g (f x)).comp (mfderiv I I' f x) := by subst hy;
   exact mfderiv_comp x hg hf
 #align mfderiv_comp_of_eq mfderiv_comp_of_eq
+-/
 
-theorem MdifferentiableOn.comp (hg : MdifferentiableOn I' I'' g u) (hf : MdifferentiableOn I I' f s)
-    (st : s ⊆ f ⁻¹' u) : MdifferentiableOn I I'' (g ∘ f) s := fun x hx =>
-  MdifferentiableWithinAt.comp x (hg (f x) (st hx)) (hf x hx) st
-#align mdifferentiable_on.comp MdifferentiableOn.comp
+#print MDifferentiableOn.comp /-
+theorem MDifferentiableOn.comp (hg : MDifferentiableOn I' I'' g u) (hf : MDifferentiableOn I I' f s)
+    (st : s ⊆ f ⁻¹' u) : MDifferentiableOn I I'' (g ∘ f) s := fun x hx =>
+  MDifferentiableWithinAt.comp x (hg (f x) (st hx)) (hf x hx) st
+#align mdifferentiable_on.comp MDifferentiableOn.comp
+-/
 
-theorem Mdifferentiable.comp (hg : Mdifferentiable I' I'' g) (hf : Mdifferentiable I I' f) :
-    Mdifferentiable I I'' (g ∘ f) := fun x => MdifferentiableAt.comp x (hg (f x)) (hf x)
-#align mdifferentiable.comp Mdifferentiable.comp
+#print MDifferentiable.comp /-
+theorem MDifferentiable.comp (hg : MDifferentiable I' I'' g) (hf : MDifferentiable I I' f) :
+    MDifferentiable I I'' (g ∘ f) := fun x => MDifferentiableAt.comp x (hg (f x)) (hf x)
+#align mdifferentiable.comp MDifferentiable.comp
+-/
 
+#print tangentMapWithin_comp_at /-
 theorem tangentMapWithin_comp_at (p : TangentBundle I M)
-    (hg : MdifferentiableWithinAt I' I'' g u (f p.1)) (hf : MdifferentiableWithinAt I I' f s p.1)
-    (h : s ⊆ f ⁻¹' u) (hps : UniqueMdiffWithinAt I s p.1) :
+    (hg : MDifferentiableWithinAt I' I'' g u (f p.1)) (hf : MDifferentiableWithinAt I I' f s p.1)
+    (h : s ⊆ f ⁻¹' u) (hps : UniqueMDiffWithinAt I s p.1) :
     tangentMapWithin I I'' (g ∘ f) s p =
       tangentMapWithin I' I'' g u (tangentMapWithin I I' f s p) :=
   by
@@ -1010,20 +1235,25 @@ theorem tangentMapWithin_comp_at (p : TangentBundle I M)
   rw [mfderivWithin_comp p.1 hg hf h hps]
   rfl
 #align tangent_map_within_comp_at tangentMapWithin_comp_at
+-/
 
-theorem tangentMap_comp_at (p : TangentBundle I M) (hg : MdifferentiableAt I' I'' g (f p.1))
-    (hf : MdifferentiableAt I I' f p.1) :
+#print tangentMap_comp_at /-
+theorem tangentMap_comp_at (p : TangentBundle I M) (hg : MDifferentiableAt I' I'' g (f p.1))
+    (hf : MDifferentiableAt I I' f p.1) :
     tangentMap I I'' (g ∘ f) p = tangentMap I' I'' g (tangentMap I I' f p) :=
   by
   simp only [tangentMap, mfld_simps]
   rw [mfderiv_comp p.1 hg hf]
   rfl
 #align tangent_map_comp_at tangentMap_comp_at
+-/
 
-theorem tangentMap_comp (hg : Mdifferentiable I' I'' g) (hf : Mdifferentiable I I' f) :
+#print tangentMap_comp /-
+theorem tangentMap_comp (hg : MDifferentiable I' I'' g) (hf : MDifferentiable I I' f) :
     tangentMap I I'' (g ∘ f) = tangentMap I' I'' g ∘ tangentMap I I' f := by ext p : 1;
   exact tangentMap_comp_at _ (hg _) (hf _)
 #align tangent_map_comp tangentMap_comp
+-/
 
 end DerivativesProperties
 
@@ -1042,111 +1272,132 @@ variable {𝕜 : Type _} [NontriviallyNormedField 𝕜] {E : Type _} [NormedAddC
   [NormedSpace 𝕜 E] {E' : Type _} [NormedAddCommGroup E'] [NormedSpace 𝕜 E'] {f : E → E'}
   {s : Set E} {x : E}
 
-theorem uniqueMdiffWithinAt_iff_uniqueDiffWithinAt :
-    UniqueMdiffWithinAt 𝓘(𝕜, E) s x ↔ UniqueDiffWithinAt 𝕜 s x := by
-  simp only [UniqueMdiffWithinAt, mfld_simps]
-#align unique_mdiff_within_at_iff_unique_diff_within_at uniqueMdiffWithinAt_iff_uniqueDiffWithinAt
+#print uniqueMDiffWithinAt_iff_uniqueDiffWithinAt /-
+theorem uniqueMDiffWithinAt_iff_uniqueDiffWithinAt :
+    UniqueMDiffWithinAt 𝓘(𝕜, E) s x ↔ UniqueDiffWithinAt 𝕜 s x := by
+  simp only [UniqueMDiffWithinAt, mfld_simps]
+#align unique_mdiff_within_at_iff_unique_diff_within_at uniqueMDiffWithinAt_iff_uniqueDiffWithinAt
+-/
 
-alias uniqueMdiffWithinAt_iff_uniqueDiffWithinAt ↔ UniqueMdiffWithinAt.uniqueDiffWithinAt
-  UniqueDiffWithinAt.uniqueMdiffWithinAt
-#align unique_mdiff_within_at.unique_diff_within_at UniqueMdiffWithinAt.uniqueDiffWithinAt
-#align unique_diff_within_at.unique_mdiff_within_at UniqueDiffWithinAt.uniqueMdiffWithinAt
+alias uniqueMDiffWithinAt_iff_uniqueDiffWithinAt ↔ UniqueMDiffWithinAt.uniqueDiffWithinAt
+  UniqueDiffWithinAt.uniqueMDiffWithinAt
+#align unique_mdiff_within_at.unique_diff_within_at UniqueMDiffWithinAt.uniqueDiffWithinAt
+#align unique_diff_within_at.unique_mdiff_within_at UniqueDiffWithinAt.uniqueMDiffWithinAt
 
-theorem uniqueMdiffOn_iff_uniqueDiffOn : UniqueMdiffOn 𝓘(𝕜, E) s ↔ UniqueDiffOn 𝕜 s := by
-  simp [UniqueMdiffOn, UniqueDiffOn, uniqueMdiffWithinAt_iff_uniqueDiffWithinAt]
-#align unique_mdiff_on_iff_unique_diff_on uniqueMdiffOn_iff_uniqueDiffOn
+#print uniqueMDiffOn_iff_uniqueDiffOn /-
+theorem uniqueMDiffOn_iff_uniqueDiffOn : UniqueMDiffOn 𝓘(𝕜, E) s ↔ UniqueDiffOn 𝕜 s := by
+  simp [UniqueMDiffOn, UniqueDiffOn, uniqueMDiffWithinAt_iff_uniqueDiffWithinAt]
+#align unique_mdiff_on_iff_unique_diff_on uniqueMDiffOn_iff_uniqueDiffOn
+-/
 
-alias uniqueMdiffOn_iff_uniqueDiffOn ↔ UniqueMdiffOn.uniqueDiffOn UniqueDiffOn.uniqueMdiffOn
-#align unique_mdiff_on.unique_diff_on UniqueMdiffOn.uniqueDiffOn
-#align unique_diff_on.unique_mdiff_on UniqueDiffOn.uniqueMdiffOn
+alias uniqueMDiffOn_iff_uniqueDiffOn ↔ UniqueMDiffOn.uniqueDiffOn UniqueDiffOn.uniqueMDiffOn
+#align unique_mdiff_on.unique_diff_on UniqueMDiffOn.uniqueDiffOn
+#align unique_diff_on.unique_mdiff_on UniqueDiffOn.uniqueMDiffOn
 
+#print writtenInExtChartAt_model_space /-
 @[simp, mfld_simps]
-theorem written_in_ext_chart_model_space : writtenInExtChartAt 𝓘(𝕜, E) 𝓘(𝕜, E') x f = f :=
+theorem writtenInExtChartAt_model_space : writtenInExtChartAt 𝓘(𝕜, E) 𝓘(𝕜, E') x f = f :=
   rfl
-#align written_in_ext_chart_model_space written_in_ext_chart_model_space
+#align written_in_ext_chart_model_space writtenInExtChartAt_model_space
+-/
 
-theorem hasMfderivWithinAt_iff_hasFDerivWithinAt {f'} :
-    HasMfderivWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') f s x f' ↔ HasFDerivWithinAt f f' s x := by
-  simpa only [HasMfderivWithinAt, and_iff_right_iff_imp, mfld_simps] using
+#print hasMFDerivWithinAt_iff_hasFDerivWithinAt /-
+theorem hasMFDerivWithinAt_iff_hasFDerivWithinAt {f'} :
+    HasMFDerivWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') f s x f' ↔ HasFDerivWithinAt f f' s x := by
+  simpa only [HasMFDerivWithinAt, and_iff_right_iff_imp, mfld_simps] using
     HasFDerivWithinAt.continuousWithinAt
-#align has_mfderiv_within_at_iff_has_fderiv_within_at hasMfderivWithinAt_iff_hasFDerivWithinAt
+#align has_mfderiv_within_at_iff_has_fderiv_within_at hasMFDerivWithinAt_iff_hasFDerivWithinAt
+-/
 
-alias hasMfderivWithinAt_iff_hasFDerivWithinAt ↔ HasMfderivWithinAt.hasFDerivWithinAt
-  HasFDerivWithinAt.hasMfderivWithinAt
-#align has_mfderiv_within_at.has_fderiv_within_at HasMfderivWithinAt.hasFDerivWithinAt
-#align has_fderiv_within_at.has_mfderiv_within_at HasFDerivWithinAt.hasMfderivWithinAt
+alias hasMFDerivWithinAt_iff_hasFDerivWithinAt ↔ HasMFDerivWithinAt.hasFDerivWithinAt
+  HasFDerivWithinAt.hasMFDerivWithinAt
+#align has_mfderiv_within_at.has_fderiv_within_at HasMFDerivWithinAt.hasFDerivWithinAt
+#align has_fderiv_within_at.has_mfderiv_within_at HasFDerivWithinAt.hasMFDerivWithinAt
 
-theorem hasMfderivAt_iff_hasFDerivAt {f'} :
-    HasMfderivAt 𝓘(𝕜, E) 𝓘(𝕜, E') f x f' ↔ HasFDerivAt f f' x := by
-  rw [← hasMfderivWithinAt_univ, hasMfderivWithinAt_iff_hasFDerivWithinAt, hasFDerivWithinAt_univ]
-#align has_mfderiv_at_iff_has_fderiv_at hasMfderivAt_iff_hasFDerivAt
+#print hasMFDerivAt_iff_hasFDerivAt /-
+theorem hasMFDerivAt_iff_hasFDerivAt {f'} :
+    HasMFDerivAt 𝓘(𝕜, E) 𝓘(𝕜, E') f x f' ↔ HasFDerivAt f f' x := by
+  rw [← hasMFDerivWithinAt_univ, hasMFDerivWithinAt_iff_hasFDerivWithinAt, hasFDerivWithinAt_univ]
+#align has_mfderiv_at_iff_has_fderiv_at hasMFDerivAt_iff_hasFDerivAt
+-/
 
-alias hasMfderivAt_iff_hasFDerivAt ↔ HasMfderivAt.hasFDerivAt HasFDerivAt.hasMfderivAt
-#align has_mfderiv_at.has_fderiv_at HasMfderivAt.hasFDerivAt
-#align has_fderiv_at.has_mfderiv_at HasFDerivAt.hasMfderivAt
+alias hasMFDerivAt_iff_hasFDerivAt ↔ HasMFDerivAt.hasFDerivAt HasFDerivAt.hasMFDerivAt
+#align has_mfderiv_at.has_fderiv_at HasMFDerivAt.hasFDerivAt
+#align has_fderiv_at.has_mfderiv_at HasFDerivAt.hasMFDerivAt
 
+#print mdifferentiableWithinAt_iff_differentiableWithinAt /-
 /-- For maps between vector spaces, `mdifferentiable_within_at` and `fdifferentiable_within_at`
 coincide -/
 theorem mdifferentiableWithinAt_iff_differentiableWithinAt :
-    MdifferentiableWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') f s x ↔ DifferentiableWithinAt 𝕜 f s x :=
+    MDifferentiableWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') f s x ↔ DifferentiableWithinAt 𝕜 f s x :=
   by
-  simp only [MdifferentiableWithinAt, mfld_simps]
+  simp only [MDifferentiableWithinAt, mfld_simps]
   exact ⟨fun H => H.2, fun H => ⟨H.ContinuousWithinAt, H⟩⟩
 #align mdifferentiable_within_at_iff_differentiable_within_at mdifferentiableWithinAt_iff_differentiableWithinAt
+-/
 
 alias mdifferentiableWithinAt_iff_differentiableWithinAt ↔
-  MdifferentiableWithinAt.differentiableWithinAt DifferentiableWithinAt.mdifferentiableWithinAt
-#align mdifferentiable_within_at.differentiable_within_at MdifferentiableWithinAt.differentiableWithinAt
+  MDifferentiableWithinAt.differentiableWithinAt DifferentiableWithinAt.mdifferentiableWithinAt
+#align mdifferentiable_within_at.differentiable_within_at MDifferentiableWithinAt.differentiableWithinAt
 #align differentiable_within_at.mdifferentiable_within_at DifferentiableWithinAt.mdifferentiableWithinAt
 
+#print mdifferentiableAt_iff_differentiableAt /-
 /-- For maps between vector spaces, `mdifferentiable_at` and `differentiable_at` coincide -/
 theorem mdifferentiableAt_iff_differentiableAt :
-    MdifferentiableAt 𝓘(𝕜, E) 𝓘(𝕜, E') f x ↔ DifferentiableAt 𝕜 f x :=
+    MDifferentiableAt 𝓘(𝕜, E) 𝓘(𝕜, E') f x ↔ DifferentiableAt 𝕜 f x :=
   by
-  simp only [MdifferentiableAt, differentiableWithinAt_univ, mfld_simps]
+  simp only [MDifferentiableAt, differentiableWithinAt_univ, mfld_simps]
   exact ⟨fun H => H.2, fun H => ⟨H.ContinuousAt, H⟩⟩
 #align mdifferentiable_at_iff_differentiable_at mdifferentiableAt_iff_differentiableAt
+-/
 
-alias mdifferentiableAt_iff_differentiableAt ↔ MdifferentiableAt.differentiableAt
+alias mdifferentiableAt_iff_differentiableAt ↔ MDifferentiableAt.differentiableAt
   DifferentiableAt.mdifferentiableAt
-#align mdifferentiable_at.differentiable_at MdifferentiableAt.differentiableAt
+#align mdifferentiable_at.differentiable_at MDifferentiableAt.differentiableAt
 #align differentiable_at.mdifferentiable_at DifferentiableAt.mdifferentiableAt
 
+#print mdifferentiableOn_iff_differentiableOn /-
 /-- For maps between vector spaces, `mdifferentiable_on` and `differentiable_on` coincide -/
 theorem mdifferentiableOn_iff_differentiableOn :
-    MdifferentiableOn 𝓘(𝕜, E) 𝓘(𝕜, E') f s ↔ DifferentiableOn 𝕜 f s := by
-  simp only [MdifferentiableOn, DifferentiableOn,
+    MDifferentiableOn 𝓘(𝕜, E) 𝓘(𝕜, E') f s ↔ DifferentiableOn 𝕜 f s := by
+  simp only [MDifferentiableOn, DifferentiableOn,
     mdifferentiableWithinAt_iff_differentiableWithinAt]
 #align mdifferentiable_on_iff_differentiable_on mdifferentiableOn_iff_differentiableOn
+-/
 
-alias mdifferentiableOn_iff_differentiableOn ↔ MdifferentiableOn.differentiableOn
+alias mdifferentiableOn_iff_differentiableOn ↔ MDifferentiableOn.differentiableOn
   DifferentiableOn.mdifferentiableOn
-#align mdifferentiable_on.differentiable_on MdifferentiableOn.differentiableOn
+#align mdifferentiable_on.differentiable_on MDifferentiableOn.differentiableOn
 #align differentiable_on.mdifferentiable_on DifferentiableOn.mdifferentiableOn
 
+#print mdifferentiable_iff_differentiable /-
 /-- For maps between vector spaces, `mdifferentiable` and `differentiable` coincide -/
 theorem mdifferentiable_iff_differentiable :
-    Mdifferentiable 𝓘(𝕜, E) 𝓘(𝕜, E') f ↔ Differentiable 𝕜 f := by
-  simp only [Mdifferentiable, Differentiable, mdifferentiableAt_iff_differentiableAt]
+    MDifferentiable 𝓘(𝕜, E) 𝓘(𝕜, E') f ↔ Differentiable 𝕜 f := by
+  simp only [MDifferentiable, Differentiable, mdifferentiableAt_iff_differentiableAt]
 #align mdifferentiable_iff_differentiable mdifferentiable_iff_differentiable
+-/
 
-alias mdifferentiable_iff_differentiable ↔ Mdifferentiable.differentiable
+alias mdifferentiable_iff_differentiable ↔ MDifferentiable.differentiable
   Differentiable.mdifferentiable
-#align mdifferentiable.differentiable Mdifferentiable.differentiable
+#align mdifferentiable.differentiable MDifferentiable.differentiable
 #align differentiable.mdifferentiable Differentiable.mdifferentiable
 
+#print mfderivWithin_eq_fderivWithin /-
 /-- For maps between vector spaces, `mfderiv_within` and `fderiv_within` coincide -/
 @[simp]
 theorem mfderivWithin_eq_fderivWithin :
     mfderivWithin 𝓘(𝕜, E) 𝓘(𝕜, E') f s x = fderivWithin 𝕜 f s x :=
   by
-  by_cases h : MdifferentiableWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') f s x
+  by_cases h : MDifferentiableWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') f s x
   · simp only [mfderivWithin, h, if_pos, mfld_simps]
   · simp only [mfderivWithin, h, if_neg, not_false_iff]
     rw [mdifferentiableWithinAt_iff_differentiableWithinAt] at h 
     exact (fderivWithin_zero_of_not_differentiableWithinAt h).symm
 #align mfderiv_within_eq_fderiv_within mfderivWithin_eq_fderivWithin
+-/
 
+#print mfderiv_eq_fderiv /-
 /-- For maps between vector spaces, `mfderiv` and `fderiv` coincide -/
 @[simp]
 theorem mfderiv_eq_fderiv : mfderiv 𝓘(𝕜, E) 𝓘(𝕜, E') f x = fderiv 𝕜 f x :=
@@ -1154,6 +1405,7 @@ theorem mfderiv_eq_fderiv : mfderiv 𝓘(𝕜, E) 𝓘(𝕜, E') f x = fderiv 
   rw [← mfderivWithin_univ, ← fderivWithin_univ]
   exact mfderivWithin_eq_fderivWithin
 #align mfderiv_eq_fderiv mfderiv_eq_fderiv
+-/
 
 end MfderivFderiv
 
@@ -1175,38 +1427,54 @@ namespace ContinuousLinearMap
 
 variable (f : E →L[𝕜] E') {s : Set E} {x : E}
 
-protected theorem hasMfderivWithinAt : HasMfderivWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') f s x f :=
-  f.HasFDerivWithinAt.HasMfderivWithinAt
-#align continuous_linear_map.has_mfderiv_within_at ContinuousLinearMap.hasMfderivWithinAt
+#print ContinuousLinearMap.hasMFDerivWithinAt /-
+protected theorem hasMFDerivWithinAt : HasMFDerivWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') f s x f :=
+  f.HasFDerivWithinAt.HasMFDerivWithinAt
+#align continuous_linear_map.has_mfderiv_within_at ContinuousLinearMap.hasMFDerivWithinAt
+-/
 
-protected theorem hasMfderivAt : HasMfderivAt 𝓘(𝕜, E) 𝓘(𝕜, E') f x f :=
-  f.HasFDerivAt.HasMfderivAt
-#align continuous_linear_map.has_mfderiv_at ContinuousLinearMap.hasMfderivAt
+#print ContinuousLinearMap.hasMFDerivAt /-
+protected theorem hasMFDerivAt : HasMFDerivAt 𝓘(𝕜, E) 𝓘(𝕜, E') f x f :=
+  f.HasFDerivAt.HasMFDerivAt
+#align continuous_linear_map.has_mfderiv_at ContinuousLinearMap.hasMFDerivAt
+-/
 
-protected theorem mdifferentiableWithinAt : MdifferentiableWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') f s x :=
-  f.DifferentiableWithinAt.MdifferentiableWithinAt
+#print ContinuousLinearMap.mdifferentiableWithinAt /-
+protected theorem mdifferentiableWithinAt : MDifferentiableWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') f s x :=
+  f.DifferentiableWithinAt.MDifferentiableWithinAt
 #align continuous_linear_map.mdifferentiable_within_at ContinuousLinearMap.mdifferentiableWithinAt
+-/
 
-protected theorem mdifferentiableOn : MdifferentiableOn 𝓘(𝕜, E) 𝓘(𝕜, E') f s :=
-  f.DifferentiableOn.MdifferentiableOn
+#print ContinuousLinearMap.mdifferentiableOn /-
+protected theorem mdifferentiableOn : MDifferentiableOn 𝓘(𝕜, E) 𝓘(𝕜, E') f s :=
+  f.DifferentiableOn.MDifferentiableOn
 #align continuous_linear_map.mdifferentiable_on ContinuousLinearMap.mdifferentiableOn
+-/
 
-protected theorem mdifferentiableAt : MdifferentiableAt 𝓘(𝕜, E) 𝓘(𝕜, E') f x :=
-  f.DifferentiableAt.MdifferentiableAt
+#print ContinuousLinearMap.mdifferentiableAt /-
+protected theorem mdifferentiableAt : MDifferentiableAt 𝓘(𝕜, E) 𝓘(𝕜, E') f x :=
+  f.DifferentiableAt.MDifferentiableAt
 #align continuous_linear_map.mdifferentiable_at ContinuousLinearMap.mdifferentiableAt
+-/
 
-protected theorem mdifferentiable : Mdifferentiable 𝓘(𝕜, E) 𝓘(𝕜, E') f :=
-  f.Differentiable.Mdifferentiable
+#print ContinuousLinearMap.mdifferentiable /-
+protected theorem mdifferentiable : MDifferentiable 𝓘(𝕜, E) 𝓘(𝕜, E') f :=
+  f.Differentiable.MDifferentiable
 #align continuous_linear_map.mdifferentiable ContinuousLinearMap.mdifferentiable
+-/
 
+#print ContinuousLinearMap.mfderiv_eq /-
 theorem mfderiv_eq : mfderiv 𝓘(𝕜, E) 𝓘(𝕜, E') f x = f :=
-  f.HasMfderivAt.mfderiv
+  f.HasMFDerivAt.mfderiv
 #align continuous_linear_map.mfderiv_eq ContinuousLinearMap.mfderiv_eq
+-/
 
-theorem mfderivWithin_eq (hs : UniqueMdiffWithinAt 𝓘(𝕜, E) s x) :
+#print ContinuousLinearMap.mfderivWithin_eq /-
+theorem mfderivWithin_eq (hs : UniqueMDiffWithinAt 𝓘(𝕜, E) s x) :
     mfderivWithin 𝓘(𝕜, E) 𝓘(𝕜, E') f s x = f :=
-  f.HasMfderivWithinAt.mfderivWithin hs
+  f.HasMFDerivWithinAt.mfderivWithin hs
 #align continuous_linear_map.mfderiv_within_eq ContinuousLinearMap.mfderivWithin_eq
+-/
 
 end ContinuousLinearMap
 
@@ -1214,38 +1482,54 @@ namespace ContinuousLinearEquiv
 
 variable (f : E ≃L[𝕜] E') {s : Set E} {x : E}
 
-protected theorem hasMfderivWithinAt : HasMfderivWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') f s x (f : E →L[𝕜] E') :=
-  f.HasFDerivWithinAt.HasMfderivWithinAt
-#align continuous_linear_equiv.has_mfderiv_within_at ContinuousLinearEquiv.hasMfderivWithinAt
+#print ContinuousLinearEquiv.hasMFDerivWithinAt /-
+protected theorem hasMFDerivWithinAt : HasMFDerivWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') f s x (f : E →L[𝕜] E') :=
+  f.HasFDerivWithinAt.HasMFDerivWithinAt
+#align continuous_linear_equiv.has_mfderiv_within_at ContinuousLinearEquiv.hasMFDerivWithinAt
+-/
 
-protected theorem hasMfderivAt : HasMfderivAt 𝓘(𝕜, E) 𝓘(𝕜, E') f x (f : E →L[𝕜] E') :=
-  f.HasFDerivAt.HasMfderivAt
-#align continuous_linear_equiv.has_mfderiv_at ContinuousLinearEquiv.hasMfderivAt
+#print ContinuousLinearEquiv.hasMFDerivAt /-
+protected theorem hasMFDerivAt : HasMFDerivAt 𝓘(𝕜, E) 𝓘(𝕜, E') f x (f : E →L[𝕜] E') :=
+  f.HasFDerivAt.HasMFDerivAt
+#align continuous_linear_equiv.has_mfderiv_at ContinuousLinearEquiv.hasMFDerivAt
+-/
 
-protected theorem mdifferentiableWithinAt : MdifferentiableWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') f s x :=
-  f.DifferentiableWithinAt.MdifferentiableWithinAt
+#print ContinuousLinearEquiv.mdifferentiableWithinAt /-
+protected theorem mdifferentiableWithinAt : MDifferentiableWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') f s x :=
+  f.DifferentiableWithinAt.MDifferentiableWithinAt
 #align continuous_linear_equiv.mdifferentiable_within_at ContinuousLinearEquiv.mdifferentiableWithinAt
+-/
 
-protected theorem mdifferentiableOn : MdifferentiableOn 𝓘(𝕜, E) 𝓘(𝕜, E') f s :=
-  f.DifferentiableOn.MdifferentiableOn
+#print ContinuousLinearEquiv.mdifferentiableOn /-
+protected theorem mdifferentiableOn : MDifferentiableOn 𝓘(𝕜, E) 𝓘(𝕜, E') f s :=
+  f.DifferentiableOn.MDifferentiableOn
 #align continuous_linear_equiv.mdifferentiable_on ContinuousLinearEquiv.mdifferentiableOn
+-/
 
-protected theorem mdifferentiableAt : MdifferentiableAt 𝓘(𝕜, E) 𝓘(𝕜, E') f x :=
-  f.DifferentiableAt.MdifferentiableAt
+#print ContinuousLinearEquiv.mdifferentiableAt /-
+protected theorem mdifferentiableAt : MDifferentiableAt 𝓘(𝕜, E) 𝓘(𝕜, E') f x :=
+  f.DifferentiableAt.MDifferentiableAt
 #align continuous_linear_equiv.mdifferentiable_at ContinuousLinearEquiv.mdifferentiableAt
+-/
 
-protected theorem mdifferentiable : Mdifferentiable 𝓘(𝕜, E) 𝓘(𝕜, E') f :=
-  f.Differentiable.Mdifferentiable
+#print ContinuousLinearEquiv.mdifferentiable /-
+protected theorem mdifferentiable : MDifferentiable 𝓘(𝕜, E) 𝓘(𝕜, E') f :=
+  f.Differentiable.MDifferentiable
 #align continuous_linear_equiv.mdifferentiable ContinuousLinearEquiv.mdifferentiable
+-/
 
+#print ContinuousLinearEquiv.mfderiv_eq /-
 theorem mfderiv_eq : mfderiv 𝓘(𝕜, E) 𝓘(𝕜, E') f x = (f : E →L[𝕜] E') :=
-  f.HasMfderivAt.mfderiv
+  f.HasMFDerivAt.mfderiv
 #align continuous_linear_equiv.mfderiv_eq ContinuousLinearEquiv.mfderiv_eq
+-/
 
-theorem mfderivWithin_eq (hs : UniqueMdiffWithinAt 𝓘(𝕜, E) s x) :
+#print ContinuousLinearEquiv.mfderivWithin_eq /-
+theorem mfderivWithin_eq (hs : UniqueMDiffWithinAt 𝓘(𝕜, E) s x) :
     mfderivWithin 𝓘(𝕜, E) 𝓘(𝕜, E') f s x = (f : E →L[𝕜] E') :=
-  f.HasMfderivWithinAt.mfderivWithin hs
+  f.HasMFDerivWithinAt.mfderivWithin hs
 #align continuous_linear_equiv.mfderiv_within_eq ContinuousLinearEquiv.mfderivWithin_eq
+-/
 
 end ContinuousLinearEquiv
 
@@ -1256,8 +1540,9 @@ section id
 /-! #### Identity -/
 
 
-theorem hasMfderivAt_id (x : M) :
-    HasMfderivAt I I (@id M) x (ContinuousLinearMap.id 𝕜 (TangentSpace I x)) :=
+#print hasMFDerivAt_id /-
+theorem hasMFDerivAt_id (x : M) :
+    HasMFDerivAt I I (@id M) x (ContinuousLinearMap.id 𝕜 (TangentSpace I x)) :=
   by
   refine' ⟨continuousAt_id, _⟩
   have : ∀ᶠ y in 𝓝[range I] (extChartAt I x) x, (extChartAt I x ∘ (extChartAt I x).symm) y = id y :=
@@ -1266,45 +1551,63 @@ theorem hasMfderivAt_id (x : M) :
     mfld_set_tac
   apply HasFDerivWithinAt.congr_of_eventuallyEq (hasFDerivWithinAt_id _ _) this
   simp only [mfld_simps]
-#align has_mfderiv_at_id hasMfderivAt_id
+#align has_mfderiv_at_id hasMFDerivAt_id
+-/
 
-theorem hasMfderivWithinAt_id (s : Set M) (x : M) :
-    HasMfderivWithinAt I I (@id M) s x (ContinuousLinearMap.id 𝕜 (TangentSpace I x)) :=
-  (hasMfderivAt_id I x).HasMfderivWithinAt
-#align has_mfderiv_within_at_id hasMfderivWithinAt_id
+#print hasMFDerivWithinAt_id /-
+theorem hasMFDerivWithinAt_id (s : Set M) (x : M) :
+    HasMFDerivWithinAt I I (@id M) s x (ContinuousLinearMap.id 𝕜 (TangentSpace I x)) :=
+  (hasMFDerivAt_id I x).HasMFDerivWithinAt
+#align has_mfderiv_within_at_id hasMFDerivWithinAt_id
+-/
 
-theorem mdifferentiableAt_id : MdifferentiableAt I I (@id M) x :=
-  (hasMfderivAt_id I x).MdifferentiableAt
+#print mdifferentiableAt_id /-
+theorem mdifferentiableAt_id : MDifferentiableAt I I (@id M) x :=
+  (hasMFDerivAt_id I x).MDifferentiableAt
 #align mdifferentiable_at_id mdifferentiableAt_id
+-/
 
-theorem mdifferentiableWithinAt_id : MdifferentiableWithinAt I I (@id M) s x :=
-  (mdifferentiableAt_id I).MdifferentiableWithinAt
+#print mdifferentiableWithinAt_id /-
+theorem mdifferentiableWithinAt_id : MDifferentiableWithinAt I I (@id M) s x :=
+  (mdifferentiableAt_id I).MDifferentiableWithinAt
 #align mdifferentiable_within_at_id mdifferentiableWithinAt_id
+-/
 
-theorem mdifferentiable_id : Mdifferentiable I I (@id M) := fun x => mdifferentiableAt_id I
+#print mdifferentiable_id /-
+theorem mdifferentiable_id : MDifferentiable I I (@id M) := fun x => mdifferentiableAt_id I
 #align mdifferentiable_id mdifferentiable_id
+-/
 
-theorem mdifferentiableOn_id : MdifferentiableOn I I (@id M) s :=
-  (mdifferentiable_id I).MdifferentiableOn
+#print mdifferentiableOn_id /-
+theorem mdifferentiableOn_id : MDifferentiableOn I I (@id M) s :=
+  (mdifferentiable_id I).MDifferentiableOn
 #align mdifferentiable_on_id mdifferentiableOn_id
+-/
 
+#print mfderiv_id /-
 @[simp, mfld_simps]
 theorem mfderiv_id : mfderiv I I (@id M) x = ContinuousLinearMap.id 𝕜 (TangentSpace I x) :=
-  HasMfderivAt.mfderiv (hasMfderivAt_id I x)
+  HasMFDerivAt.mfderiv (hasMFDerivAt_id I x)
 #align mfderiv_id mfderiv_id
+-/
 
-theorem mfderivWithin_id (hxs : UniqueMdiffWithinAt I s x) :
+#print mfderivWithin_id /-
+theorem mfderivWithin_id (hxs : UniqueMDiffWithinAt I s x) :
     mfderivWithin I I (@id M) s x = ContinuousLinearMap.id 𝕜 (TangentSpace I x) :=
   by
-  rw [Mdifferentiable.mfderivWithin (mdifferentiableAt_id I) hxs]
+  rw [MDifferentiable.mfderivWithin (mdifferentiableAt_id I) hxs]
   exact mfderiv_id I
 #align mfderiv_within_id mfderivWithin_id
+-/
 
+#print tangentMap_id /-
 @[simp, mfld_simps]
 theorem tangentMap_id : tangentMap I I (id : M → M) = id := by ext1 ⟨x, v⟩; simp [tangentMap]
 #align tangent_map_id tangentMap_id
+-/
 
-theorem tangentMapWithin_id {p : TangentBundle I M} (hs : UniqueMdiffWithinAt I s p.proj) :
+#print tangentMapWithin_id /-
+theorem tangentMapWithin_id {p : TangentBundle I M} (hs : UniqueMDiffWithinAt I s p.proj) :
     tangentMapWithin I I (id : M → M) s p = p :=
   by
   simp only [tangentMapWithin, id.def]
@@ -1312,6 +1615,7 @@ theorem tangentMapWithin_id {p : TangentBundle I M} (hs : UniqueMdiffWithinAt I
   · rcases p with ⟨⟩; rfl
   · exact hs
 #align tangent_map_within_id tangentMapWithin_id
+-/
 
 end id
 
@@ -1322,44 +1626,60 @@ section Const
 
 variable {c : M'}
 
-theorem hasMfderivAt_const (c : M') (x : M) :
-    HasMfderivAt I I' (fun y : M => c) x (0 : TangentSpace I x →L[𝕜] TangentSpace I' c) :=
+#print hasMFDerivAt_const /-
+theorem hasMFDerivAt_const (c : M') (x : M) :
+    HasMFDerivAt I I' (fun y : M => c) x (0 : TangentSpace I x →L[𝕜] TangentSpace I' c) :=
   by
   refine' ⟨continuous_const.continuous_at, _⟩
   simp only [writtenInExtChartAt, (· ∘ ·), hasFDerivWithinAt_const]
-#align has_mfderiv_at_const hasMfderivAt_const
+#align has_mfderiv_at_const hasMFDerivAt_const
+-/
 
-theorem hasMfderivWithinAt_const (c : M') (s : Set M) (x : M) :
-    HasMfderivWithinAt I I' (fun y : M => c) s x (0 : TangentSpace I x →L[𝕜] TangentSpace I' c) :=
-  (hasMfderivAt_const I I' c x).HasMfderivWithinAt
-#align has_mfderiv_within_at_const hasMfderivWithinAt_const
+#print hasMFDerivWithinAt_const /-
+theorem hasMFDerivWithinAt_const (c : M') (s : Set M) (x : M) :
+    HasMFDerivWithinAt I I' (fun y : M => c) s x (0 : TangentSpace I x →L[𝕜] TangentSpace I' c) :=
+  (hasMFDerivAt_const I I' c x).HasMFDerivWithinAt
+#align has_mfderiv_within_at_const hasMFDerivWithinAt_const
+-/
 
-theorem mdifferentiableAt_const : MdifferentiableAt I I' (fun y : M => c) x :=
-  (hasMfderivAt_const I I' c x).MdifferentiableAt
+#print mdifferentiableAt_const /-
+theorem mdifferentiableAt_const : MDifferentiableAt I I' (fun y : M => c) x :=
+  (hasMFDerivAt_const I I' c x).MDifferentiableAt
 #align mdifferentiable_at_const mdifferentiableAt_const
+-/
 
-theorem mdifferentiableWithinAt_const : MdifferentiableWithinAt I I' (fun y : M => c) s x :=
-  (mdifferentiableAt_const I I').MdifferentiableWithinAt
+#print mdifferentiableWithinAt_const /-
+theorem mdifferentiableWithinAt_const : MDifferentiableWithinAt I I' (fun y : M => c) s x :=
+  (mdifferentiableAt_const I I').MDifferentiableWithinAt
 #align mdifferentiable_within_at_const mdifferentiableWithinAt_const
+-/
 
-theorem mdifferentiable_const : Mdifferentiable I I' fun y : M => c := fun x =>
+#print mdifferentiable_const /-
+theorem mdifferentiable_const : MDifferentiable I I' fun y : M => c := fun x =>
   mdifferentiableAt_const I I'
 #align mdifferentiable_const mdifferentiable_const
+-/
 
-theorem mdifferentiableOn_const : MdifferentiableOn I I' (fun y : M => c) s :=
-  (mdifferentiable_const I I').MdifferentiableOn
+#print mdifferentiableOn_const /-
+theorem mdifferentiableOn_const : MDifferentiableOn I I' (fun y : M => c) s :=
+  (mdifferentiable_const I I').MDifferentiableOn
 #align mdifferentiable_on_const mdifferentiableOn_const
+-/
 
+#print mfderiv_const /-
 @[simp, mfld_simps]
 theorem mfderiv_const :
     mfderiv I I' (fun y : M => c) x = (0 : TangentSpace I x →L[𝕜] TangentSpace I' c) :=
-  HasMfderivAt.mfderiv (hasMfderivAt_const I I' c x)
+  HasMFDerivAt.mfderiv (hasMFDerivAt_const I I' c x)
 #align mfderiv_const mfderiv_const
+-/
 
-theorem mfderivWithin_const (hxs : UniqueMdiffWithinAt I s x) :
+#print mfderivWithin_const /-
+theorem mfderivWithin_const (hxs : UniqueMDiffWithinAt I s x) :
     mfderivWithin I I' (fun y : M => c) s x = (0 : TangentSpace I x →L[𝕜] TangentSpace I' c) :=
-  (hasMfderivWithinAt_const _ _ _ _ _).mfderivWithin hxs
+  (hasMFDerivWithinAt_const _ _ _ _ _).mfderivWithin hxs
 #align mfderiv_within_const mfderivWithin_const
+-/
 
 end Const
 
@@ -1368,8 +1688,9 @@ section Prod
 /-! Operations on the product of two manifolds-/
 
 
-theorem hasMfderivAt_fst (x : M × M') :
-    HasMfderivAt (I.Prod I') I Prod.fst x
+#print hasMFDerivAt_fst /-
+theorem hasMFDerivAt_fst (x : M × M') :
+    HasMFDerivAt (I.Prod I') I Prod.fst x
       (ContinuousLinearMap.fst 𝕜 (TangentSpace I x.1) (TangentSpace I' x.2)) :=
   by
   refine' ⟨continuous_fst.continuous_at, _⟩
@@ -1381,52 +1702,70 @@ theorem hasMfderivAt_fst (x : M × M') :
     mfld_set_tac
   apply HasFDerivWithinAt.congr_of_eventuallyEq hasFDerivWithinAt_fst this
   simp only [mfld_simps]
-#align has_mfderiv_at_fst hasMfderivAt_fst
+#align has_mfderiv_at_fst hasMFDerivAt_fst
+-/
 
-theorem hasMfderivWithinAt_fst (s : Set (M × M')) (x : M × M') :
-    HasMfderivWithinAt (I.Prod I') I Prod.fst s x
+#print hasMFDerivWithinAt_fst /-
+theorem hasMFDerivWithinAt_fst (s : Set (M × M')) (x : M × M') :
+    HasMFDerivWithinAt (I.Prod I') I Prod.fst s x
       (ContinuousLinearMap.fst 𝕜 (TangentSpace I x.1) (TangentSpace I' x.2)) :=
-  (hasMfderivAt_fst I I' x).HasMfderivWithinAt
-#align has_mfderiv_within_at_fst hasMfderivWithinAt_fst
+  (hasMFDerivAt_fst I I' x).HasMFDerivWithinAt
+#align has_mfderiv_within_at_fst hasMFDerivWithinAt_fst
+-/
 
-theorem mdifferentiableAt_fst {x : M × M'} : MdifferentiableAt (I.Prod I') I Prod.fst x :=
-  (hasMfderivAt_fst I I' x).MdifferentiableAt
+#print mdifferentiableAt_fst /-
+theorem mdifferentiableAt_fst {x : M × M'} : MDifferentiableAt (I.Prod I') I Prod.fst x :=
+  (hasMFDerivAt_fst I I' x).MDifferentiableAt
 #align mdifferentiable_at_fst mdifferentiableAt_fst
+-/
 
+#print mdifferentiableWithinAt_fst /-
 theorem mdifferentiableWithinAt_fst {s : Set (M × M')} {x : M × M'} :
-    MdifferentiableWithinAt (I.Prod I') I Prod.fst s x :=
-  (mdifferentiableAt_fst I I').MdifferentiableWithinAt
+    MDifferentiableWithinAt (I.Prod I') I Prod.fst s x :=
+  (mdifferentiableAt_fst I I').MDifferentiableWithinAt
 #align mdifferentiable_within_at_fst mdifferentiableWithinAt_fst
+-/
 
-theorem mdifferentiable_fst : Mdifferentiable (I.Prod I') I (Prod.fst : M × M' → M) := fun x =>
+#print mdifferentiable_fst /-
+theorem mdifferentiable_fst : MDifferentiable (I.Prod I') I (Prod.fst : M × M' → M) := fun x =>
   mdifferentiableAt_fst I I'
 #align mdifferentiable_fst mdifferentiable_fst
+-/
 
-theorem mdifferentiableOn_fst {s : Set (M × M')} : MdifferentiableOn (I.Prod I') I Prod.fst s :=
-  (mdifferentiable_fst I I').MdifferentiableOn
+#print mdifferentiableOn_fst /-
+theorem mdifferentiableOn_fst {s : Set (M × M')} : MDifferentiableOn (I.Prod I') I Prod.fst s :=
+  (mdifferentiable_fst I I').MDifferentiableOn
 #align mdifferentiable_on_fst mdifferentiableOn_fst
+-/
 
+#print mfderiv_fst /-
 @[simp, mfld_simps]
 theorem mfderiv_fst {x : M × M'} :
     mfderiv (I.Prod I') I Prod.fst x =
       ContinuousLinearMap.fst 𝕜 (TangentSpace I x.1) (TangentSpace I' x.2) :=
-  (hasMfderivAt_fst I I' x).mfderiv
+  (hasMFDerivAt_fst I I' x).mfderiv
 #align mfderiv_fst mfderiv_fst
+-/
 
+#print mfderivWithin_fst /-
 theorem mfderivWithin_fst {s : Set (M × M')} {x : M × M'}
-    (hxs : UniqueMdiffWithinAt (I.Prod I') s x) :
+    (hxs : UniqueMDiffWithinAt (I.Prod I') s x) :
     mfderivWithin (I.Prod I') I Prod.fst s x =
       ContinuousLinearMap.fst 𝕜 (TangentSpace I x.1) (TangentSpace I' x.2) :=
-  by rw [Mdifferentiable.mfderivWithin (mdifferentiableAt_fst I I') hxs]; exact mfderiv_fst I I'
+  by rw [MDifferentiable.mfderivWithin (mdifferentiableAt_fst I I') hxs]; exact mfderiv_fst I I'
 #align mfderiv_within_fst mfderivWithin_fst
+-/
 
+#print tangentMap_prod_fst /-
 @[simp, mfld_simps]
 theorem tangentMap_prod_fst {p : TangentBundle (I.Prod I') (M × M')} :
     tangentMap (I.Prod I') I Prod.fst p = totalSpaceMk p.proj.1 p.2.1 := by simp [tangentMap]
 #align tangent_map_prod_fst tangentMap_prod_fst
+-/
 
+#print tangentMapWithin_prod_fst /-
 theorem tangentMapWithin_prod_fst {s : Set (M × M')} {p : TangentBundle (I.Prod I') (M × M')}
-    (hs : UniqueMdiffWithinAt (I.Prod I') s p.proj) :
+    (hs : UniqueMDiffWithinAt (I.Prod I') s p.proj) :
     tangentMapWithin (I.Prod I') I Prod.fst s p = totalSpaceMk p.proj.1 p.2.1 :=
   by
   simp only [tangentMapWithin]
@@ -1434,9 +1773,11 @@ theorem tangentMapWithin_prod_fst {s : Set (M × M')} {p : TangentBundle (I.Prod
   · rcases p with ⟨⟩; rfl
   · exact hs
 #align tangent_map_within_prod_fst tangentMapWithin_prod_fst
+-/
 
-theorem hasMfderivAt_snd (x : M × M') :
-    HasMfderivAt (I.Prod I') I' Prod.snd x
+#print hasMFDerivAt_snd /-
+theorem hasMFDerivAt_snd (x : M × M') :
+    HasMFDerivAt (I.Prod I') I' Prod.snd x
       (ContinuousLinearMap.snd 𝕜 (TangentSpace I x.1) (TangentSpace I' x.2)) :=
   by
   refine' ⟨continuous_snd.continuous_at, _⟩
@@ -1448,52 +1789,70 @@ theorem hasMfderivAt_snd (x : M × M') :
     mfld_set_tac
   apply HasFDerivWithinAt.congr_of_eventuallyEq hasFDerivWithinAt_snd this
   simp only [mfld_simps]
-#align has_mfderiv_at_snd hasMfderivAt_snd
+#align has_mfderiv_at_snd hasMFDerivAt_snd
+-/
 
-theorem hasMfderivWithinAt_snd (s : Set (M × M')) (x : M × M') :
-    HasMfderivWithinAt (I.Prod I') I' Prod.snd s x
+#print hasMFDerivWithinAt_snd /-
+theorem hasMFDerivWithinAt_snd (s : Set (M × M')) (x : M × M') :
+    HasMFDerivWithinAt (I.Prod I') I' Prod.snd s x
       (ContinuousLinearMap.snd 𝕜 (TangentSpace I x.1) (TangentSpace I' x.2)) :=
-  (hasMfderivAt_snd I I' x).HasMfderivWithinAt
-#align has_mfderiv_within_at_snd hasMfderivWithinAt_snd
+  (hasMFDerivAt_snd I I' x).HasMFDerivWithinAt
+#align has_mfderiv_within_at_snd hasMFDerivWithinAt_snd
+-/
 
-theorem mdifferentiableAt_snd {x : M × M'} : MdifferentiableAt (I.Prod I') I' Prod.snd x :=
-  (hasMfderivAt_snd I I' x).MdifferentiableAt
+#print mdifferentiableAt_snd /-
+theorem mdifferentiableAt_snd {x : M × M'} : MDifferentiableAt (I.Prod I') I' Prod.snd x :=
+  (hasMFDerivAt_snd I I' x).MDifferentiableAt
 #align mdifferentiable_at_snd mdifferentiableAt_snd
+-/
 
+#print mdifferentiableWithinAt_snd /-
 theorem mdifferentiableWithinAt_snd {s : Set (M × M')} {x : M × M'} :
-    MdifferentiableWithinAt (I.Prod I') I' Prod.snd s x :=
-  (mdifferentiableAt_snd I I').MdifferentiableWithinAt
+    MDifferentiableWithinAt (I.Prod I') I' Prod.snd s x :=
+  (mdifferentiableAt_snd I I').MDifferentiableWithinAt
 #align mdifferentiable_within_at_snd mdifferentiableWithinAt_snd
+-/
 
-theorem mdifferentiable_snd : Mdifferentiable (I.Prod I') I' (Prod.snd : M × M' → M') := fun x =>
+#print mdifferentiable_snd /-
+theorem mdifferentiable_snd : MDifferentiable (I.Prod I') I' (Prod.snd : M × M' → M') := fun x =>
   mdifferentiableAt_snd I I'
 #align mdifferentiable_snd mdifferentiable_snd
+-/
 
-theorem mdifferentiableOn_snd {s : Set (M × M')} : MdifferentiableOn (I.Prod I') I' Prod.snd s :=
-  (mdifferentiable_snd I I').MdifferentiableOn
+#print mdifferentiableOn_snd /-
+theorem mdifferentiableOn_snd {s : Set (M × M')} : MDifferentiableOn (I.Prod I') I' Prod.snd s :=
+  (mdifferentiable_snd I I').MDifferentiableOn
 #align mdifferentiable_on_snd mdifferentiableOn_snd
+-/
 
+#print mfderiv_snd /-
 @[simp, mfld_simps]
 theorem mfderiv_snd {x : M × M'} :
     mfderiv (I.Prod I') I' Prod.snd x =
       ContinuousLinearMap.snd 𝕜 (TangentSpace I x.1) (TangentSpace I' x.2) :=
-  (hasMfderivAt_snd I I' x).mfderiv
+  (hasMFDerivAt_snd I I' x).mfderiv
 #align mfderiv_snd mfderiv_snd
+-/
 
+#print mfderivWithin_snd /-
 theorem mfderivWithin_snd {s : Set (M × M')} {x : M × M'}
-    (hxs : UniqueMdiffWithinAt (I.Prod I') s x) :
+    (hxs : UniqueMDiffWithinAt (I.Prod I') s x) :
     mfderivWithin (I.Prod I') I' Prod.snd s x =
       ContinuousLinearMap.snd 𝕜 (TangentSpace I x.1) (TangentSpace I' x.2) :=
-  by rw [Mdifferentiable.mfderivWithin (mdifferentiableAt_snd I I') hxs]; exact mfderiv_snd I I'
+  by rw [MDifferentiable.mfderivWithin (mdifferentiableAt_snd I I') hxs]; exact mfderiv_snd I I'
 #align mfderiv_within_snd mfderivWithin_snd
+-/
 
+#print tangentMap_prod_snd /-
 @[simp, mfld_simps]
 theorem tangentMap_prod_snd {p : TangentBundle (I.Prod I') (M × M')} :
     tangentMap (I.Prod I') I' Prod.snd p = totalSpaceMk p.proj.2 p.2.2 := by simp [tangentMap]
 #align tangent_map_prod_snd tangentMap_prod_snd
+-/
 
+#print tangentMapWithin_prod_snd /-
 theorem tangentMapWithin_prod_snd {s : Set (M × M')} {p : TangentBundle (I.Prod I') (M × M')}
-    (hs : UniqueMdiffWithinAt (I.Prod I') s p.proj) :
+    (hs : UniqueMDiffWithinAt (I.Prod I') s p.proj) :
     tangentMapWithin (I.Prod I') I' Prod.snd s p = totalSpaceMk p.proj.2 p.2.2 :=
   by
   simp only [tangentMapWithin]
@@ -1501,20 +1860,24 @@ theorem tangentMapWithin_prod_snd {s : Set (M × M')} {p : TangentBundle (I.Prod
   · rcases p with ⟨⟩; rfl
   · exact hs
 #align tangent_map_within_prod_snd tangentMapWithin_prod_snd
+-/
 
 variable {I I' I''}
 
-theorem MdifferentiableAt.mfderiv_prod {f : M → M'} {g : M → M''} {x : M}
-    (hf : MdifferentiableAt I I' f x) (hg : MdifferentiableAt I I'' g x) :
+#print MDifferentiableAt.mfderiv_prod /-
+theorem MDifferentiableAt.mfderiv_prod {f : M → M'} {g : M → M''} {x : M}
+    (hf : MDifferentiableAt I I' f x) (hg : MDifferentiableAt I I'' g x) :
     mfderiv I (I'.Prod I'') (fun x => (f x, g x)) x = (mfderiv I I' f x).Prod (mfderiv I I'' g x) :=
   by
   classical
   simp_rw [mfderiv, if_pos (hf.prod_mk hg), if_pos hf, if_pos hg]
   exact hf.2.fderivWithin_prod hg.2 (I.unique_diff _ (mem_range_self _))
-#align mdifferentiable_at.mfderiv_prod MdifferentiableAt.mfderiv_prod
+#align mdifferentiable_at.mfderiv_prod MDifferentiableAt.mfderiv_prod
+-/
 
 variable (I I' I'')
 
+#print mfderiv_prod_left /-
 theorem mfderiv_prod_left {x₀ : M} {y₀ : M'} :
     mfderiv I (I.Prod I') (fun x => (x, y₀)) x₀ =
       ContinuousLinearMap.inl 𝕜 (TangentSpace I x₀) (TangentSpace I' y₀) :=
@@ -1522,7 +1885,9 @@ theorem mfderiv_prod_left {x₀ : M} {y₀ : M'} :
   refine' ((mdifferentiableAt_id I).mfderiv_prod (mdifferentiableAt_const I I')).trans _
   rw [mfderiv_id, mfderiv_const, ContinuousLinearMap.inl]
 #align mfderiv_prod_left mfderiv_prod_left
+-/
 
+#print mfderiv_prod_right /-
 theorem mfderiv_prod_right {x₀ : M} {y₀ : M'} :
     mfderiv I' (I.Prod I') (fun y => (x₀, y)) y₀ =
       ContinuousLinearMap.inr 𝕜 (TangentSpace I x₀) (TangentSpace I' y₀) :=
@@ -1530,12 +1895,14 @@ theorem mfderiv_prod_right {x₀ : M} {y₀ : M'} :
   refine' ((mdifferentiableAt_const I' I).mfderiv_prod (mdifferentiableAt_id I')).trans _
   rw [mfderiv_id, mfderiv_const, ContinuousLinearMap.inr]
 #align mfderiv_prod_right mfderiv_prod_right
+-/
 
+#print mfderiv_prod_eq_add /-
 /-- The total derivative of a function in two variables is the sum of the partial derivatives.
   Note that to state this (without casts) we need to be able to see through the definition of
   `tangent_space`. -/
 theorem mfderiv_prod_eq_add {f : M × M' → M''} {p : M × M'}
-    (hf : MdifferentiableAt (I.Prod I') I'' f p) :
+    (hf : MDifferentiableAt (I.Prod I') I'' f p) :
     mfderiv (I.Prod I') I'' f p =
       show E × E' →L[𝕜] E'' from
         mfderiv (I.Prod I') I'' (fun z : M × M' => f (z.1, p.2)) p +
@@ -1556,6 +1923,7 @@ theorem mfderiv_prod_eq_add {f : M × M' → M''} {p : M × M'}
   simp_rw [Prod.mk.eta]
   all_goals infer_instance
 #align mfderiv_prod_eq_add mfderiv_prod_eq_add
+-/
 
 end Prod
 
@@ -1573,102 +1941,138 @@ section Group
 
 variable {I} {z : M} {f g : M → E'} {f' g' : TangentSpace I z →L[𝕜] E'}
 
-theorem HasMfderivAt.add (hf : HasMfderivAt I 𝓘(𝕜, E') f z f')
-    (hg : HasMfderivAt I 𝓘(𝕜, E') g z g') : HasMfderivAt I 𝓘(𝕜, E') (f + g) z (f' + g') :=
+#print HasMFDerivAt.add /-
+theorem HasMFDerivAt.add (hf : HasMFDerivAt I 𝓘(𝕜, E') f z f')
+    (hg : HasMFDerivAt I 𝓘(𝕜, E') g z g') : HasMFDerivAt I 𝓘(𝕜, E') (f + g) z (f' + g') :=
   ⟨hf.1.add hg.1, hf.2.add hg.2⟩
-#align has_mfderiv_at.add HasMfderivAt.add
+#align has_mfderiv_at.add HasMFDerivAt.add
+-/
 
-theorem MdifferentiableAt.add (hf : MdifferentiableAt I 𝓘(𝕜, E') f z)
-    (hg : MdifferentiableAt I 𝓘(𝕜, E') g z) : MdifferentiableAt I 𝓘(𝕜, E') (f + g) z :=
-  (hf.HasMfderivAt.add hg.HasMfderivAt).MdifferentiableAt
-#align mdifferentiable_at.add MdifferentiableAt.add
+#print MDifferentiableAt.add /-
+theorem MDifferentiableAt.add (hf : MDifferentiableAt I 𝓘(𝕜, E') f z)
+    (hg : MDifferentiableAt I 𝓘(𝕜, E') g z) : MDifferentiableAt I 𝓘(𝕜, E') (f + g) z :=
+  (hf.HasMFDerivAt.add hg.HasMFDerivAt).MDifferentiableAt
+#align mdifferentiable_at.add MDifferentiableAt.add
+-/
 
-theorem Mdifferentiable.add (hf : Mdifferentiable I 𝓘(𝕜, E') f)
-    (hg : Mdifferentiable I 𝓘(𝕜, E') g) : Mdifferentiable I 𝓘(𝕜, E') (f + g) := fun x =>
+#print MDifferentiable.add /-
+theorem MDifferentiable.add (hf : MDifferentiable I 𝓘(𝕜, E') f)
+    (hg : MDifferentiable I 𝓘(𝕜, E') g) : MDifferentiable I 𝓘(𝕜, E') (f + g) := fun x =>
   (hf x).add (hg x)
-#align mdifferentiable.add Mdifferentiable.add
+#align mdifferentiable.add MDifferentiable.add
+-/
 
-theorem mfderiv_add (hf : MdifferentiableAt I 𝓘(𝕜, E') f z)
-    (hg : MdifferentiableAt I 𝓘(𝕜, E') g z) :
+#print mfderiv_add /-
+theorem mfderiv_add (hf : MDifferentiableAt I 𝓘(𝕜, E') f z)
+    (hg : MDifferentiableAt I 𝓘(𝕜, E') g z) :
     (mfderiv I 𝓘(𝕜, E') (f + g) z : TangentSpace I z →L[𝕜] E') =
       (mfderiv I 𝓘(𝕜, E') f z + mfderiv I 𝓘(𝕜, E') g z : TangentSpace I z →L[𝕜] E') :=
-  (hf.HasMfderivAt.add hg.HasMfderivAt).mfderiv
+  (hf.HasMFDerivAt.add hg.HasMFDerivAt).mfderiv
 #align mfderiv_add mfderiv_add
+-/
 
-theorem HasMfderivAt.const_smul (hf : HasMfderivAt I 𝓘(𝕜, E') f z f') (s : 𝕜) :
-    HasMfderivAt I 𝓘(𝕜, E') (s • f) z (s • f') :=
+#print HasMFDerivAt.const_smul /-
+theorem HasMFDerivAt.const_smul (hf : HasMFDerivAt I 𝓘(𝕜, E') f z f') (s : 𝕜) :
+    HasMFDerivAt I 𝓘(𝕜, E') (s • f) z (s • f') :=
   ⟨hf.1.const_smul s, hf.2.const_smul s⟩
-#align has_mfderiv_at.const_smul HasMfderivAt.const_smul
+#align has_mfderiv_at.const_smul HasMFDerivAt.const_smul
+-/
 
-theorem MdifferentiableAt.const_smul (hf : MdifferentiableAt I 𝓘(𝕜, E') f z) (s : 𝕜) :
-    MdifferentiableAt I 𝓘(𝕜, E') (s • f) z :=
-  (hf.HasMfderivAt.const_smul s).MdifferentiableAt
-#align mdifferentiable_at.const_smul MdifferentiableAt.const_smul
+#print MDifferentiableAt.const_smul /-
+theorem MDifferentiableAt.const_smul (hf : MDifferentiableAt I 𝓘(𝕜, E') f z) (s : 𝕜) :
+    MDifferentiableAt I 𝓘(𝕜, E') (s • f) z :=
+  (hf.HasMFDerivAt.const_smul s).MDifferentiableAt
+#align mdifferentiable_at.const_smul MDifferentiableAt.const_smul
+-/
 
-theorem Mdifferentiable.const_smul (s : 𝕜) (hf : Mdifferentiable I 𝓘(𝕜, E') f) :
-    Mdifferentiable I 𝓘(𝕜, E') (s • f) := fun x => (hf x).const_smul s
-#align mdifferentiable.const_smul Mdifferentiable.const_smul
+#print MDifferentiable.const_smul /-
+theorem MDifferentiable.const_smul (s : 𝕜) (hf : MDifferentiable I 𝓘(𝕜, E') f) :
+    MDifferentiable I 𝓘(𝕜, E') (s • f) := fun x => (hf x).const_smul s
+#align mdifferentiable.const_smul MDifferentiable.const_smul
+-/
 
-theorem const_smul_mfderiv (hf : MdifferentiableAt I 𝓘(𝕜, E') f z) (s : 𝕜) :
+#print const_smul_mfderiv /-
+theorem const_smul_mfderiv (hf : MDifferentiableAt I 𝓘(𝕜, E') f z) (s : 𝕜) :
     (mfderiv I 𝓘(𝕜, E') (s • f) z : TangentSpace I z →L[𝕜] E') =
       (s • mfderiv I 𝓘(𝕜, E') f z : TangentSpace I z →L[𝕜] E') :=
-  (hf.HasMfderivAt.const_smul s).mfderiv
+  (hf.HasMFDerivAt.const_smul s).mfderiv
 #align const_smul_mfderiv const_smul_mfderiv
+-/
 
-theorem HasMfderivAt.neg (hf : HasMfderivAt I 𝓘(𝕜, E') f z f') :
-    HasMfderivAt I 𝓘(𝕜, E') (-f) z (-f') :=
+#print HasMFDerivAt.neg /-
+theorem HasMFDerivAt.neg (hf : HasMFDerivAt I 𝓘(𝕜, E') f z f') :
+    HasMFDerivAt I 𝓘(𝕜, E') (-f) z (-f') :=
   ⟨hf.1.neg, hf.2.neg⟩
-#align has_mfderiv_at.neg HasMfderivAt.neg
+#align has_mfderiv_at.neg HasMFDerivAt.neg
+-/
 
-theorem hasMfderivAt_neg : HasMfderivAt I 𝓘(𝕜, E') (-f) z (-f') ↔ HasMfderivAt I 𝓘(𝕜, E') f z f' :=
+#print hasMFDerivAt_neg /-
+theorem hasMFDerivAt_neg : HasMFDerivAt I 𝓘(𝕜, E') (-f) z (-f') ↔ HasMFDerivAt I 𝓘(𝕜, E') f z f' :=
   ⟨fun hf => by convert hf.neg <;> rw [neg_neg], fun hf => hf.neg⟩
-#align has_mfderiv_at_neg hasMfderivAt_neg
+#align has_mfderiv_at_neg hasMFDerivAt_neg
+-/
 
-theorem MdifferentiableAt.neg (hf : MdifferentiableAt I 𝓘(𝕜, E') f z) :
-    MdifferentiableAt I 𝓘(𝕜, E') (-f) z :=
-  hf.HasMfderivAt.neg.MdifferentiableAt
-#align mdifferentiable_at.neg MdifferentiableAt.neg
+#print MDifferentiableAt.neg /-
+theorem MDifferentiableAt.neg (hf : MDifferentiableAt I 𝓘(𝕜, E') f z) :
+    MDifferentiableAt I 𝓘(𝕜, E') (-f) z :=
+  hf.HasMFDerivAt.neg.MDifferentiableAt
+#align mdifferentiable_at.neg MDifferentiableAt.neg
+-/
 
+#print mdifferentiableAt_neg /-
 theorem mdifferentiableAt_neg :
-    MdifferentiableAt I 𝓘(𝕜, E') (-f) z ↔ MdifferentiableAt I 𝓘(𝕜, E') f z :=
+    MDifferentiableAt I 𝓘(𝕜, E') (-f) z ↔ MDifferentiableAt I 𝓘(𝕜, E') f z :=
   ⟨fun hf => by convert hf.neg <;> rw [neg_neg], fun hf => hf.neg⟩
 #align mdifferentiable_at_neg mdifferentiableAt_neg
+-/
 
-theorem Mdifferentiable.neg (hf : Mdifferentiable I 𝓘(𝕜, E') f) : Mdifferentiable I 𝓘(𝕜, E') (-f) :=
+#print MDifferentiable.neg /-
+theorem MDifferentiable.neg (hf : MDifferentiable I 𝓘(𝕜, E') f) : MDifferentiable I 𝓘(𝕜, E') (-f) :=
   fun x => (hf x).neg
-#align mdifferentiable.neg Mdifferentiable.neg
+#align mdifferentiable.neg MDifferentiable.neg
+-/
 
+#print mfderiv_neg /-
 theorem mfderiv_neg (f : M → E') (x : M) :
     (mfderiv I 𝓘(𝕜, E') (-f) x : TangentSpace I x →L[𝕜] E') =
       (-mfderiv I 𝓘(𝕜, E') f x : TangentSpace I x →L[𝕜] E') :=
   by
   simp_rw [mfderiv]
-  by_cases hf : MdifferentiableAt I 𝓘(𝕜, E') f x
+  by_cases hf : MDifferentiableAt I 𝓘(𝕜, E') f x
   · exact hf.has_mfderiv_at.neg.mfderiv
   · rw [if_neg hf]; rw [← mdifferentiableAt_neg] at hf ; rw [if_neg hf, neg_zero]
 #align mfderiv_neg mfderiv_neg
+-/
 
-theorem HasMfderivAt.sub (hf : HasMfderivAt I 𝓘(𝕜, E') f z f')
-    (hg : HasMfderivAt I 𝓘(𝕜, E') g z g') : HasMfderivAt I 𝓘(𝕜, E') (f - g) z (f' - g') :=
+#print HasMFDerivAt.sub /-
+theorem HasMFDerivAt.sub (hf : HasMFDerivAt I 𝓘(𝕜, E') f z f')
+    (hg : HasMFDerivAt I 𝓘(𝕜, E') g z g') : HasMFDerivAt I 𝓘(𝕜, E') (f - g) z (f' - g') :=
   ⟨hf.1.sub hg.1, hf.2.sub hg.2⟩
-#align has_mfderiv_at.sub HasMfderivAt.sub
+#align has_mfderiv_at.sub HasMFDerivAt.sub
+-/
 
-theorem MdifferentiableAt.sub (hf : MdifferentiableAt I 𝓘(𝕜, E') f z)
-    (hg : MdifferentiableAt I 𝓘(𝕜, E') g z) : MdifferentiableAt I 𝓘(𝕜, E') (f - g) z :=
-  (hf.HasMfderivAt.sub hg.HasMfderivAt).MdifferentiableAt
-#align mdifferentiable_at.sub MdifferentiableAt.sub
+#print MDifferentiableAt.sub /-
+theorem MDifferentiableAt.sub (hf : MDifferentiableAt I 𝓘(𝕜, E') f z)
+    (hg : MDifferentiableAt I 𝓘(𝕜, E') g z) : MDifferentiableAt I 𝓘(𝕜, E') (f - g) z :=
+  (hf.HasMFDerivAt.sub hg.HasMFDerivAt).MDifferentiableAt
+#align mdifferentiable_at.sub MDifferentiableAt.sub
+-/
 
-theorem Mdifferentiable.sub (hf : Mdifferentiable I 𝓘(𝕜, E') f)
-    (hg : Mdifferentiable I 𝓘(𝕜, E') g) : Mdifferentiable I 𝓘(𝕜, E') (f - g) := fun x =>
+#print MDifferentiable.sub /-
+theorem MDifferentiable.sub (hf : MDifferentiable I 𝓘(𝕜, E') f)
+    (hg : MDifferentiable I 𝓘(𝕜, E') g) : MDifferentiable I 𝓘(𝕜, E') (f - g) := fun x =>
   (hf x).sub (hg x)
-#align mdifferentiable.sub Mdifferentiable.sub
+#align mdifferentiable.sub MDifferentiable.sub
+-/
 
-theorem mfderiv_sub (hf : MdifferentiableAt I 𝓘(𝕜, E') f z)
-    (hg : MdifferentiableAt I 𝓘(𝕜, E') g z) :
+#print mfderiv_sub /-
+theorem mfderiv_sub (hf : MDifferentiableAt I 𝓘(𝕜, E') f z)
+    (hg : MDifferentiableAt I 𝓘(𝕜, E') g z) :
     (mfderiv I 𝓘(𝕜, E') (f - g) z : TangentSpace I z →L[𝕜] E') =
       (mfderiv I 𝓘(𝕜, E') f z - mfderiv I 𝓘(𝕜, E') g z : TangentSpace I z →L[𝕜] E') :=
-  (hf.HasMfderivAt.sub hg.HasMfderivAt).mfderiv
+  (hf.HasMFDerivAt.sub hg.HasMFDerivAt).mfderiv
 #align mfderiv_sub mfderiv_sub
+-/
 
 end Group
 
@@ -1677,38 +2081,50 @@ section AlgebraOverRing
 variable {I} {z : M} {F' : Type _} [NormedRing F'] [NormedAlgebra 𝕜 F'] {p q : M → F'}
   {p' q' : TangentSpace I z →L[𝕜] F'}
 
-theorem HasMfderivWithinAt.mul' (hp : HasMfderivWithinAt I 𝓘(𝕜, F') p s z p')
-    (hq : HasMfderivWithinAt I 𝓘(𝕜, F') q s z q') :
-    HasMfderivWithinAt I 𝓘(𝕜, F') (p * q) s z (p z • q' + p'.smul_right (q z) : E →L[𝕜] F') :=
+#print HasMFDerivWithinAt.mul' /-
+theorem HasMFDerivWithinAt.mul' (hp : HasMFDerivWithinAt I 𝓘(𝕜, F') p s z p')
+    (hq : HasMFDerivWithinAt I 𝓘(𝕜, F') q s z q') :
+    HasMFDerivWithinAt I 𝓘(𝕜, F') (p * q) s z (p z • q' + p'.smul_right (q z) : E →L[𝕜] F') :=
   ⟨hp.1.mul hq.1, by simpa only [mfld_simps] using hp.2.mul' hq.2⟩
-#align has_mfderiv_within_at.mul' HasMfderivWithinAt.mul'
-
-theorem HasMfderivAt.mul' (hp : HasMfderivAt I 𝓘(𝕜, F') p z p')
-    (hq : HasMfderivAt I 𝓘(𝕜, F') q z q') :
-    HasMfderivAt I 𝓘(𝕜, F') (p * q) z (p z • q' + p'.smul_right (q z) : E →L[𝕜] F') :=
-  hasMfderivWithinAt_univ.mp <| hp.HasMfderivWithinAt.mul' hq.HasMfderivWithinAt
-#align has_mfderiv_at.mul' HasMfderivAt.mul'
-
-theorem MdifferentiableWithinAt.mul (hp : MdifferentiableWithinAt I 𝓘(𝕜, F') p s z)
-    (hq : MdifferentiableWithinAt I 𝓘(𝕜, F') q s z) :
-    MdifferentiableWithinAt I 𝓘(𝕜, F') (p * q) s z :=
-  (hp.HasMfderivWithinAt.mul' hq.HasMfderivWithinAt).MdifferentiableWithinAt
-#align mdifferentiable_within_at.mul MdifferentiableWithinAt.mul
-
-theorem MdifferentiableAt.mul (hp : MdifferentiableAt I 𝓘(𝕜, F') p z)
-    (hq : MdifferentiableAt I 𝓘(𝕜, F') q z) : MdifferentiableAt I 𝓘(𝕜, F') (p * q) z :=
-  (hp.HasMfderivAt.mul' hq.HasMfderivAt).MdifferentiableAt
-#align mdifferentiable_at.mul MdifferentiableAt.mul
-
-theorem MdifferentiableOn.mul (hp : MdifferentiableOn I 𝓘(𝕜, F') p s)
-    (hq : MdifferentiableOn I 𝓘(𝕜, F') q s) : MdifferentiableOn I 𝓘(𝕜, F') (p * q) s := fun x hx =>
+#align has_mfderiv_within_at.mul' HasMFDerivWithinAt.mul'
+-/
+
+#print HasMFDerivAt.mul' /-
+theorem HasMFDerivAt.mul' (hp : HasMFDerivAt I 𝓘(𝕜, F') p z p')
+    (hq : HasMFDerivAt I 𝓘(𝕜, F') q z q') :
+    HasMFDerivAt I 𝓘(𝕜, F') (p * q) z (p z • q' + p'.smul_right (q z) : E →L[𝕜] F') :=
+  hasMFDerivWithinAt_univ.mp <| hp.HasMFDerivWithinAt.mul' hq.HasMFDerivWithinAt
+#align has_mfderiv_at.mul' HasMFDerivAt.mul'
+-/
+
+#print MDifferentiableWithinAt.mul /-
+theorem MDifferentiableWithinAt.mul (hp : MDifferentiableWithinAt I 𝓘(𝕜, F') p s z)
+    (hq : MDifferentiableWithinAt I 𝓘(𝕜, F') q s z) :
+    MDifferentiableWithinAt I 𝓘(𝕜, F') (p * q) s z :=
+  (hp.HasMFDerivWithinAt.mul' hq.HasMFDerivWithinAt).MDifferentiableWithinAt
+#align mdifferentiable_within_at.mul MDifferentiableWithinAt.mul
+-/
+
+#print MDifferentiableAt.mul /-
+theorem MDifferentiableAt.mul (hp : MDifferentiableAt I 𝓘(𝕜, F') p z)
+    (hq : MDifferentiableAt I 𝓘(𝕜, F') q z) : MDifferentiableAt I 𝓘(𝕜, F') (p * q) z :=
+  (hp.HasMFDerivAt.mul' hq.HasMFDerivAt).MDifferentiableAt
+#align mdifferentiable_at.mul MDifferentiableAt.mul
+-/
+
+#print MDifferentiableOn.mul /-
+theorem MDifferentiableOn.mul (hp : MDifferentiableOn I 𝓘(𝕜, F') p s)
+    (hq : MDifferentiableOn I 𝓘(𝕜, F') q s) : MDifferentiableOn I 𝓘(𝕜, F') (p * q) s := fun x hx =>
   (hp x hx).mul <| hq x hx
-#align mdifferentiable_on.mul MdifferentiableOn.mul
+#align mdifferentiable_on.mul MDifferentiableOn.mul
+-/
 
-theorem Mdifferentiable.mul (hp : Mdifferentiable I 𝓘(𝕜, F') p)
-    (hq : Mdifferentiable I 𝓘(𝕜, F') q) : Mdifferentiable I 𝓘(𝕜, F') (p * q) := fun x =>
+#print MDifferentiable.mul /-
+theorem MDifferentiable.mul (hp : MDifferentiable I 𝓘(𝕜, F') p)
+    (hq : MDifferentiable I 𝓘(𝕜, F') q) : MDifferentiable I 𝓘(𝕜, F') (p * q) := fun x =>
   (hp x).mul (hq x)
-#align mdifferentiable.mul Mdifferentiable.mul
+#align mdifferentiable.mul MDifferentiable.mul
+-/
 
 end AlgebraOverRing
 
@@ -1717,17 +2133,21 @@ section AlgebraOverCommRing
 variable {I} {z : M} {F' : Type _} [NormedCommRing F'] [NormedAlgebra 𝕜 F'] {p q : M → F'}
   {p' q' : TangentSpace I z →L[𝕜] F'}
 
-theorem HasMfderivWithinAt.mul (hp : HasMfderivWithinAt I 𝓘(𝕜, F') p s z p')
-    (hq : HasMfderivWithinAt I 𝓘(𝕜, F') q s z q') :
-    HasMfderivWithinAt I 𝓘(𝕜, F') (p * q) s z (p z • q' + q z • p' : E →L[𝕜] F') := by
+#print HasMFDerivWithinAt.mul /-
+theorem HasMFDerivWithinAt.mul (hp : HasMFDerivWithinAt I 𝓘(𝕜, F') p s z p')
+    (hq : HasMFDerivWithinAt I 𝓘(𝕜, F') q s z q') :
+    HasMFDerivWithinAt I 𝓘(𝕜, F') (p * q) s z (p z • q' + q z • p' : E →L[𝕜] F') := by
   convert hp.mul' hq; ext z; apply mul_comm
-#align has_mfderiv_within_at.mul HasMfderivWithinAt.mul
+#align has_mfderiv_within_at.mul HasMFDerivWithinAt.mul
+-/
 
-theorem HasMfderivAt.mul (hp : HasMfderivAt I 𝓘(𝕜, F') p z p')
-    (hq : HasMfderivAt I 𝓘(𝕜, F') q z q') :
-    HasMfderivAt I 𝓘(𝕜, F') (p * q) z (p z • q' + q z • p' : E →L[𝕜] F') :=
-  hasMfderivWithinAt_univ.mp <| hp.HasMfderivWithinAt.mul hq.HasMfderivWithinAt
-#align has_mfderiv_at.mul HasMfderivAt.mul
+#print HasMFDerivAt.mul /-
+theorem HasMFDerivAt.mul (hp : HasMFDerivAt I 𝓘(𝕜, F') p z p')
+    (hq : HasMFDerivAt I 𝓘(𝕜, F') q z q') :
+    HasMFDerivAt I 𝓘(𝕜, F') (p * q) z (p z • q' + q z • p' : E →L[𝕜] F') :=
+  hasMFDerivWithinAt_univ.mp <| hp.HasMFDerivWithinAt.mul hq.HasMFDerivWithinAt
+#align has_mfderiv_at.mul HasMFDerivAt.mul
+-/
 
 end AlgebraOverCommRing
 
@@ -1738,39 +2158,55 @@ namespace ModelWithCorners
 /-! #### Model with corners -/
 
 
-protected theorem hasMfderivAt {x} : HasMfderivAt I 𝓘(𝕜, E) I x (ContinuousLinearMap.id _ _) :=
+#print ModelWithCorners.hasMFDerivAt /-
+protected theorem hasMFDerivAt {x} : HasMFDerivAt I 𝓘(𝕜, E) I x (ContinuousLinearMap.id _ _) :=
   ⟨I.ContinuousAt, (hasFDerivWithinAt_id _ _).congr' I.RightInvOn (mem_range_self _)⟩
-#align model_with_corners.has_mfderiv_at ModelWithCorners.hasMfderivAt
+#align model_with_corners.has_mfderiv_at ModelWithCorners.hasMFDerivAt
+-/
 
-protected theorem hasMfderivWithinAt {s x} :
-    HasMfderivWithinAt I 𝓘(𝕜, E) I s x (ContinuousLinearMap.id _ _) :=
-  I.HasMfderivAt.HasMfderivWithinAt
-#align model_with_corners.has_mfderiv_within_at ModelWithCorners.hasMfderivWithinAt
+#print ModelWithCorners.hasMFDerivWithinAt /-
+protected theorem hasMFDerivWithinAt {s x} :
+    HasMFDerivWithinAt I 𝓘(𝕜, E) I s x (ContinuousLinearMap.id _ _) :=
+  I.HasMFDerivAt.HasMFDerivWithinAt
+#align model_with_corners.has_mfderiv_within_at ModelWithCorners.hasMFDerivWithinAt
+-/
 
-protected theorem mdifferentiableWithinAt {s x} : MdifferentiableWithinAt I 𝓘(𝕜, E) I s x :=
-  I.HasMfderivWithinAt.MdifferentiableWithinAt
+#print ModelWithCorners.mdifferentiableWithinAt /-
+protected theorem mdifferentiableWithinAt {s x} : MDifferentiableWithinAt I 𝓘(𝕜, E) I s x :=
+  I.HasMFDerivWithinAt.MDifferentiableWithinAt
 #align model_with_corners.mdifferentiable_within_at ModelWithCorners.mdifferentiableWithinAt
+-/
 
-protected theorem mdifferentiableAt {x} : MdifferentiableAt I 𝓘(𝕜, E) I x :=
-  I.HasMfderivAt.MdifferentiableAt
+#print ModelWithCorners.mdifferentiableAt /-
+protected theorem mdifferentiableAt {x} : MDifferentiableAt I 𝓘(𝕜, E) I x :=
+  I.HasMFDerivAt.MDifferentiableAt
 #align model_with_corners.mdifferentiable_at ModelWithCorners.mdifferentiableAt
+-/
 
-protected theorem mdifferentiableOn {s} : MdifferentiableOn I 𝓘(𝕜, E) I s := fun x hx =>
-  I.MdifferentiableWithinAt
+#print ModelWithCorners.mdifferentiableOn /-
+protected theorem mdifferentiableOn {s} : MDifferentiableOn I 𝓘(𝕜, E) I s := fun x hx =>
+  I.MDifferentiableWithinAt
 #align model_with_corners.mdifferentiable_on ModelWithCorners.mdifferentiableOn
+-/
 
-protected theorem mdifferentiable : Mdifferentiable I 𝓘(𝕜, E) I := fun x => I.MdifferentiableAt
+#print ModelWithCorners.mdifferentiable /-
+protected theorem mdifferentiable : MDifferentiable I 𝓘(𝕜, E) I := fun x => I.MDifferentiableAt
 #align model_with_corners.mdifferentiable ModelWithCorners.mdifferentiable
+-/
 
-theorem hasMfderivWithinAt_symm {x} (hx : x ∈ range I) :
-    HasMfderivWithinAt 𝓘(𝕜, E) I I.symm (range I) x (ContinuousLinearMap.id _ _) :=
+#print ModelWithCorners.hasMFDerivWithinAt_symm /-
+theorem hasMFDerivWithinAt_symm {x} (hx : x ∈ range I) :
+    HasMFDerivWithinAt 𝓘(𝕜, E) I I.symm (range I) x (ContinuousLinearMap.id _ _) :=
   ⟨I.continuousWithinAt_symm,
     (hasFDerivWithinAt_id _ _).congr' (fun y hy => I.RightInvOn hy.1) ⟨hx, mem_range_self _⟩⟩
-#align model_with_corners.has_mfderiv_within_at_symm ModelWithCorners.hasMfderivWithinAt_symm
+#align model_with_corners.has_mfderiv_within_at_symm ModelWithCorners.hasMFDerivWithinAt_symm
+-/
 
-theorem mdifferentiableOn_symm : MdifferentiableOn 𝓘(𝕜, E) I I.symm (range I) := fun x hx =>
-  (I.hasMfderivWithinAt_symm hx).MdifferentiableWithinAt
+#print ModelWithCorners.mdifferentiableOn_symm /-
+theorem mdifferentiableOn_symm : MDifferentiableOn 𝓘(𝕜, E) I I.symm (range I) := fun x hx =>
+  (I.hasMFDerivWithinAt_symm hx).MDifferentiableWithinAt
 #align model_with_corners.mdifferentiable_on_symm ModelWithCorners.mdifferentiableOn_symm
+-/
 
 end ModelWithCorners
 
@@ -1778,8 +2214,9 @@ section Charts
 
 variable {e : LocalHomeomorph M H}
 
+#print mdifferentiableAt_atlas /-
 theorem mdifferentiableAt_atlas (h : e ∈ atlas H M) {x : M} (hx : x ∈ e.source) :
-    MdifferentiableAt I I e x :=
+    MDifferentiableAt I I e x :=
   by
   refine' ⟨(e.continuous_on x hx).ContinuousAt (IsOpen.mem_nhds e.open_source hx), _⟩
   have mem :
@@ -1797,13 +2234,17 @@ theorem mdifferentiableAt_atlas (h : e ∈ atlas H M) {x : M} (hx : x ∈ e.sour
   · simpa only [mfld_simps]
   · apply IsOpen.mem_nhds ((LocalHomeomorph.open_source _).Preimage I.continuous_symm) mem.1
 #align mdifferentiable_at_atlas mdifferentiableAt_atlas
+-/
 
-theorem mdifferentiableOn_atlas (h : e ∈ atlas H M) : MdifferentiableOn I I e e.source :=
-  fun x hx => (mdifferentiableAt_atlas I h hx).MdifferentiableWithinAt
+#print mdifferentiableOn_atlas /-
+theorem mdifferentiableOn_atlas (h : e ∈ atlas H M) : MDifferentiableOn I I e e.source :=
+  fun x hx => (mdifferentiableAt_atlas I h hx).MDifferentiableWithinAt
 #align mdifferentiable_on_atlas mdifferentiableOn_atlas
+-/
 
+#print mdifferentiableAt_atlas_symm /-
 theorem mdifferentiableAt_atlas_symm (h : e ∈ atlas H M) {x : H} (hx : x ∈ e.target) :
-    MdifferentiableAt I I e.symm x :=
+    MDifferentiableAt I I e.symm x :=
   by
   refine' ⟨(e.continuous_on_symm x hx).ContinuousAt (IsOpen.mem_nhds e.open_target hx), _⟩
   have mem : I x ∈ I.symm ⁻¹' (e.symm ≫ₕ chart_at H (e.symm x)).source ∩ range I := by
@@ -1820,19 +2261,27 @@ theorem mdifferentiableAt_atlas_symm (h : e ∈ atlas H M) {x : H} (hx : x ∈ e
   · simpa only [mfld_simps]
   · apply IsOpen.mem_nhds ((LocalHomeomorph.open_source _).Preimage I.continuous_symm) mem.1
 #align mdifferentiable_at_atlas_symm mdifferentiableAt_atlas_symm
+-/
 
-theorem mdifferentiableOn_atlas_symm (h : e ∈ atlas H M) : MdifferentiableOn I I e.symm e.target :=
-  fun x hx => (mdifferentiableAt_atlas_symm I h hx).MdifferentiableWithinAt
+#print mdifferentiableOn_atlas_symm /-
+theorem mdifferentiableOn_atlas_symm (h : e ∈ atlas H M) : MDifferentiableOn I I e.symm e.target :=
+  fun x hx => (mdifferentiableAt_atlas_symm I h hx).MDifferentiableWithinAt
 #align mdifferentiable_on_atlas_symm mdifferentiableOn_atlas_symm
+-/
 
-theorem mdifferentiable_of_mem_atlas (h : e ∈ atlas H M) : e.Mdifferentiable I I :=
+#print mdifferentiable_of_mem_atlas /-
+theorem mdifferentiable_of_mem_atlas (h : e ∈ atlas H M) : e.MDifferentiable I I :=
   ⟨mdifferentiableOn_atlas I h, mdifferentiableOn_atlas_symm I h⟩
 #align mdifferentiable_of_mem_atlas mdifferentiable_of_mem_atlas
+-/
 
-theorem mdifferentiable_chart (x : M) : (chartAt H x).Mdifferentiable I I :=
+#print mdifferentiable_chart /-
+theorem mdifferentiable_chart (x : M) : (chartAt H x).MDifferentiable I I :=
   mdifferentiable_of_mem_atlas _ (chart_mem_atlas _ _)
 #align mdifferentiable_chart mdifferentiable_chart
+-/
 
+#print tangentMap_chart /-
 /-- The derivative of the chart at a base point is the chart of the tangent bundle, composed with
 the identification between the tangent bundle of the model space and the product space. -/
 theorem tangentMap_chart {p q : TangentBundle I M} (h : q.1 ∈ (chartAt H p.1).source) :
@@ -1841,11 +2290,13 @@ theorem tangentMap_chart {p q : TangentBundle I M} (h : q.1 ∈ (chartAt H p.1).
         ((chartAt (ModelProd H E) p : TangentBundle I M → ModelProd H E) q) :=
   by
   dsimp [tangentMap]
-  rw [MdifferentiableAt.mfderiv]
+  rw [MDifferentiableAt.mfderiv]
   · rfl
   · exact mdifferentiableAt_atlas _ (chart_mem_atlas _ _) h
 #align tangent_map_chart tangentMap_chart
+-/
 
+#print tangentMap_chart_symm /-
 /-- The derivative of the inverse of the chart at a base point is the inverse of the chart of the
 tangent bundle, composed with the identification between the tangent bundle of the model space and
 the product space. -/
@@ -1856,13 +2307,14 @@ theorem tangentMap_chart_symm {p : TangentBundle I M} {q : TangentBundle I H}
         ((Equiv.sigmaEquivProd H E) q) :=
   by
   dsimp only [tangentMap]
-  rw [MdifferentiableAt.mfderiv (mdifferentiableAt_atlas_symm _ (chart_mem_atlas _ _) h)]
+  rw [MDifferentiableAt.mfderiv (mdifferentiableAt_atlas_symm _ (chart_mem_atlas _ _) h)]
   -- a trivial instance is needed after the rewrite, handle it right now.
   rotate_left;
   · infer_instance
   simp only [ContinuousLinearMap.coe_coe, TangentBundle.chartAt, h, tangentBundleCore, chart_at,
     Sigma.mk.inj_iff, mfld_simps]
 #align tangent_map_chart_symm tangentMap_chart_symm
+-/
 
 end Charts
 
@@ -1871,7 +2323,7 @@ end SpecificFunctions
 /-! ### Differentiable local homeomorphisms -/
 
 
-namespace LocalHomeomorph.Mdifferentiable
+namespace LocalHomeomorph.MDifferentiable
 
 variable {𝕜 : Type _} [NontriviallyNormedField 𝕜] {E : Type _} [NormedAddCommGroup E]
   [NormedSpace 𝕜 E] {H : Type _} [TopologicalSpace H] {I : ModelWithCorners 𝕜 E H} {M : Type _}
@@ -1880,23 +2332,30 @@ variable {𝕜 : Type _} [NontriviallyNormedField 𝕜] {E : Type _} [NormedAddC
   [TopologicalSpace M'] [ChartedSpace H' M'] {E'' : Type _} [NormedAddCommGroup E'']
   [NormedSpace 𝕜 E''] {H'' : Type _} [TopologicalSpace H''] {I'' : ModelWithCorners 𝕜 E'' H''}
   {M'' : Type _} [TopologicalSpace M''] [ChartedSpace H'' M''] {e : LocalHomeomorph M M'}
-  (he : e.Mdifferentiable I I') {e' : LocalHomeomorph M' M''}
+  (he : e.MDifferentiable I I') {e' : LocalHomeomorph M' M''}
 
-theorem symm : e.symm.Mdifferentiable I' I :=
+#print LocalHomeomorph.MDifferentiable.symm /-
+theorem symm : e.symm.MDifferentiable I' I :=
   ⟨he.2, he.1⟩
-#align local_homeomorph.mdifferentiable.symm LocalHomeomorph.Mdifferentiable.symm
+#align local_homeomorph.mdifferentiable.symm LocalHomeomorph.MDifferentiable.symm
+-/
 
-protected theorem mdifferentiableAt {x : M} (hx : x ∈ e.source) : MdifferentiableAt I I' e x :=
-  (he.1 x hx).MdifferentiableAt (IsOpen.mem_nhds e.open_source hx)
-#align local_homeomorph.mdifferentiable.mdifferentiable_at LocalHomeomorph.Mdifferentiable.mdifferentiableAt
+#print LocalHomeomorph.MDifferentiable.mdifferentiableAt /-
+protected theorem mdifferentiableAt {x : M} (hx : x ∈ e.source) : MDifferentiableAt I I' e x :=
+  (he.1 x hx).MDifferentiableAt (IsOpen.mem_nhds e.open_source hx)
+#align local_homeomorph.mdifferentiable.mdifferentiable_at LocalHomeomorph.MDifferentiable.mdifferentiableAt
+-/
 
-theorem mdifferentiableAt_symm {x : M'} (hx : x ∈ e.target) : MdifferentiableAt I' I e.symm x :=
-  (he.2 x hx).MdifferentiableAt (IsOpen.mem_nhds e.open_target hx)
-#align local_homeomorph.mdifferentiable.mdifferentiable_at_symm LocalHomeomorph.Mdifferentiable.mdifferentiableAt_symm
+#print LocalHomeomorph.MDifferentiable.mdifferentiableAt_symm /-
+theorem mdifferentiableAt_symm {x : M'} (hx : x ∈ e.target) : MDifferentiableAt I' I e.symm x :=
+  (he.2 x hx).MDifferentiableAt (IsOpen.mem_nhds e.open_target hx)
+#align local_homeomorph.mdifferentiable.mdifferentiable_at_symm LocalHomeomorph.MDifferentiable.mdifferentiableAt_symm
+-/
 
 variable [SmoothManifoldWithCorners I M] [SmoothManifoldWithCorners I' M']
   [SmoothManifoldWithCorners I'' M'']
 
+#print LocalHomeomorph.MDifferentiable.symm_comp_deriv /-
 theorem symm_comp_deriv {x : M} (hx : x ∈ e.source) :
     (mfderiv I' I e.symm (e x)).comp (mfderiv I I' e x) =
       ContinuousLinearMap.id 𝕜 (TangentSpace I x) :=
@@ -1909,14 +2368,18 @@ theorem symm_comp_deriv {x : M} (hx : x ∈ e.source) :
   apply Filter.EventuallyEq.mfderiv_eq
   have : e.source ∈ 𝓝 x := IsOpen.mem_nhds e.open_source hx
   exact Filter.mem_of_superset this (by mfld_set_tac)
-#align local_homeomorph.mdifferentiable.symm_comp_deriv LocalHomeomorph.Mdifferentiable.symm_comp_deriv
+#align local_homeomorph.mdifferentiable.symm_comp_deriv LocalHomeomorph.MDifferentiable.symm_comp_deriv
+-/
 
+#print LocalHomeomorph.MDifferentiable.comp_symm_deriv /-
 theorem comp_symm_deriv {x : M'} (hx : x ∈ e.target) :
     (mfderiv I I' e (e.symm x)).comp (mfderiv I' I e.symm x) =
       ContinuousLinearMap.id 𝕜 (TangentSpace I' x) :=
   he.symm.symm_comp_deriv hx
-#align local_homeomorph.mdifferentiable.comp_symm_deriv LocalHomeomorph.Mdifferentiable.comp_symm_deriv
+#align local_homeomorph.mdifferentiable.comp_symm_deriv LocalHomeomorph.MDifferentiable.comp_symm_deriv
+-/
 
+#print LocalHomeomorph.MDifferentiable.mfderiv /-
 /-- The derivative of a differentiable local homeomorphism, as a continuous linear equivalence
 between the tangent spaces at `x` and `e x`. -/
 protected def mfderiv {x : M} (hx : x ∈ e.source) : TangentSpace I x ≃L[𝕜] TangentSpace I' (e x) :=
@@ -1937,47 +2400,62 @@ protected def mfderiv {x : M} (hx : x ∈ e.source) : TangentSpace I x ≃L[𝕜
       conv_rhs => rw [← this, ← he.comp_symm_deriv (e.map_source hx)]
       rw [e.left_inv hx]
       rfl }
-#align local_homeomorph.mdifferentiable.mfderiv LocalHomeomorph.Mdifferentiable.mfderiv
+#align local_homeomorph.mdifferentiable.mfderiv LocalHomeomorph.MDifferentiable.mfderiv
+-/
 
+#print LocalHomeomorph.MDifferentiable.mfderiv_bijective /-
 theorem mfderiv_bijective {x : M} (hx : x ∈ e.source) : Function.Bijective (mfderiv I I' e x) :=
   (he.mfderiv hx).Bijective
-#align local_homeomorph.mdifferentiable.mfderiv_bijective LocalHomeomorph.Mdifferentiable.mfderiv_bijective
+#align local_homeomorph.mdifferentiable.mfderiv_bijective LocalHomeomorph.MDifferentiable.mfderiv_bijective
+-/
 
+#print LocalHomeomorph.MDifferentiable.mfderiv_injective /-
 theorem mfderiv_injective {x : M} (hx : x ∈ e.source) : Function.Injective (mfderiv I I' e x) :=
   (he.mfderiv hx).Injective
-#align local_homeomorph.mdifferentiable.mfderiv_injective LocalHomeomorph.Mdifferentiable.mfderiv_injective
+#align local_homeomorph.mdifferentiable.mfderiv_injective LocalHomeomorph.MDifferentiable.mfderiv_injective
+-/
 
+#print LocalHomeomorph.MDifferentiable.mfderiv_surjective /-
 theorem mfderiv_surjective {x : M} (hx : x ∈ e.source) : Function.Surjective (mfderiv I I' e x) :=
   (he.mfderiv hx).Surjective
-#align local_homeomorph.mdifferentiable.mfderiv_surjective LocalHomeomorph.Mdifferentiable.mfderiv_surjective
+#align local_homeomorph.mdifferentiable.mfderiv_surjective LocalHomeomorph.MDifferentiable.mfderiv_surjective
+-/
 
+#print LocalHomeomorph.MDifferentiable.ker_mfderiv_eq_bot /-
 theorem ker_mfderiv_eq_bot {x : M} (hx : x ∈ e.source) : LinearMap.ker (mfderiv I I' e x) = ⊥ :=
   (he.mfderiv hx).toLinearEquiv.ker
-#align local_homeomorph.mdifferentiable.ker_mfderiv_eq_bot LocalHomeomorph.Mdifferentiable.ker_mfderiv_eq_bot
+#align local_homeomorph.mdifferentiable.ker_mfderiv_eq_bot LocalHomeomorph.MDifferentiable.ker_mfderiv_eq_bot
+-/
 
+#print LocalHomeomorph.MDifferentiable.range_mfderiv_eq_top /-
 theorem range_mfderiv_eq_top {x : M} (hx : x ∈ e.source) : LinearMap.range (mfderiv I I' e x) = ⊤ :=
   (he.mfderiv hx).toLinearEquiv.range
-#align local_homeomorph.mdifferentiable.range_mfderiv_eq_top LocalHomeomorph.Mdifferentiable.range_mfderiv_eq_top
+#align local_homeomorph.mdifferentiable.range_mfderiv_eq_top LocalHomeomorph.MDifferentiable.range_mfderiv_eq_top
+-/
 
+#print LocalHomeomorph.MDifferentiable.range_mfderiv_eq_univ /-
 theorem range_mfderiv_eq_univ {x : M} (hx : x ∈ e.source) : range (mfderiv I I' e x) = univ :=
   (he.mfderiv_surjective hx).range_eq
-#align local_homeomorph.mdifferentiable.range_mfderiv_eq_univ LocalHomeomorph.Mdifferentiable.range_mfderiv_eq_univ
+#align local_homeomorph.mdifferentiable.range_mfderiv_eq_univ LocalHomeomorph.MDifferentiable.range_mfderiv_eq_univ
+-/
 
-theorem trans (he' : e'.Mdifferentiable I' I'') : (e.trans e').Mdifferentiable I I'' :=
+#print LocalHomeomorph.MDifferentiable.trans /-
+theorem trans (he' : e'.MDifferentiable I' I'') : (e.trans e').MDifferentiable I I'' :=
   by
   constructor
   · intro x hx
     simp only [mfld_simps] at hx 
     exact
-      ((he'.mdifferentiable_at hx.2).comp _ (he.mdifferentiable_at hx.1)).MdifferentiableWithinAt
+      ((he'.mdifferentiable_at hx.2).comp _ (he.mdifferentiable_at hx.1)).MDifferentiableWithinAt
   · intro x hx
     simp only [mfld_simps] at hx 
     exact
       ((he.symm.mdifferentiable_at hx.2).comp _
-          (he'.symm.mdifferentiable_at hx.1)).MdifferentiableWithinAt
-#align local_homeomorph.mdifferentiable.trans LocalHomeomorph.Mdifferentiable.trans
+          (he'.symm.mdifferentiable_at hx.1)).MDifferentiableWithinAt
+#align local_homeomorph.mdifferentiable.trans LocalHomeomorph.MDifferentiable.trans
+-/
 
-end LocalHomeomorph.Mdifferentiable
+end LocalHomeomorph.MDifferentiable
 
 /-! ### Differentiability of `ext_chart_at` -/
 
@@ -1988,25 +2466,33 @@ variable {𝕜 : Type _} [NontriviallyNormedField 𝕜] {E : Type _} [NormedAddC
   [NormedSpace 𝕜 E] {H : Type _} [TopologicalSpace H] (I : ModelWithCorners 𝕜 E H) {M : Type _}
   [TopologicalSpace M] [ChartedSpace H M] [SmoothManifoldWithCorners I M] {s : Set M} {x y : M}
 
-theorem hasMfderivAt_extChartAt (h : y ∈ (chartAt H x).source) :
-    HasMfderivAt I 𝓘(𝕜, E) (extChartAt I x) y (mfderiv I I (chartAt H x) y : _) :=
-  I.HasMfderivAt.comp y ((mdifferentiable_chart I x).MdifferentiableAt h).HasMfderivAt
-#align has_mfderiv_at_ext_chart_at hasMfderivAt_extChartAt
+#print hasMFDerivAt_extChartAt /-
+theorem hasMFDerivAt_extChartAt (h : y ∈ (chartAt H x).source) :
+    HasMFDerivAt I 𝓘(𝕜, E) (extChartAt I x) y (mfderiv I I (chartAt H x) y : _) :=
+  I.HasMFDerivAt.comp y ((mdifferentiable_chart I x).MDifferentiableAt h).HasMFDerivAt
+#align has_mfderiv_at_ext_chart_at hasMFDerivAt_extChartAt
+-/
 
-theorem hasMfderivWithinAt_extChartAt (h : y ∈ (chartAt H x).source) :
-    HasMfderivWithinAt I 𝓘(𝕜, E) (extChartAt I x) s y (mfderiv I I (chartAt H x) y : _) :=
-  (hasMfderivAt_extChartAt I h).HasMfderivWithinAt
-#align has_mfderiv_within_at_ext_chart_at hasMfderivWithinAt_extChartAt
+#print hasMFDerivWithinAt_extChartAt /-
+theorem hasMFDerivWithinAt_extChartAt (h : y ∈ (chartAt H x).source) :
+    HasMFDerivWithinAt I 𝓘(𝕜, E) (extChartAt I x) s y (mfderiv I I (chartAt H x) y : _) :=
+  (hasMFDerivAt_extChartAt I h).HasMFDerivWithinAt
+#align has_mfderiv_within_at_ext_chart_at hasMFDerivWithinAt_extChartAt
+-/
 
+#print mdifferentiableAt_extChartAt /-
 theorem mdifferentiableAt_extChartAt (h : y ∈ (chartAt H x).source) :
-    MdifferentiableAt I 𝓘(𝕜, E) (extChartAt I x) y :=
-  (hasMfderivAt_extChartAt I h).MdifferentiableAt
+    MDifferentiableAt I 𝓘(𝕜, E) (extChartAt I x) y :=
+  (hasMFDerivAt_extChartAt I h).MDifferentiableAt
 #align mdifferentiable_at_ext_chart_at mdifferentiableAt_extChartAt
+-/
 
+#print mdifferentiableOn_extChartAt /-
 theorem mdifferentiableOn_extChartAt :
-    MdifferentiableOn I 𝓘(𝕜, E) (extChartAt I x) (chartAt H x).source := fun y hy =>
-  (hasMfderivWithinAt_extChartAt I hy).MdifferentiableWithinAt
+    MDifferentiableOn I 𝓘(𝕜, E) (extChartAt I x) (chartAt H x).source := fun y hy =>
+  (hasMFDerivWithinAt_extChartAt I hy).MDifferentiableWithinAt
 #align mdifferentiable_on_ext_chart_at mdifferentiableOn_extChartAt
+-/
 
 end extChartAt
 
@@ -2022,11 +2508,12 @@ variable {𝕜 : Type _} [NontriviallyNormedField 𝕜] {E : Type _} [NormedAddC
   {I' : ModelWithCorners 𝕜 E' H'} {M' : Type _} [TopologicalSpace M'] [ChartedSpace H' M']
   {s : Set M}
 
+#print UniqueMDiffOn.uniqueMDiffOn_preimage /-
 /-- If a set has the unique differential property, then its image under a local
 diffeomorphism also has the unique differential property. -/
-theorem UniqueMdiffOn.uniqueMdiffOn_preimage [SmoothManifoldWithCorners I' M']
-    (hs : UniqueMdiffOn I s) {e : LocalHomeomorph M M'} (he : e.Mdifferentiable I I') :
-    UniqueMdiffOn I' (e.target ∩ e.symm ⁻¹' s) :=
+theorem UniqueMDiffOn.uniqueMDiffOn_preimage [SmoothManifoldWithCorners I' M']
+    (hs : UniqueMDiffOn I s) {e : LocalHomeomorph M M'} (he : e.MDifferentiable I I') :
+    UniqueMDiffOn I' (e.target ∩ e.symm ⁻¹' s) :=
   by
   /- Start from a point `x` in the image, and let `z` be its preimage. Then the unique
     derivative property at `x` is expressed through `ext_chart_at I' x`, and the unique
@@ -2046,20 +2533,20 @@ theorem UniqueMdiffOn.uniqueMdiffOn_preimage [SmoothManifoldWithCorners I' M']
     UniqueDiffWithinAt 𝕜 (F.symm ⁻¹' (s ∩ (e.source ∩ e ⁻¹' (extChartAt I' x).source)) ∩ F.target)
       (F z) :=
     by
-    have : UniqueMdiffWithinAt I s z := hs _ hx.2
+    have : UniqueMDiffWithinAt I s z := hs _ hx.2
     have S : e.source ∩ e ⁻¹' (extChartAt I' x).source ∈ 𝓝 z :=
       by
       apply IsOpen.mem_nhds
       apply e.continuous_on.preimage_open_of_open e.open_source (isOpen_extChartAt_source I' x)
       simp only [z_source, zx, mfld_simps]
     have := this.inter S
-    rw [uniqueMdiffWithinAt_iff] at this 
+    rw [uniqueMDiffWithinAt_iff] at this 
     exact this
   -- denote by `G` the change of coordinate, i.e., the composition of the two extended charts and
   -- of `e`
   let G := F.symm ≫ e.to_local_equiv ≫ extChartAt I' x
   -- `G` is differentiable
-  have Diff : ((chart_at H z).symm ≫ₕ e ≫ₕ chart_at H' x).Mdifferentiable I I' :=
+  have Diff : ((chart_at H z).symm ≫ₕ e ≫ₕ chart_at H' x).MDifferentiable I I' :=
     by
     have A := mdifferentiable_of_mem_atlas I (chart_mem_atlas H z)
     have B := mdifferentiable_of_mem_atlas I' (chart_mem_atlas H' x)
@@ -2098,40 +2585,45 @@ theorem UniqueMdiffOn.uniqueMdiffOn_preimage [SmoothManifoldWithCorners I' M']
       (extChartAt I' x).symm ⁻¹' e.target ∩ (extChartAt I' x).symm ⁻¹' (e.symm ⁻¹' s) ∩ range I'
   rw [image_subset_iff]
   mfld_set_tac
-#align unique_mdiff_on.unique_mdiff_on_preimage UniqueMdiffOn.uniqueMdiffOn_preimage
+#align unique_mdiff_on.unique_mdiff_on_preimage UniqueMDiffOn.uniqueMDiffOn_preimage
+-/
 
+#print UniqueMDiffOn.uniqueDiffOn_target_inter /-
 /-- If a set in a manifold has the unique derivative property, then its pullback by any extended
 chart, in the vector space, also has the unique derivative property. -/
-theorem UniqueMdiffOn.uniqueDiffOn_target_inter (hs : UniqueMdiffOn I s) (x : M) :
+theorem UniqueMDiffOn.uniqueDiffOn_target_inter (hs : UniqueMDiffOn I s) (x : M) :
     UniqueDiffOn 𝕜 ((extChartAt I x).target ∩ (extChartAt I x).symm ⁻¹' s) :=
   by
   -- this is just a reformulation of `unique_mdiff_on.unique_mdiff_on_preimage`, using as `e`
   -- the local chart at `x`.
   intro z hz
   simp only [mfld_simps] at hz 
-  have : (chart_at H x).Mdifferentiable I I := mdifferentiable_chart _ _
+  have : (chart_at H x).MDifferentiable I I := mdifferentiable_chart _ _
   have T := (hs.unique_mdiff_on_preimage this) (I.symm z)
-  simp only [hz.left.left, hz.left.right, hz.right, UniqueMdiffWithinAt, mfld_simps] at T ⊢
+  simp only [hz.left.left, hz.left.right, hz.right, UniqueMDiffWithinAt, mfld_simps] at T ⊢
   convert T using 1
   rw [@preimage_comp _ _ _ _ (chart_at H x).symm]
   mfld_set_tac
-#align unique_mdiff_on.unique_diff_on_target_inter UniqueMdiffOn.uniqueDiffOn_target_inter
+#align unique_mdiff_on.unique_diff_on_target_inter UniqueMDiffOn.uniqueDiffOn_target_inter
+-/
 
+#print UniqueMDiffOn.uniqueDiffOn_inter_preimage /-
 /-- When considering functions between manifolds, this statement shows up often. It entails
 the unique differential of the pullback in extended charts of the set where the function can
 be read in the charts. -/
-theorem UniqueMdiffOn.uniqueDiffOn_inter_preimage (hs : UniqueMdiffOn I s) (x : M) (y : M')
+theorem UniqueMDiffOn.uniqueDiffOn_inter_preimage (hs : UniqueMDiffOn I s) (x : M) (y : M')
     {f : M → M'} (hf : ContinuousOn f s) :
     UniqueDiffOn 𝕜
       ((extChartAt I x).target ∩ (extChartAt I x).symm ⁻¹' (s ∩ f ⁻¹' (extChartAt I' y).source)) :=
-  haveI : UniqueMdiffOn I (s ∩ f ⁻¹' (extChartAt I' y).source) :=
+  haveI : UniqueMDiffOn I (s ∩ f ⁻¹' (extChartAt I' y).source) :=
     by
     intro z hz
     apply (hs z hz.1).inter'
     apply (hf z hz.1).preimage_mem_nhdsWithin
     exact (isOpen_extChartAt_source I' y).mem_nhds hz.2
   this.unique_diff_on_target_inter _
-#align unique_mdiff_on.unique_diff_on_inter_preimage UniqueMdiffOn.uniqueDiffOn_inter_preimage
+#align unique_mdiff_on.unique_diff_on_inter_preimage UniqueMDiffOn.uniqueDiffOn_inter_preimage
+-/
 
 open Bundle
 
@@ -2141,10 +2633,11 @@ variable {F : Type _} [NormedAddCommGroup F] [NormedSpace 𝕜 F] (Z : M → Typ
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print UniqueMDiffOn.smooth_bundle_preimage /-
 /-- In a smooth fiber bundle, the preimage under the projection of a set with
 unique differential in the basis also has unique differential. -/
-theorem UniqueMdiffOn.smooth_bundle_preimage (hs : UniqueMdiffOn I s) :
-    UniqueMdiffOn (I.Prod 𝓘(𝕜, F)) (π Z ⁻¹' s) :=
+theorem UniqueMDiffOn.smooth_bundle_preimage (hs : UniqueMDiffOn I s) :
+    UniqueMDiffOn (I.Prod 𝓘(𝕜, F)) (π Z ⁻¹' s) :=
   by
   /- Using a chart (and the fact that unique differentiability is invariant under charts), we
     reduce the situation to the model space, where we can use the fact that products respect
@@ -2167,9 +2660,9 @@ theorem UniqueMdiffOn.smooth_bundle_preimage (hs : UniqueMdiffOn I s) :
     intro hx
     simp only [FiberBundle.chartedSpace_chartAt_symm_fst p x hx, mfld_simps]
   -- It suffices to prove unique differentiability in a chart
-  suffices h : UniqueMdiffOn (I.prod 𝓘(𝕜, F)) (e.target ∩ e.symm ⁻¹' (π Z ⁻¹' s))
+  suffices h : UniqueMDiffOn (I.prod 𝓘(𝕜, F)) (e.target ∩ e.symm ⁻¹' (π Z ⁻¹' s))
   · have A :
-      UniqueMdiffOn (I.prod 𝓘(𝕜, F))
+      UniqueMDiffOn (I.prod 𝓘(𝕜, F))
         (e.symm.target ∩ e.symm.symm ⁻¹' (e.target ∩ e.symm ⁻¹' (π Z ⁻¹' s))) :=
       by
       apply h.unique_mdiff_on_preimage
@@ -2182,7 +2675,7 @@ theorem UniqueMdiffOn.smooth_bundle_preimage (hs : UniqueMdiffOn I s) :
     simp only [e, LocalHomeomorph.left_inv _ hq.1, mfld_simps] at hq 
     simp only [hq, mfld_simps]
   intro q hq
-  simp only [UniqueMdiffWithinAt, ModelWithCorners.prod, -preimage_inter, mfld_simps]
+  simp only [UniqueMDiffWithinAt, ModelWithCorners.prod, -preimage_inter, mfld_simps]
   have :
     𝓝[(I.symm ⁻¹' (e₀.target ∩ e₀.symm ⁻¹' s) ∩ range I) ×ˢ univ] (I q.1, q.2) ≤
       𝓝[(fun p : E × F => (I.symm p.1, p.snd)) ⁻¹' (e.target ∩ e.symm ⁻¹' (π Z ⁻¹' s)) ∩
@@ -2205,20 +2698,23 @@ theorem UniqueMdiffOn.smooth_bundle_preimage (hs : UniqueMdiffOn I s) :
   apply UniqueDiffOn.prod _ uniqueDiffOn_univ
   · simp only [hq, mfld_simps]
   · intro x hx
-    have A : UniqueMdiffOn I (e₀.target ∩ e₀.symm ⁻¹' s) :=
+    have A : UniqueMDiffOn I (e₀.target ∩ e₀.symm ⁻¹' s) :=
       by
       apply hs.unique_mdiff_on_preimage
       exact mdifferentiable_of_mem_atlas _ (chart_mem_atlas _ _)
       infer_instance
-    simp only [UniqueMdiffOn, UniqueMdiffWithinAt, preimage_inter, mfld_simps] at A 
+    simp only [UniqueMDiffOn, UniqueMDiffWithinAt, preimage_inter, mfld_simps] at A 
     have B := A (I.symm x) hx.1.1 hx.1.2
     rwa [← preimage_inter, ModelWithCorners.right_inv _ hx.2] at B 
-#align unique_mdiff_on.smooth_bundle_preimage UniqueMdiffOn.smooth_bundle_preimage
+#align unique_mdiff_on.smooth_bundle_preimage UniqueMDiffOn.smooth_bundle_preimage
+-/
 
-theorem UniqueMdiffOn.tangent_bundle_proj_preimage (hs : UniqueMdiffOn I s) :
-    UniqueMdiffOn I.tangent (π (TangentSpace I) ⁻¹' s) :=
+#print UniqueMDiffOn.tangentBundle_proj_preimage /-
+theorem UniqueMDiffOn.tangentBundle_proj_preimage (hs : UniqueMDiffOn I s) :
+    UniqueMDiffOn I.tangent (π (TangentSpace I) ⁻¹' s) :=
   hs.smooth_bundle_preimage _
-#align unique_mdiff_on.tangent_bundle_proj_preimage UniqueMdiffOn.tangent_bundle_proj_preimage
+#align unique_mdiff_on.tangent_bundle_proj_preimage UniqueMDiffOn.tangentBundle_proj_preimage
+-/
 
 end UniqueMdiff
 
Diff
@@ -424,8 +424,6 @@ theorem mdifferentiableWithinAt_iff {f : M → M'} {s : Set M} {x : M} :
   simp only [HasFDerivWithinAt, nhdsWithin_inter, nhdsWithin_extChartAt_target_eq]
 #align mdifferentiable_within_at_iff mdifferentiableWithinAt_iff
 
-include Is I's
-
 /-- One can reformulate differentiability within a set at a point as continuity within this set at
 this point, and differentiability in any chart containing that point. -/
 theorem mdifferentiableWithinAt_iff_of_mem_source {x' : M} {y : M'}
@@ -566,8 +564,6 @@ theorem mfderivWithin_subset (st : s ⊆ t) (hs : UniqueMdiffWithinAt I s x)
   ((MdifferentiableWithinAt.hasMfderivWithinAt h).mono st).mfderivWithin hs
 #align mfderiv_within_subset mfderivWithin_subset
 
-omit Is I's
-
 theorem MdifferentiableWithinAt.mono (hst : s ⊆ t) (h : MdifferentiableWithinAt I I' f t x) :
     MdifferentiableWithinAt I I' f s x :=
   ⟨ContinuousWithinAt.mono h.1 hst,
@@ -628,8 +624,6 @@ theorem mdifferentiableOn_of_locally_mdifferentiableOn
   exact (mdifferentiableWithinAt_inter (IsOpen.mem_nhds t_open xt)).1 (ht x ⟨xs, xt⟩)
 #align mdifferentiable_on_of_locally_mdifferentiable_on mdifferentiableOn_of_locally_mdifferentiableOn
 
-include Is I's
-
 @[simp, mfld_simps]
 theorem mfderivWithin_univ : mfderivWithin I I' f univ = mfderiv I I' f :=
   by
@@ -655,8 +649,6 @@ theorem mdifferentiableAt_iff_of_mem_source {x' : M} {y : M'}
       rw [continuousWithinAt_univ, Set.preimage_univ, Set.univ_inter]
 #align mdifferentiable_at_iff_of_mem_source mdifferentiableAt_iff_of_mem_source
 
-omit Is I's
-
 /-! ### Deriving continuity from differentiability on manifolds -/
 
 
@@ -686,8 +678,6 @@ theorem Mdifferentiable.continuous (h : Mdifferentiable I I' f) : Continuous f :
   continuous_iff_continuousAt.2 fun x => (h x).ContinuousAt
 #align mdifferentiable.continuous Mdifferentiable.continuous
 
-include Is I's
-
 theorem tangentMapWithin_subset {p : TangentBundle I M} (st : s ⊆ t)
     (hs : UniqueMdiffWithinAt I s p.1) (h : MdifferentiableWithinAt I I' f t p.1) :
     tangentMapWithin I I' f s p = tangentMapWithin I I' f t p :=
@@ -729,8 +719,6 @@ theorem tangentMap_fst {p : TangentBundle I M} : (tangentMap I I' f p).1 = f p.1
   rfl
 #align tangent_map_fst tangentMap_fst
 
-omit Is I's
-
 theorem MdifferentiableWithinAt.prod_mk {f : M → M'} {g : M → M''}
     (hf : MdifferentiableWithinAt I I' f s x) (hg : MdifferentiableWithinAt I I'' g s x) :
     MdifferentiableWithinAt I (I'.Prod I'') (fun x => (f x, g x)) s x :=
@@ -808,8 +796,6 @@ theorem HasMfderivAt.congr_of_eventuallyEq (h : HasMfderivAt I I' f x f') (h₁
   rwa [nhdsWithin_univ]
 #align has_mfderiv_at.congr_of_eventually_eq HasMfderivAt.congr_of_eventuallyEq
 
-include Is I's
-
 theorem MdifferentiableWithinAt.congr_of_eventuallyEq (h : MdifferentiableWithinAt I I' f s x)
     (h₁ : f₁ =ᶠ[𝓝[s] x] f) (hx : f₁ x = f x) : MdifferentiableWithinAt I I' f₁ s x :=
   (h.HasMfderivWithinAt.congr_of_eventuallyEq h₁ hx).MdifferentiableWithinAt
@@ -908,8 +894,6 @@ theorem mfderiv_congr {f' : M → M'} (h : f = f') :
 /-! ### Composition lemmas -/
 
 
-omit Is I's
-
 theorem written_in_ext_chart_comp (h : ContinuousWithinAt f s x) :
     {y |
         writtenInExtChartAt I I'' x (g ∘ f) y =
@@ -925,8 +909,6 @@ theorem written_in_ext_chart_comp (h : ContinuousWithinAt f s x) :
 
 variable (x)
 
-include Is I's I''s
-
 theorem HasMfderivWithinAt.comp (hg : HasMfderivWithinAt I' I'' g u (f x) g')
     (hf : HasMfderivWithinAt I I' f s x f') (hst : s ⊆ f ⁻¹' u) :
     HasMfderivWithinAt I I'' (g ∘ f) s x (g'.comp f') :=
@@ -1900,8 +1882,6 @@ variable {𝕜 : Type _} [NontriviallyNormedField 𝕜] {E : Type _} [NormedAddC
   {M'' : Type _} [TopologicalSpace M''] [ChartedSpace H'' M''] {e : LocalHomeomorph M M'}
   (he : e.Mdifferentiable I I') {e' : LocalHomeomorph M' M''}
 
-include he
-
 theorem symm : e.symm.Mdifferentiable I' I :=
   ⟨he.2, he.1⟩
 #align local_homeomorph.mdifferentiable.symm LocalHomeomorph.Mdifferentiable.symm
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 geometry.manifold.mfderiv
-! leanprover-community/mathlib commit 3a69562db5a458db8322b190ec8d9a8bbd8a5b14
+! leanprover-community/mathlib commit e354e865255654389cc46e6032160238df2e0f40
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -101,7 +101,7 @@ noncomputable section
 
 open scoped Classical Topology Manifold Bundle
 
-open Set
+open Set Bundle
 
 universe u
 
@@ -731,6 +731,53 @@ theorem tangentMap_fst {p : TangentBundle I M} : (tangentMap I I' f p).1 = f p.1
 
 omit Is I's
 
+theorem MdifferentiableWithinAt.prod_mk {f : M → M'} {g : M → M''}
+    (hf : MdifferentiableWithinAt I I' f s x) (hg : MdifferentiableWithinAt I I'' g s x) :
+    MdifferentiableWithinAt I (I'.Prod I'') (fun x => (f x, g x)) s x :=
+  ⟨hf.1.Prod hg.1, hf.2.Prod hg.2⟩
+#align mdifferentiable_within_at.prod_mk MdifferentiableWithinAt.prod_mk
+
+theorem MdifferentiableAt.prod_mk {f : M → M'} {g : M → M''} (hf : MdifferentiableAt I I' f x)
+    (hg : MdifferentiableAt I I'' g x) :
+    MdifferentiableAt I (I'.Prod I'') (fun x => (f x, g x)) x :=
+  ⟨hf.1.Prod hg.1, hf.2.Prod hg.2⟩
+#align mdifferentiable_at.prod_mk MdifferentiableAt.prod_mk
+
+theorem MdifferentiableOn.prod_mk {f : M → M'} {g : M → M''} (hf : MdifferentiableOn I I' f s)
+    (hg : MdifferentiableOn I I'' g s) :
+    MdifferentiableOn I (I'.Prod I'') (fun x => (f x, g x)) s := fun x hx =>
+  (hf x hx).prod_mk (hg x hx)
+#align mdifferentiable_on.prod_mk MdifferentiableOn.prod_mk
+
+theorem Mdifferentiable.prod_mk {f : M → M'} {g : M → M''} (hf : Mdifferentiable I I' f)
+    (hg : Mdifferentiable I I'' g) : Mdifferentiable I (I'.Prod I'') fun x => (f x, g x) := fun x =>
+  (hf x).prod_mk (hg x)
+#align mdifferentiable.prod_mk Mdifferentiable.prod_mk
+
+theorem MdifferentiableWithinAt.prod_mk_space {f : M → E'} {g : M → E''}
+    (hf : MdifferentiableWithinAt I 𝓘(𝕜, E') f s x)
+    (hg : MdifferentiableWithinAt I 𝓘(𝕜, E'') g s x) :
+    MdifferentiableWithinAt I 𝓘(𝕜, E' × E'') (fun x => (f x, g x)) s x :=
+  ⟨hf.1.Prod hg.1, hf.2.Prod hg.2⟩
+#align mdifferentiable_within_at.prod_mk_space MdifferentiableWithinAt.prod_mk_space
+
+theorem MdifferentiableAt.prod_mk_space {f : M → E'} {g : M → E''}
+    (hf : MdifferentiableAt I 𝓘(𝕜, E') f x) (hg : MdifferentiableAt I 𝓘(𝕜, E'') g x) :
+    MdifferentiableAt I 𝓘(𝕜, E' × E'') (fun x => (f x, g x)) x :=
+  ⟨hf.1.Prod hg.1, hf.2.Prod hg.2⟩
+#align mdifferentiable_at.prod_mk_space MdifferentiableAt.prod_mk_space
+
+theorem MdifferentiableOn.prod_mk_space {f : M → E'} {g : M → E''}
+    (hf : MdifferentiableOn I 𝓘(𝕜, E') f s) (hg : MdifferentiableOn I 𝓘(𝕜, E'') g s) :
+    MdifferentiableOn I 𝓘(𝕜, E' × E'') (fun x => (f x, g x)) s := fun x hx =>
+  (hf x hx).prod_mk_space (hg x hx)
+#align mdifferentiable_on.prod_mk_space MdifferentiableOn.prod_mk_space
+
+theorem Mdifferentiable.prod_mk_space {f : M → E'} {g : M → E''} (hf : Mdifferentiable I 𝓘(𝕜, E') f)
+    (hg : Mdifferentiable I 𝓘(𝕜, E'') g) : Mdifferentiable I 𝓘(𝕜, E' × E'') fun x => (f x, g x) :=
+  fun x => (hf x).prod_mk_space (hg x)
+#align mdifferentiable.prod_mk_space Mdifferentiable.prod_mk_space
+
 /-! ### Congruence lemmas for derivatives on manifolds -/
 
 
@@ -846,6 +893,18 @@ theorem Filter.EventuallyEq.mfderiv_eq (hL : f₁ =ᶠ[𝓝 x] f) :
   exact hL.mfderiv_within_eq (uniqueMdiffWithinAt_univ I) A
 #align filter.eventually_eq.mfderiv_eq Filter.EventuallyEq.mfderiv_eq
 
+/-- A congruence lemma for `mfderiv`, (ab)using the fact that `tangent_space I' (f x)` is
+definitionally equal to `E'`. -/
+theorem mfderiv_congr_point {x' : M} (h : x = x') :
+    @Eq (E →L[𝕜] E') (mfderiv I I' f x) (mfderiv I I' f x') := by subst h
+#align mfderiv_congr_point mfderiv_congr_point
+
+/-- A congruence lemma for `mfderiv`, (ab)using the fact that `tangent_space I' (f x)` is
+definitionally equal to `E'`. -/
+theorem mfderiv_congr {f' : M → M'} (h : f = f') :
+    @Eq (E →L[𝕜] E') (mfderiv I I' f x) (mfderiv I I' f' x) := by subst h
+#align mfderiv_congr mfderiv_congr
+
 /-! ### Composition lemmas -/
 
 
@@ -944,6 +1003,12 @@ theorem mfderiv_comp (hg : MdifferentiableAt I' I'' g (f x)) (hf : Mdifferentiab
   exact HasMfderivAt.comp x hg.has_mfderiv_at hf.has_mfderiv_at
 #align mfderiv_comp mfderiv_comp
 
+theorem mfderiv_comp_of_eq {x : M} {y : M'} (hg : MdifferentiableAt I' I'' g y)
+    (hf : MdifferentiableAt I I' f x) (hy : f x = y) :
+    mfderiv I I'' (g ∘ f) x = (mfderiv I' I'' g (f x)).comp (mfderiv I I' f x) := by subst hy;
+  exact mfderiv_comp x hg hf
+#align mfderiv_comp_of_eq mfderiv_comp_of_eq
+
 theorem MdifferentiableOn.comp (hg : MdifferentiableOn I' I'' g u) (hf : MdifferentiableOn I I' f s)
     (st : s ⊆ f ⁻¹' u) : MdifferentiableOn I I'' (g ∘ f) s := fun x hx =>
   MdifferentiableWithinAt.comp x (hg (f x) (st hx)) (hf x hx) st
@@ -1120,7 +1185,9 @@ variable {𝕜 : Type _} [NontriviallyNormedField 𝕜] {E : Type _} [NormedAddC
   [TopologicalSpace M] [ChartedSpace H M] [SmoothManifoldWithCorners I M] {E' : Type _}
   [NormedAddCommGroup E'] [NormedSpace 𝕜 E'] {H' : Type _} [TopologicalSpace H']
   (I' : ModelWithCorners 𝕜 E' H') {M' : Type _} [TopologicalSpace M'] [ChartedSpace H' M']
-  [SmoothManifoldWithCorners I' M']
+  [SmoothManifoldWithCorners I' M'] {E'' : Type _} [NormedAddCommGroup E''] [NormedSpace 𝕜 E'']
+  {H'' : Type _} [TopologicalSpace H''] (I'' : ModelWithCorners 𝕜 E'' H'') {M'' : Type _}
+  [TopologicalSpace M''] [ChartedSpace H'' M''] [SmoothManifoldWithCorners I'' M'']
 
 namespace ContinuousLinearMap
 
@@ -1210,7 +1277,7 @@ section id
 theorem hasMfderivAt_id (x : M) :
     HasMfderivAt I I (@id M) x (ContinuousLinearMap.id 𝕜 (TangentSpace I x)) :=
   by
-  refine' ⟨continuous_id.continuous_at, _⟩
+  refine' ⟨continuousAt_id, _⟩
   have : ∀ᶠ y in 𝓝[range I] (extChartAt I x) x, (extChartAt I x ∘ (extChartAt I x).symm) y = id y :=
     by
     apply Filter.mem_of_superset (extChartAt_target_mem_nhdsWithin I x)
@@ -1314,6 +1381,202 @@ theorem mfderivWithin_const (hxs : UniqueMdiffWithinAt I s x) :
 
 end Const
 
+section Prod
+
+/-! Operations on the product of two manifolds-/
+
+
+theorem hasMfderivAt_fst (x : M × M') :
+    HasMfderivAt (I.Prod I') I Prod.fst x
+      (ContinuousLinearMap.fst 𝕜 (TangentSpace I x.1) (TangentSpace I' x.2)) :=
+  by
+  refine' ⟨continuous_fst.continuous_at, _⟩
+  have :
+    ∀ᶠ y in 𝓝[range (I.prod I')] extChartAt (I.prod I') x x,
+      (extChartAt I x.1 ∘ Prod.fst ∘ (extChartAt (I.prod I') x).symm) y = y.1 :=
+    by
+    apply Filter.mem_of_superset (extChartAt_target_mem_nhdsWithin (I.prod I') x)
+    mfld_set_tac
+  apply HasFDerivWithinAt.congr_of_eventuallyEq hasFDerivWithinAt_fst this
+  simp only [mfld_simps]
+#align has_mfderiv_at_fst hasMfderivAt_fst
+
+theorem hasMfderivWithinAt_fst (s : Set (M × M')) (x : M × M') :
+    HasMfderivWithinAt (I.Prod I') I Prod.fst s x
+      (ContinuousLinearMap.fst 𝕜 (TangentSpace I x.1) (TangentSpace I' x.2)) :=
+  (hasMfderivAt_fst I I' x).HasMfderivWithinAt
+#align has_mfderiv_within_at_fst hasMfderivWithinAt_fst
+
+theorem mdifferentiableAt_fst {x : M × M'} : MdifferentiableAt (I.Prod I') I Prod.fst x :=
+  (hasMfderivAt_fst I I' x).MdifferentiableAt
+#align mdifferentiable_at_fst mdifferentiableAt_fst
+
+theorem mdifferentiableWithinAt_fst {s : Set (M × M')} {x : M × M'} :
+    MdifferentiableWithinAt (I.Prod I') I Prod.fst s x :=
+  (mdifferentiableAt_fst I I').MdifferentiableWithinAt
+#align mdifferentiable_within_at_fst mdifferentiableWithinAt_fst
+
+theorem mdifferentiable_fst : Mdifferentiable (I.Prod I') I (Prod.fst : M × M' → M) := fun x =>
+  mdifferentiableAt_fst I I'
+#align mdifferentiable_fst mdifferentiable_fst
+
+theorem mdifferentiableOn_fst {s : Set (M × M')} : MdifferentiableOn (I.Prod I') I Prod.fst s :=
+  (mdifferentiable_fst I I').MdifferentiableOn
+#align mdifferentiable_on_fst mdifferentiableOn_fst
+
+@[simp, mfld_simps]
+theorem mfderiv_fst {x : M × M'} :
+    mfderiv (I.Prod I') I Prod.fst x =
+      ContinuousLinearMap.fst 𝕜 (TangentSpace I x.1) (TangentSpace I' x.2) :=
+  (hasMfderivAt_fst I I' x).mfderiv
+#align mfderiv_fst mfderiv_fst
+
+theorem mfderivWithin_fst {s : Set (M × M')} {x : M × M'}
+    (hxs : UniqueMdiffWithinAt (I.Prod I') s x) :
+    mfderivWithin (I.Prod I') I Prod.fst s x =
+      ContinuousLinearMap.fst 𝕜 (TangentSpace I x.1) (TangentSpace I' x.2) :=
+  by rw [Mdifferentiable.mfderivWithin (mdifferentiableAt_fst I I') hxs]; exact mfderiv_fst I I'
+#align mfderiv_within_fst mfderivWithin_fst
+
+@[simp, mfld_simps]
+theorem tangentMap_prod_fst {p : TangentBundle (I.Prod I') (M × M')} :
+    tangentMap (I.Prod I') I Prod.fst p = totalSpaceMk p.proj.1 p.2.1 := by simp [tangentMap]
+#align tangent_map_prod_fst tangentMap_prod_fst
+
+theorem tangentMapWithin_prod_fst {s : Set (M × M')} {p : TangentBundle (I.Prod I') (M × M')}
+    (hs : UniqueMdiffWithinAt (I.Prod I') s p.proj) :
+    tangentMapWithin (I.Prod I') I Prod.fst s p = totalSpaceMk p.proj.1 p.2.1 :=
+  by
+  simp only [tangentMapWithin]
+  rw [mfderivWithin_fst]
+  · rcases p with ⟨⟩; rfl
+  · exact hs
+#align tangent_map_within_prod_fst tangentMapWithin_prod_fst
+
+theorem hasMfderivAt_snd (x : M × M') :
+    HasMfderivAt (I.Prod I') I' Prod.snd x
+      (ContinuousLinearMap.snd 𝕜 (TangentSpace I x.1) (TangentSpace I' x.2)) :=
+  by
+  refine' ⟨continuous_snd.continuous_at, _⟩
+  have :
+    ∀ᶠ y in 𝓝[range (I.prod I')] extChartAt (I.prod I') x x,
+      (extChartAt I' x.2 ∘ Prod.snd ∘ (extChartAt (I.prod I') x).symm) y = y.2 :=
+    by
+    apply Filter.mem_of_superset (extChartAt_target_mem_nhdsWithin (I.prod I') x)
+    mfld_set_tac
+  apply HasFDerivWithinAt.congr_of_eventuallyEq hasFDerivWithinAt_snd this
+  simp only [mfld_simps]
+#align has_mfderiv_at_snd hasMfderivAt_snd
+
+theorem hasMfderivWithinAt_snd (s : Set (M × M')) (x : M × M') :
+    HasMfderivWithinAt (I.Prod I') I' Prod.snd s x
+      (ContinuousLinearMap.snd 𝕜 (TangentSpace I x.1) (TangentSpace I' x.2)) :=
+  (hasMfderivAt_snd I I' x).HasMfderivWithinAt
+#align has_mfderiv_within_at_snd hasMfderivWithinAt_snd
+
+theorem mdifferentiableAt_snd {x : M × M'} : MdifferentiableAt (I.Prod I') I' Prod.snd x :=
+  (hasMfderivAt_snd I I' x).MdifferentiableAt
+#align mdifferentiable_at_snd mdifferentiableAt_snd
+
+theorem mdifferentiableWithinAt_snd {s : Set (M × M')} {x : M × M'} :
+    MdifferentiableWithinAt (I.Prod I') I' Prod.snd s x :=
+  (mdifferentiableAt_snd I I').MdifferentiableWithinAt
+#align mdifferentiable_within_at_snd mdifferentiableWithinAt_snd
+
+theorem mdifferentiable_snd : Mdifferentiable (I.Prod I') I' (Prod.snd : M × M' → M') := fun x =>
+  mdifferentiableAt_snd I I'
+#align mdifferentiable_snd mdifferentiable_snd
+
+theorem mdifferentiableOn_snd {s : Set (M × M')} : MdifferentiableOn (I.Prod I') I' Prod.snd s :=
+  (mdifferentiable_snd I I').MdifferentiableOn
+#align mdifferentiable_on_snd mdifferentiableOn_snd
+
+@[simp, mfld_simps]
+theorem mfderiv_snd {x : M × M'} :
+    mfderiv (I.Prod I') I' Prod.snd x =
+      ContinuousLinearMap.snd 𝕜 (TangentSpace I x.1) (TangentSpace I' x.2) :=
+  (hasMfderivAt_snd I I' x).mfderiv
+#align mfderiv_snd mfderiv_snd
+
+theorem mfderivWithin_snd {s : Set (M × M')} {x : M × M'}
+    (hxs : UniqueMdiffWithinAt (I.Prod I') s x) :
+    mfderivWithin (I.Prod I') I' Prod.snd s x =
+      ContinuousLinearMap.snd 𝕜 (TangentSpace I x.1) (TangentSpace I' x.2) :=
+  by rw [Mdifferentiable.mfderivWithin (mdifferentiableAt_snd I I') hxs]; exact mfderiv_snd I I'
+#align mfderiv_within_snd mfderivWithin_snd
+
+@[simp, mfld_simps]
+theorem tangentMap_prod_snd {p : TangentBundle (I.Prod I') (M × M')} :
+    tangentMap (I.Prod I') I' Prod.snd p = totalSpaceMk p.proj.2 p.2.2 := by simp [tangentMap]
+#align tangent_map_prod_snd tangentMap_prod_snd
+
+theorem tangentMapWithin_prod_snd {s : Set (M × M')} {p : TangentBundle (I.Prod I') (M × M')}
+    (hs : UniqueMdiffWithinAt (I.Prod I') s p.proj) :
+    tangentMapWithin (I.Prod I') I' Prod.snd s p = totalSpaceMk p.proj.2 p.2.2 :=
+  by
+  simp only [tangentMapWithin]
+  rw [mfderivWithin_snd]
+  · rcases p with ⟨⟩; rfl
+  · exact hs
+#align tangent_map_within_prod_snd tangentMapWithin_prod_snd
+
+variable {I I' I''}
+
+theorem MdifferentiableAt.mfderiv_prod {f : M → M'} {g : M → M''} {x : M}
+    (hf : MdifferentiableAt I I' f x) (hg : MdifferentiableAt I I'' g x) :
+    mfderiv I (I'.Prod I'') (fun x => (f x, g x)) x = (mfderiv I I' f x).Prod (mfderiv I I'' g x) :=
+  by
+  classical
+  simp_rw [mfderiv, if_pos (hf.prod_mk hg), if_pos hf, if_pos hg]
+  exact hf.2.fderivWithin_prod hg.2 (I.unique_diff _ (mem_range_self _))
+#align mdifferentiable_at.mfderiv_prod MdifferentiableAt.mfderiv_prod
+
+variable (I I' I'')
+
+theorem mfderiv_prod_left {x₀ : M} {y₀ : M'} :
+    mfderiv I (I.Prod I') (fun x => (x, y₀)) x₀ =
+      ContinuousLinearMap.inl 𝕜 (TangentSpace I x₀) (TangentSpace I' y₀) :=
+  by
+  refine' ((mdifferentiableAt_id I).mfderiv_prod (mdifferentiableAt_const I I')).trans _
+  rw [mfderiv_id, mfderiv_const, ContinuousLinearMap.inl]
+#align mfderiv_prod_left mfderiv_prod_left
+
+theorem mfderiv_prod_right {x₀ : M} {y₀ : M'} :
+    mfderiv I' (I.Prod I') (fun y => (x₀, y)) y₀ =
+      ContinuousLinearMap.inr 𝕜 (TangentSpace I x₀) (TangentSpace I' y₀) :=
+  by
+  refine' ((mdifferentiableAt_const I' I).mfderiv_prod (mdifferentiableAt_id I')).trans _
+  rw [mfderiv_id, mfderiv_const, ContinuousLinearMap.inr]
+#align mfderiv_prod_right mfderiv_prod_right
+
+/-- The total derivative of a function in two variables is the sum of the partial derivatives.
+  Note that to state this (without casts) we need to be able to see through the definition of
+  `tangent_space`. -/
+theorem mfderiv_prod_eq_add {f : M × M' → M''} {p : M × M'}
+    (hf : MdifferentiableAt (I.Prod I') I'' f p) :
+    mfderiv (I.Prod I') I'' f p =
+      show E × E' →L[𝕜] E'' from
+        mfderiv (I.Prod I') I'' (fun z : M × M' => f (z.1, p.2)) p +
+          mfderiv (I.Prod I') I'' (fun z : M × M' => f (p.1, z.2)) p :=
+  by
+  dsimp only
+  rw [← @Prod.mk.eta _ _ p] at hf 
+  rw [mfderiv_comp_of_eq hf ((mdifferentiableAt_fst I I').prod_mk (mdifferentiableAt_const _ _))
+      rfl,
+    mfderiv_comp_of_eq hf ((mdifferentiableAt_const _ _).prod_mk (mdifferentiableAt_snd I I')) rfl,
+    ← ContinuousLinearMap.comp_add,
+    (mdifferentiableAt_fst I I').mfderiv_prod (mdifferentiableAt_const (I.prod I') I'),
+    (mdifferentiableAt_const (I.prod I') I).mfderiv_prod (mdifferentiableAt_snd I I'), mfderiv_fst,
+    mfderiv_snd, mfderiv_const, mfderiv_const]
+  symm
+  convert ContinuousLinearMap.comp_id _
+  · exact ContinuousLinearMap.coprod_inl_inr
+  simp_rw [Prod.mk.eta]
+  all_goals infer_instance
+#align mfderiv_prod_eq_add mfderiv_prod_eq_add
+
+end Prod
+
 section Arithmetic
 
 /-! #### Arithmetic
Diff
@@ -154,7 +154,7 @@ theorem differentiable_within_at_localInvariantProp :
       rw [this] at h 
       have : I (e x) ∈ I.symm ⁻¹' e.target ∩ Set.range I := by simp only [hx, mfld_simps]
       have := (mem_groupoid_of_pregroupoid.2 he).2.ContDiffWithinAt this
-      convert(h.comp' _ (this.differentiable_within_at le_top)).mono_of_mem _ using 1
+      convert (h.comp' _ (this.differentiable_within_at le_top)).mono_of_mem _ using 1
       · ext y; simp only [mfld_simps]
       refine'
         mem_nhds_within.mpr
@@ -174,7 +174,7 @@ theorem differentiable_within_at_localInvariantProp :
       have A : (I' ∘ f ∘ I.symm) (I x) ∈ I'.symm ⁻¹' e'.source ∩ Set.range I' := by
         simp only [hx, mfld_simps]
       have := (mem_groupoid_of_pregroupoid.2 he').1.ContDiffWithinAt A
-      convert(this.differentiable_within_at le_top).comp _ h _
+      convert (this.differentiable_within_at le_top).comp _ h _
       · ext y; simp only [mfld_simps]
       · intro y hy; simp only [mfld_simps] at hy ; simpa only [hy, mfld_simps] using hs hy.1 }
 #align differentiable_within_at_local_invariant_prop differentiable_within_at_localInvariantProp
@@ -740,7 +740,7 @@ theorem HasMfderivWithinAt.congr_of_eventuallyEq (h : HasMfderivWithinAt I I' f
   refine' ⟨ContinuousWithinAt.congr_of_eventuallyEq h.1 h₁ hx, _⟩
   apply HasFDerivWithinAt.congr_of_eventuallyEq h.2
   · have :
-      (extChartAt I x).symm ⁻¹' { y | f₁ y = f y } ∈
+      (extChartAt I x).symm ⁻¹' {y | f₁ y = f y} ∈
         𝓝[(extChartAt I x).symm ⁻¹' s ∩ range I] (extChartAt I x) x :=
       extChartAt_preimage_mem_nhdsWithin I x h₁
     apply Filter.mem_of_superset this fun y => _
@@ -852,9 +852,9 @@ theorem Filter.EventuallyEq.mfderiv_eq (hL : f₁ =ᶠ[𝓝 x] f) :
 omit Is I's
 
 theorem written_in_ext_chart_comp (h : ContinuousWithinAt f s x) :
-    { y |
+    {y |
         writtenInExtChartAt I I'' x (g ∘ f) y =
-          (writtenInExtChartAt I' I'' (f x) g ∘ writtenInExtChartAt I I' x f) y } ∈
+          (writtenInExtChartAt I' I'' (f x) g ∘ writtenInExtChartAt I I' x f) y} ∈
       𝓝[(extChartAt I x).symm ⁻¹' s ∩ range I] (extChartAt I x) x :=
   by
   apply
@@ -1000,8 +1000,8 @@ theorem uniqueMdiffWithinAt_iff_uniqueDiffWithinAt :
   simp only [UniqueMdiffWithinAt, mfld_simps]
 #align unique_mdiff_within_at_iff_unique_diff_within_at uniqueMdiffWithinAt_iff_uniqueDiffWithinAt
 
-alias uniqueMdiffWithinAt_iff_uniqueDiffWithinAt ↔
-  UniqueMdiffWithinAt.uniqueDiffWithinAt UniqueDiffWithinAt.uniqueMdiffWithinAt
+alias uniqueMdiffWithinAt_iff_uniqueDiffWithinAt ↔ UniqueMdiffWithinAt.uniqueDiffWithinAt
+  UniqueDiffWithinAt.uniqueMdiffWithinAt
 #align unique_mdiff_within_at.unique_diff_within_at UniqueMdiffWithinAt.uniqueDiffWithinAt
 #align unique_diff_within_at.unique_mdiff_within_at UniqueDiffWithinAt.uniqueMdiffWithinAt
 
@@ -1024,8 +1024,8 @@ theorem hasMfderivWithinAt_iff_hasFDerivWithinAt {f'} :
     HasFDerivWithinAt.continuousWithinAt
 #align has_mfderiv_within_at_iff_has_fderiv_within_at hasMfderivWithinAt_iff_hasFDerivWithinAt
 
-alias hasMfderivWithinAt_iff_hasFDerivWithinAt ↔
-  HasMfderivWithinAt.hasFDerivWithinAt HasFDerivWithinAt.hasMfderivWithinAt
+alias hasMfderivWithinAt_iff_hasFDerivWithinAt ↔ HasMfderivWithinAt.hasFDerivWithinAt
+  HasFDerivWithinAt.hasMfderivWithinAt
 #align has_mfderiv_within_at.has_fderiv_within_at HasMfderivWithinAt.hasFDerivWithinAt
 #align has_fderiv_within_at.has_mfderiv_within_at HasFDerivWithinAt.hasMfderivWithinAt
 
@@ -1060,8 +1060,8 @@ theorem mdifferentiableAt_iff_differentiableAt :
   exact ⟨fun H => H.2, fun H => ⟨H.ContinuousAt, H⟩⟩
 #align mdifferentiable_at_iff_differentiable_at mdifferentiableAt_iff_differentiableAt
 
-alias mdifferentiableAt_iff_differentiableAt ↔
-  MdifferentiableAt.differentiableAt DifferentiableAt.mdifferentiableAt
+alias mdifferentiableAt_iff_differentiableAt ↔ MdifferentiableAt.differentiableAt
+  DifferentiableAt.mdifferentiableAt
 #align mdifferentiable_at.differentiable_at MdifferentiableAt.differentiableAt
 #align differentiable_at.mdifferentiable_at DifferentiableAt.mdifferentiableAt
 
@@ -1072,8 +1072,8 @@ theorem mdifferentiableOn_iff_differentiableOn :
     mdifferentiableWithinAt_iff_differentiableWithinAt]
 #align mdifferentiable_on_iff_differentiable_on mdifferentiableOn_iff_differentiableOn
 
-alias mdifferentiableOn_iff_differentiableOn ↔
-  MdifferentiableOn.differentiableOn DifferentiableOn.mdifferentiableOn
+alias mdifferentiableOn_iff_differentiableOn ↔ MdifferentiableOn.differentiableOn
+  DifferentiableOn.mdifferentiableOn
 #align mdifferentiable_on.differentiable_on MdifferentiableOn.differentiableOn
 #align differentiable_on.mdifferentiable_on DifferentiableOn.mdifferentiableOn
 
@@ -1083,8 +1083,8 @@ theorem mdifferentiable_iff_differentiable :
   simp only [Mdifferentiable, Differentiable, mdifferentiableAt_iff_differentiableAt]
 #align mdifferentiable_iff_differentiable mdifferentiable_iff_differentiable
 
-alias mdifferentiable_iff_differentiable ↔
-  Mdifferentiable.differentiable Differentiable.mdifferentiable
+alias mdifferentiable_iff_differentiable ↔ Mdifferentiable.differentiable
+  Differentiable.mdifferentiable
 #align mdifferentiable.differentiable Mdifferentiable.differentiable
 #align differentiable.mdifferentiable Differentiable.mdifferentiable
 
Diff
@@ -149,9 +149,9 @@ theorem differentiable_within_at_localInvariantProp :
       apply ContinuousAt.preimage_mem_nhds I.continuous_symm.continuous_at this
     right_invariance' := by
       intro s x f e he hx h
-      rw [DifferentiableWithinAtProp] at h⊢
+      rw [DifferentiableWithinAtProp] at h ⊢
       have : I x = (I ∘ e.symm ∘ I.symm) (I (e x)) := by simp only [hx, mfld_simps]
-      rw [this] at h
+      rw [this] at h 
       have : I (e x) ∈ I.symm ⁻¹' e.target ∩ Set.range I := by simp only [hx, mfld_simps]
       have := (mem_groupoid_of_pregroupoid.2 he).2.ContDiffWithinAt this
       convert(h.comp' _ (this.differentiable_within_at le_top)).mono_of_mem _ using 1
@@ -165,18 +165,18 @@ theorem differentiable_within_at_localInvariantProp :
       intro s x f g h hx hf
       apply hf.congr
       · intro y hy
-        simp only [mfld_simps] at hy
+        simp only [mfld_simps] at hy 
         simp only [h, hy, mfld_simps]
       · simp only [hx, mfld_simps]
     left_invariance' := by
       intro s x f e' he' hs hx h
-      rw [DifferentiableWithinAtProp] at h⊢
+      rw [DifferentiableWithinAtProp] at h ⊢
       have A : (I' ∘ f ∘ I.symm) (I x) ∈ I'.symm ⁻¹' e'.source ∩ Set.range I' := by
         simp only [hx, mfld_simps]
       have := (mem_groupoid_of_pregroupoid.2 he').1.ContDiffWithinAt A
       convert(this.differentiable_within_at le_top).comp _ h _
       · ext y; simp only [mfld_simps]
-      · intro y hy; simp only [mfld_simps] at hy; simpa only [hy, mfld_simps] using hs hy.1 }
+      · intro y hy; simp only [mfld_simps] at hy ; simpa only [hy, mfld_simps] using hs hy.1 }
 #align differentiable_within_at_local_invariant_prop differentiable_within_at_localInvariantProp
 
 /-- Predicate ensuring that, at a point and within a set, a function can have at most one
@@ -372,7 +372,7 @@ theorem UniqueMdiffWithinAt.inter (hs : UniqueMdiffWithinAt I s x) (ht : t ∈ 
 theorem IsOpen.uniqueMdiffWithinAt (xs : x ∈ s) (hs : IsOpen s) : UniqueMdiffWithinAt I s x :=
   by
   have := UniqueMdiffWithinAt.inter (uniqueMdiffWithinAt_univ I) (IsOpen.mem_nhds hs xs)
-  rwa [univ_inter] at this
+  rwa [univ_inter] at this 
 #align is_open.unique_mdiff_within_at IsOpen.uniqueMdiffWithinAt
 
 theorem UniqueMdiffOn.inter (hs : UniqueMdiffOn I s) (ht : IsOpen t) : UniqueMdiffOn I (s ∩ t) :=
@@ -476,7 +476,7 @@ theorem hasMfderivWithinAt_univ : HasMfderivWithinAt I I' f univ x f' ↔ HasMfd
 
 theorem hasMfderivAt_unique (h₀ : HasMfderivAt I I' f x f₀') (h₁ : HasMfderivAt I I' f x f₁') :
     f₀' = f₁' := by
-  rw [← hasMfderivWithinAt_univ] at h₀ h₁
+  rw [← hasMfderivWithinAt_univ] at h₀ h₁ 
   exact (uniqueMdiffWithinAt_univ I).Eq h₀ h₁
 #align has_mfderiv_at_unique hasMfderivAt_unique
 
@@ -512,7 +512,7 @@ theorem HasMfderivWithinAt.nhdsWithin (h : HasMfderivWithinAt I I' f s x f') (ht
 
 theorem HasMfderivWithinAt.hasMfderivAt (h : HasMfderivWithinAt I I' f s x f') (hs : s ∈ 𝓝 x) :
     HasMfderivAt I I' f x f' := by
-  rwa [← univ_inter s, hasMfderivWithinAt_inter hs, hasMfderivWithinAt_univ] at h
+  rwa [← univ_inter s, hasMfderivWithinAt_inter hs, hasMfderivWithinAt_univ] at h 
 #align has_mfderiv_within_at.has_mfderiv_at HasMfderivWithinAt.hasMfderivAt
 
 theorem MdifferentiableWithinAt.hasMfderivWithinAt (h : MdifferentiableWithinAt I I' f s x) :
@@ -604,7 +604,7 @@ theorem MdifferentiableWithinAt.mdifferentiableAt (h : MdifferentiableWithinAt I
     (hs : s ∈ 𝓝 x) : MdifferentiableAt I I' f x :=
   by
   have : s = univ ∩ s := by rw [univ_inter]
-  rwa [this, mdifferentiableWithinAt_inter hs, mdifferentiableWithinAt_univ] at h
+  rwa [this, mdifferentiableWithinAt_inter hs, mdifferentiableWithinAt_univ] at h 
 #align mdifferentiable_within_at.mdifferentiable_at MdifferentiableWithinAt.mdifferentiableAt
 
 theorem MdifferentiableOn.mono (h : MdifferentiableOn I I' f t) (st : s ⊆ t) :
@@ -703,7 +703,7 @@ theorem tangentMapWithin_univ : tangentMapWithin I I' f univ = tangentMap I I' f
 theorem tangentMapWithin_eq_tangentMap {p : TangentBundle I M} (hs : UniqueMdiffWithinAt I s p.1)
     (h : MdifferentiableAt I I' f p.1) : tangentMapWithin I I' f s p = tangentMap I I' f p :=
   by
-  rw [← mdifferentiableWithinAt_univ] at h
+  rw [← mdifferentiableWithinAt_univ] at h 
   rw [← tangentMapWithin_univ]
   exact tangentMapWithin_subset (subset_univ _) hs h
 #align tangent_map_within_eq_tangent_map tangentMapWithin_eq_tangentMap
@@ -756,7 +756,7 @@ theorem HasMfderivWithinAt.congr_mono (h : HasMfderivWithinAt I I' f s x f')
 theorem HasMfderivAt.congr_of_eventuallyEq (h : HasMfderivAt I I' f x f') (h₁ : f₁ =ᶠ[𝓝 x] f) :
     HasMfderivAt I I' f₁ x f' :=
   by
-  rw [← hasMfderivWithinAt_univ] at h⊢
+  rw [← hasMfderivWithinAt_univ] at h ⊢
   apply h.congr_of_eventually_eq _ (mem_of_mem_nhds h₁ : _)
   rwa [nhdsWithin_univ]
 #align has_mfderiv_at.congr_of_eventually_eq HasMfderivAt.congr_of_eventuallyEq
@@ -842,7 +842,7 @@ theorem Filter.EventuallyEq.mfderiv_eq (hL : f₁ =ᶠ[𝓝 x] f) :
   by
   have A : f₁ x = f x := (mem_of_mem_nhds hL : _)
   rw [← mfderivWithin_univ, ← mfderivWithin_univ]
-  rw [← nhdsWithin_univ] at hL
+  rw [← nhdsWithin_univ] at hL 
   exact hL.mfderiv_within_eq (uniqueMdiffWithinAt_univ I) A
 #align filter.eventually_eq.mfderiv_eq Filter.EventuallyEq.mfderiv_eq
 
@@ -884,13 +884,13 @@ theorem HasMfderivWithinAt.comp (hg : HasMfderivWithinAt I' I'' g u (f x) g')
       extChartAt_preimage_mem_nhdsWithin I x
         (hf.1.preimage_mem_nhdsWithin (extChartAt_source_mem_nhds _ _))
     unfold HasMfderivWithinAt at *
-    rw [← hasFDerivWithinAt_inter' this, ← extChartAt_preimage_inter_eq] at hf⊢
+    rw [← hasFDerivWithinAt_inter' this, ← extChartAt_preimage_inter_eq] at hf ⊢
     have : writtenInExtChartAt I I' x f ((extChartAt I x) x) = (extChartAt I' (f x)) (f x) := by
       simp only [mfld_simps]
-    rw [← this] at hg
+    rw [← this] at hg 
     apply HasFDerivWithinAt.comp ((extChartAt I x) x) hg.2 hf.2 _
     intro y hy
-    simp only [mfld_simps] at hy
+    simp only [mfld_simps] at hy 
     have : f (((chart_at H x).symm : H → M) (I.symm y)) ∈ u := hst hy.1.1
     simp only [hy, this, mfld_simps]
   apply A.congr_of_eventually_eq (written_in_ext_chart_comp hf.1)
@@ -1096,7 +1096,7 @@ theorem mfderivWithin_eq_fderivWithin :
   by_cases h : MdifferentiableWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') f s x
   · simp only [mfderivWithin, h, if_pos, mfld_simps]
   · simp only [mfderivWithin, h, if_neg, not_false_iff]
-    rw [mdifferentiableWithinAt_iff_differentiableWithinAt] at h
+    rw [mdifferentiableWithinAt_iff_differentiableWithinAt] at h 
     exact (fderivWithin_zero_of_not_differentiableWithinAt h).symm
 #align mfderiv_within_eq_fderiv_within mfderivWithin_eq_fderivWithin
 
@@ -1400,7 +1400,7 @@ theorem mfderiv_neg (f : M → E') (x : M) :
   simp_rw [mfderiv]
   by_cases hf : MdifferentiableAt I 𝓘(𝕜, E') f x
   · exact hf.has_mfderiv_at.neg.mfderiv
-  · rw [if_neg hf]; rw [← mdifferentiableAt_neg] at hf; rw [if_neg hf, neg_zero]
+  · rw [if_neg hf]; rw [← mdifferentiableAt_neg] at hf ; rw [if_neg hf, neg_zero]
 #align mfderiv_neg mfderiv_neg
 
 theorem HasMfderivAt.sub (hf : HasMfderivAt I 𝓘(𝕜, E') f z f')
@@ -1547,8 +1547,8 @@ theorem mdifferentiableAt_atlas (h : e ∈ atlas H M) {x : M} (hx : x ∈ e.sour
       (I.symm ⁻¹' ((chart_at H x).symm.trans e).source ∩ range I) :=
     this.1
   have B := A.differentiable_on le_top (I ((chart_at H x : M → H) x)) mem
-  simp only [mfld_simps] at B
-  rw [inter_comm, differentiableWithinAt_inter] at B
+  simp only [mfld_simps] at B 
+  rw [inter_comm, differentiableWithinAt_inter] at B 
   · simpa only [mfld_simps]
   · apply IsOpen.mem_nhds ((LocalHomeomorph.open_source _).Preimage I.continuous_symm) mem.1
 #align mdifferentiable_at_atlas mdifferentiableAt_atlas
@@ -1570,8 +1570,8 @@ theorem mdifferentiableAt_atlas_symm (h : e ∈ atlas H M) {x : H} (hx : x ∈ e
       (I.symm ⁻¹' (e.symm.trans (chart_at H (e.symm x))).source ∩ range I) :=
     this.1
   have B := A.differentiable_on le_top (I x) mem
-  simp only [mfld_simps] at B
-  rw [inter_comm, differentiableWithinAt_inter] at B
+  simp only [mfld_simps] at B 
+  rw [inter_comm, differentiableWithinAt_inter] at B 
   · simpa only [mfld_simps]
   · apply IsOpen.mem_nhds ((LocalHomeomorph.open_source _).Preimage I.continuous_symm) mem.1
 #align mdifferentiable_at_atlas_symm mdifferentiableAt_atlas_symm
@@ -1724,11 +1724,11 @@ theorem trans (he' : e'.Mdifferentiable I' I'') : (e.trans e').Mdifferentiable I
   by
   constructor
   · intro x hx
-    simp only [mfld_simps] at hx
+    simp only [mfld_simps] at hx 
     exact
       ((he'.mdifferentiable_at hx.2).comp _ (he.mdifferentiable_at hx.1)).MdifferentiableWithinAt
   · intro x hx
-    simp only [mfld_simps] at hx
+    simp only [mfld_simps] at hx 
     exact
       ((he.symm.mdifferentiable_at hx.2).comp _
           (he'.symm.mdifferentiable_at hx.1)).MdifferentiableWithinAt
@@ -1810,7 +1810,7 @@ theorem UniqueMdiffOn.uniqueMdiffOn_preimage [SmoothManifoldWithCorners I' M']
       apply e.continuous_on.preimage_open_of_open e.open_source (isOpen_extChartAt_source I' x)
       simp only [z_source, zx, mfld_simps]
     have := this.inter S
-    rw [uniqueMdiffWithinAt_iff] at this
+    rw [uniqueMdiffWithinAt_iff] at this 
     exact this
   -- denote by `G` the change of coordinate, i.e., the composition of the two extended charts and
   -- of `e`
@@ -1848,7 +1848,7 @@ theorem UniqueMdiffOn.uniqueMdiffOn_preimage [SmoothManifoldWithCorners I' M']
       (G '' (F.symm ⁻¹' (s ∩ (e.source ∩ e ⁻¹' (extChartAt I' x).source)) ∩ F.target)) (G (F z)) :=
     D₂.unique_diff_within_at B C
   have : G (F z) = (extChartAt I' x) x := by dsimp [G, F]; simp only [hx.1, mfld_simps]
-  rw [this] at key
+  rw [this] at key 
   apply key.mono
   show
     G '' (F.symm ⁻¹' (s ∩ (e.source ∩ e ⁻¹' (extChartAt I' x).source)) ∩ F.target) ⊆
@@ -1865,10 +1865,10 @@ theorem UniqueMdiffOn.uniqueDiffOn_target_inter (hs : UniqueMdiffOn I s) (x : M)
   -- this is just a reformulation of `unique_mdiff_on.unique_mdiff_on_preimage`, using as `e`
   -- the local chart at `x`.
   intro z hz
-  simp only [mfld_simps] at hz
+  simp only [mfld_simps] at hz 
   have : (chart_at H x).Mdifferentiable I I := mdifferentiable_chart _ _
   have T := (hs.unique_mdiff_on_preimage this) (I.symm z)
-  simp only [hz.left.left, hz.left.right, hz.right, UniqueMdiffWithinAt, mfld_simps] at T⊢
+  simp only [hz.left.left, hz.left.right, hz.right, UniqueMdiffWithinAt, mfld_simps] at T ⊢
   convert T using 1
   rw [@preimage_comp _ _ _ _ (chart_at H x).symm]
   mfld_set_tac
@@ -1936,7 +1936,7 @@ theorem UniqueMdiffOn.smooth_bundle_preimage (hs : UniqueMdiffOn I s) :
       simp only [e, hp, mfld_simps]
     apply (A _ this).mono
     intro q hq
-    simp only [e, LocalHomeomorph.left_inv _ hq.1, mfld_simps] at hq
+    simp only [e, LocalHomeomorph.left_inv _ hq.1, mfld_simps] at hq 
     simp only [hq, mfld_simps]
   intro q hq
   simp only [UniqueMdiffWithinAt, ModelWithCorners.prod, -preimage_inter, mfld_simps]
@@ -1949,15 +1949,15 @@ theorem UniqueMdiffOn.smooth_bundle_preimage (hs : UniqueMdiffOn I s) :
     rw [nhdsWithin_le_iff, mem_nhdsWithin]
     refine' ⟨(fun p : E × F => (I.symm p.1, p.snd)) ⁻¹' e.target, _, _, _⟩
     · exact e.open_target.preimage (I.continuous_symm.prod_map continuous_id)
-    · simp only [Prod.mk.eta, mfld_simps] at hq
+    · simp only [Prod.mk.eta, mfld_simps] at hq 
       simp only [Prod.mk.eta, hq, mfld_simps]
     rintro x hx
-    simp only [mfld_simps] at hx
+    simp only [mfld_simps] at hx 
     have h2x := hx
-    simp only [e, FiberBundle.chartedSpace_chartAt, Trivialization.mem_target, mfld_simps] at h2x
+    simp only [e, FiberBundle.chartedSpace_chartAt, Trivialization.mem_target, mfld_simps] at h2x 
     simp only [h2s, hx, h2x, -preimage_inter, mfld_simps]
   refine' UniqueDiffWithinAt.mono_nhds _ this
-  rw [h2s] at hq
+  rw [h2s] at hq 
   -- apply unique differentiability of products to conclude
   apply UniqueDiffOn.prod _ uniqueDiffOn_univ
   · simp only [hq, mfld_simps]
@@ -1967,9 +1967,9 @@ theorem UniqueMdiffOn.smooth_bundle_preimage (hs : UniqueMdiffOn I s) :
       apply hs.unique_mdiff_on_preimage
       exact mdifferentiable_of_mem_atlas _ (chart_mem_atlas _ _)
       infer_instance
-    simp only [UniqueMdiffOn, UniqueMdiffWithinAt, preimage_inter, mfld_simps] at A
+    simp only [UniqueMdiffOn, UniqueMdiffWithinAt, preimage_inter, mfld_simps] at A 
     have B := A (I.symm x) hx.1.1 hx.1.2
-    rwa [← preimage_inter, ModelWithCorners.right_inv _ hx.2] at B
+    rwa [← preimage_inter, ModelWithCorners.right_inv _ hx.2] at B 
 #align unique_mdiff_on.smooth_bundle_preimage UniqueMdiffOn.smooth_bundle_preimage
 
 theorem UniqueMdiffOn.tangent_bundle_proj_preimage (hs : UniqueMdiffOn I s) :
Diff
@@ -99,7 +99,7 @@ Derivative, manifold
 
 noncomputable section
 
-open Classical Topology Manifold Bundle
+open scoped Classical Topology Manifold Bundle
 
 open Set
 
Diff
@@ -144,8 +144,7 @@ theorem differentiable_within_at_localInvariantProp :
       rw [DifferentiableWithinAtProp, DifferentiableWithinAtProp, this]
       symm
       apply differentiableWithinAt_inter
-      have : u ∈ 𝓝 (I.symm (I x)) := by
-        rw [ModelWithCorners.left_inv]
+      have : u ∈ 𝓝 (I.symm (I x)) := by rw [ModelWithCorners.left_inv];
         exact IsOpen.mem_nhds u_open xu
       apply ContinuousAt.preimage_mem_nhds I.continuous_symm.continuous_at this
     right_invariance' := by
@@ -156,8 +155,7 @@ theorem differentiable_within_at_localInvariantProp :
       have : I (e x) ∈ I.symm ⁻¹' e.target ∩ Set.range I := by simp only [hx, mfld_simps]
       have := (mem_groupoid_of_pregroupoid.2 he).2.ContDiffWithinAt this
       convert(h.comp' _ (this.differentiable_within_at le_top)).mono_of_mem _ using 1
-      · ext y
-        simp only [mfld_simps]
+      · ext y; simp only [mfld_simps]
       refine'
         mem_nhds_within.mpr
           ⟨I.symm ⁻¹' e.target, e.open_target.preimage I.continuous_symm, by
@@ -177,11 +175,8 @@ theorem differentiable_within_at_localInvariantProp :
         simp only [hx, mfld_simps]
       have := (mem_groupoid_of_pregroupoid.2 he').1.ContDiffWithinAt A
       convert(this.differentiable_within_at le_top).comp _ h _
-      · ext y
-        simp only [mfld_simps]
-      · intro y hy
-        simp only [mfld_simps] at hy
-        simpa only [hy, mfld_simps] using hs hy.1 }
+      · ext y; simp only [mfld_simps]
+      · intro y hy; simp only [mfld_simps] at hy; simpa only [hy, mfld_simps] using hs hy.1 }
 #align differentiable_within_at_local_invariant_prop differentiable_within_at_localInvariantProp
 
 /-- Predicate ensuring that, at a point and within a set, a function can have at most one
@@ -554,9 +549,7 @@ theorem HasMfderivAt.mfderiv (h : HasMfderivAt I I' f x f') : mfderiv I I' f x =
 #align has_mfderiv_at.mfderiv HasMfderivAt.mfderiv
 
 theorem HasMfderivWithinAt.mfderivWithin (h : HasMfderivWithinAt I I' f s x f')
-    (hxs : UniqueMdiffWithinAt I s x) : mfderivWithin I I' f s x = f' :=
-  by
-  ext
+    (hxs : UniqueMdiffWithinAt I s x) : mfderivWithin I I' f s x = f' := by ext;
   rw [hxs.eq h h.mdifferentiable_within_at.has_mfderiv_within_at]
 #align has_mfderiv_within_at.mfderiv_within HasMfderivWithinAt.mfderivWithin
 
@@ -618,10 +611,8 @@ theorem MdifferentiableOn.mono (h : MdifferentiableOn I I' f t) (st : s ⊆ t) :
     MdifferentiableOn I I' f s := fun x hx => (h x (st hx)).mono st
 #align mdifferentiable_on.mono MdifferentiableOn.mono
 
-theorem mdifferentiableOn_univ : MdifferentiableOn I I' f univ ↔ Mdifferentiable I I' f :=
-  by
-  simp only [MdifferentiableOn, mdifferentiableWithinAt_univ, mfld_simps]
-  rfl
+theorem mdifferentiableOn_univ : MdifferentiableOn I I' f univ ↔ Mdifferentiable I I' f := by
+  simp only [MdifferentiableOn, mdifferentiableWithinAt_univ, mfld_simps]; rfl
 #align mdifferentiable_on_univ mdifferentiableOn_univ
 
 theorem Mdifferentiable.mdifferentiableOn (h : Mdifferentiable I I' f) :
@@ -705,9 +696,7 @@ theorem tangentMapWithin_subset {p : TangentBundle I M} (st : s ⊆ t)
   rw [mfderivWithin_subset st hs h]
 #align tangent_map_within_subset tangentMapWithin_subset
 
-theorem tangentMapWithin_univ : tangentMapWithin I I' f univ = tangentMap I I' f :=
-  by
-  ext p : 1
+theorem tangentMapWithin_univ : tangentMapWithin I I' f univ = tangentMap I I' f := by ext p : 1;
   simp only [tangentMapWithin, tangentMap, mfld_simps]
 #align tangent_map_within_univ tangentMapWithin_univ
 
@@ -985,9 +974,7 @@ theorem tangentMap_comp_at (p : TangentBundle I M) (hg : MdifferentiableAt I' I'
 #align tangent_map_comp_at tangentMap_comp_at
 
 theorem tangentMap_comp (hg : Mdifferentiable I' I'' g) (hf : Mdifferentiable I I' f) :
-    tangentMap I I'' (g ∘ f) = tangentMap I' I'' g ∘ tangentMap I I' f :=
-  by
-  ext p : 1
+    tangentMap I I'' (g ∘ f) = tangentMap I' I'' g ∘ tangentMap I I' f := by ext p : 1;
   exact tangentMap_comp_at _ (hg _) (hf _)
 #align tangent_map_comp tangentMap_comp
 
@@ -1265,10 +1252,7 @@ theorem mfderivWithin_id (hxs : UniqueMdiffWithinAt I s x) :
 #align mfderiv_within_id mfderivWithin_id
 
 @[simp, mfld_simps]
-theorem tangentMap_id : tangentMap I I (id : M → M) = id :=
-  by
-  ext1 ⟨x, v⟩
-  simp [tangentMap]
+theorem tangentMap_id : tangentMap I I (id : M → M) = id := by ext1 ⟨x, v⟩; simp [tangentMap]
 #align tangent_map_id tangentMap_id
 
 theorem tangentMapWithin_id {p : TangentBundle I M} (hs : UniqueMdiffWithinAt I s p.proj) :
@@ -1276,8 +1260,7 @@ theorem tangentMapWithin_id {p : TangentBundle I M} (hs : UniqueMdiffWithinAt I
   by
   simp only [tangentMapWithin, id.def]
   rw [mfderivWithin_id]
-  · rcases p with ⟨⟩
-    rfl
+  · rcases p with ⟨⟩; rfl
   · exact hs
 #align tangent_map_within_id tangentMapWithin_id
 
@@ -1417,9 +1400,7 @@ theorem mfderiv_neg (f : M → E') (x : M) :
   simp_rw [mfderiv]
   by_cases hf : MdifferentiableAt I 𝓘(𝕜, E') f x
   · exact hf.has_mfderiv_at.neg.mfderiv
-  · rw [if_neg hf]
-    rw [← mdifferentiableAt_neg] at hf
-    rw [if_neg hf, neg_zero]
+  · rw [if_neg hf]; rw [← mdifferentiableAt_neg] at hf; rw [if_neg hf, neg_zero]
 #align mfderiv_neg mfderiv_neg
 
 theorem HasMfderivAt.sub (hf : HasMfderivAt I 𝓘(𝕜, E') f z f')
@@ -1493,11 +1474,8 @@ variable {I} {z : M} {F' : Type _} [NormedCommRing F'] [NormedAlgebra 𝕜 F'] {
 
 theorem HasMfderivWithinAt.mul (hp : HasMfderivWithinAt I 𝓘(𝕜, F') p s z p')
     (hq : HasMfderivWithinAt I 𝓘(𝕜, F') q s z q') :
-    HasMfderivWithinAt I 𝓘(𝕜, F') (p * q) s z (p z • q' + q z • p' : E →L[𝕜] F') :=
-  by
-  convert hp.mul' hq
-  ext z
-  apply mul_comm
+    HasMfderivWithinAt I 𝓘(𝕜, F') (p * q) s z (p z • q' + q z • p' : E →L[𝕜] F') := by
+  convert hp.mul' hq; ext z; apply mul_comm
 #align has_mfderiv_within_at.mul HasMfderivWithinAt.mul
 
 theorem HasMfderivAt.mul (hp : HasMfderivAt I 𝓘(𝕜, F') p z p')
@@ -1860,10 +1838,8 @@ theorem UniqueMdiffOn.uniqueMdiffOn_preimage [SmoothManifoldWithCorners I' M']
   have C : DenseRange (G' : E → E') :=
     by
     have :
-      G' = mfderiv I I' ((chart_at H z).symm ≫ₕ e ≫ₕ chart_at H' x) ((chart_at H z : M → H) z) :=
-      by
-      rw [(Diff.mdifferentiable_at Mmem).mfderiv]
-      rfl
+      G' = mfderiv I I' ((chart_at H z).symm ≫ₕ e ≫ₕ chart_at H' x) ((chart_at H z : M → H) z) := by
+      rw [(Diff.mdifferentiable_at Mmem).mfderiv]; rfl
     rw [this]
     exact (Diff.mfderiv_surjective Mmem).DenseRange
   -- key step: thanks to what we have proved about it, `G` preserves the unique derivative property
@@ -1871,9 +1847,7 @@ theorem UniqueMdiffOn.uniqueMdiffOn_preimage [SmoothManifoldWithCorners I' M']
     UniqueDiffWithinAt 𝕜
       (G '' (F.symm ⁻¹' (s ∩ (e.source ∩ e ⁻¹' (extChartAt I' x).source)) ∩ F.target)) (G (F z)) :=
     D₂.unique_diff_within_at B C
-  have : G (F z) = (extChartAt I' x) x := by
-    dsimp [G, F]
-    simp only [hx.1, mfld_simps]
+  have : G (F z) = (extChartAt I' x) x := by dsimp [G, F]; simp only [hx.1, mfld_simps]
   rw [this] at key
   apply key.mono
   show
@@ -1933,8 +1907,7 @@ theorem UniqueMdiffOn.smooth_bundle_preimage (hs : UniqueMdiffOn I s) :
     reduce the situation to the model space, where we can use the fact that products respect
     unique differentiability. -/
   intro p hp
-  replace hp : p.fst ∈ s
-  · simpa only [mfld_simps] using hp
+  replace hp : p.fst ∈ s; · simpa only [mfld_simps] using hp
   let e₀ := chart_at H p.1
   let e := chart_at (ModelProd H F) p
   have h2s :
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 geometry.manifold.mfderiv
-! leanprover-community/mathlib commit 0187644979f2d3e10a06e916a869c994facd9a87
+! leanprover-community/mathlib commit 3a69562db5a458db8322b190ec8d9a8bbd8a5b14
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -647,10 +647,10 @@ theorem mfderivWithin_univ : mfderivWithin I I' f univ = mfderiv I I' f :=
   rw [mdifferentiableWithinAt_univ]
 #align mfderiv_within_univ mfderivWithin_univ
 
-theorem mfderivWithin_inter (ht : t ∈ 𝓝 x) (hs : UniqueMdiffWithinAt I s x) :
+theorem mfderivWithin_inter (ht : t ∈ 𝓝 x) :
     mfderivWithin I I' f (s ∩ t) x = mfderivWithin I I' f s x := by
   rw [mfderivWithin, mfderivWithin, extChartAt_preimage_inter_eq, mdifferentiableWithinAt_inter ht,
-    fderivWithin_inter (extChartAt_preimage_mem_nhds I x ht) hs]
+    fderivWithin_inter (extChartAt_preimage_mem_nhds I x ht)]
 #align mfderiv_within_inter mfderivWithin_inter
 
 theorem mdifferentiableAt_iff_of_mem_source {x' : M} {y : M'}
Diff
@@ -272,7 +272,7 @@ this would not mean anything relevant. -/
 def HasMfderivWithinAt (f : M → M') (s : Set M) (x : M)
     (f' : TangentSpace I x →L[𝕜] TangentSpace I' (f x)) :=
   ContinuousWithinAt f s x ∧
-    HasFderivWithinAt (writtenInExtChartAt I I' x f : E → E') f'
+    HasFDerivWithinAt (writtenInExtChartAt I I' x f : E → E') f'
       ((extChartAt I x).symm ⁻¹' s ∩ range I) ((extChartAt I x) x)
 #align has_mfderiv_within_at HasMfderivWithinAt
 
@@ -286,7 +286,7 @@ and in particular by coincidence `written_in_ext_chart_at I I' x f` could be dif
 this would not mean anything relevant. -/
 def HasMfderivAt (f : M → M') (x : M) (f' : TangentSpace I x →L[𝕜] TangentSpace I' (f x)) :=
   ContinuousAt f x ∧
-    HasFderivWithinAt (writtenInExtChartAt I I' x f : E → E') f' (range I) ((extChartAt I x) x)
+    HasFDerivWithinAt (writtenInExtChartAt I I' x f : E → E') f' (range I) ((extChartAt I x) x)
 #align has_mfderiv_at HasMfderivAt
 
 /-- Let `f` be a function between two smooth manifolds. Then `mfderiv_within I I' f s x` is the
@@ -426,7 +426,7 @@ theorem mdifferentiableWithinAt_iff {f : M → M'} {s : Set M} {x : M} :
   by
   refine' and_congr Iff.rfl (exists_congr fun f' => _)
   rw [inter_comm]
-  simp only [HasFderivWithinAt, nhdsWithin_inter, nhdsWithin_extChartAt_target_eq]
+  simp only [HasFDerivWithinAt, nhdsWithin_inter, nhdsWithin_extChartAt_target_eq]
 #align mdifferentiable_within_at_iff mdifferentiableWithinAt_iff
 
 include Is I's
@@ -456,12 +456,12 @@ theorem mfderiv_zero_of_not_mdifferentiableAt (h : ¬MdifferentiableAt I I' f x)
 theorem HasMfderivWithinAt.mono (h : HasMfderivWithinAt I I' f t x f') (hst : s ⊆ t) :
     HasMfderivWithinAt I I' f s x f' :=
   ⟨ContinuousWithinAt.mono h.1 hst,
-    HasFderivWithinAt.mono h.2 (inter_subset_inter (preimage_mono hst) (Subset.refl _))⟩
+    HasFDerivWithinAt.mono h.2 (inter_subset_inter (preimage_mono hst) (Subset.refl _))⟩
 #align has_mfderiv_within_at.mono HasMfderivWithinAt.mono
 
 theorem HasMfderivAt.hasMfderivWithinAt (h : HasMfderivAt I I' f x f') :
     HasMfderivWithinAt I I' f s x f' :=
-  ⟨ContinuousAt.continuousWithinAt h.1, HasFderivWithinAt.mono h.2 (inter_subset_right _ _)⟩
+  ⟨ContinuousAt.continuousWithinAt h.1, HasFDerivWithinAt.mono h.2 (inter_subset_right _ _)⟩
 #align has_mfderiv_at.has_mfderiv_within_at HasMfderivAt.hasMfderivWithinAt
 
 theorem HasMfderivWithinAt.mdifferentiableWithinAt (h : HasMfderivWithinAt I I' f s x f') :
@@ -489,14 +489,14 @@ theorem hasMfderivWithinAt_inter' (h : t ∈ 𝓝[s] x) :
     HasMfderivWithinAt I I' f (s ∩ t) x f' ↔ HasMfderivWithinAt I I' f s x f' :=
   by
   rw [HasMfderivWithinAt, HasMfderivWithinAt, extChartAt_preimage_inter_eq,
-    hasFderivWithinAt_inter', continuousWithinAt_inter' h]
+    hasFDerivWithinAt_inter', continuousWithinAt_inter' h]
   exact extChartAt_preimage_mem_nhdsWithin I x h
 #align has_mfderiv_within_at_inter' hasMfderivWithinAt_inter'
 
 theorem hasMfderivWithinAt_inter (h : t ∈ 𝓝 x) :
     HasMfderivWithinAt I I' f (s ∩ t) x f' ↔ HasMfderivWithinAt I I' f s x f' :=
   by
-  rw [HasMfderivWithinAt, HasMfderivWithinAt, extChartAt_preimage_inter_eq, hasFderivWithinAt_inter,
+  rw [HasMfderivWithinAt, HasMfderivWithinAt, extChartAt_preimage_inter_eq, hasFDerivWithinAt_inter,
     continuousWithinAt_inter h]
   exact extChartAt_preimage_mem_nhds I x h
 #align has_mfderiv_within_at_inter hasMfderivWithinAt_inter
@@ -506,7 +506,7 @@ theorem HasMfderivWithinAt.union (hs : HasMfderivWithinAt I I' f s x f')
   by
   constructor
   · exact ContinuousWithinAt.union hs.1 ht.1
-  · convert HasFderivWithinAt.union hs.2 ht.2
+  · convert HasFDerivWithinAt.union hs.2 ht.2
     simp only [union_inter_distrib_right, preimage_union]
 #align has_mfderiv_within_at.union HasMfderivWithinAt.union
 
@@ -525,7 +525,7 @@ theorem MdifferentiableWithinAt.hasMfderivWithinAt (h : MdifferentiableWithinAt
   by
   refine' ⟨h.1, _⟩
   simp only [mfderivWithin, h, if_pos, mfld_simps]
-  exact DifferentiableWithinAt.hasFderivWithinAt h.2
+  exact DifferentiableWithinAt.hasFDerivWithinAt h.2
 #align mdifferentiable_within_at.has_mfderiv_within_at MdifferentiableWithinAt.hasMfderivWithinAt
 
 theorem MdifferentiableWithinAt.mfderivWithin (h : MdifferentiableWithinAt I I' f s x) :
@@ -540,7 +540,7 @@ theorem MdifferentiableAt.hasMfderivAt (h : MdifferentiableAt I I' f x) :
   by
   refine' ⟨h.1, _⟩
   simp only [mfderiv, h, if_pos, mfld_simps]
-  exact DifferentiableWithinAt.hasFderivWithinAt h.2
+  exact DifferentiableWithinAt.hasFDerivWithinAt h.2
 #align mdifferentiable_at.has_mfderiv_at MdifferentiableAt.hasMfderivAt
 
 theorem MdifferentiableAt.mfderiv (h : MdifferentiableAt I I' f x) :
@@ -749,7 +749,7 @@ theorem HasMfderivWithinAt.congr_of_eventuallyEq (h : HasMfderivWithinAt I I' f
     (h₁ : f₁ =ᶠ[𝓝[s] x] f) (hx : f₁ x = f x) : HasMfderivWithinAt I I' f₁ s x f' :=
   by
   refine' ⟨ContinuousWithinAt.congr_of_eventuallyEq h.1 h₁ hx, _⟩
-  apply HasFderivWithinAt.congr_of_eventuallyEq h.2
+  apply HasFDerivWithinAt.congr_of_eventuallyEq h.2
   · have :
       (extChartAt I x).symm ⁻¹' { y | f₁ y = f y } ∈
         𝓝[(extChartAt I x).symm ⁻¹' s ∩ range I] (extChartAt I x) x :=
@@ -885,7 +885,7 @@ theorem HasMfderivWithinAt.comp (hg : HasMfderivWithinAt I' I'' g u (f x) g')
   by
   refine' ⟨ContinuousWithinAt.comp hg.1 hf.1 hst, _⟩
   have A :
-    HasFderivWithinAt (writtenInExtChartAt I' I'' (f x) g ∘ writtenInExtChartAt I I' x f)
+    HasFDerivWithinAt (writtenInExtChartAt I' I'' (f x) g ∘ writtenInExtChartAt I I' x f)
       (ContinuousLinearMap.comp g' f' : E →L[𝕜] E'') ((extChartAt I x).symm ⁻¹' s ∩ range I)
       ((extChartAt I x) x) :=
     by
@@ -895,11 +895,11 @@ theorem HasMfderivWithinAt.comp (hg : HasMfderivWithinAt I' I'' g u (f x) g')
       extChartAt_preimage_mem_nhdsWithin I x
         (hf.1.preimage_mem_nhdsWithin (extChartAt_source_mem_nhds _ _))
     unfold HasMfderivWithinAt at *
-    rw [← hasFderivWithinAt_inter' this, ← extChartAt_preimage_inter_eq] at hf⊢
+    rw [← hasFDerivWithinAt_inter' this, ← extChartAt_preimage_inter_eq] at hf⊢
     have : writtenInExtChartAt I I' x f ((extChartAt I x) x) = (extChartAt I' (f x)) (f x) := by
       simp only [mfld_simps]
     rw [← this] at hg
-    apply HasFderivWithinAt.comp ((extChartAt I x) x) hg.2 hf.2 _
+    apply HasFDerivWithinAt.comp ((extChartAt I x) x) hg.2 hf.2 _
     intro y hy
     simp only [mfld_simps] at hy
     have : f (((chart_at H x).symm : H → M) (I.symm y)) ∈ u := hst hy.1.1
@@ -1031,25 +1031,25 @@ theorem written_in_ext_chart_model_space : writtenInExtChartAt 𝓘(𝕜, E) 
   rfl
 #align written_in_ext_chart_model_space written_in_ext_chart_model_space
 
-theorem hasMfderivWithinAt_iff_hasFderivWithinAt {f'} :
-    HasMfderivWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') f s x f' ↔ HasFderivWithinAt f f' s x := by
+theorem hasMfderivWithinAt_iff_hasFDerivWithinAt {f'} :
+    HasMfderivWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') f s x f' ↔ HasFDerivWithinAt f f' s x := by
   simpa only [HasMfderivWithinAt, and_iff_right_iff_imp, mfld_simps] using
-    HasFderivWithinAt.continuousWithinAt
-#align has_mfderiv_within_at_iff_has_fderiv_within_at hasMfderivWithinAt_iff_hasFderivWithinAt
+    HasFDerivWithinAt.continuousWithinAt
+#align has_mfderiv_within_at_iff_has_fderiv_within_at hasMfderivWithinAt_iff_hasFDerivWithinAt
 
-alias hasMfderivWithinAt_iff_hasFderivWithinAt ↔
-  HasMfderivWithinAt.hasFderivWithinAt HasFderivWithinAt.hasMfderivWithinAt
-#align has_mfderiv_within_at.has_fderiv_within_at HasMfderivWithinAt.hasFderivWithinAt
-#align has_fderiv_within_at.has_mfderiv_within_at HasFderivWithinAt.hasMfderivWithinAt
+alias hasMfderivWithinAt_iff_hasFDerivWithinAt ↔
+  HasMfderivWithinAt.hasFDerivWithinAt HasFDerivWithinAt.hasMfderivWithinAt
+#align has_mfderiv_within_at.has_fderiv_within_at HasMfderivWithinAt.hasFDerivWithinAt
+#align has_fderiv_within_at.has_mfderiv_within_at HasFDerivWithinAt.hasMfderivWithinAt
 
-theorem hasMfderivAt_iff_hasFderivAt {f'} :
-    HasMfderivAt 𝓘(𝕜, E) 𝓘(𝕜, E') f x f' ↔ HasFderivAt f f' x := by
-  rw [← hasMfderivWithinAt_univ, hasMfderivWithinAt_iff_hasFderivWithinAt, hasFderivWithinAt_univ]
-#align has_mfderiv_at_iff_has_fderiv_at hasMfderivAt_iff_hasFderivAt
+theorem hasMfderivAt_iff_hasFDerivAt {f'} :
+    HasMfderivAt 𝓘(𝕜, E) 𝓘(𝕜, E') f x f' ↔ HasFDerivAt f f' x := by
+  rw [← hasMfderivWithinAt_univ, hasMfderivWithinAt_iff_hasFDerivWithinAt, hasFDerivWithinAt_univ]
+#align has_mfderiv_at_iff_has_fderiv_at hasMfderivAt_iff_hasFDerivAt
 
-alias hasMfderivAt_iff_hasFderivAt ↔ HasMfderivAt.hasFderivAt HasFderivAt.hasMfderivAt
-#align has_mfderiv_at.has_fderiv_at HasMfderivAt.hasFderivAt
-#align has_fderiv_at.has_mfderiv_at HasFderivAt.hasMfderivAt
+alias hasMfderivAt_iff_hasFDerivAt ↔ HasMfderivAt.hasFDerivAt HasFDerivAt.hasMfderivAt
+#align has_mfderiv_at.has_fderiv_at HasMfderivAt.hasFDerivAt
+#align has_fderiv_at.has_mfderiv_at HasFDerivAt.hasMfderivAt
 
 /-- For maps between vector spaces, `mdifferentiable_within_at` and `fdifferentiable_within_at`
 coincide -/
@@ -1140,11 +1140,11 @@ namespace ContinuousLinearMap
 variable (f : E →L[𝕜] E') {s : Set E} {x : E}
 
 protected theorem hasMfderivWithinAt : HasMfderivWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') f s x f :=
-  f.HasFderivWithinAt.HasMfderivWithinAt
+  f.HasFDerivWithinAt.HasMfderivWithinAt
 #align continuous_linear_map.has_mfderiv_within_at ContinuousLinearMap.hasMfderivWithinAt
 
 protected theorem hasMfderivAt : HasMfderivAt 𝓘(𝕜, E) 𝓘(𝕜, E') f x f :=
-  f.HasFderivAt.HasMfderivAt
+  f.HasFDerivAt.HasMfderivAt
 #align continuous_linear_map.has_mfderiv_at ContinuousLinearMap.hasMfderivAt
 
 protected theorem mdifferentiableWithinAt : MdifferentiableWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') f s x :=
@@ -1179,11 +1179,11 @@ namespace ContinuousLinearEquiv
 variable (f : E ≃L[𝕜] E') {s : Set E} {x : E}
 
 protected theorem hasMfderivWithinAt : HasMfderivWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') f s x (f : E →L[𝕜] E') :=
-  f.HasFderivWithinAt.HasMfderivWithinAt
+  f.HasFDerivWithinAt.HasMfderivWithinAt
 #align continuous_linear_equiv.has_mfderiv_within_at ContinuousLinearEquiv.hasMfderivWithinAt
 
 protected theorem hasMfderivAt : HasMfderivAt 𝓘(𝕜, E) 𝓘(𝕜, E') f x (f : E →L[𝕜] E') :=
-  f.HasFderivAt.HasMfderivAt
+  f.HasFDerivAt.HasMfderivAt
 #align continuous_linear_equiv.has_mfderiv_at ContinuousLinearEquiv.hasMfderivAt
 
 protected theorem mdifferentiableWithinAt : MdifferentiableWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') f s x :=
@@ -1228,7 +1228,7 @@ theorem hasMfderivAt_id (x : M) :
     by
     apply Filter.mem_of_superset (extChartAt_target_mem_nhdsWithin I x)
     mfld_set_tac
-  apply HasFderivWithinAt.congr_of_eventuallyEq (hasFderivWithinAt_id _ _) this
+  apply HasFDerivWithinAt.congr_of_eventuallyEq (hasFDerivWithinAt_id _ _) this
   simp only [mfld_simps]
 #align has_mfderiv_at_id hasMfderivAt_id
 
@@ -1294,7 +1294,7 @@ theorem hasMfderivAt_const (c : M') (x : M) :
     HasMfderivAt I I' (fun y : M => c) x (0 : TangentSpace I x →L[𝕜] TangentSpace I' c) :=
   by
   refine' ⟨continuous_const.continuous_at, _⟩
-  simp only [writtenInExtChartAt, (· ∘ ·), hasFderivWithinAt_const]
+  simp only [writtenInExtChartAt, (· ∘ ·), hasFDerivWithinAt_const]
 #align has_mfderiv_at_const hasMfderivAt_const
 
 theorem hasMfderivWithinAt_const (c : M') (s : Set M) (x : M) :
@@ -1516,7 +1516,7 @@ namespace ModelWithCorners
 
 
 protected theorem hasMfderivAt {x} : HasMfderivAt I 𝓘(𝕜, E) I x (ContinuousLinearMap.id _ _) :=
-  ⟨I.ContinuousAt, (hasFderivWithinAt_id _ _).congr' I.RightInvOn (mem_range_self _)⟩
+  ⟨I.ContinuousAt, (hasFDerivWithinAt_id _ _).congr' I.RightInvOn (mem_range_self _)⟩
 #align model_with_corners.has_mfderiv_at ModelWithCorners.hasMfderivAt
 
 protected theorem hasMfderivWithinAt {s x} :
@@ -1542,7 +1542,7 @@ protected theorem mdifferentiable : Mdifferentiable I 𝓘(𝕜, E) I := fun x =
 theorem hasMfderivWithinAt_symm {x} (hx : x ∈ range I) :
     HasMfderivWithinAt 𝓘(𝕜, E) I I.symm (range I) x (ContinuousLinearMap.id _ _) :=
   ⟨I.continuousWithinAt_symm,
-    (hasFderivWithinAt_id _ _).congr' (fun y hy => I.RightInvOn hy.1) ⟨hx, mem_range_self _⟩⟩
+    (hasFDerivWithinAt_id _ _).congr' (fun y hy => I.RightInvOn hy.1) ⟨hx, mem_range_self _⟩⟩
 #align model_with_corners.has_mfderiv_within_at_symm ModelWithCorners.hasMfderivWithinAt_symm
 
 theorem mdifferentiableOn_symm : MdifferentiableOn 𝓘(𝕜, E) I I.symm (range I) := fun x hx =>
@@ -1850,9 +1850,9 @@ theorem UniqueMdiffOn.uniqueMdiffOn_preimage [SmoothManifoldWithCorners I' M']
       simp only [G, F, mfld_simps]
   -- let `G'` be its derivative
   let G' := fderivWithin 𝕜 G (range I) (F z)
-  have D₁ : HasFderivWithinAt G G' (range I) (F z) := A.has_fderiv_within_at
+  have D₁ : HasFDerivWithinAt G G' (range I) (F z) := A.has_fderiv_within_at
   have D₂ :
-    HasFderivWithinAt G G' (F.symm ⁻¹' (s ∩ (e.source ∩ e ⁻¹' (extChartAt I' x).source)) ∩ F.target)
+    HasFDerivWithinAt G G' (F.symm ⁻¹' (s ∩ (e.source ∩ e ⁻¹' (extChartAt I' x).source)) ∩ F.target)
       (F z) :=
     D₁.mono (by mfld_set_tac)
   -- The derivative `G'` is onto, as it is the derivative of a local diffeomorphism, the composition
Diff
@@ -1,15 +1,14 @@
 /-
 Copyright (c) 2020 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 geometry.manifold.mfderiv
-! leanprover-community/mathlib commit f2ce6086713c78a7f880485f7917ea547a215982
+! leanprover-community/mathlib commit 0187644979f2d3e10a06e916a869c994facd9a87
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
-import Mathbin.Geometry.Manifold.LocalInvariantProperties
-import Mathbin.Geometry.Manifold.TangentBundle
+import Mathbin.Geometry.Manifold.VectorBundle.Tangent
 
 /-!
 # The derivative of functions between smooth manifolds
@@ -66,9 +65,9 @@ of `f` in these charts.
 Due to the fact that we are working in a model with corners, with an additional embedding `I` of the
 model space `H` in the model vector space `E`, the charts taking values in `E` are not the original
 charts of the manifold, but those ones composed with `I`, called extended charts. We define
-`written_in_ext_chart I I' x f` for the function `f` written in the preferred extended charts.  Then
-the manifold derivative of `f`, at `x`, is just the usual derivative of `written_in_ext_chart I I' x
-f`, at the point `(ext_chart_at I x) x`.
+`written_in_ext_chart I I' x f` for the function `f` written in the preferred extended charts. Then
+the manifold derivative of `f`, at `x`, is just the usual derivative of
+`written_in_ext_chart I I' x f`, at the point `(ext_chart_at I x) x`.
 
 There is a subtelty with respect to continuity: if the function is not continuous, then the image
 of a small open set around `x` will not be contained in the source of the preferred chart around
@@ -100,7 +99,7 @@ Derivative, manifold
 
 noncomputable section
 
-open Classical Topology Manifold
+open Classical Topology Manifold Bundle
 
 open Set
 
@@ -721,26 +720,25 @@ theorem tangentMapWithin_eq_tangentMap {p : TangentBundle I M} (hs : UniqueMdiff
 #align tangent_map_within_eq_tangent_map tangentMapWithin_eq_tangentMap
 
 @[simp, mfld_simps]
-theorem tangentMapWithin_tangentBundle_proj {p : TangentBundle I M} :
-    TangentBundle.proj I' M' (tangentMapWithin I I' f s p) = f (TangentBundle.proj I M p) :=
+theorem tangentMapWithin_proj {p : TangentBundle I M} :
+    (tangentMapWithin I I' f s p).proj = f p.proj :=
   rfl
-#align tangent_map_within_tangent_bundle_proj tangentMapWithin_tangentBundle_proj
+#align tangent_map_within_proj tangentMapWithin_proj
 
 @[simp, mfld_simps]
-theorem tangentMapWithin_proj {p : TangentBundle I M} : (tangentMapWithin I I' f s p).1 = f p.1 :=
+theorem tangentMapWithin_fst {p : TangentBundle I M} : (tangentMapWithin I I' f s p).1 = f p.1 :=
   rfl
-#align tangent_map_within_proj tangentMapWithin_proj
+#align tangent_map_within_fst tangentMapWithin_fst
 
 @[simp, mfld_simps]
-theorem tangentMap_tangentBundle_proj {p : TangentBundle I M} :
-    TangentBundle.proj I' M' (tangentMap I I' f p) = f (TangentBundle.proj I M p) :=
+theorem tangentMap_proj {p : TangentBundle I M} : (tangentMap I I' f p).proj = f p.proj :=
   rfl
-#align tangent_map_tangent_bundle_proj tangentMap_tangentBundle_proj
+#align tangent_map_proj tangentMap_proj
 
 @[simp, mfld_simps]
-theorem tangentMap_proj {p : TangentBundle I M} : (tangentMap I I' f p).1 = f p.1 :=
+theorem tangentMap_fst {p : TangentBundle I M} : (tangentMap I I' f p).1 = f p.1 :=
   rfl
-#align tangent_map_proj tangentMap_proj
+#align tangent_map_fst tangentMap_fst
 
 omit Is I's
 
@@ -1273,8 +1271,7 @@ theorem tangentMap_id : tangentMap I I (id : M → M) = id :=
   simp [tangentMap]
 #align tangent_map_id tangentMap_id
 
-theorem tangentMapWithin_id {p : TangentBundle I M}
-    (hs : UniqueMdiffWithinAt I s (TangentBundle.proj I M p)) :
+theorem tangentMapWithin_id {p : TangentBundle I M} (hs : UniqueMdiffWithinAt I s p.proj) :
     tangentMapWithin I I (id : M → M) s p = p :=
   by
   simp only [tangentMapWithin, id.def]
@@ -1640,8 +1637,8 @@ theorem tangentMap_chart_symm {p : TangentBundle I M} {q : TangentBundle I H}
   -- a trivial instance is needed after the rewrite, handle it right now.
   rotate_left;
   · infer_instance
-  simp only [ContinuousLinearMap.coe_coe, BasicSmoothVectorBundleCore.chart, h, tangentBundleCore,
-    BasicSmoothVectorBundleCore.toVectorBundleCore, chart_at, Sigma.mk.inj_iff, mfld_simps]
+  simp only [ContinuousLinearMap.coe_coe, TangentBundle.chartAt, h, tangentBundleCore, chart_at,
+    Sigma.mk.inj_iff, mfld_simps]
 #align tangent_map_chart_symm tangentMap_chart_symm
 
 end Charts
@@ -1919,15 +1916,18 @@ theorem UniqueMdiffOn.uniqueDiffOn_inter_preimage (hs : UniqueMdiffOn I s) (x :
   this.unique_diff_on_target_inter _
 #align unique_mdiff_on.unique_diff_on_inter_preimage UniqueMdiffOn.uniqueDiffOn_inter_preimage
 
-variable {F : Type _} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
-  (Z : BasicSmoothVectorBundleCore I M F)
+open Bundle
+
+variable {F : Type _} [NormedAddCommGroup F] [NormedSpace 𝕜 F] (Z : M → Type _)
+  [TopologicalSpace (TotalSpace Z)] [∀ b, TopologicalSpace (Z b)] [∀ b, AddCommMonoid (Z b)]
+  [∀ b, Module 𝕜 (Z b)] [FiberBundle F Z] [VectorBundle 𝕜 F Z] [SmoothVectorBundle F Z I]
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
-/-- In a smooth fiber bundle constructed from core, the preimage under the projection of a set with
+/-- In a smooth fiber bundle, the preimage under the projection of a set with
 unique differential in the basis also has unique differential. -/
 theorem UniqueMdiffOn.smooth_bundle_preimage (hs : UniqueMdiffOn I s) :
-    UniqueMdiffOn (I.Prod 𝓘(𝕜, F)) (Z.toVectorBundleCore.proj ⁻¹' s) :=
+    UniqueMdiffOn (I.Prod 𝓘(𝕜, F)) (π Z ⁻¹' s) :=
   by
   /- Using a chart (and the fact that unique differentiability is invariant under charts), we
     reduce the situation to the model space, where we can use the fact that products respect
@@ -1937,37 +1937,54 @@ theorem UniqueMdiffOn.smooth_bundle_preimage (hs : UniqueMdiffOn I s) :
   · simpa only [mfld_simps] using hp
   let e₀ := chart_at H p.1
   let e := chart_at (ModelProd H F) p
+  have h2s :
+    ∀ x,
+      x ∈ e.target ∩ e.symm ⁻¹' (π Z ⁻¹' s) ↔
+        (x.1 ∈ e₀.target ∧ e₀.symm x.1 ∈ (trivialization_at F Z p.1).baseSet) ∧ e₀.symm x.1 ∈ s :=
+    by
+    intro x
+    have A : x ∈ e.target ↔ x.1 ∈ e₀.target ∧ e₀.symm x.1 ∈ (trivialization_at F Z p.1).baseSet :=
+      by
+      simp only [e, FiberBundle.chartedSpace_chartAt, Trivialization.mem_target,
+        Bundle.TotalSpace.proj, mfld_simps]
+    rw [← A, mem_inter_iff, and_congr_right_iff]
+    intro hx
+    simp only [FiberBundle.chartedSpace_chartAt_symm_fst p x hx, mfld_simps]
   -- It suffices to prove unique differentiability in a chart
-  suffices h :
-    UniqueMdiffOn (I.prod 𝓘(𝕜, F)) (e.target ∩ e.symm ⁻¹' (Z.to_vector_bundle_core.proj ⁻¹' s))
+  suffices h : UniqueMdiffOn (I.prod 𝓘(𝕜, F)) (e.target ∩ e.symm ⁻¹' (π Z ⁻¹' s))
   · have A :
       UniqueMdiffOn (I.prod 𝓘(𝕜, F))
-        (e.symm.target ∩
-          e.symm.symm ⁻¹' (e.target ∩ e.symm ⁻¹' (Z.to_vector_bundle_core.proj ⁻¹' s))) :=
+        (e.symm.target ∩ e.symm.symm ⁻¹' (e.target ∩ e.symm ⁻¹' (π Z ⁻¹' s))) :=
       by
       apply h.unique_mdiff_on_preimage
       exact (mdifferentiable_of_mem_atlas _ (chart_mem_atlas _ _)).symm
       infer_instance
-    have :
-      p ∈
-        e.symm.target ∩
-          e.symm.symm ⁻¹' (e.target ∩ e.symm ⁻¹' (Z.to_vector_bundle_core.proj ⁻¹' s)) :=
-      by simp only [e, hp, mfld_simps]
+    have : p ∈ e.symm.target ∩ e.symm.symm ⁻¹' (e.target ∩ e.symm ⁻¹' (π Z ⁻¹' s)) := by
+      simp only [e, hp, mfld_simps]
     apply (A _ this).mono
     intro q hq
     simp only [e, LocalHomeomorph.left_inv _ hq.1, mfld_simps] at hq
     simp only [hq, mfld_simps]
-  -- rewrite the relevant set in the chart as a direct product
-  have :
-    (fun p : E × F => (I.symm p.1, p.snd)) ⁻¹' e.target ∩
-          (fun p : E × F => (I.symm p.1, p.snd)) ⁻¹' (e.symm ⁻¹' (Sigma.fst ⁻¹' s)) ∩
-        range I ×ˢ univ =
-      (I.symm ⁻¹' (e₀.target ∩ e₀.symm ⁻¹' s) ∩ range I) ×ˢ univ :=
-    by mfld_set_tac
   intro q hq
-  replace hq : q.1 ∈ (chart_at H p.1).target ∧ ((chart_at H p.1).symm : H → M) q.1 ∈ s
-  · simpa only [mfld_simps] using hq
-  simp only [UniqueMdiffWithinAt, ModelWithCorners.prod, preimage_inter, this, mfld_simps]
+  simp only [UniqueMdiffWithinAt, ModelWithCorners.prod, -preimage_inter, mfld_simps]
+  have :
+    𝓝[(I.symm ⁻¹' (e₀.target ∩ e₀.symm ⁻¹' s) ∩ range I) ×ˢ univ] (I q.1, q.2) ≤
+      𝓝[(fun p : E × F => (I.symm p.1, p.snd)) ⁻¹' (e.target ∩ e.symm ⁻¹' (π Z ⁻¹' s)) ∩
+          range I ×ˢ univ]
+        (I q.1, q.2) :=
+    by
+    rw [nhdsWithin_le_iff, mem_nhdsWithin]
+    refine' ⟨(fun p : E × F => (I.symm p.1, p.snd)) ⁻¹' e.target, _, _, _⟩
+    · exact e.open_target.preimage (I.continuous_symm.prod_map continuous_id)
+    · simp only [Prod.mk.eta, mfld_simps] at hq
+      simp only [Prod.mk.eta, hq, mfld_simps]
+    rintro x hx
+    simp only [mfld_simps] at hx
+    have h2x := hx
+    simp only [e, FiberBundle.chartedSpace_chartAt, Trivialization.mem_target, mfld_simps] at h2x
+    simp only [h2s, hx, h2x, -preimage_inter, mfld_simps]
+  refine' UniqueDiffWithinAt.mono_nhds _ this
+  rw [h2s] at hq
   -- apply unique differentiability of products to conclude
   apply UniqueDiffOn.prod _ uniqueDiffOn_univ
   · simp only [hq, mfld_simps]
@@ -1982,10 +1999,10 @@ theorem UniqueMdiffOn.smooth_bundle_preimage (hs : UniqueMdiffOn I s) :
     rwa [← preimage_inter, ModelWithCorners.right_inv _ hx.2] at B
 #align unique_mdiff_on.smooth_bundle_preimage UniqueMdiffOn.smooth_bundle_preimage
 
-theorem UniqueMdiffOn.tangentBundle_proj_preimage (hs : UniqueMdiffOn I s) :
-    UniqueMdiffOn I.tangent (TangentBundle.proj I M ⁻¹' s) :=
+theorem UniqueMdiffOn.tangent_bundle_proj_preimage (hs : UniqueMdiffOn I s) :
+    UniqueMdiffOn I.tangent (π (TangentSpace I) ⁻¹' s) :=
   hs.smooth_bundle_preimage _
-#align unique_mdiff_on.tangent_bundle_proj_preimage UniqueMdiffOn.tangentBundle_proj_preimage
+#align unique_mdiff_on.tangent_bundle_proj_preimage UniqueMdiffOn.tangent_bundle_proj_preimage
 
 end UniqueMdiff
 
Diff
@@ -156,7 +156,7 @@ theorem differentiable_within_at_localInvariantProp :
       rw [this] at h
       have : I (e x) ∈ I.symm ⁻¹' e.target ∩ Set.range I := by simp only [hx, mfld_simps]
       have := (mem_groupoid_of_pregroupoid.2 he).2.ContDiffWithinAt this
-      convert (h.comp' _ (this.differentiable_within_at le_top)).mono_of_mem _ using 1
+      convert(h.comp' _ (this.differentiable_within_at le_top)).mono_of_mem _ using 1
       · ext y
         simp only [mfld_simps]
       refine'
@@ -177,7 +177,7 @@ theorem differentiable_within_at_localInvariantProp :
       have A : (I' ∘ f ∘ I.symm) (I x) ∈ I'.symm ⁻¹' e'.source ∩ Set.range I' := by
         simp only [hx, mfld_simps]
       have := (mem_groupoid_of_pregroupoid.2 he').1.ContDiffWithinAt A
-      convert (this.differentiable_within_at le_top).comp _ h _
+      convert(this.differentiable_within_at le_top).comp _ h _
       · ext y
         simp only [mfld_simps]
       · intro y hy
Diff
@@ -228,12 +228,12 @@ def MdifferentiableAt (f : M → M') (x : M) :=
     DifferentiableWithinAt 𝕜 (writtenInExtChartAt I I' x f) (range I) ((extChartAt I x) x)
 #align mdifferentiable_at MdifferentiableAt
 
-/- ./././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 ∧ »(_, _)]] -/
 theorem mdifferentiableAt_iff_liftPropAt (f : M → M') (x : M) :
     MdifferentiableAt I I' f x ↔ LiftPropAt (DifferentiableWithinAtProp I I') f x :=
   by
   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 ∧ »(_, _)]]"
   · rw [continuousWithinAt_univ]
   · simp [DifferentiableWithinAtProp, Set.univ_inter]
 #align mdifferentiable_at_iff_lift_prop_at mdifferentiableAt_iff_liftPropAt

Changes in mathlib4

mathlib3
mathlib4
perf: make LocalInvariantProp a structure (#12552)
  • Also redefine MDifferentiableWithinAt and MDifferentiableAt so that they are using LiftProp[Within]At.
  • This causes a speedup in the old proof of ContMDiffWithinAt.cle_arrowCongr by 25%.
  • Also give some extra information in the proof of ContMDiffWithinAt.cle_arrowCongr to speed it up by another factor of 4.
  • A bit of the fallout (e.g. in hasSmoothAddSelf) is from Lean unfolding way too many definitions to make things definitionally equal. Since LiftPropWithinAt is now a structure, the old proofs now break, unless you rewrite with chartedSpaceSelf_prod), causing much less defeq-abuse.
  • The new lemmas MDifferentiableWithinAt.differentiableWithinAt_writtenInExtChartAt and MDifferentiableAt.differentiableWithinAt_writtenInExtChartAt have a bit long names. This is to avoid naming clash with the existing MDifferentiableWithinAt.differentiableWithinAt. I'm open for other suggestions.
Diff
@@ -197,15 +197,32 @@ We require continuity in the definition, as otherwise points close to `x` in `s`
 and in particular by coincidence `writtenInExtChartAt I I' x f` could be differentiable, while
 this would not mean anything relevant. -/
 def MDifferentiableWithinAt (f : M → M') (s : Set M) (x : M) :=
-  ContinuousWithinAt f s x ∧
-    DifferentiableWithinAt 𝕜 (writtenInExtChartAt I I' x f) ((extChartAt I x).symm ⁻¹' s ∩ range I)
-      ((extChartAt I x) x)
+  LiftPropWithinAt (DifferentiableWithinAtProp I I') f s x
 #align mdifferentiable_within_at MDifferentiableWithinAt
 
-theorem mdifferentiableWithinAt_iff_liftPropWithinAt (f : M → M') (s : Set M) (x : M) :
-    MDifferentiableWithinAt I I' f s x ↔ LiftPropWithinAt (DifferentiableWithinAtProp I I') f s x :=
-  by rfl
-#align mdifferentiable_within_at_iff_lift_prop_within_at mdifferentiableWithinAt_iff_liftPropWithinAt
+theorem mdifferentiableWithinAt_iff' (f : M → M') (s : Set M) (x : M) :
+    MDifferentiableWithinAt I I' f s x ↔ ContinuousWithinAt f s x ∧
+    DifferentiableWithinAt 𝕜 (writtenInExtChartAt I I' x f)
+      ((extChartAt I x).symm ⁻¹' s ∩ range I) ((extChartAt I x) x) := by
+  rw [MDifferentiableWithinAt, liftPropWithinAt_iff']; rfl
+#align mdifferentiable_within_at_iff_lift_prop_within_at mdifferentiableWithinAt_iff'
+
+@[deprecated] -- 2024-04-30
+alias mdifferentiableWithinAt_iff_liftPropWithinAt := mdifferentiableWithinAt_iff'
+
+variable {I I'} in
+theorem MDifferentiableWithinAt.continuousWithinAt {f : M → M'} {s : Set M} {x : M}
+    (hf : MDifferentiableWithinAt I I' f s x) :
+    ContinuousWithinAt f s x :=
+  mdifferentiableWithinAt_iff' .. |>.1 hf |>.1
+#align mdifferentiable_within_at.continuous_within_at MDifferentiableWithinAt.continuousWithinAt
+
+variable {I I'} in
+theorem MDifferentiableWithinAt.differentiableWithinAt_writtenInExtChartAt
+    {f : M → M'} {s : Set M} {x : M} (hf : MDifferentiableWithinAt I I' f s x) :
+    DifferentiableWithinAt 𝕜 (writtenInExtChartAt I I' x f)
+      ((extChartAt I x).symm ⁻¹' s ∩ range I) ((extChartAt I x) x) :=
+  mdifferentiableWithinAt_iff' .. |>.1 hf |>.2
 
 /-- `MDifferentiableAt I I' f x` indicates that the function `f` between manifolds
 has a derivative at the point `x`.
@@ -216,17 +233,33 @@ We require continuity in the definition, as otherwise points close to `x` could
 and in particular by coincidence `writtenInExtChartAt I I' x f` could be differentiable, while
 this would not mean anything relevant. -/
 def MDifferentiableAt (f : M → M') (x : M) :=
-  ContinuousAt f x ∧
-    DifferentiableWithinAt 𝕜 (writtenInExtChartAt I I' x f) (range I) ((extChartAt I x) x)
+  LiftPropAt (DifferentiableWithinAtProp I I') f x
 #align mdifferentiable_at MDifferentiableAt
 
-theorem mdifferentiableAt_iff_liftPropAt (f : M → M') (x : M) :
-    MDifferentiableAt I I' f x ↔ LiftPropAt (DifferentiableWithinAtProp I I') f x := by
-  congrm ?_ ∧ ?_
-  · rw [continuousWithinAt_univ]
-  · -- Porting note: `rfl` wasn't needed
-    simp [DifferentiableWithinAtProp, Set.univ_inter]; rfl
-#align mdifferentiable_at_iff_lift_prop_at mdifferentiableAt_iff_liftPropAt
+theorem mdifferentiableAt_iff (f : M → M') (x : M) :
+    MDifferentiableAt I I' f x ↔ ContinuousAt f x ∧
+    DifferentiableWithinAt 𝕜 (writtenInExtChartAt I I' x f) (range I) ((extChartAt I x) x) := by
+  rw [MDifferentiableAt, liftPropAt_iff]
+  congrm _ ∧ ?_
+  simp [DifferentiableWithinAtProp, Set.univ_inter]
+  -- Porting note: `rfl` wasn't needed
+  rfl
+#align mdifferentiable_at_iff_lift_prop_at mdifferentiableAt_iff
+
+@[deprecated] -- 2024-04-30
+alias mdifferentiableAt_iff_liftPropAt := mdifferentiableAt_iff
+
+variable {I I'} in
+theorem MDifferentiableAt.continuousAt {f : M → M'} {x : M} (hf : MDifferentiableAt I I' f x) :
+    ContinuousAt f x :=
+  mdifferentiableAt_iff .. |>.1 hf |>.1
+#align mdifferentiable_at.continuous_at MDifferentiableAt.continuousAt
+
+variable {I I'} in
+theorem MDifferentiableAt.differentiableWithinAt_writtenInExtChartAt {f : M → M'} {x : M}
+    (hf : MDifferentiableAt I I' f x) :
+    DifferentiableWithinAt 𝕜 (writtenInExtChartAt I I' x f) (range I) ((extChartAt I x) x) :=
+  mdifferentiableAt_iff .. |>.1 hf |>.2
 
 /-- `MDifferentiableOn I I' f s` indicates that the function `f` between manifolds
 has a derivative within `s` at all points of `s`.
perf: make LocalInvariantProp a structure (#12552)
  • Also redefine MDifferentiableWithinAt and MDifferentiableAt so that they are using LiftProp[Within]At.
  • This causes a speedup in the old proof of ContMDiffWithinAt.cle_arrowCongr by 25%.
  • Also give some extra information in the proof of ContMDiffWithinAt.cle_arrowCongr to speed it up by another factor of 4.
  • A bit of the fallout (e.g. in hasSmoothAddSelf) is from Lean unfolding way too many definitions to make things definitionally equal. Since LiftPropWithinAt is now a structure, the old proofs now break, unless you rewrite with chartedSpaceSelf_prod), causing much less defeq-abuse.
  • The new lemmas MDifferentiableWithinAt.differentiableWithinAt_writtenInExtChartAt and MDifferentiableAt.differentiableWithinAt_writtenInExtChartAt have a bit long names. This is to avoid naming clash with the existing MDifferentiableWithinAt.differentiableWithinAt. I'm open for other suggestions.
Diff
@@ -139,6 +139,7 @@ theorem mdifferentiableWithinAt_iff {f : M → M'} {s : Set M} {x : M} :
       ContinuousWithinAt f s x ∧
         DifferentiableWithinAt 𝕜 (writtenInExtChartAt I I' x f)
           ((extChartAt I x).target ∩ (extChartAt I x).symm ⁻¹' s) ((extChartAt I x) x) := by
+  rw [mdifferentiableWithinAt_iff']
   refine' and_congr Iff.rfl (exists_congr fun f' => _)
   rw [inter_comm]
   simp only [HasFDerivWithinAt, nhdsWithin_inter, nhdsWithin_extChartAt_target_eq]
@@ -183,8 +184,9 @@ theorem HasMFDerivWithinAt.mdifferentiableWithinAt (h : HasMFDerivWithinAt I I'
 #align has_mfderiv_within_at.mdifferentiable_within_at HasMFDerivWithinAt.mdifferentiableWithinAt
 
 theorem HasMFDerivAt.mdifferentiableAt (h : HasMFDerivAt I I' f x f') :
-    MDifferentiableAt I I' f x :=
-  ⟨h.1, ⟨f', h.2⟩⟩
+    MDifferentiableAt I I' f x := by
+  rw [mdifferentiableAt_iff]
+  exact ⟨h.1, ⟨f', h.2⟩⟩
 #align has_mfderiv_at.mdifferentiable_at HasMFDerivAt.mdifferentiableAt
 
 @[simp, mfld_simps]
@@ -246,9 +248,9 @@ protected theorem MDifferentiableWithinAt.mfderivWithin (h : MDifferentiableWith
 
 theorem MDifferentiableAt.hasMFDerivAt (h : MDifferentiableAt I I' f x) :
     HasMFDerivAt I I' f x (mfderiv I I' f x) := by
-  refine' ⟨h.1, _⟩
+  refine' ⟨h.continuousAt, _⟩
   simp only [mfderiv, h, if_pos, mfld_simps]
-  exact DifferentiableWithinAt.hasFDerivWithinAt h.2
+  exact DifferentiableWithinAt.hasFDerivWithinAt h.differentiableWithinAt_writtenInExtChartAt
 #align mdifferentiable_at.has_mfderiv_at MDifferentiableAt.hasMFDerivAt
 
 protected theorem MDifferentiableAt.mfderiv (h : MDifferentiableAt I I' f x) :
@@ -281,27 +283,26 @@ theorem mfderivWithin_subset (st : s ⊆ t) (hs : UniqueMDiffWithinAt I s x)
 
 theorem MDifferentiableWithinAt.mono (hst : s ⊆ t) (h : MDifferentiableWithinAt I I' f t x) :
     MDifferentiableWithinAt I I' f s x :=
-  ⟨ContinuousWithinAt.mono h.1 hst,
-    DifferentiableWithinAt.mono h.2 (inter_subset_inter (preimage_mono hst) (Subset.refl _))⟩
+  ⟨ContinuousWithinAt.mono h.1 hst, DifferentiableWithinAt.mono
+    h.differentiableWithinAt_writtenInExtChartAt
+    (inter_subset_inter_left _ (preimage_mono hst))⟩
 #align mdifferentiable_within_at.mono MDifferentiableWithinAt.mono
 
 theorem mdifferentiableWithinAt_univ :
     MDifferentiableWithinAt I I' f univ x ↔ MDifferentiableAt I I' f x := by
-  simp only [MDifferentiableWithinAt, MDifferentiableAt, continuousWithinAt_univ, mfld_simps]
+  simp_rw [MDifferentiableWithinAt, MDifferentiableAt, ChartedSpace.LiftPropAt]
 #align mdifferentiable_within_at_univ mdifferentiableWithinAt_univ
 
 theorem mdifferentiableWithinAt_inter (ht : t ∈ 𝓝 x) :
     MDifferentiableWithinAt I I' f (s ∩ t) x ↔ MDifferentiableWithinAt I I' f s x := by
-  rw [MDifferentiableWithinAt, MDifferentiableWithinAt, extChartAt_preimage_inter_eq,
-    differentiableWithinAt_inter, continuousWithinAt_inter ht]
-  exact extChartAt_preimage_mem_nhds I ht
+  rw [MDifferentiableWithinAt, MDifferentiableWithinAt,
+    (differentiable_within_at_localInvariantProp I I').liftPropWithinAt_inter ht]
 #align mdifferentiable_within_at_inter mdifferentiableWithinAt_inter
 
 theorem mdifferentiableWithinAt_inter' (ht : t ∈ 𝓝[s] x) :
     MDifferentiableWithinAt I I' f (s ∩ t) x ↔ MDifferentiableWithinAt I I' f s x := by
-  rw [MDifferentiableWithinAt, MDifferentiableWithinAt, extChartAt_preimage_inter_eq,
-    differentiableWithinAt_inter', continuousWithinAt_inter' ht]
-  exact extChartAt_preimage_mem_nhdsWithin I ht
+  rw [MDifferentiableWithinAt, MDifferentiableWithinAt,
+    (differentiable_within_at_localInvariantProp I I').liftPropWithinAt_inter' ht]
 #align mdifferentiable_within_at_inter' mdifferentiableWithinAt_inter'
 
 theorem MDifferentiableAt.mdifferentiableWithinAt (h : MDifferentiableAt I I' f x) :
@@ -440,15 +441,6 @@ theorem HasMFDerivAt.continuousAt (h : HasMFDerivAt I I' f x f') : ContinuousAt
   h.1
 #align has_mfderiv_at.continuous_at HasMFDerivAt.continuousAt
 
-theorem MDifferentiableWithinAt.continuousWithinAt (h : MDifferentiableWithinAt I I' f s x) :
-    ContinuousWithinAt f s x :=
-  h.1
-#align mdifferentiable_within_at.continuous_within_at MDifferentiableWithinAt.continuousWithinAt
-
-theorem MDifferentiableAt.continuousAt (h : MDifferentiableAt I I' f x) : ContinuousAt f x :=
-  h.1
-#align mdifferentiable_at.continuous_at MDifferentiableAt.continuousAt
-
 theorem MDifferentiableOn.continuousOn (h : MDifferentiableOn I I' f s) : ContinuousOn f s :=
   fun x hx => (h x hx).continuousWithinAt
 #align mdifferentiable_on.continuous_on MDifferentiableOn.continuousOn
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
@@ -224,7 +224,7 @@ theorem mdifferentiableAt_iff_liftPropAt (f : M → M') (x : M) :
     MDifferentiableAt I I' f x ↔ LiftPropAt (DifferentiableWithinAtProp I I') f x := by
   congrm ?_ ∧ ?_
   · rw [continuousWithinAt_univ]
-  · -- porting note: `rfl` wasn't needed
+  · -- Porting note: `rfl` wasn't needed
     simp [DifferentiableWithinAtProp, Set.univ_inter]; rfl
 #align mdifferentiable_at_iff_lift_prop_at mdifferentiableAt_iff_liftPropAt
 
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
@@ -109,7 +109,7 @@ variable [Is : SmoothManifoldWithCorners I M] [I's : SmoothManifoldWithCorners I
 /-- `UniqueMDiffWithinAt` achieves its goal: it implies the uniqueness of the derivative. -/
 nonrec theorem UniqueMDiffWithinAt.eq (U : UniqueMDiffWithinAt I s x)
     (h : HasMFDerivWithinAt I I' f s x f') (h₁ : HasMFDerivWithinAt I I' f s x f₁') : f' = f₁' := by
-  -- porting note: didn't need `convert` because of finding instances by unification
+  -- Porting note: didn't need `convert` because of finding instances by unification
   convert U.eq h.2 h₁.2
 #align unique_mdiff_within_at.eq UniqueMDiffWithinAt.eq
 
@@ -378,7 +378,7 @@ theorem mdifferentiableAt_iff_of_mem_source {x' : M} {y : M'}
 
 /-! ### Deducing differentiability from smoothness -/
 
--- porting note: moved from `ContMDiffMFDeriv`
+-- Porting note: moved from `ContMDiffMFDeriv`
 variable {n : ℕ∞}
 
 theorem ContMDiffWithinAt.mdifferentiableWithinAt (hf : ContMDiffWithinAt I I' n f s x)
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
@@ -383,8 +383,8 @@ variable {n : ℕ∞}
 
 theorem ContMDiffWithinAt.mdifferentiableWithinAt (hf : ContMDiffWithinAt I I' n f s x)
     (hn : 1 ≤ n) : MDifferentiableWithinAt I I' f s x := by
-  suffices h : MDifferentiableWithinAt I I' f (s ∩ f ⁻¹' (extChartAt I' (f x)).source) x
-  · rwa [mdifferentiableWithinAt_inter'] at h
+  suffices h : MDifferentiableWithinAt I I' f (s ∩ f ⁻¹' (extChartAt I' (f x)).source) x by
+    rwa [mdifferentiableWithinAt_inter'] at h
     apply hf.1.preimage_mem_nhdsWithin
     exact extChartAt_source_mem_nhds I' (f x)
   rw [mdifferentiableWithinAt_iff]
refactor(PartialHomeomorph): Remove explicit variable (x : M). (#10083)

Instead, supply it as needed.

This replaces an explicit argument (x : M) by an implicit {x : M} in the following lemmas:

  • extChartAt_source_mem_nhds'
  • extChartAt_source_mem_nhdsWithin'
  • continuousAt_extChartAt'
  • extChartAt_image_nhd_mem_nhds_of_boundaryless
  • extChartAt_target_mem_nhdsWithin'
  • nhdsWithin_extChartAt_target_eq'
  • continuousAt_extChartAt_symm'
  • continuousAt_extChartAt_symm''
  • map_extChartAt_nhdsWithin_eq_image'
  • map_extChartAt_nhdsWithin'
  • map_extChartAt_symm_nhdsWithin'
  • map_extChartAt_symm_nhdsWithin_range'
  • extChartAt_preimage_mem_nhdsWithin'
  • extChartAt_preimage_mem_nhdsWithin
  • extChartAt_preimage_mem_nhds'
  • extChartAt_preimage_mem_nhds

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

Diff
@@ -202,14 +202,14 @@ theorem hasMFDerivWithinAt_inter' (h : t ∈ 𝓝[s] x) :
     HasMFDerivWithinAt I I' f (s ∩ t) x f' ↔ HasMFDerivWithinAt I I' f s x f' := by
   rw [HasMFDerivWithinAt, HasMFDerivWithinAt, extChartAt_preimage_inter_eq,
     hasFDerivWithinAt_inter', continuousWithinAt_inter' h]
-  exact extChartAt_preimage_mem_nhdsWithin I x h
+  exact extChartAt_preimage_mem_nhdsWithin I h
 #align has_mfderiv_within_at_inter' hasMFDerivWithinAt_inter'
 
 theorem hasMFDerivWithinAt_inter (h : t ∈ 𝓝 x) :
     HasMFDerivWithinAt I I' f (s ∩ t) x f' ↔ HasMFDerivWithinAt I I' f s x f' := by
   rw [HasMFDerivWithinAt, HasMFDerivWithinAt, extChartAt_preimage_inter_eq, hasFDerivWithinAt_inter,
     continuousWithinAt_inter h]
-  exact extChartAt_preimage_mem_nhds I x h
+  exact extChartAt_preimage_mem_nhds I h
 #align has_mfderiv_within_at_inter hasMFDerivWithinAt_inter
 
 theorem HasMFDerivWithinAt.union (hs : HasMFDerivWithinAt I I' f s x f')
@@ -294,14 +294,14 @@ theorem mdifferentiableWithinAt_inter (ht : t ∈ 𝓝 x) :
     MDifferentiableWithinAt I I' f (s ∩ t) x ↔ MDifferentiableWithinAt I I' f s x := by
   rw [MDifferentiableWithinAt, MDifferentiableWithinAt, extChartAt_preimage_inter_eq,
     differentiableWithinAt_inter, continuousWithinAt_inter ht]
-  exact extChartAt_preimage_mem_nhds I x ht
+  exact extChartAt_preimage_mem_nhds I ht
 #align mdifferentiable_within_at_inter mdifferentiableWithinAt_inter
 
 theorem mdifferentiableWithinAt_inter' (ht : t ∈ 𝓝[s] x) :
     MDifferentiableWithinAt I I' f (s ∩ t) x ↔ MDifferentiableWithinAt I I' f s x := by
   rw [MDifferentiableWithinAt, MDifferentiableWithinAt, extChartAt_preimage_inter_eq,
     differentiableWithinAt_inter', continuousWithinAt_inter' ht]
-  exact extChartAt_preimage_mem_nhdsWithin I x ht
+  exact extChartAt_preimage_mem_nhdsWithin I ht
 #align mdifferentiable_within_at_inter' mdifferentiableWithinAt_inter'
 
 theorem MDifferentiableAt.mdifferentiableWithinAt (h : MDifferentiableAt I I' f x) :
@@ -350,7 +350,7 @@ theorem mfderivWithin_univ : mfderivWithin I I' f univ = mfderiv I I' f := by
 theorem mfderivWithin_inter (ht : t ∈ 𝓝 x) :
     mfderivWithin I I' f (s ∩ t) x = mfderivWithin I I' f s x := by
   rw [mfderivWithin, mfderivWithin, extChartAt_preimage_inter_eq, mdifferentiableWithinAt_inter ht,
-    fderivWithin_inter (extChartAt_preimage_mem_nhds I x ht)]
+    fderivWithin_inter (extChartAt_preimage_mem_nhds I ht)]
 #align mfderiv_within_inter mfderivWithin_inter
 
 theorem mfderivWithin_of_mem_nhds (h : s ∈ 𝓝 x) : mfderivWithin I I' f s x = mfderiv I I' f x := by
@@ -551,7 +551,7 @@ theorem HasMFDerivWithinAt.congr_of_eventuallyEq (h : HasMFDerivWithinAt I I' f
   · have :
       (extChartAt I x).symm ⁻¹' {y | f₁ y = f y} ∈
         𝓝[(extChartAt I x).symm ⁻¹' s ∩ range I] (extChartAt I x) x :=
-      extChartAt_preimage_mem_nhdsWithin I x h₁
+      extChartAt_preimage_mem_nhdsWithin I h₁
     apply Filter.mem_of_superset this fun y => _
     simp (config := { contextual := true }) only [hx, mfld_simps]
   · simp only [hx, mfld_simps]
@@ -667,7 +667,7 @@ theorem writtenInExtChartAt_comp (h : ContinuousWithinAt f s x) :
       𝓝[(extChartAt I x).symm ⁻¹' s ∩ range I] (extChartAt I x) x := by
   apply
     @Filter.mem_of_superset _ _ (f ∘ (extChartAt I x).symm ⁻¹' (extChartAt I' (f x)).source) _
-      (extChartAt_preimage_mem_nhdsWithin I x
+      (extChartAt_preimage_mem_nhdsWithin I
         (h.preimage_mem_nhdsWithin (extChartAt_source_mem_nhds _ _)))
   mfld_set_tac
 #align written_in_ext_chart_comp writtenInExtChartAt_comp
@@ -685,7 +685,7 @@ theorem HasMFDerivWithinAt.comp (hg : HasMFDerivWithinAt I' I'' g u (f x) g')
     have :
       (extChartAt I x).symm ⁻¹' (f ⁻¹' (extChartAt I' (f x)).source) ∈
         𝓝[(extChartAt I x).symm ⁻¹' s ∩ range I] (extChartAt I x) x :=
-      extChartAt_preimage_mem_nhdsWithin I x
+      extChartAt_preimage_mem_nhdsWithin I
         (hf.1.preimage_mem_nhdsWithin (extChartAt_source_mem_nhds _ _))
     unfold HasMFDerivWithinAt at *
     rw [← hasFDerivWithinAt_inter' this, ← extChartAt_preimage_inter_eq] at hf ⊢
chore: correct hypothesis order in dot notation lemma (#9568)

Following a comment by @sgouezel, the hypothesis IsOpen s should be the first explicit argument.

Diff
@@ -82,7 +82,7 @@ theorem UniqueMDiffWithinAt.inter (hs : UniqueMDiffWithinAt I s x) (ht : t ∈ 
   hs.inter' (nhdsWithin_le_nhds ht)
 #align unique_mdiff_within_at.inter UniqueMDiffWithinAt.inter
 
-theorem IsOpen.uniqueMDiffWithinAt (xs : x ∈ s) (hs : IsOpen s) : UniqueMDiffWithinAt I s x :=
+theorem IsOpen.uniqueMDiffWithinAt (hs : IsOpen s) (xs : x ∈ s) : UniqueMDiffWithinAt I s x :=
   (uniqueMDiffWithinAt_univ I).mono_of_mem <| nhdsWithin_le_nhds <| hs.mem_nhds xs
 #align is_open.unique_mdiff_within_at IsOpen.uniqueMDiffWithinAt
 
@@ -90,8 +90,8 @@ theorem UniqueMDiffOn.inter (hs : UniqueMDiffOn I s) (ht : IsOpen t) : UniqueMDi
   fun _x hx => UniqueMDiffWithinAt.inter (hs _ hx.1) (ht.mem_nhds hx.2)
 #align unique_mdiff_on.inter UniqueMDiffOn.inter
 
-theorem IsOpen.uniqueMDiffOn (hs : IsOpen s) : UniqueMDiffOn I s := fun _x hx =>
-  IsOpen.uniqueMDiffWithinAt hx hs
+theorem IsOpen.uniqueMDiffOn (hs : IsOpen s) : UniqueMDiffOn I s :=
+  fun _x hx => hs.uniqueMDiffWithinAt hx
 #align is_open.unique_mdiff_on IsOpen.uniqueMDiffOn
 
 theorem uniqueMDiffOn_univ : UniqueMDiffOn I (univ : Set M) :=
refactor(Geometry/Manifold/MFDeriv): split file (#9565)

With about 2200 lines, this is the largest file in Geometry/Manifolds.

refactor(Geometry/Manifold/MFDeriv): split file (#9565)

With about 2200 lines, this is the largest file in Geometry/Manifolds.

Diff
@@ -3,311 +3,28 @@ Copyright (c) 2020 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.Geometry.Manifold.VectorBundle.Tangent
+import Mathlib.Geometry.Manifold.MFDeriv.Defs
 
 #align_import geometry.manifold.mfderiv from "leanprover-community/mathlib"@"e473c3198bb41f68560cab68a0529c854b618833"
 
 /-!
-# The derivative of functions between smooth manifolds
-
-Let `M` and `M'` be two smooth manifolds with corners over a field `𝕜` (with respective models with
-corners `I` on `(E, H)` and `I'` on `(E', H')`), and let `f : M → M'`. We define the
-derivative of the function at a point, within a set or along the whole space, mimicking the API
-for (Fréchet) derivatives. It is denoted by `mfderiv I I' f x`, where "m" stands for "manifold" and
-"f" for "Fréchet" (as in the usual derivative `fderiv 𝕜 f x`).
-
-## Main definitions
-
-* `UniqueMDiffOn I s` : predicate saying that, at each point of the set `s`, a function can have
-  at most one derivative. This technical condition is important when we define
-  `mfderivWithin` below, as otherwise there is an arbitrary choice in the derivative,
-  and many properties will fail (for instance the chain rule). This is analogous to
-  `UniqueDiffOn 𝕜 s` in a vector space.
-
-Let `f` be a map between smooth manifolds. The following definitions follow the `fderiv` API.
-
-* `mfderiv I I' f x` : the derivative of `f` at `x`, as a continuous linear map from the tangent
-  space at `x` to the tangent space at `f x`. If the map is not differentiable, this is `0`.
-* `mfderivWithin I I' f s x` : the derivative of `f` at `x` within `s`, as a continuous linear map
-  from the tangent space at `x` to the tangent space at `f x`. If the map is not differentiable
-  within `s`, this is `0`.
-* `MDifferentiableAt I I' f x` : Prop expressing whether `f` is differentiable at `x`.
-* `MDifferentiableWithinAt 𝕜 f s x` : Prop expressing whether `f` is differentiable within `s`
-  at `x`.
-* `HasMFDerivAt I I' f s x f'` : Prop expressing whether `f` has `f'` as a derivative at `x`.
-* `HasMFDerivWithinAt I I' f s x f'` : Prop expressing whether `f` has `f'` as a derivative
-  within `s` at `x`.
-* `MDifferentiableOn I I' f s` : Prop expressing that `f` is differentiable on the set `s`.
-* `MDifferentiable I I' f` : Prop expressing that `f` is differentiable everywhere.
-* `tangentMap I I' f` : the derivative of `f`, as a map from the tangent bundle of `M` to the
-  tangent bundle of `M'`.
-
-We also establish results on the differential of the identity, constant functions, charts, extended
-charts. For functions between vector spaces, we show that the usual notions and the manifold notions
-coincide.
-
-## Implementation notes
-
-The tangent bundle is constructed using the machinery of topological fiber bundles, for which one
-can define bundled morphisms and construct canonically maps from the total space of one bundle to
-the total space of another one. One could use this mechanism to construct directly the derivative
-of a smooth map. However, we want to define the derivative of any map (and let it be zero if the map
-is not differentiable) to avoid proof arguments everywhere. This means we have to go back to the
-details of the definition of the total space of a fiber bundle constructed from core, to cook up a
-suitable definition of the derivative. It is the following: at each point, we have a preferred chart
-(used to identify the fiber above the point with the model vector space in fiber bundles). Then one
-should read the function using these preferred charts at `x` and `f x`, and take the derivative
-of `f` in these charts.
-
-Due to the fact that we are working in a model with corners, with an additional embedding `I` of the
-model space `H` in the model vector space `E`, the charts taking values in `E` are not the original
-charts of the manifold, but those ones composed with `I`, called extended charts. We define
-`writtenInExtChartAt I I' x f` for the function `f` written in the preferred extended charts. Then
-the manifold derivative of `f`, at `x`, is just the usual derivative of
-`writtenInExtChartAt I I' x f`, at the point `(extChartAt I x) x`.
-
-There is a subtelty with respect to continuity: if the function is not continuous, then the image
-of a small open set around `x` will not be contained in the source of the preferred chart around
-`f x`, which means that when reading `f` in the chart one is losing some information. To avoid this,
-we include continuity in the definition of differentiablity (which is reasonable since with any
-definition, differentiability implies continuity).
-
-*Warning*: the derivative (even within a subset) is a linear map on the whole tangent space. Suppose
-that one is given a smooth submanifold `N`, and a function which is smooth on `N` (i.e., its
-restriction to the subtype `N` is smooth). Then, in the whole manifold `M`, the property
-`MDifferentiableOn I I' f N` holds. However, `mfderivWithin I I' f N` is not uniquely defined
-(what values would one choose for vectors that are transverse to `N`?), which can create issues down
-the road. The problem here is that knowing the value of `f` along `N` does not determine the
-differential of `f` in all directions. This is in contrast to the case where `N` would be an open
-subset, or a submanifold with boundary of maximal dimension, where this issue does not appear.
-The predicate `UniqueMDiffOn I N` indicates that the derivative along `N` is unique if it exists,
-and is an assumption in most statements requiring a form of uniqueness.
-
-On a vector space, the manifold derivative and the usual derivative are equal. This means in
-particular that they live on the same space, i.e., the tangent space is defeq to the original vector
-space. To get this property is a motivation for our definition of the tangent space as a single
-copy of the vector space, instead of more usual definitions such as the space of derivations, or
-the space of equivalence classes of smooth curves in the manifold.
-
-## Tags
-Derivative, manifold
--/
-
-noncomputable section
+# Basic properties of the manifold Fréchet derivative
 
-open scoped Classical Topology Manifold Bundle
-open Set Bundle ChartedSpace
+In this file, we show various properties of the manifold Fréchet derivative,
+mimicking the API for Fréchet derivatives.
+- basic properties of unique differentiability sets
+- various general lemmas about the manifold Fréchet derivative
+- deducing differentiability from smoothness,
+- deriving continuity from differentiability on manifolds,
+- congruence lemmas for derivatives on manifolds
+- composition lemmas and the chain rule
 
-universe u
-
-section DerivativesDefinitions
-
-/-!
-### Derivative of maps between manifolds
-
-The derivative of a smooth map `f` between smooth manifold `M` and `M'` at `x` is a bounded linear
-map from the tangent space to `M` at `x`, to the tangent space to `M'` at `f x`. Since we defined
-the tangent space using one specific chart, the formula for the derivative is written in terms of
-this specific chart.
-
-We use the names `MDifferentiable` and `mfderiv`, where the prefix letter `m` means "manifold".
 -/
 
-variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
-  [NormedSpace 𝕜 E] {H : Type*} [TopologicalSpace H] (I : ModelWithCorners 𝕜 E H) {M : Type*}
-  [TopologicalSpace M] [ChartedSpace H M] {E' : Type*} [NormedAddCommGroup E'] [NormedSpace 𝕜 E']
-  {H' : Type*} [TopologicalSpace H'] (I' : ModelWithCorners 𝕜 E' H') {M' : Type*}
-  [TopologicalSpace M'] [ChartedSpace H' M']
-
-/-- Property in the model space of a model with corners of being differentiable within at set at a
-point, when read in the model vector space. This property will be lifted to manifolds to define
-differentiable functions between manifolds. -/
-def DifferentiableWithinAtProp (f : H → H') (s : Set H) (x : H) : Prop :=
-  DifferentiableWithinAt 𝕜 (I' ∘ f ∘ I.symm) (I.symm ⁻¹' s ∩ Set.range I) (I x)
-#align differentiable_within_at_prop DifferentiableWithinAtProp
-
-/-- Being differentiable in the model space is a local property, invariant under smooth maps.
-Therefore, it will lift nicely to manifolds. -/
-theorem differentiable_within_at_localInvariantProp :
-    (contDiffGroupoid ⊤ I).LocalInvariantProp (contDiffGroupoid ⊤ I')
-      (DifferentiableWithinAtProp I I') :=
-  { is_local := by
-      intro s x u f u_open xu
-      have : I.symm ⁻¹' (s ∩ u) ∩ Set.range I = I.symm ⁻¹' s ∩ Set.range I ∩ I.symm ⁻¹' u := by
-        simp only [Set.inter_right_comm, Set.preimage_inter]
-      rw [DifferentiableWithinAtProp, DifferentiableWithinAtProp, this]
-      symm
-      apply differentiableWithinAt_inter
-      have : u ∈ 𝓝 (I.symm (I x)) := by
-        rw [ModelWithCorners.left_inv]
-        exact IsOpen.mem_nhds u_open xu
-      apply I.continuous_symm.continuousAt this
-    right_invariance' := by
-      intro s x f e he hx h
-      rw [DifferentiableWithinAtProp] at h ⊢
-      have : I x = (I ∘ e.symm ∘ I.symm) (I (e x)) := by simp only [hx, mfld_simps]
-      rw [this] at h
-      have : I (e x) ∈ I.symm ⁻¹' e.target ∩ Set.range I := by simp only [hx, mfld_simps]
-      have := (mem_groupoid_of_pregroupoid.2 he).2.contDiffWithinAt this
-      convert (h.comp' _ (this.differentiableWithinAt le_top)).mono_of_mem _ using 1
-      · ext y; simp only [mfld_simps]
-      refine'
-        mem_nhdsWithin.mpr
-          ⟨I.symm ⁻¹' e.target, e.open_target.preimage I.continuous_symm, by
-            simp_rw [Set.mem_preimage, I.left_inv, e.mapsTo hx], _⟩
-      mfld_set_tac
-    congr_of_forall := by
-      intro s x f g h hx hf
-      apply hf.congr
-      · intro y hy
-        simp only [mfld_simps] at hy
-        simp only [h, hy, mfld_simps]
-      · simp only [hx, mfld_simps]
-    left_invariance' := by
-      intro s x f e' he' hs hx h
-      rw [DifferentiableWithinAtProp] at h ⊢
-      have A : (I' ∘ f ∘ I.symm) (I x) ∈ I'.symm ⁻¹' e'.source ∩ Set.range I' := by
-        simp only [hx, mfld_simps]
-      have := (mem_groupoid_of_pregroupoid.2 he').1.contDiffWithinAt A
-      convert (this.differentiableWithinAt le_top).comp _ h _
-      · ext y; simp only [mfld_simps]
-      · intro y hy; simp only [mfld_simps] at hy; simpa only [hy, mfld_simps] using hs hy.1 }
-#align differentiable_within_at_local_invariant_prop differentiable_within_at_localInvariantProp
-
-/-- Predicate ensuring that, at a point and within a set, a function can have at most one
-derivative. This is expressed using the preferred chart at the considered point. -/
-def UniqueMDiffWithinAt (s : Set M) (x : M) :=
-  UniqueDiffWithinAt 𝕜 ((extChartAt I x).symm ⁻¹' s ∩ range I) ((extChartAt I x) x)
-#align unique_mdiff_within_at UniqueMDiffWithinAt
-
-/-- Predicate ensuring that, at all points of a set, a function can have at most one derivative. -/
-def UniqueMDiffOn (s : Set M) :=
-  ∀ x ∈ s, UniqueMDiffWithinAt I s x
-#align unique_mdiff_on UniqueMDiffOn
-
-/-- `MDifferentiableWithinAt I I' f s x` indicates that the function `f` between manifolds
-has a derivative at the point `x` within the set `s`.
-This is a generalization of `DifferentiableWithinAt` to manifolds.
-
-We require continuity in the definition, as otherwise points close to `x` in `s` could be sent by
-`f` outside of the chart domain around `f x`. Then the chart could do anything to the image points,
-and in particular by coincidence `writtenInExtChartAt I I' x f` could be differentiable, while
-this would not mean anything relevant. -/
-def MDifferentiableWithinAt (f : M → M') (s : Set M) (x : M) :=
-  ContinuousWithinAt f s x ∧
-    DifferentiableWithinAt 𝕜 (writtenInExtChartAt I I' x f) ((extChartAt I x).symm ⁻¹' s ∩ range I)
-      ((extChartAt I x) x)
-#align mdifferentiable_within_at MDifferentiableWithinAt
-
-theorem mdifferentiableWithinAt_iff_liftPropWithinAt (f : M → M') (s : Set M) (x : M) :
-    MDifferentiableWithinAt I I' f s x ↔ LiftPropWithinAt (DifferentiableWithinAtProp I I') f s x :=
-  by rfl
-#align mdifferentiable_within_at_iff_lift_prop_within_at mdifferentiableWithinAt_iff_liftPropWithinAt
-
-/-- `MDifferentiableAt I I' f x` indicates that the function `f` between manifolds
-has a derivative at the point `x`.
-This is a generalization of `DifferentiableAt` to manifolds.
-
-We require continuity in the definition, as otherwise points close to `x` could be sent by
-`f` outside of the chart domain around `f x`. Then the chart could do anything to the image points,
-and in particular by coincidence `writtenInExtChartAt I I' x f` could be differentiable, while
-this would not mean anything relevant. -/
-def MDifferentiableAt (f : M → M') (x : M) :=
-  ContinuousAt f x ∧
-    DifferentiableWithinAt 𝕜 (writtenInExtChartAt I I' x f) (range I) ((extChartAt I x) x)
-#align mdifferentiable_at MDifferentiableAt
-
-theorem mdifferentiableAt_iff_liftPropAt (f : M → M') (x : M) :
-    MDifferentiableAt I I' f x ↔ LiftPropAt (DifferentiableWithinAtProp I I') f x := by
-  congrm ?_ ∧ ?_
-  · rw [continuousWithinAt_univ]
-  · -- porting note: `rfl` wasn't needed
-    simp [DifferentiableWithinAtProp, Set.univ_inter]; rfl
-#align mdifferentiable_at_iff_lift_prop_at mdifferentiableAt_iff_liftPropAt
-
-/-- `MDifferentiableOn I I' f s` indicates that the function `f` between manifolds
-has a derivative within `s` at all points of `s`.
-This is a generalization of `DifferentiableOn` to manifolds. -/
-def MDifferentiableOn (f : M → M') (s : Set M) :=
-  ∀ x ∈ s, MDifferentiableWithinAt I I' f s x
-#align mdifferentiable_on MDifferentiableOn
-
-/-- `MDifferentiable I I' f` indicates that the function `f` between manifolds
-has a derivative everywhere.
-This is a generalization of `Differentiable` to manifolds. -/
-def MDifferentiable (f : M → M') :=
-  ∀ x, MDifferentiableAt I I' f x
-#align mdifferentiable MDifferentiable
-
-/-- Prop registering if a partial homeomorphism is a local diffeomorphism on its source -/
-def PartialHomeomorph.MDifferentiable (f : PartialHomeomorph M M') :=
-  MDifferentiableOn I I' f f.source ∧ MDifferentiableOn I' I f.symm f.target
-#align local_homeomorph.mdifferentiable PartialHomeomorph.MDifferentiable
-
-variable [SmoothManifoldWithCorners I M] [SmoothManifoldWithCorners I' M']
-
-/-- `HasMFDerivWithinAt I I' f s x f'` indicates that the function `f` between manifolds
-has, at the point `x` and within the set `s`, the derivative `f'`. Here, `f'` is a continuous linear
-map from the tangent space at `x` to the tangent space at `f x`.
-
-This is a generalization of `HasFDerivWithinAt` to manifolds (as indicated by the prefix `m`).
-The order of arguments is changed as the type of the derivative `f'` depends on the choice of `x`.
-
-We require continuity in the definition, as otherwise points close to `x` in `s` could be sent by
-`f` outside of the chart domain around `f x`. Then the chart could do anything to the image points,
-and in particular by coincidence `writtenInExtChartAt I I' x f` could be differentiable, while
-this would not mean anything relevant. -/
-def HasMFDerivWithinAt (f : M → M') (s : Set M) (x : M)
-    (f' : TangentSpace I x →L[𝕜] TangentSpace I' (f x)) :=
-  ContinuousWithinAt f s x ∧
-    HasFDerivWithinAt (writtenInExtChartAt I I' x f : E → E') f'
-      ((extChartAt I x).symm ⁻¹' s ∩ range I) ((extChartAt I x) x)
-#align has_mfderiv_within_at HasMFDerivWithinAt
-
-/-- `HasMFDerivAt I I' f x f'` indicates that the function `f` between manifolds
-has, at the point `x`, the derivative `f'`. Here, `f'` is a continuous linear
-map from the tangent space at `x` to the tangent space at `f x`.
-
-We require continuity in the definition, as otherwise points close to `x` `s` could be sent by
-`f` outside of the chart domain around `f x`. Then the chart could do anything to the image points,
-and in particular by coincidence `writtenInExtChartAt I I' x f` could be differentiable, while
-this would not mean anything relevant. -/
-def HasMFDerivAt (f : M → M') (x : M) (f' : TangentSpace I x →L[𝕜] TangentSpace I' (f x)) :=
-  ContinuousAt f x ∧
-    HasFDerivWithinAt (writtenInExtChartAt I I' x f : E → E') f' (range I) ((extChartAt I x) x)
-#align has_mfderiv_at HasMFDerivAt
-
-/-- Let `f` be a function between two smooth manifolds. Then `mfderivWithin I I' f s x` is the
-derivative of `f` at `x` within `s`, as a continuous linear map from the tangent space at `x` to the
-tangent space at `f x`. -/
-def mfderivWithin (f : M → M') (s : Set M) (x : M) : TangentSpace I x →L[𝕜] TangentSpace I' (f x) :=
-  if MDifferentiableWithinAt I I' f s x then
-    (fderivWithin 𝕜 (writtenInExtChartAt I I' x f) ((extChartAt I x).symm ⁻¹' s ∩ range I)
-        ((extChartAt I x) x) :
-      _)
-  else 0
-#align mfderiv_within mfderivWithin
-
-/-- Let `f` be a function between two smooth manifolds. Then `mfderiv I I' f x` is the derivative of
-`f` at `x`, as a continuous linear map from the tangent space at `x` to the tangent space at
-`f x`. -/
-def mfderiv (f : M → M') (x : M) : TangentSpace I x →L[𝕜] TangentSpace I' (f x) :=
-  if MDifferentiableAt I I' f x then
-    (fderivWithin 𝕜 (writtenInExtChartAt I I' x f : E → E') (range I) ((extChartAt I x) x) : _)
-  else 0
-#align mfderiv mfderiv
-
-/-- The derivative within a set, as a map between the tangent bundles -/
-def tangentMapWithin (f : M → M') (s : Set M) : TangentBundle I M → TangentBundle I' M' := fun p =>
-  ⟨f p.1, (mfderivWithin I I' f s p.1 : TangentSpace I p.1 → TangentSpace I' (f p.1)) p.2⟩
-#align tangent_map_within tangentMapWithin
-
-/-- The derivative, as a map between the tangent bundles -/
-def tangentMap (f : M → M') : TangentBundle I M → TangentBundle I' M' := fun p =>
-  ⟨f p.1, (mfderiv I I' f p.1 : TangentSpace I p.1 → TangentSpace I' (f p.1)) p.2⟩
-#align tangent_map tangentMap
-
-end DerivativesDefinitions
+noncomputable section
+
+open scoped Topology Manifold
+open Set Bundle
 
 section DerivativesProperties
 
@@ -370,7 +87,7 @@ theorem IsOpen.uniqueMDiffWithinAt (xs : x ∈ s) (hs : IsOpen s) : UniqueMDiffW
 #align is_open.unique_mdiff_within_at IsOpen.uniqueMDiffWithinAt
 
 theorem UniqueMDiffOn.inter (hs : UniqueMDiffOn I s) (ht : IsOpen t) : UniqueMDiffOn I (s ∩ t) :=
-  fun _x hx => UniqueMDiffWithinAt.inter (hs _ hx.1) (IsOpen.mem_nhds ht hx.2)
+  fun _x hx => UniqueMDiffWithinAt.inter (hs _ hx.1) (ht.mem_nhds hx.2)
 #align unique_mdiff_on.inter UniqueMDiffOn.inter
 
 theorem IsOpen.uniqueMDiffOn (hs : IsOpen s) : UniqueMDiffOn I s := fun _x hx =>
@@ -620,7 +337,7 @@ theorem mdifferentiableOn_of_locally_mdifferentiableOn
     MDifferentiableOn I I' f s := by
   intro x xs
   rcases h x xs with ⟨t, t_open, xt, ht⟩
-  exact (mdifferentiableWithinAt_inter (IsOpen.mem_nhds t_open xt)).1 (ht x ⟨xs, xt⟩)
+  exact (mdifferentiableWithinAt_inter (t_open.mem_nhds xt)).1 (ht x ⟨xs, xt⟩)
 #align mdifferentiable_on_of_locally_mdifferentiable_on mdifferentiableOn_of_locally_mdifferentiableOn
 
 @[simp, mfld_simps]
@@ -662,7 +379,6 @@ theorem mdifferentiableAt_iff_of_mem_source {x' : M} {y : M'}
 /-! ### Deducing differentiability from smoothness -/
 
 -- porting note: moved from `ContMDiffMFDeriv`
-
 variable {n : ℕ∞}
 
 theorem ContMDiffWithinAt.mdifferentiableWithinAt (hf : ContMDiffWithinAt I I' n f s x)
@@ -1067,1096 +783,3 @@ theorem tangentMap_comp (hg : MDifferentiable I' I'' g) (hf : MDifferentiable I
 #align tangent_map_comp tangentMap_comp
 
 end DerivativesProperties
-
-section MFDerivFderiv
-
-/-!
-### Relations between vector space derivative and manifold derivative
-
-The manifold derivative `mfderiv`, when considered on the model vector space with its trivial
-manifold structure, coincides with the usual Frechet derivative `fderiv`. In this section, we prove
-this and related statements.
--/
-
-
-variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
-  [NormedSpace 𝕜 E] {E' : Type*} [NormedAddCommGroup E'] [NormedSpace 𝕜 E'] {f : E → E'}
-  {s : Set E} {x : E}
-
-theorem uniqueMDiffWithinAt_iff_uniqueDiffWithinAt :
-    UniqueMDiffWithinAt 𝓘(𝕜, E) s x ↔ UniqueDiffWithinAt 𝕜 s x := by
-  simp only [UniqueMDiffWithinAt, mfld_simps]
-#align unique_mdiff_within_at_iff_unique_diff_within_at uniqueMDiffWithinAt_iff_uniqueDiffWithinAt
-
-alias ⟨UniqueMDiffWithinAt.uniqueDiffWithinAt, UniqueDiffWithinAt.uniqueMDiffWithinAt⟩ :=
-  uniqueMDiffWithinAt_iff_uniqueDiffWithinAt
-#align unique_mdiff_within_at.unique_diff_within_at UniqueMDiffWithinAt.uniqueDiffWithinAt
-#align unique_diff_within_at.unique_mdiff_within_at UniqueDiffWithinAt.uniqueMDiffWithinAt
-
-theorem uniqueMDiffOn_iff_uniqueDiffOn : UniqueMDiffOn 𝓘(𝕜, E) s ↔ UniqueDiffOn 𝕜 s := by
-  simp [UniqueMDiffOn, UniqueDiffOn, uniqueMDiffWithinAt_iff_uniqueDiffWithinAt]
-#align unique_mdiff_on_iff_unique_diff_on uniqueMDiffOn_iff_uniqueDiffOn
-
-alias ⟨UniqueMDiffOn.uniqueDiffOn, UniqueDiffOn.uniqueMDiffOn⟩ := uniqueMDiffOn_iff_uniqueDiffOn
-#align unique_mdiff_on.unique_diff_on UniqueMDiffOn.uniqueDiffOn
-#align unique_diff_on.unique_mdiff_on UniqueDiffOn.uniqueMDiffOn
-
--- porting note: was `@[simp, mfld_simps]` but `simp` can prove it
-theorem writtenInExtChartAt_model_space : writtenInExtChartAt 𝓘(𝕜, E) 𝓘(𝕜, E') x f = f :=
-  rfl
-#align written_in_ext_chart_model_space writtenInExtChartAt_model_space
-
-theorem hasMFDerivWithinAt_iff_hasFDerivWithinAt {f'} :
-    HasMFDerivWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') f s x f' ↔ HasFDerivWithinAt f f' s x := by
-  simpa only [HasMFDerivWithinAt, and_iff_right_iff_imp, mfld_simps] using
-    HasFDerivWithinAt.continuousWithinAt
-#align has_mfderiv_within_at_iff_has_fderiv_within_at hasMFDerivWithinAt_iff_hasFDerivWithinAt
-
-alias ⟨HasMFDerivWithinAt.hasFDerivWithinAt, HasFDerivWithinAt.hasMFDerivWithinAt⟩ :=
-  hasMFDerivWithinAt_iff_hasFDerivWithinAt
-#align has_mfderiv_within_at.has_fderiv_within_at HasMFDerivWithinAt.hasFDerivWithinAt
-#align has_fderiv_within_at.has_mfderiv_within_at HasFDerivWithinAt.hasMFDerivWithinAt
-
-theorem hasMFDerivAt_iff_hasFDerivAt {f'} :
-    HasMFDerivAt 𝓘(𝕜, E) 𝓘(𝕜, E') f x f' ↔ HasFDerivAt f f' x := by
-  rw [← hasMFDerivWithinAt_univ, hasMFDerivWithinAt_iff_hasFDerivWithinAt, hasFDerivWithinAt_univ]
-#align has_mfderiv_at_iff_has_fderiv_at hasMFDerivAt_iff_hasFDerivAt
-
-alias ⟨HasMFDerivAt.hasFDerivAt, HasFDerivAt.hasMFDerivAt⟩ := hasMFDerivAt_iff_hasFDerivAt
-#align has_mfderiv_at.has_fderiv_at HasMFDerivAt.hasFDerivAt
-#align has_fderiv_at.has_mfderiv_at HasFDerivAt.hasMFDerivAt
-
-/-- For maps between vector spaces, `MDifferentiableWithinAt` and `DifferentiableWithinAt`
-coincide -/
-theorem mdifferentiableWithinAt_iff_differentiableWithinAt :
-    MDifferentiableWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') f s x ↔ DifferentiableWithinAt 𝕜 f s x := by
-  simp only [MDifferentiableWithinAt, mfld_simps]
-  exact ⟨fun H => H.2, fun H => ⟨H.continuousWithinAt, H⟩⟩
-#align mdifferentiable_within_at_iff_differentiable_within_at mdifferentiableWithinAt_iff_differentiableWithinAt
-
-alias ⟨MDifferentiableWithinAt.differentiableWithinAt,
-    DifferentiableWithinAt.mdifferentiableWithinAt⟩ :=
-  mdifferentiableWithinAt_iff_differentiableWithinAt
-#align mdifferentiable_within_at.differentiable_within_at MDifferentiableWithinAt.differentiableWithinAt
-#align differentiable_within_at.mdifferentiable_within_at DifferentiableWithinAt.mdifferentiableWithinAt
-
-/-- For maps between vector spaces, `MDifferentiableAt` and `DifferentiableAt` coincide -/
-theorem mdifferentiableAt_iff_differentiableAt :
-    MDifferentiableAt 𝓘(𝕜, E) 𝓘(𝕜, E') f x ↔ DifferentiableAt 𝕜 f x := by
-  simp only [MDifferentiableAt, differentiableWithinAt_univ, mfld_simps]
-  exact ⟨fun H => H.2, fun H => ⟨H.continuousAt, H⟩⟩
-#align mdifferentiable_at_iff_differentiable_at mdifferentiableAt_iff_differentiableAt
-
-alias ⟨MDifferentiableAt.differentiableAt, DifferentiableAt.mdifferentiableAt⟩ :=
-  mdifferentiableAt_iff_differentiableAt
-#align mdifferentiable_at.differentiable_at MDifferentiableAt.differentiableAt
-#align differentiable_at.mdifferentiable_at DifferentiableAt.mdifferentiableAt
-
-/-- For maps between vector spaces, `MDifferentiableOn` and `DifferentiableOn` coincide -/
-theorem mdifferentiableOn_iff_differentiableOn :
-    MDifferentiableOn 𝓘(𝕜, E) 𝓘(𝕜, E') f s ↔ DifferentiableOn 𝕜 f s := by
-  simp only [MDifferentiableOn, DifferentiableOn,
-    mdifferentiableWithinAt_iff_differentiableWithinAt]
-#align mdifferentiable_on_iff_differentiable_on mdifferentiableOn_iff_differentiableOn
-
-alias ⟨MDifferentiableOn.differentiableOn, DifferentiableOn.mdifferentiableOn⟩ :=
-  mdifferentiableOn_iff_differentiableOn
-#align mdifferentiable_on.differentiable_on MDifferentiableOn.differentiableOn
-#align differentiable_on.mdifferentiable_on DifferentiableOn.mdifferentiableOn
-
-/-- For maps between vector spaces, `MDifferentiable` and `Differentiable` coincide -/
-theorem mdifferentiable_iff_differentiable :
-    MDifferentiable 𝓘(𝕜, E) 𝓘(𝕜, E') f ↔ Differentiable 𝕜 f := by
-  simp only [MDifferentiable, Differentiable, mdifferentiableAt_iff_differentiableAt]
-#align mdifferentiable_iff_differentiable mdifferentiable_iff_differentiable
-
-alias ⟨MDifferentiable.differentiable, Differentiable.mdifferentiable⟩ :=
-  mdifferentiable_iff_differentiable
-#align mdifferentiable.differentiable MDifferentiable.differentiable
-#align differentiable.mdifferentiable Differentiable.mdifferentiable
-
-/-- For maps between vector spaces, `mfderivWithin` and `fderivWithin` coincide -/
-@[simp]
-theorem mfderivWithin_eq_fderivWithin :
-    mfderivWithin 𝓘(𝕜, E) 𝓘(𝕜, E') f s x = fderivWithin 𝕜 f s x := by
-  by_cases h : MDifferentiableWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') f s x
-  · simp only [mfderivWithin, h, if_pos, mfld_simps]
-  · simp only [mfderivWithin, h, if_neg, not_false_iff]
-    rw [mdifferentiableWithinAt_iff_differentiableWithinAt] at h
-    exact (fderivWithin_zero_of_not_differentiableWithinAt h).symm
-#align mfderiv_within_eq_fderiv_within mfderivWithin_eq_fderivWithin
-
-/-- For maps between vector spaces, `mfderiv` and `fderiv` coincide -/
-@[simp]
-theorem mfderiv_eq_fderiv : mfderiv 𝓘(𝕜, E) 𝓘(𝕜, E') f x = fderiv 𝕜 f x := by
-  rw [← mfderivWithin_univ, ← fderivWithin_univ]
-  exact mfderivWithin_eq_fderivWithin
-#align mfderiv_eq_fderiv mfderiv_eq_fderiv
-
-end MFDerivFderiv
-
-section SpecificFunctions
-
-/-! ### Differentiability of specific functions -/
-
-
-variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
-  [NormedSpace 𝕜 E] {H : Type*} [TopologicalSpace H] (I : ModelWithCorners 𝕜 E H) {M : Type*}
-  [TopologicalSpace M] [ChartedSpace H M] [SmoothManifoldWithCorners I M] {E' : Type*}
-  [NormedAddCommGroup E'] [NormedSpace 𝕜 E'] {H' : Type*} [TopologicalSpace H']
-  (I' : ModelWithCorners 𝕜 E' H') {M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M']
-  [SmoothManifoldWithCorners I' M'] {E'' : Type*} [NormedAddCommGroup E''] [NormedSpace 𝕜 E'']
-  {H'' : Type*} [TopologicalSpace H''] (I'' : ModelWithCorners 𝕜 E'' H'') {M'' : Type*}
-  [TopologicalSpace M''] [ChartedSpace H'' M''] [SmoothManifoldWithCorners I'' M'']
-
-namespace ContinuousLinearMap
-
-variable (f : E →L[𝕜] E') {s : Set E} {x : E}
-
-protected theorem hasMFDerivWithinAt : HasMFDerivWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') f s x f :=
-  f.hasFDerivWithinAt.hasMFDerivWithinAt
-#align continuous_linear_map.has_mfderiv_within_at ContinuousLinearMap.hasMFDerivWithinAt
-
-protected theorem hasMFDerivAt : HasMFDerivAt 𝓘(𝕜, E) 𝓘(𝕜, E') f x f :=
-  f.hasFDerivAt.hasMFDerivAt
-#align continuous_linear_map.has_mfderiv_at ContinuousLinearMap.hasMFDerivAt
-
-protected theorem mdifferentiableWithinAt : MDifferentiableWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') f s x :=
-  f.differentiableWithinAt.mdifferentiableWithinAt
-#align continuous_linear_map.mdifferentiable_within_at ContinuousLinearMap.mdifferentiableWithinAt
-
-protected theorem mdifferentiableOn : MDifferentiableOn 𝓘(𝕜, E) 𝓘(𝕜, E') f s :=
-  f.differentiableOn.mdifferentiableOn
-#align continuous_linear_map.mdifferentiable_on ContinuousLinearMap.mdifferentiableOn
-
-protected theorem mdifferentiableAt : MDifferentiableAt 𝓘(𝕜, E) 𝓘(𝕜, E') f x :=
-  f.differentiableAt.mdifferentiableAt
-#align continuous_linear_map.mdifferentiable_at ContinuousLinearMap.mdifferentiableAt
-
-protected theorem mdifferentiable : MDifferentiable 𝓘(𝕜, E) 𝓘(𝕜, E') f :=
-  f.differentiable.mdifferentiable
-#align continuous_linear_map.mdifferentiable ContinuousLinearMap.mdifferentiable
-
-theorem mfderiv_eq : mfderiv 𝓘(𝕜, E) 𝓘(𝕜, E') f x = f :=
-  f.hasMFDerivAt.mfderiv
-#align continuous_linear_map.mfderiv_eq ContinuousLinearMap.mfderiv_eq
-
-theorem mfderivWithin_eq (hs : UniqueMDiffWithinAt 𝓘(𝕜, E) s x) :
-    mfderivWithin 𝓘(𝕜, E) 𝓘(𝕜, E') f s x = f :=
-  f.hasMFDerivWithinAt.mfderivWithin hs
-#align continuous_linear_map.mfderiv_within_eq ContinuousLinearMap.mfderivWithin_eq
-
-end ContinuousLinearMap
-
-namespace ContinuousLinearEquiv
-
-variable (f : E ≃L[𝕜] E') {s : Set E} {x : E}
-
-protected theorem hasMFDerivWithinAt : HasMFDerivWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') f s x (f : E →L[𝕜] E') :=
-  f.hasFDerivWithinAt.hasMFDerivWithinAt
-#align continuous_linear_equiv.has_mfderiv_within_at ContinuousLinearEquiv.hasMFDerivWithinAt
-
-protected theorem hasMFDerivAt : HasMFDerivAt 𝓘(𝕜, E) 𝓘(𝕜, E') f x (f : E →L[𝕜] E') :=
-  f.hasFDerivAt.hasMFDerivAt
-#align continuous_linear_equiv.has_mfderiv_at ContinuousLinearEquiv.hasMFDerivAt
-
-protected theorem mdifferentiableWithinAt : MDifferentiableWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') f s x :=
-  f.differentiableWithinAt.mdifferentiableWithinAt
-#align continuous_linear_equiv.mdifferentiable_within_at ContinuousLinearEquiv.mdifferentiableWithinAt
-
-protected theorem mdifferentiableOn : MDifferentiableOn 𝓘(𝕜, E) 𝓘(𝕜, E') f s :=
-  f.differentiableOn.mdifferentiableOn
-#align continuous_linear_equiv.mdifferentiable_on ContinuousLinearEquiv.mdifferentiableOn
-
-protected theorem mdifferentiableAt : MDifferentiableAt 𝓘(𝕜, E) 𝓘(𝕜, E') f x :=
-  f.differentiableAt.mdifferentiableAt
-#align continuous_linear_equiv.mdifferentiable_at ContinuousLinearEquiv.mdifferentiableAt
-
-protected theorem mdifferentiable : MDifferentiable 𝓘(𝕜, E) 𝓘(𝕜, E') f :=
-  f.differentiable.mdifferentiable
-#align continuous_linear_equiv.mdifferentiable ContinuousLinearEquiv.mdifferentiable
-
-theorem mfderiv_eq : mfderiv 𝓘(𝕜, E) 𝓘(𝕜, E') f x = (f : E →L[𝕜] E') :=
-  f.hasMFDerivAt.mfderiv
-#align continuous_linear_equiv.mfderiv_eq ContinuousLinearEquiv.mfderiv_eq
-
-theorem mfderivWithin_eq (hs : UniqueMDiffWithinAt 𝓘(𝕜, E) s x) :
-    mfderivWithin 𝓘(𝕜, E) 𝓘(𝕜, E') f s x = (f : E →L[𝕜] E') :=
-  f.hasMFDerivWithinAt.mfderivWithin hs
-#align continuous_linear_equiv.mfderiv_within_eq ContinuousLinearEquiv.mfderivWithin_eq
-
-end ContinuousLinearEquiv
-
-variable {s : Set M} {x : M}
-
-section id
-
-/-! #### Identity -/
-
-theorem hasMFDerivAt_id (x : M) :
-    HasMFDerivAt I I (@id M) x (ContinuousLinearMap.id 𝕜 (TangentSpace I x)) := by
-  refine' ⟨continuousAt_id, _⟩
-  have : ∀ᶠ y in 𝓝[range I] (extChartAt I x) x, (extChartAt I x ∘ (extChartAt I x).symm) y = y
-  · apply Filter.mem_of_superset (extChartAt_target_mem_nhdsWithin I x)
-    mfld_set_tac
-  apply HasFDerivWithinAt.congr_of_eventuallyEq (hasFDerivWithinAt_id _ _) this
-  simp only [mfld_simps]
-#align has_mfderiv_at_id hasMFDerivAt_id
-
-theorem hasMFDerivWithinAt_id (s : Set M) (x : M) :
-    HasMFDerivWithinAt I I (@id M) s x (ContinuousLinearMap.id 𝕜 (TangentSpace I x)) :=
-  (hasMFDerivAt_id I x).hasMFDerivWithinAt
-#align has_mfderiv_within_at_id hasMFDerivWithinAt_id
-
-theorem mdifferentiableAt_id : MDifferentiableAt I I (@id M) x :=
-  (hasMFDerivAt_id I x).mdifferentiableAt
-#align mdifferentiable_at_id mdifferentiableAt_id
-
-theorem mdifferentiableWithinAt_id : MDifferentiableWithinAt I I (@id M) s x :=
-  (mdifferentiableAt_id I).mdifferentiableWithinAt
-#align mdifferentiable_within_at_id mdifferentiableWithinAt_id
-
-theorem mdifferentiable_id : MDifferentiable I I (@id M) := fun _ => mdifferentiableAt_id I
-#align mdifferentiable_id mdifferentiable_id
-
-theorem mdifferentiableOn_id : MDifferentiableOn I I (@id M) s :=
-  (mdifferentiable_id I).mdifferentiableOn
-#align mdifferentiable_on_id mdifferentiableOn_id
-
-@[simp, mfld_simps]
-theorem mfderiv_id : mfderiv I I (@id M) x = ContinuousLinearMap.id 𝕜 (TangentSpace I x) :=
-  HasMFDerivAt.mfderiv (hasMFDerivAt_id I x)
-#align mfderiv_id mfderiv_id
-
-theorem mfderivWithin_id (hxs : UniqueMDiffWithinAt I s x) :
-    mfderivWithin I I (@id M) s x = ContinuousLinearMap.id 𝕜 (TangentSpace I x) := by
-  rw [MDifferentiable.mfderivWithin (mdifferentiableAt_id I) hxs]
-  exact mfderiv_id I
-#align mfderiv_within_id mfderivWithin_id
-
-@[simp, mfld_simps]
-theorem tangentMap_id : tangentMap I I (id : M → M) = id := by ext1 ⟨x, v⟩; simp [tangentMap]
-#align tangent_map_id tangentMap_id
-
-theorem tangentMapWithin_id {p : TangentBundle I M} (hs : UniqueMDiffWithinAt I s p.proj) :
-    tangentMapWithin I I (id : M → M) s p = p := by
-  simp only [tangentMapWithin, id.def]
-  rw [mfderivWithin_id]
-  · rcases p with ⟨⟩; rfl
-  · exact hs
-#align tangent_map_within_id tangentMapWithin_id
-
-end id
-
-section Const
-
-/-! #### Constants -/
-
-
-variable {c : M'}
-
-theorem hasMFDerivAt_const (c : M') (x : M) :
-    HasMFDerivAt I I' (fun _ : M => c) x (0 : TangentSpace I x →L[𝕜] TangentSpace I' c) := by
-  refine' ⟨continuous_const.continuousAt, _⟩
-  simp only [writtenInExtChartAt, (· ∘ ·), hasFDerivWithinAt_const]
-#align has_mfderiv_at_const hasMFDerivAt_const
-
-theorem hasMFDerivWithinAt_const (c : M') (s : Set M) (x : M) :
-    HasMFDerivWithinAt I I' (fun _ : M => c) s x (0 : TangentSpace I x →L[𝕜] TangentSpace I' c) :=
-  (hasMFDerivAt_const I I' c x).hasMFDerivWithinAt
-#align has_mfderiv_within_at_const hasMFDerivWithinAt_const
-
-theorem mdifferentiableAt_const : MDifferentiableAt I I' (fun _ : M => c) x :=
-  (hasMFDerivAt_const I I' c x).mdifferentiableAt
-#align mdifferentiable_at_const mdifferentiableAt_const
-
-theorem mdifferentiableWithinAt_const : MDifferentiableWithinAt I I' (fun _ : M => c) s x :=
-  (mdifferentiableAt_const I I').mdifferentiableWithinAt
-#align mdifferentiable_within_at_const mdifferentiableWithinAt_const
-
-theorem mdifferentiable_const : MDifferentiable I I' fun _ : M => c := fun _ =>
-  mdifferentiableAt_const I I'
-#align mdifferentiable_const mdifferentiable_const
-
-theorem mdifferentiableOn_const : MDifferentiableOn I I' (fun _ : M => c) s :=
-  (mdifferentiable_const I I').mdifferentiableOn
-#align mdifferentiable_on_const mdifferentiableOn_const
-
-@[simp, mfld_simps]
-theorem mfderiv_const :
-    mfderiv I I' (fun _ : M => c) x = (0 : TangentSpace I x →L[𝕜] TangentSpace I' c) :=
-  HasMFDerivAt.mfderiv (hasMFDerivAt_const I I' c x)
-#align mfderiv_const mfderiv_const
-
-theorem mfderivWithin_const (hxs : UniqueMDiffWithinAt I s x) :
-    mfderivWithin I I' (fun _ : M => c) s x = (0 : TangentSpace I x →L[𝕜] TangentSpace I' c) :=
-  (hasMFDerivWithinAt_const _ _ _ _ _).mfderivWithin hxs
-#align mfderiv_within_const mfderivWithin_const
-
-end Const
-
-section Prod
-
-/-! ### Operations on the product of two manifolds -/
-
-theorem hasMFDerivAt_fst (x : M × M') :
-    HasMFDerivAt (I.prod I') I Prod.fst x
-      (ContinuousLinearMap.fst 𝕜 (TangentSpace I x.1) (TangentSpace I' x.2)) := by
-  refine' ⟨continuous_fst.continuousAt, _⟩
-  have :
-    ∀ᶠ y in 𝓝[range (I.prod I')] extChartAt (I.prod I') x x,
-      (extChartAt I x.1 ∘ Prod.fst ∘ (extChartAt (I.prod I') x).symm) y = y.1 := by
-    /- porting note: was
-    apply Filter.mem_of_superset (extChartAt_target_mem_nhdsWithin (I.prod I') x)
-    mfld_set_tac
-    -/
-    filter_upwards [extChartAt_target_mem_nhdsWithin (I.prod I') x] with y hy
-    rw [extChartAt_prod] at hy
-    exact (extChartAt I x.1).right_inv hy.1
-  apply HasFDerivWithinAt.congr_of_eventuallyEq hasFDerivWithinAt_fst this
-  -- porting note: next line was `simp only [mfld_simps]`
-  exact (extChartAt I x.1).right_inv <| (extChartAt I x.1).map_source (mem_extChartAt_source _ _)
-#align has_mfderiv_at_fst hasMFDerivAt_fst
-
-theorem hasMFDerivWithinAt_fst (s : Set (M × M')) (x : M × M') :
-    HasMFDerivWithinAt (I.prod I') I Prod.fst s x
-      (ContinuousLinearMap.fst 𝕜 (TangentSpace I x.1) (TangentSpace I' x.2)) :=
-  (hasMFDerivAt_fst I I' x).hasMFDerivWithinAt
-#align has_mfderiv_within_at_fst hasMFDerivWithinAt_fst
-
-theorem mdifferentiableAt_fst {x : M × M'} : MDifferentiableAt (I.prod I') I Prod.fst x :=
-  (hasMFDerivAt_fst I I' x).mdifferentiableAt
-#align mdifferentiable_at_fst mdifferentiableAt_fst
-
-theorem mdifferentiableWithinAt_fst {s : Set (M × M')} {x : M × M'} :
-    MDifferentiableWithinAt (I.prod I') I Prod.fst s x :=
-  (mdifferentiableAt_fst I I').mdifferentiableWithinAt
-#align mdifferentiable_within_at_fst mdifferentiableWithinAt_fst
-
-theorem mdifferentiable_fst : MDifferentiable (I.prod I') I (Prod.fst : M × M' → M) := fun _ =>
-  mdifferentiableAt_fst I I'
-#align mdifferentiable_fst mdifferentiable_fst
-
-theorem mdifferentiableOn_fst {s : Set (M × M')} : MDifferentiableOn (I.prod I') I Prod.fst s :=
-  (mdifferentiable_fst I I').mdifferentiableOn
-#align mdifferentiable_on_fst mdifferentiableOn_fst
-
-@[simp, mfld_simps]
-theorem mfderiv_fst {x : M × M'} :
-    mfderiv (I.prod I') I Prod.fst x =
-      ContinuousLinearMap.fst 𝕜 (TangentSpace I x.1) (TangentSpace I' x.2) :=
-  (hasMFDerivAt_fst I I' x).mfderiv
-#align mfderiv_fst mfderiv_fst
-
-theorem mfderivWithin_fst {s : Set (M × M')} {x : M × M'}
-    (hxs : UniqueMDiffWithinAt (I.prod I') s x) :
-    mfderivWithin (I.prod I') I Prod.fst s x =
-      ContinuousLinearMap.fst 𝕜 (TangentSpace I x.1) (TangentSpace I' x.2) :=
-  by rw [MDifferentiable.mfderivWithin (mdifferentiableAt_fst I I') hxs]; exact mfderiv_fst I I'
-#align mfderiv_within_fst mfderivWithin_fst
-
-@[simp, mfld_simps]
-theorem tangentMap_prod_fst {p : TangentBundle (I.prod I') (M × M')} :
-    tangentMap (I.prod I') I Prod.fst p = ⟨p.proj.1, p.2.1⟩ := by
-  -- porting note: `rfl` wasn't needed
-  simp [tangentMap]; rfl
-#align tangent_map_prod_fst tangentMap_prod_fst
-
-theorem tangentMapWithin_prod_fst {s : Set (M × M')} {p : TangentBundle (I.prod I') (M × M')}
-    (hs : UniqueMDiffWithinAt (I.prod I') s p.proj) :
-    tangentMapWithin (I.prod I') I Prod.fst s p = ⟨p.proj.1, p.2.1⟩ := by
-  simp only [tangentMapWithin]
-  rw [mfderivWithin_fst]
-  · rcases p with ⟨⟩; rfl
-  · exact hs
-#align tangent_map_within_prod_fst tangentMapWithin_prod_fst
-
-theorem hasMFDerivAt_snd (x : M × M') :
-    HasMFDerivAt (I.prod I') I' Prod.snd x
-      (ContinuousLinearMap.snd 𝕜 (TangentSpace I x.1) (TangentSpace I' x.2)) := by
-  refine' ⟨continuous_snd.continuousAt, _⟩
-  have :
-    ∀ᶠ y in 𝓝[range (I.prod I')] extChartAt (I.prod I') x x,
-      (extChartAt I' x.2 ∘ Prod.snd ∘ (extChartAt (I.prod I') x).symm) y = y.2 := by
-    /- porting note: was
-    apply Filter.mem_of_superset (extChartAt_target_mem_nhdsWithin (I.prod I') x)
-    mfld_set_tac
-    -/
-    filter_upwards [extChartAt_target_mem_nhdsWithin (I.prod I') x] with y hy
-    rw [extChartAt_prod] at hy
-    exact (extChartAt I' x.2).right_inv hy.2
-  apply HasFDerivWithinAt.congr_of_eventuallyEq hasFDerivWithinAt_snd this
-  -- porting note: the next line was `simp only [mfld_simps]`
-  exact (extChartAt I' x.2).right_inv <| (extChartAt I' x.2).map_source (mem_extChartAt_source _ _)
-#align has_mfderiv_at_snd hasMFDerivAt_snd
-
-theorem hasMFDerivWithinAt_snd (s : Set (M × M')) (x : M × M') :
-    HasMFDerivWithinAt (I.prod I') I' Prod.snd s x
-      (ContinuousLinearMap.snd 𝕜 (TangentSpace I x.1) (TangentSpace I' x.2)) :=
-  (hasMFDerivAt_snd I I' x).hasMFDerivWithinAt
-#align has_mfderiv_within_at_snd hasMFDerivWithinAt_snd
-
-theorem mdifferentiableAt_snd {x : M × M'} : MDifferentiableAt (I.prod I') I' Prod.snd x :=
-  (hasMFDerivAt_snd I I' x).mdifferentiableAt
-#align mdifferentiable_at_snd mdifferentiableAt_snd
-
-theorem mdifferentiableWithinAt_snd {s : Set (M × M')} {x : M × M'} :
-    MDifferentiableWithinAt (I.prod I') I' Prod.snd s x :=
-  (mdifferentiableAt_snd I I').mdifferentiableWithinAt
-#align mdifferentiable_within_at_snd mdifferentiableWithinAt_snd
-
-theorem mdifferentiable_snd : MDifferentiable (I.prod I') I' (Prod.snd : M × M' → M') := fun _ =>
-  mdifferentiableAt_snd I I'
-#align mdifferentiable_snd mdifferentiable_snd
-
-theorem mdifferentiableOn_snd {s : Set (M × M')} : MDifferentiableOn (I.prod I') I' Prod.snd s :=
-  (mdifferentiable_snd I I').mdifferentiableOn
-#align mdifferentiable_on_snd mdifferentiableOn_snd
-
-@[simp, mfld_simps]
-theorem mfderiv_snd {x : M × M'} :
-    mfderiv (I.prod I') I' Prod.snd x =
-      ContinuousLinearMap.snd 𝕜 (TangentSpace I x.1) (TangentSpace I' x.2) :=
-  (hasMFDerivAt_snd I I' x).mfderiv
-#align mfderiv_snd mfderiv_snd
-
-theorem mfderivWithin_snd {s : Set (M × M')} {x : M × M'}
-    (hxs : UniqueMDiffWithinAt (I.prod I') s x) :
-    mfderivWithin (I.prod I') I' Prod.snd s x =
-      ContinuousLinearMap.snd 𝕜 (TangentSpace I x.1) (TangentSpace I' x.2) :=
-  by rw [MDifferentiable.mfderivWithin (mdifferentiableAt_snd I I') hxs]; exact mfderiv_snd I I'
-#align mfderiv_within_snd mfderivWithin_snd
-
-@[simp, mfld_simps]
-theorem tangentMap_prod_snd {p : TangentBundle (I.prod I') (M × M')} :
-    tangentMap (I.prod I') I' Prod.snd p = ⟨p.proj.2, p.2.2⟩ := by
-  -- porting note: `rfl` wasn't needed
-  simp [tangentMap]; rfl
-#align tangent_map_prod_snd tangentMap_prod_snd
-
-theorem tangentMapWithin_prod_snd {s : Set (M × M')} {p : TangentBundle (I.prod I') (M × M')}
-    (hs : UniqueMDiffWithinAt (I.prod I') s p.proj) :
-    tangentMapWithin (I.prod I') I' Prod.snd s p = ⟨p.proj.2, p.2.2⟩ := by
-  simp only [tangentMapWithin]
-  rw [mfderivWithin_snd]
-  · rcases p with ⟨⟩; rfl
-  · exact hs
-#align tangent_map_within_prod_snd tangentMapWithin_prod_snd
-
-variable {I I' I''}
-
-theorem MDifferentiableAt.mfderiv_prod {f : M → M'} {g : M → M''} {x : M}
-    (hf : MDifferentiableAt I I' f x) (hg : MDifferentiableAt I I'' g x) :
-    mfderiv I (I'.prod I'') (fun x => (f x, g x)) x =
-      (mfderiv I I' f x).prod (mfderiv I I'' g x) := by
-  classical
-  simp_rw [mfderiv, if_pos (hf.prod_mk hg), if_pos hf, if_pos hg]
-  exact hf.2.fderivWithin_prod hg.2 (I.unique_diff _ (mem_range_self _))
-#align mdifferentiable_at.mfderiv_prod MDifferentiableAt.mfderiv_prod
-
-variable (I I' I'')
-
-theorem mfderiv_prod_left {x₀ : M} {y₀ : M'} :
-    mfderiv I (I.prod I') (fun x => (x, y₀)) x₀ =
-      ContinuousLinearMap.inl 𝕜 (TangentSpace I x₀) (TangentSpace I' y₀) := by
-  refine' ((mdifferentiableAt_id I).mfderiv_prod (mdifferentiableAt_const I I')).trans _
-  rw [mfderiv_id, mfderiv_const, ContinuousLinearMap.inl]
-#align mfderiv_prod_left mfderiv_prod_left
-
-theorem mfderiv_prod_right {x₀ : M} {y₀ : M'} :
-    mfderiv I' (I.prod I') (fun y => (x₀, y)) y₀ =
-      ContinuousLinearMap.inr 𝕜 (TangentSpace I x₀) (TangentSpace I' y₀) := by
-  refine' ((mdifferentiableAt_const I' I).mfderiv_prod (mdifferentiableAt_id I')).trans _
-  rw [mfderiv_id, mfderiv_const, ContinuousLinearMap.inr]
-#align mfderiv_prod_right mfderiv_prod_right
-
-/-- The total derivative of a function in two variables is the sum of the partial derivatives.
-  Note that to state this (without casts) we need to be able to see through the definition of
-  `TangentSpace`. -/
-theorem mfderiv_prod_eq_add {f : M × M' → M''} {p : M × M'}
-    (hf : MDifferentiableAt (I.prod I') I'' f p) :
-    mfderiv (I.prod I') I'' f p =
-      show E × E' →L[𝕜] E'' from
-        mfderiv (I.prod I') I'' (fun z : M × M' => f (z.1, p.2)) p +
-          mfderiv (I.prod I') I'' (fun z : M × M' => f (p.1, z.2)) p := by
-  dsimp only
-  erw [mfderiv_comp_of_eq hf ((mdifferentiableAt_fst I I').prod_mk (mdifferentiableAt_const _ _))
-      rfl,
-    mfderiv_comp_of_eq hf ((mdifferentiableAt_const _ _).prod_mk (mdifferentiableAt_snd I I')) rfl,
-    ← ContinuousLinearMap.comp_add,
-    (mdifferentiableAt_fst I I').mfderiv_prod (mdifferentiableAt_const (I.prod I') I'),
-    (mdifferentiableAt_const (I.prod I') I).mfderiv_prod (mdifferentiableAt_snd I I'), mfderiv_fst,
-    mfderiv_snd, mfderiv_const, mfderiv_const]
-  symm
-  convert ContinuousLinearMap.comp_id <| mfderiv (.prod I I') I'' f (p.1, p.2)
-  · exact ContinuousLinearMap.coprod_inl_inr
-#align mfderiv_prod_eq_add mfderiv_prod_eq_add
-
-end Prod
-
-section Arithmetic
-
-/-! #### Arithmetic
-
-Note that in the `HasMFDerivAt` lemmas there is an abuse of the defeq between `E'` and
-`TangentSpace 𝓘(𝕜, E') (f z)` (similarly for `g',F',p',q'`). In general this defeq is not
-canonical, but in this case (the tangent space of a vector space) it is canonical.
- -/
-
-section Group
-
-variable {I} {z : M} {f g : M → E'} {f' g' : TangentSpace I z →L[𝕜] E'}
-
-theorem HasMFDerivAt.add (hf : HasMFDerivAt I 𝓘(𝕜, E') f z f')
-    (hg : HasMFDerivAt I 𝓘(𝕜, E') g z g') : HasMFDerivAt I 𝓘(𝕜, E') (f + g) z (f' + g') :=
-  ⟨hf.1.add hg.1, hf.2.add hg.2⟩
-#align has_mfderiv_at.add HasMFDerivAt.add
-
-theorem MDifferentiableAt.add (hf : MDifferentiableAt I 𝓘(𝕜, E') f z)
-    (hg : MDifferentiableAt I 𝓘(𝕜, E') g z) : MDifferentiableAt I 𝓘(𝕜, E') (f + g) z :=
-  (hf.hasMFDerivAt.add hg.hasMFDerivAt).mdifferentiableAt
-#align mdifferentiable_at.add MDifferentiableAt.add
-
-theorem MDifferentiable.add (hf : MDifferentiable I 𝓘(𝕜, E') f)
-    (hg : MDifferentiable I 𝓘(𝕜, E') g) : MDifferentiable I 𝓘(𝕜, E') (f + g) := fun x =>
-  (hf x).add (hg x)
-#align mdifferentiable.add MDifferentiable.add
-
--- porting note: forcing types using `by exact`
-theorem mfderiv_add (hf : MDifferentiableAt I 𝓘(𝕜, E') f z)
-    (hg : MDifferentiableAt I 𝓘(𝕜, E') g z) :
-    (by exact mfderiv I 𝓘(𝕜, E') (f + g) z : TangentSpace I z →L[𝕜] E') =
-      (by exact mfderiv I 𝓘(𝕜, E') f z) + (by exact mfderiv I 𝓘(𝕜, E') g z) :=
-  (hf.hasMFDerivAt.add hg.hasMFDerivAt).mfderiv
-#align mfderiv_add mfderiv_add
-
-theorem HasMFDerivAt.const_smul (hf : HasMFDerivAt I 𝓘(𝕜, E') f z f') (s : 𝕜) :
-    HasMFDerivAt I 𝓘(𝕜, E') (s • f) z (s • f') :=
-  ⟨hf.1.const_smul s, hf.2.const_smul s⟩
-#align has_mfderiv_at.const_smul HasMFDerivAt.const_smul
-
-theorem MDifferentiableAt.const_smul (hf : MDifferentiableAt I 𝓘(𝕜, E') f z) (s : 𝕜) :
-    MDifferentiableAt I 𝓘(𝕜, E') (s • f) z :=
-  (hf.hasMFDerivAt.const_smul s).mdifferentiableAt
-#align mdifferentiable_at.const_smul MDifferentiableAt.const_smul
-
-theorem MDifferentiable.const_smul (s : 𝕜) (hf : MDifferentiable I 𝓘(𝕜, E') f) :
-    MDifferentiable I 𝓘(𝕜, E') (s • f) := fun x => (hf x).const_smul s
-#align mdifferentiable.const_smul MDifferentiable.const_smul
-
-theorem const_smul_mfderiv (hf : MDifferentiableAt I 𝓘(𝕜, E') f z) (s : 𝕜) :
-    (mfderiv I 𝓘(𝕜, E') (s • f) z : TangentSpace I z →L[𝕜] E') =
-      (s • mfderiv I 𝓘(𝕜, E') f z : TangentSpace I z →L[𝕜] E') :=
-  (hf.hasMFDerivAt.const_smul s).mfderiv
-#align const_smul_mfderiv const_smul_mfderiv
-
-theorem HasMFDerivAt.neg (hf : HasMFDerivAt I 𝓘(𝕜, E') f z f') :
-    HasMFDerivAt I 𝓘(𝕜, E') (-f) z (-f') :=
-  ⟨hf.1.neg, hf.2.neg⟩
-#align has_mfderiv_at.neg HasMFDerivAt.neg
-
-theorem hasMFDerivAt_neg : HasMFDerivAt I 𝓘(𝕜, E') (-f) z (-f') ↔ HasMFDerivAt I 𝓘(𝕜, E') f z f' :=
-  ⟨fun hf => by convert hf.neg <;> rw [neg_neg], fun hf => hf.neg⟩
-#align has_mfderiv_at_neg hasMFDerivAt_neg
-
-theorem MDifferentiableAt.neg (hf : MDifferentiableAt I 𝓘(𝕜, E') f z) :
-    MDifferentiableAt I 𝓘(𝕜, E') (-f) z :=
-  hf.hasMFDerivAt.neg.mdifferentiableAt
-#align mdifferentiable_at.neg MDifferentiableAt.neg
-
-theorem mdifferentiableAt_neg :
-    MDifferentiableAt I 𝓘(𝕜, E') (-f) z ↔ MDifferentiableAt I 𝓘(𝕜, E') f z :=
-  ⟨fun hf => by convert hf.neg; rw [neg_neg], fun hf => hf.neg⟩
-#align mdifferentiable_at_neg mdifferentiableAt_neg
-
-theorem MDifferentiable.neg (hf : MDifferentiable I 𝓘(𝕜, E') f) : MDifferentiable I 𝓘(𝕜, E') (-f) :=
-  fun x => (hf x).neg
-#align mdifferentiable.neg MDifferentiable.neg
-
-theorem mfderiv_neg (f : M → E') (x : M) :
-    (mfderiv I 𝓘(𝕜, E') (-f) x : TangentSpace I x →L[𝕜] E') =
-      (-mfderiv I 𝓘(𝕜, E') f x : TangentSpace I x →L[𝕜] E') := by
-  simp_rw [mfderiv]
-  by_cases hf : MDifferentiableAt I 𝓘(𝕜, E') f x
-  · exact hf.hasMFDerivAt.neg.mfderiv
-  · rw [if_neg hf]; rw [← mdifferentiableAt_neg] at hf; rw [if_neg hf, neg_zero]
-#align mfderiv_neg mfderiv_neg
-
-theorem HasMFDerivAt.sub (hf : HasMFDerivAt I 𝓘(𝕜, E') f z f')
-    (hg : HasMFDerivAt I 𝓘(𝕜, E') g z g') : HasMFDerivAt I 𝓘(𝕜, E') (f - g) z (f' - g') :=
-  ⟨hf.1.sub hg.1, hf.2.sub hg.2⟩
-#align has_mfderiv_at.sub HasMFDerivAt.sub
-
-theorem MDifferentiableAt.sub (hf : MDifferentiableAt I 𝓘(𝕜, E') f z)
-    (hg : MDifferentiableAt I 𝓘(𝕜, E') g z) : MDifferentiableAt I 𝓘(𝕜, E') (f - g) z :=
-  (hf.hasMFDerivAt.sub hg.hasMFDerivAt).mdifferentiableAt
-#align mdifferentiable_at.sub MDifferentiableAt.sub
-
-theorem MDifferentiable.sub (hf : MDifferentiable I 𝓘(𝕜, E') f)
-    (hg : MDifferentiable I 𝓘(𝕜, E') g) : MDifferentiable I 𝓘(𝕜, E') (f - g) := fun x =>
-  (hf x).sub (hg x)
-#align mdifferentiable.sub MDifferentiable.sub
-
-theorem mfderiv_sub (hf : MDifferentiableAt I 𝓘(𝕜, E') f z)
-    (hg : MDifferentiableAt I 𝓘(𝕜, E') g z) :
-    (by exact mfderiv I 𝓘(𝕜, E') (f - g) z : TangentSpace I z →L[𝕜] E') =
-      (by exact mfderiv I 𝓘(𝕜, E') f z) - (by exact mfderiv I 𝓘(𝕜, E') g z) :=
-  (hf.hasMFDerivAt.sub hg.hasMFDerivAt).mfderiv
-#align mfderiv_sub mfderiv_sub
-
-end Group
-
-section AlgebraOverRing
-
-variable {I} {z : M} {F' : Type*} [NormedRing F'] [NormedAlgebra 𝕜 F'] {p q : M → F'}
-  {p' q' : TangentSpace I z →L[𝕜] F'}
-
-theorem HasMFDerivWithinAt.mul' (hp : HasMFDerivWithinAt I 𝓘(𝕜, F') p s z p')
-    (hq : HasMFDerivWithinAt I 𝓘(𝕜, F') q s z q') :
-    HasMFDerivWithinAt I 𝓘(𝕜, F') (p * q) s z (p z • q' + p'.smulRight (q z) : E →L[𝕜] F') :=
-  ⟨hp.1.mul hq.1, by simpa only [mfld_simps] using hp.2.mul' hq.2⟩
-#align has_mfderiv_within_at.mul' HasMFDerivWithinAt.mul'
-
-theorem HasMFDerivAt.mul' (hp : HasMFDerivAt I 𝓘(𝕜, F') p z p')
-    (hq : HasMFDerivAt I 𝓘(𝕜, F') q z q') :
-    HasMFDerivAt I 𝓘(𝕜, F') (p * q) z (p z • q' + p'.smulRight (q z) : E →L[𝕜] F') :=
-  hasMFDerivWithinAt_univ.mp <| hp.hasMFDerivWithinAt.mul' hq.hasMFDerivWithinAt
-#align has_mfderiv_at.mul' HasMFDerivAt.mul'
-
-theorem MDifferentiableWithinAt.mul (hp : MDifferentiableWithinAt I 𝓘(𝕜, F') p s z)
-    (hq : MDifferentiableWithinAt I 𝓘(𝕜, F') q s z) :
-    MDifferentiableWithinAt I 𝓘(𝕜, F') (p * q) s z :=
-  (hp.hasMFDerivWithinAt.mul' hq.hasMFDerivWithinAt).mdifferentiableWithinAt
-#align mdifferentiable_within_at.mul MDifferentiableWithinAt.mul
-
-theorem MDifferentiableAt.mul (hp : MDifferentiableAt I 𝓘(𝕜, F') p z)
-    (hq : MDifferentiableAt I 𝓘(𝕜, F') q z) : MDifferentiableAt I 𝓘(𝕜, F') (p * q) z :=
-  (hp.hasMFDerivAt.mul' hq.hasMFDerivAt).mdifferentiableAt
-#align mdifferentiable_at.mul MDifferentiableAt.mul
-
-theorem MDifferentiableOn.mul (hp : MDifferentiableOn I 𝓘(𝕜, F') p s)
-    (hq : MDifferentiableOn I 𝓘(𝕜, F') q s) : MDifferentiableOn I 𝓘(𝕜, F') (p * q) s := fun x hx =>
-  (hp x hx).mul <| hq x hx
-#align mdifferentiable_on.mul MDifferentiableOn.mul
-
-theorem MDifferentiable.mul (hp : MDifferentiable I 𝓘(𝕜, F') p)
-    (hq : MDifferentiable I 𝓘(𝕜, F') q) : MDifferentiable I 𝓘(𝕜, F') (p * q) := fun x =>
-  (hp x).mul (hq x)
-#align mdifferentiable.mul MDifferentiable.mul
-
-end AlgebraOverRing
-
-section AlgebraOverCommRing
-
-variable {I} {z : M} {F' : Type*} [NormedCommRing F'] [NormedAlgebra 𝕜 F'] {p q : M → F'}
-  {p' q' : TangentSpace I z →L[𝕜] F'}
-
-theorem HasMFDerivWithinAt.mul (hp : HasMFDerivWithinAt I 𝓘(𝕜, F') p s z p')
-    (hq : HasMFDerivWithinAt I 𝓘(𝕜, F') q s z q') :
-    HasMFDerivWithinAt I 𝓘(𝕜, F') (p * q) s z (p z • q' + q z • p' : E →L[𝕜] F') := by
-  convert hp.mul' hq; ext _; apply mul_comm
-#align has_mfderiv_within_at.mul HasMFDerivWithinAt.mul
-
-theorem HasMFDerivAt.mul (hp : HasMFDerivAt I 𝓘(𝕜, F') p z p')
-    (hq : HasMFDerivAt I 𝓘(𝕜, F') q z q') :
-    HasMFDerivAt I 𝓘(𝕜, F') (p * q) z (p z • q' + q z • p' : E →L[𝕜] F') :=
-  hasMFDerivWithinAt_univ.mp <| hp.hasMFDerivWithinAt.mul hq.hasMFDerivWithinAt
-#align has_mfderiv_at.mul HasMFDerivAt.mul
-
-end AlgebraOverCommRing
-
-end Arithmetic
-
-namespace ModelWithCorners
-
-/-! #### Model with corners -/
-
-
-protected theorem hasMFDerivAt {x} : HasMFDerivAt I 𝓘(𝕜, E) I x (ContinuousLinearMap.id _ _) :=
-  ⟨I.continuousAt, (hasFDerivWithinAt_id _ _).congr' I.rightInvOn (mem_range_self _)⟩
-#align model_with_corners.has_mfderiv_at ModelWithCorners.hasMFDerivAt
-
-protected theorem hasMFDerivWithinAt {s x} :
-    HasMFDerivWithinAt I 𝓘(𝕜, E) I s x (ContinuousLinearMap.id _ _) :=
-  I.hasMFDerivAt.hasMFDerivWithinAt
-#align model_with_corners.has_mfderiv_within_at ModelWithCorners.hasMFDerivWithinAt
-
-protected theorem mdifferentiableWithinAt {s x} : MDifferentiableWithinAt I 𝓘(𝕜, E) I s x :=
-  I.hasMFDerivWithinAt.mdifferentiableWithinAt
-#align model_with_corners.mdifferentiable_within_at ModelWithCorners.mdifferentiableWithinAt
-
-protected theorem mdifferentiableAt {x} : MDifferentiableAt I 𝓘(𝕜, E) I x :=
-  I.hasMFDerivAt.mdifferentiableAt
-#align model_with_corners.mdifferentiable_at ModelWithCorners.mdifferentiableAt
-
-protected theorem mdifferentiableOn {s} : MDifferentiableOn I 𝓘(𝕜, E) I s := fun _ _ =>
-  I.mdifferentiableWithinAt
-#align model_with_corners.mdifferentiable_on ModelWithCorners.mdifferentiableOn
-
-protected theorem mdifferentiable : MDifferentiable I 𝓘(𝕜, E) I := fun _ => I.mdifferentiableAt
-#align model_with_corners.mdifferentiable ModelWithCorners.mdifferentiable
-
-theorem hasMFDerivWithinAt_symm {x} (hx : x ∈ range I) :
-    HasMFDerivWithinAt 𝓘(𝕜, E) I I.symm (range I) x (ContinuousLinearMap.id _ _) :=
-  ⟨I.continuousWithinAt_symm,
-    (hasFDerivWithinAt_id _ _).congr' (fun _y hy => I.rightInvOn hy.1) ⟨hx, mem_range_self _⟩⟩
-#align model_with_corners.has_mfderiv_within_at_symm ModelWithCorners.hasMFDerivWithinAt_symm
-
-theorem mdifferentiableOn_symm : MDifferentiableOn 𝓘(𝕜, E) I I.symm (range I) := fun _x hx =>
-  (I.hasMFDerivWithinAt_symm hx).mdifferentiableWithinAt
-#align model_with_corners.mdifferentiable_on_symm ModelWithCorners.mdifferentiableOn_symm
-
-end ModelWithCorners
-
-section Charts
-
-variable {e : PartialHomeomorph M H}
-
-theorem mdifferentiableAt_atlas (h : e ∈ atlas H M) {x : M} (hx : x ∈ e.source) :
-    MDifferentiableAt I I e x := by
-  refine' ⟨(e.continuousOn x hx).continuousAt (IsOpen.mem_nhds e.open_source hx), _⟩
-  have mem :
-    I ((chartAt H x : M → H) x) ∈ I.symm ⁻¹' ((chartAt H x).symm ≫ₕ e).source ∩ range I := by
-    simp only [hx, mfld_simps]
-  have : (chartAt H x).symm.trans e ∈ contDiffGroupoid ∞ I :=
-    HasGroupoid.compatible (chart_mem_atlas H x) h
-  have A :
-    ContDiffOn 𝕜 ∞ (I ∘ (chartAt H x).symm.trans e ∘ I.symm)
-      (I.symm ⁻¹' ((chartAt H x).symm.trans e).source ∩ range I) :=
-    this.1
-  have B := A.differentiableOn le_top (I ((chartAt H x : M → H) x)) mem
-  simp only [mfld_simps] at B
-  rw [inter_comm, differentiableWithinAt_inter] at B
-  · simpa only [mfld_simps]
-  · apply IsOpen.mem_nhds ((PartialHomeomorph.open_source _).preimage I.continuous_symm) mem.1
-#align mdifferentiable_at_atlas mdifferentiableAt_atlas
-
-theorem mdifferentiableOn_atlas (h : e ∈ atlas H M) : MDifferentiableOn I I e e.source :=
-  fun _x hx => (mdifferentiableAt_atlas I h hx).mdifferentiableWithinAt
-#align mdifferentiable_on_atlas mdifferentiableOn_atlas
-
-theorem mdifferentiableAt_atlas_symm (h : e ∈ atlas H M) {x : H} (hx : x ∈ e.target) :
-    MDifferentiableAt I I e.symm x := by
-  refine' ⟨(e.continuousOn_symm x hx).continuousAt (IsOpen.mem_nhds e.open_target hx), _⟩
-  have mem : I x ∈ I.symm ⁻¹' (e.symm ≫ₕ chartAt H (e.symm x)).source ∩ range I := by
-    simp only [hx, mfld_simps]
-  have : e.symm.trans (chartAt H (e.symm x)) ∈ contDiffGroupoid ∞ I :=
-    HasGroupoid.compatible h (chart_mem_atlas H _)
-  have A :
-    ContDiffOn 𝕜 ∞ (I ∘ e.symm.trans (chartAt H (e.symm x)) ∘ I.symm)
-      (I.symm ⁻¹' (e.symm.trans (chartAt H (e.symm x))).source ∩ range I) :=
-    this.1
-  have B := A.differentiableOn le_top (I x) mem
-  simp only [mfld_simps] at B
-  rw [inter_comm, differentiableWithinAt_inter] at B
-  · simpa only [mfld_simps]
-  · apply IsOpen.mem_nhds ((PartialHomeomorph.open_source _).preimage I.continuous_symm) mem.1
-#align mdifferentiable_at_atlas_symm mdifferentiableAt_atlas_symm
-
-theorem mdifferentiableOn_atlas_symm (h : e ∈ atlas H M) : MDifferentiableOn I I e.symm e.target :=
-  fun _x hx => (mdifferentiableAt_atlas_symm I h hx).mdifferentiableWithinAt
-#align mdifferentiable_on_atlas_symm mdifferentiableOn_atlas_symm
-
-theorem mdifferentiable_of_mem_atlas (h : e ∈ atlas H M) : e.MDifferentiable I I :=
-  ⟨mdifferentiableOn_atlas I h, mdifferentiableOn_atlas_symm I h⟩
-#align mdifferentiable_of_mem_atlas mdifferentiable_of_mem_atlas
-
-theorem mdifferentiable_chart (x : M) : (chartAt H x).MDifferentiable I I :=
-  mdifferentiable_of_mem_atlas _ (chart_mem_atlas _ _)
-#align mdifferentiable_chart mdifferentiable_chart
-
-/-- The derivative of the chart at a base point is the chart of the tangent bundle, composed with
-the identification between the tangent bundle of the model space and the product space. -/
-theorem tangentMap_chart {p q : TangentBundle I M} (h : q.1 ∈ (chartAt H p.1).source) :
-    tangentMap I I (chartAt H p.1) q =
-      (TotalSpace.toProd _ _).symm
-        ((chartAt (ModelProd H E) p : TangentBundle I M → ModelProd H E) q) := by
-  dsimp [tangentMap]
-  rw [MDifferentiableAt.mfderiv]
-  · rfl
-  · exact mdifferentiableAt_atlas _ (chart_mem_atlas _ _) h
-#align tangent_map_chart tangentMap_chart
-
-/-- The derivative of the inverse of the chart at a base point is the inverse of the chart of the
-tangent bundle, composed with the identification between the tangent bundle of the model space and
-the product space. -/
-theorem tangentMap_chart_symm {p : TangentBundle I M} {q : TangentBundle I H}
-    (h : q.1 ∈ (chartAt H p.1).target) :
-    tangentMap I I (chartAt H p.1).symm q =
-      (chartAt (ModelProd H E) p).symm (TotalSpace.toProd H E q) := by
-  dsimp only [tangentMap]
-  rw [MDifferentiableAt.mfderiv (mdifferentiableAt_atlas_symm _ (chart_mem_atlas _ _) h)]
-  simp only [ContinuousLinearMap.coe_coe, TangentBundle.chartAt, h, tangentBundleCore,
-    mfld_simps, (· ∘ ·)]
-  -- `simp` fails to apply `PartialEquiv.prod_symm` with `ModelProd`
-  congr
-  exact ((chartAt H (TotalSpace.proj p)).right_inv h).symm
-#align tangent_map_chart_symm tangentMap_chart_symm
-
-end Charts
-
-end SpecificFunctions
-
-/-! ### Differentiable partial homeomorphisms -/
-
-namespace PartialHomeomorph.MDifferentiable
-
-variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
-  [NormedSpace 𝕜 E] {H : Type*} [TopologicalSpace H] {I : ModelWithCorners 𝕜 E H} {M : Type*}
-  [TopologicalSpace M] [ChartedSpace H M] {E' : Type*} [NormedAddCommGroup E'] [NormedSpace 𝕜 E']
-  {H' : Type*} [TopologicalSpace H'] {I' : ModelWithCorners 𝕜 E' H'} {M' : Type*}
-  [TopologicalSpace M'] [ChartedSpace H' M'] {E'' : Type*} [NormedAddCommGroup E'']
-  [NormedSpace 𝕜 E''] {H'' : Type*} [TopologicalSpace H''] {I'' : ModelWithCorners 𝕜 E'' H''}
-  {M'' : Type*} [TopologicalSpace M''] [ChartedSpace H'' M''] {e : PartialHomeomorph M M'}
-  (he : e.MDifferentiable I I') {e' : PartialHomeomorph M' M''}
-
-nonrec theorem symm : e.symm.MDifferentiable I' I := he.symm
-#align local_homeomorph.mdifferentiable.symm PartialHomeomorph.MDifferentiable.symm
-
-protected theorem mdifferentiableAt {x : M} (hx : x ∈ e.source) : MDifferentiableAt I I' e x :=
-  (he.1 x hx).mdifferentiableAt (IsOpen.mem_nhds e.open_source hx)
-#align local_homeomorph.mdifferentiable.mdifferentiable_at PartialHomeomorph.MDifferentiable.mdifferentiableAt
-
-theorem mdifferentiableAt_symm {x : M'} (hx : x ∈ e.target) : MDifferentiableAt I' I e.symm x :=
-  (he.2 x hx).mdifferentiableAt (IsOpen.mem_nhds e.open_target hx)
-#align local_homeomorph.mdifferentiable.mdifferentiable_at_symm PartialHomeomorph.MDifferentiable.mdifferentiableAt_symm
-
-variable [SmoothManifoldWithCorners I M] [SmoothManifoldWithCorners I' M']
-  [SmoothManifoldWithCorners I'' M'']
-
-theorem symm_comp_deriv {x : M} (hx : x ∈ e.source) :
-    (mfderiv I' I e.symm (e x)).comp (mfderiv I I' e x) =
-      ContinuousLinearMap.id 𝕜 (TangentSpace I x) := by
-  have : mfderiv I I (e.symm ∘ e) x = (mfderiv I' I e.symm (e x)).comp (mfderiv I I' e x) :=
-    mfderiv_comp x (he.mdifferentiableAt_symm (e.map_source hx)) (he.mdifferentiableAt hx)
-  rw [← this]
-  have : mfderiv I I (_root_.id : M → M) x = ContinuousLinearMap.id _ _ := mfderiv_id I
-  rw [← this]
-  apply Filter.EventuallyEq.mfderiv_eq
-  have : e.source ∈ 𝓝 x := IsOpen.mem_nhds e.open_source hx
-  exact Filter.mem_of_superset this (by mfld_set_tac)
-#align local_homeomorph.mdifferentiable.symm_comp_deriv PartialHomeomorph.MDifferentiable.symm_comp_deriv
-
-theorem comp_symm_deriv {x : M'} (hx : x ∈ e.target) :
-    (mfderiv I I' e (e.symm x)).comp (mfderiv I' I e.symm x) =
-      ContinuousLinearMap.id 𝕜 (TangentSpace I' x) :=
-  he.symm.symm_comp_deriv hx
-#align local_homeomorph.mdifferentiable.comp_symm_deriv PartialHomeomorph.MDifferentiable.comp_symm_deriv
-
-/-- The derivative of a differentiable partial homeomorphism, as a continuous linear equivalence
-between the tangent spaces at `x` and `e x`. -/
-protected def mfderiv {x : M} (hx : x ∈ e.source) : TangentSpace I x ≃L[𝕜] TangentSpace I' (e x) :=
-  { mfderiv I I' e x with
-    invFun := mfderiv I' I e.symm (e x)
-    continuous_toFun := (mfderiv I I' e x).cont
-    continuous_invFun := (mfderiv I' I e.symm (e x)).cont
-    left_inv := fun y => by
-      have : (ContinuousLinearMap.id _ _ : TangentSpace I x →L[𝕜] TangentSpace I x) y = y := rfl
-      conv_rhs => rw [← this, ← he.symm_comp_deriv hx]
-    right_inv := fun y => by
-      have :
-        (ContinuousLinearMap.id 𝕜 _ : TangentSpace I' (e x) →L[𝕜] TangentSpace I' (e x)) y = y :=
-        rfl
-      conv_rhs => rw [← this, ← he.comp_symm_deriv (e.map_source hx)]
-      rw [e.left_inv hx]
-      rfl }
-#align local_homeomorph.mdifferentiable.mfderiv PartialHomeomorph.MDifferentiable.mfderiv
-
-theorem mfderiv_bijective {x : M} (hx : x ∈ e.source) : Function.Bijective (mfderiv I I' e x) :=
-  (he.mfderiv hx).bijective
-#align local_homeomorph.mdifferentiable.mfderiv_bijective PartialHomeomorph.MDifferentiable.mfderiv_bijective
-
-theorem mfderiv_injective {x : M} (hx : x ∈ e.source) : Function.Injective (mfderiv I I' e x) :=
-  (he.mfderiv hx).injective
-#align local_homeomorph.mdifferentiable.mfderiv_injective PartialHomeomorph.MDifferentiable.mfderiv_injective
-
-theorem mfderiv_surjective {x : M} (hx : x ∈ e.source) : Function.Surjective (mfderiv I I' e x) :=
-  (he.mfderiv hx).surjective
-#align local_homeomorph.mdifferentiable.mfderiv_surjective PartialHomeomorph.MDifferentiable.mfderiv_surjective
-
-theorem ker_mfderiv_eq_bot {x : M} (hx : x ∈ e.source) : LinearMap.ker (mfderiv I I' e x) = ⊥ :=
-  (he.mfderiv hx).toLinearEquiv.ker
-#align local_homeomorph.mdifferentiable.ker_mfderiv_eq_bot PartialHomeomorph.MDifferentiable.ker_mfderiv_eq_bot
-
-theorem range_mfderiv_eq_top {x : M} (hx : x ∈ e.source) : LinearMap.range (mfderiv I I' e x) = ⊤ :=
-  (he.mfderiv hx).toLinearEquiv.range
-#align local_homeomorph.mdifferentiable.range_mfderiv_eq_top PartialHomeomorph.MDifferentiable.range_mfderiv_eq_top
-
-theorem range_mfderiv_eq_univ {x : M} (hx : x ∈ e.source) : range (mfderiv I I' e x) = univ :=
-  (he.mfderiv_surjective hx).range_eq
-#align local_homeomorph.mdifferentiable.range_mfderiv_eq_univ PartialHomeomorph.MDifferentiable.range_mfderiv_eq_univ
-
-theorem trans (he' : e'.MDifferentiable I' I'') : (e.trans e').MDifferentiable I I'' := by
-  constructor
-  · intro x hx
-    simp only [mfld_simps] at hx
-    exact
-      ((he'.mdifferentiableAt hx.2).comp _ (he.mdifferentiableAt hx.1)).mdifferentiableWithinAt
-  · intro x hx
-    simp only [mfld_simps] at hx
-    exact
-      ((he.symm.mdifferentiableAt hx.2).comp _
-          (he'.symm.mdifferentiableAt hx.1)).mdifferentiableWithinAt
-#align local_homeomorph.mdifferentiable.trans PartialHomeomorph.MDifferentiable.trans
-
-end PartialHomeomorph.MDifferentiable
-
-/-! ### Differentiability of `extChartAt` -/
-
-section extChartAt
-
-variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
-  [NormedSpace 𝕜 E] {H : Type*} [TopologicalSpace H] (I : ModelWithCorners 𝕜 E H) {M : Type*}
-  [TopologicalSpace M] [ChartedSpace H M] [SmoothManifoldWithCorners I M] {s : Set M} {x y : M}
-
-theorem hasMFDerivAt_extChartAt (h : y ∈ (chartAt H x).source) :
-    HasMFDerivAt I 𝓘(𝕜, E) (extChartAt I x) y (mfderiv I I (chartAt H x) y : _) :=
-  I.hasMFDerivAt.comp y ((mdifferentiable_chart I x).mdifferentiableAt h).hasMFDerivAt
-#align has_mfderiv_at_ext_chart_at hasMFDerivAt_extChartAt
-
-theorem hasMFDerivWithinAt_extChartAt (h : y ∈ (chartAt H x).source) :
-    HasMFDerivWithinAt I 𝓘(𝕜, E) (extChartAt I x) s y (mfderiv I I (chartAt H x) y : _) :=
-  (hasMFDerivAt_extChartAt I h).hasMFDerivWithinAt
-#align has_mfderiv_within_at_ext_chart_at hasMFDerivWithinAt_extChartAt
-
-theorem mdifferentiableAt_extChartAt (h : y ∈ (chartAt H x).source) :
-    MDifferentiableAt I 𝓘(𝕜, E) (extChartAt I x) y :=
-  (hasMFDerivAt_extChartAt I h).mdifferentiableAt
-#align mdifferentiable_at_ext_chart_at mdifferentiableAt_extChartAt
-
-theorem mdifferentiableOn_extChartAt :
-    MDifferentiableOn I 𝓘(𝕜, E) (extChartAt I x) (chartAt H x).source := fun _y hy =>
-  (hasMFDerivWithinAt_extChartAt I hy).mdifferentiableWithinAt
-#align mdifferentiable_on_ext_chart_at mdifferentiableOn_extChartAt
-
-end extChartAt
-
-/-! ### Unique derivative sets in manifolds -/
-
-section UniqueMDiff
-
-variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
-  [NormedSpace 𝕜 E] {H : Type*} [TopologicalSpace H] {I : ModelWithCorners 𝕜 E H} {M : Type*}
-  [TopologicalSpace M] [ChartedSpace H M] [SmoothManifoldWithCorners I M] {E' : Type*}
-  [NormedAddCommGroup E'] [NormedSpace 𝕜 E'] {H' : Type*} [TopologicalSpace H']
-  {I' : ModelWithCorners 𝕜 E' H'} {M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M']
-  [SmoothManifoldWithCorners I' M'] {s : Set M}
-
-/-- If `s` has the unique differential property at `x`, `f` is differentiable within `s` at x` and
-its derivative has Dense range, then `f '' s` has the Unique differential property at `f x`. -/
-theorem UniqueMDiffWithinAt.image_denseRange {x : M} (hs : UniqueMDiffWithinAt I s x)
-    {f : M → M'} {f' : E →L[𝕜] E'} (hf : HasMFDerivWithinAt I I' f s x f')
-    (hd : DenseRange f') : UniqueMDiffWithinAt I' (f '' s) (f x) := by
-  /- Rewrite in coordinates, apply `HasFDerivWithinAt.uniqueDiffWithinAt`. -/
-  have := hs.inter' <| hf.1 (extChartAt_source_mem_nhds I' (f x))
-  refine (((hf.2.mono ?sub1).uniqueDiffWithinAt this hd).mono ?sub2).congr_pt ?pt
-  case pt => simp only [mfld_simps]
-  case sub1 => mfld_set_tac
-  case sub2 =>
-    rintro _ ⟨y, ⟨⟨hys, hfy⟩, -⟩, rfl⟩
-    exact ⟨⟨_, hys, ((extChartAt I' (f x)).left_inv hfy).symm⟩, mem_range_self _⟩
-
-/-- If `s` has the unique differential, `f` is differentiable on `s` and its derivative at every
-point of `s` has dense range, then `f '' s` has the unique differential property. This version
-uses `HaMFDerivWithinAt` predicate. -/
-theorem UniqueMDiffOn.image_denseRange' (hs : UniqueMDiffOn I s) {f : M → M'}
-    {f' : M → E →L[𝕜] E'} (hf : ∀ x ∈ s, HasMFDerivWithinAt I I' f s x (f' x))
-    (hd : ∀ x ∈ s, DenseRange (f' x)) :
-    UniqueMDiffOn I' (f '' s) :=
-  ball_image_iff.2 fun x hx ↦ (hs x hx).image_denseRange (hf x hx) (hd x hx)
-
-/-- If `s` has the unique differential, `f` is differentiable on `s` and its derivative at every
-point of `s` has dense range, then `f '' s` has the unique differential property. -/
-theorem UniqueMDiffOn.image_denseRange (hs : UniqueMDiffOn I s) {f : M → M'}
-    (hf : MDifferentiableOn I I' f s) (hd : ∀ x ∈ s, DenseRange (mfderivWithin I I' f s x)) :
-    UniqueMDiffOn I' (f '' s) :=
-  hs.image_denseRange' (fun x hx ↦ (hf x hx).hasMFDerivWithinAt) hd
-
-protected theorem UniqueMDiffWithinAt.preimage_partialHomeomorph {x : M}
-    (hs : UniqueMDiffWithinAt I s x) {e : PartialHomeomorph M M'} (he : e.MDifferentiable I I')
-    (hx : x ∈ e.source) :
-    UniqueMDiffWithinAt I' (e.target ∩ e.symm ⁻¹' s) (e x) := by
-  rw [← e.image_source_inter_eq', inter_comm]
-  exact (hs.inter (e.open_source.mem_nhds hx)).image_denseRange
-    (he.mdifferentiableAt hx).hasMFDerivAt.hasMFDerivWithinAt
-    (he.mfderiv_surjective hx).denseRange
-
-/-- If a set has the unique differential property, then its image under a local
-diffeomorphism also has the unique differential property. -/
-theorem UniqueMDiffOn.uniqueMDiffOn_preimage (hs : UniqueMDiffOn I s) {e : PartialHomeomorph M M'}
-    (he : e.MDifferentiable I I') : UniqueMDiffOn I' (e.target ∩ e.symm ⁻¹' s) := fun _x hx ↦
-  e.right_inv hx.1 ▸ (hs _ hx.2).preimage_partialHomeomorph he (e.map_target hx.1)
-#align unique_mdiff_on.unique_mdiff_on_preimage UniqueMDiffOn.uniqueMDiffOn_preimage
-
-/-- If a set in a manifold has the unique derivative property, then its pullback by any extended
-chart, in the vector space, also has the unique derivative property. -/
-theorem UniqueMDiffOn.uniqueDiffOn_target_inter (hs : UniqueMDiffOn I s) (x : M) :
-    UniqueDiffOn 𝕜 ((extChartAt I x).target ∩ (extChartAt I x).symm ⁻¹' s) := by
-  -- this is just a reformulation of `UniqueMDiffOn.uniqueMDiffOn_preimage`, using as `e`
-  -- the local chart at `x`.
-  apply UniqueMDiffOn.uniqueDiffOn
-  rw [← PartialEquiv.image_source_inter_eq', inter_comm, extChartAt_source]
-  exact (hs.inter (chartAt H x).open_source).image_denseRange'
-    (fun y hy ↦ hasMFDerivWithinAt_extChartAt I hy.2)
-    fun y hy ↦ ((mdifferentiable_chart _ _).mfderiv_surjective hy.2).denseRange
-#align unique_mdiff_on.unique_diff_on_target_inter UniqueMDiffOn.uniqueDiffOn_target_inter
-
-/-- When considering functions between manifolds, this statement shows up often. It entails
-the unique differential of the pullback in extended charts of the set where the function can
-be read in the charts. -/
-theorem UniqueMDiffOn.uniqueDiffOn_inter_preimage (hs : UniqueMDiffOn I s) (x : M) (y : M')
-    {f : M → M'} (hf : ContinuousOn f s) :
-    UniqueDiffOn 𝕜
-      ((extChartAt I x).target ∩ (extChartAt I x).symm ⁻¹' (s ∩ f ⁻¹' (extChartAt I' y).source)) :=
-  haveI : UniqueMDiffOn I (s ∩ f ⁻¹' (extChartAt I' y).source) := by
-    intro z hz
-    apply (hs z hz.1).inter'
-    apply (hf z hz.1).preimage_mem_nhdsWithin
-    exact (isOpen_extChartAt_source I' y).mem_nhds hz.2
-  this.uniqueDiffOn_target_inter _
-#align unique_mdiff_on.unique_diff_on_inter_preimage UniqueMDiffOn.uniqueDiffOn_inter_preimage
-
-open Bundle
-
-variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] {Z : M → Type*}
-  [TopologicalSpace (TotalSpace F Z)] [∀ b, TopologicalSpace (Z b)] [∀ b, AddCommMonoid (Z b)]
-  [∀ b, Module 𝕜 (Z b)] [FiberBundle F Z] [VectorBundle 𝕜 F Z] [SmoothVectorBundle F Z I]
-
-theorem Trivialization.mdifferentiable (e : Trivialization F (π F Z)) [MemTrivializationAtlas e] :
-    e.toPartialHomeomorph.MDifferentiable (I.prod 𝓘(𝕜, F)) (I.prod 𝓘(𝕜, F)) :=
-  ⟨(e.smoothOn I).mdifferentiableOn, (e.smoothOn_symm I).mdifferentiableOn⟩
-
-theorem UniqueMDiffWithinAt.smooth_bundle_preimage {p : TotalSpace F Z}
-    (hs : UniqueMDiffWithinAt I s p.proj) :
-    UniqueMDiffWithinAt (I.prod 𝓘(𝕜, F)) (π F Z ⁻¹' s) p := by
-  set e := trivializationAt F Z p.proj
-  have hp : p ∈ e.source := FiberBundle.mem_trivializationAt_proj_source
-  have : UniqueMDiffWithinAt (I.prod 𝓘(𝕜, F)) (s ×ˢ univ) (e p)
-  · rw [← Prod.mk.eta (p := e p), FiberBundle.trivializationAt_proj_fst]
-    exact hs.prod (uniqueMDiffWithinAt_univ _)
-  rw [← e.left_inv hp]
-  refine (this.preimage_partialHomeomorph e.mdifferentiable.symm (e.map_source hp)).mono ?_
-  rintro y ⟨hy, hys, -⟩
-  rwa [PartialHomeomorph.symm_symm, e.coe_coe, e.coe_fst hy] at hys
-
-variable (Z)
-
-theorem UniqueMDiffWithinAt.smooth_bundle_preimage' {b : M} (hs : UniqueMDiffWithinAt I s b)
-    (x : Z b) : UniqueMDiffWithinAt (I.prod 𝓘(𝕜, F)) (π F Z ⁻¹' s) ⟨b, x⟩ :=
-  hs.smooth_bundle_preimage (p := ⟨b, x⟩)
-
-/-- In a smooth fiber bundle, the preimage under the projection of a set with
-unique differential in the basis also has unique differential. -/
-theorem UniqueMDiffOn.smooth_bundle_preimage (hs : UniqueMDiffOn I s) :
-    UniqueMDiffOn (I.prod 𝓘(𝕜, F)) (π F Z ⁻¹' s) := fun _p hp ↦
-  (hs _ hp).smooth_bundle_preimage
-#align unique_mdiff_on.smooth_bundle_preimage UniqueMDiffOn.smooth_bundle_preimage
-
-/-- The preimage under the projection from the tangent bundle of a set with unique differential in
-the basis also has unique differential. -/
-theorem UniqueMDiffOn.tangentBundle_proj_preimage (hs : UniqueMDiffOn I s) :
-    UniqueMDiffOn I.tangent (π E (TangentSpace I) ⁻¹' s) :=
-  hs.smooth_bundle_preimage _
-#align unique_mdiff_on.tangent_bundle_proj_preimage UniqueMDiffOn.tangentBundle_proj_preimage
-
-end UniqueMDiff
chore(Analysis,Geometry): remove almost all autoImplicit (#9691)

After this PR, no file in Geometry uses autoImplicit, and in Analysis it's scoped to six declarations.

Diff
@@ -93,9 +93,6 @@ the space of equivalence classes of smooth curves in the manifold.
 Derivative, manifold
 -/
 
-set_option autoImplicit true
-
-
 noncomputable section
 
 open scoped Classical Topology Manifold Bundle
@@ -666,6 +663,8 @@ theorem mdifferentiableAt_iff_of_mem_source {x' : M} {y : M'}
 
 -- porting note: moved from `ContMDiffMFDeriv`
 
+variable {n : ℕ∞}
+
 theorem ContMDiffWithinAt.mdifferentiableWithinAt (hf : ContMDiffWithinAt I I' n f s x)
     (hn : 1 ≤ n) : MDifferentiableWithinAt I I' f s x := by
   suffices h : MDifferentiableWithinAt I I' f (s ∩ f ⁻¹' (extChartAt I' (f x)).source) x
@@ -2045,7 +2044,7 @@ variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCom
 
 /-- If `s` has the unique differential property at `x`, `f` is differentiable within `s` at x` and
 its derivative has Dense range, then `f '' s` has the Unique differential property at `f x`. -/
-theorem UniqueMDiffWithinAt.image_denseRange (hs : UniqueMDiffWithinAt I s x)
+theorem UniqueMDiffWithinAt.image_denseRange {x : M} (hs : UniqueMDiffWithinAt I s x)
     {f : M → M'} {f' : E →L[𝕜] E'} (hf : HasMFDerivWithinAt I I' f s x f')
     (hd : DenseRange f') : UniqueMDiffWithinAt I' (f '' s) (f x) := by
   /- Rewrite in coordinates, apply `HasFDerivWithinAt.uniqueDiffWithinAt`. -/
@@ -2073,8 +2072,9 @@ theorem UniqueMDiffOn.image_denseRange (hs : UniqueMDiffOn I s) {f : M → M'}
     UniqueMDiffOn I' (f '' s) :=
   hs.image_denseRange' (fun x hx ↦ (hf x hx).hasMFDerivWithinAt) hd
 
-protected theorem UniqueMDiffWithinAt.preimage_partialHomeomorph (hs : UniqueMDiffWithinAt I s x)
-    {e : PartialHomeomorph M M'} (he : e.MDifferentiable I I') (hx : x ∈ e.source) :
+protected theorem UniqueMDiffWithinAt.preimage_partialHomeomorph {x : M}
+    (hs : UniqueMDiffWithinAt I s x) {e : PartialHomeomorph M M'} (he : e.MDifferentiable I I')
+    (hx : x ∈ e.source) :
     UniqueMDiffWithinAt I' (e.target ∩ e.symm ⁻¹' s) (e x) := by
   rw [← e.image_source_inter_eq', inter_comm]
   exact (hs.inter (e.open_source.mem_nhds hx)).image_denseRange
chore: last LocalHomeomorph -> PartialHomeomorph renames (#9238)

Follow-up to #8982; a few lemma names were still wrong.

Co-authored-by: Winston Yin <winstonyin@gmail.com>

Diff
@@ -2073,7 +2073,7 @@ theorem UniqueMDiffOn.image_denseRange (hs : UniqueMDiffOn I s) {f : M → M'}
     UniqueMDiffOn I' (f '' s) :=
   hs.image_denseRange' (fun x hx ↦ (hf x hx).hasMFDerivWithinAt) hd
 
-protected theorem UniqueMDiffWithinAt.preimage_localHomeomorph (hs : UniqueMDiffWithinAt I s x)
+protected theorem UniqueMDiffWithinAt.preimage_partialHomeomorph (hs : UniqueMDiffWithinAt I s x)
     {e : PartialHomeomorph M M'} (he : e.MDifferentiable I I') (hx : x ∈ e.source) :
     UniqueMDiffWithinAt I' (e.target ∩ e.symm ⁻¹' s) (e x) := by
   rw [← e.image_source_inter_eq', inter_comm]
@@ -2085,7 +2085,7 @@ protected theorem UniqueMDiffWithinAt.preimage_localHomeomorph (hs : UniqueMDiff
 diffeomorphism also has the unique differential property. -/
 theorem UniqueMDiffOn.uniqueMDiffOn_preimage (hs : UniqueMDiffOn I s) {e : PartialHomeomorph M M'}
     (he : e.MDifferentiable I I') : UniqueMDiffOn I' (e.target ∩ e.symm ⁻¹' s) := fun _x hx ↦
-  e.right_inv hx.1 ▸ (hs _ hx.2).preimage_localHomeomorph he (e.map_target hx.1)
+  e.right_inv hx.1 ▸ (hs _ hx.2).preimage_partialHomeomorph he (e.map_target hx.1)
 #align unique_mdiff_on.unique_mdiff_on_preimage UniqueMDiffOn.uniqueMDiffOn_preimage
 
 /-- If a set in a manifold has the unique derivative property, then its pullback by any extended
@@ -2135,7 +2135,7 @@ theorem UniqueMDiffWithinAt.smooth_bundle_preimage {p : TotalSpace F Z}
   · rw [← Prod.mk.eta (p := e p), FiberBundle.trivializationAt_proj_fst]
     exact hs.prod (uniqueMDiffWithinAt_univ _)
   rw [← e.left_inv hp]
-  refine (this.preimage_localHomeomorph e.mdifferentiable.symm (e.map_source hp)).mono ?_
+  refine (this.preimage_partialHomeomorph e.mdifferentiable.symm (e.map_source hp)).mono ?_
   rintro y ⟨hy, hys, -⟩
   rwa [PartialHomeomorph.symm_symm, e.coe_coe, e.coe_fst hy] at hys
 
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
@@ -242,7 +242,7 @@ def MDifferentiable (f : M → M') :=
   ∀ x, MDifferentiableAt I I' f x
 #align mdifferentiable MDifferentiable
 
-/-- Prop registering if a local homeomorphism is a local diffeomorphism on its source -/
+/-- Prop registering if a partial homeomorphism is a local diffeomorphism on its source -/
 def PartialHomeomorph.MDifferentiable (f : PartialHomeomorph M M') :=
   MDifferentiableOn I I' f f.source ∧ MDifferentiableOn I' I f.symm f.target
 #align local_homeomorph.mdifferentiable PartialHomeomorph.MDifferentiable
@@ -1898,7 +1898,7 @@ end Charts
 
 end SpecificFunctions
 
-/-! ### Differentiable local homeomorphisms -/
+/-! ### Differentiable partial homeomorphisms -/
 
 namespace PartialHomeomorph.MDifferentiable
 
@@ -1944,7 +1944,7 @@ theorem comp_symm_deriv {x : M'} (hx : x ∈ e.target) :
   he.symm.symm_comp_deriv hx
 #align local_homeomorph.mdifferentiable.comp_symm_deriv PartialHomeomorph.MDifferentiable.comp_symm_deriv
 
-/-- The derivative of a differentiable local homeomorphism, as a continuous linear equivalence
+/-- The derivative of a differentiable partial homeomorphism, as a continuous linear equivalence
 between the tangent spaces at `x` and `e x`. -/
 protected def mfderiv {x : M} (hx : x ∈ e.source) : TangentSpace I x ≃L[𝕜] TangentSpace I' (e x) :=
   { mfderiv I I' e x with
feat: Add congr_mfderiv lemmas mirroring congr_fderiv (#9066)

Add convenience lemmas

  • HasMFDerivAt.congr_mfderiv
  • HasMFDerivWithinAt.congr_mfderiv

These mirror the already existing

  • HasFDerivAt.congr_fderiv
  • HasFDerivWithinAt.congr_fderiv
Diff
@@ -821,6 +821,13 @@ theorem MDifferentiable.prod_mk_space {f : M → E'} {g : M → E''} (hf : MDiff
 
 /-! ### Congruence lemmas for derivatives on manifolds -/
 
+theorem HasMFDerivAt.congr_mfderiv (h : HasMFDerivAt I I' f x f') (h' : f' = f₁') :
+    HasMFDerivAt I I' f x f₁' :=
+  h' ▸ h
+
+theorem HasMFDerivWithinAt.congr_mfderiv (h : HasMFDerivWithinAt I I' f s x f') (h' : f' = f₁') :
+    HasMFDerivWithinAt I I' f s x f₁' :=
+  h' ▸ h
 
 theorem HasMFDerivWithinAt.congr_of_eventuallyEq (h : HasMFDerivWithinAt I I' f s x f')
     (h₁ : f₁ =ᶠ[𝓝[s] x] f) (hx : f₁ x = f x) : HasMFDerivWithinAt I I' f₁ s x f' := by
chore: rename LocalEquiv to PartialEquiv (#8984)

The current name is misleading: there's no open set involved; it's just an equivalence between subsets of domain and target. zulip discussion

PEquiv is similarly named: this is fine, as they're different designs for the same concept.

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

Diff
@@ -1882,7 +1882,7 @@ theorem tangentMap_chart_symm {p : TangentBundle I M} {q : TangentBundle I H}
   rw [MDifferentiableAt.mfderiv (mdifferentiableAt_atlas_symm _ (chart_mem_atlas _ _) h)]
   simp only [ContinuousLinearMap.coe_coe, TangentBundle.chartAt, h, tangentBundleCore,
     mfld_simps, (· ∘ ·)]
-  -- `simp` fails to apply `LocalEquiv.prod_symm` with `ModelProd`
+  -- `simp` fails to apply `PartialEquiv.prod_symm` with `ModelProd`
   congr
   exact ((chartAt H (TotalSpace.proj p)).right_inv h).symm
 #align tangent_map_chart_symm tangentMap_chart_symm
@@ -2088,7 +2088,7 @@ theorem UniqueMDiffOn.uniqueDiffOn_target_inter (hs : UniqueMDiffOn I s) (x : M)
   -- this is just a reformulation of `UniqueMDiffOn.uniqueMDiffOn_preimage`, using as `e`
   -- the local chart at `x`.
   apply UniqueMDiffOn.uniqueDiffOn
-  rw [← LocalEquiv.image_source_inter_eq', inter_comm, extChartAt_source]
+  rw [← PartialEquiv.image_source_inter_eq', inter_comm, extChartAt_source]
   exact (hs.inter (chartAt H x).open_source).image_denseRange'
     (fun y hy ↦ hasMFDerivWithinAt_extChartAt I hy.2)
     fun y hy ↦ ((mdifferentiable_chart _ _).mfderiv_surjective hy.2).denseRange
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
@@ -243,9 +243,9 @@ def MDifferentiable (f : M → M') :=
 #align mdifferentiable MDifferentiable
 
 /-- Prop registering if a local homeomorphism is a local diffeomorphism on its source -/
-def LocalHomeomorph.MDifferentiable (f : LocalHomeomorph M M') :=
+def PartialHomeomorph.MDifferentiable (f : PartialHomeomorph M M') :=
   MDifferentiableOn I I' f f.source ∧ MDifferentiableOn I' I f.symm f.target
-#align local_homeomorph.mdifferentiable LocalHomeomorph.MDifferentiable
+#align local_homeomorph.mdifferentiable PartialHomeomorph.MDifferentiable
 
 variable [SmoothManifoldWithCorners I M] [SmoothManifoldWithCorners I' M']
 
@@ -1804,7 +1804,7 @@ end ModelWithCorners
 
 section Charts
 
-variable {e : LocalHomeomorph M H}
+variable {e : PartialHomeomorph M H}
 
 theorem mdifferentiableAt_atlas (h : e ∈ atlas H M) {x : M} (hx : x ∈ e.source) :
     MDifferentiableAt I I e x := by
@@ -1822,7 +1822,7 @@ theorem mdifferentiableAt_atlas (h : e ∈ atlas H M) {x : M} (hx : x ∈ e.sour
   simp only [mfld_simps] at B
   rw [inter_comm, differentiableWithinAt_inter] at B
   · simpa only [mfld_simps]
-  · apply IsOpen.mem_nhds ((LocalHomeomorph.open_source _).preimage I.continuous_symm) mem.1
+  · apply IsOpen.mem_nhds ((PartialHomeomorph.open_source _).preimage I.continuous_symm) mem.1
 #align mdifferentiable_at_atlas mdifferentiableAt_atlas
 
 theorem mdifferentiableOn_atlas (h : e ∈ atlas H M) : MDifferentiableOn I I e e.source :=
@@ -1844,7 +1844,7 @@ theorem mdifferentiableAt_atlas_symm (h : e ∈ atlas H M) {x : H} (hx : x ∈ e
   simp only [mfld_simps] at B
   rw [inter_comm, differentiableWithinAt_inter] at B
   · simpa only [mfld_simps]
-  · apply IsOpen.mem_nhds ((LocalHomeomorph.open_source _).preimage I.continuous_symm) mem.1
+  · apply IsOpen.mem_nhds ((PartialHomeomorph.open_source _).preimage I.continuous_symm) mem.1
 #align mdifferentiable_at_atlas_symm mdifferentiableAt_atlas_symm
 
 theorem mdifferentiableOn_atlas_symm (h : e ∈ atlas H M) : MDifferentiableOn I I e.symm e.target :=
@@ -1893,7 +1893,7 @@ end SpecificFunctions
 
 /-! ### Differentiable local homeomorphisms -/
 
-namespace LocalHomeomorph.MDifferentiable
+namespace PartialHomeomorph.MDifferentiable
 
 variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
   [NormedSpace 𝕜 E] {H : Type*} [TopologicalSpace H] {I : ModelWithCorners 𝕜 E H} {M : Type*}
@@ -1901,19 +1901,19 @@ variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCom
   {H' : Type*} [TopologicalSpace H'] {I' : ModelWithCorners 𝕜 E' H'} {M' : Type*}
   [TopologicalSpace M'] [ChartedSpace H' M'] {E'' : Type*} [NormedAddCommGroup E'']
   [NormedSpace 𝕜 E''] {H'' : Type*} [TopologicalSpace H''] {I'' : ModelWithCorners 𝕜 E'' H''}
-  {M'' : Type*} [TopologicalSpace M''] [ChartedSpace H'' M''] {e : LocalHomeomorph M M'}
-  (he : e.MDifferentiable I I') {e' : LocalHomeomorph M' M''}
+  {M'' : Type*} [TopologicalSpace M''] [ChartedSpace H'' M''] {e : PartialHomeomorph M M'}
+  (he : e.MDifferentiable I I') {e' : PartialHomeomorph M' M''}
 
 nonrec theorem symm : e.symm.MDifferentiable I' I := he.symm
-#align local_homeomorph.mdifferentiable.symm LocalHomeomorph.MDifferentiable.symm
+#align local_homeomorph.mdifferentiable.symm PartialHomeomorph.MDifferentiable.symm
 
 protected theorem mdifferentiableAt {x : M} (hx : x ∈ e.source) : MDifferentiableAt I I' e x :=
   (he.1 x hx).mdifferentiableAt (IsOpen.mem_nhds e.open_source hx)
-#align local_homeomorph.mdifferentiable.mdifferentiable_at LocalHomeomorph.MDifferentiable.mdifferentiableAt
+#align local_homeomorph.mdifferentiable.mdifferentiable_at PartialHomeomorph.MDifferentiable.mdifferentiableAt
 
 theorem mdifferentiableAt_symm {x : M'} (hx : x ∈ e.target) : MDifferentiableAt I' I e.symm x :=
   (he.2 x hx).mdifferentiableAt (IsOpen.mem_nhds e.open_target hx)
-#align local_homeomorph.mdifferentiable.mdifferentiable_at_symm LocalHomeomorph.MDifferentiable.mdifferentiableAt_symm
+#align local_homeomorph.mdifferentiable.mdifferentiable_at_symm PartialHomeomorph.MDifferentiable.mdifferentiableAt_symm
 
 variable [SmoothManifoldWithCorners I M] [SmoothManifoldWithCorners I' M']
   [SmoothManifoldWithCorners I'' M'']
@@ -1929,13 +1929,13 @@ theorem symm_comp_deriv {x : M} (hx : x ∈ e.source) :
   apply Filter.EventuallyEq.mfderiv_eq
   have : e.source ∈ 𝓝 x := IsOpen.mem_nhds e.open_source hx
   exact Filter.mem_of_superset this (by mfld_set_tac)
-#align local_homeomorph.mdifferentiable.symm_comp_deriv LocalHomeomorph.MDifferentiable.symm_comp_deriv
+#align local_homeomorph.mdifferentiable.symm_comp_deriv PartialHomeomorph.MDifferentiable.symm_comp_deriv
 
 theorem comp_symm_deriv {x : M'} (hx : x ∈ e.target) :
     (mfderiv I I' e (e.symm x)).comp (mfderiv I' I e.symm x) =
       ContinuousLinearMap.id 𝕜 (TangentSpace I' x) :=
   he.symm.symm_comp_deriv hx
-#align local_homeomorph.mdifferentiable.comp_symm_deriv LocalHomeomorph.MDifferentiable.comp_symm_deriv
+#align local_homeomorph.mdifferentiable.comp_symm_deriv PartialHomeomorph.MDifferentiable.comp_symm_deriv
 
 /-- The derivative of a differentiable local homeomorphism, as a continuous linear equivalence
 between the tangent spaces at `x` and `e x`. -/
@@ -1954,31 +1954,31 @@ protected def mfderiv {x : M} (hx : x ∈ e.source) : TangentSpace I x ≃L[𝕜
       conv_rhs => rw [← this, ← he.comp_symm_deriv (e.map_source hx)]
       rw [e.left_inv hx]
       rfl }
-#align local_homeomorph.mdifferentiable.mfderiv LocalHomeomorph.MDifferentiable.mfderiv
+#align local_homeomorph.mdifferentiable.mfderiv PartialHomeomorph.MDifferentiable.mfderiv
 
 theorem mfderiv_bijective {x : M} (hx : x ∈ e.source) : Function.Bijective (mfderiv I I' e x) :=
   (he.mfderiv hx).bijective
-#align local_homeomorph.mdifferentiable.mfderiv_bijective LocalHomeomorph.MDifferentiable.mfderiv_bijective
+#align local_homeomorph.mdifferentiable.mfderiv_bijective PartialHomeomorph.MDifferentiable.mfderiv_bijective
 
 theorem mfderiv_injective {x : M} (hx : x ∈ e.source) : Function.Injective (mfderiv I I' e x) :=
   (he.mfderiv hx).injective
-#align local_homeomorph.mdifferentiable.mfderiv_injective LocalHomeomorph.MDifferentiable.mfderiv_injective
+#align local_homeomorph.mdifferentiable.mfderiv_injective PartialHomeomorph.MDifferentiable.mfderiv_injective
 
 theorem mfderiv_surjective {x : M} (hx : x ∈ e.source) : Function.Surjective (mfderiv I I' e x) :=
   (he.mfderiv hx).surjective
-#align local_homeomorph.mdifferentiable.mfderiv_surjective LocalHomeomorph.MDifferentiable.mfderiv_surjective
+#align local_homeomorph.mdifferentiable.mfderiv_surjective PartialHomeomorph.MDifferentiable.mfderiv_surjective
 
 theorem ker_mfderiv_eq_bot {x : M} (hx : x ∈ e.source) : LinearMap.ker (mfderiv I I' e x) = ⊥ :=
   (he.mfderiv hx).toLinearEquiv.ker
-#align local_homeomorph.mdifferentiable.ker_mfderiv_eq_bot LocalHomeomorph.MDifferentiable.ker_mfderiv_eq_bot
+#align local_homeomorph.mdifferentiable.ker_mfderiv_eq_bot PartialHomeomorph.MDifferentiable.ker_mfderiv_eq_bot
 
 theorem range_mfderiv_eq_top {x : M} (hx : x ∈ e.source) : LinearMap.range (mfderiv I I' e x) = ⊤ :=
   (he.mfderiv hx).toLinearEquiv.range
-#align local_homeomorph.mdifferentiable.range_mfderiv_eq_top LocalHomeomorph.MDifferentiable.range_mfderiv_eq_top
+#align local_homeomorph.mdifferentiable.range_mfderiv_eq_top PartialHomeomorph.MDifferentiable.range_mfderiv_eq_top
 
 theorem range_mfderiv_eq_univ {x : M} (hx : x ∈ e.source) : range (mfderiv I I' e x) = univ :=
   (he.mfderiv_surjective hx).range_eq
-#align local_homeomorph.mdifferentiable.range_mfderiv_eq_univ LocalHomeomorph.MDifferentiable.range_mfderiv_eq_univ
+#align local_homeomorph.mdifferentiable.range_mfderiv_eq_univ PartialHomeomorph.MDifferentiable.range_mfderiv_eq_univ
 
 theorem trans (he' : e'.MDifferentiable I' I'') : (e.trans e').MDifferentiable I I'' := by
   constructor
@@ -1991,9 +1991,9 @@ theorem trans (he' : e'.MDifferentiable I' I'') : (e.trans e').MDifferentiable I
     exact
       ((he.symm.mdifferentiableAt hx.2).comp _
           (he'.symm.mdifferentiableAt hx.1)).mdifferentiableWithinAt
-#align local_homeomorph.mdifferentiable.trans LocalHomeomorph.MDifferentiable.trans
+#align local_homeomorph.mdifferentiable.trans PartialHomeomorph.MDifferentiable.trans
 
-end LocalHomeomorph.MDifferentiable
+end PartialHomeomorph.MDifferentiable
 
 /-! ### Differentiability of `extChartAt` -/
 
@@ -2067,7 +2067,7 @@ theorem UniqueMDiffOn.image_denseRange (hs : UniqueMDiffOn I s) {f : M → M'}
   hs.image_denseRange' (fun x hx ↦ (hf x hx).hasMFDerivWithinAt) hd
 
 protected theorem UniqueMDiffWithinAt.preimage_localHomeomorph (hs : UniqueMDiffWithinAt I s x)
-    {e : LocalHomeomorph M M'} (he : e.MDifferentiable I I') (hx : x ∈ e.source) :
+    {e : PartialHomeomorph M M'} (he : e.MDifferentiable I I') (hx : x ∈ e.source) :
     UniqueMDiffWithinAt I' (e.target ∩ e.symm ⁻¹' s) (e x) := by
   rw [← e.image_source_inter_eq', inter_comm]
   exact (hs.inter (e.open_source.mem_nhds hx)).image_denseRange
@@ -2076,7 +2076,7 @@ protected theorem UniqueMDiffWithinAt.preimage_localHomeomorph (hs : UniqueMDiff
 
 /-- If a set has the unique differential property, then its image under a local
 diffeomorphism also has the unique differential property. -/
-theorem UniqueMDiffOn.uniqueMDiffOn_preimage (hs : UniqueMDiffOn I s) {e : LocalHomeomorph M M'}
+theorem UniqueMDiffOn.uniqueMDiffOn_preimage (hs : UniqueMDiffOn I s) {e : PartialHomeomorph M M'}
     (he : e.MDifferentiable I I') : UniqueMDiffOn I' (e.target ∩ e.symm ⁻¹' s) := fun _x hx ↦
   e.right_inv hx.1 ▸ (hs _ hx.2).preimage_localHomeomorph he (e.map_target hx.1)
 #align unique_mdiff_on.unique_mdiff_on_preimage UniqueMDiffOn.uniqueMDiffOn_preimage
@@ -2116,7 +2116,7 @@ variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] {Z : M → Type
   [∀ b, Module 𝕜 (Z b)] [FiberBundle F Z] [VectorBundle 𝕜 F Z] [SmoothVectorBundle F Z I]
 
 theorem Trivialization.mdifferentiable (e : Trivialization F (π F Z)) [MemTrivializationAtlas e] :
-    e.toLocalHomeomorph.MDifferentiable (I.prod 𝓘(𝕜, F)) (I.prod 𝓘(𝕜, F)) :=
+    e.toPartialHomeomorph.MDifferentiable (I.prod 𝓘(𝕜, F)) (I.prod 𝓘(𝕜, F)) :=
   ⟨(e.smoothOn I).mdifferentiableOn, (e.smoothOn_symm I).mdifferentiableOn⟩
 
 theorem UniqueMDiffWithinAt.smooth_bundle_preimage {p : TotalSpace F Z}
@@ -2130,7 +2130,7 @@ theorem UniqueMDiffWithinAt.smooth_bundle_preimage {p : TotalSpace F Z}
   rw [← e.left_inv hp]
   refine (this.preimage_localHomeomorph e.mdifferentiable.symm (e.map_source hp)).mono ?_
   rintro y ⟨hy, hys, -⟩
-  rwa [LocalHomeomorph.symm_symm, e.coe_coe, e.coe_fst hy] at hys
+  rwa [PartialHomeomorph.symm_symm, e.coe_coe, e.coe_fst hy] at hys
 
 variable (Z)
 
doc: Mark named theorems (#8749)
Diff
@@ -979,7 +979,7 @@ theorem HasMFDerivWithinAt.comp (hg : HasMFDerivWithinAt I' I'' g u (f x) g')
   simp only [mfld_simps]
 #align has_mfderiv_within_at.comp HasMFDerivWithinAt.comp
 
-/-- The chain rule. -/
+/-- The **chain rule for manifolds**. -/
 theorem HasMFDerivAt.comp (hg : HasMFDerivAt I' I'' g (f x) g') (hf : HasMFDerivAt I I' f x f') :
     HasMFDerivAt I I'' (g ∘ f) x (g'.comp f') := by
   rw [← hasMFDerivWithinAt_univ] at *
fix: remove references to non-heterogenous operators in theorem statements (#8086)

Some of these are likely porting errors. Statements should always be about the heterogenous versions because these are the ones with notation.

For places where we are abusing defeq, this debuts the trick of using (by exact a : B) = (by exact a1) + (by exact b2) to ensure the = and + are typed as B instead of A.

Diff
@@ -1616,11 +1616,11 @@ theorem MDifferentiable.add (hf : MDifferentiable I 𝓘(𝕜, E') f)
   (hf x).add (hg x)
 #align mdifferentiable.add MDifferentiable.add
 
--- porting note: forcing types using `@Add.add`
+-- porting note: forcing types using `by exact`
 theorem mfderiv_add (hf : MDifferentiableAt I 𝓘(𝕜, E') f z)
     (hg : MDifferentiableAt I 𝓘(𝕜, E') g z) :
-    (mfderiv I 𝓘(𝕜, E') (f + g) z : TangentSpace I z →L[𝕜] E') =
-      @Add.add (TangentSpace I z →L[𝕜] E') _ (mfderiv I 𝓘(𝕜, E') f z) (mfderiv I 𝓘(𝕜, E') g z) :=
+    (by exact mfderiv I 𝓘(𝕜, E') (f + g) z : TangentSpace I z →L[𝕜] E') =
+      (by exact mfderiv I 𝓘(𝕜, E') f z) + (by exact mfderiv I 𝓘(𝕜, E') g z) :=
   (hf.hasMFDerivAt.add hg.hasMFDerivAt).mfderiv
 #align mfderiv_add mfderiv_add
 
@@ -1693,8 +1693,8 @@ theorem MDifferentiable.sub (hf : MDifferentiable I 𝓘(𝕜, E') f)
 
 theorem mfderiv_sub (hf : MDifferentiableAt I 𝓘(𝕜, E') f z)
     (hg : MDifferentiableAt I 𝓘(𝕜, E') g z) :
-    (mfderiv I 𝓘(𝕜, E') (f - g) z : TangentSpace I z →L[𝕜] E') =
-      @Sub.sub (TangentSpace I z →L[𝕜] E') _ (mfderiv I 𝓘(𝕜, E') f z) (mfderiv I 𝓘(𝕜, E') g z) :=
+    (by exact mfderiv I 𝓘(𝕜, E') (f - g) z : TangentSpace I z →L[𝕜] E') =
+      (by exact mfderiv I 𝓘(𝕜, E') f z) - (by exact mfderiv I 𝓘(𝕜, E') g z) :=
   (hf.hasMFDerivAt.sub hg.hasMFDerivAt).mfderiv
 #align mfderiv_sub mfderiv_sub
 
feat: lemmas analogous to fderiv_within_of_isOpen (#8057)
  • from the project towards Sard's theorem

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

Diff
@@ -639,6 +639,18 @@ theorem mfderivWithin_inter (ht : t ∈ 𝓝 x) :
     fderivWithin_inter (extChartAt_preimage_mem_nhds I x ht)]
 #align mfderiv_within_inter mfderivWithin_inter
 
+theorem mfderivWithin_of_mem_nhds (h : s ∈ 𝓝 x) : mfderivWithin I I' f s x = mfderiv I I' f x := by
+  rw [← mfderivWithin_univ, ← univ_inter s, mfderivWithin_inter h]
+
+lemma mfderivWithin_of_isOpen (hs : IsOpen s) (hx : x ∈ s) :
+    mfderivWithin I I' f s x = mfderiv I I' f x :=
+  mfderivWithin_of_mem_nhds (hs.mem_nhds hx)
+
+theorem mfderivWithin_eq_mfderiv (hs : UniqueMDiffWithinAt I s x) (h : MDifferentiableAt I I' f x) :
+    mfderivWithin I I' f s x = mfderiv I I' f x := by
+  rw [← mfderivWithin_univ]
+  exact mfderivWithin_subset (subset_univ _) hs h.mdifferentiableWithinAt
+
 theorem mdifferentiableAt_iff_of_mem_source {x' : M} {y : M'}
     (hx : x' ∈ (chartAt H x).source) (hy : f x' ∈ (chartAt H' y).source) :
     MDifferentiableAt I I' f x' ↔
Revert "chore: revert #7703 (#7710)"

This reverts commit f3695eb2.

Diff
@@ -901,7 +901,8 @@ theorem tangentMapWithin_congr (h : ∀ x ∈ s, f x = f₁ x) (p : TangentBundl
     (hs : UniqueMDiffWithinAt I s p.1) :
     tangentMapWithin I I' f s p = tangentMapWithin I I' f₁ s p := by
   refine TotalSpace.ext _ _ (h p.1 hp) ?_
-  simp only [tangentMapWithin, h p.1 hp, mfderivWithin_congr hs h (h _ hp), HEq.refl]
+  -- This used to be `simp only`, but we need `erw` after leanprover/lean4#2644
+  rw [tangentMapWithin, h p.1 hp, tangentMapWithin, mfderivWithin_congr hs h (h _ hp)]
 #align tangent_map_within_congr tangentMapWithin_congr
 
 theorem Filter.EventuallyEq.mfderiv_eq (hL : f₁ =ᶠ[𝓝 x] f) :
chore: revert #7703 (#7710)

This reverts commit 26eb2b0a.

Diff
@@ -901,8 +901,7 @@ theorem tangentMapWithin_congr (h : ∀ x ∈ s, f x = f₁ x) (p : TangentBundl
     (hs : UniqueMDiffWithinAt I s p.1) :
     tangentMapWithin I I' f s p = tangentMapWithin I I' f₁ s p := by
   refine TotalSpace.ext _ _ (h p.1 hp) ?_
-  -- This used to be `simp only`, but we need `erw` after leanprover/lean4#2644
-  rw [tangentMapWithin, h p.1 hp, tangentMapWithin, mfderivWithin_congr hs h (h _ hp)]
+  simp only [tangentMapWithin, h p.1 hp, mfderivWithin_congr hs h (h _ hp), HEq.refl]
 #align tangent_map_within_congr tangentMapWithin_congr
 
 theorem Filter.EventuallyEq.mfderiv_eq (hL : f₁ =ᶠ[𝓝 x] f) :
chore: bump toolchain to v4.2.0-rc2 (#7703)

This includes all the changes from #7606.

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

Diff
@@ -901,7 +901,8 @@ theorem tangentMapWithin_congr (h : ∀ x ∈ s, f x = f₁ x) (p : TangentBundl
     (hs : UniqueMDiffWithinAt I s p.1) :
     tangentMapWithin I I' f s p = tangentMapWithin I I' f₁ s p := by
   refine TotalSpace.ext _ _ (h p.1 hp) ?_
-  simp only [tangentMapWithin, h p.1 hp, mfderivWithin_congr hs h (h _ hp), HEq.refl]
+  -- This used to be `simp only`, but we need `erw` after leanprover/lean4#2644
+  rw [tangentMapWithin, h p.1 hp, tangentMapWithin, mfderivWithin_congr hs h (h _ hp)]
 #align tangent_map_within_congr tangentMapWithin_congr
 
 theorem Filter.EventuallyEq.mfderiv_eq (hL : f₁ =ᶠ[𝓝 x] f) :
chore: tidy various files (#6924)
Diff
@@ -316,15 +316,17 @@ section DerivativesProperties
 
 /-! ### Unique differentiability sets in manifolds -/
 
-variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
-  [NormedSpace 𝕜 E] {H : Type*} [TopologicalSpace H] (I : ModelWithCorners 𝕜 E H) {M : Type*}
-  [TopologicalSpace M] [ChartedSpace H M]
-  --
-  {E' : Type*}
-  [NormedAddCommGroup E'] [NormedSpace 𝕜 E'] {H' : Type*} [TopologicalSpace H']
-  {I' : ModelWithCorners 𝕜 E' H'} {M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M']
-  {E'' : Type*} [NormedAddCommGroup E''] [NormedSpace 𝕜 E''] {H'' : Type*} [TopologicalSpace H'']
-  {I'' : ModelWithCorners 𝕜 E'' H''} {M'' : Type*} [TopologicalSpace M''] [ChartedSpace H'' M'']
+variable
+  {𝕜 : Type*} [NontriviallyNormedField 𝕜]
+  {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E]
+  {H : Type*} [TopologicalSpace H] (I : ModelWithCorners 𝕜 E H)
+  {M : Type*} [TopologicalSpace M] [ChartedSpace H M]
+  {E' : Type*} [NormedAddCommGroup E'] [NormedSpace 𝕜 E']
+  {H' : Type*} [TopologicalSpace H'] {I' : ModelWithCorners 𝕜 E' H'}
+  {M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M']
+  {E'' : Type*} [NormedAddCommGroup E''] [NormedSpace 𝕜 E'']
+  {H'' : Type*} [TopologicalSpace H''] {I'' : ModelWithCorners 𝕜 E'' H''}
+  {M'' : Type*} [TopologicalSpace M''] [ChartedSpace H'' M'']
   {f f₀ f₁ : M → M'} {x : M} {s t : Set M} {g : M' → M''} {u : Set M'}
 
 theorem uniqueMDiffWithinAt_univ : UniqueMDiffWithinAt I univ x := by
@@ -1105,7 +1107,7 @@ alias ⟨HasMFDerivAt.hasFDerivAt, HasFDerivAt.hasMFDerivAt⟩ := hasMFDerivAt_i
 #align has_mfderiv_at.has_fderiv_at HasMFDerivAt.hasFDerivAt
 #align has_fderiv_at.has_mfderiv_at HasFDerivAt.hasMFDerivAt
 
-/-- For maps between vector spaces, `MDifferentiableWithinAt` and `fdifferentiable_within_at`
+/-- For maps between vector spaces, `MDifferentiableWithinAt` and `DifferentiableWithinAt`
 coincide -/
 theorem mdifferentiableWithinAt_iff_differentiableWithinAt :
     MDifferentiableWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') f s x ↔ DifferentiableWithinAt 𝕜 f s x := by
@@ -2021,7 +2023,7 @@ variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCom
   {I' : ModelWithCorners 𝕜 E' H'} {M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M']
   [SmoothManifoldWithCorners I' M'] {s : Set M}
 
-/-- If `s` has the unique differential property at `x`, `f` is differetiable within `s` at x` and
+/-- If `s` has the unique differential property at `x`, `f` is differentiable within `s` at x` and
 its derivative has Dense range, then `f '' s` has the Unique differential property at `f x`. -/
 theorem UniqueMDiffWithinAt.image_denseRange (hs : UniqueMDiffWithinAt I s x)
     {f : M → M'} {f' : E →L[𝕜] E'} (hf : HasMFDerivWithinAt I I' f s x f')
@@ -2035,7 +2037,7 @@ theorem UniqueMDiffWithinAt.image_denseRange (hs : UniqueMDiffWithinAt I s x)
     rintro _ ⟨y, ⟨⟨hys, hfy⟩, -⟩, rfl⟩
     exact ⟨⟨_, hys, ((extChartAt I' (f x)).left_inv hfy).symm⟩, mem_range_self _⟩
 
-/-- If `s` has the unique differential, `f` is differetiable on `s` and its derivative at every
+/-- If `s` has the unique differential, `f` is differentiable on `s` and its derivative at every
 point of `s` has dense range, then `f '' s` has the unique differential property. This version
 uses `HaMFDerivWithinAt` predicate. -/
 theorem UniqueMDiffOn.image_denseRange' (hs : UniqueMDiffOn I s) {f : M → M'}
@@ -2044,7 +2046,7 @@ theorem UniqueMDiffOn.image_denseRange' (hs : UniqueMDiffOn I s) {f : M → M'}
     UniqueMDiffOn I' (f '' s) :=
   ball_image_iff.2 fun x hx ↦ (hs x hx).image_denseRange (hf x hx) (hd x hx)
 
-/-- If `s` has the unique differential, `f` is differetiable on `s` and its derivative at every
+/-- If `s` has the unique differential, `f` is differentiable on `s` and its derivative at every
 point of `s` has dense range, then `f '' s` has the unique differential property. -/
 theorem UniqueMDiffOn.image_denseRange (hs : UniqueMDiffOn I s) {f : M → M'}
     (hf : MDifferentiableOn I I' f s) (hd : ∀ x ∈ s, DenseRange (mfderivWithin I I' f s x)) :
chore: cleanup Mathlib.Init.Data.Prod (#6972)

Removing from Mathlib.Init.Data.Prod from the early parts of the import hierarchy.

While at it, remove unnecessary uses of Prod.mk.eta across the library.

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

Diff
@@ -1559,7 +1559,6 @@ theorem mfderiv_prod_eq_add {f : M × M' → M''} {p : M × M'}
         mfderiv (I.prod I') I'' (fun z : M × M' => f (z.1, p.2)) p +
           mfderiv (I.prod I') I'' (fun z : M × M' => f (p.1, z.2)) p := by
   dsimp only
-  rw [← @Prod.mk.eta _ _ p] at hf
   erw [mfderiv_comp_of_eq hf ((mdifferentiableAt_fst I I').prod_mk (mdifferentiableAt_const _ _))
       rfl,
     mfderiv_comp_of_eq hf ((mdifferentiableAt_const _ _).prod_mk (mdifferentiableAt_snd I I')) rfl,
feat: congr(...) congruence quotations and port congrm tactic (#2544)

Adds a term elaborator for congr(...) "congruence quotations". For example, if hf : f = f' and hx : x = x', then we have congr($hf $x) : f x = f' x'. This supports the functions having implicit arguments, and it has support for subsingleton instance arguments. So for example, if s t : Set X are sets with Fintype instances and h : s = t then congr(Fintype.card $h) : Fintype.card s = Fintype.card t works.

Ports the congrm tactic as a convenient frontend for applying a congruence quotation to the goal. Holes are turned into congruence holes. For example, congrm 1 + ?_ uses congr(1 + $(?_)). Placeholders (_) do not turn into congruence holes; that's not to say they have to be identical on the LHS and RHS, but congrm itself is responsible for finding a congruence lemma for such arguments.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Moritz Doll <moritz.doll@googlemail.com>

Diff
@@ -222,8 +222,7 @@ def MDifferentiableAt (f : M → M') (x : M) :=
 
 theorem mdifferentiableAt_iff_liftPropAt (f : M → M') (x : M) :
     MDifferentiableAt I I' f x ↔ LiftPropAt (DifferentiableWithinAtProp I I') f x := by
-  -- porting note: was `congrm ∧`
-  apply Iff.and
+  congrm ?_ ∧ ?_
   · rw [continuousWithinAt_univ]
   · -- porting note: `rfl` wasn't needed
     simp [DifferentiableWithinAtProp, Set.univ_inter]; rfl
chore: remove duplicate lemma HasFDerivWithinAt.nhdsWithin (#6773)

This is a perfect duplicate of HasFDerivWithinAt.mono_of_mem.

Same thing with Deriv instead of FDeriv.

Diff
@@ -505,10 +505,10 @@ theorem HasMFDerivWithinAt.union (hs : HasMFDerivWithinAt I I' f s x f')
     simp only [union_inter_distrib_right, preimage_union]
 #align has_mfderiv_within_at.union HasMFDerivWithinAt.union
 
-theorem HasMFDerivWithinAt.nhdsWithin (h : HasMFDerivWithinAt I I' f s x f') (ht : s ∈ 𝓝[t] x) :
+theorem HasMFDerivWithinAt.mono_of_mem (h : HasMFDerivWithinAt I I' f s x f') (ht : s ∈ 𝓝[t] x) :
     HasMFDerivWithinAt I I' f t x f' :=
   (hasMFDerivWithinAt_inter' ht).1 (h.mono (inter_subset_right _ _))
-#align has_mfderiv_within_at.nhds_within HasMFDerivWithinAt.nhdsWithin
+#align has_mfderiv_within_at.nhds_within HasMFDerivWithinAt.mono_of_mem
 
 theorem HasMFDerivWithinAt.hasMFDerivAt (h : HasMFDerivWithinAt I I' f s x f') (hs : s ∈ 𝓝 x) :
     HasMFDerivAt I I' f x f' := by
feat: patch for new alias command (#6172)
Diff
@@ -1068,8 +1068,8 @@ theorem uniqueMDiffWithinAt_iff_uniqueDiffWithinAt :
   simp only [UniqueMDiffWithinAt, mfld_simps]
 #align unique_mdiff_within_at_iff_unique_diff_within_at uniqueMDiffWithinAt_iff_uniqueDiffWithinAt
 
-alias uniqueMDiffWithinAt_iff_uniqueDiffWithinAt ↔ UniqueMDiffWithinAt.uniqueDiffWithinAt
-  UniqueDiffWithinAt.uniqueMDiffWithinAt
+alias ⟨UniqueMDiffWithinAt.uniqueDiffWithinAt, UniqueDiffWithinAt.uniqueMDiffWithinAt⟩ :=
+  uniqueMDiffWithinAt_iff_uniqueDiffWithinAt
 #align unique_mdiff_within_at.unique_diff_within_at UniqueMDiffWithinAt.uniqueDiffWithinAt
 #align unique_diff_within_at.unique_mdiff_within_at UniqueDiffWithinAt.uniqueMDiffWithinAt
 
@@ -1077,7 +1077,7 @@ theorem uniqueMDiffOn_iff_uniqueDiffOn : UniqueMDiffOn 𝓘(𝕜, E) s ↔ Uniqu
   simp [UniqueMDiffOn, UniqueDiffOn, uniqueMDiffWithinAt_iff_uniqueDiffWithinAt]
 #align unique_mdiff_on_iff_unique_diff_on uniqueMDiffOn_iff_uniqueDiffOn
 
-alias uniqueMDiffOn_iff_uniqueDiffOn ↔ UniqueMDiffOn.uniqueDiffOn UniqueDiffOn.uniqueMDiffOn
+alias ⟨UniqueMDiffOn.uniqueDiffOn, UniqueDiffOn.uniqueMDiffOn⟩ := uniqueMDiffOn_iff_uniqueDiffOn
 #align unique_mdiff_on.unique_diff_on UniqueMDiffOn.uniqueDiffOn
 #align unique_diff_on.unique_mdiff_on UniqueDiffOn.uniqueMDiffOn
 
@@ -1092,8 +1092,8 @@ theorem hasMFDerivWithinAt_iff_hasFDerivWithinAt {f'} :
     HasFDerivWithinAt.continuousWithinAt
 #align has_mfderiv_within_at_iff_has_fderiv_within_at hasMFDerivWithinAt_iff_hasFDerivWithinAt
 
-alias hasMFDerivWithinAt_iff_hasFDerivWithinAt ↔ HasMFDerivWithinAt.hasFDerivWithinAt
-  HasFDerivWithinAt.hasMFDerivWithinAt
+alias ⟨HasMFDerivWithinAt.hasFDerivWithinAt, HasFDerivWithinAt.hasMFDerivWithinAt⟩ :=
+  hasMFDerivWithinAt_iff_hasFDerivWithinAt
 #align has_mfderiv_within_at.has_fderiv_within_at HasMFDerivWithinAt.hasFDerivWithinAt
 #align has_fderiv_within_at.has_mfderiv_within_at HasFDerivWithinAt.hasMFDerivWithinAt
 
@@ -1102,7 +1102,7 @@ theorem hasMFDerivAt_iff_hasFDerivAt {f'} :
   rw [← hasMFDerivWithinAt_univ, hasMFDerivWithinAt_iff_hasFDerivWithinAt, hasFDerivWithinAt_univ]
 #align has_mfderiv_at_iff_has_fderiv_at hasMFDerivAt_iff_hasFDerivAt
 
-alias hasMFDerivAt_iff_hasFDerivAt ↔ HasMFDerivAt.hasFDerivAt HasFDerivAt.hasMFDerivAt
+alias ⟨HasMFDerivAt.hasFDerivAt, HasFDerivAt.hasMFDerivAt⟩ := hasMFDerivAt_iff_hasFDerivAt
 #align has_mfderiv_at.has_fderiv_at HasMFDerivAt.hasFDerivAt
 #align has_fderiv_at.has_mfderiv_at HasFDerivAt.hasMFDerivAt
 
@@ -1114,8 +1114,9 @@ theorem mdifferentiableWithinAt_iff_differentiableWithinAt :
   exact ⟨fun H => H.2, fun H => ⟨H.continuousWithinAt, H⟩⟩
 #align mdifferentiable_within_at_iff_differentiable_within_at mdifferentiableWithinAt_iff_differentiableWithinAt
 
-alias mdifferentiableWithinAt_iff_differentiableWithinAt ↔
-  MDifferentiableWithinAt.differentiableWithinAt DifferentiableWithinAt.mdifferentiableWithinAt
+alias ⟨MDifferentiableWithinAt.differentiableWithinAt,
+    DifferentiableWithinAt.mdifferentiableWithinAt⟩ :=
+  mdifferentiableWithinAt_iff_differentiableWithinAt
 #align mdifferentiable_within_at.differentiable_within_at MDifferentiableWithinAt.differentiableWithinAt
 #align differentiable_within_at.mdifferentiable_within_at DifferentiableWithinAt.mdifferentiableWithinAt
 
@@ -1126,8 +1127,8 @@ theorem mdifferentiableAt_iff_differentiableAt :
   exact ⟨fun H => H.2, fun H => ⟨H.continuousAt, H⟩⟩
 #align mdifferentiable_at_iff_differentiable_at mdifferentiableAt_iff_differentiableAt
 
-alias mdifferentiableAt_iff_differentiableAt ↔ MDifferentiableAt.differentiableAt
-  DifferentiableAt.mdifferentiableAt
+alias ⟨MDifferentiableAt.differentiableAt, DifferentiableAt.mdifferentiableAt⟩ :=
+  mdifferentiableAt_iff_differentiableAt
 #align mdifferentiable_at.differentiable_at MDifferentiableAt.differentiableAt
 #align differentiable_at.mdifferentiable_at DifferentiableAt.mdifferentiableAt
 
@@ -1138,8 +1139,8 @@ theorem mdifferentiableOn_iff_differentiableOn :
     mdifferentiableWithinAt_iff_differentiableWithinAt]
 #align mdifferentiable_on_iff_differentiable_on mdifferentiableOn_iff_differentiableOn
 
-alias mdifferentiableOn_iff_differentiableOn ↔ MDifferentiableOn.differentiableOn
-  DifferentiableOn.mdifferentiableOn
+alias ⟨MDifferentiableOn.differentiableOn, DifferentiableOn.mdifferentiableOn⟩ :=
+  mdifferentiableOn_iff_differentiableOn
 #align mdifferentiable_on.differentiable_on MDifferentiableOn.differentiableOn
 #align differentiable_on.mdifferentiable_on DifferentiableOn.mdifferentiableOn
 
@@ -1149,8 +1150,8 @@ theorem mdifferentiable_iff_differentiable :
   simp only [MDifferentiable, Differentiable, mdifferentiableAt_iff_differentiableAt]
 #align mdifferentiable_iff_differentiable mdifferentiable_iff_differentiable
 
-alias mdifferentiable_iff_differentiable ↔ MDifferentiable.differentiable
-  Differentiable.mdifferentiable
+alias ⟨MDifferentiable.differentiable, Differentiable.mdifferentiable⟩ :=
+  mdifferentiable_iff_differentiable
 #align mdifferentiable.differentiable MDifferentiable.differentiable
 #align differentiable.mdifferentiable Differentiable.mdifferentiable
 
fix: disable autoImplicit globally (#6528)

Autoimplicits are highly controversial and also defeat the performance-improving work in #6474.

The intent of this PR is to make autoImplicit opt-in on a per-file basis, by disabling it in the lakefile and enabling it again with set_option autoImplicit true in the few files that rely on it.

That also keeps this PR small, as opposed to attempting to "fix" files to not need it any more.

I claim that many of the uses of autoImplicit in these files are accidental; situations such as:

  • Assuming variables are in scope, but pasting the lemma in the wrong section
  • Pasting in a lemma from a scratch file without checking to see if the variable names are consistent with the rest of the file
  • Making a copy-paste error between lemmas and forgetting to add an explicit arguments.

Having set_option autoImplicit false as the default prevents these types of mistake being made in the 90% of files where autoImplicits are not used at all, and causes them to be caught by CI during review.

I think there were various points during the port where we encouraged porters to delete the universes u v lines; I think having autoparams for universe variables only would cover a lot of the cases we actually use them, while avoiding any real shortcomings.

A Zulip poll (after combining overlapping votes accordingly) was in favor of this change with 5:5:18 as the no:dontcare:yes vote ratio.

While this PR was being reviewed, a handful of files gained some more likely-accidental autoImplicits. In these places, set_option autoImplicit true has been placed locally within a section, rather than at the top of the file.

Diff
@@ -93,6 +93,8 @@ the space of equivalence classes of smooth curves in the manifold.
 Derivative, manifold
 -/
 
+set_option autoImplicit true
+
 
 noncomputable section
 
@@ -114,7 +116,6 @@ this specific chart.
 We use the names `MDifferentiable` and `mfderiv`, where the prefix letter `m` means "manifold".
 -/
 
-
 variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
   [NormedSpace 𝕜 E] {H : Type*} [TopologicalSpace H] (I : ModelWithCorners 𝕜 E H) {M : Type*}
   [TopologicalSpace M] [ChartedSpace H M] {E' : Type*} [NormedAddCommGroup E'] [NormedSpace 𝕜 E']
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
@@ -115,10 +115,10 @@ We use the names `MDifferentiable` and `mfderiv`, where the prefix letter `m` me
 -/
 
 
-variable {𝕜 : Type _} [NontriviallyNormedField 𝕜] {E : Type _} [NormedAddCommGroup E]
-  [NormedSpace 𝕜 E] {H : Type _} [TopologicalSpace H] (I : ModelWithCorners 𝕜 E H) {M : Type _}
-  [TopologicalSpace M] [ChartedSpace H M] {E' : Type _} [NormedAddCommGroup E'] [NormedSpace 𝕜 E']
-  {H' : Type _} [TopologicalSpace H'] (I' : ModelWithCorners 𝕜 E' H') {M' : Type _}
+variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
+  [NormedSpace 𝕜 E] {H : Type*} [TopologicalSpace H] (I : ModelWithCorners 𝕜 E H) {M : Type*}
+  [TopologicalSpace M] [ChartedSpace H M] {E' : Type*} [NormedAddCommGroup E'] [NormedSpace 𝕜 E']
+  {H' : Type*} [TopologicalSpace H'] (I' : ModelWithCorners 𝕜 E' H') {M' : Type*}
   [TopologicalSpace M'] [ChartedSpace H' M']
 
 /-- Property in the model space of a model with corners of being differentiable within at set at a
@@ -316,15 +316,15 @@ section DerivativesProperties
 
 /-! ### Unique differentiability sets in manifolds -/
 
-variable {𝕜 : Type _} [NontriviallyNormedField 𝕜] {E : Type _} [NormedAddCommGroup E]
-  [NormedSpace 𝕜 E] {H : Type _} [TopologicalSpace H] (I : ModelWithCorners 𝕜 E H) {M : Type _}
+variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
+  [NormedSpace 𝕜 E] {H : Type*} [TopologicalSpace H] (I : ModelWithCorners 𝕜 E H) {M : Type*}
   [TopologicalSpace M] [ChartedSpace H M]
   --
-  {E' : Type _}
-  [NormedAddCommGroup E'] [NormedSpace 𝕜 E'] {H' : Type _} [TopologicalSpace H']
-  {I' : ModelWithCorners 𝕜 E' H'} {M' : Type _} [TopologicalSpace M'] [ChartedSpace H' M']
-  {E'' : Type _} [NormedAddCommGroup E''] [NormedSpace 𝕜 E''] {H'' : Type _} [TopologicalSpace H'']
-  {I'' : ModelWithCorners 𝕜 E'' H''} {M'' : Type _} [TopologicalSpace M''] [ChartedSpace H'' M'']
+  {E' : Type*}
+  [NormedAddCommGroup E'] [NormedSpace 𝕜 E'] {H' : Type*} [TopologicalSpace H']
+  {I' : ModelWithCorners 𝕜 E' H'} {M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M']
+  {E'' : Type*} [NormedAddCommGroup E''] [NormedSpace 𝕜 E''] {H'' : Type*} [TopologicalSpace H'']
+  {I'' : ModelWithCorners 𝕜 E'' H''} {M'' : Type*} [TopologicalSpace M''] [ChartedSpace H'' M'']
   {f f₀ f₁ : M → M'} {x : M} {s t : Set M} {g : M' → M''} {u : Set M'}
 
 theorem uniqueMDiffWithinAt_univ : UniqueMDiffWithinAt I univ x := by
@@ -1058,8 +1058,8 @@ this and related statements.
 -/
 
 
-variable {𝕜 : Type _} [NontriviallyNormedField 𝕜] {E : Type _} [NormedAddCommGroup E]
-  [NormedSpace 𝕜 E] {E' : Type _} [NormedAddCommGroup E'] [NormedSpace 𝕜 E'] {f : E → E'}
+variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
+  [NormedSpace 𝕜 E] {E' : Type*} [NormedAddCommGroup E'] [NormedSpace 𝕜 E'] {f : E → E'}
   {s : Set E} {x : E}
 
 theorem uniqueMDiffWithinAt_iff_uniqueDiffWithinAt :
@@ -1178,13 +1178,13 @@ section SpecificFunctions
 /-! ### Differentiability of specific functions -/
 
 
-variable {𝕜 : Type _} [NontriviallyNormedField 𝕜] {E : Type _} [NormedAddCommGroup E]
-  [NormedSpace 𝕜 E] {H : Type _} [TopologicalSpace H] (I : ModelWithCorners 𝕜 E H) {M : Type _}
-  [TopologicalSpace M] [ChartedSpace H M] [SmoothManifoldWithCorners I M] {E' : Type _}
-  [NormedAddCommGroup E'] [NormedSpace 𝕜 E'] {H' : Type _} [TopologicalSpace H']
-  (I' : ModelWithCorners 𝕜 E' H') {M' : Type _} [TopologicalSpace M'] [ChartedSpace H' M']
-  [SmoothManifoldWithCorners I' M'] {E'' : Type _} [NormedAddCommGroup E''] [NormedSpace 𝕜 E'']
-  {H'' : Type _} [TopologicalSpace H''] (I'' : ModelWithCorners 𝕜 E'' H'') {M'' : Type _}
+variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
+  [NormedSpace 𝕜 E] {H : Type*} [TopologicalSpace H] (I : ModelWithCorners 𝕜 E H) {M : Type*}
+  [TopologicalSpace M] [ChartedSpace H M] [SmoothManifoldWithCorners I M] {E' : Type*}
+  [NormedAddCommGroup E'] [NormedSpace 𝕜 E'] {H' : Type*} [TopologicalSpace H']
+  (I' : ModelWithCorners 𝕜 E' H') {M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M']
+  [SmoothManifoldWithCorners I' M'] {E'' : Type*} [NormedAddCommGroup E''] [NormedSpace 𝕜 E'']
+  {H'' : Type*} [TopologicalSpace H''] (I'' : ModelWithCorners 𝕜 E'' H'') {M'' : Type*}
   [TopologicalSpace M''] [ChartedSpace H'' M''] [SmoothManifoldWithCorners I'' M'']
 
 namespace ContinuousLinearMap
@@ -1687,7 +1687,7 @@ end Group
 
 section AlgebraOverRing
 
-variable {I} {z : M} {F' : Type _} [NormedRing F'] [NormedAlgebra 𝕜 F'] {p q : M → F'}
+variable {I} {z : M} {F' : Type*} [NormedRing F'] [NormedAlgebra 𝕜 F'] {p q : M → F'}
   {p' q' : TangentSpace I z →L[𝕜] F'}
 
 theorem HasMFDerivWithinAt.mul' (hp : HasMFDerivWithinAt I 𝓘(𝕜, F') p s z p')
@@ -1727,7 +1727,7 @@ end AlgebraOverRing
 
 section AlgebraOverCommRing
 
-variable {I} {z : M} {F' : Type _} [NormedCommRing F'] [NormedAlgebra 𝕜 F'] {p q : M → F'}
+variable {I} {z : M} {F' : Type*} [NormedCommRing F'] [NormedAlgebra 𝕜 F'] {p q : M → F'}
   {p' q' : TangentSpace I z →L[𝕜] F'}
 
 theorem HasMFDerivWithinAt.mul (hp : HasMFDerivWithinAt I 𝓘(𝕜, F') p s z p')
@@ -1880,13 +1880,13 @@ end SpecificFunctions
 
 namespace LocalHomeomorph.MDifferentiable
 
-variable {𝕜 : Type _} [NontriviallyNormedField 𝕜] {E : Type _} [NormedAddCommGroup E]
-  [NormedSpace 𝕜 E] {H : Type _} [TopologicalSpace H] {I : ModelWithCorners 𝕜 E H} {M : Type _}
-  [TopologicalSpace M] [ChartedSpace H M] {E' : Type _} [NormedAddCommGroup E'] [NormedSpace 𝕜 E']
-  {H' : Type _} [TopologicalSpace H'] {I' : ModelWithCorners 𝕜 E' H'} {M' : Type _}
-  [TopologicalSpace M'] [ChartedSpace H' M'] {E'' : Type _} [NormedAddCommGroup E'']
-  [NormedSpace 𝕜 E''] {H'' : Type _} [TopologicalSpace H''] {I'' : ModelWithCorners 𝕜 E'' H''}
-  {M'' : Type _} [TopologicalSpace M''] [ChartedSpace H'' M''] {e : LocalHomeomorph M M'}
+variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
+  [NormedSpace 𝕜 E] {H : Type*} [TopologicalSpace H] {I : ModelWithCorners 𝕜 E H} {M : Type*}
+  [TopologicalSpace M] [ChartedSpace H M] {E' : Type*} [NormedAddCommGroup E'] [NormedSpace 𝕜 E']
+  {H' : Type*} [TopologicalSpace H'] {I' : ModelWithCorners 𝕜 E' H'} {M' : Type*}
+  [TopologicalSpace M'] [ChartedSpace H' M'] {E'' : Type*} [NormedAddCommGroup E'']
+  [NormedSpace 𝕜 E''] {H'' : Type*} [TopologicalSpace H''] {I'' : ModelWithCorners 𝕜 E'' H''}
+  {M'' : Type*} [TopologicalSpace M''] [ChartedSpace H'' M''] {e : LocalHomeomorph M M'}
   (he : e.MDifferentiable I I') {e' : LocalHomeomorph M' M''}
 
 nonrec theorem symm : e.symm.MDifferentiable I' I := he.symm
@@ -1984,8 +1984,8 @@ end LocalHomeomorph.MDifferentiable
 
 section extChartAt
 
-variable {𝕜 : Type _} [NontriviallyNormedField 𝕜] {E : Type _} [NormedAddCommGroup E]
-  [NormedSpace 𝕜 E] {H : Type _} [TopologicalSpace H] (I : ModelWithCorners 𝕜 E H) {M : Type _}
+variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
+  [NormedSpace 𝕜 E] {H : Type*} [TopologicalSpace H] (I : ModelWithCorners 𝕜 E H) {M : Type*}
   [TopologicalSpace M] [ChartedSpace H M] [SmoothManifoldWithCorners I M] {s : Set M} {x y : M}
 
 theorem hasMFDerivAt_extChartAt (h : y ∈ (chartAt H x).source) :
@@ -2014,11 +2014,11 @@ end extChartAt
 
 section UniqueMDiff
 
-variable {𝕜 : Type _} [NontriviallyNormedField 𝕜] {E : Type _} [NormedAddCommGroup E]
-  [NormedSpace 𝕜 E] {H : Type _} [TopologicalSpace H] {I : ModelWithCorners 𝕜 E H} {M : Type _}
-  [TopologicalSpace M] [ChartedSpace H M] [SmoothManifoldWithCorners I M] {E' : Type _}
-  [NormedAddCommGroup E'] [NormedSpace 𝕜 E'] {H' : Type _} [TopologicalSpace H']
-  {I' : ModelWithCorners 𝕜 E' H'} {M' : Type _} [TopologicalSpace M'] [ChartedSpace H' M']
+variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
+  [NormedSpace 𝕜 E] {H : Type*} [TopologicalSpace H] {I : ModelWithCorners 𝕜 E H} {M : Type*}
+  [TopologicalSpace M] [ChartedSpace H M] [SmoothManifoldWithCorners I M] {E' : Type*}
+  [NormedAddCommGroup E'] [NormedSpace 𝕜 E'] {H' : Type*} [TopologicalSpace H']
+  {I' : ModelWithCorners 𝕜 E' H'} {M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M']
   [SmoothManifoldWithCorners I' M'] {s : Set M}
 
 /-- If `s` has the unique differential property at `x`, `f` is differetiable within `s` at x` and
@@ -2096,7 +2096,7 @@ theorem UniqueMDiffOn.uniqueDiffOn_inter_preimage (hs : UniqueMDiffOn I s) (x :
 
 open Bundle
 
-variable {F : Type _} [NormedAddCommGroup F] [NormedSpace 𝕜 F] {Z : M → Type _}
+variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] {Z : M → Type*}
   [TopologicalSpace (TotalSpace F Z)] [∀ b, TopologicalSpace (Z b)] [∀ b, AddCommMonoid (Z b)]
   [∀ b, Module 𝕜 (Z b)] [FiberBundle F Z] [VectorBundle 𝕜 F Z] [SmoothVectorBundle F Z I]
 
chore: fix grammar mistakes (#6121)
Diff
@@ -1577,7 +1577,7 @@ section Arithmetic
 
 /-! #### Arithmetic
 
-Note that in the in `HasMFDerivAt` lemmas there is an abuse of the defeq between `E'` and
+Note that in the `HasMFDerivAt` lemmas there is an abuse of the defeq between `E'` and
 `TangentSpace 𝓘(𝕜, E') (f z)` (similarly for `g',F',p',q'`). In general this defeq is not
 canonical, but in this case (the tangent space of a vector space) it is canonical.
  -/
chore: script to replace headers with #align_import statements (#5979)

Open in Gitpod

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

Diff
@@ -2,14 +2,11 @@
 Copyright (c) 2020 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 geometry.manifold.mfderiv
-! leanprover-community/mathlib commit e473c3198bb41f68560cab68a0529c854b618833
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Geometry.Manifold.VectorBundle.Tangent
 
+#align_import geometry.manifold.mfderiv from "leanprover-community/mathlib"@"e473c3198bb41f68560cab68a0529c854b618833"
+
 /-!
 # The derivative of functions between smooth manifolds
 
chore: cleanup whitespace (#5988)

Grepping for [^ .:{-] [^ :] and reviewing the results. Once I started I couldn't stop. :-)

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

Diff
@@ -77,7 +77,7 @@ definition, differentiability implies continuity).
 
 *Warning*: the derivative (even within a subset) is a linear map on the whole tangent space. Suppose
 that one is given a smooth submanifold `N`, and a function which is smooth on `N` (i.e., its
-restriction to the subtype  `N` is smooth). Then, in the whole manifold `M`, the property
+restriction to the subtype `N` is smooth). Then, in the whole manifold `M`, the property
 `MDifferentiableOn I I' f N` holds. However, `mfderivWithin I I' f N` is not uniquely defined
 (what values would one choose for vectors that are transverse to `N`?), which can create issues down
 the road. The problem here is that knowing the value of `f` along `N` does not determine the
@@ -658,7 +658,7 @@ theorem mdifferentiableAt_iff_of_mem_source {x' : M} {y : M'}
 theorem ContMDiffWithinAt.mdifferentiableWithinAt (hf : ContMDiffWithinAt I I' n f s x)
     (hn : 1 ≤ n) : MDifferentiableWithinAt I I' f s x := by
   suffices h : MDifferentiableWithinAt I I' f (s ∩ f ⁻¹' (extChartAt I' (f x)).source) x
-  · rwa [mdifferentiableWithinAt_inter'] at h 
+  · rwa [mdifferentiableWithinAt_inter'] at h
     apply hf.1.preimage_mem_nhdsWithin
     exact extChartAt_source_mem_nhds I' (f x)
   rw [mdifferentiableWithinAt_iff]
refactor: redefine Bundle.TotalSpace (#5720)

Forward-port leanprover-community/mathlib#19221

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 geometry.manifold.mfderiv
-! leanprover-community/mathlib commit e354e865255654389cc46e6032160238df2e0f40
+! leanprover-community/mathlib commit e473c3198bb41f68560cab68a0529c854b618833
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -756,21 +756,11 @@ theorem tangentMapWithin_proj {p : TangentBundle I M} :
   rfl
 #align tangent_map_within_proj tangentMapWithin_proj
 
-@[simp, mfld_simps]
-theorem tangentMapWithin_fst {p : TangentBundle I M} : (tangentMapWithin I I' f s p).1 = f p.1 :=
-  rfl
-#align tangent_map_within_fst tangentMapWithin_fst
-
 @[simp, mfld_simps]
 theorem tangentMap_proj {p : TangentBundle I M} : (tangentMap I I' f p).proj = f p.proj :=
   rfl
 #align tangent_map_proj tangentMap_proj
 
-@[simp, mfld_simps]
-theorem tangentMap_fst {p : TangentBundle I M} : (tangentMap I I' f p).1 = f p.1 :=
-  rfl
-#align tangent_map_fst tangentMap_fst
-
 theorem MDifferentiableWithinAt.prod_mk {f : M → M'} {g : M → M''}
     (hf : MDifferentiableWithinAt I I' f s x) (hg : MDifferentiableWithinAt I I'' g s x) :
     MDifferentiableWithinAt I (I'.prod I'') (fun x => (f x, g x)) s x :=
@@ -911,8 +901,8 @@ theorem mfderivWithin_congr (hs : UniqueMDiffWithinAt I s x) (hL : ∀ x ∈ s,
 theorem tangentMapWithin_congr (h : ∀ x ∈ s, f x = f₁ x) (p : TangentBundle I M) (hp : p.1 ∈ s)
     (hs : UniqueMDiffWithinAt I s p.1) :
     tangentMapWithin I I' f s p = tangentMapWithin I I' f₁ s p := by
-  refine Sigma.ext (h p.1 hp) ?_
-  simp only [tangentMapWithin, h p.fst hp, mfderivWithin_congr hs h (h _ hp), HEq.refl]
+  refine TotalSpace.ext _ _ (h p.1 hp) ?_
+  simp only [tangentMapWithin, h p.1 hp, mfderivWithin_congr hs h (h _ hp), HEq.refl]
 #align tangent_map_within_congr tangentMapWithin_congr
 
 theorem Filter.EventuallyEq.mfderiv_eq (hL : f₁ =ᶠ[𝓝 x] f) :
@@ -1448,14 +1438,14 @@ theorem mfderivWithin_fst {s : Set (M × M')} {x : M × M'}
 
 @[simp, mfld_simps]
 theorem tangentMap_prod_fst {p : TangentBundle (I.prod I') (M × M')} :
-    tangentMap (I.prod I') I Prod.fst p = totalSpaceMk p.proj.1 p.2.1 := by
+    tangentMap (I.prod I') I Prod.fst p = ⟨p.proj.1, p.2.1⟩ := by
   -- porting note: `rfl` wasn't needed
   simp [tangentMap]; rfl
 #align tangent_map_prod_fst tangentMap_prod_fst
 
 theorem tangentMapWithin_prod_fst {s : Set (M × M')} {p : TangentBundle (I.prod I') (M × M')}
     (hs : UniqueMDiffWithinAt (I.prod I') s p.proj) :
-    tangentMapWithin (I.prod I') I Prod.fst s p = totalSpaceMk p.proj.1 p.2.1 := by
+    tangentMapWithin (I.prod I') I Prod.fst s p = ⟨p.proj.1, p.2.1⟩ := by
   simp only [tangentMapWithin]
   rw [mfderivWithin_fst]
   · rcases p with ⟨⟩; rfl
@@ -1520,14 +1510,14 @@ theorem mfderivWithin_snd {s : Set (M × M')} {x : M × M'}
 
 @[simp, mfld_simps]
 theorem tangentMap_prod_snd {p : TangentBundle (I.prod I') (M × M')} :
-    tangentMap (I.prod I') I' Prod.snd p = totalSpaceMk p.proj.2 p.2.2 := by
+    tangentMap (I.prod I') I' Prod.snd p = ⟨p.proj.2, p.2.2⟩ := by
   -- porting note: `rfl` wasn't needed
   simp [tangentMap]; rfl
 #align tangent_map_prod_snd tangentMap_prod_snd
 
 theorem tangentMapWithin_prod_snd {s : Set (M × M')} {p : TangentBundle (I.prod I') (M × M')}
     (hs : UniqueMDiffWithinAt (I.prod I') s p.proj) :
-    tangentMapWithin (I.prod I') I' Prod.snd s p = totalSpaceMk p.proj.2 p.2.2 := by
+    tangentMapWithin (I.prod I') I' Prod.snd s p = ⟨p.proj.2, p.2.2⟩ := by
   simp only [tangentMapWithin]
   rw [mfderivWithin_snd]
   · rcases p with ⟨⟩; rfl
@@ -1861,7 +1851,7 @@ theorem mdifferentiable_chart (x : M) : (chartAt H x).MDifferentiable I I :=
 the identification between the tangent bundle of the model space and the product space. -/
 theorem tangentMap_chart {p q : TangentBundle I M} (h : q.1 ∈ (chartAt H p.1).source) :
     tangentMap I I (chartAt H p.1) q =
-      (Equiv.sigmaEquivProd _ _).symm
+      (TotalSpace.toProd _ _).symm
         ((chartAt (ModelProd H E) p : TangentBundle I M → ModelProd H E) q) := by
   dsimp [tangentMap]
   rw [MDifferentiableAt.mfderiv]
@@ -1875,14 +1865,9 @@ the product space. -/
 theorem tangentMap_chart_symm {p : TangentBundle I M} {q : TangentBundle I H}
     (h : q.1 ∈ (chartAt H p.1).target) :
     tangentMap I I (chartAt H p.1).symm q =
-      (chartAt (ModelProd H E) p).symm ((Equiv.sigmaEquivProd H E) q) := by
+      (chartAt (ModelProd H E) p).symm (TotalSpace.toProd H E q) := by
   dsimp only [tangentMap]
   rw [MDifferentiableAt.mfderiv (mdifferentiableAt_atlas_symm _ (chart_mem_atlas _ _) h)]
-  /- porting note: was
-  simp only [ContinuousLinearMap.coe_coe, TangentBundle.chartAt, h, tangentBundleCore, chartAt,
-    Sigma.mk.inj_iff, mfld_simps]
-  -/
-  refine congr_arg (Sigma.mk _) ?_
   simp only [ContinuousLinearMap.coe_coe, TangentBundle.chartAt, h, tangentBundleCore,
     mfld_simps, (· ∘ ·)]
   -- `simp` fails to apply `LocalEquiv.prod_symm` with `ModelProd`
@@ -2115,15 +2100,16 @@ theorem UniqueMDiffOn.uniqueDiffOn_inter_preimage (hs : UniqueMDiffOn I s) (x :
 open Bundle
 
 variable {F : Type _} [NormedAddCommGroup F] [NormedSpace 𝕜 F] {Z : M → Type _}
-  [TopologicalSpace (TotalSpace Z)] [∀ b, TopologicalSpace (Z b)] [∀ b, AddCommMonoid (Z b)]
+  [TopologicalSpace (TotalSpace F Z)] [∀ b, TopologicalSpace (Z b)] [∀ b, AddCommMonoid (Z b)]
   [∀ b, Module 𝕜 (Z b)] [FiberBundle F Z] [VectorBundle 𝕜 F Z] [SmoothVectorBundle F Z I]
 
-theorem Trivialization.mdifferentiable (e : Trivialization F (π Z)) [MemTrivializationAtlas e] :
+theorem Trivialization.mdifferentiable (e : Trivialization F (π F Z)) [MemTrivializationAtlas e] :
     e.toLocalHomeomorph.MDifferentiable (I.prod 𝓘(𝕜, F)) (I.prod 𝓘(𝕜, F)) :=
   ⟨(e.smoothOn I).mdifferentiableOn, (e.smoothOn_symm I).mdifferentiableOn⟩
 
-theorem UniqueMDiffWithinAt.smooth_bundle_preimage {p : TotalSpace Z}
-    (hs : UniqueMDiffWithinAt I s p.proj) : UniqueMDiffWithinAt (I.prod 𝓘(𝕜, F)) (π Z ⁻¹' s) p := by
+theorem UniqueMDiffWithinAt.smooth_bundle_preimage {p : TotalSpace F Z}
+    (hs : UniqueMDiffWithinAt I s p.proj) :
+    UniqueMDiffWithinAt (I.prod 𝓘(𝕜, F)) (π F Z ⁻¹' s) p := by
   set e := trivializationAt F Z p.proj
   have hp : p ∈ e.source := FiberBundle.mem_trivializationAt_proj_source
   have : UniqueMDiffWithinAt (I.prod 𝓘(𝕜, F)) (s ×ˢ univ) (e p)
@@ -2137,20 +2123,20 @@ theorem UniqueMDiffWithinAt.smooth_bundle_preimage {p : TotalSpace Z}
 variable (Z)
 
 theorem UniqueMDiffWithinAt.smooth_bundle_preimage' {b : M} (hs : UniqueMDiffWithinAt I s b)
-    (x : Z b) : UniqueMDiffWithinAt (I.prod 𝓘(𝕜, F)) (π Z ⁻¹' s) (totalSpaceMk b x) :=
-  hs.smooth_bundle_preimage (p := totalSpaceMk b x)
+    (x : Z b) : UniqueMDiffWithinAt (I.prod 𝓘(𝕜, F)) (π F Z ⁻¹' s) ⟨b, x⟩ :=
+  hs.smooth_bundle_preimage (p := ⟨b, x⟩)
 
 /-- In a smooth fiber bundle, the preimage under the projection of a set with
 unique differential in the basis also has unique differential. -/
 theorem UniqueMDiffOn.smooth_bundle_preimage (hs : UniqueMDiffOn I s) :
-    UniqueMDiffOn (I.prod 𝓘(𝕜, F)) (π Z ⁻¹' s) := fun _p hp ↦
+    UniqueMDiffOn (I.prod 𝓘(𝕜, F)) (π F Z ⁻¹' s) := fun _p hp ↦
   (hs _ hp).smooth_bundle_preimage
 #align unique_mdiff_on.smooth_bundle_preimage UniqueMDiffOn.smooth_bundle_preimage
 
 /-- The preimage under the projection from the tangent bundle of a set with unique differential in
 the basis also has unique differential. -/
 theorem UniqueMDiffOn.tangentBundle_proj_preimage (hs : UniqueMDiffOn I s) :
-    UniqueMDiffOn I.tangent (π (TangentSpace I) ⁻¹' s) :=
+    UniqueMDiffOn I.tangent (π E (TangentSpace I) ⁻¹' s) :=
   hs.smooth_bundle_preimage _
 #align unique_mdiff_on.tangent_bundle_proj_preimage UniqueMDiffOn.tangentBundle_proj_preimage
 
chore: remove occurrences of semicolon after space (#5713)

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

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

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

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

Diff
@@ -176,7 +176,7 @@ theorem differentiable_within_at_localInvariantProp :
       have := (mem_groupoid_of_pregroupoid.2 he').1.contDiffWithinAt A
       convert (this.differentiableWithinAt le_top).comp _ h _
       · ext y; simp only [mfld_simps]
-      · intro y hy; simp only [mfld_simps] at hy ; simpa only [hy, mfld_simps] using hs hy.1 }
+      · intro y hy; simp only [mfld_simps] at hy; simpa only [hy, mfld_simps] using hs hy.1 }
 #align differentiable_within_at_local_invariant_prop differentiable_within_at_localInvariantProp
 
 /-- Predicate ensuring that, at a point and within a set, a function can have at most one
@@ -1671,7 +1671,7 @@ theorem mfderiv_neg (f : M → E') (x : M) :
   simp_rw [mfderiv]
   by_cases hf : MDifferentiableAt I 𝓘(𝕜, E') f x
   · exact hf.hasMFDerivAt.neg.mfderiv
-  · rw [if_neg hf]; rw [← mdifferentiableAt_neg] at hf ; rw [if_neg hf, neg_zero]
+  · rw [if_neg hf]; rw [← mdifferentiableAt_neg] at hf; rw [if_neg hf, neg_zero]
 #align mfderiv_neg mfderiv_neg
 
 theorem HasMFDerivAt.sub (hf : HasMFDerivAt I 𝓘(𝕜, E') f z f')
feat: add MDifferentiableOn.mdifferentiableAt (#5510)
Diff
@@ -602,6 +602,10 @@ theorem MDifferentiableWithinAt.mdifferentiableAt (h : MDifferentiableWithinAt I
   rwa [this, mdifferentiableWithinAt_inter hs, mdifferentiableWithinAt_univ] at h
 #align mdifferentiable_within_at.mdifferentiable_at MDifferentiableWithinAt.mdifferentiableAt
 
+theorem MDifferentiableOn.mdifferentiableAt (h : MDifferentiableOn I I' f s) (hx : s ∈ 𝓝 x) :
+    MDifferentiableAt I I' f x :=
+  (h x (mem_of_mem_nhds hx)).mdifferentiableAt hx
+
 theorem MDifferentiableOn.mono (h : MDifferentiableOn I I' f t) (st : s ⊆ t) :
     MDifferentiableOn I I' f s := fun x hx => (h x (st hx)).mono st
 #align mdifferentiable_on.mono MDifferentiableOn.mono
feat: port Geometry.Manifold.Mfderiv (#5454)

Dependencies 12 + 886

887 files ported (98.7%)
397625 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