geometry.manifold.cont_mdiffMathlib.Geometry.Manifold.ContMDiff.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)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -413,7 +413,7 @@ theorem contMDiffWithinAt_iff_target :
     ContMDiffWithinAt I I' n f s x ↔
       ContinuousWithinAt f s x ∧ ContMDiffWithinAt I 𝓘(𝕜, E') n (extChartAt I' (f x) ∘ f) s x :=
   by
-  simp_rw [ContMDiffWithinAt, lift_prop_within_at, ← and_assoc']
+  simp_rw [ContMDiffWithinAt, lift_prop_within_at, ← and_assoc]
   have cont :
     ContinuousWithinAt f s x ∧ ContinuousWithinAt (extChartAt I' (f x) ∘ f) s x ↔
       ContinuousWithinAt f s x :=
Diff
@@ -142,7 +142,7 @@ theorem contDiffWithinAt_localInvariantProp (n : ℕ∞) :
       intro s x f e he hx h
       rw [ContDiffWithinAtProp] 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 ∩ range I := by simp only [hx, mfld_simps]
       have := ((mem_groupoid_of_pregroupoid.2 he).2.ContDiffWithinAt this).of_le le_top
       convert (h.comp' _ this).mono_of_mem _ using 1
@@ -156,7 +156,7 @@ theorem contDiffWithinAt_localInvariantProp (n : ℕ∞) :
       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
@@ -167,7 +167,7 @@ theorem contDiffWithinAt_localInvariantProp (n : ℕ∞) :
       have := ((mem_groupoid_of_pregroupoid.2 he').1.ContDiffWithinAt A).of_le le_top
       convert this.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 cont_diff_within_at_local_invariant_prop contDiffWithinAt_localInvariantProp
 -/
 
@@ -514,8 +514,8 @@ theorem contMDiffWithinAt_iff_of_mem_source' {x' : M} {y : M'} (hx : x' ∈ (cha
           (extChartAt I x x') :=
   by
   refine' (contMDiffWithinAt_iff_of_mem_source hx hy).trans _
-  rw [← extChartAt_source I] at hx 
-  rw [← extChartAt_source I'] at hy 
+  rw [← extChartAt_source I] at hx
+  rw [← extChartAt_source I'] at hy
   rw [and_congr_right_iff]
   set e := extChartAt I x; set e' := extChartAt I' (f x)
   refine' fun hc => contDiffWithinAt_congr_nhds _
@@ -550,7 +550,7 @@ theorem contMDiffWithinAt_iff_target_of_mem_source {x : M} {y : M'}
   intro hf
   simp_rw [StructureGroupoid.liftPropWithinAt_self_target]
   simp_rw [((chart_at H' y).ContinuousAt hy).comp_continuousWithinAt hf]
-  rw [← extChartAt_source I'] at hy 
+  rw [← extChartAt_source I'] at hy
   simp_rw [(continuousAt_extChartAt' I' _ hy).comp_continuousWithinAt hf]
   rfl
 #align cont_mdiff_within_at_iff_target_of_mem_source contMDiffWithinAt_iff_target_of_mem_source
@@ -573,7 +573,7 @@ theorem contMDiffWithinAt_iff_source_of_mem_maximalAtlas (he : e ∈ maximalAtla
       ContMDiffWithinAt 𝓘(𝕜, E) I' n (f ∘ (e.extend I).symm) ((e.extend I).symm ⁻¹' s ∩ range I)
         (e.extend I x) :=
   by
-  have h2x := hx; rw [← e.extend_source I] at h2x 
+  have h2x := hx; rw [← e.extend_source I] at h2x
   simp_rw [ContMDiffWithinAt,
     (contDiffWithinAt_localInvariantProp I I' n).liftPropWithinAt_indep_chart_source he hx,
     StructureGroupoid.liftPropWithinAt_self_source,
@@ -607,7 +607,7 @@ theorem contMDiffOn_iff_of_mem_maximalAtlas (he : e ∈ maximalAtlas I M)
     ContMDiffOn I I' n f s ↔
       ContinuousOn f s ∧ ContDiffOn 𝕜 n (e'.extend I' ∘ f ∘ (e.extend I).symm) (e.extend I '' s) :=
   by
-  simp_rw [ContinuousOn, ContDiffOn, Set.ball_image_iff, ← forall_and, ContMDiffOn]
+  simp_rw [ContinuousOn, ContDiffOn, Set.forall_mem_image, ← forall_and, ContMDiffOn]
   exact forall₂_congr fun x hx => contMDiffWithinAt_iff_image he he' hs (hs hx) (h2s hx)
 #align cont_mdiff_on_iff_of_mem_maximal_atlas contMDiffOn_iff_of_mem_maximalAtlas
 -/
@@ -642,7 +642,7 @@ theorem contMDiffOn_iff :
   constructor
   · intro h
     refine' ⟨fun x hx => (h x hx).1, fun x y z hz => _⟩
-    simp only [mfld_simps] at hz 
+    simp only [mfld_simps] at hz
     let w := (extChartAt I x).symm z
     have : w ∈ s := by simp only [w, hz, mfld_simps]
     specialize h w this
@@ -977,7 +977,7 @@ theorem SmoothOn.smoothAt (h : SmoothOn I I' f s) (hx : s ∈ 𝓝 x) : SmoothAt
 theorem contMDiffOn_iff_source_of_mem_maximalAtlas (he : e ∈ maximalAtlas I M) (hs : s ⊆ e.source) :
     ContMDiffOn I I' n f s ↔ ContMDiffOn 𝓘(𝕜, E) I' n (f ∘ (e.extend I).symm) (e.extend I '' s) :=
   by
-  simp_rw [ContMDiffOn, Set.ball_image_iff]
+  simp_rw [ContMDiffOn, Set.forall_mem_image]
   refine' forall₂_congr fun x hx => _
   rw [contMDiffWithinAt_iff_source_of_mem_maximalAtlas he (hs hx)]
   apply contMDiffWithinAt_congr_nhds
@@ -1008,7 +1008,7 @@ theorem contMDiffWithinAt_iff_contMDiffOn_nhds {n : ℕ} :
       · intro y hy; exact hy.2
       · intro y hy; exact hu ⟨hy.1.1, hy.2⟩
     have h' : ContMDiffWithinAt I I' n f (s ∩ o) x := h.mono (inter_subset_left _ _)
-    simp only [ContMDiffWithinAt, lift_prop_within_at, ContDiffWithinAtProp] at h' 
+    simp only [ContMDiffWithinAt, lift_prop_within_at, ContDiffWithinAtProp] at h'
     -- let `u` be a good neighborhood in the chart where the function is smooth
     rcases h.2.ContDiffOn le_rfl with ⟨u, u_nhds, u_subset, hu⟩
     -- pull it back to the manifold, and intersect with a suitable neighborhood of `x`, to get the
@@ -1051,7 +1051,7 @@ theorem contMDiffWithinAt_iff_contMDiffOn_nhds {n : ℕ} :
       refine' (contMDiffWithinAt_iff_of_mem_source' (v_incl hy) (v_incl' y hy)).mpr ⟨this, _⟩
       · apply hu.mono
         · intro z hz
-          simp only [v, mfld_simps] at hz 
+          simp only [v, mfld_simps] at hz
           have : I ((chart_at H x) ((chart_at H x).symm (I.symm z))) ∈ u := by simp only [hz]
           simpa only [hz, mfld_simps] using this
         · have exty : I (chart_at H x y) ∈ u := hy.2
@@ -1060,7 +1060,7 @@ theorem contMDiffWithinAt_iff_contMDiffOn_nhds {n : ℕ} :
     have : ContMDiffWithinAt I I' (↑n) f (insert x s ∩ u) x :=
       haveI : x ∈ insert x s := mem_insert x s
       hu.mono (inter_subset_right _ _) _ ⟨this, mem_of_mem_nhdsWithin this u_nhds⟩
-    rw [contMDiffWithinAt_inter' u_nhds] at this 
+    rw [contMDiffWithinAt_inter' u_nhds] at this
     exact this.mono (subset_insert x s)
 #align cont_mdiff_within_at_iff_cont_mdiff_on_nhds contMDiffWithinAt_iff_contMDiffOn_nhds
 -/
@@ -1182,7 +1182,7 @@ theorem ContMDiffWithinAt.comp {t : Set M'} {g : M' → M''} (x : M)
   set e' := extChartAt I' (f x)
   set e'' := extChartAt I'' (g (f x))
   have : e' (f x) = (writtenInExtChartAt I I' x f) (e x) := by simp only [e, e', mfld_simps]
-  rw [this] at hg 
+  rw [this] at hg
   have A :
     ∀ᶠ y in 𝓝[e.symm ⁻¹' s ∩ range I] e x,
       y ∈ e.target ∧ f (e.symm y) ∈ t ∧ f (e.symm y) ∈ e'.source ∧ g (f (e.symm y)) ∈ e''.source :=
@@ -1779,7 +1779,7 @@ theorem ContDiffWithinAt.comp_contMDiffWithinAt {g : F → F'} {f : M → F} {s
   by
   rw [contMDiffWithinAt_iff] at *
   refine' ⟨hg.continuous_within_at.comp hf.1 h, _⟩
-  rw [← (extChartAt I x).left_inv (mem_extChartAt_source I x)] at hg 
+  rw [← (extChartAt I x).left_inv (mem_extChartAt_source I x)] at hg
   apply ContDiffWithinAt.comp _ hg hf.2 _
   exact (inter_subset_left _ _).trans (preimage_mono h)
 #align cont_diff_within_at.comp_cont_mdiff_within_at ContDiffWithinAt.comp_contMDiffWithinAt
@@ -1936,7 +1936,7 @@ theorem contMDiffWithinAt_fst {s : Set (M × N)} {p : M × N} :
   rw [contMDiffWithinAt_iff']
   refine' ⟨continuousWithinAt_fst, _⟩
   refine' cont_diff_within_at_fst.congr (fun y hy => _) _
-  · simp only [mfld_simps] at hy 
+  · simp only [mfld_simps] at hy
     simp only [hy, mfld_simps]
   · simp only [mfld_simps]
 #align cont_mdiff_within_at_fst contMDiffWithinAt_fst
@@ -2026,7 +2026,7 @@ theorem contMDiffWithinAt_snd {s : Set (M × N)} {p : M × N} :
   rw [contMDiffWithinAt_iff']
   refine' ⟨continuousWithinAt_snd, _⟩
   refine' cont_diff_within_at_snd.congr (fun y hy => _) _
-  · simp only [mfld_simps] at hy 
+  · simp only [mfld_simps] at hy
     simp only [hy, mfld_simps]
   · simp only [mfld_simps]
 #align cont_mdiff_within_at_snd contMDiffWithinAt_snd
@@ -2551,7 +2551,7 @@ theorem isLocalStructomorphOn_contDiffGroupoid_iff_aux {f : PartialHomeomorph M
     mfld_set_tac
   have H₂ : eq_on f (c'.symm ∘ e ∘ c) s := by
     intro y hy
-    simp only [mfld_simps] at hy 
+    simp only [mfld_simps] at hy
     have hy₁ : f y ∈ c'.source := by simp only [hy, mfld_simps]
     have hy₂ : y ∈ c.source := by simp only [hy, mfld_simps]
     have hy₃ : c y ∈ c.symm ⁻¹' f.source ∩ e.source := by simp only [hy, mfld_simps]
@@ -2595,7 +2595,7 @@ theorem isLocalStructomorphOn_contDiffGroupoid_iff (f : PartialHomeomorph M M')
       have h2 : ⇑c' ∘ ⇑f ∘ ⇑c.symm = ⇑(c.symm ≫ₕ f ≫ₕ c') := rfl
       have hcx : c x ∈ c.symm ⁻¹' f.source := by simp only [hx, mfld_simps]
       rw [h2]
-      rw [← h1, h2, PartialHomeomorph.isLocalStructomorphWithinAt_iff'] at hxf 
+      rw [← h1, h2, PartialHomeomorph.isLocalStructomorphWithinAt_iff'] at hxf
       · exact hxf hcx
       · mfld_set_tac
       · apply Or.inl
@@ -2617,7 +2617,7 @@ theorem isLocalStructomorphOn_contDiffGroupoid_iff (f : PartialHomeomorph M M')
         by
         intro x hx; rw [← e.right_inv hx, ← hef (e.symm.maps_to hx)]
         exact PartialHomeomorph.mapsTo _ (h2e <| e.symm.maps_to hx)
-      rw [inter_self] at h1 
+      rw [inter_self] at h1
       rwa [inter_eq_right_iff_subset.mpr]
       refine' h2.trans _
       mfld_set_tac
@@ -2636,7 +2636,7 @@ theorem isLocalStructomorphOn_contDiffGroupoid_iff (f : PartialHomeomorph M M')
     refine' ⟨(c.symm.trans f).trans c', ⟨_, _⟩, (_ : eq_on (c' ∘ f ∘ c.symm) _ _), _⟩
     · -- smoothness of the candidate local structomorphism in the forward direction
       intro y hy
-      simp only [mfld_simps] at hy 
+      simp only [mfld_simps] at hy
       have H : ContMDiffWithinAt I I ⊤ f (f ≫ₕ c').source ((extChartAt I x).symm y) :=
         by
         refine' (h₁ ((extChartAt I x).symm y) _).mono _
@@ -2644,7 +2644,7 @@ theorem isLocalStructomorphOn_contDiffGroupoid_iff (f : PartialHomeomorph M M')
         · mfld_set_tac
       have hy' : (extChartAt I x).symm y ∈ c.source := by simp only [hy, mfld_simps]
       have hy'' : f ((extChartAt I x).symm y) ∈ c'.source := by simp only [hy, mfld_simps]
-      rw [contMDiffWithinAt_iff_of_mem_source hy' hy''] at H 
+      rw [contMDiffWithinAt_iff_of_mem_source hy' hy''] at H
       · convert H.2.mono _
         · simp only [hy, mfld_simps]
         · mfld_set_tac
@@ -2652,7 +2652,7 @@ theorem isLocalStructomorphOn_contDiffGroupoid_iff (f : PartialHomeomorph M M')
       · infer_instance
     · -- smoothness of the candidate local structomorphism in the reverse direction
       intro y hy
-      simp only [mfld_simps] at hy 
+      simp only [mfld_simps] at hy
       have H : ContMDiffWithinAt I I ⊤ f.symm (f.symm ≫ₕ c).source ((extChartAt I (f x)).symm y) :=
         by
         refine' (h₂ ((extChartAt I (f x)).symm y) _).mono _
@@ -2660,7 +2660,7 @@ theorem isLocalStructomorphOn_contDiffGroupoid_iff (f : PartialHomeomorph M M')
         · mfld_set_tac
       have hy' : (extChartAt I (f x)).symm y ∈ c'.source := by simp only [hy, mfld_simps]
       have hy'' : f.symm ((extChartAt I (f x)).symm y) ∈ c.source := by simp only [hy, mfld_simps]
-      rw [contMDiffWithinAt_iff_of_mem_source hy' hy''] at H 
+      rw [contMDiffWithinAt_iff_of_mem_source hy' hy''] at H
       · convert H.2.mono _
         · simp only [hy, mfld_simps]
         · mfld_set_tac
Diff
@@ -671,7 +671,7 @@ theorem contMDiffOn_iff_target :
   by
   inhabit E'
   simp only [contMDiffOn_iff, ModelWithCorners.source_eq, chartAt_self_eq,
-    PartialHomeomorph.refl_localEquiv, PartialEquiv.refl_trans, extChartAt,
+    PartialHomeomorph.refl_partialEquiv, PartialEquiv.refl_trans, extChartAt,
     PartialHomeomorph.extend, Set.preimage_univ, Set.inter_univ, and_congr_right_iff]
   intro h
   constructor
Diff
@@ -1679,15 +1679,15 @@ theorem smoothWithinAt_one [One M'] : SmoothWithinAt I I' (1 : M → M') s x :=
 
 end id
 
-#print contMDiff_of_support /-
-theorem contMDiff_of_support {f : M → F} (hf : ∀ x ∈ tsupport f, ContMDiffAt I 𝓘(𝕜, F) n f x) :
+#print contMDiff_of_tsupport /-
+theorem contMDiff_of_tsupport {f : M → F} (hf : ∀ x ∈ tsupport f, ContMDiffAt I 𝓘(𝕜, F) n f x) :
     ContMDiff I 𝓘(𝕜, F) n f := by
   intro x
   by_cases hx : x ∈ tsupport f
   · exact hf x hx
   · refine' ContMDiffAt.congr_of_eventuallyEq _ (eventuallyEq_zero_nhds.2 hx)
     exact contMDiffAt_const
-#align cont_mdiff_of_support contMDiff_of_support
+#align cont_mdiff_of_support contMDiff_of_tsupport
 -/
 
 /-! ### The inclusion map from one open set to another is smooth -/
Diff
@@ -424,8 +424,8 @@ theorem contMDiffWithinAt_iff_target :
     exact
       inter_mem self_mem_nhdsWithin
         (h.preimage_mem_nhds_within <| (chart_at _ _).open_source.mem_nhds <| mem_chart_source _ _)
-  simp_rw [Cont, ContDiffWithinAtProp, extChartAt, PartialHomeomorph.extend, LocalEquiv.coe_trans,
-    ModelWithCorners.toLocalEquiv_coe, PartialHomeomorph.coe_coe, modelWithCornersSelf_coe,
+  simp_rw [Cont, ContDiffWithinAtProp, extChartAt, PartialHomeomorph.extend, PartialEquiv.coe_trans,
+    ModelWithCorners.toPartialEquiv_coe, PartialHomeomorph.coe_coe, modelWithCornersSelf_coe,
     chartAt_self_eq, PartialHomeomorph.refl_apply, comp.left_id]
 #align cont_mdiff_within_at_iff_target contMDiffWithinAt_iff_target
 -/
@@ -671,8 +671,8 @@ theorem contMDiffOn_iff_target :
   by
   inhabit E'
   simp only [contMDiffOn_iff, ModelWithCorners.source_eq, chartAt_self_eq,
-    PartialHomeomorph.refl_localEquiv, LocalEquiv.refl_trans, extChartAt, PartialHomeomorph.extend,
-    Set.preimage_univ, Set.inter_univ, and_congr_right_iff]
+    PartialHomeomorph.refl_localEquiv, PartialEquiv.refl_trans, extChartAt,
+    PartialHomeomorph.extend, Set.preimage_univ, Set.inter_univ, and_congr_right_iff]
   intro h
   constructor
   · refine' fun h' y => ⟨_, fun x _ => h' x y⟩
@@ -1474,7 +1474,7 @@ theorem contMDiffOn_extend_symm (he : e ∈ maximalAtlas I M) :
   by
   have h2 := contMDiffOn_symm_of_mem_maximalAtlas he
   refine' h2.comp (cont_mdiff_on_model_symm.mono <| image_subset_range _ _) _
-  simp_rw [image_subset_iff, LocalEquiv.restr_coe_symm, I.to_local_equiv_coe_symm,
+  simp_rw [image_subset_iff, PartialEquiv.restr_coe_symm, I.to_local_equiv_coe_symm,
     preimage_preimage, I.left_inv, preimage_id']
 #align cont_mdiff_on_extend_symm contMDiffOn_extend_symm
 -/
@@ -2269,7 +2269,7 @@ theorem contMDiffWithinAt_pi_space :
       ∀ i, ContMDiffWithinAt I 𝓘(𝕜, Fi i) n (fun x => φ x i) s x :=
   by
   simp only [contMDiffWithinAt_iff, continuousWithinAt_pi, contDiffWithinAt_pi, forall_and,
-    writtenInExtChartAt, extChartAt_model_space_eq_id, (· ∘ ·), LocalEquiv.refl_coe, id]
+    writtenInExtChartAt, extChartAt_model_space_eq_id, (· ∘ ·), PartialEquiv.refl_coe, id]
 #align cont_mdiff_within_at_pi_space contMDiffWithinAt_pi_space
 -/
 
Diff
@@ -86,8 +86,8 @@ variable {𝕜 : Type _} [NontriviallyNormedField 𝕜]
   [NormedSpace 𝕜 F₂] {F₃ : Type _} [NormedAddCommGroup F₃] [NormedSpace 𝕜 F₃] {F₄ : Type _}
   [NormedAddCommGroup F₄] [NormedSpace 𝕜 F₄]
   -- declare functions, sets, points and smoothness indices
-  {e : LocalHomeomorph M H}
-  {e' : LocalHomeomorph M' H'} {f f₁ : M → M'} {s s₁ t : Set M} {x : M} {m n : ℕ∞}
+  {e : PartialHomeomorph M H}
+  {e' : PartialHomeomorph M' H'} {f f₁ : M → M'} {s s₁ t : Set M} {x : M} {m n : ℕ∞}
 
 #print ContDiffWithinAtProp /-
 /-- Property in the model space of a model with corners of being `C^n` within at set at a point,
@@ -424,9 +424,9 @@ theorem contMDiffWithinAt_iff_target :
     exact
       inter_mem self_mem_nhdsWithin
         (h.preimage_mem_nhds_within <| (chart_at _ _).open_source.mem_nhds <| mem_chart_source _ _)
-  simp_rw [Cont, ContDiffWithinAtProp, extChartAt, LocalHomeomorph.extend, LocalEquiv.coe_trans,
-    ModelWithCorners.toLocalEquiv_coe, LocalHomeomorph.coe_coe, modelWithCornersSelf_coe,
-    chartAt_self_eq, LocalHomeomorph.refl_apply, comp.left_id]
+  simp_rw [Cont, ContDiffWithinAtProp, extChartAt, PartialHomeomorph.extend, LocalEquiv.coe_trans,
+    ModelWithCorners.toLocalEquiv_coe, PartialHomeomorph.coe_coe, modelWithCornersSelf_coe,
+    chartAt_self_eq, PartialHomeomorph.refl_apply, comp.left_id]
 #align cont_mdiff_within_at_iff_target contMDiffWithinAt_iff_target
 -/
 
@@ -671,7 +671,7 @@ theorem contMDiffOn_iff_target :
   by
   inhabit E'
   simp only [contMDiffOn_iff, ModelWithCorners.source_eq, chartAt_self_eq,
-    LocalHomeomorph.refl_localEquiv, LocalEquiv.refl_trans, extChartAt, LocalHomeomorph.extend,
+    PartialHomeomorph.refl_localEquiv, LocalEquiv.refl_trans, extChartAt, PartialHomeomorph.extend,
     Set.preimage_univ, Set.inter_univ, and_congr_right_iff]
   intro h
   constructor
@@ -1001,10 +1001,10 @@ theorem contMDiffWithinAt_iff_contMDiffOn_nhds {n : ℕ} :
         IsOpen o ∧ x ∈ o ∧ o ⊆ (chart_at H x).source ∧ o ∩ s ⊆ f ⁻¹' (chart_at H' (f x)).source :=
       by
       have : (chart_at H' (f x)).source ∈ 𝓝 (f x) :=
-        IsOpen.mem_nhds (LocalHomeomorph.open_source _) (mem_chart_source H' (f x))
+        IsOpen.mem_nhds (PartialHomeomorph.open_source _) (mem_chart_source H' (f x))
       rcases mem_nhdsWithin.1 (h.1.preimage_mem_nhdsWithin this) with ⟨u, u_open, xu, hu⟩
       refine' ⟨u ∩ (chart_at H x).source, _, ⟨xu, mem_chart_source _ _⟩, _, _⟩
-      · exact IsOpen.inter u_open (LocalHomeomorph.open_source _)
+      · exact IsOpen.inter u_open (PartialHomeomorph.open_source _)
       · intro y hy; exact hy.2
       · intro y hy; exact hu ⟨hy.1.1, hy.2⟩
     have h' : ContMDiffWithinAt I I' n f (s ∩ o) x := h.mono (inter_subset_left _ _)
@@ -1490,7 +1490,7 @@ theorem contMDiffOn_extChartAt_symm (x : M) :
 
 #print contMDiffOn_of_mem_contDiffGroupoid /-
 /-- An element of `cont_diff_groupoid ⊤ I` is `C^n` for any `n`. -/
-theorem contMDiffOn_of_mem_contDiffGroupoid {e' : LocalHomeomorph H H}
+theorem contMDiffOn_of_mem_contDiffGroupoid {e' : PartialHomeomorph H H}
     (h : e' ∈ contDiffGroupoid ⊤ I) : ContMDiffOn I I n e' e'.source :=
   (contDiffWithinAt_localInvariantProp I I n).liftPropOn_of_mem_groupoid (contDiffWithinAtProp_id I)
     h
@@ -2518,7 +2518,7 @@ section
 variable [ChartedSpace H M'] [IsM' : SmoothManifoldWithCorners I M']
 
 #print isLocalStructomorphOn_contDiffGroupoid_iff_aux /-
-theorem isLocalStructomorphOn_contDiffGroupoid_iff_aux {f : LocalHomeomorph M M'}
+theorem isLocalStructomorphOn_contDiffGroupoid_iff_aux {f : PartialHomeomorph M M'}
     (hf : LiftPropOn (contDiffGroupoid ⊤ I).IsLocalStructomorphWithinAt f f.source) :
     SmoothOn I I f f.source :=
   by
@@ -2568,7 +2568,7 @@ theorem isLocalStructomorphOn_contDiffGroupoid_iff_aux {f : LocalHomeomorph M M'
 /-- Let `M` and `M'` be smooth manifolds with the same model-with-corners, `I`.  Then `f : M → M'`
 is a local structomorphism for `I`, if and only if it is manifold-smooth on the domain of definition
 in both directions. -/
-theorem isLocalStructomorphOn_contDiffGroupoid_iff (f : LocalHomeomorph M M') :
+theorem isLocalStructomorphOn_contDiffGroupoid_iff (f : PartialHomeomorph M M') :
     LiftPropOn (contDiffGroupoid ⊤ I).IsLocalStructomorphWithinAt f f.source ↔
       SmoothOn I I f f.source ∧ SmoothOn I I f.symm f.target :=
   by
@@ -2586,7 +2586,7 @@ theorem isLocalStructomorphOn_contDiffGroupoid_iff (f : LocalHomeomorph M M') :
     obtain ⟨-, hxf⟩ := h x hx
     refine' ⟨(f.symm.continuous_at hX).ContinuousWithinAt, fun h2x => _⟩
     obtain ⟨e, he, h2e, hef, hex⟩ :
-      ∃ e : LocalHomeomorph H H,
+      ∃ e : PartialHomeomorph H H,
         e ∈ contDiffGroupoid ⊤ I ∧
           e.source ⊆ (c.symm ≫ₕ f ≫ₕ c').source ∧
             eq_on (c' ∘ f ∘ c.symm) e e.source ∧ c x ∈ e.source :=
@@ -2595,7 +2595,7 @@ theorem isLocalStructomorphOn_contDiffGroupoid_iff (f : LocalHomeomorph M M') :
       have h2 : ⇑c' ∘ ⇑f ∘ ⇑c.symm = ⇑(c.symm ≫ₕ f ≫ₕ c') := rfl
       have hcx : c x ∈ c.symm ⁻¹' f.source := by simp only [hx, mfld_simps]
       rw [h2]
-      rw [← h1, h2, LocalHomeomorph.isLocalStructomorphWithinAt_iff'] at hxf 
+      rw [← h1, h2, PartialHomeomorph.isLocalStructomorphWithinAt_iff'] at hxf 
       · exact hxf hcx
       · mfld_set_tac
       · apply Or.inl
@@ -2616,7 +2616,7 @@ theorem isLocalStructomorphOn_contDiffGroupoid_iff (f : LocalHomeomorph M M') :
       have h2 : e.target ⊆ (c.symm ≫ₕ f ≫ₕ c').target :=
         by
         intro x hx; rw [← e.right_inv hx, ← hef (e.symm.maps_to hx)]
-        exact LocalHomeomorph.mapsTo _ (h2e <| e.symm.maps_to hx)
+        exact PartialHomeomorph.mapsTo _ (h2e <| e.symm.maps_to hx)
       rw [inter_self] at h1 
       rwa [inter_eq_right_iff_subset.mpr]
       refine' h2.trans _
Diff
@@ -3,8 +3,8 @@ 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.SmoothManifoldWithCorners
-import Mathbin.Geometry.Manifold.LocalInvariantProperties
+import Geometry.Manifold.SmoothManifoldWithCorners
+import Geometry.Manifold.LocalInvariantProperties
 
 #align_import geometry.manifold.cont_mdiff from "leanprover-community/mathlib"@"30faa0c3618ce1472bf6305ae0e3fa56affa3f95"
 
Diff
@@ -1735,8 +1735,8 @@ theorem contMDiffWithinAt_iff_contDiffWithinAt {f : E → E'} {s : Set E} {x : E
 #align cont_mdiff_within_at_iff_cont_diff_within_at contMDiffWithinAt_iff_contDiffWithinAt
 -/
 
-alias contMDiffWithinAt_iff_contDiffWithinAt ↔ ContMDiffWithinAt.contDiffWithinAt
-  ContDiffWithinAt.contMDiffWithinAt
+alias ⟨ContMDiffWithinAt.contDiffWithinAt, ContDiffWithinAt.contMDiffWithinAt⟩ :=
+  contMDiffWithinAt_iff_contDiffWithinAt
 #align cont_mdiff_within_at.cont_diff_within_at ContMDiffWithinAt.contDiffWithinAt
 #align cont_diff_within_at.cont_mdiff_within_at ContDiffWithinAt.contMDiffWithinAt
 
@@ -1747,7 +1747,7 @@ theorem contMDiffAt_iff_contDiffAt {f : E → E'} {x : E} :
 #align cont_mdiff_at_iff_cont_diff_at contMDiffAt_iff_contDiffAt
 -/
 
-alias contMDiffAt_iff_contDiffAt ↔ ContMDiffAt.contDiffAt ContDiffAt.contMDiffAt
+alias ⟨ContMDiffAt.contDiffAt, ContDiffAt.contMDiffAt⟩ := contMDiffAt_iff_contDiffAt
 #align cont_mdiff_at.cont_diff_at ContMDiffAt.contDiffAt
 #align cont_diff_at.cont_mdiff_at ContDiffAt.contMDiffAt
 
@@ -1758,7 +1758,7 @@ theorem contMDiffOn_iff_contDiffOn {f : E → E'} {s : Set E} :
 #align cont_mdiff_on_iff_cont_diff_on contMDiffOn_iff_contDiffOn
 -/
 
-alias contMDiffOn_iff_contDiffOn ↔ ContMDiffOn.contDiffOn ContDiffOn.contMDiffOn
+alias ⟨ContMDiffOn.contDiffOn, ContDiffOn.contMDiffOn⟩ := contMDiffOn_iff_contDiffOn
 #align cont_mdiff_on.cont_diff_on ContMDiffOn.contDiffOn
 #align cont_diff_on.cont_mdiff_on ContDiffOn.contMDiffOn
 
@@ -1768,7 +1768,7 @@ theorem contMDiff_iff_contDiff {f : E → E'} : ContMDiff 𝓘(𝕜, E) 𝓘(
 #align cont_mdiff_iff_cont_diff contMDiff_iff_contDiff
 -/
 
-alias contMDiff_iff_contDiff ↔ ContMDiff.contDiff ContDiff.contMDiff
+alias ⟨ContMDiff.contDiff, ContDiff.contMDiff⟩ := contMDiff_iff_contDiff
 #align cont_mdiff.cont_diff ContMDiff.contDiff
 #align cont_diff.cont_mdiff ContDiff.contMDiff
 
Diff
@@ -2,15 +2,12 @@
 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.cont_mdiff
-! leanprover-community/mathlib commit 30faa0c3618ce1472bf6305ae0e3fa56affa3f95
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Geometry.Manifold.SmoothManifoldWithCorners
 import Mathbin.Geometry.Manifold.LocalInvariantProperties
 
+#align_import geometry.manifold.cont_mdiff from "leanprover-community/mathlib"@"30faa0c3618ce1472bf6305ae0e3fa56affa3f95"
+
 /-!
 # Smooth 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.cont_mdiff
-! leanprover-community/mathlib commit e5ab837fc252451f3eb9124ae6e7b6f57455e7b9
+! leanprover-community/mathlib commit 30faa0c3618ce1472bf6305ae0e3fa56affa3f95
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -14,6 +14,9 @@ import Mathbin.Geometry.Manifold.LocalInvariantProperties
 /-!
 # Smooth functions between smooth manifolds
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 We define `Cⁿ` functions between smooth manifolds, as functions which are `Cⁿ` in charts, and prove
 basic properties of these notions.
 
Diff
@@ -89,34 +89,43 @@ variable {𝕜 : Type _} [NontriviallyNormedField 𝕜]
   {e : LocalHomeomorph M H}
   {e' : LocalHomeomorph M' H'} {f f₁ : M → M'} {s s₁ t : Set M} {x : M} {m n : ℕ∞}
 
+#print ContDiffWithinAtProp /-
 /-- Property in the model space of a model with corners of being `C^n` within at set at a point,
 when read in the model vector space. This property will be lifted to manifolds to define smooth
 functions between manifolds. -/
 def ContDiffWithinAtProp (n : ℕ∞) (f : H → H') (s : Set H) (x : H) : Prop :=
   ContDiffWithinAt 𝕜 n (I' ∘ f ∘ I.symm) (I.symm ⁻¹' s ∩ range I) (I x)
 #align cont_diff_within_at_prop ContDiffWithinAtProp
+-/
 
+#print contDiffWithinAtProp_self_source /-
 theorem contDiffWithinAtProp_self_source {f : E → H'} {s : Set E} {x : E} :
     ContDiffWithinAtProp 𝓘(𝕜, E) I' n f s x ↔ ContDiffWithinAt 𝕜 n (I' ∘ f) s x :=
   by
   simp_rw [ContDiffWithinAtProp, modelWithCornersSelf_coe, range_id, inter_univ]
   rfl
 #align cont_diff_within_at_prop_self_source contDiffWithinAtProp_self_source
+-/
 
+#print contDiffWithinAtProp_self /-
 theorem contDiffWithinAtProp_self {f : E → E'} {s : Set E} {x : E} :
     ContDiffWithinAtProp 𝓘(𝕜, E) 𝓘(𝕜, E') n f s x ↔ ContDiffWithinAt 𝕜 n f s x :=
   contDiffWithinAtProp_self_source 𝓘(𝕜, E')
 #align cont_diff_within_at_prop_self contDiffWithinAtProp_self
+-/
 
+#print contDiffWithinAtProp_self_target /-
 theorem contDiffWithinAtProp_self_target {f : H → E'} {s : Set H} {x : H} :
     ContDiffWithinAtProp I 𝓘(𝕜, E') n f s x ↔
       ContDiffWithinAt 𝕜 n (f ∘ I.symm) (I.symm ⁻¹' s ∩ range I) (I x) :=
   Iff.rfl
 #align cont_diff_within_at_prop_self_target contDiffWithinAtProp_self_target
+-/
 
+#print contDiffWithinAt_localInvariantProp /-
 /-- Being `Cⁿ` in the model space is a local property, invariant under smooth maps. Therefore,
 it will lift nicely to manifolds. -/
-theorem cont_diff_within_at_localInvariantProp (n : ℕ∞) :
+theorem contDiffWithinAt_localInvariantProp (n : ℕ∞) :
     (contDiffGroupoid ∞ I).LocalInvariantProp (contDiffGroupoid ∞ I')
       (ContDiffWithinAtProp I I' n) :=
   { is_local := by
@@ -159,8 +168,10 @@ theorem cont_diff_within_at_localInvariantProp (n : ℕ∞) :
       convert this.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 cont_diff_within_at_local_invariant_prop cont_diff_within_at_localInvariantProp
+#align cont_diff_within_at_local_invariant_prop contDiffWithinAt_localInvariantProp
+-/
 
+#print contDiffWithinAtProp_mono_of_mem /-
 theorem contDiffWithinAtProp_mono_of_mem (n : ℕ∞) ⦃s x t⦄ ⦃f : H → H'⦄ (hts : s ∈ 𝓝[t] x)
     (h : ContDiffWithinAtProp I I' n f s x) : ContDiffWithinAtProp I I' n f t x :=
   by
@@ -168,7 +179,9 @@ theorem contDiffWithinAtProp_mono_of_mem (n : ℕ∞) ⦃s x t⦄ ⦃f : H → H
   refine' inter_mem _ (mem_of_superset self_mem_nhdsWithin <| inter_subset_right _ _)
   rwa [← Filter.mem_map, ← I.image_eq, I.symm_map_nhds_within_image]
 #align cont_diff_within_at_prop_mono_of_mem contDiffWithinAtProp_mono_of_mem
+-/
 
+#print contDiffWithinAtProp_id /-
 theorem contDiffWithinAtProp_id (x : H) : ContDiffWithinAtProp I I n id univ x :=
   by
   simp [ContDiffWithinAtProp]
@@ -177,62 +190,80 @@ theorem contDiffWithinAtProp_id (x : H) : ContDiffWithinAtProp I I n id univ x :
   · simp only [mfld_simps]
   · simp only [ModelWithCorners.right_inv I hy, mfld_simps]
 #align cont_diff_within_at_prop_id contDiffWithinAtProp_id
+-/
 
+#print ContMDiffWithinAt /-
 /-- A function is `n` times continuously differentiable within a set at a point in a manifold if
 it is continuous and it is `n` times continuously differentiable in this set around this point, when
 read in the preferred chart at this point. -/
-def ContMdiffWithinAt (n : ℕ∞) (f : M → M') (s : Set M) (x : M) :=
+def ContMDiffWithinAt (n : ℕ∞) (f : M → M') (s : Set M) (x : M) :=
   LiftPropWithinAt (ContDiffWithinAtProp I I' n) f s x
-#align cont_mdiff_within_at ContMdiffWithinAt
+#align cont_mdiff_within_at ContMDiffWithinAt
+-/
 
+#print SmoothWithinAt /-
 /-- Abbreviation for `cont_mdiff_within_at I I' ⊤ f s x`. See also documentation for `smooth`.
 -/
 @[reducible]
 def SmoothWithinAt (f : M → M') (s : Set M) (x : M) :=
-  ContMdiffWithinAt I I' ⊤ f s x
+  ContMDiffWithinAt I I' ⊤ f s x
 #align smooth_within_at SmoothWithinAt
+-/
 
+#print ContMDiffAt /-
 /-- A function is `n` times continuously differentiable at a point in a manifold if
 it is continuous and it is `n` times continuously differentiable around this point, when
 read in the preferred chart at this point. -/
-def ContMdiffAt (n : ℕ∞) (f : M → M') (x : M) :=
-  ContMdiffWithinAt I I' n f univ x
-#align cont_mdiff_at ContMdiffAt
+def ContMDiffAt (n : ℕ∞) (f : M → M') (x : M) :=
+  ContMDiffWithinAt I I' n f univ x
+#align cont_mdiff_at ContMDiffAt
+-/
 
-theorem contMdiffAt_iff {n : ℕ∞} {f : M → M'} {x : M} :
-    ContMdiffAt I I' n f x ↔
+#print contMDiffAt_iff /-
+theorem contMDiffAt_iff {n : ℕ∞} {f : M → M'} {x : M} :
+    ContMDiffAt I I' n f x ↔
       ContinuousAt f x ∧
         ContDiffWithinAt 𝕜 n (extChartAt I' (f x) ∘ f ∘ (extChartAt I x).symm) (range I)
           (extChartAt I x x) :=
   liftPropAt_iff.trans <| by rw [ContDiffWithinAtProp, preimage_univ, univ_inter]; rfl
-#align cont_mdiff_at_iff contMdiffAt_iff
+#align cont_mdiff_at_iff contMDiffAt_iff
+-/
 
+#print SmoothAt /-
 /-- Abbreviation for `cont_mdiff_at I I' ⊤ f x`. See also documentation for `smooth`. -/
 @[reducible]
 def SmoothAt (f : M → M') (x : M) :=
-  ContMdiffAt I I' ⊤ f x
+  ContMDiffAt I I' ⊤ f x
 #align smooth_at SmoothAt
+-/
 
+#print ContMDiffOn /-
 /-- A function is `n` times continuously differentiable in a set of a manifold if it is continuous
 and, for any pair of points, it is `n` times continuously differentiable on this set in the charts
 around these points. -/
-def ContMdiffOn (n : ℕ∞) (f : M → M') (s : Set M) :=
-  ∀ x ∈ s, ContMdiffWithinAt I I' n f s x
-#align cont_mdiff_on ContMdiffOn
+def ContMDiffOn (n : ℕ∞) (f : M → M') (s : Set M) :=
+  ∀ x ∈ s, ContMDiffWithinAt I I' n f s x
+#align cont_mdiff_on ContMDiffOn
+-/
 
+#print SmoothOn /-
 /-- Abbreviation for `cont_mdiff_on I I' ⊤ f s`. See also documentation for `smooth`. -/
 @[reducible]
 def SmoothOn (f : M → M') (s : Set M) :=
-  ContMdiffOn I I' ⊤ f s
+  ContMDiffOn I I' ⊤ f s
 #align smooth_on SmoothOn
+-/
 
+#print ContMDiff /-
 /-- A function is `n` times continuously differentiable in a manifold if it is continuous
 and, for any pair of points, it is `n` times continuously differentiable in the charts
 around these points. -/
-def ContMdiff (n : ℕ∞) (f : M → M') :=
-  ∀ x, ContMdiffAt I I' n f x
-#align cont_mdiff ContMdiff
+def ContMDiff (n : ℕ∞) (f : M → M') :=
+  ∀ x, ContMDiffAt I I' n f x
+#align cont_mdiff ContMDiff
+-/
 
+#print Smooth /-
 /-- Abbreviation for `cont_mdiff I I' ⊤ f`.
 Short note to work with these abbreviations: a lemma of the form `cont_mdiff_foo.bar` will
 apply fine to an assumption `smooth_foo` using dot notation or normal notation.
@@ -242,82 +273,114 @@ to make it possible to use `smooth` consistently.
 This also applies to `smooth_at`, `smooth_on` and `smooth_within_at`.-/
 @[reducible]
 def Smooth (f : M → M') :=
-  ContMdiff I I' ⊤ f
+  ContMDiff I I' ⊤ f
 #align smooth Smooth
+-/
 
 /-! ### Basic properties of smooth functions between manifolds -/
 
 
 variable {I I'}
 
-theorem ContMdiff.smooth (h : ContMdiff I I' ⊤ f) : Smooth I I' f :=
+#print ContMDiff.smooth /-
+theorem ContMDiff.smooth (h : ContMDiff I I' ⊤ f) : Smooth I I' f :=
   h
-#align cont_mdiff.smooth ContMdiff.smooth
+#align cont_mdiff.smooth ContMDiff.smooth
+-/
 
-theorem Smooth.contMdiff (h : Smooth I I' f) : ContMdiff I I' ⊤ f :=
+#print Smooth.contMDiff /-
+theorem Smooth.contMDiff (h : Smooth I I' f) : ContMDiff I I' ⊤ f :=
   h
-#align smooth.cont_mdiff Smooth.contMdiff
+#align smooth.cont_mdiff Smooth.contMDiff
+-/
 
-theorem ContMdiffOn.smoothOn (h : ContMdiffOn I I' ⊤ f s) : SmoothOn I I' f s :=
+#print ContMDiffOn.smoothOn /-
+theorem ContMDiffOn.smoothOn (h : ContMDiffOn I I' ⊤ f s) : SmoothOn I I' f s :=
   h
-#align cont_mdiff_on.smooth_on ContMdiffOn.smoothOn
+#align cont_mdiff_on.smooth_on ContMDiffOn.smoothOn
+-/
 
-theorem SmoothOn.contMdiffOn (h : SmoothOn I I' f s) : ContMdiffOn I I' ⊤ f s :=
+#print SmoothOn.contMDiffOn /-
+theorem SmoothOn.contMDiffOn (h : SmoothOn I I' f s) : ContMDiffOn I I' ⊤ f s :=
   h
-#align smooth_on.cont_mdiff_on SmoothOn.contMdiffOn
+#align smooth_on.cont_mdiff_on SmoothOn.contMDiffOn
+-/
 
-theorem ContMdiffAt.smoothAt (h : ContMdiffAt I I' ⊤ f x) : SmoothAt I I' f x :=
+#print ContMDiffAt.smoothAt /-
+theorem ContMDiffAt.smoothAt (h : ContMDiffAt I I' ⊤ f x) : SmoothAt I I' f x :=
   h
-#align cont_mdiff_at.smooth_at ContMdiffAt.smoothAt
+#align cont_mdiff_at.smooth_at ContMDiffAt.smoothAt
+-/
 
-theorem SmoothAt.contMdiffAt (h : SmoothAt I I' f x) : ContMdiffAt I I' ⊤ f x :=
+#print SmoothAt.contMDiffAt /-
+theorem SmoothAt.contMDiffAt (h : SmoothAt I I' f x) : ContMDiffAt I I' ⊤ f x :=
   h
-#align smooth_at.cont_mdiff_at SmoothAt.contMdiffAt
+#align smooth_at.cont_mdiff_at SmoothAt.contMDiffAt
+-/
 
-theorem ContMdiffWithinAt.smoothWithinAt (h : ContMdiffWithinAt I I' ⊤ f s x) :
+#print ContMDiffWithinAt.smoothWithinAt /-
+theorem ContMDiffWithinAt.smoothWithinAt (h : ContMDiffWithinAt I I' ⊤ f s x) :
     SmoothWithinAt I I' f s x :=
   h
-#align cont_mdiff_within_at.smooth_within_at ContMdiffWithinAt.smoothWithinAt
+#align cont_mdiff_within_at.smooth_within_at ContMDiffWithinAt.smoothWithinAt
+-/
 
-theorem SmoothWithinAt.contMdiffWithinAt (h : SmoothWithinAt I I' f s x) :
-    ContMdiffWithinAt I I' ⊤ f s x :=
+#print SmoothWithinAt.contMDiffWithinAt /-
+theorem SmoothWithinAt.contMDiffWithinAt (h : SmoothWithinAt I I' f s x) :
+    ContMDiffWithinAt I I' ⊤ f s x :=
   h
-#align smooth_within_at.cont_mdiff_within_at SmoothWithinAt.contMdiffWithinAt
+#align smooth_within_at.cont_mdiff_within_at SmoothWithinAt.contMDiffWithinAt
+-/
 
-theorem ContMdiff.contMdiffAt (h : ContMdiff I I' n f) : ContMdiffAt I I' n f x :=
+#print ContMDiff.contMDiffAt /-
+theorem ContMDiff.contMDiffAt (h : ContMDiff I I' n f) : ContMDiffAt I I' n f x :=
   h x
-#align cont_mdiff.cont_mdiff_at ContMdiff.contMdiffAt
+#align cont_mdiff.cont_mdiff_at ContMDiff.contMDiffAt
+-/
 
+#print Smooth.smoothAt /-
 theorem Smooth.smoothAt (h : Smooth I I' f) : SmoothAt I I' f x :=
-  ContMdiff.contMdiffAt h
+  ContMDiff.contMDiffAt h
 #align smooth.smooth_at Smooth.smoothAt
+-/
 
-theorem contMdiffWithinAt_univ : ContMdiffWithinAt I I' n f univ x ↔ ContMdiffAt I I' n f x :=
+#print contMDiffWithinAt_univ /-
+theorem contMDiffWithinAt_univ : ContMDiffWithinAt I I' n f univ x ↔ ContMDiffAt I I' n f x :=
   Iff.rfl
-#align cont_mdiff_within_at_univ contMdiffWithinAt_univ
+#align cont_mdiff_within_at_univ contMDiffWithinAt_univ
+-/
 
+#print smoothWithinAt_univ /-
 theorem smoothWithinAt_univ : SmoothWithinAt I I' f univ x ↔ SmoothAt I I' f x :=
-  contMdiffWithinAt_univ
+  contMDiffWithinAt_univ
 #align smooth_within_at_univ smoothWithinAt_univ
+-/
 
-theorem contMdiffOn_univ : ContMdiffOn I I' n f univ ↔ ContMdiff I I' n f := by
-  simp only [ContMdiffOn, ContMdiff, contMdiffWithinAt_univ, forall_prop_of_true, mem_univ]
-#align cont_mdiff_on_univ contMdiffOn_univ
+#print contMDiffOn_univ /-
+theorem contMDiffOn_univ : ContMDiffOn I I' n f univ ↔ ContMDiff I I' n f := by
+  simp only [ContMDiffOn, ContMDiff, contMDiffWithinAt_univ, forall_prop_of_true, mem_univ]
+#align cont_mdiff_on_univ contMDiffOn_univ
+-/
 
+#print smoothOn_univ /-
 theorem smoothOn_univ : SmoothOn I I' f univ ↔ Smooth I I' f :=
-  contMdiffOn_univ
+  contMDiffOn_univ
 #align smooth_on_univ smoothOn_univ
+-/
 
+#print contMDiffWithinAt_iff /-
 /-- One can reformulate smoothness within a set at a point as continuity within this set at this
 point, and smoothness in the corresponding extended chart. -/
-theorem contMdiffWithinAt_iff :
-    ContMdiffWithinAt I I' n f s x ↔
+theorem contMDiffWithinAt_iff :
+    ContMDiffWithinAt I I' n f s x ↔
       ContinuousWithinAt f s x ∧
         ContDiffWithinAt 𝕜 n (extChartAt I' (f x) ∘ f ∘ (extChartAt I x).symm)
           ((extChartAt I x).symm ⁻¹' s ∩ range I) (extChartAt I x x) :=
   Iff.rfl
-#align cont_mdiff_within_at_iff contMdiffWithinAt_iff
+#align cont_mdiff_within_at_iff contMDiffWithinAt_iff
+-/
 
+#print contMDiffWithinAt_iff' /-
 /-- One can reformulate smoothness within a set at a point as continuity within this set at this
 point, and smoothness in the corresponding extended chart. This form states smoothness of `f`
 written in such a way that the set is restricted to lie within the domain/codomain of the
@@ -326,29 +389,31 @@ Even though this expression is more complicated than the one in `cont_mdiff_with
 a smaller set, but their germs at `ext_chart_at I x x` are equal. It is sometimes useful to rewrite
 using this in the goal.
 -/
-theorem contMdiffWithinAt_iff' :
-    ContMdiffWithinAt I I' n f s x ↔
+theorem contMDiffWithinAt_iff' :
+    ContMDiffWithinAt I I' n f s x ↔
       ContinuousWithinAt f s x ∧
         ContDiffWithinAt 𝕜 n (extChartAt I' (f x) ∘ f ∘ (extChartAt I x).symm)
           ((extChartAt I x).target ∩
             (extChartAt I x).symm ⁻¹' (s ∩ f ⁻¹' (extChartAt I' (f x)).source))
           (extChartAt I x x) :=
   by
-  rw [contMdiffWithinAt_iff, and_congr_right_iff]
+  rw [contMDiffWithinAt_iff, and_congr_right_iff]
   set e := extChartAt I x; set e' := extChartAt I' (f x)
   refine' fun hc => contDiffWithinAt_congr_nhds _
   rw [← e.image_source_inter_eq', ← map_extChartAt_nhdsWithin_eq_image, ← map_extChartAt_nhdsWithin,
     inter_comm, nhdsWithin_inter_of_mem]
   exact hc (extChartAt_source_mem_nhds _ _)
-#align cont_mdiff_within_at_iff' contMdiffWithinAt_iff'
+#align cont_mdiff_within_at_iff' contMDiffWithinAt_iff'
+-/
 
+#print contMDiffWithinAt_iff_target /-
 /-- One can reformulate smoothness within a set at a point as continuity within this set at this
 point, and smoothness in the corresponding extended chart in the target. -/
-theorem contMdiffWithinAt_iff_target :
-    ContMdiffWithinAt I I' n f s x ↔
-      ContinuousWithinAt f s x ∧ ContMdiffWithinAt I 𝓘(𝕜, E') n (extChartAt I' (f x) ∘ f) s x :=
+theorem contMDiffWithinAt_iff_target :
+    ContMDiffWithinAt I I' n f s x ↔
+      ContinuousWithinAt f s x ∧ ContMDiffWithinAt I 𝓘(𝕜, E') n (extChartAt I' (f x) ∘ f) s x :=
   by
-  simp_rw [ContMdiffWithinAt, lift_prop_within_at, ← and_assoc']
+  simp_rw [ContMDiffWithinAt, lift_prop_within_at, ← and_assoc']
   have cont :
     ContinuousWithinAt f s x ∧ ContinuousWithinAt (extChartAt I' (f x) ∘ f) s x ↔
       ContinuousWithinAt f s x :=
@@ -362,77 +427,93 @@ theorem contMdiffWithinAt_iff_target :
   simp_rw [Cont, ContDiffWithinAtProp, extChartAt, LocalHomeomorph.extend, LocalEquiv.coe_trans,
     ModelWithCorners.toLocalEquiv_coe, LocalHomeomorph.coe_coe, modelWithCornersSelf_coe,
     chartAt_self_eq, LocalHomeomorph.refl_apply, comp.left_id]
-#align cont_mdiff_within_at_iff_target contMdiffWithinAt_iff_target
+#align cont_mdiff_within_at_iff_target contMDiffWithinAt_iff_target
+-/
 
+#print smoothWithinAt_iff /-
 theorem smoothWithinAt_iff :
     SmoothWithinAt I I' f s x ↔
       ContinuousWithinAt f s x ∧
         ContDiffWithinAt 𝕜 ∞ (extChartAt I' (f x) ∘ f ∘ (extChartAt I x).symm)
           ((extChartAt I x).symm ⁻¹' s ∩ range I) (extChartAt I x x) :=
-  contMdiffWithinAt_iff
+  contMDiffWithinAt_iff
 #align smooth_within_at_iff smoothWithinAt_iff
+-/
 
+#print smoothWithinAt_iff_target /-
 theorem smoothWithinAt_iff_target :
     SmoothWithinAt I I' f s x ↔
       ContinuousWithinAt f s x ∧ SmoothWithinAt I 𝓘(𝕜, E') (extChartAt I' (f x) ∘ f) s x :=
-  contMdiffWithinAt_iff_target
+  contMDiffWithinAt_iff_target
 #align smooth_within_at_iff_target smoothWithinAt_iff_target
+-/
 
-theorem contMdiffAt_iff_target {x : M} :
-    ContMdiffAt I I' n f x ↔
-      ContinuousAt f x ∧ ContMdiffAt I 𝓘(𝕜, E') n (extChartAt I' (f x) ∘ f) x :=
-  by rw [ContMdiffAt, ContMdiffAt, contMdiffWithinAt_iff_target, continuousWithinAt_univ]
-#align cont_mdiff_at_iff_target contMdiffAt_iff_target
+#print contMDiffAt_iff_target /-
+theorem contMDiffAt_iff_target {x : M} :
+    ContMDiffAt I I' n f x ↔
+      ContinuousAt f x ∧ ContMDiffAt I 𝓘(𝕜, E') n (extChartAt I' (f x) ∘ f) x :=
+  by rw [ContMDiffAt, ContMDiffAt, contMDiffWithinAt_iff_target, continuousWithinAt_univ]
+#align cont_mdiff_at_iff_target contMDiffAt_iff_target
+-/
 
+#print smoothAt_iff_target /-
 theorem smoothAt_iff_target {x : M} :
     SmoothAt I I' f x ↔ ContinuousAt f x ∧ SmoothAt I 𝓘(𝕜, E') (extChartAt I' (f x) ∘ f) x :=
-  contMdiffAt_iff_target
+  contMDiffAt_iff_target
 #align smooth_at_iff_target smoothAt_iff_target
+-/
 
-theorem contMdiffWithinAt_iff_of_mem_maximalAtlas {x : M} (he : e ∈ maximalAtlas I M)
+#print contMDiffWithinAt_iff_of_mem_maximalAtlas /-
+theorem contMDiffWithinAt_iff_of_mem_maximalAtlas {x : M} (he : e ∈ maximalAtlas I M)
     (he' : e' ∈ maximalAtlas I' M') (hx : x ∈ e.source) (hy : f x ∈ e'.source) :
-    ContMdiffWithinAt I I' n f s x ↔
+    ContMDiffWithinAt I I' n f s x ↔
       ContinuousWithinAt f s x ∧
         ContDiffWithinAt 𝕜 n (e'.extend I' ∘ f ∘ (e.extend I).symm)
           ((e.extend I).symm ⁻¹' s ∩ range I) (e.extend I x) :=
-  (cont_diff_within_at_localInvariantProp I I' n).liftPropWithinAt_indep_chart he hx he' hy
-#align cont_mdiff_within_at_iff_of_mem_maximal_atlas contMdiffWithinAt_iff_of_mem_maximalAtlas
+  (contDiffWithinAt_localInvariantProp I I' n).liftPropWithinAt_indep_chart he hx he' hy
+#align cont_mdiff_within_at_iff_of_mem_maximal_atlas contMDiffWithinAt_iff_of_mem_maximalAtlas
+-/
 
+#print contMDiffWithinAt_iff_image /-
 /-- An alternative formulation of `cont_mdiff_within_at_iff_of_mem_maximal_atlas`
   if the set if `s` lies in `e.source`. -/
-theorem contMdiffWithinAt_iff_image {x : M} (he : e ∈ maximalAtlas I M)
+theorem contMDiffWithinAt_iff_image {x : M} (he : e ∈ maximalAtlas I M)
     (he' : e' ∈ maximalAtlas I' M') (hs : s ⊆ e.source) (hx : x ∈ e.source) (hy : f x ∈ e'.source) :
-    ContMdiffWithinAt I I' n f s x ↔
+    ContMDiffWithinAt I I' n f s x ↔
       ContinuousWithinAt f s x ∧
         ContDiffWithinAt 𝕜 n (e'.extend I' ∘ f ∘ (e.extend I).symm) (e.extend I '' s)
           (e.extend I x) :=
   by
-  rw [contMdiffWithinAt_iff_of_mem_maximalAtlas he he' hx hy, and_congr_right_iff]
+  rw [contMDiffWithinAt_iff_of_mem_maximalAtlas he he' hx hy, and_congr_right_iff]
   refine' fun hf => contDiffWithinAt_congr_nhds _
   simp_rw [nhdsWithin_eq_iff_eventuallyEq, e.extend_symm_preimage_inter_range_eventually_eq I hs hx]
-#align cont_mdiff_within_at_iff_image contMdiffWithinAt_iff_image
+#align cont_mdiff_within_at_iff_image contMDiffWithinAt_iff_image
+-/
 
+#print contMDiffWithinAt_iff_of_mem_source /-
 /-- One can reformulate smoothness within a set at a point as continuity within this set at this
 point, and smoothness in any chart containing that point. -/
-theorem contMdiffWithinAt_iff_of_mem_source {x' : M} {y : M'} (hx : x' ∈ (chartAt H x).source)
+theorem contMDiffWithinAt_iff_of_mem_source {x' : M} {y : M'} (hx : x' ∈ (chartAt H x).source)
     (hy : f x' ∈ (chartAt H' y).source) :
-    ContMdiffWithinAt I I' n f s x' ↔
+    ContMDiffWithinAt I I' n f s x' ↔
       ContinuousWithinAt f s x' ∧
         ContDiffWithinAt 𝕜 n (extChartAt I' y ∘ f ∘ (extChartAt I x).symm)
           ((extChartAt I x).symm ⁻¹' s ∩ range I) (extChartAt I x x') :=
-  contMdiffWithinAt_iff_of_mem_maximalAtlas (chart_mem_maximalAtlas _ x)
+  contMDiffWithinAt_iff_of_mem_maximalAtlas (chart_mem_maximalAtlas _ x)
     (chart_mem_maximalAtlas _ y) hx hy
-#align cont_mdiff_within_at_iff_of_mem_source contMdiffWithinAt_iff_of_mem_source
+#align cont_mdiff_within_at_iff_of_mem_source contMDiffWithinAt_iff_of_mem_source
+-/
 
-theorem contMdiffWithinAt_iff_of_mem_source' {x' : M} {y : M'} (hx : x' ∈ (chartAt H x).source)
+#print contMDiffWithinAt_iff_of_mem_source' /-
+theorem contMDiffWithinAt_iff_of_mem_source' {x' : M} {y : M'} (hx : x' ∈ (chartAt H x).source)
     (hy : f x' ∈ (chartAt H' y).source) :
-    ContMdiffWithinAt I I' n f s x' ↔
+    ContMDiffWithinAt I I' n f s x' ↔
       ContinuousWithinAt f s x' ∧
         ContDiffWithinAt 𝕜 n (extChartAt I' y ∘ f ∘ (extChartAt I x).symm)
           ((extChartAt I x).target ∩ (extChartAt I x).symm ⁻¹' (s ∩ f ⁻¹' (extChartAt I' y).source))
           (extChartAt I x x') :=
   by
-  refine' (contMdiffWithinAt_iff_of_mem_source hx hy).trans _
+  refine' (contMDiffWithinAt_iff_of_mem_source hx hy).trans _
   rw [← extChartAt_source I] at hx 
   rw [← extChartAt_source I'] at hy 
   rw [and_congr_right_iff]
@@ -441,25 +522,29 @@ theorem contMdiffWithinAt_iff_of_mem_source' {x' : M} {y : M'} (hx : x' ∈ (cha
   rw [← e.image_source_inter_eq', ← map_extChartAt_nhdsWithin_eq_image' I x hx, ←
     map_extChartAt_nhdsWithin' I x hx, inter_comm, nhdsWithin_inter_of_mem]
   exact hc (extChartAt_source_mem_nhds' _ _ hy)
-#align cont_mdiff_within_at_iff_of_mem_source' contMdiffWithinAt_iff_of_mem_source'
+#align cont_mdiff_within_at_iff_of_mem_source' contMDiffWithinAt_iff_of_mem_source'
+-/
 
-theorem contMdiffAt_iff_of_mem_source {x' : M} {y : M'} (hx : x' ∈ (chartAt H x).source)
+#print contMDiffAt_iff_of_mem_source /-
+theorem contMDiffAt_iff_of_mem_source {x' : M} {y : M'} (hx : x' ∈ (chartAt H x).source)
     (hy : f x' ∈ (chartAt H' y).source) :
-    ContMdiffAt I I' n f x' ↔
+    ContMDiffAt I I' n f x' ↔
       ContinuousAt f x' ∧
         ContDiffWithinAt 𝕜 n (extChartAt I' y ∘ f ∘ (extChartAt I x).symm) (range I)
           (extChartAt I x x') :=
-  (contMdiffWithinAt_iff_of_mem_source hx hy).trans <| by
+  (contMDiffWithinAt_iff_of_mem_source hx hy).trans <| by
     rw [continuousWithinAt_univ, preimage_univ, univ_inter]
-#align cont_mdiff_at_iff_of_mem_source contMdiffAt_iff_of_mem_source
+#align cont_mdiff_at_iff_of_mem_source contMDiffAt_iff_of_mem_source
+-/
 
-theorem contMdiffWithinAt_iff_target_of_mem_source {x : M} {y : M'}
+#print contMDiffWithinAt_iff_target_of_mem_source /-
+theorem contMDiffWithinAt_iff_target_of_mem_source {x : M} {y : M'}
     (hy : f x ∈ (chartAt H' y).source) :
-    ContMdiffWithinAt I I' n f s x ↔
-      ContinuousWithinAt f s x ∧ ContMdiffWithinAt I 𝓘(𝕜, E') n (extChartAt I' y ∘ f) s x :=
+    ContMDiffWithinAt I I' n f s x ↔
+      ContinuousWithinAt f s x ∧ ContMDiffWithinAt I 𝓘(𝕜, E') n (extChartAt I' y ∘ f) s x :=
   by
-  simp_rw [ContMdiffWithinAt]
-  rw [(cont_diff_within_at_localInvariantProp I I' n).liftPropWithinAt_indep_chart_target
+  simp_rw [ContMDiffWithinAt]
+  rw [(contDiffWithinAt_localInvariantProp I I' n).liftPropWithinAt_indep_chart_target
       (chart_mem_maximal_atlas I' y) hy,
     and_congr_right]
   intro hf
@@ -468,72 +553,86 @@ theorem contMdiffWithinAt_iff_target_of_mem_source {x : M} {y : M'}
   rw [← extChartAt_source I'] at hy 
   simp_rw [(continuousAt_extChartAt' I' _ hy).comp_continuousWithinAt hf]
   rfl
-#align cont_mdiff_within_at_iff_target_of_mem_source contMdiffWithinAt_iff_target_of_mem_source
+#align cont_mdiff_within_at_iff_target_of_mem_source contMDiffWithinAt_iff_target_of_mem_source
+-/
 
-theorem contMdiffAt_iff_target_of_mem_source {x : M} {y : M'} (hy : f x ∈ (chartAt H' y).source) :
-    ContMdiffAt I I' n f x ↔ ContinuousAt f x ∧ ContMdiffAt I 𝓘(𝕜, E') n (extChartAt I' y ∘ f) x :=
+#print contMDiffAt_iff_target_of_mem_source /-
+theorem contMDiffAt_iff_target_of_mem_source {x : M} {y : M'} (hy : f x ∈ (chartAt H' y).source) :
+    ContMDiffAt I I' n f x ↔ ContinuousAt f x ∧ ContMDiffAt I 𝓘(𝕜, E') n (extChartAt I' y ∘ f) x :=
   by
-  rw [ContMdiffAt, contMdiffWithinAt_iff_target_of_mem_source hy, continuousWithinAt_univ,
-    ContMdiffAt]
+  rw [ContMDiffAt, contMDiffWithinAt_iff_target_of_mem_source hy, continuousWithinAt_univ,
+    ContMDiffAt]
   infer_instance
-#align cont_mdiff_at_iff_target_of_mem_source contMdiffAt_iff_target_of_mem_source
+#align cont_mdiff_at_iff_target_of_mem_source contMDiffAt_iff_target_of_mem_source
+-/
 
-theorem contMdiffWithinAt_iff_source_of_mem_maximalAtlas (he : e ∈ maximalAtlas I M)
+#print contMDiffWithinAt_iff_source_of_mem_maximalAtlas /-
+theorem contMDiffWithinAt_iff_source_of_mem_maximalAtlas (he : e ∈ maximalAtlas I M)
     (hx : x ∈ e.source) :
-    ContMdiffWithinAt I I' n f s x ↔
-      ContMdiffWithinAt 𝓘(𝕜, E) I' n (f ∘ (e.extend I).symm) ((e.extend I).symm ⁻¹' s ∩ range I)
+    ContMDiffWithinAt I I' n f s x ↔
+      ContMDiffWithinAt 𝓘(𝕜, E) I' n (f ∘ (e.extend I).symm) ((e.extend I).symm ⁻¹' s ∩ range I)
         (e.extend I x) :=
   by
   have h2x := hx; rw [← e.extend_source I] at h2x 
-  simp_rw [ContMdiffWithinAt,
-    (cont_diff_within_at_localInvariantProp I I' n).liftPropWithinAt_indep_chart_source he hx,
+  simp_rw [ContMDiffWithinAt,
+    (contDiffWithinAt_localInvariantProp I I' n).liftPropWithinAt_indep_chart_source he hx,
     StructureGroupoid.liftPropWithinAt_self_source,
     e.extend_symm_continuous_within_at_comp_right_iff, contDiffWithinAtProp_self_source,
     ContDiffWithinAtProp, Function.comp, e.left_inv hx, (e.extend I).left_inv h2x]
   rfl
-#align cont_mdiff_within_at_iff_source_of_mem_maximal_atlas contMdiffWithinAt_iff_source_of_mem_maximalAtlas
+#align cont_mdiff_within_at_iff_source_of_mem_maximal_atlas contMDiffWithinAt_iff_source_of_mem_maximalAtlas
+-/
 
-theorem contMdiffWithinAt_iff_source_of_mem_source {x' : M} (hx' : x' ∈ (chartAt H x).source) :
-    ContMdiffWithinAt I I' n f s x' ↔
-      ContMdiffWithinAt 𝓘(𝕜, E) I' n (f ∘ (extChartAt I x).symm)
+#print contMDiffWithinAt_iff_source_of_mem_source /-
+theorem contMDiffWithinAt_iff_source_of_mem_source {x' : M} (hx' : x' ∈ (chartAt H x).source) :
+    ContMDiffWithinAt I I' n f s x' ↔
+      ContMDiffWithinAt 𝓘(𝕜, E) I' n (f ∘ (extChartAt I x).symm)
         ((extChartAt I x).symm ⁻¹' s ∩ range I) (extChartAt I x x') :=
-  contMdiffWithinAt_iff_source_of_mem_maximalAtlas (chart_mem_maximalAtlas I x) hx'
-#align cont_mdiff_within_at_iff_source_of_mem_source contMdiffWithinAt_iff_source_of_mem_source
+  contMDiffWithinAt_iff_source_of_mem_maximalAtlas (chart_mem_maximalAtlas I x) hx'
+#align cont_mdiff_within_at_iff_source_of_mem_source contMDiffWithinAt_iff_source_of_mem_source
+-/
 
-theorem contMdiffAt_iff_source_of_mem_source {x' : M} (hx' : x' ∈ (chartAt H x).source) :
-    ContMdiffAt I I' n f x' ↔
-      ContMdiffWithinAt 𝓘(𝕜, E) I' n (f ∘ (extChartAt I x).symm) (range I) (extChartAt I x x') :=
+#print contMDiffAt_iff_source_of_mem_source /-
+theorem contMDiffAt_iff_source_of_mem_source {x' : M} (hx' : x' ∈ (chartAt H x).source) :
+    ContMDiffAt I I' n f x' ↔
+      ContMDiffWithinAt 𝓘(𝕜, E) I' n (f ∘ (extChartAt I x).symm) (range I) (extChartAt I x x') :=
   by
-  simp_rw [ContMdiffAt, contMdiffWithinAt_iff_source_of_mem_source hx', preimage_univ, univ_inter]
-#align cont_mdiff_at_iff_source_of_mem_source contMdiffAt_iff_source_of_mem_source
+  simp_rw [ContMDiffAt, contMDiffWithinAt_iff_source_of_mem_source hx', preimage_univ, univ_inter]
+#align cont_mdiff_at_iff_source_of_mem_source contMDiffAt_iff_source_of_mem_source
+-/
 
-theorem contMdiffOn_iff_of_mem_maximalAtlas (he : e ∈ maximalAtlas I M)
+#print contMDiffOn_iff_of_mem_maximalAtlas /-
+theorem contMDiffOn_iff_of_mem_maximalAtlas (he : e ∈ maximalAtlas I M)
     (he' : e' ∈ maximalAtlas I' M') (hs : s ⊆ e.source) (h2s : MapsTo f s e'.source) :
-    ContMdiffOn I I' n f s ↔
+    ContMDiffOn I I' n f s ↔
       ContinuousOn f s ∧ ContDiffOn 𝕜 n (e'.extend I' ∘ f ∘ (e.extend I).symm) (e.extend I '' s) :=
   by
-  simp_rw [ContinuousOn, ContDiffOn, Set.ball_image_iff, ← forall_and, ContMdiffOn]
-  exact forall₂_congr fun x hx => contMdiffWithinAt_iff_image he he' hs (hs hx) (h2s hx)
-#align cont_mdiff_on_iff_of_mem_maximal_atlas contMdiffOn_iff_of_mem_maximalAtlas
+  simp_rw [ContinuousOn, ContDiffOn, Set.ball_image_iff, ← forall_and, ContMDiffOn]
+  exact forall₂_congr fun x hx => contMDiffWithinAt_iff_image he he' hs (hs hx) (h2s hx)
+#align cont_mdiff_on_iff_of_mem_maximal_atlas contMDiffOn_iff_of_mem_maximalAtlas
+-/
 
+#print contMDiffOn_iff_of_subset_source /-
 /-- If the set where you want `f` to be smooth lies entirely in a single chart, and `f` maps it
   into a single chart, the smoothness of `f` on that set can be expressed by purely looking in
   these charts.
   Note: this lemma uses `ext_chart_at I x '' s` instead of `(ext_chart_at I x).symm ⁻¹' s` to ensure
   that this set lies in `(ext_chart_at I x).target`. -/
-theorem contMdiffOn_iff_of_subset_source {x : M} {y : M'} (hs : s ⊆ (chartAt H x).source)
+theorem contMDiffOn_iff_of_subset_source {x : M} {y : M'} (hs : s ⊆ (chartAt H x).source)
     (h2s : MapsTo f s (chartAt H' y).source) :
-    ContMdiffOn I I' n f s ↔
+    ContMDiffOn I I' n f s ↔
       ContinuousOn f s ∧
         ContDiffOn 𝕜 n (extChartAt I' y ∘ f ∘ (extChartAt I x).symm) (extChartAt I x '' s) :=
-  contMdiffOn_iff_of_mem_maximalAtlas (chart_mem_maximalAtlas I x) (chart_mem_maximalAtlas I' y) hs
+  contMDiffOn_iff_of_mem_maximalAtlas (chart_mem_maximalAtlas I x) (chart_mem_maximalAtlas I' y) hs
     h2s
-#align cont_mdiff_on_iff_of_subset_source contMdiffOn_iff_of_subset_source
+#align cont_mdiff_on_iff_of_subset_source contMDiffOn_iff_of_subset_source
+-/
 
+#print contMDiffOn_iff /-
 /-- One can reformulate smoothness on a set as continuity on this set, and smoothness in any
 extended chart. -/
-theorem contMdiffOn_iff :
-    ContMdiffOn I I' n f s ↔
+theorem contMDiffOn_iff :
+    ContMDiffOn I I' n f s ↔
       ContinuousOn f s ∧
         ∀ (x : M) (y : M'),
           ContDiffOn 𝕜 n (extChartAt I' y ∘ f ∘ (extChartAt I x).symm)
@@ -549,27 +648,29 @@ theorem contMdiffOn_iff :
     specialize h w this
     have w1 : w ∈ (chart_at H x).source := by simp only [w, hz, mfld_simps]
     have w2 : f w ∈ (chart_at H' y).source := by simp only [w, hz, mfld_simps]
-    convert ((contMdiffWithinAt_iff_of_mem_source w1 w2).mp h).2.mono _
+    convert ((contMDiffWithinAt_iff_of_mem_source w1 w2).mp h).2.mono _
     · simp only [w, hz, mfld_simps]
     · mfld_set_tac
   · rintro ⟨hcont, hdiff⟩ x hx
-    refine' (cont_diff_within_at_localInvariantProp I I' n).liftPropWithinAt_iff.mpr _
+    refine' (contDiffWithinAt_localInvariantProp I I' n).liftPropWithinAt_iff.mpr _
     refine' ⟨hcont x hx, _⟩
     dsimp [ContDiffWithinAtProp]
     convert hdiff x (f x) (extChartAt I x x) (by simp only [hx, mfld_simps]) using 1
     mfld_set_tac
-#align cont_mdiff_on_iff contMdiffOn_iff
+#align cont_mdiff_on_iff contMDiffOn_iff
+-/
 
+#print contMDiffOn_iff_target /-
 /-- One can reformulate smoothness on a set as continuity on this set, and smoothness in any
 extended chart in the target. -/
-theorem contMdiffOn_iff_target :
-    ContMdiffOn I I' n f s ↔
+theorem contMDiffOn_iff_target :
+    ContMDiffOn I I' n f s ↔
       ContinuousOn f s ∧
         ∀ y : M',
-          ContMdiffOn I 𝓘(𝕜, E') n (extChartAt I' y ∘ f) (s ∩ f ⁻¹' (extChartAt I' y).source) :=
+          ContMDiffOn I 𝓘(𝕜, E') n (extChartAt I' y ∘ f) (s ∩ f ⁻¹' (extChartAt I' y).source) :=
   by
   inhabit E'
-  simp only [contMdiffOn_iff, ModelWithCorners.source_eq, chartAt_self_eq,
+  simp only [contMDiffOn_iff, ModelWithCorners.source_eq, chartAt_self_eq,
     LocalHomeomorph.refl_localEquiv, LocalEquiv.refl_trans, extChartAt, LocalHomeomorph.extend,
     Set.preimage_univ, Set.inter_univ, and_congr_right_iff]
   intro h
@@ -579,8 +680,10 @@ theorem contMdiffOn_iff_target :
     convert (h''.comp' (chart_at H' y).continuous_toFun).comp' h
     simp
   · exact fun h' x y => (h' y).2 x default
-#align cont_mdiff_on_iff_target contMdiffOn_iff_target
+#align cont_mdiff_on_iff_target contMDiffOn_iff_target
+-/
 
+#print smoothOn_iff /-
 theorem smoothOn_iff :
     SmoothOn I I' f s ↔
       ContinuousOn f s ∧
@@ -588,38 +691,46 @@ theorem smoothOn_iff :
           ContDiffOn 𝕜 ⊤ (extChartAt I' y ∘ f ∘ (extChartAt I x).symm)
             ((extChartAt I x).target ∩
               (extChartAt I x).symm ⁻¹' (s ∩ f ⁻¹' (extChartAt I' y).source)) :=
-  contMdiffOn_iff
+  contMDiffOn_iff
 #align smooth_on_iff smoothOn_iff
+-/
 
+#print smoothOn_iff_target /-
 theorem smoothOn_iff_target :
     SmoothOn I I' f s ↔
       ContinuousOn f s ∧
         ∀ y : M', SmoothOn I 𝓘(𝕜, E') (extChartAt I' y ∘ f) (s ∩ f ⁻¹' (extChartAt I' y).source) :=
-  contMdiffOn_iff_target
+  contMDiffOn_iff_target
 #align smooth_on_iff_target smoothOn_iff_target
+-/
 
+#print contMDiff_iff /-
 /-- One can reformulate smoothness as continuity and smoothness in any extended chart. -/
-theorem contMdiff_iff :
-    ContMdiff I I' n f ↔
+theorem contMDiff_iff :
+    ContMDiff I I' n f ↔
       Continuous f ∧
         ∀ (x : M) (y : M'),
           ContDiffOn 𝕜 n (extChartAt I' y ∘ f ∘ (extChartAt I x).symm)
             ((extChartAt I x).target ∩
               (extChartAt I x).symm ⁻¹' (f ⁻¹' (extChartAt I' y).source)) :=
-  by simp [← contMdiffOn_univ, contMdiffOn_iff, continuous_iff_continuousOn_univ]
-#align cont_mdiff_iff contMdiff_iff
+  by simp [← contMDiffOn_univ, contMDiffOn_iff, continuous_iff_continuousOn_univ]
+#align cont_mdiff_iff contMDiff_iff
+-/
 
+#print contMDiff_iff_target /-
 /-- One can reformulate smoothness as continuity and smoothness in any extended chart in the
 target. -/
-theorem contMdiff_iff_target :
-    ContMdiff I I' n f ↔
+theorem contMDiff_iff_target :
+    ContMDiff I I' n f ↔
       Continuous f ∧
-        ∀ y : M', ContMdiffOn I 𝓘(𝕜, E') n (extChartAt I' y ∘ f) (f ⁻¹' (extChartAt I' y).source) :=
+        ∀ y : M', ContMDiffOn I 𝓘(𝕜, E') n (extChartAt I' y ∘ f) (f ⁻¹' (extChartAt I' y).source) :=
   by
-  rw [← contMdiffOn_univ, contMdiffOn_iff_target]
+  rw [← contMDiffOn_univ, contMDiffOn_iff_target]
   simp [continuous_iff_continuousOn_univ]
-#align cont_mdiff_iff_target contMdiff_iff_target
+#align cont_mdiff_iff_target contMDiff_iff_target
+-/
 
+#print smooth_iff /-
 theorem smooth_iff :
     Smooth I I' f ↔
       Continuous f ∧
@@ -627,191 +738,259 @@ theorem smooth_iff :
           ContDiffOn 𝕜 ⊤ (extChartAt I' y ∘ f ∘ (extChartAt I x).symm)
             ((extChartAt I x).target ∩
               (extChartAt I x).symm ⁻¹' (f ⁻¹' (extChartAt I' y).source)) :=
-  contMdiff_iff
+  contMDiff_iff
 #align smooth_iff smooth_iff
+-/
 
+#print smooth_iff_target /-
 theorem smooth_iff_target :
     Smooth I I' f ↔
       Continuous f ∧
         ∀ y : M', SmoothOn I 𝓘(𝕜, E') (extChartAt I' y ∘ f) (f ⁻¹' (extChartAt I' y).source) :=
-  contMdiff_iff_target
+  contMDiff_iff_target
 #align smooth_iff_target smooth_iff_target
+-/
 
 /-! ### Deducing smoothness from higher smoothness -/
 
 
-theorem ContMdiffWithinAt.of_le (hf : ContMdiffWithinAt I I' n f s x) (le : m ≤ n) :
-    ContMdiffWithinAt I I' m f s x :=
+#print ContMDiffWithinAt.of_le /-
+theorem ContMDiffWithinAt.of_le (hf : ContMDiffWithinAt I I' n f s x) (le : m ≤ n) :
+    ContMDiffWithinAt I I' m f s x :=
   ⟨hf.1, hf.2.of_le le⟩
-#align cont_mdiff_within_at.of_le ContMdiffWithinAt.of_le
+#align cont_mdiff_within_at.of_le ContMDiffWithinAt.of_le
+-/
 
-theorem ContMdiffAt.of_le (hf : ContMdiffAt I I' n f x) (le : m ≤ n) : ContMdiffAt I I' m f x :=
-  ContMdiffWithinAt.of_le hf le
-#align cont_mdiff_at.of_le ContMdiffAt.of_le
+#print ContMDiffAt.of_le /-
+theorem ContMDiffAt.of_le (hf : ContMDiffAt I I' n f x) (le : m ≤ n) : ContMDiffAt I I' m f x :=
+  ContMDiffWithinAt.of_le hf le
+#align cont_mdiff_at.of_le ContMDiffAt.of_le
+-/
 
-theorem ContMdiffOn.of_le (hf : ContMdiffOn I I' n f s) (le : m ≤ n) : ContMdiffOn I I' m f s :=
+#print ContMDiffOn.of_le /-
+theorem ContMDiffOn.of_le (hf : ContMDiffOn I I' n f s) (le : m ≤ n) : ContMDiffOn I I' m f s :=
   fun x hx => (hf x hx).of_le le
-#align cont_mdiff_on.of_le ContMdiffOn.of_le
+#align cont_mdiff_on.of_le ContMDiffOn.of_le
+-/
 
-theorem ContMdiff.of_le (hf : ContMdiff I I' n f) (le : m ≤ n) : ContMdiff I I' m f := fun x =>
+#print ContMDiff.of_le /-
+theorem ContMDiff.of_le (hf : ContMDiff I I' n f) (le : m ≤ n) : ContMDiff I I' m f := fun x =>
   (hf x).of_le le
-#align cont_mdiff.of_le ContMdiff.of_le
+#align cont_mdiff.of_le ContMDiff.of_le
+-/
 
 /-! ### Deducing smoothness from smoothness one step beyond -/
 
 
-theorem ContMdiffWithinAt.of_succ {n : ℕ} (h : ContMdiffWithinAt I I' n.succ f s x) :
-    ContMdiffWithinAt I I' n f s x :=
+#print ContMDiffWithinAt.of_succ /-
+theorem ContMDiffWithinAt.of_succ {n : ℕ} (h : ContMDiffWithinAt I I' n.succ f s x) :
+    ContMDiffWithinAt I I' n f s x :=
   h.of_le (WithTop.coe_le_coe.2 (Nat.le_succ n))
-#align cont_mdiff_within_at.of_succ ContMdiffWithinAt.of_succ
+#align cont_mdiff_within_at.of_succ ContMDiffWithinAt.of_succ
+-/
 
-theorem ContMdiffAt.of_succ {n : ℕ} (h : ContMdiffAt I I' n.succ f x) : ContMdiffAt I I' n f x :=
-  ContMdiffWithinAt.of_succ h
-#align cont_mdiff_at.of_succ ContMdiffAt.of_succ
+#print ContMDiffAt.of_succ /-
+theorem ContMDiffAt.of_succ {n : ℕ} (h : ContMDiffAt I I' n.succ f x) : ContMDiffAt I I' n f x :=
+  ContMDiffWithinAt.of_succ h
+#align cont_mdiff_at.of_succ ContMDiffAt.of_succ
+-/
 
-theorem ContMdiffOn.of_succ {n : ℕ} (h : ContMdiffOn I I' n.succ f s) : ContMdiffOn I I' n f s :=
+#print ContMDiffOn.of_succ /-
+theorem ContMDiffOn.of_succ {n : ℕ} (h : ContMDiffOn I I' n.succ f s) : ContMDiffOn I I' n f s :=
   fun x hx => (h x hx).of_succ
-#align cont_mdiff_on.of_succ ContMdiffOn.of_succ
+#align cont_mdiff_on.of_succ ContMDiffOn.of_succ
+-/
 
-theorem ContMdiff.of_succ {n : ℕ} (h : ContMdiff I I' n.succ f) : ContMdiff I I' n f := fun x =>
+#print ContMDiff.of_succ /-
+theorem ContMDiff.of_succ {n : ℕ} (h : ContMDiff I I' n.succ f) : ContMDiff I I' n f := fun x =>
   (h x).of_succ
-#align cont_mdiff.of_succ ContMdiff.of_succ
+#align cont_mdiff.of_succ ContMDiff.of_succ
+-/
 
 /-! ### Deducing continuity from smoothness -/
 
 
-theorem ContMdiffWithinAt.continuousWithinAt (hf : ContMdiffWithinAt I I' n f s x) :
+#print ContMDiffWithinAt.continuousWithinAt /-
+theorem ContMDiffWithinAt.continuousWithinAt (hf : ContMDiffWithinAt I I' n f s x) :
     ContinuousWithinAt f s x :=
   hf.1
-#align cont_mdiff_within_at.continuous_within_at ContMdiffWithinAt.continuousWithinAt
+#align cont_mdiff_within_at.continuous_within_at ContMDiffWithinAt.continuousWithinAt
+-/
 
-theorem ContMdiffAt.continuousAt (hf : ContMdiffAt I I' n f x) : ContinuousAt f x :=
-  (continuousWithinAt_univ _ _).1 <| ContMdiffWithinAt.continuousWithinAt hf
-#align cont_mdiff_at.continuous_at ContMdiffAt.continuousAt
+#print ContMDiffAt.continuousAt /-
+theorem ContMDiffAt.continuousAt (hf : ContMDiffAt I I' n f x) : ContinuousAt f x :=
+  (continuousWithinAt_univ _ _).1 <| ContMDiffWithinAt.continuousWithinAt hf
+#align cont_mdiff_at.continuous_at ContMDiffAt.continuousAt
+-/
 
-theorem ContMdiffOn.continuousOn (hf : ContMdiffOn I I' n f s) : ContinuousOn f s := fun x hx =>
+#print ContMDiffOn.continuousOn /-
+theorem ContMDiffOn.continuousOn (hf : ContMDiffOn I I' n f s) : ContinuousOn f s := fun x hx =>
   (hf x hx).ContinuousWithinAt
-#align cont_mdiff_on.continuous_on ContMdiffOn.continuousOn
+#align cont_mdiff_on.continuous_on ContMDiffOn.continuousOn
+-/
 
-theorem ContMdiff.continuous (hf : ContMdiff I I' n f) : Continuous f :=
+#print ContMDiff.continuous /-
+theorem ContMDiff.continuous (hf : ContMDiff I I' n f) : Continuous f :=
   continuous_iff_continuousAt.2 fun x => (hf x).ContinuousAt
-#align cont_mdiff.continuous ContMdiff.continuous
+#align cont_mdiff.continuous ContMDiff.continuous
+-/
 
 /-! ### `C^∞` smoothness -/
 
 
-theorem contMdiffWithinAt_top :
-    SmoothWithinAt I I' f s x ↔ ∀ n : ℕ, ContMdiffWithinAt I I' n f s x :=
+#print contMDiffWithinAt_top /-
+theorem contMDiffWithinAt_top :
+    SmoothWithinAt I I' f s x ↔ ∀ n : ℕ, ContMDiffWithinAt I I' n f s x :=
   ⟨fun h n => ⟨h.1, contDiffWithinAt_top.1 h.2 n⟩, fun H =>
     ⟨(H 0).1, contDiffWithinAt_top.2 fun n => (H n).2⟩⟩
-#align cont_mdiff_within_at_top contMdiffWithinAt_top
+#align cont_mdiff_within_at_top contMDiffWithinAt_top
+-/
 
-theorem contMdiffAt_top : SmoothAt I I' f x ↔ ∀ n : ℕ, ContMdiffAt I I' n f x :=
-  contMdiffWithinAt_top
-#align cont_mdiff_at_top contMdiffAt_top
+#print contMDiffAt_top /-
+theorem contMDiffAt_top : SmoothAt I I' f x ↔ ∀ n : ℕ, ContMDiffAt I I' n f x :=
+  contMDiffWithinAt_top
+#align cont_mdiff_at_top contMDiffAt_top
+-/
 
-theorem contMdiffOn_top : SmoothOn I I' f s ↔ ∀ n : ℕ, ContMdiffOn I I' n f s :=
-  ⟨fun h n => h.of_le le_top, fun h x hx => contMdiffWithinAt_top.2 fun n => h n x hx⟩
-#align cont_mdiff_on_top contMdiffOn_top
+#print contMDiffOn_top /-
+theorem contMDiffOn_top : SmoothOn I I' f s ↔ ∀ n : ℕ, ContMDiffOn I I' n f s :=
+  ⟨fun h n => h.of_le le_top, fun h x hx => contMDiffWithinAt_top.2 fun n => h n x hx⟩
+#align cont_mdiff_on_top contMDiffOn_top
+-/
 
-theorem contMdiff_top : Smooth I I' f ↔ ∀ n : ℕ, ContMdiff I I' n f :=
-  ⟨fun h n => h.of_le le_top, fun h x => contMdiffWithinAt_top.2 fun n => h n x⟩
-#align cont_mdiff_top contMdiff_top
+#print contMDiff_top /-
+theorem contMDiff_top : Smooth I I' f ↔ ∀ n : ℕ, ContMDiff I I' n f :=
+  ⟨fun h n => h.of_le le_top, fun h x => contMDiffWithinAt_top.2 fun n => h n x⟩
+#align cont_mdiff_top contMDiff_top
+-/
 
-theorem contMdiffWithinAt_iff_nat :
-    ContMdiffWithinAt I I' n f s x ↔ ∀ m : ℕ, (m : ℕ∞) ≤ n → ContMdiffWithinAt I I' m f s x :=
+#print contMDiffWithinAt_iff_nat /-
+theorem contMDiffWithinAt_iff_nat :
+    ContMDiffWithinAt I I' n f s x ↔ ∀ m : ℕ, (m : ℕ∞) ≤ n → ContMDiffWithinAt I I' m f s x :=
   by
   refine' ⟨fun h m hm => h.of_le hm, fun h => _⟩
   cases n
-  · exact contMdiffWithinAt_top.2 fun n => h n le_top
+  · exact contMDiffWithinAt_top.2 fun n => h n le_top
   · exact h n le_rfl
-#align cont_mdiff_within_at_iff_nat contMdiffWithinAt_iff_nat
+#align cont_mdiff_within_at_iff_nat contMDiffWithinAt_iff_nat
+-/
 
 /-! ### Restriction to a smaller set -/
 
 
-theorem ContMdiffWithinAt.mono_of_mem (hf : ContMdiffWithinAt I I' n f s x) (hts : s ∈ 𝓝[t] x) :
-    ContMdiffWithinAt I I' n f t x :=
+#print ContMDiffWithinAt.mono_of_mem /-
+theorem ContMDiffWithinAt.mono_of_mem (hf : ContMDiffWithinAt I I' n f s x) (hts : s ∈ 𝓝[t] x) :
+    ContMDiffWithinAt I I' n f t x :=
   StructureGroupoid.LocalInvariantProp.liftPropWithinAt_mono_of_mem
     (contDiffWithinAtProp_mono_of_mem I I' n) hf hts
-#align cont_mdiff_within_at.mono_of_mem ContMdiffWithinAt.mono_of_mem
+#align cont_mdiff_within_at.mono_of_mem ContMDiffWithinAt.mono_of_mem
+-/
 
-theorem ContMdiffWithinAt.mono (hf : ContMdiffWithinAt I I' n f s x) (hts : t ⊆ s) :
-    ContMdiffWithinAt I I' n f t x :=
+#print ContMDiffWithinAt.mono /-
+theorem ContMDiffWithinAt.mono (hf : ContMDiffWithinAt I I' n f s x) (hts : t ⊆ s) :
+    ContMDiffWithinAt I I' n f t x :=
   hf.mono_of_mem <| mem_of_superset self_mem_nhdsWithin hts
-#align cont_mdiff_within_at.mono ContMdiffWithinAt.mono
+#align cont_mdiff_within_at.mono ContMDiffWithinAt.mono
+-/
 
-theorem contMdiffWithinAt_congr_nhds (hst : 𝓝[s] x = 𝓝[t] x) :
-    ContMdiffWithinAt I I' n f s x ↔ ContMdiffWithinAt I I' n f t x :=
+#print contMDiffWithinAt_congr_nhds /-
+theorem contMDiffWithinAt_congr_nhds (hst : 𝓝[s] x = 𝓝[t] x) :
+    ContMDiffWithinAt I I' n f s x ↔ ContMDiffWithinAt I I' n f t x :=
   ⟨fun h => h.mono_of_mem <| hst ▸ self_mem_nhdsWithin, fun h =>
     h.mono_of_mem <| hst.symm ▸ self_mem_nhdsWithin⟩
-#align cont_mdiff_within_at_congr_nhds contMdiffWithinAt_congr_nhds
+#align cont_mdiff_within_at_congr_nhds contMDiffWithinAt_congr_nhds
+-/
 
-theorem ContMdiffAt.contMdiffWithinAt (hf : ContMdiffAt I I' n f x) :
-    ContMdiffWithinAt I I' n f s x :=
-  ContMdiffWithinAt.mono hf (subset_univ _)
-#align cont_mdiff_at.cont_mdiff_within_at ContMdiffAt.contMdiffWithinAt
+#print ContMDiffAt.contMDiffWithinAt /-
+theorem ContMDiffAt.contMDiffWithinAt (hf : ContMDiffAt I I' n f x) :
+    ContMDiffWithinAt I I' n f s x :=
+  ContMDiffWithinAt.mono hf (subset_univ _)
+#align cont_mdiff_at.cont_mdiff_within_at ContMDiffAt.contMDiffWithinAt
+-/
 
+#print SmoothAt.smoothWithinAt /-
 theorem SmoothAt.smoothWithinAt (hf : SmoothAt I I' f x) : SmoothWithinAt I I' f s x :=
-  ContMdiffAt.contMdiffWithinAt hf
+  ContMDiffAt.contMDiffWithinAt hf
 #align smooth_at.smooth_within_at SmoothAt.smoothWithinAt
+-/
 
-theorem ContMdiffOn.mono (hf : ContMdiffOn I I' n f s) (hts : t ⊆ s) : ContMdiffOn I I' n f t :=
+#print ContMDiffOn.mono /-
+theorem ContMDiffOn.mono (hf : ContMDiffOn I I' n f s) (hts : t ⊆ s) : ContMDiffOn I I' n f t :=
   fun x hx => (hf x (hts hx)).mono hts
-#align cont_mdiff_on.mono ContMdiffOn.mono
+#align cont_mdiff_on.mono ContMDiffOn.mono
+-/
 
-theorem ContMdiff.contMdiffOn (hf : ContMdiff I I' n f) : ContMdiffOn I I' n f s := fun x hx =>
-  (hf x).ContMdiffWithinAt
-#align cont_mdiff.cont_mdiff_on ContMdiff.contMdiffOn
+#print ContMDiff.contMDiffOn /-
+theorem ContMDiff.contMDiffOn (hf : ContMDiff I I' n f) : ContMDiffOn I I' n f s := fun x hx =>
+  (hf x).ContMDiffWithinAt
+#align cont_mdiff.cont_mdiff_on ContMDiff.contMDiffOn
+-/
 
+#print Smooth.smoothOn /-
 theorem Smooth.smoothOn (hf : Smooth I I' f) : SmoothOn I I' f s :=
-  ContMdiff.contMdiffOn hf
+  ContMDiff.contMDiffOn hf
 #align smooth.smooth_on Smooth.smoothOn
+-/
 
-theorem contMdiffWithinAt_inter' (ht : t ∈ 𝓝[s] x) :
-    ContMdiffWithinAt I I' n f (s ∩ t) x ↔ ContMdiffWithinAt I I' n f s x :=
-  (cont_diff_within_at_localInvariantProp I I' n).liftPropWithinAt_inter' ht
-#align cont_mdiff_within_at_inter' contMdiffWithinAt_inter'
+#print contMDiffWithinAt_inter' /-
+theorem contMDiffWithinAt_inter' (ht : t ∈ 𝓝[s] x) :
+    ContMDiffWithinAt I I' n f (s ∩ t) x ↔ ContMDiffWithinAt I I' n f s x :=
+  (contDiffWithinAt_localInvariantProp I I' n).liftPropWithinAt_inter' ht
+#align cont_mdiff_within_at_inter' contMDiffWithinAt_inter'
+-/
 
-theorem contMdiffWithinAt_inter (ht : t ∈ 𝓝 x) :
-    ContMdiffWithinAt I I' n f (s ∩ t) x ↔ ContMdiffWithinAt I I' n f s x :=
-  (cont_diff_within_at_localInvariantProp I I' n).liftPropWithinAt_inter ht
-#align cont_mdiff_within_at_inter contMdiffWithinAt_inter
+#print contMDiffWithinAt_inter /-
+theorem contMDiffWithinAt_inter (ht : t ∈ 𝓝 x) :
+    ContMDiffWithinAt I I' n f (s ∩ t) x ↔ ContMDiffWithinAt I I' n f s x :=
+  (contDiffWithinAt_localInvariantProp I I' n).liftPropWithinAt_inter ht
+#align cont_mdiff_within_at_inter contMDiffWithinAt_inter
+-/
 
-theorem ContMdiffWithinAt.contMdiffAt (h : ContMdiffWithinAt I I' n f s x) (ht : s ∈ 𝓝 x) :
-    ContMdiffAt I I' n f x :=
-  (cont_diff_within_at_localInvariantProp I I' n).liftPropAt_of_liftPropWithinAt h ht
-#align cont_mdiff_within_at.cont_mdiff_at ContMdiffWithinAt.contMdiffAt
+#print ContMDiffWithinAt.contMDiffAt /-
+theorem ContMDiffWithinAt.contMDiffAt (h : ContMDiffWithinAt I I' n f s x) (ht : s ∈ 𝓝 x) :
+    ContMDiffAt I I' n f x :=
+  (contDiffWithinAt_localInvariantProp I I' n).liftPropAt_of_liftPropWithinAt h ht
+#align cont_mdiff_within_at.cont_mdiff_at ContMDiffWithinAt.contMDiffAt
+-/
 
+#print SmoothWithinAt.smoothAt /-
 theorem SmoothWithinAt.smoothAt (h : SmoothWithinAt I I' f s x) (ht : s ∈ 𝓝 x) :
     SmoothAt I I' f x :=
-  ContMdiffWithinAt.contMdiffAt h ht
+  ContMDiffWithinAt.contMDiffAt h ht
 #align smooth_within_at.smooth_at SmoothWithinAt.smoothAt
+-/
 
-theorem ContMdiffOn.contMdiffAt (h : ContMdiffOn I I' n f s) (hx : s ∈ 𝓝 x) :
-    ContMdiffAt I I' n f x :=
-  (h x (mem_of_mem_nhds hx)).ContMdiffAt hx
-#align cont_mdiff_on.cont_mdiff_at ContMdiffOn.contMdiffAt
+#print ContMDiffOn.contMDiffAt /-
+theorem ContMDiffOn.contMDiffAt (h : ContMDiffOn I I' n f s) (hx : s ∈ 𝓝 x) :
+    ContMDiffAt I I' n f x :=
+  (h x (mem_of_mem_nhds hx)).ContMDiffAt hx
+#align cont_mdiff_on.cont_mdiff_at ContMDiffOn.contMDiffAt
+-/
 
+#print SmoothOn.smoothAt /-
 theorem SmoothOn.smoothAt (h : SmoothOn I I' f s) (hx : s ∈ 𝓝 x) : SmoothAt I I' f x :=
-  h.ContMdiffAt hx
+  h.ContMDiffAt hx
 #align smooth_on.smooth_at SmoothOn.smoothAt
+-/
 
-theorem contMdiffOn_iff_source_of_mem_maximalAtlas (he : e ∈ maximalAtlas I M) (hs : s ⊆ e.source) :
-    ContMdiffOn I I' n f s ↔ ContMdiffOn 𝓘(𝕜, E) I' n (f ∘ (e.extend I).symm) (e.extend I '' s) :=
+#print contMDiffOn_iff_source_of_mem_maximalAtlas /-
+theorem contMDiffOn_iff_source_of_mem_maximalAtlas (he : e ∈ maximalAtlas I M) (hs : s ⊆ e.source) :
+    ContMDiffOn I I' n f s ↔ ContMDiffOn 𝓘(𝕜, E) I' n (f ∘ (e.extend I).symm) (e.extend I '' s) :=
   by
-  simp_rw [ContMdiffOn, Set.ball_image_iff]
+  simp_rw [ContMDiffOn, Set.ball_image_iff]
   refine' forall₂_congr fun x hx => _
-  rw [contMdiffWithinAt_iff_source_of_mem_maximalAtlas he (hs hx)]
-  apply contMdiffWithinAt_congr_nhds
+  rw [contMDiffWithinAt_iff_source_of_mem_maximalAtlas he (hs hx)]
+  apply contMDiffWithinAt_congr_nhds
   simp_rw [nhdsWithin_eq_iff_eventuallyEq,
     e.extend_symm_preimage_inter_range_eventually_eq I hs (hs hx)]
-#align cont_mdiff_on_iff_source_of_mem_maximal_atlas contMdiffOn_iff_source_of_mem_maximalAtlas
+#align cont_mdiff_on_iff_source_of_mem_maximal_atlas contMDiffOn_iff_source_of_mem_maximalAtlas
+-/
 
+#print contMDiffWithinAt_iff_contMDiffOn_nhds /-
 /-- A function is `C^n` within a set at a point, for `n : ℕ`, if and only if it is `C^n` on
 a neighborhood of this point. -/
-theorem contMdiffWithinAt_iff_contMdiffOn_nhds {n : ℕ} :
-    ContMdiffWithinAt I I' n f s x ↔ ∃ u ∈ 𝓝[insert x s] x, ContMdiffOn I I' n f u :=
+theorem contMDiffWithinAt_iff_contMDiffOn_nhds {n : ℕ} :
+    ContMDiffWithinAt I I' n f s x ↔ ∃ u ∈ 𝓝[insert x s] x, ContMDiffOn I I' n f u :=
   by
   constructor
   · intro h
@@ -828,8 +1007,8 @@ theorem contMdiffWithinAt_iff_contMdiffOn_nhds {n : ℕ} :
       · exact IsOpen.inter u_open (LocalHomeomorph.open_source _)
       · intro y hy; exact hy.2
       · intro y hy; exact hu ⟨hy.1.1, hy.2⟩
-    have h' : ContMdiffWithinAt I I' n f (s ∩ o) x := h.mono (inter_subset_left _ _)
-    simp only [ContMdiffWithinAt, lift_prop_within_at, ContDiffWithinAtProp] at h' 
+    have h' : ContMDiffWithinAt I I' n f (s ∩ o) x := h.mono (inter_subset_left _ _)
+    simp only [ContMDiffWithinAt, lift_prop_within_at, ContDiffWithinAtProp] at h' 
     -- let `u` be a good neighborhood in the chart where the function is smooth
     rcases h.2.ContDiffOn le_rfl with ⟨u, u_nhds, u_subset, hu⟩
     -- pull it back to the manifold, and intersect with a suitable neighborhood of `x`, to get the
@@ -854,7 +1033,7 @@ theorem contMdiffWithinAt_iff_contMdiffOn_nhds {n : ℕ} :
       rcases hy.1 with (rfl | h')
       · simp only [mem_insert_iff, mfld_simps]
       · simp only [mem_insert_iff, ho hy.2, h', h'o ⟨hy.2, h'⟩, mfld_simps]
-    show ContMdiffOn I I' n f v
+    show ContMDiffOn I I' n f v
     · intro y hy
       have : ContinuousWithinAt f v y :=
         by
@@ -869,7 +1048,7 @@ theorem contMdiffWithinAt_iff_contMdiffOn_nhds {n : ℕ} :
         · simp only [v_incl hy, v_incl' y hy, mfld_simps]
         · simp only [v_incl hy, v_incl' y hy, mfld_simps]
         · simp only [v_incl hy, mfld_simps]
-      refine' (contMdiffWithinAt_iff_of_mem_source' (v_incl hy) (v_incl' y hy)).mpr ⟨this, _⟩
+      refine' (contMDiffWithinAt_iff_of_mem_source' (v_incl hy) (v_incl' y hy)).mpr ⟨this, _⟩
       · apply hu.mono
         · intro z hz
           simp only [v, mfld_simps] at hz 
@@ -878,100 +1057,126 @@ theorem contMdiffWithinAt_iff_contMdiffOn_nhds {n : ℕ} :
         · have exty : I (chart_at H x y) ∈ u := hy.2
           simp only [v_incl hy, v_incl' y hy, exty, hy.1.1, hy.1.2, mfld_simps]
   · rintro ⟨u, u_nhds, hu⟩
-    have : ContMdiffWithinAt I I' (↑n) f (insert x s ∩ u) x :=
+    have : ContMDiffWithinAt I I' (↑n) f (insert x s ∩ u) x :=
       haveI : x ∈ insert x s := mem_insert x s
       hu.mono (inter_subset_right _ _) _ ⟨this, mem_of_mem_nhdsWithin this u_nhds⟩
-    rw [contMdiffWithinAt_inter' u_nhds] at this 
+    rw [contMDiffWithinAt_inter' u_nhds] at this 
     exact this.mono (subset_insert x s)
-#align cont_mdiff_within_at_iff_cont_mdiff_on_nhds contMdiffWithinAt_iff_contMdiffOn_nhds
+#align cont_mdiff_within_at_iff_cont_mdiff_on_nhds contMDiffWithinAt_iff_contMDiffOn_nhds
+-/
 
+#print contMDiffAt_iff_contMDiffOn_nhds /-
 /-- A function is `C^n` at a point, for `n : ℕ`, if and only if it is `C^n` on
 a neighborhood of this point. -/
-theorem contMdiffAt_iff_contMdiffOn_nhds {n : ℕ} :
-    ContMdiffAt I I' n f x ↔ ∃ u ∈ 𝓝 x, ContMdiffOn I I' n f u := by
-  simp [← contMdiffWithinAt_univ, contMdiffWithinAt_iff_contMdiffOn_nhds, nhdsWithin_univ]
-#align cont_mdiff_at_iff_cont_mdiff_on_nhds contMdiffAt_iff_contMdiffOn_nhds
+theorem contMDiffAt_iff_contMDiffOn_nhds {n : ℕ} :
+    ContMDiffAt I I' n f x ↔ ∃ u ∈ 𝓝 x, ContMDiffOn I I' n f u := by
+  simp [← contMDiffWithinAt_univ, contMDiffWithinAt_iff_contMDiffOn_nhds, nhdsWithin_univ]
+#align cont_mdiff_at_iff_cont_mdiff_on_nhds contMDiffAt_iff_contMDiffOn_nhds
+-/
 
+#print contMDiffAt_iff_contMDiffAt_nhds /-
 /-- Note: This does not hold for `n = ∞`. `f` being `C^∞` at `x` means that for every `n`, `f` is
 `C^n` on some neighborhood of `x`, but this neighborhood can depend on `n`. -/
-theorem contMdiffAt_iff_contMdiffAt_nhds {n : ℕ} :
-    ContMdiffAt I I' n f x ↔ ∀ᶠ x' in 𝓝 x, ContMdiffAt I I' n f x' :=
+theorem contMDiffAt_iff_contMDiffAt_nhds {n : ℕ} :
+    ContMDiffAt I I' n f x ↔ ∀ᶠ x' in 𝓝 x, ContMDiffAt I I' n f x' :=
   by
   refine' ⟨_, fun h => h.self_of_nhds⟩
-  rw [contMdiffAt_iff_contMdiffOn_nhds]
+  rw [contMDiffAt_iff_contMDiffOn_nhds]
   rintro ⟨u, hu, h⟩
   refine' (eventually_mem_nhds.mpr hu).mono fun x' hx' => _
-  exact (h x' <| mem_of_mem_nhds hx').ContMdiffAt hx'
-#align cont_mdiff_at_iff_cont_mdiff_at_nhds contMdiffAt_iff_contMdiffAt_nhds
+  exact (h x' <| mem_of_mem_nhds hx').ContMDiffAt hx'
+#align cont_mdiff_at_iff_cont_mdiff_at_nhds contMDiffAt_iff_contMDiffAt_nhds
+-/
 
 /-! ### Congruence lemmas -/
 
 
-theorem ContMdiffWithinAt.congr (h : ContMdiffWithinAt I I' n f s x) (h₁ : ∀ y ∈ s, f₁ y = f y)
-    (hx : f₁ x = f x) : ContMdiffWithinAt I I' n f₁ s x :=
-  (cont_diff_within_at_localInvariantProp I I' n).liftPropWithinAt_congr h h₁ hx
-#align cont_mdiff_within_at.congr ContMdiffWithinAt.congr
+#print ContMDiffWithinAt.congr /-
+theorem ContMDiffWithinAt.congr (h : ContMDiffWithinAt I I' n f s x) (h₁ : ∀ y ∈ s, f₁ y = f y)
+    (hx : f₁ x = f x) : ContMDiffWithinAt I I' n f₁ s x :=
+  (contDiffWithinAt_localInvariantProp I I' n).liftPropWithinAt_congr h h₁ hx
+#align cont_mdiff_within_at.congr ContMDiffWithinAt.congr
+-/
 
-theorem contMdiffWithinAt_congr (h₁ : ∀ y ∈ s, f₁ y = f y) (hx : f₁ x = f x) :
-    ContMdiffWithinAt I I' n f₁ s x ↔ ContMdiffWithinAt I I' n f s x :=
-  (cont_diff_within_at_localInvariantProp I I' n).liftPropWithinAt_congr_iff h₁ hx
-#align cont_mdiff_within_at_congr contMdiffWithinAt_congr
+#print contMDiffWithinAt_congr /-
+theorem contMDiffWithinAt_congr (h₁ : ∀ y ∈ s, f₁ y = f y) (hx : f₁ x = f x) :
+    ContMDiffWithinAt I I' n f₁ s x ↔ ContMDiffWithinAt I I' n f s x :=
+  (contDiffWithinAt_localInvariantProp I I' n).liftPropWithinAt_congr_iff h₁ hx
+#align cont_mdiff_within_at_congr contMDiffWithinAt_congr
+-/
 
-theorem ContMdiffWithinAt.congr_of_eventuallyEq (h : ContMdiffWithinAt I I' n f s x)
-    (h₁ : f₁ =ᶠ[𝓝[s] x] f) (hx : f₁ x = f x) : ContMdiffWithinAt I I' n f₁ s x :=
-  (cont_diff_within_at_localInvariantProp I I' n).liftPropWithinAt_congr_of_eventuallyEq h h₁ hx
-#align cont_mdiff_within_at.congr_of_eventually_eq ContMdiffWithinAt.congr_of_eventuallyEq
+#print ContMDiffWithinAt.congr_of_eventuallyEq /-
+theorem ContMDiffWithinAt.congr_of_eventuallyEq (h : ContMDiffWithinAt I I' n f s x)
+    (h₁ : f₁ =ᶠ[𝓝[s] x] f) (hx : f₁ x = f x) : ContMDiffWithinAt I I' n f₁ s x :=
+  (contDiffWithinAt_localInvariantProp I I' n).liftPropWithinAt_congr_of_eventuallyEq h h₁ hx
+#align cont_mdiff_within_at.congr_of_eventually_eq ContMDiffWithinAt.congr_of_eventuallyEq
+-/
 
-theorem Filter.EventuallyEq.contMdiffWithinAt_iff (h₁ : f₁ =ᶠ[𝓝[s] x] f) (hx : f₁ x = f x) :
-    ContMdiffWithinAt I I' n f₁ s x ↔ ContMdiffWithinAt I I' n f s x :=
-  (cont_diff_within_at_localInvariantProp I I' n).liftPropWithinAt_congr_iff_of_eventuallyEq h₁ hx
-#align filter.eventually_eq.cont_mdiff_within_at_iff Filter.EventuallyEq.contMdiffWithinAt_iff
+#print Filter.EventuallyEq.contMDiffWithinAt_iff /-
+theorem Filter.EventuallyEq.contMDiffWithinAt_iff (h₁ : f₁ =ᶠ[𝓝[s] x] f) (hx : f₁ x = f x) :
+    ContMDiffWithinAt I I' n f₁ s x ↔ ContMDiffWithinAt I I' n f s x :=
+  (contDiffWithinAt_localInvariantProp I I' n).liftPropWithinAt_congr_iff_of_eventuallyEq h₁ hx
+#align filter.eventually_eq.cont_mdiff_within_at_iff Filter.EventuallyEq.contMDiffWithinAt_iff
+-/
 
-theorem ContMdiffAt.congr_of_eventuallyEq (h : ContMdiffAt I I' n f x) (h₁ : f₁ =ᶠ[𝓝 x] f) :
-    ContMdiffAt I I' n f₁ x :=
-  (cont_diff_within_at_localInvariantProp I I' n).liftPropAt_congr_of_eventuallyEq h h₁
-#align cont_mdiff_at.congr_of_eventually_eq ContMdiffAt.congr_of_eventuallyEq
+#print ContMDiffAt.congr_of_eventuallyEq /-
+theorem ContMDiffAt.congr_of_eventuallyEq (h : ContMDiffAt I I' n f x) (h₁ : f₁ =ᶠ[𝓝 x] f) :
+    ContMDiffAt I I' n f₁ x :=
+  (contDiffWithinAt_localInvariantProp I I' n).liftPropAt_congr_of_eventuallyEq h h₁
+#align cont_mdiff_at.congr_of_eventually_eq ContMDiffAt.congr_of_eventuallyEq
+-/
 
-theorem Filter.EventuallyEq.contMdiffAt_iff (h₁ : f₁ =ᶠ[𝓝 x] f) :
-    ContMdiffAt I I' n f₁ x ↔ ContMdiffAt I I' n f x :=
-  (cont_diff_within_at_localInvariantProp I I' n).liftPropAt_congr_iff_of_eventuallyEq h₁
-#align filter.eventually_eq.cont_mdiff_at_iff Filter.EventuallyEq.contMdiffAt_iff
+#print Filter.EventuallyEq.contMDiffAt_iff /-
+theorem Filter.EventuallyEq.contMDiffAt_iff (h₁ : f₁ =ᶠ[𝓝 x] f) :
+    ContMDiffAt I I' n f₁ x ↔ ContMDiffAt I I' n f x :=
+  (contDiffWithinAt_localInvariantProp I I' n).liftPropAt_congr_iff_of_eventuallyEq h₁
+#align filter.eventually_eq.cont_mdiff_at_iff Filter.EventuallyEq.contMDiffAt_iff
+-/
 
-theorem ContMdiffOn.congr (h : ContMdiffOn I I' n f s) (h₁ : ∀ y ∈ s, f₁ y = f y) :
-    ContMdiffOn I I' n f₁ s :=
-  (cont_diff_within_at_localInvariantProp I I' n).liftPropOn_congr h h₁
-#align cont_mdiff_on.congr ContMdiffOn.congr
+#print ContMDiffOn.congr /-
+theorem ContMDiffOn.congr (h : ContMDiffOn I I' n f s) (h₁ : ∀ y ∈ s, f₁ y = f y) :
+    ContMDiffOn I I' n f₁ s :=
+  (contDiffWithinAt_localInvariantProp I I' n).liftPropOn_congr h h₁
+#align cont_mdiff_on.congr ContMDiffOn.congr
+-/
 
-theorem contMdiffOn_congr (h₁ : ∀ y ∈ s, f₁ y = f y) :
-    ContMdiffOn I I' n f₁ s ↔ ContMdiffOn I I' n f s :=
-  (cont_diff_within_at_localInvariantProp I I' n).liftPropOn_congr_iff h₁
-#align cont_mdiff_on_congr contMdiffOn_congr
+#print contMDiffOn_congr /-
+theorem contMDiffOn_congr (h₁ : ∀ y ∈ s, f₁ y = f y) :
+    ContMDiffOn I I' n f₁ s ↔ ContMDiffOn I I' n f s :=
+  (contDiffWithinAt_localInvariantProp I I' n).liftPropOn_congr_iff h₁
+#align cont_mdiff_on_congr contMDiffOn_congr
+-/
 
 /-! ### Locality -/
 
 
+#print contMDiffOn_of_locally_contMDiffOn /-
 /-- Being `C^n` is a local property. -/
-theorem contMdiffOn_of_locally_contMdiffOn
-    (h : ∀ x ∈ s, ∃ u, IsOpen u ∧ x ∈ u ∧ ContMdiffOn I I' n f (s ∩ u)) : ContMdiffOn I I' n f s :=
-  (cont_diff_within_at_localInvariantProp I I' n).liftPropOn_of_locally_liftPropOn h
-#align cont_mdiff_on_of_locally_cont_mdiff_on contMdiffOn_of_locally_contMdiffOn
+theorem contMDiffOn_of_locally_contMDiffOn
+    (h : ∀ x ∈ s, ∃ u, IsOpen u ∧ x ∈ u ∧ ContMDiffOn I I' n f (s ∩ u)) : ContMDiffOn I I' n f s :=
+  (contDiffWithinAt_localInvariantProp I I' n).liftPropOn_of_locally_liftPropOn h
+#align cont_mdiff_on_of_locally_cont_mdiff_on contMDiffOn_of_locally_contMDiffOn
+-/
 
-theorem contMdiff_of_locally_contMdiffOn (h : ∀ x, ∃ u, IsOpen u ∧ x ∈ u ∧ ContMdiffOn I I' n f u) :
-    ContMdiff I I' n f :=
-  (cont_diff_within_at_localInvariantProp I I' n).liftProp_of_locally_liftPropOn h
-#align cont_mdiff_of_locally_cont_mdiff_on contMdiff_of_locally_contMdiffOn
+#print contMDiff_of_locally_contMDiffOn /-
+theorem contMDiff_of_locally_contMDiffOn (h : ∀ x, ∃ u, IsOpen u ∧ x ∈ u ∧ ContMDiffOn I I' n f u) :
+    ContMDiff I I' n f :=
+  (contDiffWithinAt_localInvariantProp I I' n).liftProp_of_locally_liftPropOn h
+#align cont_mdiff_of_locally_cont_mdiff_on contMDiff_of_locally_contMDiffOn
+-/
 
 /-! ### Smoothness of the composition of smooth functions between manifolds -/
 
 
 section Composition
 
+#print ContMDiffWithinAt.comp /-
 /-- The composition of `C^n` functions within domains at points is `C^n`. -/
-theorem ContMdiffWithinAt.comp {t : Set M'} {g : M' → M''} (x : M)
-    (hg : ContMdiffWithinAt I' I'' n g t (f x)) (hf : ContMdiffWithinAt I I' n f s x)
-    (st : MapsTo f s t) : ContMdiffWithinAt I I'' n (g ∘ f) s x :=
+theorem ContMDiffWithinAt.comp {t : Set M'} {g : M' → M''} (x : M)
+    (hg : ContMDiffWithinAt I' I'' n g t (f x)) (hf : ContMDiffWithinAt I I' n f s x)
+    (st : MapsTo f s t) : ContMDiffWithinAt I I'' n (g ∘ f) s x :=
   by
-  rw [contMdiffWithinAt_iff] at hg hf ⊢
+  rw [contMDiffWithinAt_iff] at hg hf ⊢
   refine' ⟨hg.1.comp hf.1 st, _⟩
   set e := extChartAt I x
   set e' := extChartAt I' (f x)
@@ -1001,126 +1206,165 @@ theorem ContMdiffWithinAt.comp {t : Set M'} {g : M' → M''} (x : M)
     rintro x' ⟨hx', ht, hfx', hgfx'⟩
     simp only [*, (· ∘ ·), writtenInExtChartAt, e'.left_inv]
   · simp only [writtenInExtChartAt, (· ∘ ·), mem_extChartAt_source, e.left_inv, e'.left_inv]
-#align cont_mdiff_within_at.comp ContMdiffWithinAt.comp
+#align cont_mdiff_within_at.comp ContMDiffWithinAt.comp
+-/
 
+#print ContMDiffWithinAt.comp_of_eq /-
 /-- See note [comp_of_eq lemmas] -/
-theorem ContMdiffWithinAt.comp_of_eq {t : Set M'} {g : M' → M''} {x : M} {y : M'}
-    (hg : ContMdiffWithinAt I' I'' n g t y) (hf : ContMdiffWithinAt I I' n f s x)
-    (st : MapsTo f s t) (hx : f x = y) : ContMdiffWithinAt I I'' n (g ∘ f) s x := by subst hx;
+theorem ContMDiffWithinAt.comp_of_eq {t : Set M'} {g : M' → M''} {x : M} {y : M'}
+    (hg : ContMDiffWithinAt I' I'' n g t y) (hf : ContMDiffWithinAt I I' n f s x)
+    (st : MapsTo f s t) (hx : f x = y) : ContMDiffWithinAt I I'' n (g ∘ f) s x := by subst hx;
   exact hg.comp x hf st
-#align cont_mdiff_within_at.comp_of_eq ContMdiffWithinAt.comp_of_eq
+#align cont_mdiff_within_at.comp_of_eq ContMDiffWithinAt.comp_of_eq
+-/
 
+#print SmoothWithinAt.comp /-
 /-- The composition of `C^∞` functions within domains at points is `C^∞`. -/
 theorem SmoothWithinAt.comp {t : Set M'} {g : M' → M''} (x : M)
     (hg : SmoothWithinAt I' I'' g t (f x)) (hf : SmoothWithinAt I I' f s x) (st : MapsTo f s t) :
     SmoothWithinAt I I'' (g ∘ f) s x :=
   hg.comp x hf st
 #align smooth_within_at.comp SmoothWithinAt.comp
+-/
 
+#print ContMDiffOn.comp /-
 /-- The composition of `C^n` functions on domains is `C^n`. -/
-theorem ContMdiffOn.comp {t : Set M'} {g : M' → M''} (hg : ContMdiffOn I' I'' n g t)
-    (hf : ContMdiffOn I I' n f s) (st : s ⊆ f ⁻¹' t) : ContMdiffOn I I'' n (g ∘ f) s := fun x hx =>
+theorem ContMDiffOn.comp {t : Set M'} {g : M' → M''} (hg : ContMDiffOn I' I'' n g t)
+    (hf : ContMDiffOn I I' n f s) (st : s ⊆ f ⁻¹' t) : ContMDiffOn I I'' n (g ∘ f) s := fun x hx =>
   (hg _ (st hx)).comp x (hf x hx) st
-#align cont_mdiff_on.comp ContMdiffOn.comp
+#align cont_mdiff_on.comp ContMDiffOn.comp
+-/
 
+#print SmoothOn.comp /-
 /-- The composition of `C^∞` functions on domains is `C^∞`. -/
 theorem SmoothOn.comp {t : Set M'} {g : M' → M''} (hg : SmoothOn I' I'' g t)
     (hf : SmoothOn I I' f s) (st : s ⊆ f ⁻¹' t) : SmoothOn I I'' (g ∘ f) s :=
   hg.comp hf st
 #align smooth_on.comp SmoothOn.comp
+-/
 
+#print ContMDiffOn.comp' /-
 /-- The composition of `C^n` functions on domains is `C^n`. -/
-theorem ContMdiffOn.comp' {t : Set M'} {g : M' → M''} (hg : ContMdiffOn I' I'' n g t)
-    (hf : ContMdiffOn I I' n f s) : ContMdiffOn I I'' n (g ∘ f) (s ∩ f ⁻¹' t) :=
+theorem ContMDiffOn.comp' {t : Set M'} {g : M' → M''} (hg : ContMDiffOn I' I'' n g t)
+    (hf : ContMDiffOn I I' n f s) : ContMDiffOn I I'' n (g ∘ f) (s ∩ f ⁻¹' t) :=
   hg.comp (hf.mono (inter_subset_left _ _)) (inter_subset_right _ _)
-#align cont_mdiff_on.comp' ContMdiffOn.comp'
+#align cont_mdiff_on.comp' ContMDiffOn.comp'
+-/
 
+#print SmoothOn.comp' /-
 /-- The composition of `C^∞` functions is `C^∞`. -/
 theorem SmoothOn.comp' {t : Set M'} {g : M' → M''} (hg : SmoothOn I' I'' g t)
     (hf : SmoothOn I I' f s) : SmoothOn I I'' (g ∘ f) (s ∩ f ⁻¹' t) :=
   hg.comp' hf
 #align smooth_on.comp' SmoothOn.comp'
+-/
 
+#print ContMDiff.comp /-
 /-- The composition of `C^n` functions is `C^n`. -/
-theorem ContMdiff.comp {g : M' → M''} (hg : ContMdiff I' I'' n g) (hf : ContMdiff I I' n f) :
-    ContMdiff I I'' n (g ∘ f) :=
+theorem ContMDiff.comp {g : M' → M''} (hg : ContMDiff I' I'' n g) (hf : ContMDiff I I' n f) :
+    ContMDiff I I'' n (g ∘ f) :=
   by
-  rw [← contMdiffOn_univ] at hf hg ⊢
+  rw [← contMDiffOn_univ] at hf hg ⊢
   exact hg.comp hf subset_preimage_univ
-#align cont_mdiff.comp ContMdiff.comp
+#align cont_mdiff.comp ContMDiff.comp
+-/
 
+#print Smooth.comp /-
 /-- The composition of `C^∞` functions is `C^∞`. -/
 theorem Smooth.comp {g : M' → M''} (hg : Smooth I' I'' g) (hf : Smooth I I' f) :
     Smooth I I'' (g ∘ f) :=
   hg.comp hf
 #align smooth.comp Smooth.comp
+-/
 
+#print ContMDiffWithinAt.comp' /-
 /-- The composition of `C^n` functions within domains at points is `C^n`. -/
-theorem ContMdiffWithinAt.comp' {t : Set M'} {g : M' → M''} (x : M)
-    (hg : ContMdiffWithinAt I' I'' n g t (f x)) (hf : ContMdiffWithinAt I I' n f s x) :
-    ContMdiffWithinAt I I'' n (g ∘ f) (s ∩ f ⁻¹' t) x :=
+theorem ContMDiffWithinAt.comp' {t : Set M'} {g : M' → M''} (x : M)
+    (hg : ContMDiffWithinAt I' I'' n g t (f x)) (hf : ContMDiffWithinAt I I' n f s x) :
+    ContMDiffWithinAt I I'' n (g ∘ f) (s ∩ f ⁻¹' t) x :=
   hg.comp x (hf.mono (inter_subset_left _ _)) (inter_subset_right _ _)
-#align cont_mdiff_within_at.comp' ContMdiffWithinAt.comp'
+#align cont_mdiff_within_at.comp' ContMDiffWithinAt.comp'
+-/
 
+#print SmoothWithinAt.comp' /-
 /-- The composition of `C^∞` functions within domains at points is `C^∞`. -/
 theorem SmoothWithinAt.comp' {t : Set M'} {g : M' → M''} (x : M)
     (hg : SmoothWithinAt I' I'' g t (f x)) (hf : SmoothWithinAt I I' f s x) :
     SmoothWithinAt I I'' (g ∘ f) (s ∩ f ⁻¹' t) x :=
   hg.comp' x hf
 #align smooth_within_at.comp' SmoothWithinAt.comp'
+-/
 
+#print ContMDiffAt.comp_contMDiffWithinAt /-
 /-- `g ∘ f` is `C^n` within `s` at `x` if `g` is `C^n` at `f x` and
 `f` is `C^n` within `s` at `x`. -/
-theorem ContMdiffAt.comp_contMdiffWithinAt {g : M' → M''} (x : M)
-    (hg : ContMdiffAt I' I'' n g (f x)) (hf : ContMdiffWithinAt I I' n f s x) :
-    ContMdiffWithinAt I I'' n (g ∘ f) s x :=
+theorem ContMDiffAt.comp_contMDiffWithinAt {g : M' → M''} (x : M)
+    (hg : ContMDiffAt I' I'' n g (f x)) (hf : ContMDiffWithinAt I I' n f s x) :
+    ContMDiffWithinAt I I'' n (g ∘ f) s x :=
   hg.comp x hf (mapsTo_univ _ _)
-#align cont_mdiff_at.comp_cont_mdiff_within_at ContMdiffAt.comp_contMdiffWithinAt
+#align cont_mdiff_at.comp_cont_mdiff_within_at ContMDiffAt.comp_contMDiffWithinAt
+-/
 
+#print SmoothAt.comp_smoothWithinAt /-
 /-- `g ∘ f` is `C^∞` within `s` at `x` if `g` is `C^∞` at `f x` and
 `f` is `C^∞` within `s` at `x`. -/
 theorem SmoothAt.comp_smoothWithinAt {g : M' → M''} (x : M) (hg : SmoothAt I' I'' g (f x))
     (hf : SmoothWithinAt I I' f s x) : SmoothWithinAt I I'' (g ∘ f) s x :=
-  hg.comp_contMdiffWithinAt x hf
+  hg.comp_contMDiffWithinAt x hf
 #align smooth_at.comp_smooth_within_at SmoothAt.comp_smoothWithinAt
+-/
 
+#print ContMDiffAt.comp /-
 /-- The composition of `C^n` functions at points is `C^n`. -/
-theorem ContMdiffAt.comp {g : M' → M''} (x : M) (hg : ContMdiffAt I' I'' n g (f x))
-    (hf : ContMdiffAt I I' n f x) : ContMdiffAt I I'' n (g ∘ f) x :=
+theorem ContMDiffAt.comp {g : M' → M''} (x : M) (hg : ContMDiffAt I' I'' n g (f x))
+    (hf : ContMDiffAt I I' n f x) : ContMDiffAt I I'' n (g ∘ f) x :=
   hg.comp x hf (mapsTo_univ _ _)
-#align cont_mdiff_at.comp ContMdiffAt.comp
+#align cont_mdiff_at.comp ContMDiffAt.comp
+-/
 
+#print ContMDiffAt.comp_of_eq /-
 /-- See note [comp_of_eq lemmas] -/
-theorem ContMdiffAt.comp_of_eq {g : M' → M''} {x : M} {y : M'} (hg : ContMdiffAt I' I'' n g y)
-    (hf : ContMdiffAt I I' n f x) (hx : f x = y) : ContMdiffAt I I'' n (g ∘ f) x := by subst hx;
+theorem ContMDiffAt.comp_of_eq {g : M' → M''} {x : M} {y : M'} (hg : ContMDiffAt I' I'' n g y)
+    (hf : ContMDiffAt I I' n f x) (hx : f x = y) : ContMDiffAt I I'' n (g ∘ f) x := by subst hx;
   exact hg.comp x hf
-#align cont_mdiff_at.comp_of_eq ContMdiffAt.comp_of_eq
+#align cont_mdiff_at.comp_of_eq ContMDiffAt.comp_of_eq
+-/
 
+#print SmoothAt.comp /-
 /-- The composition of `C^∞` functions at points is `C^∞`. -/
 theorem SmoothAt.comp {g : M' → M''} (x : M) (hg : SmoothAt I' I'' g (f x))
     (hf : SmoothAt I I' f x) : SmoothAt I I'' (g ∘ f) x :=
   hg.comp x hf
 #align smooth_at.comp SmoothAt.comp
+-/
 
-theorem ContMdiff.comp_contMdiffOn {f : M → M'} {g : M' → M''} {s : Set M}
-    (hg : ContMdiff I' I'' n g) (hf : ContMdiffOn I I' n f s) : ContMdiffOn I I'' n (g ∘ f) s :=
-  hg.ContMdiffOn.comp hf Set.subset_preimage_univ
-#align cont_mdiff.comp_cont_mdiff_on ContMdiff.comp_contMdiffOn
+#print ContMDiff.comp_contMDiffOn /-
+theorem ContMDiff.comp_contMDiffOn {f : M → M'} {g : M' → M''} {s : Set M}
+    (hg : ContMDiff I' I'' n g) (hf : ContMDiffOn I I' n f s) : ContMDiffOn I I'' n (g ∘ f) s :=
+  hg.ContMDiffOn.comp hf Set.subset_preimage_univ
+#align cont_mdiff.comp_cont_mdiff_on ContMDiff.comp_contMDiffOn
+-/
 
+#print Smooth.comp_smoothOn /-
 theorem Smooth.comp_smoothOn {f : M → M'} {g : M' → M''} {s : Set M} (hg : Smooth I' I'' g)
     (hf : SmoothOn I I' f s) : SmoothOn I I'' (g ∘ f) s :=
   hg.SmoothOn.comp hf Set.subset_preimage_univ
 #align smooth.comp_smooth_on Smooth.comp_smoothOn
+-/
 
-theorem ContMdiffOn.comp_contMdiff {t : Set M'} {g : M' → M''} (hg : ContMdiffOn I' I'' n g t)
-    (hf : ContMdiff I I' n f) (ht : ∀ x, f x ∈ t) : ContMdiff I I'' n (g ∘ f) :=
-  contMdiffOn_univ.mp <| hg.comp hf.ContMdiffOn fun x _ => ht x
-#align cont_mdiff_on.comp_cont_mdiff ContMdiffOn.comp_contMdiff
+#print ContMDiffOn.comp_contMDiff /-
+theorem ContMDiffOn.comp_contMDiff {t : Set M'} {g : M' → M''} (hg : ContMDiffOn I' I'' n g t)
+    (hf : ContMDiff I I' n f) (ht : ∀ x, f x ∈ t) : ContMDiff I I'' n (g ∘ f) :=
+  contMDiffOn_univ.mp <| hg.comp hf.ContMDiffOn fun x _ => ht x
+#align cont_mdiff_on.comp_cont_mdiff ContMDiffOn.comp_contMDiff
+-/
 
+#print SmoothOn.comp_smooth /-
 theorem SmoothOn.comp_smooth {t : Set M'} {g : M' → M''} (hg : SmoothOn I' I'' g t)
     (hf : Smooth I I' f) (ht : ∀ x, f x ∈ t) : Smooth I I'' (g ∘ f) :=
-  hg.comp_contMdiff hf ht
+  hg.comp_contMDiff hf ht
 #align smooth_on.comp_smooth SmoothOn.comp_smooth
+-/
 
 end Composition
 
@@ -1129,99 +1373,129 @@ end Composition
 
 section Atlas
 
-theorem contMdiff_model : ContMdiff I 𝓘(𝕜, E) n I :=
+#print contMDiff_model /-
+theorem contMDiff_model : ContMDiff I 𝓘(𝕜, E) n I :=
   by
   intro x
-  refine' (contMdiffAt_iff _ _).mpr ⟨I.continuous_at, _⟩
+  refine' (contMDiffAt_iff _ _).mpr ⟨I.continuous_at, _⟩
   simp only [mfld_simps]
   refine' cont_diff_within_at_id.congr_of_eventually_eq _ _
   · exact eventually_eq_of_mem self_mem_nhdsWithin fun x₂ => I.right_inv
   simp_rw [Function.comp_apply, I.left_inv, id_def]
-#align cont_mdiff_model contMdiff_model
+#align cont_mdiff_model contMDiff_model
+-/
 
-theorem contMdiffOn_model_symm : ContMdiffOn 𝓘(𝕜, E) I n I.symm (range I) :=
+#print contMDiffOn_model_symm /-
+theorem contMDiffOn_model_symm : ContMDiffOn 𝓘(𝕜, E) I n I.symm (range I) :=
   by
-  rw [contMdiffOn_iff]
+  rw [contMDiffOn_iff]
   refine' ⟨I.continuous_on_symm, fun x y => _⟩
   simp only [mfld_simps]
   exact cont_diff_on_id.congr fun x' => I.right_inv
-#align cont_mdiff_on_model_symm contMdiffOn_model_symm
+#align cont_mdiff_on_model_symm contMDiffOn_model_symm
+-/
 
+#print contMDiffOn_of_mem_maximalAtlas /-
 /-- An atlas member is `C^n` for any `n`. -/
-theorem contMdiffOn_of_mem_maximalAtlas (h : e ∈ maximalAtlas I M) : ContMdiffOn I I n e e.source :=
-  ContMdiffOn.of_le
-    ((cont_diff_within_at_localInvariantProp I I ∞).liftPropOn_of_mem_maximalAtlas
+theorem contMDiffOn_of_mem_maximalAtlas (h : e ∈ maximalAtlas I M) : ContMDiffOn I I n e e.source :=
+  ContMDiffOn.of_le
+    ((contDiffWithinAt_localInvariantProp I I ∞).liftPropOn_of_mem_maximalAtlas
       (contDiffWithinAtProp_id I) h)
     le_top
-#align cont_mdiff_on_of_mem_maximal_atlas contMdiffOn_of_mem_maximalAtlas
+#align cont_mdiff_on_of_mem_maximal_atlas contMDiffOn_of_mem_maximalAtlas
+-/
 
+#print contMDiffOn_symm_of_mem_maximalAtlas /-
 /-- The inverse of an atlas member is `C^n` for any `n`. -/
-theorem contMdiffOn_symm_of_mem_maximalAtlas (h : e ∈ maximalAtlas I M) :
-    ContMdiffOn I I n e.symm e.target :=
-  ContMdiffOn.of_le
-    ((cont_diff_within_at_localInvariantProp I I ∞).liftPropOn_symm_of_mem_maximalAtlas
+theorem contMDiffOn_symm_of_mem_maximalAtlas (h : e ∈ maximalAtlas I M) :
+    ContMDiffOn I I n e.symm e.target :=
+  ContMDiffOn.of_le
+    ((contDiffWithinAt_localInvariantProp I I ∞).liftPropOn_symm_of_mem_maximalAtlas
       (contDiffWithinAtProp_id I) h)
     le_top
-#align cont_mdiff_on_symm_of_mem_maximal_atlas contMdiffOn_symm_of_mem_maximalAtlas
-
-theorem contMdiffAt_of_mem_maximalAtlas (h : e ∈ maximalAtlas I M) (hx : x ∈ e.source) :
-    ContMdiffAt I I n e x :=
-  (contMdiffOn_of_mem_maximalAtlas h).ContMdiffAt <| e.open_source.mem_nhds hx
-#align cont_mdiff_at_of_mem_maximal_atlas contMdiffAt_of_mem_maximalAtlas
-
-theorem contMdiffAt_symm_of_mem_maximalAtlas {x : H} (h : e ∈ maximalAtlas I M)
-    (hx : x ∈ e.target) : ContMdiffAt I I n e.symm x :=
-  (contMdiffOn_symm_of_mem_maximalAtlas h).ContMdiffAt <| e.open_target.mem_nhds hx
-#align cont_mdiff_at_symm_of_mem_maximal_atlas contMdiffAt_symm_of_mem_maximalAtlas
-
-theorem contMdiffOn_chart : ContMdiffOn I I n (chartAt H x) (chartAt H x).source :=
-  contMdiffOn_of_mem_maximalAtlas <| chart_mem_maximalAtlas I x
-#align cont_mdiff_on_chart contMdiffOn_chart
-
-theorem contMdiffOn_chart_symm : ContMdiffOn I I n (chartAt H x).symm (chartAt H x).target :=
-  contMdiffOn_symm_of_mem_maximalAtlas <| chart_mem_maximalAtlas I x
-#align cont_mdiff_on_chart_symm contMdiffOn_chart_symm
-
-theorem contMdiffAt_extend {x : M} (he : e ∈ maximalAtlas I M) (hx : x ∈ e.source) :
-    ContMdiffAt I 𝓘(𝕜, E) n (e.extend I) x :=
-  (contMdiff_model _).comp x <| contMdiffAt_of_mem_maximalAtlas he hx
-#align cont_mdiff_at_extend contMdiffAt_extend
-
-theorem contMdiffAt_ext_chart_at' {x' : M} (h : x' ∈ (chartAt H x).source) :
-    ContMdiffAt I 𝓘(𝕜, E) n (extChartAt I x) x' :=
-  contMdiffAt_extend (chart_mem_maximalAtlas I x) h
-#align cont_mdiff_at_ext_chart_at' contMdiffAt_ext_chart_at'
-
-theorem contMdiffAt_extChartAt : ContMdiffAt I 𝓘(𝕜, E) n (extChartAt I x) x :=
-  contMdiffAt_ext_chart_at' <| mem_chart_source H x
-#align cont_mdiff_at_ext_chart_at contMdiffAt_extChartAt
-
-theorem contMdiffOn_extChartAt : ContMdiffOn I 𝓘(𝕜, E) n (extChartAt I x) (chartAt H x).source :=
-  fun x' hx' => (contMdiffAt_ext_chart_at' hx').ContMdiffWithinAt
-#align cont_mdiff_on_ext_chart_at contMdiffOn_extChartAt
-
-theorem contMdiffOn_extend_symm (he : e ∈ maximalAtlas I M) :
-    ContMdiffOn 𝓘(𝕜, E) I n (e.extend I).symm (I '' e.target) :=
+#align cont_mdiff_on_symm_of_mem_maximal_atlas contMDiffOn_symm_of_mem_maximalAtlas
+-/
+
+#print contMDiffAt_of_mem_maximalAtlas /-
+theorem contMDiffAt_of_mem_maximalAtlas (h : e ∈ maximalAtlas I M) (hx : x ∈ e.source) :
+    ContMDiffAt I I n e x :=
+  (contMDiffOn_of_mem_maximalAtlas h).ContMDiffAt <| e.open_source.mem_nhds hx
+#align cont_mdiff_at_of_mem_maximal_atlas contMDiffAt_of_mem_maximalAtlas
+-/
+
+#print contMDiffAt_symm_of_mem_maximalAtlas /-
+theorem contMDiffAt_symm_of_mem_maximalAtlas {x : H} (h : e ∈ maximalAtlas I M)
+    (hx : x ∈ e.target) : ContMDiffAt I I n e.symm x :=
+  (contMDiffOn_symm_of_mem_maximalAtlas h).ContMDiffAt <| e.open_target.mem_nhds hx
+#align cont_mdiff_at_symm_of_mem_maximal_atlas contMDiffAt_symm_of_mem_maximalAtlas
+-/
+
+#print contMDiffOn_chart /-
+theorem contMDiffOn_chart : ContMDiffOn I I n (chartAt H x) (chartAt H x).source :=
+  contMDiffOn_of_mem_maximalAtlas <| chart_mem_maximalAtlas I x
+#align cont_mdiff_on_chart contMDiffOn_chart
+-/
+
+#print contMDiffOn_chart_symm /-
+theorem contMDiffOn_chart_symm : ContMDiffOn I I n (chartAt H x).symm (chartAt H x).target :=
+  contMDiffOn_symm_of_mem_maximalAtlas <| chart_mem_maximalAtlas I x
+#align cont_mdiff_on_chart_symm contMDiffOn_chart_symm
+-/
+
+#print contMDiffAt_extend /-
+theorem contMDiffAt_extend {x : M} (he : e ∈ maximalAtlas I M) (hx : x ∈ e.source) :
+    ContMDiffAt I 𝓘(𝕜, E) n (e.extend I) x :=
+  (contMDiff_model _).comp x <| contMDiffAt_of_mem_maximalAtlas he hx
+#align cont_mdiff_at_extend contMDiffAt_extend
+-/
+
+#print contMDiffAt_extChartAt' /-
+theorem contMDiffAt_extChartAt' {x' : M} (h : x' ∈ (chartAt H x).source) :
+    ContMDiffAt I 𝓘(𝕜, E) n (extChartAt I x) x' :=
+  contMDiffAt_extend (chart_mem_maximalAtlas I x) h
+#align cont_mdiff_at_ext_chart_at' contMDiffAt_extChartAt'
+-/
+
+#print contMDiffAt_extChartAt /-
+theorem contMDiffAt_extChartAt : ContMDiffAt I 𝓘(𝕜, E) n (extChartAt I x) x :=
+  contMDiffAt_extChartAt' <| mem_chart_source H x
+#align cont_mdiff_at_ext_chart_at contMDiffAt_extChartAt
+-/
+
+#print contMDiffOn_extChartAt /-
+theorem contMDiffOn_extChartAt : ContMDiffOn I 𝓘(𝕜, E) n (extChartAt I x) (chartAt H x).source :=
+  fun x' hx' => (contMDiffAt_extChartAt' hx').ContMDiffWithinAt
+#align cont_mdiff_on_ext_chart_at contMDiffOn_extChartAt
+-/
+
+#print contMDiffOn_extend_symm /-
+theorem contMDiffOn_extend_symm (he : e ∈ maximalAtlas I M) :
+    ContMDiffOn 𝓘(𝕜, E) I n (e.extend I).symm (I '' e.target) :=
   by
-  have h2 := contMdiffOn_symm_of_mem_maximalAtlas he
+  have h2 := contMDiffOn_symm_of_mem_maximalAtlas he
   refine' h2.comp (cont_mdiff_on_model_symm.mono <| image_subset_range _ _) _
   simp_rw [image_subset_iff, LocalEquiv.restr_coe_symm, I.to_local_equiv_coe_symm,
     preimage_preimage, I.left_inv, preimage_id']
-#align cont_mdiff_on_extend_symm contMdiffOn_extend_symm
+#align cont_mdiff_on_extend_symm contMDiffOn_extend_symm
+-/
 
-theorem contMdiffOn_extChartAt_symm (x : M) :
-    ContMdiffOn 𝓘(𝕜, E) I n (extChartAt I x).symm (extChartAt I x).target :=
+#print contMDiffOn_extChartAt_symm /-
+theorem contMDiffOn_extChartAt_symm (x : M) :
+    ContMDiffOn 𝓘(𝕜, E) I n (extChartAt I x).symm (extChartAt I x).target :=
   by
-  convert contMdiffOn_extend_symm (chart_mem_maximal_atlas I x)
+  convert contMDiffOn_extend_symm (chart_mem_maximal_atlas I x)
   rw [extChartAt_target, I.image_eq]
-#align cont_mdiff_on_ext_chart_at_symm contMdiffOn_extChartAt_symm
+#align cont_mdiff_on_ext_chart_at_symm contMDiffOn_extChartAt_symm
+-/
 
+#print contMDiffOn_of_mem_contDiffGroupoid /-
 /-- An element of `cont_diff_groupoid ⊤ I` is `C^n` for any `n`. -/
-theorem contMdiffOn_of_mem_contDiffGroupoid {e' : LocalHomeomorph H H}
-    (h : e' ∈ contDiffGroupoid ⊤ I) : ContMdiffOn I I n e' e'.source :=
-  (cont_diff_within_at_localInvariantProp I I n).liftPropOn_of_mem_groupoid
-    (contDiffWithinAtProp_id I) h
-#align cont_mdiff_on_of_mem_cont_diff_groupoid contMdiffOn_of_mem_contDiffGroupoid
+theorem contMDiffOn_of_mem_contDiffGroupoid {e' : LocalHomeomorph H H}
+    (h : e' ∈ contDiffGroupoid ⊤ I) : ContMDiffOn I I n e' e'.source :=
+  (contDiffWithinAt_localInvariantProp I I n).liftPropOn_of_mem_groupoid (contDiffWithinAtProp_id I)
+    h
+#align cont_mdiff_on_of_mem_cont_diff_groupoid contMDiffOn_of_mem_contDiffGroupoid
+-/
 
 end Atlas
 
@@ -1230,38 +1504,54 @@ end Atlas
 
 section id
 
-theorem contMdiff_id : ContMdiff I I n (id : M → M) :=
-  ContMdiff.of_le
-    ((cont_diff_within_at_localInvariantProp I I ∞).liftProp_id (contDiffWithinAtProp_id I)) le_top
-#align cont_mdiff_id contMdiff_id
+#print contMDiff_id /-
+theorem contMDiff_id : ContMDiff I I n (id : M → M) :=
+  ContMDiff.of_le
+    ((contDiffWithinAt_localInvariantProp I I ∞).liftProp_id (contDiffWithinAtProp_id I)) le_top
+#align cont_mdiff_id contMDiff_id
+-/
 
+#print smooth_id /-
 theorem smooth_id : Smooth I I (id : M → M) :=
-  contMdiff_id
+  contMDiff_id
 #align smooth_id smooth_id
+-/
 
-theorem contMdiffOn_id : ContMdiffOn I I n (id : M → M) s :=
-  contMdiff_id.ContMdiffOn
-#align cont_mdiff_on_id contMdiffOn_id
+#print contMDiffOn_id /-
+theorem contMDiffOn_id : ContMDiffOn I I n (id : M → M) s :=
+  contMDiff_id.ContMDiffOn
+#align cont_mdiff_on_id contMDiffOn_id
+-/
 
+#print smoothOn_id /-
 theorem smoothOn_id : SmoothOn I I (id : M → M) s :=
-  contMdiffOn_id
+  contMDiffOn_id
 #align smooth_on_id smoothOn_id
+-/
 
-theorem contMdiffAt_id : ContMdiffAt I I n (id : M → M) x :=
-  contMdiff_id.ContMdiffAt
-#align cont_mdiff_at_id contMdiffAt_id
+#print contMDiffAt_id /-
+theorem contMDiffAt_id : ContMDiffAt I I n (id : M → M) x :=
+  contMDiff_id.ContMDiffAt
+#align cont_mdiff_at_id contMDiffAt_id
+-/
 
+#print smoothAt_id /-
 theorem smoothAt_id : SmoothAt I I (id : M → M) x :=
-  contMdiffAt_id
+  contMDiffAt_id
 #align smooth_at_id smoothAt_id
+-/
 
-theorem contMdiffWithinAt_id : ContMdiffWithinAt I I n (id : M → M) s x :=
-  contMdiffAt_id.ContMdiffWithinAt
-#align cont_mdiff_within_at_id contMdiffWithinAt_id
+#print contMDiffWithinAt_id /-
+theorem contMDiffWithinAt_id : ContMDiffWithinAt I I n (id : M → M) s x :=
+  contMDiffAt_id.ContMDiffWithinAt
+#align cont_mdiff_within_at_id contMDiffWithinAt_id
+-/
 
+#print smoothWithinAt_id /-
 theorem smoothWithinAt_id : SmoothWithinAt I I (id : M → M) s x :=
-  contMdiffWithinAt_id
+  contMDiffWithinAt_id
 #align smooth_within_at_id smoothWithinAt_id
+-/
 
 end id
 
@@ -1272,99 +1562,133 @@ section id
 
 variable {c : M'}
 
-theorem contMdiff_const : ContMdiff I I' n fun x : M => c :=
+#print contMDiff_const /-
+theorem contMDiff_const : ContMDiff I I' n fun x : M => c :=
   by
   intro x
   refine' ⟨continuousWithinAt_const, _⟩
   simp only [ContDiffWithinAtProp, (· ∘ ·)]
   exact contDiffWithinAt_const
-#align cont_mdiff_const contMdiff_const
+#align cont_mdiff_const contMDiff_const
+-/
 
+#print contMDiff_one /-
 @[to_additive]
-theorem contMdiff_one [One M'] : ContMdiff I I' n (1 : M → M') := by
-  simp only [Pi.one_def, contMdiff_const]
-#align cont_mdiff_one contMdiff_one
-#align cont_mdiff_zero contMdiff_zero
+theorem contMDiff_one [One M'] : ContMDiff I I' n (1 : M → M') := by
+  simp only [Pi.one_def, contMDiff_const]
+#align cont_mdiff_one contMDiff_one
+#align cont_mdiff_zero contMDiff_zero
+-/
 
+#print smooth_const /-
 theorem smooth_const : Smooth I I' fun x : M => c :=
-  contMdiff_const
+  contMDiff_const
 #align smooth_const smooth_const
+-/
 
+#print smooth_one /-
 @[to_additive]
 theorem smooth_one [One M'] : Smooth I I' (1 : M → M') := by simp only [Pi.one_def, smooth_const]
 #align smooth_one smooth_one
 #align smooth_zero smooth_zero
+-/
 
-theorem contMdiffOn_const : ContMdiffOn I I' n (fun x : M => c) s :=
-  contMdiff_const.ContMdiffOn
-#align cont_mdiff_on_const contMdiffOn_const
+#print contMDiffOn_const /-
+theorem contMDiffOn_const : ContMDiffOn I I' n (fun x : M => c) s :=
+  contMDiff_const.ContMDiffOn
+#align cont_mdiff_on_const contMDiffOn_const
+-/
 
+#print contMDiffOn_one /-
 @[to_additive]
-theorem contMdiffOn_one [One M'] : ContMdiffOn I I' n (1 : M → M') s :=
-  contMdiff_one.ContMdiffOn
-#align cont_mdiff_on_one contMdiffOn_one
-#align cont_mdiff_on_zero contMdiffOn_zero
+theorem contMDiffOn_one [One M'] : ContMDiffOn I I' n (1 : M → M') s :=
+  contMDiff_one.ContMDiffOn
+#align cont_mdiff_on_one contMDiffOn_one
+#align cont_mdiff_on_zero contMDiffOn_zero
+-/
 
+#print smoothOn_const /-
 theorem smoothOn_const : SmoothOn I I' (fun x : M => c) s :=
-  contMdiffOn_const
+  contMDiffOn_const
 #align smooth_on_const smoothOn_const
+-/
 
+#print smoothOn_one /-
 @[to_additive]
 theorem smoothOn_one [One M'] : SmoothOn I I' (1 : M → M') s :=
-  contMdiffOn_one
+  contMDiffOn_one
 #align smooth_on_one smoothOn_one
 #align smooth_on_zero smoothOn_zero
+-/
 
-theorem contMdiffAt_const : ContMdiffAt I I' n (fun x : M => c) x :=
-  contMdiff_const.ContMdiffAt
-#align cont_mdiff_at_const contMdiffAt_const
+#print contMDiffAt_const /-
+theorem contMDiffAt_const : ContMDiffAt I I' n (fun x : M => c) x :=
+  contMDiff_const.ContMDiffAt
+#align cont_mdiff_at_const contMDiffAt_const
+-/
 
+#print contMDiffAt_one /-
 @[to_additive]
-theorem contMdiffAt_one [One M'] : ContMdiffAt I I' n (1 : M → M') x :=
-  contMdiff_one.ContMdiffAt
-#align cont_mdiff_at_one contMdiffAt_one
-#align cont_mdiff_at_zero contMdiffAt_zero
+theorem contMDiffAt_one [One M'] : ContMDiffAt I I' n (1 : M → M') x :=
+  contMDiff_one.ContMDiffAt
+#align cont_mdiff_at_one contMDiffAt_one
+#align cont_mdiff_at_zero contMDiffAt_zero
+-/
 
+#print smoothAt_const /-
 theorem smoothAt_const : SmoothAt I I' (fun x : M => c) x :=
-  contMdiffAt_const
+  contMDiffAt_const
 #align smooth_at_const smoothAt_const
+-/
 
+#print smoothAt_one /-
 @[to_additive]
 theorem smoothAt_one [One M'] : SmoothAt I I' (1 : M → M') x :=
-  contMdiffAt_one
+  contMDiffAt_one
 #align smooth_at_one smoothAt_one
 #align smooth_at_zero smoothAt_zero
+-/
 
-theorem contMdiffWithinAt_const : ContMdiffWithinAt I I' n (fun x : M => c) s x :=
-  contMdiffAt_const.ContMdiffWithinAt
-#align cont_mdiff_within_at_const contMdiffWithinAt_const
+#print contMDiffWithinAt_const /-
+theorem contMDiffWithinAt_const : ContMDiffWithinAt I I' n (fun x : M => c) s x :=
+  contMDiffAt_const.ContMDiffWithinAt
+#align cont_mdiff_within_at_const contMDiffWithinAt_const
+-/
 
+#print contMDiffWithinAt_one /-
 @[to_additive]
-theorem contMdiffWithinAt_one [One M'] : ContMdiffWithinAt I I' n (1 : M → M') s x :=
-  contMdiffAt_const.ContMdiffWithinAt
-#align cont_mdiff_within_at_one contMdiffWithinAt_one
-#align cont_mdiff_within_at_zero contMdiffWithinAt_zero
+theorem contMDiffWithinAt_one [One M'] : ContMDiffWithinAt I I' n (1 : M → M') s x :=
+  contMDiffAt_const.ContMDiffWithinAt
+#align cont_mdiff_within_at_one contMDiffWithinAt_one
+#align cont_mdiff_within_at_zero contMDiffWithinAt_zero
+-/
 
+#print smoothWithinAt_const /-
 theorem smoothWithinAt_const : SmoothWithinAt I I' (fun x : M => c) s x :=
-  contMdiffWithinAt_const
+  contMDiffWithinAt_const
 #align smooth_within_at_const smoothWithinAt_const
+-/
 
+#print smoothWithinAt_one /-
 @[to_additive]
 theorem smoothWithinAt_one [One M'] : SmoothWithinAt I I' (1 : M → M') s x :=
-  contMdiffWithinAt_one
+  contMDiffWithinAt_one
 #align smooth_within_at_one smoothWithinAt_one
 #align smooth_within_at_zero smoothWithinAt_zero
+-/
 
 end id
 
-theorem contMdiff_of_support {f : M → F} (hf : ∀ x ∈ tsupport f, ContMdiffAt I 𝓘(𝕜, F) n f x) :
-    ContMdiff I 𝓘(𝕜, F) n f := by
+#print contMDiff_of_support /-
+theorem contMDiff_of_support {f : M → F} (hf : ∀ x ∈ tsupport f, ContMDiffAt I 𝓘(𝕜, F) n f x) :
+    ContMDiff I 𝓘(𝕜, F) n f := by
   intro x
   by_cases hx : x ∈ tsupport f
   · exact hf x hx
-  · refine' ContMdiffAt.congr_of_eventuallyEq _ (eventuallyEq_zero_nhds.2 hx)
-    exact contMdiffAt_const
-#align cont_mdiff_of_support contMdiff_of_support
+  · refine' ContMDiffAt.congr_of_eventuallyEq _ (eventuallyEq_zero_nhds.2 hx)
+    exact contMDiffAt_const
+#align cont_mdiff_of_support contMDiff_of_support
+-/
 
 /-! ### The inclusion map from one open set to another is smooth -/
 
@@ -1373,22 +1697,26 @@ section
 
 open TopologicalSpace
 
-theorem contMdiff_inclusion {n : ℕ∞} {U V : Opens M} (h : U ≤ V) :
-    ContMdiff I I n (Set.inclusion h : U → V) :=
+#print contMDiff_inclusion /-
+theorem contMDiff_inclusion {n : ℕ∞} {U V : Opens M} (h : U ≤ V) :
+    ContMDiff I I n (Set.inclusion h : U → V) :=
   by
   rintro ⟨x, hx : x ∈ U⟩
-  apply (cont_diff_within_at_localInvariantProp I I n).liftProp_inclusion
+  apply (contDiffWithinAt_localInvariantProp I I n).liftProp_inclusion
   intro y
   dsimp [ContDiffWithinAtProp]
   rw [Set.univ_inter]
   refine' cont_diff_within_at_id.congr _ _
   · exact I.right_inv_on
   · exact congr_arg I (I.left_inv y)
-#align cont_mdiff_inclusion contMdiff_inclusion
+#align cont_mdiff_inclusion contMDiff_inclusion
+-/
 
+#print smooth_inclusion /-
 theorem smooth_inclusion {U V : Opens M} (h : U ≤ V) : Smooth I I (Set.inclusion h : U → V) :=
-  contMdiff_inclusion h
+  contMDiff_inclusion h
 #align smooth_inclusion smooth_inclusion
+-/
 
 end
 
@@ -1397,65 +1725,79 @@ end
 
 section Module
 
-theorem contMdiffWithinAt_iff_contDiffWithinAt {f : E → E'} {s : Set E} {x : E} :
-    ContMdiffWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') n f s x ↔ ContDiffWithinAt 𝕜 n f s x :=
+#print contMDiffWithinAt_iff_contDiffWithinAt /-
+theorem contMDiffWithinAt_iff_contDiffWithinAt {f : E → E'} {s : Set E} {x : E} :
+    ContMDiffWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') n f s x ↔ ContDiffWithinAt 𝕜 n f s x :=
   by
-  simp (config := { contextual := true }) only [ContMdiffWithinAt, lift_prop_within_at,
+  simp (config := { contextual := true }) only [ContMDiffWithinAt, lift_prop_within_at,
     ContDiffWithinAtProp, iff_def, mfld_simps]
   exact ContDiffWithinAt.continuousWithinAt
-#align cont_mdiff_within_at_iff_cont_diff_within_at contMdiffWithinAt_iff_contDiffWithinAt
-
-alias contMdiffWithinAt_iff_contDiffWithinAt ↔ ContMdiffWithinAt.contDiffWithinAt
-  ContDiffWithinAt.contMdiffWithinAt
-#align cont_mdiff_within_at.cont_diff_within_at ContMdiffWithinAt.contDiffWithinAt
-#align cont_diff_within_at.cont_mdiff_within_at ContDiffWithinAt.contMdiffWithinAt
-
-theorem contMdiffAt_iff_contDiffAt {f : E → E'} {x : E} :
-    ContMdiffAt 𝓘(𝕜, E) 𝓘(𝕜, E') n f x ↔ ContDiffAt 𝕜 n f x := by
-  rw [← contMdiffWithinAt_univ, contMdiffWithinAt_iff_contDiffWithinAt, contDiffWithinAt_univ]
-#align cont_mdiff_at_iff_cont_diff_at contMdiffAt_iff_contDiffAt
-
-alias contMdiffAt_iff_contDiffAt ↔ ContMdiffAt.contDiffAt ContDiffAt.contMdiffAt
-#align cont_mdiff_at.cont_diff_at ContMdiffAt.contDiffAt
-#align cont_diff_at.cont_mdiff_at ContDiffAt.contMdiffAt
-
-theorem contMdiffOn_iff_contDiffOn {f : E → E'} {s : Set E} :
-    ContMdiffOn 𝓘(𝕜, E) 𝓘(𝕜, E') n f s ↔ ContDiffOn 𝕜 n f s :=
-  forall_congr' <| by simp [contMdiffWithinAt_iff_contDiffWithinAt]
-#align cont_mdiff_on_iff_cont_diff_on contMdiffOn_iff_contDiffOn
-
-alias contMdiffOn_iff_contDiffOn ↔ ContMdiffOn.contDiffOn ContDiffOn.contMdiffOn
-#align cont_mdiff_on.cont_diff_on ContMdiffOn.contDiffOn
-#align cont_diff_on.cont_mdiff_on ContDiffOn.contMdiffOn
-
-theorem contMdiff_iff_contDiff {f : E → E'} : ContMdiff 𝓘(𝕜, E) 𝓘(𝕜, E') n f ↔ ContDiff 𝕜 n f := by
-  rw [← contDiffOn_univ, ← contMdiffOn_univ, contMdiffOn_iff_contDiffOn]
-#align cont_mdiff_iff_cont_diff contMdiff_iff_contDiff
-
-alias contMdiff_iff_contDiff ↔ ContMdiff.contDiff ContDiff.contMdiff
-#align cont_mdiff.cont_diff ContMdiff.contDiff
-#align cont_diff.cont_mdiff ContDiff.contMdiff
-
-theorem ContDiffWithinAt.comp_contMdiffWithinAt {g : F → F'} {f : M → F} {s : Set M} {t : Set F}
-    {x : M} (hg : ContDiffWithinAt 𝕜 n g t (f x)) (hf : ContMdiffWithinAt I 𝓘(𝕜, F) n f s x)
-    (h : s ⊆ f ⁻¹' t) : ContMdiffWithinAt I 𝓘(𝕜, F') n (g ∘ f) s x :=
+#align cont_mdiff_within_at_iff_cont_diff_within_at contMDiffWithinAt_iff_contDiffWithinAt
+-/
+
+alias contMDiffWithinAt_iff_contDiffWithinAt ↔ ContMDiffWithinAt.contDiffWithinAt
+  ContDiffWithinAt.contMDiffWithinAt
+#align cont_mdiff_within_at.cont_diff_within_at ContMDiffWithinAt.contDiffWithinAt
+#align cont_diff_within_at.cont_mdiff_within_at ContDiffWithinAt.contMDiffWithinAt
+
+#print contMDiffAt_iff_contDiffAt /-
+theorem contMDiffAt_iff_contDiffAt {f : E → E'} {x : E} :
+    ContMDiffAt 𝓘(𝕜, E) 𝓘(𝕜, E') n f x ↔ ContDiffAt 𝕜 n f x := by
+  rw [← contMDiffWithinAt_univ, contMDiffWithinAt_iff_contDiffWithinAt, contDiffWithinAt_univ]
+#align cont_mdiff_at_iff_cont_diff_at contMDiffAt_iff_contDiffAt
+-/
+
+alias contMDiffAt_iff_contDiffAt ↔ ContMDiffAt.contDiffAt ContDiffAt.contMDiffAt
+#align cont_mdiff_at.cont_diff_at ContMDiffAt.contDiffAt
+#align cont_diff_at.cont_mdiff_at ContDiffAt.contMDiffAt
+
+#print contMDiffOn_iff_contDiffOn /-
+theorem contMDiffOn_iff_contDiffOn {f : E → E'} {s : Set E} :
+    ContMDiffOn 𝓘(𝕜, E) 𝓘(𝕜, E') n f s ↔ ContDiffOn 𝕜 n f s :=
+  forall_congr' <| by simp [contMDiffWithinAt_iff_contDiffWithinAt]
+#align cont_mdiff_on_iff_cont_diff_on contMDiffOn_iff_contDiffOn
+-/
+
+alias contMDiffOn_iff_contDiffOn ↔ ContMDiffOn.contDiffOn ContDiffOn.contMDiffOn
+#align cont_mdiff_on.cont_diff_on ContMDiffOn.contDiffOn
+#align cont_diff_on.cont_mdiff_on ContDiffOn.contMDiffOn
+
+#print contMDiff_iff_contDiff /-
+theorem contMDiff_iff_contDiff {f : E → E'} : ContMDiff 𝓘(𝕜, E) 𝓘(𝕜, E') n f ↔ ContDiff 𝕜 n f := by
+  rw [← contDiffOn_univ, ← contMDiffOn_univ, contMDiffOn_iff_contDiffOn]
+#align cont_mdiff_iff_cont_diff contMDiff_iff_contDiff
+-/
+
+alias contMDiff_iff_contDiff ↔ ContMDiff.contDiff ContDiff.contMDiff
+#align cont_mdiff.cont_diff ContMDiff.contDiff
+#align cont_diff.cont_mdiff ContDiff.contMDiff
+
+#print ContDiffWithinAt.comp_contMDiffWithinAt /-
+theorem ContDiffWithinAt.comp_contMDiffWithinAt {g : F → F'} {f : M → F} {s : Set M} {t : Set F}
+    {x : M} (hg : ContDiffWithinAt 𝕜 n g t (f x)) (hf : ContMDiffWithinAt I 𝓘(𝕜, F) n f s x)
+    (h : s ⊆ f ⁻¹' t) : ContMDiffWithinAt I 𝓘(𝕜, F') n (g ∘ f) s x :=
   by
-  rw [contMdiffWithinAt_iff] at *
+  rw [contMDiffWithinAt_iff] at *
   refine' ⟨hg.continuous_within_at.comp hf.1 h, _⟩
   rw [← (extChartAt I x).left_inv (mem_extChartAt_source I x)] at hg 
   apply ContDiffWithinAt.comp _ hg hf.2 _
   exact (inter_subset_left _ _).trans (preimage_mono h)
-#align cont_diff_within_at.comp_cont_mdiff_within_at ContDiffWithinAt.comp_contMdiffWithinAt
+#align cont_diff_within_at.comp_cont_mdiff_within_at ContDiffWithinAt.comp_contMDiffWithinAt
+-/
 
-theorem ContDiffAt.comp_contMdiffAt {g : F → F'} {f : M → F} {x : M} (hg : ContDiffAt 𝕜 n g (f x))
-    (hf : ContMdiffAt I 𝓘(𝕜, F) n f x) : ContMdiffAt I 𝓘(𝕜, F') n (g ∘ f) x :=
-  hg.comp_contMdiffWithinAt hf Subset.rfl
-#align cont_diff_at.comp_cont_mdiff_at ContDiffAt.comp_contMdiffAt
+#print ContDiffAt.comp_contMDiffAt /-
+theorem ContDiffAt.comp_contMDiffAt {g : F → F'} {f : M → F} {x : M} (hg : ContDiffAt 𝕜 n g (f x))
+    (hf : ContMDiffAt I 𝓘(𝕜, F) n f x) : ContMDiffAt I 𝓘(𝕜, F') n (g ∘ f) x :=
+  hg.comp_contMDiffWithinAt hf Subset.rfl
+#align cont_diff_at.comp_cont_mdiff_at ContDiffAt.comp_contMDiffAt
+-/
 
-theorem ContDiff.comp_contMdiff {g : F → F'} {f : M → F} (hg : ContDiff 𝕜 n g)
-    (hf : ContMdiff I 𝓘(𝕜, F) n f) : ContMdiff I 𝓘(𝕜, F') n (g ∘ f) := fun x =>
-  hg.ContDiffAt.comp_contMdiffAt (hf x)
-#align cont_diff.comp_cont_mdiff ContDiff.comp_contMdiff
+#print ContDiff.comp_contMDiff /-
+theorem ContDiff.comp_contMDiff {g : F → F'} {f : M → F} (hg : ContDiff 𝕜 n g)
+    (hf : ContMDiff I 𝓘(𝕜, F) n f) : ContMDiff I 𝓘(𝕜, F') n (g ∘ f) := fun x =>
+  hg.ContDiffAt.comp_contMDiffAt (hf x)
+#align cont_diff.comp_cont_mdiff ContDiff.comp_contMDiff
+-/
 
 end Module
 
@@ -1464,331 +1806,447 @@ end Module
 
 section ProdMk
 
-theorem ContMdiffWithinAt.prod_mk {f : M → M'} {g : M → N'} (hf : ContMdiffWithinAt I I' n f s x)
-    (hg : ContMdiffWithinAt I J' n g s x) :
-    ContMdiffWithinAt I (I'.Prod J') n (fun x => (f x, g x)) s x :=
+#print ContMDiffWithinAt.prod_mk /-
+theorem ContMDiffWithinAt.prod_mk {f : M → M'} {g : M → N'} (hf : ContMDiffWithinAt I I' n f s x)
+    (hg : ContMDiffWithinAt I J' n g s x) :
+    ContMDiffWithinAt I (I'.Prod J') n (fun x => (f x, g x)) s x :=
   by
-  rw [contMdiffWithinAt_iff] at *
+  rw [contMDiffWithinAt_iff] at *
   exact ⟨hf.1.Prod hg.1, hf.2.Prod hg.2⟩
-#align cont_mdiff_within_at.prod_mk ContMdiffWithinAt.prod_mk
+#align cont_mdiff_within_at.prod_mk ContMDiffWithinAt.prod_mk
+-/
 
-theorem ContMdiffWithinAt.prod_mk_space {f : M → E'} {g : M → F'}
-    (hf : ContMdiffWithinAt I 𝓘(𝕜, E') n f s x) (hg : ContMdiffWithinAt I 𝓘(𝕜, F') n g s x) :
-    ContMdiffWithinAt I 𝓘(𝕜, E' × F') n (fun x => (f x, g x)) s x :=
+#print ContMDiffWithinAt.prod_mk_space /-
+theorem ContMDiffWithinAt.prod_mk_space {f : M → E'} {g : M → F'}
+    (hf : ContMDiffWithinAt I 𝓘(𝕜, E') n f s x) (hg : ContMDiffWithinAt I 𝓘(𝕜, F') n g s x) :
+    ContMDiffWithinAt I 𝓘(𝕜, E' × F') n (fun x => (f x, g x)) s x :=
   by
-  rw [contMdiffWithinAt_iff] at *
+  rw [contMDiffWithinAt_iff] at *
   exact ⟨hf.1.Prod hg.1, hf.2.Prod hg.2⟩
-#align cont_mdiff_within_at.prod_mk_space ContMdiffWithinAt.prod_mk_space
+#align cont_mdiff_within_at.prod_mk_space ContMDiffWithinAt.prod_mk_space
+-/
 
-theorem ContMdiffAt.prod_mk {f : M → M'} {g : M → N'} (hf : ContMdiffAt I I' n f x)
-    (hg : ContMdiffAt I J' n g x) : ContMdiffAt I (I'.Prod J') n (fun x => (f x, g x)) x :=
+#print ContMDiffAt.prod_mk /-
+theorem ContMDiffAt.prod_mk {f : M → M'} {g : M → N'} (hf : ContMDiffAt I I' n f x)
+    (hg : ContMDiffAt I J' n g x) : ContMDiffAt I (I'.Prod J') n (fun x => (f x, g x)) x :=
   hf.prod_mk hg
-#align cont_mdiff_at.prod_mk ContMdiffAt.prod_mk
+#align cont_mdiff_at.prod_mk ContMDiffAt.prod_mk
+-/
 
-theorem ContMdiffAt.prod_mk_space {f : M → E'} {g : M → F'} (hf : ContMdiffAt I 𝓘(𝕜, E') n f x)
-    (hg : ContMdiffAt I 𝓘(𝕜, F') n g x) : ContMdiffAt I 𝓘(𝕜, E' × F') n (fun x => (f x, g x)) x :=
+#print ContMDiffAt.prod_mk_space /-
+theorem ContMDiffAt.prod_mk_space {f : M → E'} {g : M → F'} (hf : ContMDiffAt I 𝓘(𝕜, E') n f x)
+    (hg : ContMDiffAt I 𝓘(𝕜, F') n g x) : ContMDiffAt I 𝓘(𝕜, E' × F') n (fun x => (f x, g x)) x :=
   hf.prod_mk_space hg
-#align cont_mdiff_at.prod_mk_space ContMdiffAt.prod_mk_space
+#align cont_mdiff_at.prod_mk_space ContMDiffAt.prod_mk_space
+-/
 
-theorem ContMdiffOn.prod_mk {f : M → M'} {g : M → N'} (hf : ContMdiffOn I I' n f s)
-    (hg : ContMdiffOn I J' n g s) : ContMdiffOn I (I'.Prod J') n (fun x => (f x, g x)) s :=
+#print ContMDiffOn.prod_mk /-
+theorem ContMDiffOn.prod_mk {f : M → M'} {g : M → N'} (hf : ContMDiffOn I I' n f s)
+    (hg : ContMDiffOn I J' n g s) : ContMDiffOn I (I'.Prod J') n (fun x => (f x, g x)) s :=
   fun x hx => (hf x hx).prod_mk (hg x hx)
-#align cont_mdiff_on.prod_mk ContMdiffOn.prod_mk
+#align cont_mdiff_on.prod_mk ContMDiffOn.prod_mk
+-/
 
-theorem ContMdiffOn.prod_mk_space {f : M → E'} {g : M → F'} (hf : ContMdiffOn I 𝓘(𝕜, E') n f s)
-    (hg : ContMdiffOn I 𝓘(𝕜, F') n g s) : ContMdiffOn I 𝓘(𝕜, E' × F') n (fun x => (f x, g x)) s :=
+#print ContMDiffOn.prod_mk_space /-
+theorem ContMDiffOn.prod_mk_space {f : M → E'} {g : M → F'} (hf : ContMDiffOn I 𝓘(𝕜, E') n f s)
+    (hg : ContMDiffOn I 𝓘(𝕜, F') n g s) : ContMDiffOn I 𝓘(𝕜, E' × F') n (fun x => (f x, g x)) s :=
   fun x hx => (hf x hx).prod_mk_space (hg x hx)
-#align cont_mdiff_on.prod_mk_space ContMdiffOn.prod_mk_space
+#align cont_mdiff_on.prod_mk_space ContMDiffOn.prod_mk_space
+-/
 
-theorem ContMdiff.prod_mk {f : M → M'} {g : M → N'} (hf : ContMdiff I I' n f)
-    (hg : ContMdiff I J' n g) : ContMdiff I (I'.Prod J') n fun x => (f x, g x) := fun x =>
+#print ContMDiff.prod_mk /-
+theorem ContMDiff.prod_mk {f : M → M'} {g : M → N'} (hf : ContMDiff I I' n f)
+    (hg : ContMDiff I J' n g) : ContMDiff I (I'.Prod J') n fun x => (f x, g x) := fun x =>
   (hf x).prod_mk (hg x)
-#align cont_mdiff.prod_mk ContMdiff.prod_mk
+#align cont_mdiff.prod_mk ContMDiff.prod_mk
+-/
 
-theorem ContMdiff.prod_mk_space {f : M → E'} {g : M → F'} (hf : ContMdiff I 𝓘(𝕜, E') n f)
-    (hg : ContMdiff I 𝓘(𝕜, F') n g) : ContMdiff I 𝓘(𝕜, E' × F') n fun x => (f x, g x) := fun x =>
+#print ContMDiff.prod_mk_space /-
+theorem ContMDiff.prod_mk_space {f : M → E'} {g : M → F'} (hf : ContMDiff I 𝓘(𝕜, E') n f)
+    (hg : ContMDiff I 𝓘(𝕜, F') n g) : ContMDiff I 𝓘(𝕜, E' × F') n fun x => (f x, g x) := fun x =>
   (hf x).prod_mk_space (hg x)
-#align cont_mdiff.prod_mk_space ContMdiff.prod_mk_space
+#align cont_mdiff.prod_mk_space ContMDiff.prod_mk_space
+-/
 
+#print SmoothWithinAt.prod_mk /-
 theorem SmoothWithinAt.prod_mk {f : M → M'} {g : M → N'} (hf : SmoothWithinAt I I' f s x)
     (hg : SmoothWithinAt I J' g s x) : SmoothWithinAt I (I'.Prod J') (fun x => (f x, g x)) s x :=
   hf.prod_mk hg
 #align smooth_within_at.prod_mk SmoothWithinAt.prod_mk
+-/
 
+#print SmoothWithinAt.prod_mk_space /-
 theorem SmoothWithinAt.prod_mk_space {f : M → E'} {g : M → F'}
     (hf : SmoothWithinAt I 𝓘(𝕜, E') f s x) (hg : SmoothWithinAt I 𝓘(𝕜, F') g s x) :
     SmoothWithinAt I 𝓘(𝕜, E' × F') (fun x => (f x, g x)) s x :=
   hf.prod_mk_space hg
 #align smooth_within_at.prod_mk_space SmoothWithinAt.prod_mk_space
+-/
 
+#print SmoothAt.prod_mk /-
 theorem SmoothAt.prod_mk {f : M → M'} {g : M → N'} (hf : SmoothAt I I' f x)
     (hg : SmoothAt I J' g x) : SmoothAt I (I'.Prod J') (fun x => (f x, g x)) x :=
   hf.prod_mk hg
 #align smooth_at.prod_mk SmoothAt.prod_mk
+-/
 
+#print SmoothAt.prod_mk_space /-
 theorem SmoothAt.prod_mk_space {f : M → E'} {g : M → F'} (hf : SmoothAt I 𝓘(𝕜, E') f x)
     (hg : SmoothAt I 𝓘(𝕜, F') g x) : SmoothAt I 𝓘(𝕜, E' × F') (fun x => (f x, g x)) x :=
   hf.prod_mk_space hg
 #align smooth_at.prod_mk_space SmoothAt.prod_mk_space
+-/
 
+#print SmoothOn.prod_mk /-
 theorem SmoothOn.prod_mk {f : M → M'} {g : M → N'} (hf : SmoothOn I I' f s)
     (hg : SmoothOn I J' g s) : SmoothOn I (I'.Prod J') (fun x => (f x, g x)) s :=
   hf.prod_mk hg
 #align smooth_on.prod_mk SmoothOn.prod_mk
+-/
 
+#print SmoothOn.prod_mk_space /-
 theorem SmoothOn.prod_mk_space {f : M → E'} {g : M → F'} (hf : SmoothOn I 𝓘(𝕜, E') f s)
     (hg : SmoothOn I 𝓘(𝕜, F') g s) : SmoothOn I 𝓘(𝕜, E' × F') (fun x => (f x, g x)) s :=
   hf.prod_mk_space hg
 #align smooth_on.prod_mk_space SmoothOn.prod_mk_space
+-/
 
+#print Smooth.prod_mk /-
 theorem Smooth.prod_mk {f : M → M'} {g : M → N'} (hf : Smooth I I' f) (hg : Smooth I J' g) :
     Smooth I (I'.Prod J') fun x => (f x, g x) :=
   hf.prod_mk hg
 #align smooth.prod_mk Smooth.prod_mk
+-/
 
+#print Smooth.prod_mk_space /-
 theorem Smooth.prod_mk_space {f : M → E'} {g : M → F'} (hf : Smooth I 𝓘(𝕜, E') f)
     (hg : Smooth I 𝓘(𝕜, F') g) : Smooth I 𝓘(𝕜, E' × F') fun x => (f x, g x) :=
   hf.prod_mk_space hg
 #align smooth.prod_mk_space Smooth.prod_mk_space
+-/
 
 end ProdMk
 
 section Projections
 
-theorem contMdiffWithinAt_fst {s : Set (M × N)} {p : M × N} :
-    ContMdiffWithinAt (I.Prod J) I n Prod.fst s p :=
+#print contMDiffWithinAt_fst /-
+theorem contMDiffWithinAt_fst {s : Set (M × N)} {p : M × N} :
+    ContMDiffWithinAt (I.Prod J) I n Prod.fst s p :=
   by
-  rw [contMdiffWithinAt_iff']
+  rw [contMDiffWithinAt_iff']
   refine' ⟨continuousWithinAt_fst, _⟩
   refine' cont_diff_within_at_fst.congr (fun y hy => _) _
   · simp only [mfld_simps] at hy 
     simp only [hy, mfld_simps]
   · simp only [mfld_simps]
-#align cont_mdiff_within_at_fst contMdiffWithinAt_fst
+#align cont_mdiff_within_at_fst contMDiffWithinAt_fst
+-/
 
-theorem ContMdiffWithinAt.fst {f : N → M × M'} {s : Set N} {x : N}
-    (hf : ContMdiffWithinAt J (I.Prod I') n f s x) :
-    ContMdiffWithinAt J I n (fun x => (f x).1) s x :=
-  contMdiffWithinAt_fst.comp x hf (mapsTo_image f s)
-#align cont_mdiff_within_at.fst ContMdiffWithinAt.fst
+#print ContMDiffWithinAt.fst /-
+theorem ContMDiffWithinAt.fst {f : N → M × M'} {s : Set N} {x : N}
+    (hf : ContMDiffWithinAt J (I.Prod I') n f s x) :
+    ContMDiffWithinAt J I n (fun x => (f x).1) s x :=
+  contMDiffWithinAt_fst.comp x hf (mapsTo_image f s)
+#align cont_mdiff_within_at.fst ContMDiffWithinAt.fst
+-/
 
-theorem contMdiffAt_fst {p : M × N} : ContMdiffAt (I.Prod J) I n Prod.fst p :=
-  contMdiffWithinAt_fst
-#align cont_mdiff_at_fst contMdiffAt_fst
+#print contMDiffAt_fst /-
+theorem contMDiffAt_fst {p : M × N} : ContMDiffAt (I.Prod J) I n Prod.fst p :=
+  contMDiffWithinAt_fst
+#align cont_mdiff_at_fst contMDiffAt_fst
+-/
 
-theorem contMdiffOn_fst {s : Set (M × N)} : ContMdiffOn (I.Prod J) I n Prod.fst s := fun x hx =>
-  contMdiffWithinAt_fst
-#align cont_mdiff_on_fst contMdiffOn_fst
+#print contMDiffOn_fst /-
+theorem contMDiffOn_fst {s : Set (M × N)} : ContMDiffOn (I.Prod J) I n Prod.fst s := fun x hx =>
+  contMDiffWithinAt_fst
+#align cont_mdiff_on_fst contMDiffOn_fst
+-/
 
-theorem contMdiff_fst : ContMdiff (I.Prod J) I n (@Prod.fst M N) := fun x => contMdiffAt_fst
-#align cont_mdiff_fst contMdiff_fst
+#print contMDiff_fst /-
+theorem contMDiff_fst : ContMDiff (I.Prod J) I n (@Prod.fst M N) := fun x => contMDiffAt_fst
+#align cont_mdiff_fst contMDiff_fst
+-/
 
+#print smoothWithinAt_fst /-
 theorem smoothWithinAt_fst {s : Set (M × N)} {p : M × N} :
     SmoothWithinAt (I.Prod J) I Prod.fst s p :=
-  contMdiffWithinAt_fst
+  contMDiffWithinAt_fst
 #align smooth_within_at_fst smoothWithinAt_fst
+-/
 
+#print smoothAt_fst /-
 theorem smoothAt_fst {p : M × N} : SmoothAt (I.Prod J) I Prod.fst p :=
-  contMdiffAt_fst
+  contMDiffAt_fst
 #align smooth_at_fst smoothAt_fst
+-/
 
+#print smoothOn_fst /-
 theorem smoothOn_fst {s : Set (M × N)} : SmoothOn (I.Prod J) I Prod.fst s :=
-  contMdiffOn_fst
+  contMDiffOn_fst
 #align smooth_on_fst smoothOn_fst
+-/
 
+#print smooth_fst /-
 theorem smooth_fst : Smooth (I.Prod J) I (@Prod.fst M N) :=
-  contMdiff_fst
+  contMDiff_fst
 #align smooth_fst smooth_fst
+-/
 
-theorem ContMdiffAt.fst {f : N → M × M'} {x : N} (hf : ContMdiffAt J (I.Prod I') n f x) :
-    ContMdiffAt J I n (fun x => (f x).1) x :=
-  contMdiffAt_fst.comp x hf
-#align cont_mdiff_at.fst ContMdiffAt.fst
+#print ContMDiffAt.fst /-
+theorem ContMDiffAt.fst {f : N → M × M'} {x : N} (hf : ContMDiffAt J (I.Prod I') n f x) :
+    ContMDiffAt J I n (fun x => (f x).1) x :=
+  contMDiffAt_fst.comp x hf
+#align cont_mdiff_at.fst ContMDiffAt.fst
+-/
 
-theorem ContMdiff.fst {f : N → M × M'} (hf : ContMdiff J (I.Prod I') n f) :
-    ContMdiff J I n fun x => (f x).1 :=
-  contMdiff_fst.comp hf
-#align cont_mdiff.fst ContMdiff.fst
+#print ContMDiff.fst /-
+theorem ContMDiff.fst {f : N → M × M'} (hf : ContMDiff J (I.Prod I') n f) :
+    ContMDiff J I n fun x => (f x).1 :=
+  contMDiff_fst.comp hf
+#align cont_mdiff.fst ContMDiff.fst
+-/
 
+#print SmoothAt.fst /-
 theorem SmoothAt.fst {f : N → M × M'} {x : N} (hf : SmoothAt J (I.Prod I') f x) :
     SmoothAt J I (fun x => (f x).1) x :=
   smoothAt_fst.comp x hf
 #align smooth_at.fst SmoothAt.fst
+-/
 
+#print Smooth.fst /-
 theorem Smooth.fst {f : N → M × M'} (hf : Smooth J (I.Prod I') f) : Smooth J I fun x => (f x).1 :=
   smooth_fst.comp hf
 #align smooth.fst Smooth.fst
+-/
 
-theorem contMdiffWithinAt_snd {s : Set (M × N)} {p : M × N} :
-    ContMdiffWithinAt (I.Prod J) J n Prod.snd s p :=
+#print contMDiffWithinAt_snd /-
+theorem contMDiffWithinAt_snd {s : Set (M × N)} {p : M × N} :
+    ContMDiffWithinAt (I.Prod J) J n Prod.snd s p :=
   by
-  rw [contMdiffWithinAt_iff']
+  rw [contMDiffWithinAt_iff']
   refine' ⟨continuousWithinAt_snd, _⟩
   refine' cont_diff_within_at_snd.congr (fun y hy => _) _
   · simp only [mfld_simps] at hy 
     simp only [hy, mfld_simps]
   · simp only [mfld_simps]
-#align cont_mdiff_within_at_snd contMdiffWithinAt_snd
+#align cont_mdiff_within_at_snd contMDiffWithinAt_snd
+-/
 
-theorem ContMdiffWithinAt.snd {f : N → M × M'} {s : Set N} {x : N}
-    (hf : ContMdiffWithinAt J (I.Prod I') n f s x) :
-    ContMdiffWithinAt J I' n (fun x => (f x).2) s x :=
-  contMdiffWithinAt_snd.comp x hf (mapsTo_image f s)
-#align cont_mdiff_within_at.snd ContMdiffWithinAt.snd
+#print ContMDiffWithinAt.snd /-
+theorem ContMDiffWithinAt.snd {f : N → M × M'} {s : Set N} {x : N}
+    (hf : ContMDiffWithinAt J (I.Prod I') n f s x) :
+    ContMDiffWithinAt J I' n (fun x => (f x).2) s x :=
+  contMDiffWithinAt_snd.comp x hf (mapsTo_image f s)
+#align cont_mdiff_within_at.snd ContMDiffWithinAt.snd
+-/
 
-theorem contMdiffAt_snd {p : M × N} : ContMdiffAt (I.Prod J) J n Prod.snd p :=
-  contMdiffWithinAt_snd
-#align cont_mdiff_at_snd contMdiffAt_snd
+#print contMDiffAt_snd /-
+theorem contMDiffAt_snd {p : M × N} : ContMDiffAt (I.Prod J) J n Prod.snd p :=
+  contMDiffWithinAt_snd
+#align cont_mdiff_at_snd contMDiffAt_snd
+-/
 
-theorem contMdiffOn_snd {s : Set (M × N)} : ContMdiffOn (I.Prod J) J n Prod.snd s := fun x hx =>
-  contMdiffWithinAt_snd
-#align cont_mdiff_on_snd contMdiffOn_snd
+#print contMDiffOn_snd /-
+theorem contMDiffOn_snd {s : Set (M × N)} : ContMDiffOn (I.Prod J) J n Prod.snd s := fun x hx =>
+  contMDiffWithinAt_snd
+#align cont_mdiff_on_snd contMDiffOn_snd
+-/
 
-theorem contMdiff_snd : ContMdiff (I.Prod J) J n (@Prod.snd M N) := fun x => contMdiffAt_snd
-#align cont_mdiff_snd contMdiff_snd
+#print contMDiff_snd /-
+theorem contMDiff_snd : ContMDiff (I.Prod J) J n (@Prod.snd M N) := fun x => contMDiffAt_snd
+#align cont_mdiff_snd contMDiff_snd
+-/
 
+#print smoothWithinAt_snd /-
 theorem smoothWithinAt_snd {s : Set (M × N)} {p : M × N} :
     SmoothWithinAt (I.Prod J) J Prod.snd s p :=
-  contMdiffWithinAt_snd
+  contMDiffWithinAt_snd
 #align smooth_within_at_snd smoothWithinAt_snd
+-/
 
+#print smoothAt_snd /-
 theorem smoothAt_snd {p : M × N} : SmoothAt (I.Prod J) J Prod.snd p :=
-  contMdiffAt_snd
+  contMDiffAt_snd
 #align smooth_at_snd smoothAt_snd
+-/
 
+#print smoothOn_snd /-
 theorem smoothOn_snd {s : Set (M × N)} : SmoothOn (I.Prod J) J Prod.snd s :=
-  contMdiffOn_snd
+  contMDiffOn_snd
 #align smooth_on_snd smoothOn_snd
+-/
 
+#print smooth_snd /-
 theorem smooth_snd : Smooth (I.Prod J) J (@Prod.snd M N) :=
-  contMdiff_snd
+  contMDiff_snd
 #align smooth_snd smooth_snd
+-/
 
-theorem ContMdiffAt.snd {f : N → M × M'} {x : N} (hf : ContMdiffAt J (I.Prod I') n f x) :
-    ContMdiffAt J I' n (fun x => (f x).2) x :=
-  contMdiffAt_snd.comp x hf
-#align cont_mdiff_at.snd ContMdiffAt.snd
+#print ContMDiffAt.snd /-
+theorem ContMDiffAt.snd {f : N → M × M'} {x : N} (hf : ContMDiffAt J (I.Prod I') n f x) :
+    ContMDiffAt J I' n (fun x => (f x).2) x :=
+  contMDiffAt_snd.comp x hf
+#align cont_mdiff_at.snd ContMDiffAt.snd
+-/
 
-theorem ContMdiff.snd {f : N → M × M'} (hf : ContMdiff J (I.Prod I') n f) :
-    ContMdiff J I' n fun x => (f x).2 :=
-  contMdiff_snd.comp hf
-#align cont_mdiff.snd ContMdiff.snd
+#print ContMDiff.snd /-
+theorem ContMDiff.snd {f : N → M × M'} (hf : ContMDiff J (I.Prod I') n f) :
+    ContMDiff J I' n fun x => (f x).2 :=
+  contMDiff_snd.comp hf
+#align cont_mdiff.snd ContMDiff.snd
+-/
 
+#print SmoothAt.snd /-
 theorem SmoothAt.snd {f : N → M × M'} {x : N} (hf : SmoothAt J (I.Prod I') f x) :
     SmoothAt J I' (fun x => (f x).2) x :=
   smoothAt_snd.comp x hf
 #align smooth_at.snd SmoothAt.snd
+-/
 
+#print Smooth.snd /-
 theorem Smooth.snd {f : N → M × M'} (hf : Smooth J (I.Prod I') f) : Smooth J I' fun x => (f x).2 :=
   smooth_snd.comp hf
 #align smooth.snd Smooth.snd
+-/
 
 end Projections
 
-theorem contMdiffWithinAt_prod_iff (f : M → M' × N') {s : Set M} {x : M} :
-    ContMdiffWithinAt I (I'.Prod J') n f s x ↔
-      ContMdiffWithinAt I I' n (Prod.fst ∘ f) s x ∧ ContMdiffWithinAt I J' n (Prod.snd ∘ f) s x :=
+#print contMDiffWithinAt_prod_iff /-
+theorem contMDiffWithinAt_prod_iff (f : M → M' × N') {s : Set M} {x : M} :
+    ContMDiffWithinAt I (I'.Prod J') n f s x ↔
+      ContMDiffWithinAt I I' n (Prod.fst ∘ f) s x ∧ ContMDiffWithinAt I J' n (Prod.snd ∘ f) s x :=
   by refine' ⟨fun h => ⟨h.fst, h.snd⟩, fun h => _⟩; simpa only [Prod.mk.eta] using h.1.prod_mk h.2
-#align cont_mdiff_within_at_prod_iff contMdiffWithinAt_prod_iff
+#align cont_mdiff_within_at_prod_iff contMDiffWithinAt_prod_iff
+-/
 
-theorem contMdiffAt_prod_iff (f : M → M' × N') {x : M} :
-    ContMdiffAt I (I'.Prod J') n f x ↔
-      ContMdiffAt I I' n (Prod.fst ∘ f) x ∧ ContMdiffAt I J' n (Prod.snd ∘ f) x :=
-  by simp_rw [← contMdiffWithinAt_univ, contMdiffWithinAt_prod_iff]
-#align cont_mdiff_at_prod_iff contMdiffAt_prod_iff
+#print contMDiffAt_prod_iff /-
+theorem contMDiffAt_prod_iff (f : M → M' × N') {x : M} :
+    ContMDiffAt I (I'.Prod J') n f x ↔
+      ContMDiffAt I I' n (Prod.fst ∘ f) x ∧ ContMDiffAt I J' n (Prod.snd ∘ f) x :=
+  by simp_rw [← contMDiffWithinAt_univ, contMDiffWithinAt_prod_iff]
+#align cont_mdiff_at_prod_iff contMDiffAt_prod_iff
+-/
 
-theorem contMdiff_prod_iff (f : M → M' × N') :
-    ContMdiff I (I'.Prod J') n f ↔
-      ContMdiff I I' n (Prod.fst ∘ f) ∧ ContMdiff I J' n (Prod.snd ∘ f) :=
+#print contMDiff_prod_iff /-
+theorem contMDiff_prod_iff (f : M → M' × N') :
+    ContMDiff I (I'.Prod J') n f ↔
+      ContMDiff I I' n (Prod.fst ∘ f) ∧ ContMDiff I J' n (Prod.snd ∘ f) :=
   ⟨fun h => ⟨h.fst, h.snd⟩, fun h => by convert h.1.prod_mk h.2; ext <;> rfl⟩
-#align cont_mdiff_prod_iff contMdiff_prod_iff
+#align cont_mdiff_prod_iff contMDiff_prod_iff
+-/
 
+#print smoothAt_prod_iff /-
 theorem smoothAt_prod_iff (f : M → M' × N') {x : M} :
     SmoothAt I (I'.Prod J') f x ↔ SmoothAt I I' (Prod.fst ∘ f) x ∧ SmoothAt I J' (Prod.snd ∘ f) x :=
-  contMdiffAt_prod_iff f
+  contMDiffAt_prod_iff f
 #align smooth_at_prod_iff smoothAt_prod_iff
+-/
 
+#print smooth_prod_iff /-
 theorem smooth_prod_iff (f : M → M' × N') :
     Smooth I (I'.Prod J') f ↔ Smooth I I' (Prod.fst ∘ f) ∧ Smooth I J' (Prod.snd ∘ f) :=
-  contMdiff_prod_iff f
+  contMDiff_prod_iff f
 #align smooth_prod_iff smooth_prod_iff
+-/
 
+#print smooth_prod_assoc /-
 theorem smooth_prod_assoc :
     Smooth ((I.Prod I').Prod J) (I.Prod (I'.Prod J)) fun x : (M × M') × N => (x.1.1, x.1.2, x.2) :=
   smooth_fst.fst.prod_mk <| smooth_fst.snd.prod_mk smooth_snd
 #align smooth_prod_assoc smooth_prod_assoc
+-/
 
 section Prod_map
 
 variable {g : N → N'} {r : Set N} {y : N}
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print ContMDiffWithinAt.prod_map' /-
 /-- The product map of two `C^n` functions within a set at a point is `C^n`
 within the product set at the product point. -/
-theorem ContMdiffWithinAt.prod_map' {p : M × N} (hf : ContMdiffWithinAt I I' n f s p.1)
-    (hg : ContMdiffWithinAt J J' n g r p.2) :
-    ContMdiffWithinAt (I.Prod J) (I'.Prod J') n (Prod.map f g) (s ×ˢ r) p :=
-  (hf.comp p contMdiffWithinAt_fst (prod_subset_preimage_fst _ _)).prod_mk <|
-    hg.comp p contMdiffWithinAt_snd (prod_subset_preimage_snd _ _)
-#align cont_mdiff_within_at.prod_map' ContMdiffWithinAt.prod_map'
+theorem ContMDiffWithinAt.prod_map' {p : M × N} (hf : ContMDiffWithinAt I I' n f s p.1)
+    (hg : ContMDiffWithinAt J J' n g r p.2) :
+    ContMDiffWithinAt (I.Prod J) (I'.Prod J') n (Prod.map f g) (s ×ˢ r) p :=
+  (hf.comp p contMDiffWithinAt_fst (prod_subset_preimage_fst _ _)).prod_mk <|
+    hg.comp p contMDiffWithinAt_snd (prod_subset_preimage_snd _ _)
+#align cont_mdiff_within_at.prod_map' ContMDiffWithinAt.prod_map'
+-/
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
-theorem ContMdiffWithinAt.prod_map (hf : ContMdiffWithinAt I I' n f s x)
-    (hg : ContMdiffWithinAt J J' n g r y) :
-    ContMdiffWithinAt (I.Prod J) (I'.Prod J') n (Prod.map f g) (s ×ˢ r) (x, y) :=
-  ContMdiffWithinAt.prod_map' hf hg
-#align cont_mdiff_within_at.prod_map ContMdiffWithinAt.prod_map
-
-theorem ContMdiffAt.prod_map (hf : ContMdiffAt I I' n f x) (hg : ContMdiffAt J J' n g y) :
-    ContMdiffAt (I.Prod J) (I'.Prod J') n (Prod.map f g) (x, y) :=
+#print ContMDiffWithinAt.prod_map /-
+theorem ContMDiffWithinAt.prod_map (hf : ContMDiffWithinAt I I' n f s x)
+    (hg : ContMDiffWithinAt J J' n g r y) :
+    ContMDiffWithinAt (I.Prod J) (I'.Prod J') n (Prod.map f g) (s ×ˢ r) (x, y) :=
+  ContMDiffWithinAt.prod_map' hf hg
+#align cont_mdiff_within_at.prod_map ContMDiffWithinAt.prod_map
+-/
+
+#print ContMDiffAt.prod_map /-
+theorem ContMDiffAt.prod_map (hf : ContMDiffAt I I' n f x) (hg : ContMDiffAt J J' n g y) :
+    ContMDiffAt (I.Prod J) (I'.Prod J') n (Prod.map f g) (x, y) :=
   by
-  rw [← contMdiffWithinAt_univ] at *
+  rw [← contMDiffWithinAt_univ] at *
   convert hf.prod_map hg
   exact univ_prod_univ.symm
-#align cont_mdiff_at.prod_map ContMdiffAt.prod_map
+#align cont_mdiff_at.prod_map ContMDiffAt.prod_map
+-/
 
-theorem ContMdiffAt.prod_map' {p : M × N} (hf : ContMdiffAt I I' n f p.1)
-    (hg : ContMdiffAt J J' n g p.2) : ContMdiffAt (I.Prod J) (I'.Prod J') n (Prod.map f g) p :=
+#print ContMDiffAt.prod_map' /-
+theorem ContMDiffAt.prod_map' {p : M × N} (hf : ContMDiffAt I I' n f p.1)
+    (hg : ContMDiffAt J J' n g p.2) : ContMDiffAt (I.Prod J) (I'.Prod J') n (Prod.map f g) p :=
   by
   rcases p with ⟨⟩
   exact hf.prod_map hg
-#align cont_mdiff_at.prod_map' ContMdiffAt.prod_map'
+#align cont_mdiff_at.prod_map' ContMDiffAt.prod_map'
+-/
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
-theorem ContMdiffOn.prod_map (hf : ContMdiffOn I I' n f s) (hg : ContMdiffOn J J' n g r) :
-    ContMdiffOn (I.Prod J) (I'.Prod J') n (Prod.map f g) (s ×ˢ r) :=
-  (hf.comp contMdiffOn_fst (prod_subset_preimage_fst _ _)).prod_mk <|
-    hg.comp contMdiffOn_snd (prod_subset_preimage_snd _ _)
-#align cont_mdiff_on.prod_map ContMdiffOn.prod_map
-
-theorem ContMdiff.prod_map (hf : ContMdiff I I' n f) (hg : ContMdiff J J' n g) :
-    ContMdiff (I.Prod J) (I'.Prod J') n (Prod.map f g) :=
+#print ContMDiffOn.prod_map /-
+theorem ContMDiffOn.prod_map (hf : ContMDiffOn I I' n f s) (hg : ContMDiffOn J J' n g r) :
+    ContMDiffOn (I.Prod J) (I'.Prod J') n (Prod.map f g) (s ×ˢ r) :=
+  (hf.comp contMDiffOn_fst (prod_subset_preimage_fst _ _)).prod_mk <|
+    hg.comp contMDiffOn_snd (prod_subset_preimage_snd _ _)
+#align cont_mdiff_on.prod_map ContMDiffOn.prod_map
+-/
+
+#print ContMDiff.prod_map /-
+theorem ContMDiff.prod_map (hf : ContMDiff I I' n f) (hg : ContMDiff J J' n g) :
+    ContMDiff (I.Prod J) (I'.Prod J') n (Prod.map f g) :=
   by
   intro p
   exact (hf p.1).prod_map' (hg p.2)
-#align cont_mdiff.prod_map ContMdiff.prod_map
+#align cont_mdiff.prod_map ContMDiff.prod_map
+-/
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print SmoothWithinAt.prod_map /-
 theorem SmoothWithinAt.prod_map (hf : SmoothWithinAt I I' f s x) (hg : SmoothWithinAt J J' g r y) :
     SmoothWithinAt (I.Prod J) (I'.Prod J') (Prod.map f g) (s ×ˢ r) (x, y) :=
   hf.Prod_map hg
 #align smooth_within_at.prod_map SmoothWithinAt.prod_map
+-/
 
+#print SmoothAt.prod_map /-
 theorem SmoothAt.prod_map (hf : SmoothAt I I' f x) (hg : SmoothAt J J' g y) :
     SmoothAt (I.Prod J) (I'.Prod J') (Prod.map f g) (x, y) :=
   hf.Prod_map hg
 #align smooth_at.prod_map SmoothAt.prod_map
+-/
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print SmoothOn.prod_map /-
 theorem SmoothOn.prod_map (hf : SmoothOn I I' f s) (hg : SmoothOn J J' g r) :
     SmoothOn (I.Prod J) (I'.Prod J') (Prod.map f g) (s ×ˢ r) :=
   hf.Prod_map hg
 #align smooth_on.prod_map SmoothOn.prod_map
+-/
 
+#print Smooth.prod_map /-
 theorem Smooth.prod_map (hf : Smooth I I' f) (hg : Smooth J J' g) :
     Smooth (I.Prod J) (I'.Prod J') (Prod.map f g) :=
   hf.Prod_map hg
 #align smooth.prod_map Smooth.prod_map
+-/
 
 end Prod_map
 
@@ -1805,192 +2263,252 @@ use `𝓘(𝕜, Π i, F i)` as the model space.
 variable {ι : Type _} [Fintype ι] {Fi : ι → Type _} [∀ i, NormedAddCommGroup (Fi i)]
   [∀ i, NormedSpace 𝕜 (Fi i)] {φ : M → ∀ i, Fi i}
 
-theorem contMdiffWithinAt_pi_space :
-    ContMdiffWithinAt I 𝓘(𝕜, ∀ i, Fi i) n φ s x ↔
-      ∀ i, ContMdiffWithinAt I 𝓘(𝕜, Fi i) n (fun x => φ x i) s x :=
+#print contMDiffWithinAt_pi_space /-
+theorem contMDiffWithinAt_pi_space :
+    ContMDiffWithinAt I 𝓘(𝕜, ∀ i, Fi i) n φ s x ↔
+      ∀ i, ContMDiffWithinAt I 𝓘(𝕜, Fi i) n (fun x => φ x i) s x :=
   by
-  simp only [contMdiffWithinAt_iff, continuousWithinAt_pi, contDiffWithinAt_pi, forall_and,
+  simp only [contMDiffWithinAt_iff, continuousWithinAt_pi, contDiffWithinAt_pi, forall_and,
     writtenInExtChartAt, extChartAt_model_space_eq_id, (· ∘ ·), LocalEquiv.refl_coe, id]
-#align cont_mdiff_within_at_pi_space contMdiffWithinAt_pi_space
+#align cont_mdiff_within_at_pi_space contMDiffWithinAt_pi_space
+-/
 
-theorem contMdiffOn_pi_space :
-    ContMdiffOn I 𝓘(𝕜, ∀ i, Fi i) n φ s ↔ ∀ i, ContMdiffOn I 𝓘(𝕜, Fi i) n (fun x => φ x i) s :=
-  ⟨fun h i x hx => contMdiffWithinAt_pi_space.1 (h x hx) i, fun h x hx =>
-    contMdiffWithinAt_pi_space.2 fun i => h i x hx⟩
-#align cont_mdiff_on_pi_space contMdiffOn_pi_space
+#print contMDiffOn_pi_space /-
+theorem contMDiffOn_pi_space :
+    ContMDiffOn I 𝓘(𝕜, ∀ i, Fi i) n φ s ↔ ∀ i, ContMDiffOn I 𝓘(𝕜, Fi i) n (fun x => φ x i) s :=
+  ⟨fun h i x hx => contMDiffWithinAt_pi_space.1 (h x hx) i, fun h x hx =>
+    contMDiffWithinAt_pi_space.2 fun i => h i x hx⟩
+#align cont_mdiff_on_pi_space contMDiffOn_pi_space
+-/
 
-theorem contMdiffAt_pi_space :
-    ContMdiffAt I 𝓘(𝕜, ∀ i, Fi i) n φ x ↔ ∀ i, ContMdiffAt I 𝓘(𝕜, Fi i) n (fun x => φ x i) x :=
-  contMdiffWithinAt_pi_space
-#align cont_mdiff_at_pi_space contMdiffAt_pi_space
+#print contMDiffAt_pi_space /-
+theorem contMDiffAt_pi_space :
+    ContMDiffAt I 𝓘(𝕜, ∀ i, Fi i) n φ x ↔ ∀ i, ContMDiffAt I 𝓘(𝕜, Fi i) n (fun x => φ x i) x :=
+  contMDiffWithinAt_pi_space
+#align cont_mdiff_at_pi_space contMDiffAt_pi_space
+-/
 
-theorem contMdiff_pi_space :
-    ContMdiff I 𝓘(𝕜, ∀ i, Fi i) n φ ↔ ∀ i, ContMdiff I 𝓘(𝕜, Fi i) n fun x => φ x i :=
-  ⟨fun h i x => contMdiffAt_pi_space.1 (h x) i, fun h x => contMdiffAt_pi_space.2 fun i => h i x⟩
-#align cont_mdiff_pi_space contMdiff_pi_space
+#print contMDiff_pi_space /-
+theorem contMDiff_pi_space :
+    ContMDiff I 𝓘(𝕜, ∀ i, Fi i) n φ ↔ ∀ i, ContMDiff I 𝓘(𝕜, Fi i) n fun x => φ x i :=
+  ⟨fun h i x => contMDiffAt_pi_space.1 (h x) i, fun h x => contMDiffAt_pi_space.2 fun i => h i x⟩
+#align cont_mdiff_pi_space contMDiff_pi_space
+-/
 
+#print smoothWithinAt_pi_space /-
 theorem smoothWithinAt_pi_space :
     SmoothWithinAt I 𝓘(𝕜, ∀ i, Fi i) φ s x ↔
       ∀ i, SmoothWithinAt I 𝓘(𝕜, Fi i) (fun x => φ x i) s x :=
-  contMdiffWithinAt_pi_space
+  contMDiffWithinAt_pi_space
 #align smooth_within_at_pi_space smoothWithinAt_pi_space
+-/
 
+#print smoothOn_pi_space /-
 theorem smoothOn_pi_space :
     SmoothOn I 𝓘(𝕜, ∀ i, Fi i) φ s ↔ ∀ i, SmoothOn I 𝓘(𝕜, Fi i) (fun x => φ x i) s :=
-  contMdiffOn_pi_space
+  contMDiffOn_pi_space
 #align smooth_on_pi_space smoothOn_pi_space
+-/
 
+#print smoothAt_pi_space /-
 theorem smoothAt_pi_space :
     SmoothAt I 𝓘(𝕜, ∀ i, Fi i) φ x ↔ ∀ i, SmoothAt I 𝓘(𝕜, Fi i) (fun x => φ x i) x :=
-  contMdiffAt_pi_space
+  contMDiffAt_pi_space
 #align smooth_at_pi_space smoothAt_pi_space
+-/
 
+#print smooth_pi_space /-
 theorem smooth_pi_space : Smooth I 𝓘(𝕜, ∀ i, Fi i) φ ↔ ∀ i, Smooth I 𝓘(𝕜, Fi i) fun x => φ x i :=
-  contMdiff_pi_space
+  contMDiff_pi_space
 #align smooth_pi_space smooth_pi_space
+-/
 
 end PiSpace
 
 /-! ### Linear maps between normed spaces are smooth -/
 
 
-theorem ContinuousLinearMap.contMdiff (L : E →L[𝕜] F) : ContMdiff 𝓘(𝕜, E) 𝓘(𝕜, F) n L :=
-  L.ContDiff.ContMdiff
-#align continuous_linear_map.cont_mdiff ContinuousLinearMap.contMdiff
+#print ContinuousLinearMap.contMDiff /-
+theorem ContinuousLinearMap.contMDiff (L : E →L[𝕜] F) : ContMDiff 𝓘(𝕜, E) 𝓘(𝕜, F) n L :=
+  L.ContDiff.ContMDiff
+#align continuous_linear_map.cont_mdiff ContinuousLinearMap.contMDiff
+-/
 
-theorem ContMdiffWithinAt.clm_comp {g : M → F₁ →L[𝕜] F₃} {f : M → F₂ →L[𝕜] F₁} {s : Set M} {x : M}
-    (hg : ContMdiffWithinAt I 𝓘(𝕜, F₁ →L[𝕜] F₃) n g s x)
-    (hf : ContMdiffWithinAt I 𝓘(𝕜, F₂ →L[𝕜] F₁) n f s x) :
-    ContMdiffWithinAt I 𝓘(𝕜, F₂ →L[𝕜] F₃) n (fun x => (g x).comp (f x)) s x :=
-  @ContDiffWithinAt.comp_contMdiffWithinAt _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
+#print ContMDiffWithinAt.clm_comp /-
+theorem ContMDiffWithinAt.clm_comp {g : M → F₁ →L[𝕜] F₃} {f : M → F₂ →L[𝕜] F₁} {s : Set M} {x : M}
+    (hg : ContMDiffWithinAt I 𝓘(𝕜, F₁ →L[𝕜] F₃) n g s x)
+    (hf : ContMDiffWithinAt I 𝓘(𝕜, F₂ →L[𝕜] F₁) n f s x) :
+    ContMDiffWithinAt I 𝓘(𝕜, F₂ →L[𝕜] F₃) n (fun x => (g x).comp (f x)) s x :=
+  @ContDiffWithinAt.comp_contMDiffWithinAt _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
     (fun x : (F₁ →L[𝕜] F₃) × (F₂ →L[𝕜] F₁) => x.1.comp x.2) (fun x => (g x, f x)) s _ x
     (by apply ContDiff.contDiffAt; exact cont_diff_fst.clm_comp contDiff_snd) (hg.prod_mk_space hf)
     (by simp_rw [preimage_univ, subset_univ])
-#align cont_mdiff_within_at.clm_comp ContMdiffWithinAt.clm_comp
+#align cont_mdiff_within_at.clm_comp ContMDiffWithinAt.clm_comp
+-/
 
-theorem ContMdiffAt.clm_comp {g : M → F₁ →L[𝕜] F₃} {f : M → F₂ →L[𝕜] F₁} {x : M}
-    (hg : ContMdiffAt I 𝓘(𝕜, F₁ →L[𝕜] F₃) n g x) (hf : ContMdiffAt I 𝓘(𝕜, F₂ →L[𝕜] F₁) n f x) :
-    ContMdiffAt I 𝓘(𝕜, F₂ →L[𝕜] F₃) n (fun x => (g x).comp (f x)) x :=
-  (hg.ContMdiffWithinAt.clm_comp hf.ContMdiffWithinAt).ContMdiffAt univ_mem
-#align cont_mdiff_at.clm_comp ContMdiffAt.clm_comp
+#print ContMDiffAt.clm_comp /-
+theorem ContMDiffAt.clm_comp {g : M → F₁ →L[𝕜] F₃} {f : M → F₂ →L[𝕜] F₁} {x : M}
+    (hg : ContMDiffAt I 𝓘(𝕜, F₁ →L[𝕜] F₃) n g x) (hf : ContMDiffAt I 𝓘(𝕜, F₂ →L[𝕜] F₁) n f x) :
+    ContMDiffAt I 𝓘(𝕜, F₂ →L[𝕜] F₃) n (fun x => (g x).comp (f x)) x :=
+  (hg.ContMDiffWithinAt.clm_comp hf.ContMDiffWithinAt).ContMDiffAt univ_mem
+#align cont_mdiff_at.clm_comp ContMDiffAt.clm_comp
+-/
 
-theorem ContMdiffOn.clm_comp {g : M → F₁ →L[𝕜] F₃} {f : M → F₂ →L[𝕜] F₁} {s : Set M}
-    (hg : ContMdiffOn I 𝓘(𝕜, F₁ →L[𝕜] F₃) n g s) (hf : ContMdiffOn I 𝓘(𝕜, F₂ →L[𝕜] F₁) n f s) :
-    ContMdiffOn I 𝓘(𝕜, F₂ →L[𝕜] F₃) n (fun x => (g x).comp (f x)) s := fun x hx =>
+#print ContMDiffOn.clm_comp /-
+theorem ContMDiffOn.clm_comp {g : M → F₁ →L[𝕜] F₃} {f : M → F₂ →L[𝕜] F₁} {s : Set M}
+    (hg : ContMDiffOn I 𝓘(𝕜, F₁ →L[𝕜] F₃) n g s) (hf : ContMDiffOn I 𝓘(𝕜, F₂ →L[𝕜] F₁) n f s) :
+    ContMDiffOn I 𝓘(𝕜, F₂ →L[𝕜] F₃) n (fun x => (g x).comp (f x)) s := fun x hx =>
   (hg x hx).clm_comp (hf x hx)
-#align cont_mdiff_on.clm_comp ContMdiffOn.clm_comp
-
-theorem ContMdiff.clm_comp {g : M → F₁ →L[𝕜] F₃} {f : M → F₂ →L[𝕜] F₁}
-    (hg : ContMdiff I 𝓘(𝕜, F₁ →L[𝕜] F₃) n g) (hf : ContMdiff I 𝓘(𝕜, F₂ →L[𝕜] F₁) n f) :
-    ContMdiff I 𝓘(𝕜, F₂ →L[𝕜] F₃) n fun x => (g x).comp (f x) := fun x => (hg x).clm_comp (hf x)
-#align cont_mdiff.clm_comp ContMdiff.clm_comp
-
-theorem ContMdiffWithinAt.clm_apply {g : M → F₁ →L[𝕜] F₂} {f : M → F₁} {s : Set M} {x : M}
-    (hg : ContMdiffWithinAt I 𝓘(𝕜, F₁ →L[𝕜] F₂) n g s x)
-    (hf : ContMdiffWithinAt I 𝓘(𝕜, F₁) n f s x) :
-    ContMdiffWithinAt I 𝓘(𝕜, F₂) n (fun x => g x (f x)) s x :=
-  @ContDiffWithinAt.comp_contMdiffWithinAt _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
+#align cont_mdiff_on.clm_comp ContMDiffOn.clm_comp
+-/
+
+#print ContMDiff.clm_comp /-
+theorem ContMDiff.clm_comp {g : M → F₁ →L[𝕜] F₃} {f : M → F₂ →L[𝕜] F₁}
+    (hg : ContMDiff I 𝓘(𝕜, F₁ →L[𝕜] F₃) n g) (hf : ContMDiff I 𝓘(𝕜, F₂ →L[𝕜] F₁) n f) :
+    ContMDiff I 𝓘(𝕜, F₂ →L[𝕜] F₃) n fun x => (g x).comp (f x) := fun x => (hg x).clm_comp (hf x)
+#align cont_mdiff.clm_comp ContMDiff.clm_comp
+-/
+
+#print ContMDiffWithinAt.clm_apply /-
+theorem ContMDiffWithinAt.clm_apply {g : M → F₁ →L[𝕜] F₂} {f : M → F₁} {s : Set M} {x : M}
+    (hg : ContMDiffWithinAt I 𝓘(𝕜, F₁ →L[𝕜] F₂) n g s x)
+    (hf : ContMDiffWithinAt I 𝓘(𝕜, F₁) n f s x) :
+    ContMDiffWithinAt I 𝓘(𝕜, F₂) n (fun x => g x (f x)) s x :=
+  @ContDiffWithinAt.comp_contMDiffWithinAt _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
     (fun x : (F₁ →L[𝕜] F₂) × F₁ => x.1 x.2) (fun x => (g x, f x)) s _ x
     (by apply ContDiff.contDiffAt; exact cont_diff_fst.clm_apply contDiff_snd) (hg.prod_mk_space hf)
     (by simp_rw [preimage_univ, subset_univ])
-#align cont_mdiff_within_at.clm_apply ContMdiffWithinAt.clm_apply
-
-theorem ContMdiffAt.clm_apply {g : M → F₁ →L[𝕜] F₂} {f : M → F₁} {x : M}
-    (hg : ContMdiffAt I 𝓘(𝕜, F₁ →L[𝕜] F₂) n g x) (hf : ContMdiffAt I 𝓘(𝕜, F₁) n f x) :
-    ContMdiffAt I 𝓘(𝕜, F₂) n (fun x => g x (f x)) x :=
-  (hg.ContMdiffWithinAt.clm_apply hf.ContMdiffWithinAt).ContMdiffAt univ_mem
-#align cont_mdiff_at.clm_apply ContMdiffAt.clm_apply
-
-theorem ContMdiffOn.clm_apply {g : M → F₁ →L[𝕜] F₂} {f : M → F₁} {s : Set M}
-    (hg : ContMdiffOn I 𝓘(𝕜, F₁ →L[𝕜] F₂) n g s) (hf : ContMdiffOn I 𝓘(𝕜, F₁) n f s) :
-    ContMdiffOn I 𝓘(𝕜, F₂) n (fun x => g x (f x)) s := fun x hx => (hg x hx).clm_apply (hf x hx)
-#align cont_mdiff_on.clm_apply ContMdiffOn.clm_apply
-
-theorem ContMdiff.clm_apply {g : M → F₁ →L[𝕜] F₂} {f : M → F₁}
-    (hg : ContMdiff I 𝓘(𝕜, F₁ →L[𝕜] F₂) n g) (hf : ContMdiff I 𝓘(𝕜, F₁) n f) :
-    ContMdiff I 𝓘(𝕜, F₂) n fun x => g x (f x) := fun x => (hg x).clm_apply (hf x)
-#align cont_mdiff.clm_apply ContMdiff.clm_apply
-
-theorem ContMdiffWithinAt.clm_prodMap {g : M → F₁ →L[𝕜] F₃} {f : M → F₂ →L[𝕜] F₄} {s : Set M}
-    {x : M} (hg : ContMdiffWithinAt I 𝓘(𝕜, F₁ →L[𝕜] F₃) n g s x)
-    (hf : ContMdiffWithinAt I 𝓘(𝕜, F₂ →L[𝕜] F₄) n f s x) :
-    ContMdiffWithinAt I 𝓘(𝕜, F₁ × F₂ →L[𝕜] F₃ × F₄) n (fun x => (g x).Prod_map (f x)) s x :=
-  @ContDiffWithinAt.comp_contMdiffWithinAt _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
+#align cont_mdiff_within_at.clm_apply ContMDiffWithinAt.clm_apply
+-/
+
+#print ContMDiffAt.clm_apply /-
+theorem ContMDiffAt.clm_apply {g : M → F₁ →L[𝕜] F₂} {f : M → F₁} {x : M}
+    (hg : ContMDiffAt I 𝓘(𝕜, F₁ →L[𝕜] F₂) n g x) (hf : ContMDiffAt I 𝓘(𝕜, F₁) n f x) :
+    ContMDiffAt I 𝓘(𝕜, F₂) n (fun x => g x (f x)) x :=
+  (hg.ContMDiffWithinAt.clm_apply hf.ContMDiffWithinAt).ContMDiffAt univ_mem
+#align cont_mdiff_at.clm_apply ContMDiffAt.clm_apply
+-/
+
+#print ContMDiffOn.clm_apply /-
+theorem ContMDiffOn.clm_apply {g : M → F₁ →L[𝕜] F₂} {f : M → F₁} {s : Set M}
+    (hg : ContMDiffOn I 𝓘(𝕜, F₁ →L[𝕜] F₂) n g s) (hf : ContMDiffOn I 𝓘(𝕜, F₁) n f s) :
+    ContMDiffOn I 𝓘(𝕜, F₂) n (fun x => g x (f x)) s := fun x hx => (hg x hx).clm_apply (hf x hx)
+#align cont_mdiff_on.clm_apply ContMDiffOn.clm_apply
+-/
+
+#print ContMDiff.clm_apply /-
+theorem ContMDiff.clm_apply {g : M → F₁ →L[𝕜] F₂} {f : M → F₁}
+    (hg : ContMDiff I 𝓘(𝕜, F₁ →L[𝕜] F₂) n g) (hf : ContMDiff I 𝓘(𝕜, F₁) n f) :
+    ContMDiff I 𝓘(𝕜, F₂) n fun x => g x (f x) := fun x => (hg x).clm_apply (hf x)
+#align cont_mdiff.clm_apply ContMDiff.clm_apply
+-/
+
+#print ContMDiffWithinAt.clm_prodMap /-
+theorem ContMDiffWithinAt.clm_prodMap {g : M → F₁ →L[𝕜] F₃} {f : M → F₂ →L[𝕜] F₄} {s : Set M}
+    {x : M} (hg : ContMDiffWithinAt I 𝓘(𝕜, F₁ →L[𝕜] F₃) n g s x)
+    (hf : ContMDiffWithinAt I 𝓘(𝕜, F₂ →L[𝕜] F₄) n f s x) :
+    ContMDiffWithinAt I 𝓘(𝕜, F₁ × F₂ →L[𝕜] F₃ × F₄) n (fun x => (g x).Prod_map (f x)) s x :=
+  @ContDiffWithinAt.comp_contMDiffWithinAt _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
     (fun x : (F₁ →L[𝕜] F₃) × (F₂ →L[𝕜] F₄) => x.1.Prod_map x.2) (fun x => (g x, f x)) s _ x
     (by
       apply ContDiff.contDiffAt
       exact (ContinuousLinearMap.prodMapL 𝕜 F₁ F₃ F₂ F₄).ContDiff)
     (hg.prod_mk_space hf) (by simp_rw [preimage_univ, subset_univ])
-#align cont_mdiff_within_at.clm_prod_map ContMdiffWithinAt.clm_prodMap
+#align cont_mdiff_within_at.clm_prod_map ContMDiffWithinAt.clm_prodMap
+-/
 
-theorem ContMdiffAt.clm_prodMap {g : M → F₁ →L[𝕜] F₃} {f : M → F₂ →L[𝕜] F₄} {x : M}
-    (hg : ContMdiffAt I 𝓘(𝕜, F₁ →L[𝕜] F₃) n g x) (hf : ContMdiffAt I 𝓘(𝕜, F₂ →L[𝕜] F₄) n f x) :
-    ContMdiffAt I 𝓘(𝕜, F₁ × F₂ →L[𝕜] F₃ × F₄) n (fun x => (g x).Prod_map (f x)) x :=
-  (hg.ContMdiffWithinAt.clm_prodMap hf.ContMdiffWithinAt).ContMdiffAt univ_mem
-#align cont_mdiff_at.clm_prod_map ContMdiffAt.clm_prodMap
+#print ContMDiffAt.clm_prodMap /-
+theorem ContMDiffAt.clm_prodMap {g : M → F₁ →L[𝕜] F₃} {f : M → F₂ →L[𝕜] F₄} {x : M}
+    (hg : ContMDiffAt I 𝓘(𝕜, F₁ →L[𝕜] F₃) n g x) (hf : ContMDiffAt I 𝓘(𝕜, F₂ →L[𝕜] F₄) n f x) :
+    ContMDiffAt I 𝓘(𝕜, F₁ × F₂ →L[𝕜] F₃ × F₄) n (fun x => (g x).Prod_map (f x)) x :=
+  (hg.ContMDiffWithinAt.clm_prodMap hf.ContMDiffWithinAt).ContMDiffAt univ_mem
+#align cont_mdiff_at.clm_prod_map ContMDiffAt.clm_prodMap
+-/
 
-theorem ContMdiffOn.clm_prodMap {g : M → F₁ →L[𝕜] F₃} {f : M → F₂ →L[𝕜] F₄} {s : Set M}
-    (hg : ContMdiffOn I 𝓘(𝕜, F₁ →L[𝕜] F₃) n g s) (hf : ContMdiffOn I 𝓘(𝕜, F₂ →L[𝕜] F₄) n f s) :
-    ContMdiffOn I 𝓘(𝕜, F₁ × F₂ →L[𝕜] F₃ × F₄) n (fun x => (g x).Prod_map (f x)) s := fun x hx =>
+#print ContMDiffOn.clm_prodMap /-
+theorem ContMDiffOn.clm_prodMap {g : M → F₁ →L[𝕜] F₃} {f : M → F₂ →L[𝕜] F₄} {s : Set M}
+    (hg : ContMDiffOn I 𝓘(𝕜, F₁ →L[𝕜] F₃) n g s) (hf : ContMDiffOn I 𝓘(𝕜, F₂ →L[𝕜] F₄) n f s) :
+    ContMDiffOn I 𝓘(𝕜, F₁ × F₂ →L[𝕜] F₃ × F₄) n (fun x => (g x).Prod_map (f x)) s := fun x hx =>
   (hg x hx).clm_prodMap (hf x hx)
-#align cont_mdiff_on.clm_prod_map ContMdiffOn.clm_prodMap
+#align cont_mdiff_on.clm_prod_map ContMDiffOn.clm_prodMap
+-/
 
-theorem ContMdiff.clm_prodMap {g : M → F₁ →L[𝕜] F₃} {f : M → F₂ →L[𝕜] F₄}
-    (hg : ContMdiff I 𝓘(𝕜, F₁ →L[𝕜] F₃) n g) (hf : ContMdiff I 𝓘(𝕜, F₂ →L[𝕜] F₄) n f) :
-    ContMdiff I 𝓘(𝕜, F₁ × F₂ →L[𝕜] F₃ × F₄) n fun x => (g x).Prod_map (f x) := fun x =>
+#print ContMDiff.clm_prodMap /-
+theorem ContMDiff.clm_prodMap {g : M → F₁ →L[𝕜] F₃} {f : M → F₂ →L[𝕜] F₄}
+    (hg : ContMDiff I 𝓘(𝕜, F₁ →L[𝕜] F₃) n g) (hf : ContMDiff I 𝓘(𝕜, F₂ →L[𝕜] F₄) n f) :
+    ContMDiff I 𝓘(𝕜, F₁ × F₂ →L[𝕜] F₃ × F₄) n fun x => (g x).Prod_map (f x) := fun x =>
   (hg x).clm_prodMap (hf x)
-#align cont_mdiff.clm_prod_map ContMdiff.clm_prodMap
+#align cont_mdiff.clm_prod_map ContMDiff.clm_prodMap
+-/
 
 /-! ### Smoothness of standard operations -/
 
 
 variable {V : Type _} [NormedAddCommGroup V] [NormedSpace 𝕜 V]
 
+#print smooth_smul /-
 /-- On any vector space, multiplication by a scalar is a smooth operation. -/
 theorem smooth_smul : Smooth (𝓘(𝕜).Prod 𝓘(𝕜, V)) 𝓘(𝕜, V) fun p : 𝕜 × V => p.1 • p.2 :=
   smooth_iff.2 ⟨continuous_smul, fun x y => contDiff_smul.ContDiffOn⟩
 #align smooth_smul smooth_smul
+-/
 
-theorem ContMdiffWithinAt.smul {f : M → 𝕜} {g : M → V} (hf : ContMdiffWithinAt I 𝓘(𝕜) n f s x)
-    (hg : ContMdiffWithinAt I 𝓘(𝕜, V) n g s x) :
-    ContMdiffWithinAt I 𝓘(𝕜, V) n (fun p => f p • g p) s x :=
-  (smooth_smul.of_le le_top).ContMdiffAt.comp_contMdiffWithinAt x (hf.prod_mk hg)
-#align cont_mdiff_within_at.smul ContMdiffWithinAt.smul
+#print ContMDiffWithinAt.smul /-
+theorem ContMDiffWithinAt.smul {f : M → 𝕜} {g : M → V} (hf : ContMDiffWithinAt I 𝓘(𝕜) n f s x)
+    (hg : ContMDiffWithinAt I 𝓘(𝕜, V) n g s x) :
+    ContMDiffWithinAt I 𝓘(𝕜, V) n (fun p => f p • g p) s x :=
+  (smooth_smul.of_le le_top).ContMDiffAt.comp_contMDiffWithinAt x (hf.prod_mk hg)
+#align cont_mdiff_within_at.smul ContMDiffWithinAt.smul
+-/
 
-theorem ContMdiffAt.smul {f : M → 𝕜} {g : M → V} (hf : ContMdiffAt I 𝓘(𝕜) n f x)
-    (hg : ContMdiffAt I 𝓘(𝕜, V) n g x) : ContMdiffAt I 𝓘(𝕜, V) n (fun p => f p • g p) x :=
+#print ContMDiffAt.smul /-
+theorem ContMDiffAt.smul {f : M → 𝕜} {g : M → V} (hf : ContMDiffAt I 𝓘(𝕜) n f x)
+    (hg : ContMDiffAt I 𝓘(𝕜, V) n g x) : ContMDiffAt I 𝓘(𝕜, V) n (fun p => f p • g p) x :=
   hf.smul hg
-#align cont_mdiff_at.smul ContMdiffAt.smul
+#align cont_mdiff_at.smul ContMDiffAt.smul
+-/
 
-theorem ContMdiffOn.smul {f : M → 𝕜} {g : M → V} (hf : ContMdiffOn I 𝓘(𝕜) n f s)
-    (hg : ContMdiffOn I 𝓘(𝕜, V) n g s) : ContMdiffOn I 𝓘(𝕜, V) n (fun p => f p • g p) s :=
+#print ContMDiffOn.smul /-
+theorem ContMDiffOn.smul {f : M → 𝕜} {g : M → V} (hf : ContMDiffOn I 𝓘(𝕜) n f s)
+    (hg : ContMDiffOn I 𝓘(𝕜, V) n g s) : ContMDiffOn I 𝓘(𝕜, V) n (fun p => f p • g p) s :=
   fun x hx => (hf x hx).smul (hg x hx)
-#align cont_mdiff_on.smul ContMdiffOn.smul
+#align cont_mdiff_on.smul ContMDiffOn.smul
+-/
 
-theorem ContMdiff.smul {f : M → 𝕜} {g : M → V} (hf : ContMdiff I 𝓘(𝕜) n f)
-    (hg : ContMdiff I 𝓘(𝕜, V) n g) : ContMdiff I 𝓘(𝕜, V) n fun p => f p • g p := fun x =>
+#print ContMDiff.smul /-
+theorem ContMDiff.smul {f : M → 𝕜} {g : M → V} (hf : ContMDiff I 𝓘(𝕜) n f)
+    (hg : ContMDiff I 𝓘(𝕜, V) n g) : ContMDiff I 𝓘(𝕜, V) n fun p => f p • g p := fun x =>
   (hf x).smul (hg x)
-#align cont_mdiff.smul ContMdiff.smul
+#align cont_mdiff.smul ContMDiff.smul
+-/
 
+#print SmoothWithinAt.smul /-
 theorem SmoothWithinAt.smul {f : M → 𝕜} {g : M → V} (hf : SmoothWithinAt I 𝓘(𝕜) f s x)
     (hg : SmoothWithinAt I 𝓘(𝕜, V) g s x) : SmoothWithinAt I 𝓘(𝕜, V) (fun p => f p • g p) s x :=
   hf.smul hg
 #align smooth_within_at.smul SmoothWithinAt.smul
+-/
 
+#print SmoothAt.smul /-
 theorem SmoothAt.smul {f : M → 𝕜} {g : M → V} (hf : SmoothAt I 𝓘(𝕜) f x)
     (hg : SmoothAt I 𝓘(𝕜, V) g x) : SmoothAt I 𝓘(𝕜, V) (fun p => f p • g p) x :=
   hf.smul hg
 #align smooth_at.smul SmoothAt.smul
+-/
 
+#print SmoothOn.smul /-
 theorem SmoothOn.smul {f : M → 𝕜} {g : M → V} (hf : SmoothOn I 𝓘(𝕜) f s)
     (hg : SmoothOn I 𝓘(𝕜, V) g s) : SmoothOn I 𝓘(𝕜, V) (fun p => f p • g p) s :=
   hf.smul hg
 #align smooth_on.smul SmoothOn.smul
+-/
 
+#print Smooth.smul /-
 theorem Smooth.smul {f : M → 𝕜} {g : M → V} (hf : Smooth I 𝓘(𝕜) f) (hg : Smooth I 𝓘(𝕜, V) g) :
     Smooth I 𝓘(𝕜, V) fun p => f p • g p :=
   hf.smul hg
 #align smooth.smul Smooth.smul
+-/
 
 /-! ### Smoothness of (local) structomorphisms -/
 
@@ -1999,12 +2517,13 @@ section
 
 variable [ChartedSpace H M'] [IsM' : SmoothManifoldWithCorners I M']
 
-theorem is_local_structomorph_on_contDiffGroupoid_iff_aux {f : LocalHomeomorph M M'}
+#print isLocalStructomorphOn_contDiffGroupoid_iff_aux /-
+theorem isLocalStructomorphOn_contDiffGroupoid_iff_aux {f : LocalHomeomorph M M'}
     (hf : LiftPropOn (contDiffGroupoid ⊤ I).IsLocalStructomorphWithinAt f f.source) :
     SmoothOn I I f f.source :=
   by
   -- It suffices to show smoothness near each `x`
-  apply contMdiffOn_of_locally_contMdiffOn
+  apply contMDiffOn_of_locally_contMDiffOn
   intro x hx
   let c := chart_at H x
   let c' := chart_at H (f x)
@@ -2023,11 +2542,11 @@ theorem is_local_structomorph_on_contDiffGroupoid_iff_aux {f : LocalHomeomorph M
   -- We need to show `f` is `cont_mdiff_on` the domain `s ∩ f.source`.  We show this in two
   -- steps: `f` is equal to `c'.symm ∘ e ∘ c` on that domain and that function is
   -- `cont_mdiff_on` it.
-  have H₁ : ContMdiffOn I I ⊤ (c'.symm ∘ e ∘ c) s :=
+  have H₁ : ContMDiffOn I I ⊤ (c'.symm ∘ e ∘ c) s :=
     by
-    have hc' : ContMdiffOn I I ⊤ c'.symm _ := contMdiffOn_chart_symm
-    have he'' : ContMdiffOn I I ⊤ e _ := contMdiffOn_of_mem_contDiffGroupoid he
-    have hc : ContMdiffOn I I ⊤ c _ := contMdiffOn_chart
+    have hc' : ContMDiffOn I I ⊤ c'.symm _ := contMDiffOn_chart_symm
+    have he'' : ContMDiffOn I I ⊤ e _ := contMDiffOn_of_mem_contDiffGroupoid he
+    have hc : ContMDiffOn I I ⊤ c _ := contMDiffOn_chart
     refine' (hc'.comp' (he''.comp' hc)).mono _
     mfld_set_tac
   have H₂ : eq_on f (c'.symm ∘ e ∘ c) s := by
@@ -2042,20 +2561,22 @@ theorem is_local_structomorph_on_contDiffGroupoid_iff_aux {f : LocalHomeomorph M
       _ = c'.symm (e (c y)) := by rw [← he' hy₃]
   refine' (H₁.congr H₂).mono _
   mfld_set_tac
-#align is_local_structomorph_on_cont_diff_groupoid_iff_aux is_local_structomorph_on_contDiffGroupoid_iff_aux
+#align is_local_structomorph_on_cont_diff_groupoid_iff_aux isLocalStructomorphOn_contDiffGroupoid_iff_aux
+-/
 
+#print isLocalStructomorphOn_contDiffGroupoid_iff /-
 /-- Let `M` and `M'` be smooth manifolds with the same model-with-corners, `I`.  Then `f : M → M'`
 is a local structomorphism for `I`, if and only if it is manifold-smooth on the domain of definition
 in both directions. -/
-theorem is_local_structomorph_on_contDiffGroupoid_iff (f : LocalHomeomorph M M') :
+theorem isLocalStructomorphOn_contDiffGroupoid_iff (f : LocalHomeomorph M M') :
     LiftPropOn (contDiffGroupoid ⊤ I).IsLocalStructomorphWithinAt f f.source ↔
       SmoothOn I I f f.source ∧ SmoothOn I I f.symm f.target :=
   by
   constructor
   · intro h
     refine'
-      ⟨is_local_structomorph_on_contDiffGroupoid_iff_aux h,
-        is_local_structomorph_on_contDiffGroupoid_iff_aux _⟩
+      ⟨isLocalStructomorphOn_contDiffGroupoid_iff_aux h,
+        isLocalStructomorphOn_contDiffGroupoid_iff_aux _⟩
     -- todo: we can generalize this part of the proof to a lemma
     intro X hX
     let x := f.symm X
@@ -2116,14 +2637,14 @@ theorem is_local_structomorph_on_contDiffGroupoid_iff (f : LocalHomeomorph M M')
     · -- smoothness of the candidate local structomorphism in the forward direction
       intro y hy
       simp only [mfld_simps] at hy 
-      have H : ContMdiffWithinAt I I ⊤ f (f ≫ₕ c').source ((extChartAt I x).symm y) :=
+      have H : ContMDiffWithinAt I I ⊤ f (f ≫ₕ c').source ((extChartAt I x).symm y) :=
         by
         refine' (h₁ ((extChartAt I x).symm y) _).mono _
         · simp only [hy, mfld_simps]
         · mfld_set_tac
       have hy' : (extChartAt I x).symm y ∈ c.source := by simp only [hy, mfld_simps]
       have hy'' : f ((extChartAt I x).symm y) ∈ c'.source := by simp only [hy, mfld_simps]
-      rw [contMdiffWithinAt_iff_of_mem_source hy' hy''] at H 
+      rw [contMDiffWithinAt_iff_of_mem_source hy' hy''] at H 
       · convert H.2.mono _
         · simp only [hy, mfld_simps]
         · mfld_set_tac
@@ -2132,14 +2653,14 @@ theorem is_local_structomorph_on_contDiffGroupoid_iff (f : LocalHomeomorph M M')
     · -- smoothness of the candidate local structomorphism in the reverse direction
       intro y hy
       simp only [mfld_simps] at hy 
-      have H : ContMdiffWithinAt I I ⊤ f.symm (f.symm ≫ₕ c).source ((extChartAt I (f x)).symm y) :=
+      have H : ContMDiffWithinAt I I ⊤ f.symm (f.symm ≫ₕ c).source ((extChartAt I (f x)).symm y) :=
         by
         refine' (h₂ ((extChartAt I (f x)).symm y) _).mono _
         · simp only [hy, mfld_simps]
         · mfld_set_tac
       have hy' : (extChartAt I (f x)).symm y ∈ c'.source := by simp only [hy, mfld_simps]
       have hy'' : f.symm ((extChartAt I (f x)).symm y) ∈ c.source := by simp only [hy, mfld_simps]
-      rw [contMdiffWithinAt_iff_of_mem_source hy' hy''] at H 
+      rw [contMDiffWithinAt_iff_of_mem_source hy' hy''] at H 
       · convert H.2.mono _
         · simp only [hy, mfld_simps]
         · mfld_set_tac
@@ -2148,7 +2669,8 @@ theorem is_local_structomorph_on_contDiffGroupoid_iff (f : LocalHomeomorph M M')
     -- now check the candidate local structomorphism agrees with `f` where it is supposed to
     · simp only [mfld_simps]
     · simp only [hx', mfld_simps]
-#align is_local_structomorph_on_cont_diff_groupoid_iff is_local_structomorph_on_contDiffGroupoid_iff
+#align is_local_structomorph_on_cont_diff_groupoid_iff isLocalStructomorphOn_contDiffGroupoid_iff
+-/
 
 end
 
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.cont_mdiff
-! leanprover-community/mathlib commit e354e865255654389cc46e6032160238df2e0f40
+! leanprover-community/mathlib commit e5ab837fc252451f3eb9124ae6e7b6f57455e7b9
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -1366,6 +1366,32 @@ theorem contMdiff_of_support {f : M → F} (hf : ∀ x ∈ tsupport f, ContMdiff
     exact contMdiffAt_const
 #align cont_mdiff_of_support contMdiff_of_support
 
+/-! ### The inclusion map from one open set to another is smooth -/
+
+
+section
+
+open TopologicalSpace
+
+theorem contMdiff_inclusion {n : ℕ∞} {U V : Opens M} (h : U ≤ V) :
+    ContMdiff I I n (Set.inclusion h : U → V) :=
+  by
+  rintro ⟨x, hx : x ∈ U⟩
+  apply (cont_diff_within_at_localInvariantProp I I n).liftProp_inclusion
+  intro y
+  dsimp [ContDiffWithinAtProp]
+  rw [Set.univ_inter]
+  refine' cont_diff_within_at_id.congr _ _
+  · exact I.right_inv_on
+  · exact congr_arg I (I.left_inv y)
+#align cont_mdiff_inclusion contMdiff_inclusion
+
+theorem smooth_inclusion {U V : Opens M} (h : U ≤ V) : Smooth I I (Set.inclusion h : U → V) :=
+  contMdiff_inclusion h
+#align smooth_inclusion smooth_inclusion
+
+end
+
 /-! ### Equivalence with the basic definition for functions between vector spaces -/
 
 
Diff
@@ -359,7 +359,7 @@ theorem contMdiffWithinAt_iff_target :
     exact
       inter_mem self_mem_nhdsWithin
         (h.preimage_mem_nhds_within <| (chart_at _ _).open_source.mem_nhds <| mem_chart_source _ _)
-  simp_rw [cont, ContDiffWithinAtProp, extChartAt, LocalHomeomorph.extend, LocalEquiv.coe_trans,
+  simp_rw [Cont, ContDiffWithinAtProp, extChartAt, LocalHomeomorph.extend, LocalEquiv.coe_trans,
     ModelWithCorners.toLocalEquiv_coe, LocalHomeomorph.coe_coe, modelWithCornersSelf_coe,
     chartAt_self_eq, LocalHomeomorph.refl_apply, comp.left_id]
 #align cont_mdiff_within_at_iff_target contMdiffWithinAt_iff_target
Diff
@@ -389,8 +389,6 @@ theorem smoothAt_iff_target {x : M} :
   contMdiffAt_iff_target
 #align smooth_at_iff_target smoothAt_iff_target
 
-include Is I's
-
 theorem contMdiffWithinAt_iff_of_mem_maximalAtlas {x : M} (he : e ∈ maximalAtlas I M)
     (he' : e' ∈ maximalAtlas I' M') (hx : x ∈ e.source) (hy : f x ∈ e'.source) :
     ContMdiffWithinAt I I' n f s x ↔
@@ -455,8 +453,6 @@ theorem contMdiffAt_iff_of_mem_source {x' : M} {y : M'} (hx : x' ∈ (chartAt H
     rw [continuousWithinAt_univ, preimage_univ, univ_inter]
 #align cont_mdiff_at_iff_of_mem_source contMdiffAt_iff_of_mem_source
 
-omit Is
-
 theorem contMdiffWithinAt_iff_target_of_mem_source {x : M} {y : M'}
     (hy : f x ∈ (chartAt H' y).source) :
     ContMdiffWithinAt I I' n f s x ↔
@@ -482,10 +478,6 @@ theorem contMdiffAt_iff_target_of_mem_source {x : M} {y : M'} (hy : f x ∈ (cha
   infer_instance
 #align cont_mdiff_at_iff_target_of_mem_source contMdiffAt_iff_target_of_mem_source
 
-omit I's
-
-include Is
-
 theorem contMdiffWithinAt_iff_source_of_mem_maximalAtlas (he : e ∈ maximalAtlas I M)
     (hx : x ∈ e.source) :
     ContMdiffWithinAt I I' n f s x ↔
@@ -515,8 +507,6 @@ theorem contMdiffAt_iff_source_of_mem_source {x' : M} (hx' : x' ∈ (chartAt H x
   simp_rw [ContMdiffAt, contMdiffWithinAt_iff_source_of_mem_source hx', preimage_univ, univ_inter]
 #align cont_mdiff_at_iff_source_of_mem_source contMdiffAt_iff_source_of_mem_source
 
-include I's
-
 theorem contMdiffOn_iff_of_mem_maximalAtlas (he : e ∈ maximalAtlas I M)
     (he' : e' ∈ maximalAtlas I' M') (hs : s ⊆ e.source) (h2s : MapsTo f s e'.source) :
     ContMdiffOn I I' n f s ↔
@@ -647,8 +637,6 @@ theorem smooth_iff_target :
   contMdiff_iff_target
 #align smooth_iff_target smooth_iff_target
 
-omit Is I's
-
 /-! ### Deducing smoothness from higher smoothness -/
 
 
@@ -809,8 +797,6 @@ theorem SmoothOn.smoothAt (h : SmoothOn I I' f s) (hx : s ∈ 𝓝 x) : SmoothAt
   h.ContMdiffAt hx
 #align smooth_on.smooth_at SmoothOn.smoothAt
 
-include Is
-
 theorem contMdiffOn_iff_source_of_mem_maximalAtlas (he : e ∈ maximalAtlas I M) (hs : s ⊆ e.source) :
     ContMdiffOn I I' n f s ↔ ContMdiffOn 𝓘(𝕜, E) I' n (f ∘ (e.extend I).symm) (e.extend I '' s) :=
   by
@@ -822,8 +808,6 @@ theorem contMdiffOn_iff_source_of_mem_maximalAtlas (he : e ∈ maximalAtlas I M)
     e.extend_symm_preimage_inter_range_eventually_eq I hs (hs hx)]
 #align cont_mdiff_on_iff_source_of_mem_maximal_atlas contMdiffOn_iff_source_of_mem_maximalAtlas
 
-include I's
-
 /-- A function is `C^n` within a set at a point, for `n : ℕ`, if and only if it is `C^n` on
 a neighborhood of this point. -/
 theorem contMdiffWithinAt_iff_contMdiffOn_nhds {n : ℕ} :
@@ -920,8 +904,6 @@ theorem contMdiffAt_iff_contMdiffAt_nhds {n : ℕ} :
   exact (h x' <| mem_of_mem_nhds hx').ContMdiffAt hx'
 #align cont_mdiff_at_iff_cont_mdiff_at_nhds contMdiffAt_iff_contMdiffAt_nhds
 
-omit Is I's
-
 /-! ### Congruence lemmas -/
 
 
@@ -1165,8 +1147,6 @@ theorem contMdiffOn_model_symm : ContMdiffOn 𝓘(𝕜, E) I n I.symm (range I)
   exact cont_diff_on_id.congr fun x' => I.right_inv
 #align cont_mdiff_on_model_symm contMdiffOn_model_symm
 
-include Is
-
 /-- An atlas member is `C^n` for any `n`. -/
 theorem contMdiffOn_of_mem_maximalAtlas (h : e ∈ maximalAtlas I M) : ContMdiffOn I I n e e.source :=
   ContMdiffOn.of_le
@@ -1236,8 +1216,6 @@ theorem contMdiffOn_extChartAt_symm (x : M) :
   rw [extChartAt_target, I.image_eq]
 #align cont_mdiff_on_ext_chart_at_symm contMdiffOn_extChartAt_symm
 
-omit Is
-
 /-- An element of `cont_diff_groupoid ⊤ I` is `C^n` for any `n`. -/
 theorem contMdiffOn_of_mem_contDiffGroupoid {e' : LocalHomeomorph H H}
     (h : e' ∈ contDiffGroupoid ⊤ I) : ContMdiffOn I I n e' e'.source :=
@@ -1995,8 +1973,6 @@ section
 
 variable [ChartedSpace H M'] [IsM' : SmoothManifoldWithCorners I M']
 
-include Is IsM'
-
 theorem is_local_structomorph_on_contDiffGroupoid_iff_aux {f : LocalHomeomorph M M'}
     (hf : LiftPropOn (contDiffGroupoid ⊤ I).IsLocalStructomorphWithinAt f f.source) :
     SmoothOn I I f f.source :=
Diff
@@ -2038,7 +2038,6 @@ theorem is_local_structomorph_on_contDiffGroupoid_iff_aux {f : LocalHomeomorph M
       f y = c'.symm (c' (f y)) := by rw [c'.left_inv hy₁]
       _ = c'.symm (c' (f (c.symm (c y)))) := by rw [c.left_inv hy₂]
       _ = c'.symm (e (c y)) := by rw [← he' hy₃]
-      
   refine' (H₁.congr H₂).mono _
   mfld_set_tac
 #align is_local_structomorph_on_cont_diff_groupoid_iff_aux is_local_structomorph_on_contDiffGroupoid_iff_aux
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.cont_mdiff
-! leanprover-community/mathlib commit 0187644979f2d3e10a06e916a869c994facd9a87
+! leanprover-community/mathlib commit e354e865255654389cc46e6032160238df2e0f40
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -1021,6 +1021,13 @@ theorem ContMdiffWithinAt.comp {t : Set M'} {g : M' → M''} (x : M)
   · simp only [writtenInExtChartAt, (· ∘ ·), mem_extChartAt_source, e.left_inv, e'.left_inv]
 #align cont_mdiff_within_at.comp ContMdiffWithinAt.comp
 
+/-- See note [comp_of_eq lemmas] -/
+theorem ContMdiffWithinAt.comp_of_eq {t : Set M'} {g : M' → M''} {x : M} {y : M'}
+    (hg : ContMdiffWithinAt I' I'' n g t y) (hf : ContMdiffWithinAt I I' n f s x)
+    (st : MapsTo f s t) (hx : f x = y) : ContMdiffWithinAt I I'' n (g ∘ f) s x := by subst hx;
+  exact hg.comp x hf st
+#align cont_mdiff_within_at.comp_of_eq ContMdiffWithinAt.comp_of_eq
+
 /-- The composition of `C^∞` functions within domains at points is `C^∞`. -/
 theorem SmoothWithinAt.comp {t : Set M'} {g : M' → M''} (x : M)
     (hg : SmoothWithinAt I' I'' g t (f x)) (hf : SmoothWithinAt I I' f s x) (st : MapsTo f s t) :
@@ -1101,6 +1108,12 @@ theorem ContMdiffAt.comp {g : M' → M''} (x : M) (hg : ContMdiffAt I' I'' n g (
   hg.comp x hf (mapsTo_univ _ _)
 #align cont_mdiff_at.comp ContMdiffAt.comp
 
+/-- See note [comp_of_eq lemmas] -/
+theorem ContMdiffAt.comp_of_eq {g : M' → M''} {x : M} {y : M'} (hg : ContMdiffAt I' I'' n g y)
+    (hf : ContMdiffAt I I' n f x) (hx : f x = y) : ContMdiffAt I I'' n (g ∘ f) x := by subst hx;
+  exact hg.comp x hf
+#align cont_mdiff_at.comp_of_eq ContMdiffAt.comp_of_eq
+
 /-- The composition of `C^∞` functions at points is `C^∞`. -/
 theorem SmoothAt.comp {g : M' → M''} (x : M) (hg : SmoothAt I' I'' g (f x))
     (hf : SmoothAt I I' f x) : SmoothAt I I'' (g ∘ f) x :=
@@ -1144,6 +1157,14 @@ theorem contMdiff_model : ContMdiff I 𝓘(𝕜, E) n I :=
   simp_rw [Function.comp_apply, I.left_inv, id_def]
 #align cont_mdiff_model contMdiff_model
 
+theorem contMdiffOn_model_symm : ContMdiffOn 𝓘(𝕜, E) I n I.symm (range I) :=
+  by
+  rw [contMdiffOn_iff]
+  refine' ⟨I.continuous_on_symm, fun x y => _⟩
+  simp only [mfld_simps]
+  exact cont_diff_on_id.congr fun x' => I.right_inv
+#align cont_mdiff_on_model_symm contMdiffOn_model_symm
+
 include Is
 
 /-- An atlas member is `C^n` for any `n`. -/
@@ -1199,6 +1220,22 @@ theorem contMdiffOn_extChartAt : ContMdiffOn I 𝓘(𝕜, E) n (extChartAt I x)
   fun x' hx' => (contMdiffAt_ext_chart_at' hx').ContMdiffWithinAt
 #align cont_mdiff_on_ext_chart_at contMdiffOn_extChartAt
 
+theorem contMdiffOn_extend_symm (he : e ∈ maximalAtlas I M) :
+    ContMdiffOn 𝓘(𝕜, E) I n (e.extend I).symm (I '' e.target) :=
+  by
+  have h2 := contMdiffOn_symm_of_mem_maximalAtlas he
+  refine' h2.comp (cont_mdiff_on_model_symm.mono <| image_subset_range _ _) _
+  simp_rw [image_subset_iff, LocalEquiv.restr_coe_symm, I.to_local_equiv_coe_symm,
+    preimage_preimage, I.left_inv, preimage_id']
+#align cont_mdiff_on_extend_symm contMdiffOn_extend_symm
+
+theorem contMdiffOn_extChartAt_symm (x : M) :
+    ContMdiffOn 𝓘(𝕜, E) I n (extChartAt I x).symm (extChartAt I x).target :=
+  by
+  convert contMdiffOn_extend_symm (chart_mem_maximal_atlas I x)
+  rw [extChartAt_target, I.image_eq]
+#align cont_mdiff_on_ext_chart_at_symm contMdiffOn_extChartAt_symm
+
 omit Is
 
 /-- An element of `cont_diff_groupoid ⊤ I` is `C^n` for any `n`. -/
@@ -1642,19 +1679,6 @@ theorem Smooth.snd {f : N → M × M'} (hf : Smooth J (I.Prod I') f) : Smooth J
   smooth_snd.comp hf
 #align smooth.snd Smooth.snd
 
-theorem smooth_iff_proj_smooth {f : M → M' × N'} :
-    Smooth I (I'.Prod J') f ↔ Smooth I I' (Prod.fst ∘ f) ∧ Smooth I J' (Prod.snd ∘ f) :=
-  by
-  constructor
-  · intro h; exact ⟨smooth_fst.comp h, smooth_snd.comp h⟩
-  · rintro ⟨h_fst, h_snd⟩; simpa only [Prod.mk.eta] using h_fst.prod_mk h_snd
-#align smooth_iff_proj_smooth smooth_iff_proj_smooth
-
-theorem smooth_prod_assoc :
-    Smooth ((I.Prod I').Prod J) (I.Prod (I'.Prod J)) fun x : (M × M') × N => (x.1.1, x.1.2, x.2) :=
-  smooth_fst.fst.prod_mk <| smooth_fst.snd.prod_mk smooth_snd
-#align smooth_prod_assoc smooth_prod_assoc
-
 end Projections
 
 theorem contMdiffWithinAt_prod_iff (f : M → M' × N') {s : Set M} {x : M} :
@@ -1666,9 +1690,30 @@ theorem contMdiffWithinAt_prod_iff (f : M → M' × N') {s : Set M} {x : M} :
 theorem contMdiffAt_prod_iff (f : M → M' × N') {x : M} :
     ContMdiffAt I (I'.Prod J') n f x ↔
       ContMdiffAt I I' n (Prod.fst ∘ f) x ∧ ContMdiffAt I J' n (Prod.snd ∘ f) x :=
-  by simp_rw [← contMdiffWithinAt_univ]; exact contMdiffWithinAt_prod_iff f
+  by simp_rw [← contMdiffWithinAt_univ, contMdiffWithinAt_prod_iff]
 #align cont_mdiff_at_prod_iff contMdiffAt_prod_iff
 
+theorem contMdiff_prod_iff (f : M → M' × N') :
+    ContMdiff I (I'.Prod J') n f ↔
+      ContMdiff I I' n (Prod.fst ∘ f) ∧ ContMdiff I J' n (Prod.snd ∘ f) :=
+  ⟨fun h => ⟨h.fst, h.snd⟩, fun h => by convert h.1.prod_mk h.2; ext <;> rfl⟩
+#align cont_mdiff_prod_iff contMdiff_prod_iff
+
+theorem smoothAt_prod_iff (f : M → M' × N') {x : M} :
+    SmoothAt I (I'.Prod J') f x ↔ SmoothAt I I' (Prod.fst ∘ f) x ∧ SmoothAt I J' (Prod.snd ∘ f) x :=
+  contMdiffAt_prod_iff f
+#align smooth_at_prod_iff smoothAt_prod_iff
+
+theorem smooth_prod_iff (f : M → M' × N') :
+    Smooth I (I'.Prod J') f ↔ Smooth I I' (Prod.fst ∘ f) ∧ Smooth I J' (Prod.snd ∘ f) :=
+  contMdiff_prod_iff f
+#align smooth_prod_iff smooth_prod_iff
+
+theorem smooth_prod_assoc :
+    Smooth ((I.Prod I').Prod J) (I.Prod (I'.Prod J)) fun x : (M × M') × N => (x.1.1, x.1.2, x.2) :=
+  smooth_fst.fst.prod_mk <| smooth_fst.snd.prod_mk smooth_snd
+#align smooth_prod_assoc smooth_prod_assoc
+
 section Prod_map
 
 variable {g : N → N'} {r : Set N} {y : N}
Diff
@@ -441,7 +441,7 @@ theorem contMdiffWithinAt_iff_of_mem_source' {x' : M} {y : M'} (hx : x' ∈ (cha
   set e := extChartAt I x; set e' := extChartAt I' (f x)
   refine' fun hc => contDiffWithinAt_congr_nhds _
   rw [← e.image_source_inter_eq', ← map_extChartAt_nhdsWithin_eq_image' I x hx, ←
-    map_extChartAt_nhds_within' I x hx, inter_comm, nhdsWithin_inter_of_mem]
+    map_extChartAt_nhdsWithin' I x hx, inter_comm, nhdsWithin_inter_of_mem]
   exact hc (extChartAt_source_mem_nhds' _ _ hy)
 #align cont_mdiff_within_at_iff_of_mem_source' contMdiffWithinAt_iff_of_mem_source'
 
@@ -470,7 +470,7 @@ theorem contMdiffWithinAt_iff_target_of_mem_source {x : M} {y : M'}
   simp_rw [StructureGroupoid.liftPropWithinAt_self_target]
   simp_rw [((chart_at H' y).ContinuousAt hy).comp_continuousWithinAt hf]
   rw [← extChartAt_source I'] at hy 
-  simp_rw [(continuousAt_ext_chart_at' I' _ hy).comp_continuousWithinAt hf]
+  simp_rw [(continuousAt_extChartAt' I' _ hy).comp_continuousWithinAt hf]
   rfl
 #align cont_mdiff_within_at_iff_target_of_mem_source contMdiffWithinAt_iff_target_of_mem_source
 
@@ -1018,7 +1018,7 @@ theorem ContMdiffWithinAt.comp {t : Set M'} {g : M' → M''} (x : M)
   · filter_upwards [A]
     rintro x' ⟨hx', ht, hfx', hgfx'⟩
     simp only [*, (· ∘ ·), writtenInExtChartAt, e'.left_inv]
-  · simp only [writtenInExtChartAt, (· ∘ ·), mem_ext_chart_source, e.left_inv, e'.left_inv]
+  · simp only [writtenInExtChartAt, (· ∘ ·), mem_extChartAt_source, e.left_inv, e'.left_inv]
 #align cont_mdiff_within_at.comp ContMdiffWithinAt.comp
 
 /-- The composition of `C^∞` functions within domains at points is `C^∞`. -/
@@ -1401,7 +1401,7 @@ theorem ContDiffWithinAt.comp_contMdiffWithinAt {g : F → F'} {f : M → F} {s
   by
   rw [contMdiffWithinAt_iff] at *
   refine' ⟨hg.continuous_within_at.comp hf.1 h, _⟩
-  rw [← (extChartAt I x).left_inv (mem_ext_chart_source I x)] at hg 
+  rw [← (extChartAt I x).left_inv (mem_extChartAt_source I x)] at hg 
   apply ContDiffWithinAt.comp _ hg hf.2 _
   exact (inter_subset_left _ _).trans (preimage_mono h)
 #align cont_diff_within_at.comp_cont_mdiff_within_at ContDiffWithinAt.comp_contMdiffWithinAt
Diff
@@ -136,7 +136,7 @@ theorem cont_diff_within_at_localInvariantProp (n : ℕ∞) :
       rw [this] at h 
       have : I (e x) ∈ I.symm ⁻¹' e.target ∩ range I := by simp only [hx, mfld_simps]
       have := ((mem_groupoid_of_pregroupoid.2 he).2.ContDiffWithinAt this).of_le le_top
-      convert(h.comp' _ this).mono_of_mem _ using 1
+      convert (h.comp' _ this).mono_of_mem _ using 1
       · ext y; simp only [mfld_simps]
       refine'
         mem_nhds_within.mpr
@@ -559,7 +559,7 @@ theorem contMdiffOn_iff :
     specialize h w this
     have w1 : w ∈ (chart_at H x).source := by simp only [w, hz, mfld_simps]
     have w2 : f w ∈ (chart_at H' y).source := by simp only [w, hz, mfld_simps]
-    convert((contMdiffWithinAt_iff_of_mem_source w1 w2).mp h).2.mono _
+    convert ((contMdiffWithinAt_iff_of_mem_source w1 w2).mp h).2.mono _
     · simp only [w, hz, mfld_simps]
     · mfld_set_tac
   · rintro ⟨hcont, hdiff⟩ x hx
@@ -586,7 +586,7 @@ theorem contMdiffOn_iff_target :
   constructor
   · refine' fun h' y => ⟨_, fun x _ => h' x y⟩
     have h'' : ContinuousOn _ univ := (ModelWithCorners.continuous I').ContinuousOn
-    convert(h''.comp' (chart_at H' y).continuous_toFun).comp' h
+    convert (h''.comp' (chart_at H' y).continuous_toFun).comp' h
     simp
   · exact fun h' x y => (h' y).2 x default
 #align cont_mdiff_on_iff_target contMdiffOn_iff_target
@@ -863,7 +863,7 @@ theorem contMdiffWithinAt_iff_contMdiffOn_nhds {n : ℕ} :
     · rw [nhdsWithin_restrict _ xo o_open]
       refine' Filter.inter_mem self_mem_nhdsWithin _
       suffices : u ∈ 𝓝[extChartAt I x '' (insert x s ∩ o)] extChartAt I x x
-      exact (continuousAt_extChartAt I x).ContinuousWithinAt.preimage_mem_nhds_within' this
+      exact (continuousAt_extChartAt I x).ContinuousWithinAt.preimage_mem_nhdsWithin' this
       apply nhdsWithin_mono _ _ u_nhds
       rw [image_subset_iff]
       intro y hy
@@ -1364,8 +1364,8 @@ theorem contMdiffWithinAt_iff_contDiffWithinAt {f : E → E'} {s : Set E} {x : E
   exact ContDiffWithinAt.continuousWithinAt
 #align cont_mdiff_within_at_iff_cont_diff_within_at contMdiffWithinAt_iff_contDiffWithinAt
 
-alias contMdiffWithinAt_iff_contDiffWithinAt ↔
-  ContMdiffWithinAt.contDiffWithinAt ContDiffWithinAt.contMdiffWithinAt
+alias contMdiffWithinAt_iff_contDiffWithinAt ↔ ContMdiffWithinAt.contDiffWithinAt
+  ContDiffWithinAt.contMdiffWithinAt
 #align cont_mdiff_within_at.cont_diff_within_at ContMdiffWithinAt.contDiffWithinAt
 #align cont_diff_within_at.cont_mdiff_within_at ContDiffWithinAt.contMdiffWithinAt
 
Diff
@@ -131,9 +131,9 @@ theorem cont_diff_within_at_localInvariantProp (n : ℕ∞) :
       apply ContinuousAt.preimage_mem_nhds I.continuous_symm.continuous_at this
     right_invariance' := by
       intro s x f e he hx h
-      rw [ContDiffWithinAtProp] at h⊢
+      rw [ContDiffWithinAtProp] 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 ∩ range I := by simp only [hx, mfld_simps]
       have := ((mem_groupoid_of_pregroupoid.2 he).2.ContDiffWithinAt this).of_le le_top
       convert(h.comp' _ this).mono_of_mem _ using 1
@@ -147,18 +147,18 @@ theorem cont_diff_within_at_localInvariantProp (n : ℕ∞) :
       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 [ContDiffWithinAtProp] at h⊢
+      rw [ContDiffWithinAtProp] at h ⊢
       have A : (I' ∘ f ∘ I.symm) (I x) ∈ I'.symm ⁻¹' e'.source ∩ range I' := by
         simp only [hx, mfld_simps]
       have := ((mem_groupoid_of_pregroupoid.2 he').1.ContDiffWithinAt A).of_le le_top
       convert this.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 cont_diff_within_at_local_invariant_prop cont_diff_within_at_localInvariantProp
 
 theorem contDiffWithinAtProp_mono_of_mem (n : ℕ∞) ⦃s x t⦄ ⦃f : H → H'⦄ (hts : s ∈ 𝓝[t] x)
@@ -435,8 +435,8 @@ theorem contMdiffWithinAt_iff_of_mem_source' {x' : M} {y : M'} (hx : x' ∈ (cha
           (extChartAt I x x') :=
   by
   refine' (contMdiffWithinAt_iff_of_mem_source hx hy).trans _
-  rw [← extChartAt_source I] at hx
-  rw [← extChartAt_source I'] at hy
+  rw [← extChartAt_source I] at hx 
+  rw [← extChartAt_source I'] at hy 
   rw [and_congr_right_iff]
   set e := extChartAt I x; set e' := extChartAt I' (f x)
   refine' fun hc => contDiffWithinAt_congr_nhds _
@@ -469,7 +469,7 @@ theorem contMdiffWithinAt_iff_target_of_mem_source {x : M} {y : M'}
   intro hf
   simp_rw [StructureGroupoid.liftPropWithinAt_self_target]
   simp_rw [((chart_at H' y).ContinuousAt hy).comp_continuousWithinAt hf]
-  rw [← extChartAt_source I'] at hy
+  rw [← extChartAt_source I'] at hy 
   simp_rw [(continuousAt_ext_chart_at' I' _ hy).comp_continuousWithinAt hf]
   rfl
 #align cont_mdiff_within_at_iff_target_of_mem_source contMdiffWithinAt_iff_target_of_mem_source
@@ -492,7 +492,7 @@ theorem contMdiffWithinAt_iff_source_of_mem_maximalAtlas (he : e ∈ maximalAtla
       ContMdiffWithinAt 𝓘(𝕜, E) I' n (f ∘ (e.extend I).symm) ((e.extend I).symm ⁻¹' s ∩ range I)
         (e.extend I x) :=
   by
-  have h2x := hx; rw [← e.extend_source I] at h2x
+  have h2x := hx; rw [← e.extend_source I] at h2x 
   simp_rw [ContMdiffWithinAt,
     (cont_diff_within_at_localInvariantProp I I' n).liftPropWithinAt_indep_chart_source he hx,
     StructureGroupoid.liftPropWithinAt_self_source,
@@ -553,7 +553,7 @@ theorem contMdiffOn_iff :
   constructor
   · intro h
     refine' ⟨fun x hx => (h x hx).1, fun x y z hz => _⟩
-    simp only [mfld_simps] at hz
+    simp only [mfld_simps] at hz 
     let w := (extChartAt I x).symm z
     have : w ∈ s := by simp only [w, hz, mfld_simps]
     specialize h w this
@@ -845,7 +845,7 @@ theorem contMdiffWithinAt_iff_contMdiffOn_nhds {n : ℕ} :
       · intro y hy; exact hy.2
       · intro y hy; exact hu ⟨hy.1.1, hy.2⟩
     have h' : ContMdiffWithinAt I I' n f (s ∩ o) x := h.mono (inter_subset_left _ _)
-    simp only [ContMdiffWithinAt, lift_prop_within_at, ContDiffWithinAtProp] at h'
+    simp only [ContMdiffWithinAt, lift_prop_within_at, ContDiffWithinAtProp] at h' 
     -- let `u` be a good neighborhood in the chart where the function is smooth
     rcases h.2.ContDiffOn le_rfl with ⟨u, u_nhds, u_subset, hu⟩
     -- pull it back to the manifold, and intersect with a suitable neighborhood of `x`, to get the
@@ -888,7 +888,7 @@ theorem contMdiffWithinAt_iff_contMdiffOn_nhds {n : ℕ} :
       refine' (contMdiffWithinAt_iff_of_mem_source' (v_incl hy) (v_incl' y hy)).mpr ⟨this, _⟩
       · apply hu.mono
         · intro z hz
-          simp only [v, mfld_simps] at hz
+          simp only [v, mfld_simps] at hz 
           have : I ((chart_at H x) ((chart_at H x).symm (I.symm z))) ∈ u := by simp only [hz]
           simpa only [hz, mfld_simps] using this
         · have exty : I (chart_at H x y) ∈ u := hy.2
@@ -897,7 +897,7 @@ theorem contMdiffWithinAt_iff_contMdiffOn_nhds {n : ℕ} :
     have : ContMdiffWithinAt I I' (↑n) f (insert x s ∩ u) x :=
       haveI : x ∈ insert x s := mem_insert x s
       hu.mono (inter_subset_right _ _) _ ⟨this, mem_of_mem_nhdsWithin this u_nhds⟩
-    rw [contMdiffWithinAt_inter' u_nhds] at this
+    rw [contMdiffWithinAt_inter' u_nhds] at this 
     exact this.mono (subset_insert x s)
 #align cont_mdiff_within_at_iff_cont_mdiff_on_nhds contMdiffWithinAt_iff_contMdiffOn_nhds
 
@@ -989,13 +989,13 @@ theorem ContMdiffWithinAt.comp {t : Set M'} {g : M' → M''} (x : M)
     (hg : ContMdiffWithinAt I' I'' n g t (f x)) (hf : ContMdiffWithinAt I I' n f s x)
     (st : MapsTo f s t) : ContMdiffWithinAt I I'' n (g ∘ f) s x :=
   by
-  rw [contMdiffWithinAt_iff] at hg hf⊢
+  rw [contMdiffWithinAt_iff] at hg hf ⊢
   refine' ⟨hg.1.comp hf.1 st, _⟩
   set e := extChartAt I x
   set e' := extChartAt I' (f x)
   set e'' := extChartAt I'' (g (f x))
   have : e' (f x) = (writtenInExtChartAt I I' x f) (e x) := by simp only [e, e', mfld_simps]
-  rw [this] at hg
+  rw [this] at hg 
   have A :
     ∀ᶠ y in 𝓝[e.symm ⁻¹' s ∩ range I] e x,
       y ∈ e.target ∧ f (e.symm y) ∈ t ∧ f (e.symm y) ∈ e'.source ∧ g (f (e.symm y)) ∈ e''.source :=
@@ -1054,8 +1054,9 @@ theorem SmoothOn.comp' {t : Set M'} {g : M' → M''} (hg : SmoothOn I' I'' g t)
 
 /-- The composition of `C^n` functions is `C^n`. -/
 theorem ContMdiff.comp {g : M' → M''} (hg : ContMdiff I' I'' n g) (hf : ContMdiff I I' n f) :
-    ContMdiff I I'' n (g ∘ f) := by
-  rw [← contMdiffOn_univ] at hf hg⊢
+    ContMdiff I I'' n (g ∘ f) :=
+  by
+  rw [← contMdiffOn_univ] at hf hg ⊢
   exact hg.comp hf subset_preimage_univ
 #align cont_mdiff.comp ContMdiff.comp
 
@@ -1400,7 +1401,7 @@ theorem ContDiffWithinAt.comp_contMdiffWithinAt {g : F → F'} {f : M → F} {s
   by
   rw [contMdiffWithinAt_iff] at *
   refine' ⟨hg.continuous_within_at.comp hf.1 h, _⟩
-  rw [← (extChartAt I x).left_inv (mem_ext_chart_source I x)] at hg
+  rw [← (extChartAt I x).left_inv (mem_ext_chart_source I x)] at hg 
   apply ContDiffWithinAt.comp _ hg hf.2 _
   exact (inter_subset_left _ _).trans (preimage_mono h)
 #align cont_diff_within_at.comp_cont_mdiff_within_at ContDiffWithinAt.comp_contMdiffWithinAt
@@ -1519,7 +1520,7 @@ theorem contMdiffWithinAt_fst {s : Set (M × N)} {p : M × N} :
   rw [contMdiffWithinAt_iff']
   refine' ⟨continuousWithinAt_fst, _⟩
   refine' cont_diff_within_at_fst.congr (fun y hy => _) _
-  · simp only [mfld_simps] at hy
+  · simp only [mfld_simps] at hy 
     simp only [hy, mfld_simps]
   · simp only [mfld_simps]
 #align cont_mdiff_within_at_fst contMdiffWithinAt_fst
@@ -1583,7 +1584,7 @@ theorem contMdiffWithinAt_snd {s : Set (M × N)} {p : M × N} :
   rw [contMdiffWithinAt_iff']
   refine' ⟨continuousWithinAt_snd, _⟩
   refine' cont_diff_within_at_snd.congr (fun y hy => _) _
-  · simp only [mfld_simps] at hy
+  · simp only [mfld_simps] at hy 
     simp only [hy, mfld_simps]
   · simp only [mfld_simps]
 #align cont_mdiff_within_at_snd contMdiffWithinAt_snd
@@ -1984,7 +1985,7 @@ theorem is_local_structomorph_on_contDiffGroupoid_iff_aux {f : LocalHomeomorph M
     mfld_set_tac
   have H₂ : eq_on f (c'.symm ∘ e ∘ c) s := by
     intro y hy
-    simp only [mfld_simps] at hy
+    simp only [mfld_simps] at hy 
     have hy₁ : f y ∈ c'.source := by simp only [hy, mfld_simps]
     have hy₂ : y ∈ c.source := by simp only [hy, mfld_simps]
     have hy₃ : c y ∈ c.symm ⁻¹' f.source ∩ e.source := by simp only [hy, mfld_simps]
@@ -2027,7 +2028,7 @@ theorem is_local_structomorph_on_contDiffGroupoid_iff (f : LocalHomeomorph M M')
       have h2 : ⇑c' ∘ ⇑f ∘ ⇑c.symm = ⇑(c.symm ≫ₕ f ≫ₕ c') := rfl
       have hcx : c x ∈ c.symm ⁻¹' f.source := by simp only [hx, mfld_simps]
       rw [h2]
-      rw [← h1, h2, LocalHomeomorph.isLocalStructomorphWithinAt_iff'] at hxf
+      rw [← h1, h2, LocalHomeomorph.isLocalStructomorphWithinAt_iff'] at hxf 
       · exact hxf hcx
       · mfld_set_tac
       · apply Or.inl
@@ -2049,7 +2050,7 @@ theorem is_local_structomorph_on_contDiffGroupoid_iff (f : LocalHomeomorph M M')
         by
         intro x hx; rw [← e.right_inv hx, ← hef (e.symm.maps_to hx)]
         exact LocalHomeomorph.mapsTo _ (h2e <| e.symm.maps_to hx)
-      rw [inter_self] at h1
+      rw [inter_self] at h1 
       rwa [inter_eq_right_iff_subset.mpr]
       refine' h2.trans _
       mfld_set_tac
@@ -2068,7 +2069,7 @@ theorem is_local_structomorph_on_contDiffGroupoid_iff (f : LocalHomeomorph M M')
     refine' ⟨(c.symm.trans f).trans c', ⟨_, _⟩, (_ : eq_on (c' ∘ f ∘ c.symm) _ _), _⟩
     · -- smoothness of the candidate local structomorphism in the forward direction
       intro y hy
-      simp only [mfld_simps] at hy
+      simp only [mfld_simps] at hy 
       have H : ContMdiffWithinAt I I ⊤ f (f ≫ₕ c').source ((extChartAt I x).symm y) :=
         by
         refine' (h₁ ((extChartAt I x).symm y) _).mono _
@@ -2076,7 +2077,7 @@ theorem is_local_structomorph_on_contDiffGroupoid_iff (f : LocalHomeomorph M M')
         · mfld_set_tac
       have hy' : (extChartAt I x).symm y ∈ c.source := by simp only [hy, mfld_simps]
       have hy'' : f ((extChartAt I x).symm y) ∈ c'.source := by simp only [hy, mfld_simps]
-      rw [contMdiffWithinAt_iff_of_mem_source hy' hy''] at H
+      rw [contMdiffWithinAt_iff_of_mem_source hy' hy''] at H 
       · convert H.2.mono _
         · simp only [hy, mfld_simps]
         · mfld_set_tac
@@ -2084,7 +2085,7 @@ theorem is_local_structomorph_on_contDiffGroupoid_iff (f : LocalHomeomorph M M')
       · infer_instance
     · -- smoothness of the candidate local structomorphism in the reverse direction
       intro y hy
-      simp only [mfld_simps] at hy
+      simp only [mfld_simps] at hy 
       have H : ContMdiffWithinAt I I ⊤ f.symm (f.symm ≫ₕ c).source ((extChartAt I (f x)).symm y) :=
         by
         refine' (h₂ ((extChartAt I (f x)).symm y) _).mono _
@@ -2092,7 +2093,7 @@ theorem is_local_structomorph_on_contDiffGroupoid_iff (f : LocalHomeomorph M M')
         · mfld_set_tac
       have hy' : (extChartAt I (f x)).symm y ∈ c'.source := by simp only [hy, mfld_simps]
       have hy'' : f.symm ((extChartAt I (f x)).symm y) ∈ c.source := by simp only [hy, mfld_simps]
-      rw [contMdiffWithinAt_iff_of_mem_source hy' hy''] at H
+      rw [contMdiffWithinAt_iff_of_mem_source hy' hy''] at H 
       · convert H.2.mono _
         · simp only [hy, mfld_simps]
         · mfld_set_tac
Diff
@@ -50,7 +50,7 @@ in terms of extended charts in `cont_mdiff_on_iff` and `cont_mdiff_iff`.
 
 open Set Function Filter ChartedSpace SmoothManifoldWithCorners
 
-open Topology Manifold
+open scoped Topology Manifold
 
 /-! ### Definition of smooth functions between manifolds -/
 
Diff
@@ -126,8 +126,7 @@ theorem cont_diff_within_at_localInvariantProp (n : ℕ∞) :
       rw [ContDiffWithinAtProp, ContDiffWithinAtProp, this]
       symm
       apply contDiffWithinAt_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
@@ -138,8 +137,7 @@ theorem cont_diff_within_at_localInvariantProp (n : ℕ∞) :
       have : I (e x) ∈ I.symm ⁻¹' e.target ∩ range I := by simp only [hx, mfld_simps]
       have := ((mem_groupoid_of_pregroupoid.2 he).2.ContDiffWithinAt this).of_le le_top
       convert(h.comp' _ this).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
@@ -159,11 +157,8 @@ theorem cont_diff_within_at_localInvariantProp (n : ℕ∞) :
         simp only [hx, mfld_simps]
       have := ((mem_groupoid_of_pregroupoid.2 he').1.ContDiffWithinAt A).of_le le_top
       convert this.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 cont_diff_within_at_local_invariant_prop cont_diff_within_at_localInvariantProp
 
 theorem contDiffWithinAtProp_mono_of_mem (n : ℕ∞) ⦃s x t⦄ ⦃f : H → H'⦄ (hts : s ∈ 𝓝[t] x)
@@ -209,10 +204,7 @@ theorem contMdiffAt_iff {n : ℕ∞} {f : M → M'} {x : M} :
       ContinuousAt f x ∧
         ContDiffWithinAt 𝕜 n (extChartAt I' (f x) ∘ f ∘ (extChartAt I x).symm) (range I)
           (extChartAt I x x) :=
-  liftPropAt_iff.trans <|
-    by
-    rw [ContDiffWithinAtProp, preimage_univ, univ_inter]
-    rfl
+  liftPropAt_iff.trans <| by rw [ContDiffWithinAtProp, preimage_univ, univ_inter]; rfl
 #align cont_mdiff_at_iff contMdiffAt_iff
 
 /-- Abbreviation for `cont_mdiff_at I I' ⊤ f x`. See also documentation for `smooth`. -/
@@ -850,10 +842,8 @@ theorem contMdiffWithinAt_iff_contMdiffOn_nhds {n : ℕ} :
       rcases mem_nhdsWithin.1 (h.1.preimage_mem_nhdsWithin this) with ⟨u, u_open, xu, hu⟩
       refine' ⟨u ∩ (chart_at H x).source, _, ⟨xu, mem_chart_source _ _⟩, _, _⟩
       · exact IsOpen.inter u_open (LocalHomeomorph.open_source _)
-      · intro y hy
-        exact hy.2
-      · intro y hy
-        exact hu ⟨hy.1.1, hy.2⟩
+      · intro y hy; exact hy.2
+      · intro y hy; exact hu ⟨hy.1.1, hy.2⟩
     have h' : ContMdiffWithinAt I I' n f (s ∩ o) x := h.mono (inter_subset_left _ _)
     simp only [ContMdiffWithinAt, lift_prop_within_at, ContDiffWithinAtProp] at h'
     -- let `u` be a good neighborhood in the chart where the function is smooth
@@ -1655,10 +1645,8 @@ theorem smooth_iff_proj_smooth {f : M → M' × N'} :
     Smooth I (I'.Prod J') f ↔ Smooth I I' (Prod.fst ∘ f) ∧ Smooth I J' (Prod.snd ∘ f) :=
   by
   constructor
-  · intro h
-    exact ⟨smooth_fst.comp h, smooth_snd.comp h⟩
-  · rintro ⟨h_fst, h_snd⟩
-    simpa only [Prod.mk.eta] using h_fst.prod_mk h_snd
+  · intro h; exact ⟨smooth_fst.comp h, smooth_snd.comp h⟩
+  · rintro ⟨h_fst, h_snd⟩; simpa only [Prod.mk.eta] using h_fst.prod_mk h_snd
 #align smooth_iff_proj_smooth smooth_iff_proj_smooth
 
 theorem smooth_prod_assoc :
@@ -1671,17 +1659,13 @@ end Projections
 theorem contMdiffWithinAt_prod_iff (f : M → M' × N') {s : Set M} {x : M} :
     ContMdiffWithinAt I (I'.Prod J') n f s x ↔
       ContMdiffWithinAt I I' n (Prod.fst ∘ f) s x ∧ ContMdiffWithinAt I J' n (Prod.snd ∘ f) s x :=
-  by
-  refine' ⟨fun h => ⟨h.fst, h.snd⟩, fun h => _⟩
-  simpa only [Prod.mk.eta] using h.1.prod_mk h.2
+  by refine' ⟨fun h => ⟨h.fst, h.snd⟩, fun h => _⟩; simpa only [Prod.mk.eta] using h.1.prod_mk h.2
 #align cont_mdiff_within_at_prod_iff contMdiffWithinAt_prod_iff
 
 theorem contMdiffAt_prod_iff (f : M → M' × N') {x : M} :
     ContMdiffAt I (I'.Prod J') n f x ↔
       ContMdiffAt I I' n (Prod.fst ∘ f) x ∧ ContMdiffAt I J' n (Prod.snd ∘ f) x :=
-  by
-  simp_rw [← contMdiffWithinAt_univ]
-  exact contMdiffWithinAt_prod_iff f
+  by simp_rw [← contMdiffWithinAt_univ]; exact contMdiffWithinAt_prod_iff f
 #align cont_mdiff_at_prod_iff contMdiffAt_prod_iff
 
 section Prod_map
@@ -1830,10 +1814,8 @@ theorem ContMdiffWithinAt.clm_comp {g : M → F₁ →L[𝕜] F₃} {f : M → F
     ContMdiffWithinAt I 𝓘(𝕜, F₂ →L[𝕜] F₃) n (fun x => (g x).comp (f x)) s x :=
   @ContDiffWithinAt.comp_contMdiffWithinAt _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
     (fun x : (F₁ →L[𝕜] F₃) × (F₂ →L[𝕜] F₁) => x.1.comp x.2) (fun x => (g x, f x)) s _ x
-    (by
-      apply ContDiff.contDiffAt
-      exact cont_diff_fst.clm_comp contDiff_snd)
-    (hg.prod_mk_space hf) (by simp_rw [preimage_univ, subset_univ])
+    (by apply ContDiff.contDiffAt; exact cont_diff_fst.clm_comp contDiff_snd) (hg.prod_mk_space hf)
+    (by simp_rw [preimage_univ, subset_univ])
 #align cont_mdiff_within_at.clm_comp ContMdiffWithinAt.clm_comp
 
 theorem ContMdiffAt.clm_comp {g : M → F₁ →L[𝕜] F₃} {f : M → F₂ →L[𝕜] F₁} {x : M}
@@ -1859,10 +1841,8 @@ theorem ContMdiffWithinAt.clm_apply {g : M → F₁ →L[𝕜] F₂} {f : M →
     ContMdiffWithinAt I 𝓘(𝕜, F₂) n (fun x => g x (f x)) s x :=
   @ContDiffWithinAt.comp_contMdiffWithinAt _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
     (fun x : (F₁ →L[𝕜] F₂) × F₁ => x.1 x.2) (fun x => (g x, f x)) s _ x
-    (by
-      apply ContDiff.contDiffAt
-      exact cont_diff_fst.clm_apply contDiff_snd)
-    (hg.prod_mk_space hf) (by simp_rw [preimage_univ, subset_univ])
+    (by apply ContDiff.contDiffAt; exact cont_diff_fst.clm_apply contDiff_snd) (hg.prod_mk_space hf)
+    (by simp_rw [preimage_univ, subset_univ])
 #align cont_mdiff_within_at.clm_apply ContMdiffWithinAt.clm_apply
 
 theorem ContMdiffAt.clm_apply {g : M → F₁ →L[𝕜] F₂} {f : M → F₁} {x : M}
@@ -2064,20 +2044,17 @@ theorem is_local_structomorph_on_contDiffGroupoid_iff (f : LocalHomeomorph M M')
         apply eq_on.symm
         refine' e.is_image_source_target.symm_eq_on_of_inter_eq_of_eq_on _ _
         · rw [inter_self, inter_eq_right_iff_subset.mpr h2e]
-        rw [inter_self]
-        exact hef.symm
+        rw [inter_self]; exact hef.symm
       have h2 : e.target ⊆ (c.symm ≫ₕ f ≫ₕ c').target :=
         by
-        intro x hx
-        rw [← e.right_inv hx, ← hef (e.symm.maps_to hx)]
+        intro x hx; rw [← e.right_inv hx, ← hef (e.symm.maps_to hx)]
         exact LocalHomeomorph.mapsTo _ (h2e <| e.symm.maps_to hx)
       rw [inter_self] at h1
       rwa [inter_eq_right_iff_subset.mpr]
       refine' h2.trans _
       mfld_set_tac
     refine' ⟨e.symm, StructureGroupoid.symm _ he, h3e, _⟩
-    rw [h2X]
-    exact e.maps_to hex
+    rw [h2X]; exact e.maps_to hex
   · -- We now show the converse: a local homeomorphism `f : M → M'` which is smooth in both
     -- directions is a local structomorphism.  We do this by proposing
     -- `((chart_at H x).symm.trans f).trans (chart_at H (f x))` as a candidate for a structomorphism
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.cont_mdiff
-! leanprover-community/mathlib commit be2c24f56783935652cefffb4bfca7e4b25d167e
+! leanprover-community/mathlib commit 0187644979f2d3e10a06e916a869c994facd9a87
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -1534,6 +1534,12 @@ theorem contMdiffWithinAt_fst {s : Set (M × N)} {p : M × N} :
   · simp only [mfld_simps]
 #align cont_mdiff_within_at_fst contMdiffWithinAt_fst
 
+theorem ContMdiffWithinAt.fst {f : N → M × M'} {s : Set N} {x : N}
+    (hf : ContMdiffWithinAt J (I.Prod I') n f s x) :
+    ContMdiffWithinAt J I n (fun x => (f x).1) s x :=
+  contMdiffWithinAt_fst.comp x hf (mapsTo_image f s)
+#align cont_mdiff_within_at.fst ContMdiffWithinAt.fst
+
 theorem contMdiffAt_fst {p : M × N} : ContMdiffAt (I.Prod J) I n Prod.fst p :=
   contMdiffWithinAt_fst
 #align cont_mdiff_at_fst contMdiffAt_fst
@@ -1592,6 +1598,12 @@ theorem contMdiffWithinAt_snd {s : Set (M × N)} {p : M × N} :
   · simp only [mfld_simps]
 #align cont_mdiff_within_at_snd contMdiffWithinAt_snd
 
+theorem ContMdiffWithinAt.snd {f : N → M × M'} {s : Set N} {x : N}
+    (hf : ContMdiffWithinAt J (I.Prod I') n f s x) :
+    ContMdiffWithinAt J I' n (fun x => (f x).2) s x :=
+  contMdiffWithinAt_snd.comp x hf (mapsTo_image f s)
+#align cont_mdiff_within_at.snd ContMdiffWithinAt.snd
+
 theorem contMdiffAt_snd {p : M × N} : ContMdiffAt (I.Prod J) J n Prod.snd p :=
   contMdiffWithinAt_snd
 #align cont_mdiff_at_snd contMdiffAt_snd
@@ -1656,6 +1668,22 @@ theorem smooth_prod_assoc :
 
 end Projections
 
+theorem contMdiffWithinAt_prod_iff (f : M → M' × N') {s : Set M} {x : M} :
+    ContMdiffWithinAt I (I'.Prod J') n f s x ↔
+      ContMdiffWithinAt I I' n (Prod.fst ∘ f) s x ∧ ContMdiffWithinAt I J' n (Prod.snd ∘ f) s x :=
+  by
+  refine' ⟨fun h => ⟨h.fst, h.snd⟩, fun h => _⟩
+  simpa only [Prod.mk.eta] using h.1.prod_mk h.2
+#align cont_mdiff_within_at_prod_iff contMdiffWithinAt_prod_iff
+
+theorem contMdiffAt_prod_iff (f : M → M' × N') {x : M} :
+    ContMdiffAt I (I'.Prod J') n f x ↔
+      ContMdiffAt I I' n (Prod.fst ∘ f) x ∧ ContMdiffAt I J' n (Prod.snd ∘ f) x :=
+  by
+  simp_rw [← contMdiffWithinAt_univ]
+  exact contMdiffWithinAt_prod_iff f
+#align cont_mdiff_at_prod_iff contMdiffAt_prod_iff
+
 section Prod_map
 
 variable {g : N → N'} {r : Set N} {y : N}
Diff
@@ -137,7 +137,7 @@ theorem cont_diff_within_at_localInvariantProp (n : ℕ∞) :
       rw [this] at h
       have : I (e x) ∈ I.symm ⁻¹' e.target ∩ range I := by simp only [hx, mfld_simps]
       have := ((mem_groupoid_of_pregroupoid.2 he).2.ContDiffWithinAt this).of_le le_top
-      convert (h.comp' _ this).mono_of_mem _ using 1
+      convert(h.comp' _ this).mono_of_mem _ using 1
       · ext y
         simp only [mfld_simps]
       refine'
@@ -567,7 +567,7 @@ theorem contMdiffOn_iff :
     specialize h w this
     have w1 : w ∈ (chart_at H x).source := by simp only [w, hz, mfld_simps]
     have w2 : f w ∈ (chart_at H' y).source := by simp only [w, hz, mfld_simps]
-    convert ((contMdiffWithinAt_iff_of_mem_source w1 w2).mp h).2.mono _
+    convert((contMdiffWithinAt_iff_of_mem_source w1 w2).mp h).2.mono _
     · simp only [w, hz, mfld_simps]
     · mfld_set_tac
   · rintro ⟨hcont, hdiff⟩ x hx
@@ -594,7 +594,7 @@ theorem contMdiffOn_iff_target :
   constructor
   · refine' fun h' y => ⟨_, fun x _ => h' x y⟩
     have h'' : ContinuousOn _ univ := (ModelWithCorners.continuous I').ContinuousOn
-    convert (h''.comp' (chart_at H' y).continuous_toFun).comp' h
+    convert(h''.comp' (chart_at H' y).continuous_toFun).comp' h
     simp
   · exact fun h' x y => (h' y).2 x default
 #align cont_mdiff_on_iff_target contMdiffOn_iff_target
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.cont_mdiff
-! leanprover-community/mathlib commit 5be98b9519379fd4434bb72c5e4120b870b8ff94
+! leanprover-community/mathlib commit be2c24f56783935652cefffb4bfca7e4b25d167e
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -80,9 +80,11 @@ variable {𝕜 : Type _} [NontriviallyNormedField 𝕜]
   [NormedAddCommGroup F'] [NormedSpace 𝕜 F'] {G' : Type _} [TopologicalSpace G']
   {J' : ModelWithCorners 𝕜 F' G'} {N' : Type _} [TopologicalSpace N'] [ChartedSpace G' N']
   [J's : SmoothManifoldWithCorners J' N']
-  -- F'' is a normed space
-  {F'' : Type _}
-  [NormedAddCommGroup F''] [NormedSpace 𝕜 F'']
+  -- F₁, F₂, F₃, F₄ are normed spaces
+  {F₁ : Type _}
+  [NormedAddCommGroup F₁] [NormedSpace 𝕜 F₁] {F₂ : Type _} [NormedAddCommGroup F₂]
+  [NormedSpace 𝕜 F₂] {F₃ : Type _} [NormedAddCommGroup F₃] [NormedSpace 𝕜 F₃] {F₄ : Type _}
+  [NormedAddCommGroup F₄] [NormedSpace 𝕜 F₄]
   -- declare functions, sets, points and smoothness indices
   {e : LocalHomeomorph M H}
   {e' : LocalHomeomorph M' H'} {f f₁ : M → M'} {s s₁ t : Set M} {x : M} {m n : ℕ∞}
@@ -1794,36 +1796,93 @@ theorem ContinuousLinearMap.contMdiff (L : E →L[𝕜] F) : ContMdiff 𝓘(𝕜
   L.ContDiff.ContMdiff
 #align continuous_linear_map.cont_mdiff ContinuousLinearMap.contMdiff
 
--- the following proof takes very long to elaborate in pure term mode
-theorem ContMdiffWithinAt.clm_comp {g : M → F →L[𝕜] F''} {f : M → F' →L[𝕜] F} {s : Set M} {x : M}
-    (hg : ContMdiffWithinAt I 𝓘(𝕜, F →L[𝕜] F'') n g s x)
-    (hf : ContMdiffWithinAt I 𝓘(𝕜, F' →L[𝕜] F) n f s x) :
-    ContMdiffWithinAt I 𝓘(𝕜, F' →L[𝕜] F'') n (fun x => (g x).comp (f x)) s x :=
+theorem ContMdiffWithinAt.clm_comp {g : M → F₁ →L[𝕜] F₃} {f : M → F₂ →L[𝕜] F₁} {s : Set M} {x : M}
+    (hg : ContMdiffWithinAt I 𝓘(𝕜, F₁ →L[𝕜] F₃) n g s x)
+    (hf : ContMdiffWithinAt I 𝓘(𝕜, F₂ →L[𝕜] F₁) n f s x) :
+    ContMdiffWithinAt I 𝓘(𝕜, F₂ →L[𝕜] F₃) n (fun x => (g x).comp (f x)) s x :=
   @ContDiffWithinAt.comp_contMdiffWithinAt _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
-    (fun x : (F →L[𝕜] F'') × (F' →L[𝕜] F) => x.1.comp x.2) (fun x => (g x, f x)) s _ x
+    (fun x : (F₁ →L[𝕜] F₃) × (F₂ →L[𝕜] F₁) => x.1.comp x.2) (fun x => (g x, f x)) s _ x
     (by
       apply ContDiff.contDiffAt
       exact cont_diff_fst.clm_comp contDiff_snd)
     (hg.prod_mk_space hf) (by simp_rw [preimage_univ, subset_univ])
 #align cont_mdiff_within_at.clm_comp ContMdiffWithinAt.clm_comp
 
-theorem ContMdiffAt.clm_comp {g : M → F →L[𝕜] F''} {f : M → F' →L[𝕜] F} {x : M}
-    (hg : ContMdiffAt I 𝓘(𝕜, F →L[𝕜] F'') n g x) (hf : ContMdiffAt I 𝓘(𝕜, F' →L[𝕜] F) n f x) :
-    ContMdiffAt I 𝓘(𝕜, F' →L[𝕜] F'') n (fun x => (g x).comp (f x)) x :=
+theorem ContMdiffAt.clm_comp {g : M → F₁ →L[𝕜] F₃} {f : M → F₂ →L[𝕜] F₁} {x : M}
+    (hg : ContMdiffAt I 𝓘(𝕜, F₁ →L[𝕜] F₃) n g x) (hf : ContMdiffAt I 𝓘(𝕜, F₂ →L[𝕜] F₁) n f x) :
+    ContMdiffAt I 𝓘(𝕜, F₂ →L[𝕜] F₃) n (fun x => (g x).comp (f x)) x :=
   (hg.ContMdiffWithinAt.clm_comp hf.ContMdiffWithinAt).ContMdiffAt univ_mem
 #align cont_mdiff_at.clm_comp ContMdiffAt.clm_comp
 
-theorem ContMdiffOn.clm_comp {g : M → F →L[𝕜] F''} {f : M → F' →L[𝕜] F} {s : Set M}
-    (hg : ContMdiffOn I 𝓘(𝕜, F →L[𝕜] F'') n g s) (hf : ContMdiffOn I 𝓘(𝕜, F' →L[𝕜] F) n f s) :
-    ContMdiffOn I 𝓘(𝕜, F' →L[𝕜] F'') n (fun x => (g x).comp (f x)) s := fun x hx =>
+theorem ContMdiffOn.clm_comp {g : M → F₁ →L[𝕜] F₃} {f : M → F₂ →L[𝕜] F₁} {s : Set M}
+    (hg : ContMdiffOn I 𝓘(𝕜, F₁ →L[𝕜] F₃) n g s) (hf : ContMdiffOn I 𝓘(𝕜, F₂ →L[𝕜] F₁) n f s) :
+    ContMdiffOn I 𝓘(𝕜, F₂ →L[𝕜] F₃) n (fun x => (g x).comp (f x)) s := fun x hx =>
   (hg x hx).clm_comp (hf x hx)
 #align cont_mdiff_on.clm_comp ContMdiffOn.clm_comp
 
-theorem ContMdiff.clm_comp {g : M → F →L[𝕜] F''} {f : M → F' →L[𝕜] F}
-    (hg : ContMdiff I 𝓘(𝕜, F →L[𝕜] F'') n g) (hf : ContMdiff I 𝓘(𝕜, F' →L[𝕜] F) n f) :
-    ContMdiff I 𝓘(𝕜, F' →L[𝕜] F'') n fun x => (g x).comp (f x) := fun x => (hg x).clm_comp (hf x)
+theorem ContMdiff.clm_comp {g : M → F₁ →L[𝕜] F₃} {f : M → F₂ →L[𝕜] F₁}
+    (hg : ContMdiff I 𝓘(𝕜, F₁ →L[𝕜] F₃) n g) (hf : ContMdiff I 𝓘(𝕜, F₂ →L[𝕜] F₁) n f) :
+    ContMdiff I 𝓘(𝕜, F₂ →L[𝕜] F₃) n fun x => (g x).comp (f x) := fun x => (hg x).clm_comp (hf x)
 #align cont_mdiff.clm_comp ContMdiff.clm_comp
 
+theorem ContMdiffWithinAt.clm_apply {g : M → F₁ →L[𝕜] F₂} {f : M → F₁} {s : Set M} {x : M}
+    (hg : ContMdiffWithinAt I 𝓘(𝕜, F₁ →L[𝕜] F₂) n g s x)
+    (hf : ContMdiffWithinAt I 𝓘(𝕜, F₁) n f s x) :
+    ContMdiffWithinAt I 𝓘(𝕜, F₂) n (fun x => g x (f x)) s x :=
+  @ContDiffWithinAt.comp_contMdiffWithinAt _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
+    (fun x : (F₁ →L[𝕜] F₂) × F₁ => x.1 x.2) (fun x => (g x, f x)) s _ x
+    (by
+      apply ContDiff.contDiffAt
+      exact cont_diff_fst.clm_apply contDiff_snd)
+    (hg.prod_mk_space hf) (by simp_rw [preimage_univ, subset_univ])
+#align cont_mdiff_within_at.clm_apply ContMdiffWithinAt.clm_apply
+
+theorem ContMdiffAt.clm_apply {g : M → F₁ →L[𝕜] F₂} {f : M → F₁} {x : M}
+    (hg : ContMdiffAt I 𝓘(𝕜, F₁ →L[𝕜] F₂) n g x) (hf : ContMdiffAt I 𝓘(𝕜, F₁) n f x) :
+    ContMdiffAt I 𝓘(𝕜, F₂) n (fun x => g x (f x)) x :=
+  (hg.ContMdiffWithinAt.clm_apply hf.ContMdiffWithinAt).ContMdiffAt univ_mem
+#align cont_mdiff_at.clm_apply ContMdiffAt.clm_apply
+
+theorem ContMdiffOn.clm_apply {g : M → F₁ →L[𝕜] F₂} {f : M → F₁} {s : Set M}
+    (hg : ContMdiffOn I 𝓘(𝕜, F₁ →L[𝕜] F₂) n g s) (hf : ContMdiffOn I 𝓘(𝕜, F₁) n f s) :
+    ContMdiffOn I 𝓘(𝕜, F₂) n (fun x => g x (f x)) s := fun x hx => (hg x hx).clm_apply (hf x hx)
+#align cont_mdiff_on.clm_apply ContMdiffOn.clm_apply
+
+theorem ContMdiff.clm_apply {g : M → F₁ →L[𝕜] F₂} {f : M → F₁}
+    (hg : ContMdiff I 𝓘(𝕜, F₁ →L[𝕜] F₂) n g) (hf : ContMdiff I 𝓘(𝕜, F₁) n f) :
+    ContMdiff I 𝓘(𝕜, F₂) n fun x => g x (f x) := fun x => (hg x).clm_apply (hf x)
+#align cont_mdiff.clm_apply ContMdiff.clm_apply
+
+theorem ContMdiffWithinAt.clm_prodMap {g : M → F₁ →L[𝕜] F₃} {f : M → F₂ →L[𝕜] F₄} {s : Set M}
+    {x : M} (hg : ContMdiffWithinAt I 𝓘(𝕜, F₁ →L[𝕜] F₃) n g s x)
+    (hf : ContMdiffWithinAt I 𝓘(𝕜, F₂ →L[𝕜] F₄) n f s x) :
+    ContMdiffWithinAt I 𝓘(𝕜, F₁ × F₂ →L[𝕜] F₃ × F₄) n (fun x => (g x).Prod_map (f x)) s x :=
+  @ContDiffWithinAt.comp_contMdiffWithinAt _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
+    (fun x : (F₁ →L[𝕜] F₃) × (F₂ →L[𝕜] F₄) => x.1.Prod_map x.2) (fun x => (g x, f x)) s _ x
+    (by
+      apply ContDiff.contDiffAt
+      exact (ContinuousLinearMap.prodMapL 𝕜 F₁ F₃ F₂ F₄).ContDiff)
+    (hg.prod_mk_space hf) (by simp_rw [preimage_univ, subset_univ])
+#align cont_mdiff_within_at.clm_prod_map ContMdiffWithinAt.clm_prodMap
+
+theorem ContMdiffAt.clm_prodMap {g : M → F₁ →L[𝕜] F₃} {f : M → F₂ →L[𝕜] F₄} {x : M}
+    (hg : ContMdiffAt I 𝓘(𝕜, F₁ →L[𝕜] F₃) n g x) (hf : ContMdiffAt I 𝓘(𝕜, F₂ →L[𝕜] F₄) n f x) :
+    ContMdiffAt I 𝓘(𝕜, F₁ × F₂ →L[𝕜] F₃ × F₄) n (fun x => (g x).Prod_map (f x)) x :=
+  (hg.ContMdiffWithinAt.clm_prodMap hf.ContMdiffWithinAt).ContMdiffAt univ_mem
+#align cont_mdiff_at.clm_prod_map ContMdiffAt.clm_prodMap
+
+theorem ContMdiffOn.clm_prodMap {g : M → F₁ →L[𝕜] F₃} {f : M → F₂ →L[𝕜] F₄} {s : Set M}
+    (hg : ContMdiffOn I 𝓘(𝕜, F₁ →L[𝕜] F₃) n g s) (hf : ContMdiffOn I 𝓘(𝕜, F₂ →L[𝕜] F₄) n f s) :
+    ContMdiffOn I 𝓘(𝕜, F₁ × F₂ →L[𝕜] F₃ × F₄) n (fun x => (g x).Prod_map (f x)) s := fun x hx =>
+  (hg x hx).clm_prodMap (hf x hx)
+#align cont_mdiff_on.clm_prod_map ContMdiffOn.clm_prodMap
+
+theorem ContMdiff.clm_prodMap {g : M → F₁ →L[𝕜] F₃} {f : M → F₂ →L[𝕜] F₄}
+    (hg : ContMdiff I 𝓘(𝕜, F₁ →L[𝕜] F₃) n g) (hf : ContMdiff I 𝓘(𝕜, F₂ →L[𝕜] F₄) n f) :
+    ContMdiff I 𝓘(𝕜, F₁ × F₂ →L[𝕜] F₃ × F₄) n fun x => (g x).Prod_map (f x) := fun x =>
+  (hg x).clm_prodMap (hf x)
+#align cont_mdiff.clm_prod_map ContMdiff.clm_prodMap
+
 /-! ### Smoothness of standard operations -/
 
 
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.cont_mdiff
-! leanprover-community/mathlib commit f2ce6086713c78a7f880485f7917ea547a215982
+! leanprover-community/mathlib commit 5be98b9519379fd4434bb72c5e4120b870b8ff94
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -172,10 +172,10 @@ theorem contDiffWithinAtProp_mono_of_mem (n : ℕ∞) ⦃s x t⦄ ⦃f : H → H
   rwa [← Filter.mem_map, ← I.image_eq, I.symm_map_nhds_within_image]
 #align cont_diff_within_at_prop_mono_of_mem contDiffWithinAtProp_mono_of_mem
 
-theorem contDiffWithinAtProp_id (x : H) : ContDiffWithinAtProp I I ∞ id univ x :=
+theorem contDiffWithinAtProp_id (x : H) : ContDiffWithinAtProp I I n id univ x :=
   by
   simp [ContDiffWithinAtProp]
-  have : ContDiffWithinAt 𝕜 ∞ id (range I) (I x) := cont_diff_id.cont_diff_at.cont_diff_within_at
+  have : ContDiffWithinAt 𝕜 n id (range I) (I x) := cont_diff_id.cont_diff_at.cont_diff_within_at
   apply this.congr fun y hy => _
   · simp only [mfld_simps]
   · simp only [ModelWithCorners.right_inv I hy, mfld_simps]
@@ -1206,6 +1206,15 @@ theorem contMdiffOn_extChartAt : ContMdiffOn I 𝓘(𝕜, E) n (extChartAt I x)
   fun x' hx' => (contMdiffAt_ext_chart_at' hx').ContMdiffWithinAt
 #align cont_mdiff_on_ext_chart_at contMdiffOn_extChartAt
 
+omit Is
+
+/-- An element of `cont_diff_groupoid ⊤ I` is `C^n` for any `n`. -/
+theorem contMdiffOn_of_mem_contDiffGroupoid {e' : LocalHomeomorph H H}
+    (h : e' ∈ contDiffGroupoid ⊤ I) : ContMdiffOn I I n e' e'.source :=
+  (cont_diff_within_at_localInvariantProp I I n).liftPropOn_of_mem_groupoid
+    (contDiffWithinAtProp_id I) h
+#align cont_mdiff_on_of_mem_cont_diff_groupoid contMdiffOn_of_mem_contDiffGroupoid
+
 end Atlas
 
 /-! ### The identity is smooth -/
@@ -1786,20 +1795,30 @@ theorem ContinuousLinearMap.contMdiff (L : E →L[𝕜] F) : ContMdiff 𝓘(𝕜
 #align continuous_linear_map.cont_mdiff ContinuousLinearMap.contMdiff
 
 -- the following proof takes very long to elaborate in pure term mode
+theorem ContMdiffWithinAt.clm_comp {g : M → F →L[𝕜] F''} {f : M → F' →L[𝕜] F} {s : Set M} {x : M}
+    (hg : ContMdiffWithinAt I 𝓘(𝕜, F →L[𝕜] F'') n g s x)
+    (hf : ContMdiffWithinAt I 𝓘(𝕜, F' →L[𝕜] F) n f s x) :
+    ContMdiffWithinAt I 𝓘(𝕜, F' →L[𝕜] F'') n (fun x => (g x).comp (f x)) s x :=
+  @ContDiffWithinAt.comp_contMdiffWithinAt _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
+    (fun x : (F →L[𝕜] F'') × (F' →L[𝕜] F) => x.1.comp x.2) (fun x => (g x, f x)) s _ x
+    (by
+      apply ContDiff.contDiffAt
+      exact cont_diff_fst.clm_comp contDiff_snd)
+    (hg.prod_mk_space hf) (by simp_rw [preimage_univ, subset_univ])
+#align cont_mdiff_within_at.clm_comp ContMdiffWithinAt.clm_comp
+
 theorem ContMdiffAt.clm_comp {g : M → F →L[𝕜] F''} {f : M → F' →L[𝕜] F} {x : M}
     (hg : ContMdiffAt I 𝓘(𝕜, F →L[𝕜] F'') n g x) (hf : ContMdiffAt I 𝓘(𝕜, F' →L[𝕜] F) n f x) :
     ContMdiffAt I 𝓘(𝕜, F' →L[𝕜] F'') n (fun x => (g x).comp (f x)) x :=
-  @ContDiffAt.comp_contMdiffAt _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
-    (fun x : (F →L[𝕜] F'') × (F' →L[𝕜] F) => x.1.comp x.2) (fun x => (g x, f x)) x
-    (by
-      apply ContDiff.contDiffAt
-      apply IsBoundedBilinearMap.contDiff
-      exact isBoundedBilinearMapComp)
-    (-- todo: simplify after #16946
-        hg.prod_mk_space
-      hf)
+  (hg.ContMdiffWithinAt.clm_comp hf.ContMdiffWithinAt).ContMdiffAt univ_mem
 #align cont_mdiff_at.clm_comp ContMdiffAt.clm_comp
 
+theorem ContMdiffOn.clm_comp {g : M → F →L[𝕜] F''} {f : M → F' →L[𝕜] F} {s : Set M}
+    (hg : ContMdiffOn I 𝓘(𝕜, F →L[𝕜] F'') n g s) (hf : ContMdiffOn I 𝓘(𝕜, F' →L[𝕜] F) n f s) :
+    ContMdiffOn I 𝓘(𝕜, F' →L[𝕜] F'') n (fun x => (g x).comp (f x)) s := fun x hx =>
+  (hg x hx).clm_comp (hf x hx)
+#align cont_mdiff_on.clm_comp ContMdiffOn.clm_comp
+
 theorem ContMdiff.clm_comp {g : M → F →L[𝕜] F''} {f : M → F' →L[𝕜] F}
     (hg : ContMdiff I 𝓘(𝕜, F →L[𝕜] F'') n g) (hf : ContMdiff I 𝓘(𝕜, F' →L[𝕜] F) n f) :
     ContMdiff I 𝓘(𝕜, F' →L[𝕜] F'') n fun x => (g x).comp (f x) := fun x => (hg x).clm_comp (hf x)
@@ -1856,3 +1875,169 @@ theorem Smooth.smul {f : M → 𝕜} {g : M → V} (hf : Smooth I 𝓘(𝕜) f)
   hf.smul hg
 #align smooth.smul Smooth.smul
 
+/-! ### Smoothness of (local) structomorphisms -/
+
+
+section
+
+variable [ChartedSpace H M'] [IsM' : SmoothManifoldWithCorners I M']
+
+include Is IsM'
+
+theorem is_local_structomorph_on_contDiffGroupoid_iff_aux {f : LocalHomeomorph M M'}
+    (hf : LiftPropOn (contDiffGroupoid ⊤ I).IsLocalStructomorphWithinAt f f.source) :
+    SmoothOn I I f f.source :=
+  by
+  -- It suffices to show smoothness near each `x`
+  apply contMdiffOn_of_locally_contMdiffOn
+  intro x hx
+  let c := chart_at H x
+  let c' := chart_at H (f x)
+  obtain ⟨-, hxf⟩ := hf x hx
+  -- Since `f` is a local structomorph, it is locally equal to some transferred element `e` of
+  -- the `cont_diff_groupoid`.
+  obtain
+    ⟨e, he, he' : eq_on (c' ∘ f ∘ c.symm) e (c.symm ⁻¹' f.source ∩ e.source), hex :
+      c x ∈ e.source⟩ :=
+    hxf (by simp only [hx, mfld_simps])
+  -- We choose a convenient set `s` in `M`.
+  let s : Set M := (f.trans c').source ∩ ((c.trans e).trans c'.symm).source
+  refine' ⟨s, (f.trans c').open_source.inter ((c.trans e).trans c'.symm).open_source, _, _⟩
+  · simp only [mfld_simps]
+    rw [← he'] <;> simp only [hx, hex, mfld_simps]
+  -- We need to show `f` is `cont_mdiff_on` the domain `s ∩ f.source`.  We show this in two
+  -- steps: `f` is equal to `c'.symm ∘ e ∘ c` on that domain and that function is
+  -- `cont_mdiff_on` it.
+  have H₁ : ContMdiffOn I I ⊤ (c'.symm ∘ e ∘ c) s :=
+    by
+    have hc' : ContMdiffOn I I ⊤ c'.symm _ := contMdiffOn_chart_symm
+    have he'' : ContMdiffOn I I ⊤ e _ := contMdiffOn_of_mem_contDiffGroupoid he
+    have hc : ContMdiffOn I I ⊤ c _ := contMdiffOn_chart
+    refine' (hc'.comp' (he''.comp' hc)).mono _
+    mfld_set_tac
+  have H₂ : eq_on f (c'.symm ∘ e ∘ c) s := by
+    intro y hy
+    simp only [mfld_simps] at hy
+    have hy₁ : f y ∈ c'.source := by simp only [hy, mfld_simps]
+    have hy₂ : y ∈ c.source := by simp only [hy, mfld_simps]
+    have hy₃ : c y ∈ c.symm ⁻¹' f.source ∩ e.source := by simp only [hy, mfld_simps]
+    calc
+      f y = c'.symm (c' (f y)) := by rw [c'.left_inv hy₁]
+      _ = c'.symm (c' (f (c.symm (c y)))) := by rw [c.left_inv hy₂]
+      _ = c'.symm (e (c y)) := by rw [← he' hy₃]
+      
+  refine' (H₁.congr H₂).mono _
+  mfld_set_tac
+#align is_local_structomorph_on_cont_diff_groupoid_iff_aux is_local_structomorph_on_contDiffGroupoid_iff_aux
+
+/-- Let `M` and `M'` be smooth manifolds with the same model-with-corners, `I`.  Then `f : M → M'`
+is a local structomorphism for `I`, if and only if it is manifold-smooth on the domain of definition
+in both directions. -/
+theorem is_local_structomorph_on_contDiffGroupoid_iff (f : LocalHomeomorph M M') :
+    LiftPropOn (contDiffGroupoid ⊤ I).IsLocalStructomorphWithinAt f f.source ↔
+      SmoothOn I I f f.source ∧ SmoothOn I I f.symm f.target :=
+  by
+  constructor
+  · intro h
+    refine'
+      ⟨is_local_structomorph_on_contDiffGroupoid_iff_aux h,
+        is_local_structomorph_on_contDiffGroupoid_iff_aux _⟩
+    -- todo: we can generalize this part of the proof to a lemma
+    intro X hX
+    let x := f.symm X
+    have hx : x ∈ f.source := f.symm.maps_to hX
+    let c := chart_at H x
+    let c' := chart_at H X
+    obtain ⟨-, hxf⟩ := h x hx
+    refine' ⟨(f.symm.continuous_at hX).ContinuousWithinAt, fun h2x => _⟩
+    obtain ⟨e, he, h2e, hef, hex⟩ :
+      ∃ e : LocalHomeomorph H H,
+        e ∈ contDiffGroupoid ⊤ I ∧
+          e.source ⊆ (c.symm ≫ₕ f ≫ₕ c').source ∧
+            eq_on (c' ∘ f ∘ c.symm) e e.source ∧ c x ∈ e.source :=
+      by
+      have h1 : c' = chart_at H (f x) := by simp only [f.right_inv hX]
+      have h2 : ⇑c' ∘ ⇑f ∘ ⇑c.symm = ⇑(c.symm ≫ₕ f ≫ₕ c') := rfl
+      have hcx : c x ∈ c.symm ⁻¹' f.source := by simp only [hx, mfld_simps]
+      rw [h2]
+      rw [← h1, h2, LocalHomeomorph.isLocalStructomorphWithinAt_iff'] at hxf
+      · exact hxf hcx
+      · mfld_set_tac
+      · apply Or.inl
+        simp only [hx, h1, mfld_simps]
+    have h2X : c' X = e (c (f.symm X)) := by
+      rw [← hef hex]
+      dsimp only [Function.comp]
+      have hfX : f.symm X ∈ c.source := by simp only [hX, mfld_simps]
+      rw [c.left_inv hfX, f.right_inv hX]
+    have h3e : eq_on (c ∘ f.symm ∘ c'.symm) e.symm (c'.symm ⁻¹' f.target ∩ e.target) :=
+      by
+      have h1 : eq_on (c.symm ≫ₕ f ≫ₕ c').symm e.symm (e.target ∩ e.target) :=
+        by
+        apply eq_on.symm
+        refine' e.is_image_source_target.symm_eq_on_of_inter_eq_of_eq_on _ _
+        · rw [inter_self, inter_eq_right_iff_subset.mpr h2e]
+        rw [inter_self]
+        exact hef.symm
+      have h2 : e.target ⊆ (c.symm ≫ₕ f ≫ₕ c').target :=
+        by
+        intro x hx
+        rw [← e.right_inv hx, ← hef (e.symm.maps_to hx)]
+        exact LocalHomeomorph.mapsTo _ (h2e <| e.symm.maps_to hx)
+      rw [inter_self] at h1
+      rwa [inter_eq_right_iff_subset.mpr]
+      refine' h2.trans _
+      mfld_set_tac
+    refine' ⟨e.symm, StructureGroupoid.symm _ he, h3e, _⟩
+    rw [h2X]
+    exact e.maps_to hex
+  · -- We now show the converse: a local homeomorphism `f : M → M'` which is smooth in both
+    -- directions is a local structomorphism.  We do this by proposing
+    -- `((chart_at H x).symm.trans f).trans (chart_at H (f x))` as a candidate for a structomorphism
+    -- of `H`.
+    rintro ⟨h₁, h₂⟩ x hx
+    refine' ⟨(h₁ x hx).ContinuousWithinAt, _⟩
+    let c := chart_at H x
+    let c' := chart_at H (f x)
+    rintro (hx' : c x ∈ c.symm ⁻¹' f.source)
+    -- propose `(c.symm.trans f).trans c'` as a candidate for a local structomorphism of `H`
+    refine' ⟨(c.symm.trans f).trans c', ⟨_, _⟩, (_ : eq_on (c' ∘ f ∘ c.symm) _ _), _⟩
+    · -- smoothness of the candidate local structomorphism in the forward direction
+      intro y hy
+      simp only [mfld_simps] at hy
+      have H : ContMdiffWithinAt I I ⊤ f (f ≫ₕ c').source ((extChartAt I x).symm y) :=
+        by
+        refine' (h₁ ((extChartAt I x).symm y) _).mono _
+        · simp only [hy, mfld_simps]
+        · mfld_set_tac
+      have hy' : (extChartAt I x).symm y ∈ c.source := by simp only [hy, mfld_simps]
+      have hy'' : f ((extChartAt I x).symm y) ∈ c'.source := by simp only [hy, mfld_simps]
+      rw [contMdiffWithinAt_iff_of_mem_source hy' hy''] at H
+      · convert H.2.mono _
+        · simp only [hy, mfld_simps]
+        · mfld_set_tac
+      · infer_instance
+      · infer_instance
+    · -- smoothness of the candidate local structomorphism in the reverse direction
+      intro y hy
+      simp only [mfld_simps] at hy
+      have H : ContMdiffWithinAt I I ⊤ f.symm (f.symm ≫ₕ c).source ((extChartAt I (f x)).symm y) :=
+        by
+        refine' (h₂ ((extChartAt I (f x)).symm y) _).mono _
+        · simp only [hy, mfld_simps]
+        · mfld_set_tac
+      have hy' : (extChartAt I (f x)).symm y ∈ c'.source := by simp only [hy, mfld_simps]
+      have hy'' : f.symm ((extChartAt I (f x)).symm y) ∈ c.source := by simp only [hy, mfld_simps]
+      rw [contMdiffWithinAt_iff_of_mem_source hy' hy''] at H
+      · convert H.2.mono _
+        · simp only [hy, mfld_simps]
+        · mfld_set_tac
+      · infer_instance
+      · infer_instance
+    -- now check the candidate local structomorphism agrees with `f` where it is supposed to
+    · simp only [mfld_simps]
+    · simp only [hx', mfld_simps]
+#align is_local_structomorph_on_cont_diff_groupoid_iff is_local_structomorph_on_contDiffGroupoid_iff
+
+end
+

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
@@ -245,8 +245,9 @@ variable {I I'}
 /-! ### Deducing smoothness from higher smoothness -/
 
 theorem ContMDiffWithinAt.of_le (hf : ContMDiffWithinAt I I' n f s x) (le : m ≤ n) :
-    ContMDiffWithinAt I I' m f s x :=
-  ⟨hf.1, hf.2.of_le le⟩
+    ContMDiffWithinAt I I' m f s x := by
+  simp only [ContMDiffWithinAt, LiftPropWithinAt] at hf ⊢
+  exact ⟨hf.1, hf.2.of_le le⟩
 #align cont_mdiff_within_at.of_le ContMDiffWithinAt.of_le
 
 theorem ContMDiffAt.of_le (hf : ContMDiffAt I I' n f x) (le : m ≤ n) : ContMDiffAt I I' m f x :=
@@ -327,8 +328,8 @@ theorem contMDiffWithinAt_iff :
     ContMDiffWithinAt I I' n f s x ↔
       ContinuousWithinAt f s x ∧
         ContDiffWithinAt 𝕜 n (extChartAt I' (f x) ∘ f ∘ (extChartAt I x).symm)
-          ((extChartAt I x).symm ⁻¹' s ∩ range I) (extChartAt I x x) :=
-  Iff.rfl
+          ((extChartAt I x).symm ⁻¹' s ∩ range I) (extChartAt I x x) := by
+  simp_rw [ContMDiffWithinAt, liftPropWithinAt_iff']; rfl
 #align cont_mdiff_within_at_iff contMDiffWithinAt_iff
 
 /-- One can reformulate smoothness within a set at a point as continuity within this set at this
@@ -345,8 +346,9 @@ theorem contMDiffWithinAt_iff' :
         ContDiffWithinAt 𝕜 n (extChartAt I' (f x) ∘ f ∘ (extChartAt I x).symm)
           ((extChartAt I x).target ∩
             (extChartAt I x).symm ⁻¹' (s ∩ f ⁻¹' (extChartAt I' (f x)).source))
-          (extChartAt I x x) :=
-  and_congr_right fun hc => contDiffWithinAt_congr_nhds <|
+          (extChartAt I x x) := by
+  simp only [ContMDiffWithinAt, liftPropWithinAt_iff']
+  exact and_congr_right fun hc => contDiffWithinAt_congr_nhds <|
     hc.nhdsWithin_extChartAt_symm_preimage_inter_range I I'
 #align cont_mdiff_within_at_iff' contMDiffWithinAt_iff'
 
@@ -355,7 +357,7 @@ point, and smoothness in the corresponding extended chart in the target. -/
 theorem contMDiffWithinAt_iff_target :
     ContMDiffWithinAt I I' n f s x ↔
       ContinuousWithinAt f s x ∧ ContMDiffWithinAt I 𝓘(𝕜, E') n (extChartAt I' (f x) ∘ f) s x := by
-  simp_rw [ContMDiffWithinAt, LiftPropWithinAt, ← and_assoc]
+  simp_rw [ContMDiffWithinAt, liftPropWithinAt_iff', ← and_assoc]
   have cont :
     ContinuousWithinAt f s x ∧ ContinuousWithinAt (extChartAt I' (f x) ∘ f) s x ↔
         ContinuousWithinAt f s x :=
style: replace '.-/' by '. -/' (#11938)

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

Diff
@@ -234,7 +234,7 @@ apply fine to an assumption `SmoothFoo` using dot notation or normal notation.
 If the consequence `bar` of the lemma involves `ContDiff`, it is still better to restate
 the lemma replacing `ContDiff` with `Smooth` both in the assumption and in the conclusion,
 to make it possible to use `Smooth` consistently.
-This also applies to `SmoothAt`, `SmoothOn` and `SmoothWithinAt`.-/
+This also applies to `SmoothAt`, `SmoothOn` and `SmoothWithinAt`. -/
 @[reducible]
 def Smooth (f : M → M') :=
   ContMDiff I I' ⊤ f
chore: Remove ball and bex from lemma names (#10816)

ball for "bounded forall" and bex for "bounded exists" are from experience very confusing abbreviations. This PR renames them to forall_mem and exists_mem in the few Set lemma names that mention them.

Also deprecate ball_image_of_ball, mem_image_elim, mem_image_elim_on since those lemmas are duplicates of the renamed lemmas (apart from argument order and implicitness, which I am also fixing by making the binder in the RHS of forall_mem_image semi-implicit), have obscure names and are completely unused.

Diff
@@ -508,7 +508,7 @@ theorem contMDiffOn_iff_of_mem_maximalAtlas (he : e ∈ maximalAtlas I M)
     ContMDiffOn I I' n f s ↔
       ContinuousOn f s ∧
         ContDiffOn 𝕜 n (e'.extend I' ∘ f ∘ (e.extend I).symm) (e.extend I '' s) := by
-  simp_rw [ContinuousOn, ContDiffOn, Set.ball_image_iff, ← forall_and, ContMDiffOn]
+  simp_rw [ContinuousOn, ContDiffOn, Set.forall_mem_image, ← forall_and, ContMDiffOn]
   exact forall₂_congr fun x hx => contMDiffWithinAt_iff_image he he' hs (hs hx) (h2s hx)
 #align cont_mdiff_on_iff_of_mem_maximal_atlas contMDiffOn_iff_of_mem_maximalAtlas
 
@@ -802,7 +802,7 @@ theorem SmoothOn.smoothAt (h : SmoothOn I I' f s) (hx : s ∈ 𝓝 x) : SmoothAt
 theorem contMDiffOn_iff_source_of_mem_maximalAtlas (he : e ∈ maximalAtlas I M) (hs : s ⊆ e.source) :
     ContMDiffOn I I' n f s ↔
       ContMDiffOn 𝓘(𝕜, E) I' n (f ∘ (e.extend I).symm) (e.extend I '' s) := by
-  simp_rw [ContMDiffOn, Set.ball_image_iff]
+  simp_rw [ContMDiffOn, Set.forall_mem_image]
   refine' forall₂_congr fun x hx => _
   rw [contMDiffWithinAt_iff_source_of_mem_maximalAtlas he (hs hx)]
   apply contMDiffWithinAt_congr_nhds
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
@@ -810,7 +810,7 @@ theorem contMDiffOn_iff_source_of_mem_maximalAtlas (he : e ∈ maximalAtlas I M)
     e.extend_symm_preimage_inter_range_eventuallyEq I hs (hs hx)]
 #align cont_mdiff_on_iff_source_of_mem_maximal_atlas contMDiffOn_iff_source_of_mem_maximalAtlas
 
--- porting note: didn't compile; fixed by golfing the proof and moving parts to lemmas
+-- Porting note: didn't compile; fixed by golfing the proof and moving parts to lemmas
 /-- A function is `C^n` within a set at a point, for `n : ℕ`, if and only if it is `C^n` on
 a neighborhood of this point. -/
 theorem contMDiffWithinAt_iff_contMDiffOn_nhds {n : ℕ} :
chore: prepare Lean version bump with explicit simp (#10999)

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

Diff
@@ -560,12 +560,12 @@ theorem contMDiffOn_iff :
     refine' ⟨fun x hx => (h x hx).1, fun x y z hz => _⟩
     simp only [mfld_simps] at hz
     let w := (extChartAt I x).symm z
-    have : w ∈ s := by simp only [hz, mfld_simps]
+    have : w ∈ s := by simp only [w, hz, mfld_simps]
     specialize h w this
-    have w1 : w ∈ (chartAt H x).source := by simp only [hz, mfld_simps]
-    have w2 : f w ∈ (chartAt H' y).source := by simp only [hz, mfld_simps]
+    have w1 : w ∈ (chartAt H x).source := by simp only [w, hz, mfld_simps]
+    have w2 : f w ∈ (chartAt H' y).source := by simp only [w, hz, mfld_simps]
     convert ((contMDiffWithinAt_iff_of_mem_source w1 w2).mp h).2.mono _
-    · simp only [hz, mfld_simps]
+    · simp only [w, hz, mfld_simps]
     · mfld_set_tac
   · rintro ⟨hcont, hdiff⟩ x hx
     refine' (contDiffWithinAt_localInvariantProp I I' n).liftPropWithinAt_iff.mpr _
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
@@ -438,9 +438,9 @@ theorem contMDiffWithinAt_iff_of_mem_source' {x' : M} {y : M'} (hx : x' ∈ (cha
   rw [and_congr_right_iff]
   set e := extChartAt I x; set e' := extChartAt I' (f x)
   refine' fun hc => contDiffWithinAt_congr_nhds _
-  rw [← e.image_source_inter_eq', ← map_extChartAt_nhdsWithin_eq_image' I x hx, ←
-    map_extChartAt_nhdsWithin' I x hx, inter_comm, nhdsWithin_inter_of_mem]
-  exact hc (extChartAt_source_mem_nhds' _ _ hy)
+  rw [← e.image_source_inter_eq', ← map_extChartAt_nhdsWithin_eq_image' I hx, ←
+    map_extChartAt_nhdsWithin' I hx, inter_comm, nhdsWithin_inter_of_mem]
+  exact hc (extChartAt_source_mem_nhds' _ hy)
 #align cont_mdiff_within_at_iff_of_mem_source' contMDiffWithinAt_iff_of_mem_source'
 
 theorem contMDiffAt_iff_of_mem_source {x' : M} {y : M'} (hx : x' ∈ (chartAt H x).source)
@@ -465,7 +465,7 @@ theorem contMDiffWithinAt_iff_target_of_mem_source {x : M} {y : M'}
   simp_rw [StructureGroupoid.liftPropWithinAt_self_target]
   simp_rw [((chartAt H' y).continuousAt hy).comp_continuousWithinAt hf]
   rw [← extChartAt_source I'] at hy
-  simp_rw [(continuousAt_extChartAt' I' _ hy).comp_continuousWithinAt hf]
+  simp_rw [(continuousAt_extChartAt' I' hy).comp_continuousWithinAt hf]
   rfl
 #align cont_mdiff_within_at_iff_target_of_mem_source contMDiffWithinAt_iff_target_of_mem_source
 
chore: last localEquiv -> partialEquiv renames in lemma names (#9620)
Diff
@@ -583,7 +583,7 @@ theorem contMDiffOn_iff_target :
         ∀ y : M',
           ContMDiffOn I 𝓘(𝕜, E') n (extChartAt I' y ∘ f) (s ∩ f ⁻¹' (extChartAt I' y).source) := by
   simp only [contMDiffOn_iff, ModelWithCorners.source_eq, chartAt_self_eq,
-    PartialHomeomorph.refl_localEquiv, PartialEquiv.refl_trans, extChartAt,
+    PartialHomeomorph.refl_partialEquiv, PartialEquiv.refl_trans, extChartAt,
     PartialHomeomorph.extend, Set.preimage_univ, Set.inter_univ, and_congr_right_iff]
   intro h
   constructor
chore(Function): rename some lemmas (#9738)
  • Merge Function.left_id and Function.comp.left_id into Function.id_comp.
  • Merge Function.right_id and Function.comp.right_id into Function.comp_id.
  • Merge Function.comp_const_right and Function.comp_const into Function.comp_const, use explicit arguments.
  • Move Function.const_comp to Mathlib.Init.Function, use explicit arguments.
Diff
@@ -166,7 +166,7 @@ theorem contDiffWithinAtProp_mono_of_mem (n : ℕ∞) ⦃s x t⦄ ⦃f : H → H
 #align cont_diff_within_at_prop_mono_of_mem contDiffWithinAtProp_mono_of_mem
 
 theorem contDiffWithinAtProp_id (x : H) : ContDiffWithinAtProp I I n id univ x := by
-  simp only [ContDiffWithinAtProp._eq_1, comp.left_id, preimage_univ, univ_inter]
+  simp only [ContDiffWithinAtProp, id_comp, preimage_univ, univ_inter]
   have : ContDiffWithinAt 𝕜 n id (range I) (I x) := contDiff_id.contDiffAt.contDiffWithinAt
   refine this.congr (fun y hy => ?_) ?_
   · simp only [ModelWithCorners.right_inv I hy, mfld_simps]
@@ -362,7 +362,7 @@ theorem contMDiffWithinAt_iff_target :
       and_iff_left_of_imp <| (continuousAt_extChartAt _ _).comp_continuousWithinAt
   simp_rw [cont, ContDiffWithinAtProp, extChartAt, PartialHomeomorph.extend, PartialEquiv.coe_trans,
     ModelWithCorners.toPartialEquiv_coe, PartialHomeomorph.coe_coe, modelWithCornersSelf_coe,
-    chartAt_self_eq, PartialHomeomorph.refl_apply, comp.left_id]
+    chartAt_self_eq, PartialHomeomorph.refl_apply, id_comp]
   rfl
 #align cont_mdiff_within_at_iff_target contMDiffWithinAt_iff_target
 
chore(Geometry/Manifold): use dot notation for IsOpen lemmas more (#9567)

While at it, switch from refine' to refine (easy cases only) in the lines I'm touching anyway.

Diff
@@ -124,7 +124,8 @@ theorem contDiffWithinAt_localInvariantProp (n : ℕ∞) :
     symm
     apply contDiffWithinAt_inter
     have : u ∈ 𝓝 (I.symm (I x)) := by
-      rw [ModelWithCorners.left_inv]; exact IsOpen.mem_nhds u_open xu
+      rw [ModelWithCorners.left_inv]
+      exact u_open.mem_nhds xu
     apply ContinuousAt.preimage_mem_nhds I.continuous_symm.continuousAt this
   right_invariance' := by
     intro s x f e he hx h
feat: ContMDiffOn.congr_mono (#9507)

Mirror ContDiffOn.congr_mono.

Diff
@@ -902,6 +902,10 @@ theorem contMDiffOn_congr (h₁ : ∀ y ∈ s, f₁ y = f y) :
   (contDiffWithinAt_localInvariantProp I I' n).liftPropOn_congr_iff h₁
 #align cont_mdiff_on_congr contMDiffOn_congr
 
+theorem ContMDiffOn.congr_mono (hf : ContMDiffOn I I' n f s) (h₁ : ∀ y ∈ s₁, f₁ y = f y)
+    (hs : s₁ ⊆ s) : ContMDiffOn I I' n f₁ s₁ :=
+  (hf.mono hs).congr h₁
+
 /-! ### Locality -/
 
 
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
@@ -359,8 +359,8 @@ theorem contMDiffWithinAt_iff_target :
     ContinuousWithinAt f s x ∧ ContinuousWithinAt (extChartAt I' (f x) ∘ f) s x ↔
         ContinuousWithinAt f s x :=
       and_iff_left_of_imp <| (continuousAt_extChartAt _ _).comp_continuousWithinAt
-  simp_rw [cont, ContDiffWithinAtProp, extChartAt, PartialHomeomorph.extend, LocalEquiv.coe_trans,
-    ModelWithCorners.toLocalEquiv_coe, PartialHomeomorph.coe_coe, modelWithCornersSelf_coe,
+  simp_rw [cont, ContDiffWithinAtProp, extChartAt, PartialHomeomorph.extend, PartialEquiv.coe_trans,
+    ModelWithCorners.toPartialEquiv_coe, PartialHomeomorph.coe_coe, modelWithCornersSelf_coe,
     chartAt_self_eq, PartialHomeomorph.refl_apply, comp.left_id]
   rfl
 #align cont_mdiff_within_at_iff_target contMDiffWithinAt_iff_target
@@ -582,8 +582,8 @@ theorem contMDiffOn_iff_target :
         ∀ y : M',
           ContMDiffOn I 𝓘(𝕜, E') n (extChartAt I' y ∘ f) (s ∩ f ⁻¹' (extChartAt I' y).source) := by
   simp only [contMDiffOn_iff, ModelWithCorners.source_eq, chartAt_self_eq,
-    PartialHomeomorph.refl_localEquiv, LocalEquiv.refl_trans, extChartAt, PartialHomeomorph.extend,
-    Set.preimage_univ, Set.inter_univ, and_congr_right_iff]
+    PartialHomeomorph.refl_localEquiv, PartialEquiv.refl_trans, extChartAt,
+    PartialHomeomorph.extend, Set.preimage_univ, Set.inter_univ, and_congr_right_iff]
   intro h
   constructor
   · refine' fun h' y => ⟨_, fun x _ => h' x y⟩
@@ -838,7 +838,7 @@ theorem contMDiffWithinAt_iff_contMDiffOn_nhds {n : ℕ} :
     have hv₂ : MapsTo f ((extChartAt I x).symm '' v) (extChartAt I' (f x)).source := by
       rintro _ ⟨y, hy, rfl⟩
       exact (hsub hy).2.2
-    rwa [contMDiffOn_iff_of_subset_source' hv₁ hv₂, LocalEquiv.image_symm_image_of_subset_target]
+    rwa [contMDiffOn_iff_of_subset_source' hv₁ hv₂, PartialEquiv.image_symm_image_of_subset_target]
     exact hsub.trans (inter_subset_left _ _)
 #align cont_mdiff_within_at_iff_cont_mdiff_on_nhds contMDiffWithinAt_iff_contMDiffOn_nhds
 
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
@@ -84,8 +84,8 @@ variable {𝕜 : Type*} [NontriviallyNormedField 𝕜]
   [NormedSpace 𝕜 F₂] {F₃ : Type*} [NormedAddCommGroup F₃] [NormedSpace 𝕜 F₃] {F₄ : Type*}
   [NormedAddCommGroup F₄] [NormedSpace 𝕜 F₄]
   -- declare functions, sets, points and smoothness indices
-  {e : LocalHomeomorph M H}
-  {e' : LocalHomeomorph M' H'} {f f₁ : M → M'} {s s₁ t : Set M} {x : M} {m n : ℕ∞}
+  {e : PartialHomeomorph M H}
+  {e' : PartialHomeomorph M' H'} {f f₁ : M → M'} {s s₁ t : Set M} {x : M} {m n : ℕ∞}
 
 /-- Property in the model space of a model with corners of being `C^n` within at set at a point,
 when read in the model vector space. This property will be lifted to manifolds to define smooth
@@ -359,9 +359,9 @@ theorem contMDiffWithinAt_iff_target :
     ContinuousWithinAt f s x ∧ ContinuousWithinAt (extChartAt I' (f x) ∘ f) s x ↔
         ContinuousWithinAt f s x :=
       and_iff_left_of_imp <| (continuousAt_extChartAt _ _).comp_continuousWithinAt
-  simp_rw [cont, ContDiffWithinAtProp, extChartAt, LocalHomeomorph.extend, LocalEquiv.coe_trans,
-    ModelWithCorners.toLocalEquiv_coe, LocalHomeomorph.coe_coe, modelWithCornersSelf_coe,
-    chartAt_self_eq, LocalHomeomorph.refl_apply, comp.left_id]
+  simp_rw [cont, ContDiffWithinAtProp, extChartAt, PartialHomeomorph.extend, LocalEquiv.coe_trans,
+    ModelWithCorners.toLocalEquiv_coe, PartialHomeomorph.coe_coe, modelWithCornersSelf_coe,
+    chartAt_self_eq, PartialHomeomorph.refl_apply, comp.left_id]
   rfl
 #align cont_mdiff_within_at_iff_target contMDiffWithinAt_iff_target
 
@@ -582,7 +582,7 @@ theorem contMDiffOn_iff_target :
         ∀ y : M',
           ContMDiffOn I 𝓘(𝕜, E') n (extChartAt I' y ∘ f) (s ∩ f ⁻¹' (extChartAt I' y).source) := by
   simp only [contMDiffOn_iff, ModelWithCorners.source_eq, chartAt_self_eq,
-    LocalHomeomorph.refl_localEquiv, LocalEquiv.refl_trans, extChartAt, LocalHomeomorph.extend,
+    PartialHomeomorph.refl_localEquiv, LocalEquiv.refl_trans, extChartAt, PartialHomeomorph.extend,
     Set.preimage_univ, Set.inter_univ, and_congr_right_iff]
   intro h
   constructor
chore: rename {LocalHomeomorph,ChartedSpace}.continuous_{to,inv}Fun fields to continuousOn_{to,inv}Fun (#8848)

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

Diff
@@ -588,7 +588,7 @@ theorem contMDiffOn_iff_target :
   constructor
   · refine' fun h' y => ⟨_, fun x _ => h' x y⟩
     have h'' : ContinuousOn _ univ := (ModelWithCorners.continuous I').continuousOn
-    convert (h''.comp' (chartAt H' y).continuous_toFun).comp' h
+    convert (h''.comp' (chartAt H' y).continuousOn_toFun).comp' h
     simp
   · exact fun h' x y => (h' y).2 x 0
 #align cont_mdiff_on_iff_target contMDiffOn_iff_target
chore: split Geometry/Manifold/ContMDiff (#8726)

At about 2200 lines, this is currently the longest file in the Geometry/Manifolds.

(It also moves the slowly compiling proof of ContMDiffWithinAt.cle_arrowCongr out of a common recompilation path.)

chore: bump to v4.3.0-rc2 (#8366)

PR contents

This is the supremum of

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

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

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

Lean PRs involved in this bump

In particular this includes adjustments for the Lean PRs

leanprover/lean4#2778

We can get rid of all the

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

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

leanprover/lean4#2722

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

leanprover/lean4#2783

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

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

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

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

Diff
@@ -2114,7 +2114,7 @@ theorem isLocalStructomorphOn_contDiffGroupoid_iff (f : LocalHomeomorph M M') :
         simp only [hx, h1, mfld_simps]
     have h2X : c' X = e (c (f.symm X)) := by
       rw [← hef hex]
-      dsimp only [Function.comp]
+      dsimp only [Function.comp_def]
       have hfX : f.symm X ∈ c.source := by simp only [hX, mfld_simps]
       rw [c.left_inv hfX, f.right_inv hX]
     have h3e : EqOn (c ∘ f.symm ∘ c'.symm) e.symm (c'.symm ⁻¹' f.target ∩ e.target) := by
chore: remove nonterminal simp (#7580)

Removes nonterminal simps on lines looking like simp [...]

Diff
@@ -164,7 +164,7 @@ theorem contDiffWithinAtProp_mono_of_mem (n : ℕ∞) ⦃s x t⦄ ⦃f : H → H
 #align cont_diff_within_at_prop_mono_of_mem contDiffWithinAtProp_mono_of_mem
 
 theorem contDiffWithinAtProp_id (x : H) : ContDiffWithinAtProp I I n id univ x := by
-  simp [ContDiffWithinAtProp]
+  simp only [ContDiffWithinAtProp._eq_1, comp.left_id, preimage_univ, univ_inter]
   have : ContDiffWithinAt 𝕜 n id (range I) (I x) := contDiff_id.contDiffAt.contDiffWithinAt
   refine this.congr (fun y hy => ?_) ?_
   · simp only [ModelWithCorners.right_inv I hy, mfld_simps]
chore: missing spaces after rcases, convert and congrm (#7725)

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

Diff
@@ -587,7 +587,7 @@ theorem contMDiffOn_iff_target :
   constructor
   · refine' fun h' y => ⟨_, fun x _ => h' x y⟩
     have h'' : ContinuousOn _ univ := (ModelWithCorners.continuous I').continuousOn
-    convert(h''.comp' (chartAt H' y).continuous_toFun).comp' h
+    convert (h''.comp' (chartAt H' y).continuous_toFun).comp' h
     simp
   · exact fun h' x y => (h' y).2 x 0
 #align cont_mdiff_on_iff_target contMDiffOn_iff_target
chore: remove trailing space in backticks (#7617)

This will improve spaces in the mathlib4 docs.

Diff
@@ -16,7 +16,7 @@ basic properties of these notions.
 
 ## Main definitions and statements
 
-Let `M ` and `M'` be two smooth manifolds, with respect to model with corners `I` and `I'`. Let
+Let `M` and `M'` be two smooth manifolds, with respect to model with corners `I` and `I'`. Let
 `f : M → M'`.
 
 * `ContMDiffWithinAt I I' n f s x` states that the function `f` is `Cⁿ` within the set `s`
chore: Make Set/Finset lemmas match lattice lemma names (#7378)

Rename union_eq_left_iff_subset to union_eq_left to match sup_eq_left. Similarly for the right and inter versions.

Diff
@@ -2121,13 +2121,13 @@ theorem isLocalStructomorphOn_contDiffGroupoid_iff (f : LocalHomeomorph M M') :
       have h1 : EqOn (c.symm ≫ₕ f ≫ₕ c').symm e.symm (e.target ∩ e.target) := by
         apply EqOn.symm
         refine' e.isImage_source_target.symm_eqOn_of_inter_eq_of_eqOn _ _
-        · rw [inter_self, inter_eq_right_iff_subset.mpr h2e]
+        · rw [inter_self, inter_eq_right.mpr h2e]
         · rw [inter_self]; exact hef.symm
       have h2 : e.target ⊆ (c.symm ≫ₕ f ≫ₕ c').target := by
         intro x hx; rw [← e.right_inv hx, ← hef (e.symm.mapsTo hx)]
         exact LocalHomeomorph.mapsTo _ (h2e <| e.symm.mapsTo hx)
       rw [inter_self] at h1
-      rwa [inter_eq_right_iff_subset.mpr]
+      rwa [inter_eq_right.mpr]
       refine' h2.trans _
       mfld_set_tac
     refine' ⟨e.symm, StructureGroupoid.symm _ he, h3e, _⟩
chore: update/remove heart beat bumps (#6860)

We clean up heart beat bumps after #6474.

Diff
@@ -1869,7 +1869,6 @@ theorem ContMDiff.clm_apply {g : M → F₁ →L[𝕜] F₂} {f : M → F₁}
 #align cont_mdiff.clm_apply ContMDiff.clm_apply
 
 -- porting note: Lean 3 code didn't need `@`
-set_option maxHeartbeats 400000 in
 theorem ContMDiffWithinAt.clm_precomp {f : M → F₁ →L[𝕜] F₂} {s : Set M} {x : M}
     (hf : ContMDiffWithinAt I 𝓘(𝕜, F₁ →L[𝕜] F₂) n f s x) :
     ContMDiffWithinAt I 𝓘(𝕜, (F₂ →L[𝕜] F₃) →L[𝕜] (F₁ →L[𝕜] F₃)) n
@@ -1896,7 +1895,6 @@ theorem ContMDiff.clm_precomp {f : M → F₁ →L[𝕜] F₂} (hf : ContMDiff I
   (hf x).clm_precomp
 
 -- porting note: Lean 3 code didn't need `@`
-set_option maxHeartbeats 400000 in
 theorem ContMDiffWithinAt.clm_postcomp {f : M → F₂ →L[𝕜] F₃} {s : Set M} {x : M}
     (hf : ContMDiffWithinAt I 𝓘(𝕜, F₂ →L[𝕜] F₃) n f s x) :
     ContMDiffWithinAt I 𝓘(𝕜, (F₁ →L[𝕜] F₂) →L[𝕜] (F₁ →L[𝕜] F₃)) n
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
@@ -1642,7 +1642,7 @@ end Projections
 theorem contMDiffWithinAt_prod_iff (f : M → M' × N') {s : Set M} {x : M} :
     ContMDiffWithinAt I (I'.prod J') n f s x ↔
       ContMDiffWithinAt I I' n (Prod.fst ∘ f) s x ∧ ContMDiffWithinAt I J' n (Prod.snd ∘ f) s x :=
-  by refine' ⟨fun h => ⟨h.fst, h.snd⟩, fun h => _⟩; simpa only [Prod.mk.eta] using h.1.prod_mk h.2
+  ⟨fun h => ⟨h.fst, h.snd⟩, fun h => h.1.prod_mk h.2⟩
 #align cont_mdiff_within_at_prod_iff contMDiffWithinAt_prod_iff
 
 theorem contMDiffAt_prod_iff (f : M → M' × N') {x : M} :
feat: patch for new alias command (#6172)
Diff
@@ -740,7 +740,7 @@ theorem contMDiffWithinAt_insert_self :
   refine Iff.rfl.and <| (contDiffWithinAt_congr_nhds ?_).trans contDiffWithinAt_insert_self
   simp only [← map_extChartAt_nhdsWithin I, nhdsWithin_insert, Filter.map_sup, Filter.map_pure]
 
-alias contMDiffWithinAt_insert_self ↔ ContMDiffWithinAt.of_insert _
+alias ⟨ContMDiffWithinAt.of_insert, _⟩ := contMDiffWithinAt_insert_self
 
 -- TODO: use `alias` again once it can make protected theorems
 theorem ContMDiffWithinAt.insert (h : ContMDiffWithinAt I I' n f s x) :
@@ -1341,8 +1341,8 @@ theorem contMDiffWithinAt_iff_contDiffWithinAt {f : E → E'} {s : Set E} {x : E
   exact ContDiffWithinAt.continuousWithinAt
 #align cont_mdiff_within_at_iff_cont_diff_within_at contMDiffWithinAt_iff_contDiffWithinAt
 
-alias contMDiffWithinAt_iff_contDiffWithinAt ↔
-  ContMDiffWithinAt.contDiffWithinAt ContDiffWithinAt.contMDiffWithinAt
+alias ⟨ContMDiffWithinAt.contDiffWithinAt, ContDiffWithinAt.contMDiffWithinAt⟩ :=
+  contMDiffWithinAt_iff_contDiffWithinAt
 #align cont_mdiff_within_at.cont_diff_within_at ContMDiffWithinAt.contDiffWithinAt
 #align cont_diff_within_at.cont_mdiff_within_at ContDiffWithinAt.contMDiffWithinAt
 
@@ -1351,7 +1351,7 @@ theorem contMDiffAt_iff_contDiffAt {f : E → E'} {x : E} :
   rw [← contMDiffWithinAt_univ, contMDiffWithinAt_iff_contDiffWithinAt, contDiffWithinAt_univ]
 #align cont_mdiff_at_iff_cont_diff_at contMDiffAt_iff_contDiffAt
 
-alias contMDiffAt_iff_contDiffAt ↔ ContMDiffAt.contDiffAt ContDiffAt.contMDiffAt
+alias ⟨ContMDiffAt.contDiffAt, ContDiffAt.contMDiffAt⟩ := contMDiffAt_iff_contDiffAt
 #align cont_mdiff_at.cont_diff_at ContMDiffAt.contDiffAt
 #align cont_diff_at.cont_mdiff_at ContDiffAt.contMDiffAt
 
@@ -1360,7 +1360,7 @@ theorem contMDiffOn_iff_contDiffOn {f : E → E'} {s : Set E} :
   forall_congr' <| by simp [contMDiffWithinAt_iff_contDiffWithinAt]
 #align cont_mdiff_on_iff_cont_diff_on contMDiffOn_iff_contDiffOn
 
-alias contMDiffOn_iff_contDiffOn ↔ ContMDiffOn.contDiffOn ContDiffOn.contMDiffOn
+alias ⟨ContMDiffOn.contDiffOn, ContDiffOn.contMDiffOn⟩ := contMDiffOn_iff_contDiffOn
 #align cont_mdiff_on.cont_diff_on ContMDiffOn.contDiffOn
 #align cont_diff_on.cont_mdiff_on ContDiffOn.contMDiffOn
 
@@ -1368,7 +1368,7 @@ theorem contMDiff_iff_contDiff {f : E → E'} : ContMDiff 𝓘(𝕜, E) 𝓘(
   rw [← contDiffOn_univ, ← contMDiffOn_univ, contMDiffOn_iff_contDiffOn]
 #align cont_mdiff_iff_cont_diff contMDiff_iff_contDiff
 
-alias contMDiff_iff_contDiff ↔ ContMDiff.contDiff ContDiff.contMDiff
+alias ⟨ContMDiff.contDiff, ContDiff.contMDiff⟩ := contMDiff_iff_contDiff
 #align cont_mdiff.cont_diff ContMDiff.contDiff
 #align cont_diff.cont_mdiff ContDiff.contMDiff
 
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
@@ -52,35 +52,35 @@ open scoped Topology Manifold
 /-! ### Definition of smooth functions between manifolds -/
 
 
-variable {𝕜 : Type _} [NontriviallyNormedField 𝕜]
+variable {𝕜 : Type*} [NontriviallyNormedField 𝕜]
   -- declare a smooth manifold `M` over the pair `(E, H)`.
-  {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]
   [SmoothManifoldWithCorners I M]
   -- declare a smooth manifold `M'` over the pair `(E', H')`.
-  {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']
   [SmoothManifoldWithCorners I' M']
   -- declare a manifold `M''` over the pair `(E'', H'')`.
-  {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'']
   -- declare a smooth manifold `N` over the pair `(F, G)`.
-  {F : Type _}
-  [NormedAddCommGroup F] [NormedSpace 𝕜 F] {G : Type _} [TopologicalSpace G]
-  {J : ModelWithCorners 𝕜 F G} {N : Type _} [TopologicalSpace N] [ChartedSpace G N]
+  {F : Type*}
+  [NormedAddCommGroup F] [NormedSpace 𝕜 F] {G : Type*} [TopologicalSpace G]
+  {J : ModelWithCorners 𝕜 F G} {N : Type*} [TopologicalSpace N] [ChartedSpace G N]
   [SmoothManifoldWithCorners J N]
   -- declare a smooth manifold `N'` over the pair `(F', G')`.
-  {F' : Type _}
-  [NormedAddCommGroup F'] [NormedSpace 𝕜 F'] {G' : Type _} [TopologicalSpace G']
-  {J' : ModelWithCorners 𝕜 F' G'} {N' : Type _} [TopologicalSpace N'] [ChartedSpace G' N']
+  {F' : Type*}
+  [NormedAddCommGroup F'] [NormedSpace 𝕜 F'] {G' : Type*} [TopologicalSpace G']
+  {J' : ModelWithCorners 𝕜 F' G'} {N' : Type*} [TopologicalSpace N'] [ChartedSpace G' N']
   [SmoothManifoldWithCorners J' N']
   -- F₁, F₂, F₃, F₄ are normed spaces
-  {F₁ : Type _}
-  [NormedAddCommGroup F₁] [NormedSpace 𝕜 F₁] {F₂ : Type _} [NormedAddCommGroup F₂]
-  [NormedSpace 𝕜 F₂] {F₃ : Type _} [NormedAddCommGroup F₃] [NormedSpace 𝕜 F₃] {F₄ : Type _}
+  {F₁ : Type*}
+  [NormedAddCommGroup F₁] [NormedSpace 𝕜 F₁] {F₂ : Type*} [NormedAddCommGroup F₂]
+  [NormedSpace 𝕜 F₂] {F₃ : Type*} [NormedAddCommGroup F₃] [NormedSpace 𝕜 F₃] {F₄ : Type*}
   [NormedAddCommGroup F₄] [NormedSpace 𝕜 F₄]
   -- declare functions, sets, points and smoothness indices
   {e : LocalHomeomorph M H}
@@ -1749,7 +1749,7 @@ use `𝓘(𝕜, Π i, F i)` as the model space.
 -/
 
 
-variable {ι : Type _} [Fintype ι] {Fi : ι → Type _} [∀ i, NormedAddCommGroup (Fi i)]
+variable {ι : Type*} [Fintype ι] {Fi : ι → Type*} [∀ i, NormedAddCommGroup (Fi i)]
   [∀ i, NormedSpace 𝕜 (Fi i)] {φ : M → ∀ i, Fi i}
 
 theorem contMDiffWithinAt_pi_space :
@@ -1984,7 +1984,7 @@ theorem ContMDiff.clm_prodMap {g : M → F₁ →L[𝕜] F₃} {f : M → F₂ 
 
 /-! ### Smoothness of standard operations -/
 
-variable {V : Type _} [NormedAddCommGroup V] [NormedSpace 𝕜 V]
+variable {V : Type*} [NormedAddCommGroup V] [NormedSpace 𝕜 V]
 
 /-- On any vector space, multiplication by a scalar is a smooth operation. -/
 theorem smooth_smul : Smooth (𝓘(𝕜).prod 𝓘(𝕜, V)) 𝓘(𝕜, V) fun p : 𝕜 × V => p.1 • p.2 :=
feat: groups with zero with a smooth division away from zero (#6069)

We have currently (additive or multiplicative) Lie groups but no typeclass to express that division is smooth away from zero in fields. This PR adds such a typeclass, modelled on the one we already have in topological spaces.

Diff
@@ -238,33 +238,51 @@ def Smooth (f : M → M') :=
   ContMDiff I I' ⊤ f
 #align smooth Smooth
 
-/-! ### Basic properties of smooth functions between manifolds -/
+variable {I I'}
 
+/-! ### Deducing smoothness from higher smoothness -/
 
-variable {I I'}
+theorem ContMDiffWithinAt.of_le (hf : ContMDiffWithinAt I I' n f s x) (le : m ≤ n) :
+    ContMDiffWithinAt I I' m f s x :=
+  ⟨hf.1, hf.2.of_le le⟩
+#align cont_mdiff_within_at.of_le ContMDiffWithinAt.of_le
+
+theorem ContMDiffAt.of_le (hf : ContMDiffAt I I' n f x) (le : m ≤ n) : ContMDiffAt I I' m f x :=
+  ContMDiffWithinAt.of_le hf le
+#align cont_mdiff_at.of_le ContMDiffAt.of_le
+
+theorem ContMDiffOn.of_le (hf : ContMDiffOn I I' n f s) (le : m ≤ n) : ContMDiffOn I I' m f s :=
+  fun x hx => (hf x hx).of_le le
+#align cont_mdiff_on.of_le ContMDiffOn.of_le
+
+theorem ContMDiff.of_le (hf : ContMDiff I I' n f) (le : m ≤ n) : ContMDiff I I' m f := fun x =>
+  (hf x).of_le le
+#align cont_mdiff.of_le ContMDiff.of_le
+
+/-! ### Basic properties of smooth functions between manifolds -/
 
 theorem ContMDiff.smooth (h : ContMDiff I I' ⊤ f) : Smooth I I' f :=
   h
 #align cont_mdiff.smooth ContMDiff.smooth
 
-theorem Smooth.contMDiff (h : Smooth I I' f) : ContMDiff I I' ⊤ f :=
-  h
+theorem Smooth.contMDiff (h : Smooth I I' f) : ContMDiff I I' n f :=
+  h.of_le le_top
 #align smooth.cont_mdiff Smooth.contMDiff
 
 theorem ContMDiffOn.smoothOn (h : ContMDiffOn I I' ⊤ f s) : SmoothOn I I' f s :=
   h
 #align cont_mdiff_on.smooth_on ContMDiffOn.smoothOn
 
-theorem SmoothOn.contMDiffOn (h : SmoothOn I I' f s) : ContMDiffOn I I' ⊤ f s :=
-  h
+theorem SmoothOn.contMDiffOn (h : SmoothOn I I' f s) : ContMDiffOn I I' n f s :=
+  h.of_le le_top
 #align smooth_on.cont_mdiff_on SmoothOn.contMDiffOn
 
 theorem ContMDiffAt.smoothAt (h : ContMDiffAt I I' ⊤ f x) : SmoothAt I I' f x :=
   h
 #align cont_mdiff_at.smooth_at ContMDiffAt.smoothAt
 
-theorem SmoothAt.contMDiffAt (h : SmoothAt I I' f x) : ContMDiffAt I I' ⊤ f x :=
-  h
+theorem SmoothAt.contMDiffAt (h : SmoothAt I I' f x) : ContMDiffAt I I' n f x :=
+  h.of_le le_top
 #align smooth_at.cont_mdiff_at SmoothAt.contMDiffAt
 
 theorem ContMDiffWithinAt.smoothWithinAt (h : ContMDiffWithinAt I I' ⊤ f s x) :
@@ -273,8 +291,8 @@ theorem ContMDiffWithinAt.smoothWithinAt (h : ContMDiffWithinAt I I' ⊤ f s x)
 #align cont_mdiff_within_at.smooth_within_at ContMDiffWithinAt.smoothWithinAt
 
 theorem SmoothWithinAt.contMDiffWithinAt (h : SmoothWithinAt I I' f s x) :
-    ContMDiffWithinAt I I' ⊤ f s x :=
-  h
+    ContMDiffWithinAt I I' n f s x :=
+  h.of_le le_top
 #align smooth_within_at.cont_mdiff_within_at SmoothWithinAt.contMDiffWithinAt
 
 theorem ContMDiff.contMDiffAt (h : ContMDiff I I' n f) : ContMDiffAt I I' n f x :=
@@ -629,25 +647,6 @@ theorem smooth_iff_target :
   contMDiff_iff_target
 #align smooth_iff_target smooth_iff_target
 
-/-! ### Deducing smoothness from higher smoothness -/
-
-theorem ContMDiffWithinAt.of_le (hf : ContMDiffWithinAt I I' n f s x) (le : m ≤ n) :
-    ContMDiffWithinAt I I' m f s x :=
-  ⟨hf.1, hf.2.of_le le⟩
-#align cont_mdiff_within_at.of_le ContMDiffWithinAt.of_le
-
-theorem ContMDiffAt.of_le (hf : ContMDiffAt I I' n f x) (le : m ≤ n) : ContMDiffAt I I' m f x :=
-  ContMDiffWithinAt.of_le hf le
-#align cont_mdiff_at.of_le ContMDiffAt.of_le
-
-theorem ContMDiffOn.of_le (hf : ContMDiffOn I I' n f s) (le : m ≤ n) : ContMDiffOn I I' m f s :=
-  fun x hx => (hf x hx).of_le le
-#align cont_mdiff_on.of_le ContMDiffOn.of_le
-
-theorem ContMDiff.of_le (hf : ContMDiff I I' n f) (le : m ≤ n) : ContMDiff I I' m f := fun x =>
-  (hf x).of_le le
-#align cont_mdiff.of_le ContMDiff.of_le
-
 /-! ### Deducing smoothness from smoothness one step beyond -/
 
 
@@ -2178,4 +2177,3 @@ theorem isLocalStructomorphOn_contDiffGroupoid_iff (f : LocalHomeomorph M M') :
 #align is_local_structomorph_on_cont_diff_groupoid_iff isLocalStructomorphOn_contDiffGroupoid_iff
 
 end
-
chore(*): add protected to *.insert theorems (#6142)

Otherwise code like

theorem ContMDiffWithinAt.mythm (h : x ∈ insert y s) : _ = _

interprets insert as ContMDiffWithinAt.insert, not Insert.insert.

Diff
@@ -741,7 +741,12 @@ theorem contMDiffWithinAt_insert_self :
   refine Iff.rfl.and <| (contDiffWithinAt_congr_nhds ?_).trans contDiffWithinAt_insert_self
   simp only [← map_extChartAt_nhdsWithin I, nhdsWithin_insert, Filter.map_sup, Filter.map_pure]
 
-alias contMDiffWithinAt_insert_self ↔ ContMDiffWithinAt.of_insert ContMDiffWithinAt.insert
+alias contMDiffWithinAt_insert_self ↔ ContMDiffWithinAt.of_insert _
+
+-- TODO: use `alias` again once it can make protected theorems
+theorem ContMDiffWithinAt.insert (h : ContMDiffWithinAt I I' n f s x) :
+    ContMDiffWithinAt I I' n f (insert x s) x :=
+  contMDiffWithinAt_insert_self.2 h
 
 theorem ContMDiffAt.contMDiffWithinAt (hf : ContMDiffAt I I' n f x) :
     ContMDiffWithinAt I I' n f s x :=
chore: script to replace headers with #align_import statements (#5979)

Open in Gitpod

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

Diff
@@ -2,15 +2,12 @@
 Copyright (c) 2020 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.cont_mdiff
-! leanprover-community/mathlib commit e5ab837fc252451f3eb9124ae6e7b6f57455e7b9
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Geometry.Manifold.SmoothManifoldWithCorners
 import Mathlib.Geometry.Manifold.LocalInvariantProperties
 
+#align_import geometry.manifold.cont_mdiff from "leanprover-community/mathlib"@"e5ab837fc252451f3eb9124ae6e7b6f57455e7b9"
+
 /-!
 # Smooth functions between smooth manifolds
 
feat: port Geometry.Manifold.VectorBundle.Hom (#5727)
Diff
@@ -1377,11 +1377,25 @@ theorem ContDiffWithinAt.comp_contMDiffWithinAt {g : F → F'} {f : M → F} {s
   hg.contMDiffWithinAt.comp x hf h
 #align cont_diff_within_at.comp_cont_mdiff_within_at ContDiffWithinAt.comp_contMDiffWithinAt
 
+theorem ContDiffAt.comp_contMDiffWithinAt {g : F → F'} {f : M → F} {s : Set M}
+    {x : M} (hg : ContDiffAt 𝕜 n g (f x)) (hf : ContMDiffWithinAt I 𝓘(𝕜, F) n f s x) :
+    ContMDiffWithinAt I 𝓘(𝕜, F') n (g ∘ f) s x :=
+  hg.contMDiffAt.comp_contMDiffWithinAt x hf
+
 theorem ContDiffAt.comp_contMDiffAt {g : F → F'} {f : M → F} {x : M} (hg : ContDiffAt 𝕜 n g (f x))
     (hf : ContMDiffAt I 𝓘(𝕜, F) n f x) : ContMDiffAt I 𝓘(𝕜, F') n (g ∘ f) x :=
-  hg.comp_contMDiffWithinAt hf Subset.rfl
+  hg.comp_contMDiffWithinAt hf
 #align cont_diff_at.comp_cont_mdiff_at ContDiffAt.comp_contMDiffAt
 
+theorem ContDiff.comp_contMDiffWithinAt {g : F → F'} {f : M → F} {s : Set M} {x : M}
+    (hg : ContDiff 𝕜 n g) (hf : ContMDiffWithinAt I 𝓘(𝕜, F) n f s x) :
+    ContMDiffWithinAt I 𝓘(𝕜, F') n (g ∘ f) s x :=
+  hg.contDiffAt.comp_contMDiffWithinAt hf
+
+theorem ContDiff.comp_contMDiffAt {g : F → F'} {f : M → F} {x : M} (hg : ContDiff 𝕜 n g)
+    (hf : ContMDiffAt I 𝓘(𝕜, F) n f x) : ContMDiffAt I 𝓘(𝕜, F') n (g ∘ f) x :=
+  hg.comp_contMDiffWithinAt hf
+
 theorem ContDiff.comp_contMDiff {g : F → F'} {f : M → F} (hg : ContDiff 𝕜 n g)
     (hf : ContMDiff I 𝓘(𝕜, F) n f) : ContMDiff I 𝓘(𝕜, F') n (g ∘ f) := fun x =>
   hg.contDiffAt.comp_contMDiffAt (hf x)
@@ -1790,14 +1804,24 @@ theorem ContinuousLinearMap.contMDiff (L : E →L[𝕜] F) : ContMDiff 𝓘(𝕜
   L.contDiff.contMDiff
 #align continuous_linear_map.cont_mdiff ContinuousLinearMap.contMDiff
 
+theorem ContinuousLinearMap.contMDiffAt (L : E →L[𝕜] F) {x} : ContMDiffAt 𝓘(𝕜, E) 𝓘(𝕜, F) n L x :=
+  L.contMDiff _
+
+theorem ContinuousLinearMap.contMDiffWithinAt (L : E →L[𝕜] F) {s x} :
+    ContMDiffWithinAt 𝓘(𝕜, E) 𝓘(𝕜, F) n L s x :=
+  L.contMDiffAt.contMDiffWithinAt
+
+theorem ContinuousLinearMap.contMDiffOn (L : E →L[𝕜] F) {s} : ContMDiffOn 𝓘(𝕜, E) 𝓘(𝕜, F) n L s :=
+  L.contMDiff.contMDiffOn
+
+theorem ContinuousLinearMap.smooth (L : E →L[𝕜] F) : Smooth 𝓘(𝕜, E) 𝓘(𝕜, F) L := L.contMDiff
+
 theorem ContMDiffWithinAt.clm_comp {g : M → F₁ →L[𝕜] F₃} {f : M → F₂ →L[𝕜] F₁} {s : Set M} {x : M}
     (hg : ContMDiffWithinAt I 𝓘(𝕜, F₁ →L[𝕜] F₃) n g s x)
     (hf : ContMDiffWithinAt I 𝓘(𝕜, F₂ →L[𝕜] F₁) n f s x) :
     ContMDiffWithinAt I 𝓘(𝕜, F₂ →L[𝕜] F₃) n (fun x => (g x).comp (f x)) s x :=
-  @ContDiffWithinAt.comp_contMDiffWithinAt _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
-    (fun x : (F₁ →L[𝕜] F₃) × (F₂ →L[𝕜] F₁) => x.1.comp x.2) (fun x => (g x, f x)) s _ x
-    (by apply ContDiff.contDiffAt; exact contDiff_fst.clm_comp contDiff_snd) (hg.prod_mk_space hf)
-    (by simp_rw [preimage_univ, subset_univ])
+  ContDiff.comp_contMDiffWithinAt (g := fun x : (F₁ →L[𝕜] F₃) × (F₂ →L[𝕜] F₁) => x.1.comp x.2)
+    (f := fun x => (g x, f x)) (contDiff_fst.clm_comp contDiff_snd) (hg.prod_mk_space hf)
 #align cont_mdiff_within_at.clm_comp ContMDiffWithinAt.clm_comp
 
 theorem ContMDiffAt.clm_comp {g : M → F₁ →L[𝕜] F₃} {f : M → F₂ →L[𝕜] F₁} {x : M}
@@ -1827,10 +1851,10 @@ theorem ContMDiffWithinAt.clm_apply {g : M → F₁ →L[𝕜] F₂} {f : M →
     (by simp_rw [preimage_univ, subset_univ])
 #align cont_mdiff_within_at.clm_apply ContMDiffWithinAt.clm_apply
 
-theorem ContMDiffAt.clm_apply {g : M → F₁ →L[𝕜] F₂} {f : M → F₁} {x : M}
+nonrec theorem ContMDiffAt.clm_apply {g : M → F₁ →L[𝕜] F₂} {f : M → F₁} {x : M}
     (hg : ContMDiffAt I 𝓘(𝕜, F₁ →L[𝕜] F₂) n g x) (hf : ContMDiffAt I 𝓘(𝕜, F₁) n f x) :
     ContMDiffAt I 𝓘(𝕜, F₂) n (fun x => g x (f x)) x :=
-  (hg.contMDiffWithinAt.clm_apply hf.contMDiffWithinAt).contMDiffAt univ_mem
+  hg.clm_apply hf
 #align cont_mdiff_at.clm_apply ContMDiffAt.clm_apply
 
 theorem ContMDiffOn.clm_apply {g : M → F₁ →L[𝕜] F₂} {f : M → F₁} {s : Set M}
@@ -1843,22 +1867,106 @@ theorem ContMDiff.clm_apply {g : M → F₁ →L[𝕜] F₂} {f : M → F₁}
     ContMDiff I 𝓘(𝕜, F₂) n fun x => g x (f x) := fun x => (hg x).clm_apply (hf x)
 #align cont_mdiff.clm_apply ContMDiff.clm_apply
 
+-- porting note: Lean 3 code didn't need `@`
+set_option maxHeartbeats 400000 in
+theorem ContMDiffWithinAt.clm_precomp {f : M → F₁ →L[𝕜] F₂} {s : Set M} {x : M}
+    (hf : ContMDiffWithinAt I 𝓘(𝕜, F₁ →L[𝕜] F₂) n f s x) :
+    ContMDiffWithinAt I 𝓘(𝕜, (F₂ →L[𝕜] F₃) →L[𝕜] (F₁ →L[𝕜] F₃)) n
+      (fun y ↦ (f y).precomp F₃ : M → (F₂ →L[𝕜] F₃) →L[𝕜] (F₁ →L[𝕜] F₃)) s x :=
+  @ContDiff.comp_contMDiffWithinAt 𝕜 _ E _ _ H _ I M _ _ (F₁ →L[𝕜] F₂) _ _
+    ((F₂ →L[𝕜] F₃) →L[𝕜] (F₁ →L[𝕜] F₃)) _ _ n (ContinuousLinearMap.compL 𝕜 F₁ F₂ F₃).flip f s x
+    (ContinuousLinearMap.compL 𝕜 F₁ F₂ F₃).flip.contDiff hf
+
+nonrec theorem ContMDiffAt.clm_precomp {f : M → F₁ →L[𝕜] F₂} {x : M}
+    (hf : ContMDiffAt I 𝓘(𝕜, F₁ →L[𝕜] F₂) n f x) :
+    ContMDiffAt I 𝓘(𝕜, (F₂ →L[𝕜] F₃) →L[𝕜] (F₁ →L[𝕜] F₃)) n
+      (fun y ↦ (f y).precomp F₃ : M → (F₂ →L[𝕜] F₃) →L[𝕜] (F₁ →L[𝕜] F₃)) x :=
+  hf.clm_precomp
+
+theorem ContMDiffOn.clm_precomp {f : M → F₁ →L[𝕜] F₂} {s : Set M}
+    (hf : ContMDiffOn I 𝓘(𝕜, F₁ →L[𝕜] F₂) n f s) :
+    ContMDiffOn I 𝓘(𝕜, (F₂ →L[𝕜] F₃) →L[𝕜] (F₁ →L[𝕜] F₃)) n
+      (fun y ↦ (f y).precomp F₃ : M → (F₂ →L[𝕜] F₃) →L[𝕜] (F₁ →L[𝕜] F₃)) s := fun x hx ↦
+  (hf x hx).clm_precomp
+
+theorem ContMDiff.clm_precomp {f : M → F₁ →L[𝕜] F₂} (hf : ContMDiff I 𝓘(𝕜, F₁ →L[𝕜] F₂) n f) :
+    ContMDiff I 𝓘(𝕜, (F₂ →L[𝕜] F₃) →L[𝕜] (F₁ →L[𝕜] F₃)) n
+      (fun y ↦ (f y).precomp F₃ : M → (F₂ →L[𝕜] F₃) →L[𝕜] (F₁ →L[𝕜] F₃)) := fun x ↦
+  (hf x).clm_precomp
+
+-- porting note: Lean 3 code didn't need `@`
+set_option maxHeartbeats 400000 in
+theorem ContMDiffWithinAt.clm_postcomp {f : M → F₂ →L[𝕜] F₃} {s : Set M} {x : M}
+    (hf : ContMDiffWithinAt I 𝓘(𝕜, F₂ →L[𝕜] F₃) n f s x) :
+    ContMDiffWithinAt I 𝓘(𝕜, (F₁ →L[𝕜] F₂) →L[𝕜] (F₁ →L[𝕜] F₃)) n
+      (fun y ↦ (f y).postcomp F₁ : M → (F₁ →L[𝕜] F₂) →L[𝕜] (F₁ →L[𝕜] F₃)) s x :=
+  @ContDiff.comp_contMDiffWithinAt 𝕜 _ E _ _ H _ I M _ _ (F₂ →L[𝕜] F₃) _ _
+    ((F₁ →L[𝕜] F₂) →L[𝕜] (F₁ →L[𝕜] F₃)) _ _ n (ContinuousLinearMap.compL 𝕜 F₁ F₂ F₃) f s x
+    (ContinuousLinearMap.compL 𝕜 F₁ F₂ F₃).contDiff hf
+
+nonrec theorem ContMDiffAt.clm_postcomp {f : M → F₂ →L[𝕜] F₃} {x : M}
+    (hf : ContMDiffAt I 𝓘(𝕜, F₂ →L[𝕜] F₃) n f x) :
+    ContMDiffAt I 𝓘(𝕜, (F₁ →L[𝕜] F₂) →L[𝕜] (F₁ →L[𝕜] F₃)) n
+      (fun y ↦ (f y).postcomp F₁ : M → (F₁ →L[𝕜] F₂) →L[𝕜] (F₁ →L[𝕜] F₃)) x :=
+  hf.clm_postcomp
+
+nonrec theorem ContMDiffOn.clm_postcomp {f : M → F₂ →L[𝕜] F₃} {s : Set M}
+    (hf : ContMDiffOn I 𝓘(𝕜, F₂ →L[𝕜] F₃) n f s) :
+    ContMDiffOn I 𝓘(𝕜, (F₁ →L[𝕜] F₂) →L[𝕜] (F₁ →L[𝕜] F₃)) n
+      (fun y ↦ (f y).postcomp F₁ : M → (F₁ →L[𝕜] F₂) →L[𝕜] (F₁ →L[𝕜] F₃)) s := fun x hx ↦
+  (hf x hx).clm_postcomp
+
+theorem ContMDiff.clm_postcomp {f : M → F₂ →L[𝕜] F₃} (hf : ContMDiff I 𝓘(𝕜, F₂ →L[𝕜] F₃) n f) :
+    ContMDiff I 𝓘(𝕜, (F₁ →L[𝕜] F₂) →L[𝕜] (F₁ →L[𝕜] F₃)) n
+      (fun y ↦ (f y).postcomp F₁ : M → (F₁ →L[𝕜] F₂) →L[𝕜] (F₁ →L[𝕜] F₃)) := fun x ↦
+  (hf x).clm_postcomp
+
+-- porting note: Lean 3 code didn't need `@`
+set_option maxHeartbeats 400000 in
+theorem ContMDiffWithinAt.cle_arrowCongr {f : M → F₁ ≃L[𝕜] F₂} {g : M → F₃ ≃L[𝕜] F₄}
+    {s : Set M} {x : M}
+    (hf : ContMDiffWithinAt I 𝓘(𝕜, F₂ →L[𝕜] F₁) n (fun x ↦ ((f x).symm : F₂ →L[𝕜] F₁)) s x)
+    (hg : ContMDiffWithinAt I 𝓘(𝕜, F₃ →L[𝕜] F₄) n (fun x ↦ (g x : F₃ →L[𝕜] F₄)) s x) :
+    ContMDiffWithinAt I 𝓘(𝕜, (F₁ →L[𝕜] F₃) →L[𝕜] (F₂ →L[𝕜] F₄)) n
+      (fun y ↦ (f y).arrowCongr (g y) : M → (F₁ →L[𝕜] F₃) →L[𝕜] (F₂ →L[𝕜] F₄)) s x :=
+  show ContMDiffWithinAt I 𝓘(𝕜, (F₁ →L[𝕜] F₃) →L[𝕜] (F₂ →L[𝕜] F₄)) n
+    (fun y ↦ (((f y).symm : F₂ →L[𝕜] F₁).precomp F₄).comp ((g y : F₃ →L[𝕜] F₄).postcomp F₁)) s x
+  from hf.clm_precomp.clm_comp hg.clm_postcomp
+
+nonrec theorem ContMDiffAt.cle_arrowCongr {f : M → F₁ ≃L[𝕜] F₂} {g : M → F₃ ≃L[𝕜] F₄} {x : M}
+    (hf : ContMDiffAt I 𝓘(𝕜, F₂ →L[𝕜] F₁) n (fun x ↦ ((f x).symm : F₂ →L[𝕜] F₁)) x)
+    (hg : ContMDiffAt I 𝓘(𝕜, F₃ →L[𝕜] F₄) n (fun x ↦ (g x : F₃ →L[𝕜] F₄)) x) :
+    ContMDiffAt I 𝓘(𝕜, (F₁ →L[𝕜] F₃) →L[𝕜] (F₂ →L[𝕜] F₄)) n
+      (fun y ↦ (f y).arrowCongr (g y) : M → (F₁ →L[𝕜] F₃) →L[𝕜] (F₂ →L[𝕜] F₄)) x :=
+  hf.cle_arrowCongr hg
+
+theorem ContMDiffOn.cle_arrowCongr {f : M → F₁ ≃L[𝕜] F₂} {g : M → F₃ ≃L[𝕜] F₄} {s : Set M}
+    (hf : ContMDiffOn I 𝓘(𝕜, F₂ →L[𝕜] F₁) n (fun x ↦ ((f x).symm : F₂ →L[𝕜] F₁)) s)
+    (hg : ContMDiffOn I 𝓘(𝕜, F₃ →L[𝕜] F₄) n (fun x ↦ (g x : F₃ →L[𝕜] F₄)) s) :
+    ContMDiffOn I 𝓘(𝕜, (F₁ →L[𝕜] F₃) →L[𝕜] (F₂ →L[𝕜] F₄)) n
+      (fun y ↦ (f y).arrowCongr (g y) : M → (F₁ →L[𝕜] F₃) →L[𝕜] (F₂ →L[𝕜] F₄)) s := fun x hx ↦
+  (hf x hx).cle_arrowCongr (hg x hx)
+
+theorem ContMDiff.cle_arrowCongr {f : M → F₁ ≃L[𝕜] F₂} {g : M → F₃ ≃L[𝕜] F₄}
+    (hf : ContMDiff I 𝓘(𝕜, F₂ →L[𝕜] F₁) n (fun x ↦ ((f x).symm : F₂ →L[𝕜] F₁)))
+    (hg : ContMDiff I 𝓘(𝕜, F₃ →L[𝕜] F₄) n (fun x ↦ (g x : F₃ →L[𝕜] F₄))) :
+    ContMDiff I 𝓘(𝕜, (F₁ →L[𝕜] F₃) →L[𝕜] (F₂ →L[𝕜] F₄)) n
+      (fun y ↦ (f y).arrowCongr (g y) : M → (F₁ →L[𝕜] F₃) →L[𝕜] (F₂ →L[𝕜] F₄)) := fun x ↦
+  (hf x).cle_arrowCongr (hg x)
+
 theorem ContMDiffWithinAt.clm_prodMap {g : M → F₁ →L[𝕜] F₃} {f : M → F₂ →L[𝕜] F₄} {s : Set M}
     {x : M} (hg : ContMDiffWithinAt I 𝓘(𝕜, F₁ →L[𝕜] F₃) n g s x)
     (hf : ContMDiffWithinAt I 𝓘(𝕜, F₂ →L[𝕜] F₄) n f s x) :
     ContMDiffWithinAt I 𝓘(𝕜, F₁ × F₂ →L[𝕜] F₃ × F₄) n (fun x => (g x).prodMap (f x)) s x :=
-  @ContDiffWithinAt.comp_contMDiffWithinAt _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
-    (fun x : (F₁ →L[𝕜] F₃) × (F₂ →L[𝕜] F₄) => x.1.prodMap x.2) (fun x => (g x, f x)) s _ x
-    (by
-      apply ContDiff.contDiffAt
-      exact (ContinuousLinearMap.prodMapL 𝕜 F₁ F₃ F₂ F₄).contDiff)
-    (hg.prod_mk_space hf) (by simp_rw [preimage_univ, subset_univ])
+  ContDiff.comp_contMDiffWithinAt (g := fun x : (F₁ →L[𝕜] F₃) × (F₂ →L[𝕜] F₄) => x.1.prodMap x.2)
+    (f := fun x => (g x, f x)) (ContinuousLinearMap.prodMapL 𝕜 F₁ F₃ F₂ F₄).contDiff
+    (hg.prod_mk_space hf)
 #align cont_mdiff_within_at.clm_prod_map ContMDiffWithinAt.clm_prodMap
 
-theorem ContMDiffAt.clm_prodMap {g : M → F₁ →L[𝕜] F₃} {f : M → F₂ →L[𝕜] F₄} {x : M}
+nonrec theorem ContMDiffAt.clm_prodMap {g : M → F₁ →L[𝕜] F₃} {f : M → F₂ →L[𝕜] F₄} {x : M}
     (hg : ContMDiffAt I 𝓘(𝕜, F₁ →L[𝕜] F₃) n g x) (hf : ContMDiffAt I 𝓘(𝕜, F₂ →L[𝕜] F₄) n f x) :
     ContMDiffAt I 𝓘(𝕜, F₁ × F₂ →L[𝕜] F₃ × F₄) n (fun x => (g x).prodMap (f x)) x :=
-  (hg.contMDiffWithinAt.clm_prodMap hf.contMDiffWithinAt).contMDiffAt univ_mem
+  hg.clm_prodMap hf
 #align cont_mdiff_at.clm_prod_map ContMDiffAt.clm_prodMap
 
 theorem ContMDiffOn.clm_prodMap {g : M → F₁ →L[𝕜] F₃} {f : M → F₂ →L[𝕜] F₄} {s : Set M}
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
@@ -156,7 +156,7 @@ theorem contDiffWithinAt_localInvariantProp (n : ℕ∞) :
     have := (mem_groupoid_of_pregroupoid.2 he').1.contDiffWithinAt A
     convert (this.of_le 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 cont_diff_within_at_local_invariant_prop contDiffWithinAt_localInvariantProp
 
 theorem contDiffWithinAtProp_mono_of_mem (n : ℕ∞) ⦃s x t⦄ ⦃f : H → H'⦄ (hts : s ∈ 𝓝[t] x)
feat: port Geometry.Manifold.ContMdiff (#4656)

Dependencies 12 + 876

877 files ported (98.7%)
391208 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