geometry.manifold.cont_mdiff_mfderivMathlib.Geometry.Manifold.ContMDiffMFDeriv

This file has been ported!

Changes since the initial port

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

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
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 Geometry.Manifold.Mfderiv
-import Geometry.Manifold.ContMdiffMap
+import Geometry.Manifold.MFDeriv.Defs
+import Geometry.Manifold.ContMDiffMap
 
 #align_import geometry.manifold.cont_mdiff_mfderiv from "leanprover-community/mathlib"@"2fe465deb81bcd7ccafa065bb686888a82f15372"
 
Diff
@@ -70,7 +70,7 @@ theorem ContMDiffWithinAt.mdifferentiableWithinAt (hf : ContMDiffWithinAt I I' n
     (hn : 1 ≤ n) : MDifferentiableWithinAt I I' f s x :=
   by
   suffices h : MDifferentiableWithinAt I I' f (s ∩ f ⁻¹' (extChartAt I' (f x)).source) x
-  · rwa [mdifferentiableWithinAt_inter'] at h 
+  · rwa [mdifferentiableWithinAt_inter'] at h
     apply hf.1.preimage_mem_nhdsWithin
     exact extChartAt_source_mem_nhds I' (f x)
   rw [mdifferentiableWithinAt_iff]
@@ -174,7 +174,7 @@ theorem ContMDiffAt.mfderiv {x₀ : N} (f : N → M → M') (g : N → M)
           (range I) (extChartAt I (g x₀) (g ((extChartAt J x₀).symm x))))
       (range J) (extChartAt J x₀ x₀) :=
     by
-    rw [contMDiffAt_iff] at hf hg 
+    rw [contMDiffAt_iff] at hf hg
     simp_rw [Function.comp, uncurry, extChartAt_prod, PartialEquiv.prod_coe_symm,
       ModelWithCorners.range_prod] at hf ⊢
     refine' ContDiffWithinAt.fderivWithin _ hg.2 I.unique_diff hmn (mem_range_self _) _
@@ -265,8 +265,8 @@ theorem ContMDiffAt.mfderiv {x₀ : N} (f : N → M → M') (g : N → M)
   filter_upwards [h2g, h4f] with x hx h2x
   rw [inTangentCoordinates_eq]
   · rfl
-  · rwa [extChartAt_source] at hx 
-  · rwa [extChartAt_source] at h2x 
+  · rwa [extChartAt_source] at hx
+  · rwa [extChartAt_source] at h2x
 #align cont_mdiff_at.mfderiv ContMDiffAt.mfderiv
 -/
 
@@ -334,14 +334,14 @@ theorem ContMDiffOn.continuousOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
             p.snd))
       (Prod.fst ⁻¹' s)
   · have A := (tangentBundleModelSpaceHomeomorph H I).Continuous
-    rw [continuous_iff_continuousOn_univ] at A 
+    rw [continuous_iff_continuousOn_univ] at A
     have B :=
       ((tangentBundleModelSpaceHomeomorph H' I').symm.Continuous.comp_continuousOn h).comp' A
     have :
       univ ∩ ⇑(tangentBundleModelSpaceHomeomorph H I) ⁻¹' (Prod.fst ⁻¹' s) =
         π E (TangentSpace I) ⁻¹' s :=
       by ext ⟨x, v⟩; simp only [mfld_simps]
-    rw [this] at B 
+    rw [this] at B
     apply B.congr
     rintro ⟨x, v⟩ hx
     dsimp [tangentMapWithin]
@@ -376,7 +376,7 @@ theorem ContMDiffOn.continuousOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
       refine' (ContinuousOn.comp C continuous_fst.continuous_on _ : _)
       exact preimage_mono (subset_preimage_image _ _)
     exact A.comp_continuous_on B
-  rw [contMDiffOn_iff] at hf 
+  rw [contMDiffOn_iff] at hf
   let x : H := I.symm (0 : E)
   let y : H' := I'.symm (0 : E')
   have A := hf.2 x y
@@ -447,7 +447,7 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
       ((range I ∩ I.symm ⁻¹' s) ×ˢ univ)
   · apply ContDiffOn.prod B _
     apply C.congr fun p hp => _
-    simp only [mfld_simps] at hp 
+    simp only [mfld_simps] at hp
     simp only [mfderivWithin, hf.mdifferentiable_on one_le_n _ hp.2, hp.1, if_pos, mfld_simps]
   have D :
     ContDiffOn 𝕜 m (fun x => fderivWithin 𝕜 (I' ∘ f ∘ I.symm) (I.symm ⁻¹' s ∩ range I) x)
@@ -497,7 +497,7 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (
   -- First step: local reduction on the space, to a set `s'` which is contained in chart domains.
   refine' contMDiffOn_of_locally_contMDiffOn fun p hp => _
   have hf' := contMDiffOn_iff.1 hf
-  simp only [mfld_simps] at hp 
+  simp only [mfld_simps] at hp
   let l := chart_at H p.proj
   set Dl := chart_at (ModelProd H E) p with hDl
   let r := chart_at H' (f p.proj)
@@ -516,7 +516,7 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (
     show p ∈ π E (TangentSpace I) ⁻¹' (o ∩ l.source)
     · simp
       have : p.proj ∈ f ⁻¹' r.source ∩ s := by simp [hp]
-      rw [ho] at this 
+      rw [ho] at this
       exact this.1
     · have : π E (TangentSpace I) ⁻¹' s ∩ π E (TangentSpace I) ⁻¹' (o ∩ l.source) = s'_lift := by
         dsimp only [s'_lift, s']; rw [ho]; mfld_set_tac
@@ -537,7 +537,7 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (
   have diff_rf : ContMDiffOn I I' n (r ∘ f) s' :=
     by
     apply ContMDiffOn.comp diff_r diff_f fun x hx => _
-    simp only [s', mfld_simps] at hx ; simp only [hx, mfld_simps]
+    simp only [s', mfld_simps] at hx; simp only [hx, mfld_simps]
   have diff_l : ContMDiffOn I I n l.symm s'l :=
     haveI A : ContMDiffOn I I n l.symm l.target := contMDiffOn_chart_symm
     A.mono (by mfld_set_tac)
@@ -558,7 +558,7 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (
     by
     have A : ContMDiffOn I'.tangent I'.tangent m Dr.symm Dr.target := contMDiffOn_chart_symm
     apply ContMDiffOn.comp A diff_irrfl_lift fun p hp => _
-    simp only [s'l_lift, mfld_simps] at hp 
+    simp only [s'l_lift, mfld_simps] at hp
     simp only [ir, hp, mfld_simps]
   -- conclusion of this step: the composition of all the maps above is smooth
   have diff_DrirrflilDl :
@@ -569,13 +569,13 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (
     have A' : ContMDiffOn I.tangent I.tangent m Dl s'_lift :=
       by
       apply A.mono fun p hp => _
-      simp only [s'_lift, mfld_simps] at hp 
+      simp only [s'_lift, mfld_simps] at hp
       simp only [Dl, hp, mfld_simps]
     have B : ContMDiffOn I.tangent I.tangent m il.symm il.target := contMDiffOn_chart_symm
     have C : ContMDiffOn I.tangent I.tangent m (il.symm ∘ Dl) s'_lift :=
       ContMDiffOn.comp B A' fun p hp => by simp only [il, mfld_simps]
     apply ContMDiffOn.comp diff_Drirrfl_lift C fun p hp => _
-    simp only [s'_lift, mfld_simps] at hp 
+    simp only [s'_lift, mfld_simps] at hp
     simp only [il, s'l_lift, hp, total_space.proj, mfld_simps]
   /- Third step: check that the composition of all the maps indeed coincides with the derivative we
     are looking for -/
@@ -585,7 +585,7 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (
         (Dr.symm ∘ ir ∘ tangentMapWithin I I' (r ∘ f ∘ l.symm) s'l ∘ il.symm ∘ Dl) q :=
     by
     intro q hq
-    simp only [s'_lift, mfld_simps] at hq 
+    simp only [s'_lift, mfld_simps] at hq
     have U'q : UniqueMDiffWithinAt I s' q.1 := by apply U'; simp only [hq, s', mfld_simps]
     have U'lq : UniqueMDiffWithinAt I s'l (Dl q).1 := by apply U'l; simp only [hq, s'l, mfld_simps]
     have A :
@@ -597,7 +597,7 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (
         simp only [hq, mfld_simps]
       · apply diff_l.mdifferentiable_on one_le_n
         simp only [s'l, hq, mfld_simps]
-      · simp only [mfld_simps] at hp ; simp only [hp, mfld_simps]
+      · simp only [mfld_simps] at hp; simp only [hp, mfld_simps]
     have B : tangentMapWithin I I l.symm s'l (il.symm (Dl q)) = q :=
       by
       have :
@@ -620,7 +620,7 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (
         simp only [hq, mfld_simps]
       · apply diff_f.mdifferentiable_on one_le_n
         simp only [hq, mfld_simps]
-      · simp only [s', mfld_simps] at hr 
+      · simp only [s', mfld_simps] at hr
         simp only [hr, mfld_simps]
     have D :
       Dr.symm (ir (tangentMapWithin I' I' r r.source (tangentMapWithin I I' f s' q))) =
@@ -684,7 +684,7 @@ theorem ContMDiff.contMDiff_tangentMap (hf : ContMDiff I I' n f) (hmn : m + 1 
 theorem ContMDiff.continuous_tangentMap (hf : ContMDiff I I' n f) (hmn : 1 ≤ n) :
     Continuous (tangentMap I I' f) :=
   by
-  rw [← contMDiffOn_univ] at hf 
+  rw [← contMDiffOn_univ] at hf
   rw [continuous_iff_continuousOn_univ]
   convert hf.continuous_on_tangent_map_within hmn uniqueMDiffOn_univ
   rw [tangentMapWithin_univ]
@@ -739,11 +739,11 @@ theorem tangentMap_tangentBundle_pure (p : TangentBundle I M) :
   simp only [Bundle.zeroSection, tangentMap, mfderiv, A, if_pos, chart_at,
     FiberBundle.chartedSpace_chartAt, TangentBundle.trivializationAt_apply, tangentBundleCore,
     Function.comp, ContinuousLinearMap.map_zero, mfld_simps]
-  rw [← fderivWithin_inter N] at B 
+  rw [← fderivWithin_inter N] at B
   rw [← fderivWithin_inter N, ← B]
   congr 1
   refine' fderivWithin_congr (fun y hy => _) _
-  · simp only [mfld_simps] at hy 
+  · simp only [mfld_simps] at hy
     simp only [hy, Prod.mk.inj_iff, mfld_simps]
   · simp only [Prod.mk.inj_iff, mfld_simps]
 #align tangent_bundle.tangent_map_tangent_bundle_pure TangentBundle.tangentMap_tangentBundle_pure
Diff
@@ -175,7 +175,7 @@ theorem ContMDiffAt.mfderiv {x₀ : N} (f : N → M → M') (g : N → M)
       (range J) (extChartAt J x₀ x₀) :=
     by
     rw [contMDiffAt_iff] at hf hg 
-    simp_rw [Function.comp, uncurry, extChartAt_prod, LocalEquiv.prod_coe_symm,
+    simp_rw [Function.comp, uncurry, extChartAt_prod, PartialEquiv.prod_coe_symm,
       ModelWithCorners.range_prod] at hf ⊢
     refine' ContDiffWithinAt.fderivWithin _ hg.2 I.unique_diff hmn (mem_range_self _) _
     · simp_rw [extChartAt_to_inv]; exact hf.2
@@ -245,12 +245,12 @@ theorem ContMDiffAt.mfderiv {x₀ : N} (f : N → M → M') (g : N → M)
     rw [(h2x₂.mdifferentiable_at le_rfl).mfderiv]
     have hI :=
       (contDiffWithinAt_ext_coord_change I (g x₂) (g x₀) <|
-            LocalEquiv.mem_symm_trans_source _ hx₂ <|
+            PartialEquiv.mem_symm_trans_source _ hx₂ <|
               mem_extChartAt_source I (g x₂)).DifferentiableWithinAt
         le_top
     have hI' :=
       (contDiffWithinAt_ext_coord_change I' (f x₀ (g x₀)) (f x₂ (g x₂)) <|
-            LocalEquiv.mem_symm_trans_source _ (mem_extChartAt_source I' (f x₂ (g x₂)))
+            PartialEquiv.mem_symm_trans_source _ (mem_extChartAt_source I' (f x₂ (g x₂)))
               h3x₂).DifferentiableWithinAt
         le_top
     have h3f := (h2x₂.mdifferentiable_at le_rfl).2
Diff
@@ -721,7 +721,7 @@ theorem tangentMap_tangentBundle_pure (p : TangentBundle I M) :
   have N : I.symm ⁻¹' (chart_at H x).target ∈ 𝓝 (I ((chart_at H x) x)) :=
     by
     apply IsOpen.mem_nhds
-    apply (LocalHomeomorph.open_target _).Preimage I.continuous_inv_fun
+    apply (PartialHomeomorph.open_target _).Preimage I.continuous_inv_fun
     simp only [mfld_simps]
   have A : MDifferentiableAt I I.tangent (fun x => @total_space.mk M E (TangentSpace I) x 0) x :=
     haveI : Smooth I (I.prod 𝓘(𝕜, E)) (zero_section E (TangentSpace I : M → Type _)) :=
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.Mfderiv
-import Mathbin.Geometry.Manifold.ContMdiffMap
+import Geometry.Manifold.Mfderiv
+import Geometry.Manifold.ContMdiffMap
 
 #align_import geometry.manifold.cont_mdiff_mfderiv from "leanprover-community/mathlib"@"2fe465deb81bcd7ccafa065bb686888a82f15372"
 
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_mfderiv
-! leanprover-community/mathlib commit 2fe465deb81bcd7ccafa065bb686888a82f15372
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Geometry.Manifold.Mfderiv
 import Mathbin.Geometry.Manifold.ContMdiffMap
 
+#align_import geometry.manifold.cont_mdiff_mfderiv from "leanprover-community/mathlib"@"2fe465deb81bcd7ccafa065bb686888a82f15372"
+
 /-!
 ### Interactions between differentiability, smoothness and manifold derivatives
 
Diff
@@ -142,6 +142,7 @@ theorem Smooth.mdifferentiableWithinAt (hf : Smooth I I' f) : MDifferentiableWit
 
 section mfderiv
 
+#print ContMDiffAt.mfderiv /-
 /-- The function that sends `x` to the `y`-derivative of `f(x,y)` at `g(x)` is `C^m` at `x₀`,
 where the derivative is taken as a continuous linear map.
 We have to assume that `f` is `C^n` at `(x₀, g(x₀))` for `n ≥ m + 1` and `g` is `C^m` at `x₀`.
@@ -270,7 +271,9 @@ theorem ContMDiffAt.mfderiv {x₀ : N} (f : N → M → M') (g : N → M)
   · rwa [extChartAt_source] at hx 
   · rwa [extChartAt_source] at h2x 
 #align cont_mdiff_at.mfderiv ContMDiffAt.mfderiv
+-/
 
+#print ContMDiffAt.mfderiv_const /-
 /-- The derivative `D_yf(y)` is `C^m` at `x₀`, where the derivative is taken as a continuous
 linear map. We have to assume that `f` is `C^n` at `x₀` for some `n ≥ m + 1`.
 We have to insert a coordinate change from `x₀` to `x` to make the derivative sensible.
@@ -284,7 +287,9 @@ theorem ContMDiffAt.mfderiv_const {x₀ : M} {f : M → M'} (hf : ContMDiffAt I
     ContMDiffAt.comp (x₀, x₀) hf contMDiffAt_snd
   this.mfderiv (fun x => f) id contMDiffAt_id hmn
 #align cont_mdiff_at.mfderiv_const ContMDiffAt.mfderiv_const
+-/
 
+#print ContMDiffAt.mfderiv_apply /-
 /-- The function that sends `x` to the `y`-derivative of `f(x,y)` at `g(x)` applied to `g₂(x)` is
 `C^n` at `x₀`, where the derivative is taken as a continuous linear map.
 We have to assume that `f` is `C^(n+1)` at `(x₀, g(x₀))` and `g` is `C^n` at `x₀`.
@@ -304,6 +309,7 @@ theorem ContMDiffAt.mfderiv_apply {x₀ : N'} (f : N → M → M') (g : N → M)
       x₀ :=
   ((hf.mfderiv f g hg hmn).comp_of_eq hg₁ rfl).clm_apply hg₂
 #align cont_mdiff_at.mfderiv_apply ContMDiffAt.mfderiv_apply
+-/
 
 end mfderiv
 
@@ -312,6 +318,7 @@ end mfderiv
 
 section tangentMap
 
+#print ContMDiffOn.continuousOn_tangentMapWithin_aux /-
 /-- If a function is `C^n` with `1 ≤ n` on a domain with unique derivatives, then its bundled
 derivative is continuous. In this auxiliary lemma, we prove this fact when the source and target
 space are model spaces in models with corners. The general fact is proved in
@@ -381,6 +388,7 @@ theorem ContMDiffOn.continuousOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
   convert hs.unique_diff_on_target_inter x using 1
   simp only [inter_comm, mfld_simps]
 #align cont_mdiff_on.continuous_on_tangent_map_within_aux ContMDiffOn.continuousOn_tangentMapWithin_aux
+-/
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
@@ -388,6 +396,7 @@ theorem ContMDiffOn.continuousOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print ContMDiffOn.contMDiffOn_tangentMapWithin_aux /-
 /-- If a function is `C^n` on a domain with unique derivatives, then its bundled derivative is
 `C^m` when `m+1 ≤ n`. In this auxiliary lemma, we prove this fact when the source and target space
 are model spaces in models with corners. The general fact is proved in
@@ -454,7 +463,9 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
   have := ContDiffOn.prod this cont_diff_snd.cont_diff_on
   exact is_bounded_bilinear_map_apply.cont_diff.comp_cont_diff_on this
 #align cont_mdiff_on.cont_mdiff_on_tangent_map_within_aux ContMDiffOn.contMDiffOn_tangentMapWithin_aux
+-/
 
+#print ContMDiffOn.contMDiffOn_tangentMapWithin /-
 /-- If a function is `C^n` on a domain with unique derivatives, then its bundled derivative
 is `C^m` when `m+1 ≤ n`. -/
 theorem ContMDiffOn.contMDiffOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (hmn : m + 1 ≤ n)
@@ -645,7 +656,9 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (
     simp only [(· ∘ ·), A, B, C, D, E.symm]
   exact diff_DrirrflilDl.congr eq_comp
 #align cont_mdiff_on.cont_mdiff_on_tangent_map_within ContMDiffOn.contMDiffOn_tangentMapWithin
+-/
 
+#print ContMDiffOn.continuousOn_tangentMapWithin /-
 /-- If a function is `C^n` on a domain with unique derivatives, with `1 ≤ n`, then its bundled
 derivative is continuous there. -/
 theorem ContMDiffOn.continuousOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (hmn : 1 ≤ n)
@@ -656,7 +669,9 @@ theorem ContMDiffOn.continuousOn_tangentMapWithin (hf : ContMDiffOn I I' n f s)
     hf.cont_mdiff_on_tangent_map_within hmn hs
   this.continuous_on
 #align cont_mdiff_on.continuous_on_tangent_map_within ContMDiffOn.continuousOn_tangentMapWithin
+-/
 
+#print ContMDiff.contMDiff_tangentMap /-
 /-- If a function is `C^n`, then its bundled derivative is `C^m` when `m+1 ≤ n`. -/
 theorem ContMDiff.contMDiff_tangentMap (hf : ContMDiff I I' n f) (hmn : m + 1 ≤ n) :
     ContMDiff I.tangent I'.tangent m (tangentMap I I' f) :=
@@ -665,7 +680,9 @@ theorem ContMDiff.contMDiff_tangentMap (hf : ContMDiff I I' n f) (hmn : m + 1 
   convert hf.cont_mdiff_on_tangent_map_within hmn uniqueMDiffOn_univ
   rw [tangentMapWithin_univ]
 #align cont_mdiff.cont_mdiff_tangent_map ContMDiff.contMDiff_tangentMap
+-/
 
+#print ContMDiff.continuous_tangentMap /-
 /-- If a function is `C^n`, with `1 ≤ n`, then its bundled derivative is continuous. -/
 theorem ContMDiff.continuous_tangentMap (hf : ContMDiff I I' n f) (hmn : 1 ≤ n) :
     Continuous (tangentMap I I' f) :=
@@ -675,6 +692,7 @@ theorem ContMDiff.continuous_tangentMap (hf : ContMDiff I I' n f) (hmn : 1 ≤ n
   convert hf.continuous_on_tangent_map_within hmn uniqueMDiffOn_univ
   rw [tangentMapWithin_univ]
 #align cont_mdiff.continuous_tangent_map ContMDiff.continuous_tangentMap
+-/
 
 end tangentMap
 
@@ -684,6 +702,7 @@ variable (I M)
 
 open Bundle
 
+#print TangentBundle.tangentMap_tangentBundle_pure /-
 /-- The derivative of the zero section of the tangent bundle maps `⟨x, v⟩` to `⟨⟨x, 0⟩, ⟨v, 0⟩⟩`.
 
 Note that, as currently framed, this is a statement in coordinates, thus reliant on the choice
@@ -731,6 +750,7 @@ theorem tangentMap_tangentBundle_pure (p : TangentBundle I M) :
     simp only [hy, Prod.mk.inj_iff, mfld_simps]
   · simp only [Prod.mk.inj_iff, mfld_simps]
 #align tangent_bundle.tangent_map_tangent_bundle_pure TangentBundle.tangentMap_tangentBundle_pure
+-/
 
 end TangentBundle
 
@@ -742,17 +762,23 @@ namespace ContMDiffMap
 -- They could be moved to another file (perhaps a new file) if desired.
 open scoped Manifold
 
+#print ContMDiffMap.mdifferentiable' /-
 protected theorem mdifferentiable' (f : C^n⟮I, M; I', M'⟯) (hn : 1 ≤ n) : MDifferentiable I I' f :=
   f.ContMDiff.MDifferentiable hn
 #align cont_mdiff_map.mdifferentiable' ContMDiffMap.mdifferentiable'
+-/
 
-protected theorem mDifferentiable (f : C^∞⟮I, M; I', M'⟯) : MDifferentiable I I' f :=
+#print ContMDiffMap.mdifferentiable /-
+protected theorem mdifferentiable (f : C^∞⟮I, M; I', M'⟯) : MDifferentiable I I' f :=
   f.ContMDiff.MDifferentiable le_top
-#align cont_mdiff_map.mdifferentiable ContMDiffMap.mDifferentiable
+#align cont_mdiff_map.mdifferentiable ContMDiffMap.mdifferentiable
+-/
 
-protected theorem mDifferentiableAt (f : C^∞⟮I, M; I', M'⟯) {x} : MDifferentiableAt I I' f x :=
+#print ContMDiffMap.mdifferentiableAt /-
+protected theorem mdifferentiableAt (f : C^∞⟮I, M; I', M'⟯) {x} : MDifferentiableAt I I' f x :=
   f.MDifferentiable x
-#align cont_mdiff_map.mdifferentiable_at ContMDiffMap.mDifferentiableAt
+#align cont_mdiff_map.mdifferentiable_at ContMDiffMap.mdifferentiableAt
+-/
 
 end ContMDiffMap
 
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_mfderiv
-! leanprover-community/mathlib commit e473c3198bb41f68560cab68a0529c854b618833
+! leanprover-community/mathlib commit 2fe465deb81bcd7ccafa065bb686888a82f15372
 ! 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.ContMdiffMap
 /-!
 ### Interactions between differentiability, smoothness and manifold derivatives
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 We give the relation between `mdifferentiable`, `cont_mdiff`, `mfderiv`, `tangent_map`
 and related notions.
 
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_mfderiv
-! leanprover-community/mathlib commit e354e865255654389cc46e6032160238df2e0f40
+! leanprover-community/mathlib commit e473c3198bb41f68560cab68a0529c854b618833
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -315,7 +315,7 @@ space are model spaces in models with corners. The general fact is proved in
 `cont_mdiff_on.continuous_on_tangent_map_within`-/
 theorem ContMDiffOn.continuousOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
     (hf : ContMDiffOn I I' n f s) (hn : 1 ≤ n) (hs : UniqueMDiffOn I s) :
-    ContinuousOn (tangentMapWithin I I' f s) (π (TangentSpace I) ⁻¹' s) :=
+    ContinuousOn (tangentMapWithin I I' f s) (π E (TangentSpace I) ⁻¹' s) :=
   by
   suffices h :
     ContinuousOn
@@ -332,7 +332,7 @@ theorem ContMDiffOn.continuousOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
       ((tangentBundleModelSpaceHomeomorph H' I').symm.Continuous.comp_continuousOn h).comp' A
     have :
       univ ∩ ⇑(tangentBundleModelSpaceHomeomorph H I) ⁻¹' (Prod.fst ⁻¹' s) =
-        π (TangentSpace I) ⁻¹' s :=
+        π E (TangentSpace I) ⁻¹' s :=
       by ext ⟨x, v⟩; simp only [mfld_simps]
     rw [this] at B 
     apply B.congr
@@ -391,7 +391,7 @@ are model spaces in models with corners. The general fact is proved in
 `cont_mdiff_on.cont_mdiff_on_tangent_map_within` -/
 theorem ContMDiffOn.contMDiffOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
     (hf : ContMDiffOn I I' n f s) (hmn : m + 1 ≤ n) (hs : UniqueMDiffOn I s) :
-    ContMDiffOn I.tangent I'.tangent m (tangentMapWithin I I' f s) (π (TangentSpace I) ⁻¹' s) :=
+    ContMDiffOn I.tangent I'.tangent m (tangentMapWithin I I' f s) (π E (TangentSpace I) ⁻¹' s) :=
   by
   have m_le_n : m ≤ n := by
     apply le_trans _ hmn
@@ -410,15 +410,15 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
   refine' ⟨hf.continuous_on_tangent_map_within_aux one_le_n hs, fun p q => _⟩
   have A :
     range I ×ˢ univ ∩
-        ((Equiv.sigmaEquivProd H E).symm ∘ fun p : E × E => (I.symm p.fst, p.snd)) ⁻¹'
-          (π (TangentSpace I) ⁻¹' s) =
+        ((total_space.to_prod H E).symm ∘ fun p : E × E => (I.symm p.fst, p.snd)) ⁻¹'
+          (π E (TangentSpace I) ⁻¹' s) =
       (range I ∩ I.symm ⁻¹' s) ×ˢ univ :=
     by ext ⟨x, v⟩; simp only [mfld_simps]
   suffices h :
     ContDiffOn 𝕜 m
-      (((fun p : H' × E' => (I' p.fst, p.snd)) ∘ Equiv.sigmaEquivProd H' E') ∘
+      (((fun p : H' × E' => (I' p.fst, p.snd)) ∘ total_space.to_prod H' E') ∘
         tangentMapWithin I I' f s ∘
-          (Equiv.sigmaEquivProd H E).symm ∘ fun p : E × E => (I.symm p.fst, p.snd))
+          (total_space.to_prod H E).symm ∘ fun p : E × E => (I.symm p.fst, p.snd))
       ((range ⇑I ∩ ⇑I.symm ⁻¹' s) ×ˢ univ)
   · simpa [A] using h
   change
@@ -456,7 +456,7 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
 is `C^m` when `m+1 ≤ n`. -/
 theorem ContMDiffOn.contMDiffOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (hmn : m + 1 ≤ n)
     (hs : UniqueMDiffOn I s) :
-    ContMDiffOn I.tangent I'.tangent m (tangentMapWithin I I' f s) (π (TangentSpace I) ⁻¹' s) :=
+    ContMDiffOn I.tangent I'.tangent m (tangentMapWithin I I' f s) (π E (TangentSpace I) ⁻¹' s) :=
   by
   /- The strategy of the proof is to avoid unfolding the definitions, and reduce by functoriality
     to the case of functions on the model spaces, where we have already proved the result.
@@ -494,20 +494,20 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (
   let il := chart_at (ModelProd H E) (tangentMap I I l p)
   let ir := chart_at (ModelProd H' E') (tangentMap I I' (r ∘ f) p)
   let s' := f ⁻¹' r.source ∩ s ∩ l.source
-  let s'_lift := π (TangentSpace I) ⁻¹' s'
+  let s'_lift := π E (TangentSpace I) ⁻¹' s'
   let s'l := l.target ∩ l.symm ⁻¹' s'
-  let s'l_lift := π (TangentSpace I) ⁻¹' s'l
+  let s'l_lift := π E (TangentSpace I) ⁻¹' s'l
   rcases continuousOn_iff'.1 hf'.1 r.source r.open_source with ⟨o, o_open, ho⟩
   suffices h : ContMDiffOn I.tangent I'.tangent m (tangentMapWithin I I' f s) s'_lift
-  · refine' ⟨π (TangentSpace I) ⁻¹' (o ∩ l.source), _, _, _⟩
-    show IsOpen (π (TangentSpace I) ⁻¹' (o ∩ l.source));
+  · refine' ⟨π E (TangentSpace I) ⁻¹' (o ∩ l.source), _, _, _⟩
+    show IsOpen (π E (TangentSpace I) ⁻¹' (o ∩ l.source));
     exact (IsOpen.inter o_open l.open_source).Preimage (continuous_proj E _)
-    show p ∈ π (TangentSpace I) ⁻¹' (o ∩ l.source)
+    show p ∈ π E (TangentSpace I) ⁻¹' (o ∩ l.source)
     · simp
       have : p.proj ∈ f ⁻¹' r.source ∩ s := by simp [hp]
       rw [ho] at this 
       exact this.1
-    · have : π (TangentSpace I) ⁻¹' s ∩ π (TangentSpace I) ⁻¹' (o ∩ l.source) = s'_lift := by
+    · have : π E (TangentSpace I) ⁻¹' s ∩ π E (TangentSpace I) ⁻¹' (o ∩ l.source) = s'_lift := by
         dsimp only [s'_lift, s']; rw [ho]; mfld_set_tac
       rw [this]
       exact h
@@ -647,9 +647,9 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (
 derivative is continuous there. -/
 theorem ContMDiffOn.continuousOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (hmn : 1 ≤ n)
     (hs : UniqueMDiffOn I s) :
-    ContinuousOn (tangentMapWithin I I' f s) (π (TangentSpace I) ⁻¹' s) :=
+    ContinuousOn (tangentMapWithin I I' f s) (π E (TangentSpace I) ⁻¹' s) :=
   haveI :
-    ContMDiffOn I.tangent I'.tangent 0 (tangentMapWithin I I' f s) (π (TangentSpace I) ⁻¹' s) :=
+    ContMDiffOn I.tangent I'.tangent 0 (tangentMapWithin I I' f s) (π E (TangentSpace I) ⁻¹' s) :=
     hf.cont_mdiff_on_tangent_map_within hmn hs
   this.continuous_on
 #align cont_mdiff_on.continuous_on_tangent_map_within ContMDiffOn.continuousOn_tangentMapWithin
@@ -696,7 +696,7 @@ may seem.
 
 TODO define splittings of vector bundles; state this result invariantly. -/
 theorem tangentMap_tangentBundle_pure (p : TangentBundle I M) :
-    tangentMap I I.tangent (zeroSection (TangentSpace I)) p = ⟨⟨p.proj, 0⟩, ⟨p.2, 0⟩⟩ :=
+    tangentMap I I.tangent (zeroSection E (TangentSpace I)) p = ⟨⟨p.proj, 0⟩, ⟨p.2, 0⟩⟩ :=
   by
   rcases p with ⟨x, v⟩
   have N : I.symm ⁻¹' (chart_at H x).target ∈ 𝓝 (I ((chart_at H x) x)) :=
@@ -704,8 +704,8 @@ theorem tangentMap_tangentBundle_pure (p : TangentBundle I M) :
     apply IsOpen.mem_nhds
     apply (LocalHomeomorph.open_target _).Preimage I.continuous_inv_fun
     simp only [mfld_simps]
-  have A : MDifferentiableAt I I.tangent (fun x => @total_space_mk M (TangentSpace I) x 0) x :=
-    haveI : Smooth I (I.prod 𝓘(𝕜, E)) (zero_section (TangentSpace I : M → Type _)) :=
+  have A : MDifferentiableAt I I.tangent (fun x => @total_space.mk M E (TangentSpace I) x 0) x :=
+    haveI : Smooth I (I.prod 𝓘(𝕜, E)) (zero_section E (TangentSpace I : M → Type _)) :=
       Bundle.smooth_zeroSection 𝕜 (TangentSpace I : M → Type _)
     this.mdifferentiable_at
   have B :
@@ -717,12 +717,12 @@ theorem tangentMap_tangentBundle_pure (p : TangentBundle I M) :
     · exact differentiableAt_const _
     · exact ModelWithCorners.unique_diff_at_image I
     · exact differentiable_at_id'.prod (differentiableAt_const _)
-  simp only [Bundle.zeroSection, tangentMap, mfderiv, total_space.proj_mk, A, if_pos, chart_at,
+  simp only [Bundle.zeroSection, tangentMap, mfderiv, A, if_pos, chart_at,
     FiberBundle.chartedSpace_chartAt, TangentBundle.trivializationAt_apply, tangentBundleCore,
     Function.comp, ContinuousLinearMap.map_zero, mfld_simps]
   rw [← fderivWithin_inter N] at B 
   rw [← fderivWithin_inter N, ← B]
-  congr 2
+  congr 1
   refine' fderivWithin_congr (fun y hy => _) _
   · simp only [mfld_simps] at hy 
     simp only [hy, Prod.mk.inj_iff, mfld_simps]
Diff
@@ -65,54 +65,74 @@ variable {𝕜 : Type _} [NontriviallyNormedField 𝕜]
 /-! ### Deducing differentiability from smoothness -/
 
 
+#print ContMDiffWithinAt.mdifferentiableWithinAt /-
 theorem ContMDiffWithinAt.mdifferentiableWithinAt (hf : ContMDiffWithinAt I I' n f s x)
-    (hn : 1 ≤ n) : MdifferentiableWithinAt I I' f s x :=
+    (hn : 1 ≤ n) : MDifferentiableWithinAt I I' f s x :=
   by
-  suffices h : MdifferentiableWithinAt I I' f (s ∩ f ⁻¹' (extChartAt I' (f x)).source) x
+  suffices h : MDifferentiableWithinAt I I' f (s ∩ f ⁻¹' (extChartAt I' (f x)).source) x
   · rwa [mdifferentiableWithinAt_inter'] at h 
     apply hf.1.preimage_mem_nhdsWithin
     exact extChartAt_source_mem_nhds I' (f x)
   rw [mdifferentiableWithinAt_iff]
   exact ⟨hf.1.mono (inter_subset_left _ _), (hf.2.DifferentiableWithinAt hn).mono (by mfld_set_tac)⟩
 #align cont_mdiff_within_at.mdifferentiable_within_at ContMDiffWithinAt.mdifferentiableWithinAt
+-/
 
+#print ContMDiffAt.mdifferentiableAt /-
 theorem ContMDiffAt.mdifferentiableAt (hf : ContMDiffAt I I' n f x) (hn : 1 ≤ n) :
-    MdifferentiableAt I I' f x :=
+    MDifferentiableAt I I' f x :=
   mdifferentiableWithinAt_univ.1 <| ContMDiffWithinAt.mdifferentiableWithinAt hf hn
 #align cont_mdiff_at.mdifferentiable_at ContMDiffAt.mdifferentiableAt
+-/
 
+#print ContMDiffOn.mdifferentiableOn /-
 theorem ContMDiffOn.mdifferentiableOn (hf : ContMDiffOn I I' n f s) (hn : 1 ≤ n) :
-    MdifferentiableOn I I' f s := fun x hx => (hf x hx).MdifferentiableWithinAt hn
+    MDifferentiableOn I I' f s := fun x hx => (hf x hx).MDifferentiableWithinAt hn
 #align cont_mdiff_on.mdifferentiable_on ContMDiffOn.mdifferentiableOn
+-/
 
-theorem ContMDiff.mdifferentiable (hf : ContMDiff I I' n f) (hn : 1 ≤ n) : Mdifferentiable I I' f :=
-  fun x => (hf x).MdifferentiableAt hn
+#print ContMDiff.mdifferentiable /-
+theorem ContMDiff.mdifferentiable (hf : ContMDiff I I' n f) (hn : 1 ≤ n) : MDifferentiable I I' f :=
+  fun x => (hf x).MDifferentiableAt hn
 #align cont_mdiff.mdifferentiable ContMDiff.mdifferentiable
+-/
 
+#print SmoothWithinAt.mdifferentiableWithinAt /-
 theorem SmoothWithinAt.mdifferentiableWithinAt (hf : SmoothWithinAt I I' f s x) :
-    MdifferentiableWithinAt I I' f s x :=
-  hf.MdifferentiableWithinAt le_top
+    MDifferentiableWithinAt I I' f s x :=
+  hf.MDifferentiableWithinAt le_top
 #align smooth_within_at.mdifferentiable_within_at SmoothWithinAt.mdifferentiableWithinAt
+-/
 
-theorem SmoothAt.mdifferentiableAt (hf : SmoothAt I I' f x) : MdifferentiableAt I I' f x :=
-  hf.MdifferentiableAt le_top
+#print SmoothAt.mdifferentiableAt /-
+theorem SmoothAt.mdifferentiableAt (hf : SmoothAt I I' f x) : MDifferentiableAt I I' f x :=
+  hf.MDifferentiableAt le_top
 #align smooth_at.mdifferentiable_at SmoothAt.mdifferentiableAt
+-/
 
-theorem SmoothOn.mdifferentiableOn (hf : SmoothOn I I' f s) : MdifferentiableOn I I' f s :=
-  hf.MdifferentiableOn le_top
+#print SmoothOn.mdifferentiableOn /-
+theorem SmoothOn.mdifferentiableOn (hf : SmoothOn I I' f s) : MDifferentiableOn I I' f s :=
+  hf.MDifferentiableOn le_top
 #align smooth_on.mdifferentiable_on SmoothOn.mdifferentiableOn
+-/
 
-theorem Smooth.mdifferentiable (hf : Smooth I I' f) : Mdifferentiable I I' f :=
+#print Smooth.mdifferentiable /-
+theorem Smooth.mdifferentiable (hf : Smooth I I' f) : MDifferentiable I I' f :=
   ContMDiff.mdifferentiable hf le_top
 #align smooth.mdifferentiable Smooth.mdifferentiable
+-/
 
-theorem Smooth.mdifferentiableAt (hf : Smooth I I' f) : MdifferentiableAt I I' f x :=
-  hf.Mdifferentiable x
+#print Smooth.mdifferentiableAt /-
+theorem Smooth.mdifferentiableAt (hf : Smooth I I' f) : MDifferentiableAt I I' f x :=
+  hf.MDifferentiable x
 #align smooth.mdifferentiable_at Smooth.mdifferentiableAt
+-/
 
-theorem Smooth.mdifferentiableWithinAt (hf : Smooth I I' f) : MdifferentiableWithinAt I I' f s x :=
-  hf.MdifferentiableAt.MdifferentiableWithinAt
+#print Smooth.mdifferentiableWithinAt /-
+theorem Smooth.mdifferentiableWithinAt (hf : Smooth I I' f) : MDifferentiableWithinAt I I' f s x :=
+  hf.MDifferentiableAt.MDifferentiableWithinAt
 #align smooth.mdifferentiable_within_at Smooth.mdifferentiableWithinAt
+-/
 
 /-! ### The derivative of a smooth function is smooth -/
 
@@ -294,7 +314,7 @@ derivative is continuous. In this auxiliary lemma, we prove this fact when the s
 space are model spaces in models with corners. The general fact is proved in
 `cont_mdiff_on.continuous_on_tangent_map_within`-/
 theorem ContMDiffOn.continuousOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
-    (hf : ContMDiffOn I I' n f s) (hn : 1 ≤ n) (hs : UniqueMdiffOn I s) :
+    (hf : ContMDiffOn I I' n f s) (hn : 1 ≤ n) (hs : UniqueMDiffOn I s) :
     ContinuousOn (tangentMapWithin I I' f s) (π (TangentSpace I) ⁻¹' s) :=
   by
   suffices h :
@@ -322,7 +342,7 @@ theorem ContMDiffOn.continuousOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
     simp only [mfld_simps]
     apply congr_fun
     apply congr_arg
-    rw [MdifferentiableWithinAt.mfderivWithin (hf.mdifferentiable_on hn x hx)]
+    rw [MDifferentiableWithinAt.mfderivWithin (hf.mdifferentiable_on hn x hx)]
     rfl
   suffices h :
     ContinuousOn
@@ -370,7 +390,7 @@ theorem ContMDiffOn.continuousOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
 are model spaces in models with corners. The general fact is proved in
 `cont_mdiff_on.cont_mdiff_on_tangent_map_within` -/
 theorem ContMDiffOn.contMDiffOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
-    (hf : ContMDiffOn I I' n f s) (hmn : m + 1 ≤ n) (hs : UniqueMdiffOn I s) :
+    (hf : ContMDiffOn I I' n f s) (hmn : m + 1 ≤ n) (hs : UniqueMDiffOn I s) :
     ContMDiffOn I.tangent I'.tangent m (tangentMapWithin I I' f s) (π (TangentSpace I) ⁻¹' s) :=
   by
   have m_le_n : m ≤ n := by
@@ -384,7 +404,7 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
   have U' : UniqueDiffOn 𝕜 (range I ∩ I.symm ⁻¹' s) :=
     by
     intro y hy
-    simpa only [UniqueMdiffOn, UniqueMdiffWithinAt, hy.1, inter_comm, mfld_simps] using
+    simpa only [UniqueMDiffOn, UniqueMDiffWithinAt, hy.1, inter_comm, mfld_simps] using
       hs (I.symm y) hy.2
   rw [contMDiffOn_iff]
   refine' ⟨hf.continuous_on_tangent_map_within_aux one_le_n hs, fun p q => _⟩
@@ -435,7 +455,7 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
 /-- If a function is `C^n` on a domain with unique derivatives, then its bundled derivative
 is `C^m` when `m+1 ≤ n`. -/
 theorem ContMDiffOn.contMDiffOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (hmn : m + 1 ≤ n)
-    (hs : UniqueMdiffOn I s) :
+    (hs : UniqueMDiffOn I s) :
     ContMDiffOn I.tangent I'.tangent m (tangentMapWithin I I' f s) (π (TangentSpace I) ⁻¹' s) :=
   by
   /- The strategy of the proof is to avoid unfolding the definitions, and reduce by functoriality
@@ -495,12 +515,12 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (
     derivative as a composition of a function between model spaces and of charts.
     Convention: statements about the differentiability of `a ∘ b ∘ c` are named `diff_abc`. Statements
     about differentiability in the bundle have a `_lift` suffix. -/
-  have U' : UniqueMdiffOn I s' :=
+  have U' : UniqueMDiffOn I s' :=
     by
-    apply UniqueMdiffOn.inter _ l.open_source
+    apply UniqueMDiffOn.inter _ l.open_source
     rw [ho, inter_comm]
     exact hs.inter o_open
-  have U'l : UniqueMdiffOn I s'l := U'.unique_mdiff_on_preimage (mdifferentiable_chart _ _)
+  have U'l : UniqueMDiffOn I s'l := U'.unique_mdiff_on_preimage (mdifferentiable_chart _ _)
   have diff_f : ContMDiffOn I I' n f s' := hf.mono (by mfld_set_tac)
   have diff_r : ContMDiffOn I' I' n r r.source := contMDiffOn_chart
   have diff_rf : ContMDiffOn I I' n (r ∘ f) s' :=
@@ -555,8 +575,8 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (
     by
     intro q hq
     simp only [s'_lift, mfld_simps] at hq 
-    have U'q : UniqueMdiffWithinAt I s' q.1 := by apply U'; simp only [hq, s', mfld_simps]
-    have U'lq : UniqueMdiffWithinAt I s'l (Dl q).1 := by apply U'l; simp only [hq, s'l, mfld_simps]
+    have U'q : UniqueMDiffWithinAt I s' q.1 := by apply U'; simp only [hq, s', mfld_simps]
+    have U'lq : UniqueMDiffWithinAt I s'l (Dl q).1 := by apply U'l; simp only [hq, s'l, mfld_simps]
     have A :
       tangentMapWithin I I' ((r ∘ f) ∘ l.symm) s'l (il.symm (Dl q)) =
         tangentMapWithin I I' (r ∘ f) s' (tangentMapWithin I I l.symm s'l (il.symm (Dl q))) :=
@@ -600,7 +620,7 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (
           tangentMap I' I' r (tangentMapWithin I I' f s' q) :=
         by
         apply tangentMapWithin_eq_tangentMap
-        · apply IsOpen.uniqueMdiffWithinAt _ r.open_source; simp [hq]
+        · apply IsOpen.uniqueMDiffWithinAt _ r.open_source; simp [hq]
         · refine' mdifferentiableAt_atlas _ (chart_mem_atlas _ _) _
           simp only [hq, mfld_simps]
       have : f p.proj = (tangentMapWithin I I' f s p).1 := rfl
@@ -626,7 +646,7 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (
 /-- If a function is `C^n` on a domain with unique derivatives, with `1 ≤ n`, then its bundled
 derivative is continuous there. -/
 theorem ContMDiffOn.continuousOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (hmn : 1 ≤ n)
-    (hs : UniqueMdiffOn I s) :
+    (hs : UniqueMDiffOn I s) :
     ContinuousOn (tangentMapWithin I I' f s) (π (TangentSpace I) ⁻¹' s) :=
   haveI :
     ContMDiffOn I.tangent I'.tangent 0 (tangentMapWithin I I' f s) (π (TangentSpace I) ⁻¹' s) :=
@@ -639,7 +659,7 @@ theorem ContMDiff.contMDiff_tangentMap (hf : ContMDiff I I' n f) (hmn : m + 1 
     ContMDiff I.tangent I'.tangent m (tangentMap I I' f) :=
   by
   rw [← contMDiffOn_univ] at hf ⊢
-  convert hf.cont_mdiff_on_tangent_map_within hmn uniqueMdiffOn_univ
+  convert hf.cont_mdiff_on_tangent_map_within hmn uniqueMDiffOn_univ
   rw [tangentMapWithin_univ]
 #align cont_mdiff.cont_mdiff_tangent_map ContMDiff.contMDiff_tangentMap
 
@@ -649,7 +669,7 @@ theorem ContMDiff.continuous_tangentMap (hf : ContMDiff I I' n f) (hmn : 1 ≤ n
   by
   rw [← contMDiffOn_univ] at hf 
   rw [continuous_iff_continuousOn_univ]
-  convert hf.continuous_on_tangent_map_within hmn uniqueMdiffOn_univ
+  convert hf.continuous_on_tangent_map_within hmn uniqueMDiffOn_univ
   rw [tangentMapWithin_univ]
 #align cont_mdiff.continuous_tangent_map ContMDiff.continuous_tangentMap
 
@@ -684,7 +704,7 @@ theorem tangentMap_tangentBundle_pure (p : TangentBundle I M) :
     apply IsOpen.mem_nhds
     apply (LocalHomeomorph.open_target _).Preimage I.continuous_inv_fun
     simp only [mfld_simps]
-  have A : MdifferentiableAt I I.tangent (fun x => @total_space_mk M (TangentSpace I) x 0) x :=
+  have A : MDifferentiableAt I I.tangent (fun x => @total_space_mk M (TangentSpace I) x 0) x :=
     haveI : Smooth I (I.prod 𝓘(𝕜, E)) (zero_section (TangentSpace I : M → Type _)) :=
       Bundle.smooth_zeroSection 𝕜 (TangentSpace I : M → Type _)
     this.mdifferentiable_at
@@ -719,17 +739,17 @@ namespace ContMDiffMap
 -- They could be moved to another file (perhaps a new file) if desired.
 open scoped Manifold
 
-protected theorem mdifferentiable' (f : C^n⟮I, M; I', M'⟯) (hn : 1 ≤ n) : Mdifferentiable I I' f :=
-  f.ContMDiff.Mdifferentiable hn
+protected theorem mdifferentiable' (f : C^n⟮I, M; I', M'⟯) (hn : 1 ≤ n) : MDifferentiable I I' f :=
+  f.ContMDiff.MDifferentiable hn
 #align cont_mdiff_map.mdifferentiable' ContMDiffMap.mdifferentiable'
 
-protected theorem mdifferentiable (f : C^∞⟮I, M; I', M'⟯) : Mdifferentiable I I' f :=
-  f.ContMDiff.Mdifferentiable le_top
-#align cont_mdiff_map.mdifferentiable ContMDiffMap.mdifferentiable
+protected theorem mDifferentiable (f : C^∞⟮I, M; I', M'⟯) : MDifferentiable I I' f :=
+  f.ContMDiff.MDifferentiable le_top
+#align cont_mdiff_map.mdifferentiable ContMDiffMap.mDifferentiable
 
-protected theorem mdifferentiableAt (f : C^∞⟮I, M; I', M'⟯) {x} : MdifferentiableAt I I' f x :=
-  f.Mdifferentiable x
-#align cont_mdiff_map.mdifferentiable_at ContMDiffMap.mdifferentiableAt
+protected theorem mDifferentiableAt (f : C^∞⟮I, M; I', M'⟯) {x} : MDifferentiableAt I I' f x :=
+  f.MDifferentiable x
+#align cont_mdiff_map.mdifferentiable_at ContMDiffMap.mDifferentiableAt
 
 end ContMDiffMap
 
Diff
@@ -711,7 +711,7 @@ theorem tangentMap_tangentBundle_pure (p : TangentBundle I M) :
 
 end TangentBundle
 
-namespace ContMdiffMap
+namespace ContMDiffMap
 
 -- These helpers for dot notation have been moved here from `geometry.manifold.cont_mdiff_map`
 -- to avoid needing to import `geometry.manifold.cont_mdiff_mfderiv` there.
@@ -721,15 +721,15 @@ open scoped Manifold
 
 protected theorem mdifferentiable' (f : C^n⟮I, M; I', M'⟯) (hn : 1 ≤ n) : Mdifferentiable I I' f :=
   f.ContMDiff.Mdifferentiable hn
-#align cont_mdiff_map.mdifferentiable' ContMdiffMap.mdifferentiable'
+#align cont_mdiff_map.mdifferentiable' ContMDiffMap.mdifferentiable'
 
 protected theorem mdifferentiable (f : C^∞⟮I, M; I', M'⟯) : Mdifferentiable I I' f :=
   f.ContMDiff.Mdifferentiable le_top
-#align cont_mdiff_map.mdifferentiable ContMdiffMap.mdifferentiable
+#align cont_mdiff_map.mdifferentiable ContMDiffMap.mdifferentiable
 
 protected theorem mdifferentiableAt (f : C^∞⟮I, M; I', M'⟯) {x} : MdifferentiableAt I I' f x :=
   f.Mdifferentiable x
-#align cont_mdiff_map.mdifferentiable_at ContMdiffMap.mdifferentiableAt
+#align cont_mdiff_map.mdifferentiable_at ContMDiffMap.mdifferentiableAt
 
-end ContMdiffMap
+end ContMDiffMap
 
Diff
@@ -65,7 +65,7 @@ variable {𝕜 : Type _} [NontriviallyNormedField 𝕜]
 /-! ### Deducing differentiability from smoothness -/
 
 
-theorem ContMdiffWithinAt.mdifferentiableWithinAt (hf : ContMdiffWithinAt I I' n f s x)
+theorem ContMDiffWithinAt.mdifferentiableWithinAt (hf : ContMDiffWithinAt I I' n f s x)
     (hn : 1 ≤ n) : MdifferentiableWithinAt I I' f s x :=
   by
   suffices h : MdifferentiableWithinAt I I' f (s ∩ f ⁻¹' (extChartAt I' (f x)).source) x
@@ -74,20 +74,20 @@ theorem ContMdiffWithinAt.mdifferentiableWithinAt (hf : ContMdiffWithinAt I I' n
     exact extChartAt_source_mem_nhds I' (f x)
   rw [mdifferentiableWithinAt_iff]
   exact ⟨hf.1.mono (inter_subset_left _ _), (hf.2.DifferentiableWithinAt hn).mono (by mfld_set_tac)⟩
-#align cont_mdiff_within_at.mdifferentiable_within_at ContMdiffWithinAt.mdifferentiableWithinAt
+#align cont_mdiff_within_at.mdifferentiable_within_at ContMDiffWithinAt.mdifferentiableWithinAt
 
-theorem ContMdiffAt.mdifferentiableAt (hf : ContMdiffAt I I' n f x) (hn : 1 ≤ n) :
+theorem ContMDiffAt.mdifferentiableAt (hf : ContMDiffAt I I' n f x) (hn : 1 ≤ n) :
     MdifferentiableAt I I' f x :=
-  mdifferentiableWithinAt_univ.1 <| ContMdiffWithinAt.mdifferentiableWithinAt hf hn
-#align cont_mdiff_at.mdifferentiable_at ContMdiffAt.mdifferentiableAt
+  mdifferentiableWithinAt_univ.1 <| ContMDiffWithinAt.mdifferentiableWithinAt hf hn
+#align cont_mdiff_at.mdifferentiable_at ContMDiffAt.mdifferentiableAt
 
-theorem ContMdiffOn.mdifferentiableOn (hf : ContMdiffOn I I' n f s) (hn : 1 ≤ n) :
+theorem ContMDiffOn.mdifferentiableOn (hf : ContMDiffOn I I' n f s) (hn : 1 ≤ n) :
     MdifferentiableOn I I' f s := fun x hx => (hf x hx).MdifferentiableWithinAt hn
-#align cont_mdiff_on.mdifferentiable_on ContMdiffOn.mdifferentiableOn
+#align cont_mdiff_on.mdifferentiable_on ContMDiffOn.mdifferentiableOn
 
-theorem ContMdiff.mdifferentiable (hf : ContMdiff I I' n f) (hn : 1 ≤ n) : Mdifferentiable I I' f :=
+theorem ContMDiff.mdifferentiable (hf : ContMDiff I I' n f) (hn : 1 ≤ n) : Mdifferentiable I I' f :=
   fun x => (hf x).MdifferentiableAt hn
-#align cont_mdiff.mdifferentiable ContMdiff.mdifferentiable
+#align cont_mdiff.mdifferentiable ContMDiff.mdifferentiable
 
 theorem SmoothWithinAt.mdifferentiableWithinAt (hf : SmoothWithinAt I I' f s x) :
     MdifferentiableWithinAt I I' f s x :=
@@ -103,7 +103,7 @@ theorem SmoothOn.mdifferentiableOn (hf : SmoothOn I I' f s) : MdifferentiableOn
 #align smooth_on.mdifferentiable_on SmoothOn.mdifferentiableOn
 
 theorem Smooth.mdifferentiable (hf : Smooth I I' f) : Mdifferentiable I I' f :=
-  ContMdiff.mdifferentiable hf le_top
+  ContMDiff.mdifferentiable hf le_top
 #align smooth.mdifferentiable Smooth.mdifferentiable
 
 theorem Smooth.mdifferentiableAt (hf : Smooth I I' f) : MdifferentiableAt I I' f x :=
@@ -129,10 +129,10 @@ This result is used to show that maps into the 1-jet bundle and cotangent bundle
 This result should be generalized to a `cont_mdiff_within_at` for `mfderiv_within`.
 If we do that, we can deduce `cont_mdiff_on.cont_mdiff_on_tangent_map_within` from this.
 -/
-theorem ContMdiffAt.mfderiv {x₀ : N} (f : N → M → M') (g : N → M)
-    (hf : ContMdiffAt (J.Prod I) I' n (Function.uncurry f) (x₀, g x₀)) (hg : ContMdiffAt J I m g x₀)
+theorem ContMDiffAt.mfderiv {x₀ : N} (f : N → M → M') (g : N → M)
+    (hf : ContMDiffAt (J.Prod I) I' n (Function.uncurry f) (x₀, g x₀)) (hg : ContMDiffAt J I m g x₀)
     (hmn : m + 1 ≤ n) :
-    ContMdiffAt J 𝓘(𝕜, E →L[𝕜] E') m
+    ContMDiffAt J 𝓘(𝕜, E →L[𝕜] E') m
       (inTangentCoordinates I I' g (fun x => f x (g x)) (fun x => mfderiv I I' (f x) (g x)) x₀)
       x₀ :=
   by
@@ -140,10 +140,10 @@ theorem ContMdiffAt.mfderiv {x₀ : N} (f : N → M → M') (g : N → M)
     apply ContinuousAt.comp (by apply hf.continuous_at) (continuous_at_id.prod hg.continuous_at)
   have h4f := h4f.preimage_mem_nhds (extChartAt_source_mem_nhds I' (f x₀ (g x₀)))
   have h3f := cont_mdiff_at_iff_cont_mdiff_at_nhds.mp (hf.of_le <| (self_le_add_left 1 m).trans hmn)
-  have h2f : ∀ᶠ x₂ in 𝓝 x₀, ContMdiffAt I I' 1 (f x₂) (g x₂) :=
+  have h2f : ∀ᶠ x₂ in 𝓝 x₀, ContMDiffAt I I' 1 (f x₂) (g x₂) :=
     by
     refine' ((continuous_at_id.prod hg.continuous_at).Tendsto.Eventually h3f).mono fun x hx => _
-    exact hx.comp (g x) (cont_mdiff_at_const.prod_mk contMdiffAt_id)
+    exact hx.comp (g x) (cont_mdiff_at_const.prod_mk contMDiffAt_id)
   have h2g := hg.continuous_at.preimage_mem_nhds (extChartAt_source_mem_nhds I (g x₀))
   have :
     ContDiffWithinAt 𝕜 m
@@ -153,7 +153,7 @@ theorem ContMdiffAt.mfderiv {x₀ : N} (f : N → M → M') (g : N → M)
           (range I) (extChartAt I (g x₀) (g ((extChartAt J x₀).symm x))))
       (range J) (extChartAt J x₀ x₀) :=
     by
-    rw [contMdiffAt_iff] at hf hg 
+    rw [contMDiffAt_iff] at hf hg 
     simp_rw [Function.comp, uncurry, extChartAt_prod, LocalEquiv.prod_coe_symm,
       ModelWithCorners.range_prod] at hf ⊢
     refine' ContDiffWithinAt.fderivWithin _ hg.2 I.unique_diff hmn (mem_range_self _) _
@@ -162,17 +162,17 @@ theorem ContMdiffAt.mfderiv {x₀ : N} (f : N → M → M') (g : N → M)
       rintro _ ⟨x, hx, rfl⟩
       exact mem_range_self _
   have :
-    ContMdiffAt J 𝓘(𝕜, E →L[𝕜] E') m
+    ContMDiffAt J 𝓘(𝕜, E →L[𝕜] E') m
       (fun x =>
         fderivWithin 𝕜 (extChartAt I' (f x₀ (g x₀)) ∘ f x ∘ (extChartAt I (g x₀)).symm) (range I)
           (extChartAt I (g x₀) (g x)))
       x₀ :=
     by
-    simp_rw [contMdiffAt_iff_source_of_mem_source (mem_chart_source G x₀),
-      contMdiffWithinAt_iff_contDiffWithinAt, Function.comp]
+    simp_rw [contMDiffAt_iff_source_of_mem_source (mem_chart_source G x₀),
+      contMDiffWithinAt_iff_contDiffWithinAt, Function.comp]
     exact this
   have :
-    ContMdiffAt J 𝓘(𝕜, E →L[𝕜] E') m
+    ContMDiffAt J 𝓘(𝕜, E →L[𝕜] E') m
       (fun x =>
         fderivWithin 𝕜
           (extChartAt I' (f x₀ (g x₀)) ∘
@@ -208,7 +208,7 @@ theorem ContMdiffAt.mfderiv {x₀ : N} (f : N → M → M') (g : N → M)
   /- The conclusion is equal to the following, when unfolding coord_change of
       `tangent_bundle_core` -/
   have :
-    ContMdiffAt J 𝓘(𝕜, E →L[𝕜] E') m
+    ContMDiffAt J 𝓘(𝕜, E →L[𝕜] E') m
       (fun x =>
         (fderivWithin 𝕜 (extChartAt I' (f x₀ (g x₀)) ∘ (extChartAt I' (f x (g x))).symm) (range I')
               (extChartAt I' (f x (g x)) (f x (g x)))).comp
@@ -246,7 +246,7 @@ theorem ContMdiffAt.mfderiv {x₀ : N} (f : N → M → M') (g : N → M)
   · rfl
   · rwa [extChartAt_source] at hx 
   · rwa [extChartAt_source] at h2x 
-#align cont_mdiff_at.mfderiv ContMdiffAt.mfderiv
+#align cont_mdiff_at.mfderiv ContMDiffAt.mfderiv
 
 /-- The derivative `D_yf(y)` is `C^m` at `x₀`, where the derivative is taken as a continuous
 linear map. We have to assume that `f` is `C^n` at `x₀` for some `n ≥ m + 1`.
@@ -254,13 +254,13 @@ We have to insert a coordinate change from `x₀` to `x` to make the derivative
 This is a special case of `cont_mdiff_at.mfderiv` where `f` does not contain any parameters and
 `g = id`.
 -/
-theorem ContMdiffAt.mfderiv_const {x₀ : M} {f : M → M'} (hf : ContMdiffAt I I' n f x₀)
+theorem ContMDiffAt.mfderiv_const {x₀ : M} {f : M → M'} (hf : ContMDiffAt I I' n f x₀)
     (hmn : m + 1 ≤ n) :
-    ContMdiffAt I 𝓘(𝕜, E →L[𝕜] E') m (inTangentCoordinates I I' id f (mfderiv I I' f) x₀) x₀ :=
-  haveI : ContMdiffAt (I.prod I) I' n (fun x : M × M => f x.2) (x₀, x₀) :=
-    ContMdiffAt.comp (x₀, x₀) hf contMdiffAt_snd
-  this.mfderiv (fun x => f) id contMdiffAt_id hmn
-#align cont_mdiff_at.mfderiv_const ContMdiffAt.mfderiv_const
+    ContMDiffAt I 𝓘(𝕜, E →L[𝕜] E') m (inTangentCoordinates I I' id f (mfderiv I I' f) x₀) x₀ :=
+  haveI : ContMDiffAt (I.prod I) I' n (fun x : M × M => f x.2) (x₀, x₀) :=
+    ContMDiffAt.comp (x₀, x₀) hf contMDiffAt_snd
+  this.mfderiv (fun x => f) id contMDiffAt_id hmn
+#align cont_mdiff_at.mfderiv_const ContMDiffAt.mfderiv_const
 
 /-- The function that sends `x` to the `y`-derivative of `f(x,y)` at `g(x)` applied to `g₂(x)` is
 `C^n` at `x₀`, where the derivative is taken as a continuous linear map.
@@ -270,17 +270,17 @@ We have to insert a coordinate change from `x₀` to `g₁(x)` to make the deriv
 This is  similar to `cont_mdiff_at.mfderiv`, but where the continuous linear map is applied to a
 (variable) vector.
 -/
-theorem ContMdiffAt.mfderiv_apply {x₀ : N'} (f : N → M → M') (g : N → M) (g₁ : N' → N) (g₂ : N' → E)
-    (hf : ContMdiffAt (J.Prod I) I' n (Function.uncurry f) (g₁ x₀, g (g₁ x₀)))
-    (hg : ContMdiffAt J I m g (g₁ x₀)) (hg₁ : ContMdiffAt J' J m g₁ x₀)
-    (hg₂ : ContMdiffAt J' 𝓘(𝕜, E) m g₂ x₀) (hmn : m + 1 ≤ n) :
-    ContMdiffAt J' 𝓘(𝕜, E') m
+theorem ContMDiffAt.mfderiv_apply {x₀ : N'} (f : N → M → M') (g : N → M) (g₁ : N' → N) (g₂ : N' → E)
+    (hf : ContMDiffAt (J.Prod I) I' n (Function.uncurry f) (g₁ x₀, g (g₁ x₀)))
+    (hg : ContMDiffAt J I m g (g₁ x₀)) (hg₁ : ContMDiffAt J' J m g₁ x₀)
+    (hg₂ : ContMDiffAt J' 𝓘(𝕜, E) m g₂ x₀) (hmn : m + 1 ≤ n) :
+    ContMDiffAt J' 𝓘(𝕜, E') m
       (fun x =>
         inTangentCoordinates I I' g (fun x => f x (g x)) (fun x => mfderiv I I' (f x) (g x)) (g₁ x₀)
           (g₁ x) (g₂ x))
       x₀ :=
   ((hf.mfderiv f g hg hmn).comp_of_eq hg₁ rfl).clm_apply hg₂
-#align cont_mdiff_at.mfderiv_apply ContMdiffAt.mfderiv_apply
+#align cont_mdiff_at.mfderiv_apply ContMDiffAt.mfderiv_apply
 
 end mfderiv
 
@@ -293,8 +293,8 @@ section tangentMap
 derivative is continuous. In this auxiliary lemma, we prove this fact when the source and target
 space are model spaces in models with corners. The general fact is proved in
 `cont_mdiff_on.continuous_on_tangent_map_within`-/
-theorem ContMdiffOn.continuousOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
-    (hf : ContMdiffOn I I' n f s) (hn : 1 ≤ n) (hs : UniqueMdiffOn I s) :
+theorem ContMDiffOn.continuousOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
+    (hf : ContMDiffOn I I' n f s) (hn : 1 ≤ n) (hs : UniqueMdiffOn I s) :
     ContinuousOn (tangentMapWithin I I' f s) (π (TangentSpace I) ⁻¹' s) :=
   by
   suffices h :
@@ -349,7 +349,7 @@ theorem ContMdiffOn.continuousOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
       refine' (ContinuousOn.comp C continuous_fst.continuous_on _ : _)
       exact preimage_mono (subset_preimage_image _ _)
     exact A.comp_continuous_on B
-  rw [contMdiffOn_iff] at hf 
+  rw [contMDiffOn_iff] at hf 
   let x : H := I.symm (0 : E)
   let y : H' := I'.symm (0 : E')
   have A := hf.2 x y
@@ -357,7 +357,7 @@ theorem ContMdiffOn.continuousOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
   apply A.continuous_on_fderiv_within _ hn
   convert hs.unique_diff_on_target_inter x using 1
   simp only [inter_comm, mfld_simps]
-#align cont_mdiff_on.continuous_on_tangent_map_within_aux ContMdiffOn.continuousOn_tangentMapWithin_aux
+#align cont_mdiff_on.continuous_on_tangent_map_within_aux ContMDiffOn.continuousOn_tangentMapWithin_aux
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
@@ -369,9 +369,9 @@ theorem ContMdiffOn.continuousOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
 `C^m` when `m+1 ≤ n`. In this auxiliary lemma, we prove this fact when the source and target space
 are model spaces in models with corners. The general fact is proved in
 `cont_mdiff_on.cont_mdiff_on_tangent_map_within` -/
-theorem ContMdiffOn.contMdiffOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
-    (hf : ContMdiffOn I I' n f s) (hmn : m + 1 ≤ n) (hs : UniqueMdiffOn I s) :
-    ContMdiffOn I.tangent I'.tangent m (tangentMapWithin I I' f s) (π (TangentSpace I) ⁻¹' s) :=
+theorem ContMDiffOn.contMDiffOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
+    (hf : ContMDiffOn I I' n f s) (hmn : m + 1 ≤ n) (hs : UniqueMdiffOn I s) :
+    ContMDiffOn I.tangent I'.tangent m (tangentMapWithin I I' f s) (π (TangentSpace I) ⁻¹' s) :=
   by
   have m_le_n : m ≤ n := by
     apply le_trans _ hmn
@@ -386,7 +386,7 @@ theorem ContMdiffOn.contMdiffOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
     intro y hy
     simpa only [UniqueMdiffOn, UniqueMdiffWithinAt, hy.1, inter_comm, mfld_simps] using
       hs (I.symm y) hy.2
-  rw [contMdiffOn_iff]
+  rw [contMDiffOn_iff]
   refine' ⟨hf.continuous_on_tangent_map_within_aux one_le_n hs, fun p q => _⟩
   have A :
     range I ×ˢ univ ∩
@@ -407,7 +407,7 @@ theorem ContMdiffOn.contMdiffOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
         ((I' (f (I.symm p.fst)), (mfderivWithin I I' f s (I.symm p.fst) : E → E') p.snd) : E' × E'))
       ((range I ∩ I.symm ⁻¹' s) ×ˢ univ)
   -- check that all bits in this formula are `C^n`
-  have hf' := contMdiffOn_iff.1 hf
+  have hf' := contMDiffOn_iff.1 hf
   have A : ContDiffOn 𝕜 m (I' ∘ f ∘ I.symm) (range I ∩ I.symm ⁻¹' s) := by
     simpa only [mfld_simps] using (hf'.2 (I.symm 0) (I'.symm 0)).of_le m_le_n
   have B : ContDiffOn 𝕜 m ((I' ∘ f ∘ I.symm) ∘ Prod.fst) ((range I ∩ I.symm ⁻¹' s) ×ˢ univ) :=
@@ -430,13 +430,13 @@ theorem ContMdiffOn.contMdiffOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
   have := D.comp cont_diff_fst.cont_diff_on (prod_subset_preimage_fst _ _)
   have := ContDiffOn.prod this cont_diff_snd.cont_diff_on
   exact is_bounded_bilinear_map_apply.cont_diff.comp_cont_diff_on this
-#align cont_mdiff_on.cont_mdiff_on_tangent_map_within_aux ContMdiffOn.contMdiffOn_tangentMapWithin_aux
+#align cont_mdiff_on.cont_mdiff_on_tangent_map_within_aux ContMDiffOn.contMDiffOn_tangentMapWithin_aux
 
 /-- If a function is `C^n` on a domain with unique derivatives, then its bundled derivative
 is `C^m` when `m+1 ≤ n`. -/
-theorem ContMdiffOn.contMdiffOn_tangentMapWithin (hf : ContMdiffOn I I' n f s) (hmn : m + 1 ≤ n)
+theorem ContMDiffOn.contMDiffOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (hmn : m + 1 ≤ n)
     (hs : UniqueMdiffOn I s) :
-    ContMdiffOn I.tangent I'.tangent m (tangentMapWithin I I' f s) (π (TangentSpace I) ⁻¹' s) :=
+    ContMDiffOn I.tangent I'.tangent m (tangentMapWithin I I' f s) (π (TangentSpace I) ⁻¹' s) :=
   by
   /- The strategy of the proof is to avoid unfolding the definitions, and reduce by functoriality
     to the case of functions on the model spaces, where we have already proved the result.
@@ -464,8 +464,8 @@ theorem ContMdiffOn.contMdiffOn_tangentMapWithin (hf : ContMdiffOn I I' n f s) (
     change 0 + 1 ≤ m + 1
     exact add_le_add_right (zero_le _) _
   -- First step: local reduction on the space, to a set `s'` which is contained in chart domains.
-  refine' contMdiffOn_of_locally_contMdiffOn fun p hp => _
-  have hf' := contMdiffOn_iff.1 hf
+  refine' contMDiffOn_of_locally_contMDiffOn fun p hp => _
+  have hf' := contMDiffOn_iff.1 hf
   simp only [mfld_simps] at hp 
   let l := chart_at H p.proj
   set Dl := chart_at (ModelProd H E) p with hDl
@@ -478,7 +478,7 @@ theorem ContMdiffOn.contMdiffOn_tangentMapWithin (hf : ContMdiffOn I I' n f s) (
   let s'l := l.target ∩ l.symm ⁻¹' s'
   let s'l_lift := π (TangentSpace I) ⁻¹' s'l
   rcases continuousOn_iff'.1 hf'.1 r.source r.open_source with ⟨o, o_open, ho⟩
-  suffices h : ContMdiffOn I.tangent I'.tangent m (tangentMapWithin I I' f s) s'_lift
+  suffices h : ContMDiffOn I.tangent I'.tangent m (tangentMapWithin I I' f s) s'_lift
   · refine' ⟨π (TangentSpace I) ⁻¹' (o ∩ l.source), _, _, _⟩
     show IsOpen (π (TangentSpace I) ⁻¹' (o ∩ l.source));
     exact (IsOpen.inter o_open l.open_source).Preimage (continuous_proj E _)
@@ -501,49 +501,49 @@ theorem ContMdiffOn.contMdiffOn_tangentMapWithin (hf : ContMdiffOn I I' n f s) (
     rw [ho, inter_comm]
     exact hs.inter o_open
   have U'l : UniqueMdiffOn I s'l := U'.unique_mdiff_on_preimage (mdifferentiable_chart _ _)
-  have diff_f : ContMdiffOn I I' n f s' := hf.mono (by mfld_set_tac)
-  have diff_r : ContMdiffOn I' I' n r r.source := contMdiffOn_chart
-  have diff_rf : ContMdiffOn I I' n (r ∘ f) s' :=
+  have diff_f : ContMDiffOn I I' n f s' := hf.mono (by mfld_set_tac)
+  have diff_r : ContMDiffOn I' I' n r r.source := contMDiffOn_chart
+  have diff_rf : ContMDiffOn I I' n (r ∘ f) s' :=
     by
-    apply ContMdiffOn.comp diff_r diff_f fun x hx => _
+    apply ContMDiffOn.comp diff_r diff_f fun x hx => _
     simp only [s', mfld_simps] at hx ; simp only [hx, mfld_simps]
-  have diff_l : ContMdiffOn I I n l.symm s'l :=
-    haveI A : ContMdiffOn I I n l.symm l.target := contMdiffOn_chart_symm
+  have diff_l : ContMDiffOn I I n l.symm s'l :=
+    haveI A : ContMDiffOn I I n l.symm l.target := contMDiffOn_chart_symm
     A.mono (by mfld_set_tac)
-  have diff_rfl : ContMdiffOn I I' n (r ∘ f ∘ l.symm) s'l :=
+  have diff_rfl : ContMDiffOn I I' n (r ∘ f ∘ l.symm) s'l :=
     by
-    apply ContMdiffOn.comp diff_rf diff_l
+    apply ContMDiffOn.comp diff_rf diff_l
     mfld_set_tac
   have diff_rfl_lift :
-    ContMdiffOn I.tangent I'.tangent m (tangentMapWithin I I' (r ∘ f ∘ l.symm) s'l) s'l_lift :=
+    ContMDiffOn I.tangent I'.tangent m (tangentMapWithin I I' (r ∘ f ∘ l.symm) s'l) s'l_lift :=
     diff_rfl.cont_mdiff_on_tangent_map_within_aux hmn U'l
   have diff_irrfl_lift :
-    ContMdiffOn I.tangent I'.tangent m (ir ∘ tangentMapWithin I I' (r ∘ f ∘ l.symm) s'l) s'l_lift :=
-    haveI A : ContMdiffOn I'.tangent I'.tangent m ir ir.source := contMdiffOn_chart
-    ContMdiffOn.comp A diff_rfl_lift fun p hp => by simp only [ir, mfld_simps]
+    ContMDiffOn I.tangent I'.tangent m (ir ∘ tangentMapWithin I I' (r ∘ f ∘ l.symm) s'l) s'l_lift :=
+    haveI A : ContMDiffOn I'.tangent I'.tangent m ir ir.source := contMDiffOn_chart
+    ContMDiffOn.comp A diff_rfl_lift fun p hp => by simp only [ir, mfld_simps]
   have diff_Drirrfl_lift :
-    ContMdiffOn I.tangent I'.tangent m (Dr.symm ∘ ir ∘ tangentMapWithin I I' (r ∘ f ∘ l.symm) s'l)
+    ContMDiffOn I.tangent I'.tangent m (Dr.symm ∘ ir ∘ tangentMapWithin I I' (r ∘ f ∘ l.symm) s'l)
       s'l_lift :=
     by
-    have A : ContMdiffOn I'.tangent I'.tangent m Dr.symm Dr.target := contMdiffOn_chart_symm
-    apply ContMdiffOn.comp A diff_irrfl_lift fun p hp => _
+    have A : ContMDiffOn I'.tangent I'.tangent m Dr.symm Dr.target := contMDiffOn_chart_symm
+    apply ContMDiffOn.comp A diff_irrfl_lift fun p hp => _
     simp only [s'l_lift, mfld_simps] at hp 
     simp only [ir, hp, mfld_simps]
   -- conclusion of this step: the composition of all the maps above is smooth
   have diff_DrirrflilDl :
-    ContMdiffOn I.tangent I'.tangent m
+    ContMDiffOn I.tangent I'.tangent m
       (Dr.symm ∘ (ir ∘ tangentMapWithin I I' (r ∘ f ∘ l.symm) s'l) ∘ il.symm ∘ Dl) s'_lift :=
     by
-    have A : ContMdiffOn I.tangent I.tangent m Dl Dl.source := contMdiffOn_chart
-    have A' : ContMdiffOn I.tangent I.tangent m Dl s'_lift :=
+    have A : ContMDiffOn I.tangent I.tangent m Dl Dl.source := contMDiffOn_chart
+    have A' : ContMDiffOn I.tangent I.tangent m Dl s'_lift :=
       by
       apply A.mono fun p hp => _
       simp only [s'_lift, mfld_simps] at hp 
       simp only [Dl, hp, mfld_simps]
-    have B : ContMdiffOn I.tangent I.tangent m il.symm il.target := contMdiffOn_chart_symm
-    have C : ContMdiffOn I.tangent I.tangent m (il.symm ∘ Dl) s'_lift :=
-      ContMdiffOn.comp B A' fun p hp => by simp only [il, mfld_simps]
-    apply ContMdiffOn.comp diff_Drirrfl_lift C fun p hp => _
+    have B : ContMDiffOn I.tangent I.tangent m il.symm il.target := contMDiffOn_chart_symm
+    have C : ContMDiffOn I.tangent I.tangent m (il.symm ∘ Dl) s'_lift :=
+      ContMDiffOn.comp B A' fun p hp => by simp only [il, mfld_simps]
+    apply ContMDiffOn.comp diff_Drirrfl_lift C fun p hp => _
     simp only [s'_lift, mfld_simps] at hp 
     simp only [il, s'l_lift, hp, total_space.proj, mfld_simps]
   /- Third step: check that the composition of all the maps indeed coincides with the derivative we
@@ -621,37 +621,37 @@ theorem ContMdiffOn.contMdiffOn_tangentMapWithin (hf : ContMdiffOn I I' n f s) (
       simp only [hq, mfld_simps]
     simp only [(· ∘ ·), A, B, C, D, E.symm]
   exact diff_DrirrflilDl.congr eq_comp
-#align cont_mdiff_on.cont_mdiff_on_tangent_map_within ContMdiffOn.contMdiffOn_tangentMapWithin
+#align cont_mdiff_on.cont_mdiff_on_tangent_map_within ContMDiffOn.contMDiffOn_tangentMapWithin
 
 /-- If a function is `C^n` on a domain with unique derivatives, with `1 ≤ n`, then its bundled
 derivative is continuous there. -/
-theorem ContMdiffOn.continuousOn_tangentMapWithin (hf : ContMdiffOn I I' n f s) (hmn : 1 ≤ n)
+theorem ContMDiffOn.continuousOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (hmn : 1 ≤ n)
     (hs : UniqueMdiffOn I s) :
     ContinuousOn (tangentMapWithin I I' f s) (π (TangentSpace I) ⁻¹' s) :=
   haveI :
-    ContMdiffOn I.tangent I'.tangent 0 (tangentMapWithin I I' f s) (π (TangentSpace I) ⁻¹' s) :=
+    ContMDiffOn I.tangent I'.tangent 0 (tangentMapWithin I I' f s) (π (TangentSpace I) ⁻¹' s) :=
     hf.cont_mdiff_on_tangent_map_within hmn hs
   this.continuous_on
-#align cont_mdiff_on.continuous_on_tangent_map_within ContMdiffOn.continuousOn_tangentMapWithin
+#align cont_mdiff_on.continuous_on_tangent_map_within ContMDiffOn.continuousOn_tangentMapWithin
 
 /-- If a function is `C^n`, then its bundled derivative is `C^m` when `m+1 ≤ n`. -/
-theorem ContMdiff.contMdiff_tangentMap (hf : ContMdiff I I' n f) (hmn : m + 1 ≤ n) :
-    ContMdiff I.tangent I'.tangent m (tangentMap I I' f) :=
+theorem ContMDiff.contMDiff_tangentMap (hf : ContMDiff I I' n f) (hmn : m + 1 ≤ n) :
+    ContMDiff I.tangent I'.tangent m (tangentMap I I' f) :=
   by
-  rw [← contMdiffOn_univ] at hf ⊢
+  rw [← contMDiffOn_univ] at hf ⊢
   convert hf.cont_mdiff_on_tangent_map_within hmn uniqueMdiffOn_univ
   rw [tangentMapWithin_univ]
-#align cont_mdiff.cont_mdiff_tangent_map ContMdiff.contMdiff_tangentMap
+#align cont_mdiff.cont_mdiff_tangent_map ContMDiff.contMDiff_tangentMap
 
 /-- If a function is `C^n`, with `1 ≤ n`, then its bundled derivative is continuous. -/
-theorem ContMdiff.continuous_tangentMap (hf : ContMdiff I I' n f) (hmn : 1 ≤ n) :
+theorem ContMDiff.continuous_tangentMap (hf : ContMDiff I I' n f) (hmn : 1 ≤ n) :
     Continuous (tangentMap I I' f) :=
   by
-  rw [← contMdiffOn_univ] at hf 
+  rw [← contMDiffOn_univ] at hf 
   rw [continuous_iff_continuousOn_univ]
   convert hf.continuous_on_tangent_map_within hmn uniqueMdiffOn_univ
   rw [tangentMapWithin_univ]
-#align cont_mdiff.continuous_tangent_map ContMdiff.continuous_tangentMap
+#align cont_mdiff.continuous_tangent_map ContMDiff.continuous_tangentMap
 
 end tangentMap
 
@@ -720,11 +720,11 @@ namespace ContMdiffMap
 open scoped Manifold
 
 protected theorem mdifferentiable' (f : C^n⟮I, M; I', M'⟯) (hn : 1 ≤ n) : Mdifferentiable I I' f :=
-  f.ContMdiff.Mdifferentiable hn
+  f.ContMDiff.Mdifferentiable hn
 #align cont_mdiff_map.mdifferentiable' ContMdiffMap.mdifferentiable'
 
 protected theorem mdifferentiable (f : C^∞⟮I, M; I', M'⟯) : Mdifferentiable I I' f :=
-  f.ContMdiff.Mdifferentiable le_top
+  f.ContMDiff.Mdifferentiable le_top
 #align cont_mdiff_map.mdifferentiable ContMdiffMap.mdifferentiable
 
 protected theorem mdifferentiableAt (f : C^∞⟮I, M; I', M'⟯) {x} : MdifferentiableAt I I' f x :=
Diff
@@ -119,8 +119,6 @@ theorem Smooth.mdifferentiableWithinAt (hf : Smooth I I' f) : MdifferentiableWit
 
 section mfderiv
 
-include Is I's Js
-
 /-- The function that sends `x` to the `y`-derivative of `f(x,y)` at `g(x)` is `C^m` at `x₀`,
 where the derivative is taken as a continuous linear map.
 We have to assume that `f` is `C^n` at `(x₀, g(x₀))` for `n ≥ m + 1` and `g` is `C^m` at `x₀`.
@@ -250,8 +248,6 @@ theorem ContMdiffAt.mfderiv {x₀ : N} (f : N → M → M') (g : N → M)
   · rwa [extChartAt_source] at h2x 
 #align cont_mdiff_at.mfderiv ContMdiffAt.mfderiv
 
-omit Js
-
 /-- The derivative `D_yf(y)` is `C^m` at `x₀`, where the derivative is taken as a continuous
 linear map. We have to assume that `f` is `C^n` at `x₀` for some `n ≥ m + 1`.
 We have to insert a coordinate change from `x₀` to `x` to make the derivative sensible.
@@ -266,8 +262,6 @@ theorem ContMdiffAt.mfderiv_const {x₀ : M} {f : M → M'} (hf : ContMdiffAt I
   this.mfderiv (fun x => f) id contMdiffAt_id hmn
 #align cont_mdiff_at.mfderiv_const ContMdiffAt.mfderiv_const
 
-include Js
-
 /-- The function that sends `x` to the `y`-derivative of `f(x,y)` at `g(x)` applied to `g₂(x)` is
 `C^n` at `x₀`, where the derivative is taken as a continuous linear map.
 We have to assume that `f` is `C^(n+1)` at `(x₀, g(x₀))` and `g` is `C^n` at `x₀`.
@@ -438,8 +432,6 @@ theorem ContMdiffOn.contMdiffOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
   exact is_bounded_bilinear_map_apply.cont_diff.comp_cont_diff_on this
 #align cont_mdiff_on.cont_mdiff_on_tangent_map_within_aux ContMdiffOn.contMdiffOn_tangentMapWithin_aux
 
-include Is I's
-
 /-- If a function is `C^n` on a domain with unique derivatives, then its bundled derivative
 is `C^m` when `m+1 ≤ n`. -/
 theorem ContMdiffOn.contMdiffOn_tangentMapWithin (hf : ContMdiffOn I I' n f s) (hmn : m + 1 ≤ n)
@@ -665,8 +657,6 @@ end tangentMap
 
 namespace TangentBundle
 
-include Is
-
 variable (I M)
 
 open Bundle
Diff
@@ -4,11 +4,12 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel, Floris van Doorn
 
 ! This file was ported from Lean 3 source module geometry.manifold.cont_mdiff_mfderiv
-! leanprover-community/mathlib commit 3a69562db5a458db8322b190ec8d9a8bbd8a5b14
+! leanprover-community/mathlib commit e354e865255654389cc46e6032160238df2e0f40
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
 import Mathbin.Geometry.Manifold.Mfderiv
+import Mathbin.Geometry.Manifold.ContMdiffMap
 
 /-!
 ### Interactions between differentiability, smoothness and manifold derivatives
@@ -265,6 +266,28 @@ theorem ContMdiffAt.mfderiv_const {x₀ : M} {f : M → M'} (hf : ContMdiffAt I
   this.mfderiv (fun x => f) id contMdiffAt_id hmn
 #align cont_mdiff_at.mfderiv_const ContMdiffAt.mfderiv_const
 
+include Js
+
+/-- The function that sends `x` to the `y`-derivative of `f(x,y)` at `g(x)` applied to `g₂(x)` is
+`C^n` at `x₀`, where the derivative is taken as a continuous linear map.
+We have to assume that `f` is `C^(n+1)` at `(x₀, g(x₀))` and `g` is `C^n` at `x₀`.
+We have to insert a coordinate change from `x₀` to `g₁(x)` to make the derivative sensible.
+
+This is  similar to `cont_mdiff_at.mfderiv`, but where the continuous linear map is applied to a
+(variable) vector.
+-/
+theorem ContMdiffAt.mfderiv_apply {x₀ : N'} (f : N → M → M') (g : N → M) (g₁ : N' → N) (g₂ : N' → E)
+    (hf : ContMdiffAt (J.Prod I) I' n (Function.uncurry f) (g₁ x₀, g (g₁ x₀)))
+    (hg : ContMdiffAt J I m g (g₁ x₀)) (hg₁ : ContMdiffAt J' J m g₁ x₀)
+    (hg₂ : ContMdiffAt J' 𝓘(𝕜, E) m g₂ x₀) (hmn : m + 1 ≤ n) :
+    ContMdiffAt J' 𝓘(𝕜, E') m
+      (fun x =>
+        inTangentCoordinates I I' g (fun x => f x (g x)) (fun x => mfderiv I I' (f x) (g x)) (g₁ x₀)
+          (g₁ x) (g₂ x))
+      x₀ :=
+  ((hf.mfderiv f g hg hmn).comp_of_eq hg₁ rfl).clm_apply hg₂
+#align cont_mdiff_at.mfderiv_apply ContMdiffAt.mfderiv_apply
+
 end mfderiv
 
 /-! ### The tangent map of a smooth function is smooth -/
@@ -698,3 +721,25 @@ theorem tangentMap_tangentBundle_pure (p : TangentBundle I M) :
 
 end TangentBundle
 
+namespace ContMdiffMap
+
+-- These helpers for dot notation have been moved here from `geometry.manifold.cont_mdiff_map`
+-- to avoid needing to import `geometry.manifold.cont_mdiff_mfderiv` there.
+-- (However as a consequence we import `geometry.manifold.cont_mdiff_map` here now.)
+-- They could be moved to another file (perhaps a new file) if desired.
+open scoped Manifold
+
+protected theorem mdifferentiable' (f : C^n⟮I, M; I', M'⟯) (hn : 1 ≤ n) : Mdifferentiable I I' f :=
+  f.ContMdiff.Mdifferentiable hn
+#align cont_mdiff_map.mdifferentiable' ContMdiffMap.mdifferentiable'
+
+protected theorem mdifferentiable (f : C^∞⟮I, M; I', M'⟯) : Mdifferentiable I I' f :=
+  f.ContMdiff.Mdifferentiable le_top
+#align cont_mdiff_map.mdifferentiable ContMdiffMap.mdifferentiable
+
+protected theorem mdifferentiableAt (f : C^∞⟮I, M; I', M'⟯) {x} : MdifferentiableAt I I' f x :=
+  f.Mdifferentiable x
+#align cont_mdiff_map.mdifferentiable_at ContMdiffMap.mdifferentiableAt
+
+end ContMdiffMap
+
Diff
@@ -226,11 +226,11 @@ theorem ContMdiffAt.mfderiv {x₀ : N} (f : N → M → M') (g : N → M)
     have hI :=
       (contDiffWithinAt_ext_coord_change I (g x₂) (g x₀) <|
             LocalEquiv.mem_symm_trans_source _ hx₂ <|
-              mem_ext_chart_source I (g x₂)).DifferentiableWithinAt
+              mem_extChartAt_source I (g x₂)).DifferentiableWithinAt
         le_top
     have hI' :=
       (contDiffWithinAt_ext_coord_change I' (f x₀ (g x₀)) (f x₂ (g x₂)) <|
-            LocalEquiv.mem_symm_trans_source _ (mem_ext_chart_source I' (f x₂ (g x₂)))
+            LocalEquiv.mem_symm_trans_source _ (mem_extChartAt_source I' (f x₂ (g x₂)))
               h3x₂).DifferentiableWithinAt
         le_top
     have h3f := (h2x₂.mdifferentiable_at le_rfl).2
@@ -239,7 +239,7 @@ theorem ContMdiffAt.mfderiv {x₀ : N} (f : N → M → M') (g : N → M)
     · exact fun x _ => mem_range_self _
     ·
       simp_rw [writtenInExtChartAt, Function.comp_apply,
-        (extChartAt I (g x₂)).left_inv (mem_ext_chart_source I (g x₂))]
+        (extChartAt I (g x₂)).left_inv (mem_extChartAt_source I (g x₂))]
     · simp_rw [Function.comp_apply, (extChartAt I (g x₀)).left_inv hx₂]
   refine' this.congr_of_eventually_eq _
   filter_upwards [h2g, h4f] with x hx h2x
Diff
@@ -242,7 +242,7 @@ theorem ContMdiffAt.mfderiv {x₀ : N} (f : N → M → M') (g : N → M)
         (extChartAt I (g x₂)).left_inv (mem_ext_chart_source I (g x₂))]
     · simp_rw [Function.comp_apply, (extChartAt I (g x₀)).left_inv hx₂]
   refine' this.congr_of_eventually_eq _
-  filter_upwards [h2g, h4f]with x hx h2x
+  filter_upwards [h2g, h4f] with x hx h2x
   rw [inTangentCoordinates_eq]
   · rfl
   · rwa [extChartAt_source] at hx 
Diff
@@ -68,7 +68,7 @@ theorem ContMdiffWithinAt.mdifferentiableWithinAt (hf : ContMdiffWithinAt I I' n
     (hn : 1 ≤ n) : MdifferentiableWithinAt I I' f s x :=
   by
   suffices h : MdifferentiableWithinAt I I' f (s ∩ f ⁻¹' (extChartAt I' (f x)).source) x
-  · rwa [mdifferentiableWithinAt_inter'] at h
+  · rwa [mdifferentiableWithinAt_inter'] at h 
     apply hf.1.preimage_mem_nhdsWithin
     exact extChartAt_source_mem_nhds I' (f x)
   rw [mdifferentiableWithinAt_iff]
@@ -154,9 +154,9 @@ theorem ContMdiffAt.mfderiv {x₀ : N} (f : N → M → M') (g : N → M)
           (range I) (extChartAt I (g x₀) (g ((extChartAt J x₀).symm x))))
       (range J) (extChartAt J x₀ x₀) :=
     by
-    rw [contMdiffAt_iff] at hf hg
+    rw [contMdiffAt_iff] at hf hg 
     simp_rw [Function.comp, uncurry, extChartAt_prod, LocalEquiv.prod_coe_symm,
-      ModelWithCorners.range_prod] at hf⊢
+      ModelWithCorners.range_prod] at hf ⊢
     refine' ContDiffWithinAt.fderivWithin _ hg.2 I.unique_diff hmn (mem_range_self _) _
     · simp_rw [extChartAt_to_inv]; exact hf.2
     · rw [← image_subset_iff]
@@ -245,8 +245,8 @@ theorem ContMdiffAt.mfderiv {x₀ : N} (f : N → M → M') (g : N → M)
   filter_upwards [h2g, h4f]with x hx h2x
   rw [inTangentCoordinates_eq]
   · rfl
-  · rwa [extChartAt_source] at hx
-  · rwa [extChartAt_source] at h2x
+  · rwa [extChartAt_source] at hx 
+  · rwa [extChartAt_source] at h2x 
 #align cont_mdiff_at.mfderiv ContMdiffAt.mfderiv
 
 omit Js
@@ -290,14 +290,14 @@ theorem ContMdiffOn.continuousOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
             p.snd))
       (Prod.fst ⁻¹' s)
   · have A := (tangentBundleModelSpaceHomeomorph H I).Continuous
-    rw [continuous_iff_continuousOn_univ] at A
+    rw [continuous_iff_continuousOn_univ] at A 
     have B :=
       ((tangentBundleModelSpaceHomeomorph H' I').symm.Continuous.comp_continuousOn h).comp' A
     have :
       univ ∩ ⇑(tangentBundleModelSpaceHomeomorph H I) ⁻¹' (Prod.fst ⁻¹' s) =
         π (TangentSpace I) ⁻¹' s :=
       by ext ⟨x, v⟩; simp only [mfld_simps]
-    rw [this] at B
+    rw [this] at B 
     apply B.congr
     rintro ⟨x, v⟩ hx
     dsimp [tangentMapWithin]
@@ -332,11 +332,11 @@ theorem ContMdiffOn.continuousOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
       refine' (ContinuousOn.comp C continuous_fst.continuous_on _ : _)
       exact preimage_mono (subset_preimage_image _ _)
     exact A.comp_continuous_on B
-  rw [contMdiffOn_iff] at hf
+  rw [contMdiffOn_iff] at hf 
   let x : H := I.symm (0 : E)
   let y : H' := I'.symm (0 : E')
   have A := hf.2 x y
-  simp only [I.image_eq, inter_comm, mfld_simps] at A⊢
+  simp only [I.image_eq, inter_comm, mfld_simps] at A ⊢
   apply A.continuous_on_fderiv_within _ hn
   convert hs.unique_diff_on_target_inter x using 1
   simp only [inter_comm, mfld_simps]
@@ -401,7 +401,7 @@ theorem ContMdiffOn.contMdiffOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
       ((range I ∩ I.symm ⁻¹' s) ×ˢ univ)
   · apply ContDiffOn.prod B _
     apply C.congr fun p hp => _
-    simp only [mfld_simps] at hp
+    simp only [mfld_simps] at hp 
     simp only [mfderivWithin, hf.mdifferentiable_on one_le_n _ hp.2, hp.1, if_pos, mfld_simps]
   have D :
     ContDiffOn 𝕜 m (fun x => fderivWithin 𝕜 (I' ∘ f ∘ I.symm) (I.symm ⁻¹' s ∩ range I) x)
@@ -451,7 +451,7 @@ theorem ContMdiffOn.contMdiffOn_tangentMapWithin (hf : ContMdiffOn I I' n f s) (
   -- First step: local reduction on the space, to a set `s'` which is contained in chart domains.
   refine' contMdiffOn_of_locally_contMdiffOn fun p hp => _
   have hf' := contMdiffOn_iff.1 hf
-  simp only [mfld_simps] at hp
+  simp only [mfld_simps] at hp 
   let l := chart_at H p.proj
   set Dl := chart_at (ModelProd H E) p with hDl
   let r := chart_at H' (f p.proj)
@@ -470,7 +470,7 @@ theorem ContMdiffOn.contMdiffOn_tangentMapWithin (hf : ContMdiffOn I I' n f s) (
     show p ∈ π (TangentSpace I) ⁻¹' (o ∩ l.source)
     · simp
       have : p.proj ∈ f ⁻¹' r.source ∩ s := by simp [hp]
-      rw [ho] at this
+      rw [ho] at this 
       exact this.1
     · have : π (TangentSpace I) ⁻¹' s ∩ π (TangentSpace I) ⁻¹' (o ∩ l.source) = s'_lift := by
         dsimp only [s'_lift, s']; rw [ho]; mfld_set_tac
@@ -491,7 +491,7 @@ theorem ContMdiffOn.contMdiffOn_tangentMapWithin (hf : ContMdiffOn I I' n f s) (
   have diff_rf : ContMdiffOn I I' n (r ∘ f) s' :=
     by
     apply ContMdiffOn.comp diff_r diff_f fun x hx => _
-    simp only [s', mfld_simps] at hx; simp only [hx, mfld_simps]
+    simp only [s', mfld_simps] at hx ; simp only [hx, mfld_simps]
   have diff_l : ContMdiffOn I I n l.symm s'l :=
     haveI A : ContMdiffOn I I n l.symm l.target := contMdiffOn_chart_symm
     A.mono (by mfld_set_tac)
@@ -512,7 +512,7 @@ theorem ContMdiffOn.contMdiffOn_tangentMapWithin (hf : ContMdiffOn I I' n f s) (
     by
     have A : ContMdiffOn I'.tangent I'.tangent m Dr.symm Dr.target := contMdiffOn_chart_symm
     apply ContMdiffOn.comp A diff_irrfl_lift fun p hp => _
-    simp only [s'l_lift, mfld_simps] at hp
+    simp only [s'l_lift, mfld_simps] at hp 
     simp only [ir, hp, mfld_simps]
   -- conclusion of this step: the composition of all the maps above is smooth
   have diff_DrirrflilDl :
@@ -523,13 +523,13 @@ theorem ContMdiffOn.contMdiffOn_tangentMapWithin (hf : ContMdiffOn I I' n f s) (
     have A' : ContMdiffOn I.tangent I.tangent m Dl s'_lift :=
       by
       apply A.mono fun p hp => _
-      simp only [s'_lift, mfld_simps] at hp
+      simp only [s'_lift, mfld_simps] at hp 
       simp only [Dl, hp, mfld_simps]
     have B : ContMdiffOn I.tangent I.tangent m il.symm il.target := contMdiffOn_chart_symm
     have C : ContMdiffOn I.tangent I.tangent m (il.symm ∘ Dl) s'_lift :=
       ContMdiffOn.comp B A' fun p hp => by simp only [il, mfld_simps]
     apply ContMdiffOn.comp diff_Drirrfl_lift C fun p hp => _
-    simp only [s'_lift, mfld_simps] at hp
+    simp only [s'_lift, mfld_simps] at hp 
     simp only [il, s'l_lift, hp, total_space.proj, mfld_simps]
   /- Third step: check that the composition of all the maps indeed coincides with the derivative we
     are looking for -/
@@ -539,7 +539,7 @@ theorem ContMdiffOn.contMdiffOn_tangentMapWithin (hf : ContMdiffOn I I' n f s) (
         (Dr.symm ∘ ir ∘ tangentMapWithin I I' (r ∘ f ∘ l.symm) s'l ∘ il.symm ∘ Dl) q :=
     by
     intro q hq
-    simp only [s'_lift, mfld_simps] at hq
+    simp only [s'_lift, mfld_simps] at hq 
     have U'q : UniqueMdiffWithinAt I s' q.1 := by apply U'; simp only [hq, s', mfld_simps]
     have U'lq : UniqueMdiffWithinAt I s'l (Dl q).1 := by apply U'l; simp only [hq, s'l, mfld_simps]
     have A :
@@ -551,7 +551,7 @@ theorem ContMdiffOn.contMdiffOn_tangentMapWithin (hf : ContMdiffOn I I' n f s) (
         simp only [hq, mfld_simps]
       · apply diff_l.mdifferentiable_on one_le_n
         simp only [s'l, hq, mfld_simps]
-      · simp only [mfld_simps] at hp; simp only [hp, mfld_simps]
+      · simp only [mfld_simps] at hp ; simp only [hp, mfld_simps]
     have B : tangentMapWithin I I l.symm s'l (il.symm (Dl q)) = q :=
       by
       have :
@@ -574,7 +574,7 @@ theorem ContMdiffOn.contMdiffOn_tangentMapWithin (hf : ContMdiffOn I I' n f s) (
         simp only [hq, mfld_simps]
       · apply diff_f.mdifferentiable_on one_le_n
         simp only [hq, mfld_simps]
-      · simp only [s', mfld_simps] at hr
+      · simp only [s', mfld_simps] at hr 
         simp only [hr, mfld_simps]
     have D :
       Dr.symm (ir (tangentMapWithin I' I' r r.source (tangentMapWithin I I' f s' q))) =
@@ -623,7 +623,7 @@ theorem ContMdiffOn.continuousOn_tangentMapWithin (hf : ContMdiffOn I I' n f s)
 theorem ContMdiff.contMdiff_tangentMap (hf : ContMdiff I I' n f) (hmn : m + 1 ≤ n) :
     ContMdiff I.tangent I'.tangent m (tangentMap I I' f) :=
   by
-  rw [← contMdiffOn_univ] at hf⊢
+  rw [← contMdiffOn_univ] at hf ⊢
   convert hf.cont_mdiff_on_tangent_map_within hmn uniqueMdiffOn_univ
   rw [tangentMapWithin_univ]
 #align cont_mdiff.cont_mdiff_tangent_map ContMdiff.contMdiff_tangentMap
@@ -632,7 +632,7 @@ theorem ContMdiff.contMdiff_tangentMap (hf : ContMdiff I I' n f) (hmn : m + 1 
 theorem ContMdiff.continuous_tangentMap (hf : ContMdiff I I' n f) (hmn : 1 ≤ n) :
     Continuous (tangentMap I I' f) :=
   by
-  rw [← contMdiffOn_univ] at hf
+  rw [← contMdiffOn_univ] at hf 
   rw [continuous_iff_continuousOn_univ]
   convert hf.continuous_on_tangent_map_within hmn uniqueMdiffOn_univ
   rw [tangentMapWithin_univ]
@@ -687,11 +687,11 @@ theorem tangentMap_tangentBundle_pure (p : TangentBundle I M) :
   simp only [Bundle.zeroSection, tangentMap, mfderiv, total_space.proj_mk, A, if_pos, chart_at,
     FiberBundle.chartedSpace_chartAt, TangentBundle.trivializationAt_apply, tangentBundleCore,
     Function.comp, ContinuousLinearMap.map_zero, mfld_simps]
-  rw [← fderivWithin_inter N] at B
+  rw [← fderivWithin_inter N] at B 
   rw [← fderivWithin_inter N, ← B]
   congr 2
   refine' fderivWithin_congr (fun y hy => _) _
-  · simp only [mfld_simps] at hy
+  · simp only [mfld_simps] at hy 
     simp only [hy, Prod.mk.inj_iff, mfld_simps]
   · simp only [Prod.mk.inj_iff, mfld_simps]
 #align tangent_bundle.tangent_map_tangent_bundle_pure TangentBundle.tangentMap_tangentBundle_pure
Diff
@@ -27,7 +27,7 @@ and related notions.
 
 open Set Function Filter ChartedSpace SmoothManifoldWithCorners Bundle
 
-open Topology Manifold Bundle
+open scoped Topology Manifold Bundle
 
 /-! ### Definition of smooth functions between manifolds -/
 
Diff
@@ -158,8 +158,7 @@ theorem ContMdiffAt.mfderiv {x₀ : N} (f : N → M → M') (g : N → M)
     simp_rw [Function.comp, uncurry, extChartAt_prod, LocalEquiv.prod_coe_symm,
       ModelWithCorners.range_prod] at hf⊢
     refine' ContDiffWithinAt.fderivWithin _ hg.2 I.unique_diff hmn (mem_range_self _) _
-    · simp_rw [extChartAt_to_inv]
-      exact hf.2
+    · simp_rw [extChartAt_to_inv]; exact hf.2
     · rw [← image_subset_iff]
       rintro _ ⟨x, hx, rfl⟩
       exact mem_range_self _
@@ -297,15 +296,12 @@ theorem ContMdiffOn.continuousOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
     have :
       univ ∩ ⇑(tangentBundleModelSpaceHomeomorph H I) ⁻¹' (Prod.fst ⁻¹' s) =
         π (TangentSpace I) ⁻¹' s :=
-      by
-      ext ⟨x, v⟩
-      simp only [mfld_simps]
+      by ext ⟨x, v⟩; simp only [mfld_simps]
     rw [this] at B
     apply B.congr
     rintro ⟨x, v⟩ hx
     dsimp [tangentMapWithin]
-    ext
-    · rfl
+    ext; · rfl
     simp only [mfld_simps]
     apply congr_fun
     apply congr_arg
@@ -380,9 +376,7 @@ theorem ContMdiffOn.contMdiffOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
         ((Equiv.sigmaEquivProd H E).symm ∘ fun p : E × E => (I.symm p.fst, p.snd)) ⁻¹'
           (π (TangentSpace I) ⁻¹' s) =
       (range I ∩ I.symm ⁻¹' s) ×ˢ univ :=
-    by
-    ext ⟨x, v⟩
-    simp only [mfld_simps]
+    by ext ⟨x, v⟩; simp only [mfld_simps]
   suffices h :
     ContDiffOn 𝕜 m
       (((fun p : H' × E' => (I' p.fst, p.snd)) ∘ Equiv.sigmaEquivProd H' E') ∘
@@ -471,18 +465,15 @@ theorem ContMdiffOn.contMdiffOn_tangentMapWithin (hf : ContMdiffOn I I' n f s) (
   rcases continuousOn_iff'.1 hf'.1 r.source r.open_source with ⟨o, o_open, ho⟩
   suffices h : ContMdiffOn I.tangent I'.tangent m (tangentMapWithin I I' f s) s'_lift
   · refine' ⟨π (TangentSpace I) ⁻¹' (o ∩ l.source), _, _, _⟩
-    show IsOpen (π (TangentSpace I) ⁻¹' (o ∩ l.source))
+    show IsOpen (π (TangentSpace I) ⁻¹' (o ∩ l.source));
     exact (IsOpen.inter o_open l.open_source).Preimage (continuous_proj E _)
     show p ∈ π (TangentSpace I) ⁻¹' (o ∩ l.source)
     · simp
       have : p.proj ∈ f ⁻¹' r.source ∩ s := by simp [hp]
       rw [ho] at this
       exact this.1
-    · have : π (TangentSpace I) ⁻¹' s ∩ π (TangentSpace I) ⁻¹' (o ∩ l.source) = s'_lift :=
-        by
-        dsimp only [s'_lift, s']
-        rw [ho]
-        mfld_set_tac
+    · have : π (TangentSpace I) ⁻¹' s ∩ π (TangentSpace I) ⁻¹' (o ∩ l.source) = s'_lift := by
+        dsimp only [s'_lift, s']; rw [ho]; mfld_set_tac
       rw [this]
       exact h
   /- Second step: check that all functions are smooth, and use the chain rule to write the bundled
@@ -500,8 +491,7 @@ theorem ContMdiffOn.contMdiffOn_tangentMapWithin (hf : ContMdiffOn I I' n f s) (
   have diff_rf : ContMdiffOn I I' n (r ∘ f) s' :=
     by
     apply ContMdiffOn.comp diff_r diff_f fun x hx => _
-    simp only [s', mfld_simps] at hx
-    simp only [hx, mfld_simps]
+    simp only [s', mfld_simps] at hx; simp only [hx, mfld_simps]
   have diff_l : ContMdiffOn I I n l.symm s'l :=
     haveI A : ContMdiffOn I I n l.symm l.target := contMdiffOn_chart_symm
     A.mono (by mfld_set_tac)
@@ -550,13 +540,8 @@ theorem ContMdiffOn.contMdiffOn_tangentMapWithin (hf : ContMdiffOn I I' n f s) (
     by
     intro q hq
     simp only [s'_lift, mfld_simps] at hq
-    have U'q : UniqueMdiffWithinAt I s' q.1 := by
-      apply U'
-      simp only [hq, s', mfld_simps]
-    have U'lq : UniqueMdiffWithinAt I s'l (Dl q).1 :=
-      by
-      apply U'l
-      simp only [hq, s'l, mfld_simps]
+    have U'q : UniqueMdiffWithinAt I s' q.1 := by apply U'; simp only [hq, s', mfld_simps]
+    have U'lq : UniqueMdiffWithinAt I s'l (Dl q).1 := by apply U'l; simp only [hq, s'l, mfld_simps]
     have A :
       tangentMapWithin I I' ((r ∘ f) ∘ l.symm) s'l (il.symm (Dl q)) =
         tangentMapWithin I I' (r ∘ f) s' (tangentMapWithin I I l.symm s'l (il.symm (Dl q))) :=
@@ -566,8 +551,7 @@ theorem ContMdiffOn.contMdiffOn_tangentMapWithin (hf : ContMdiffOn I I' n f s) (
         simp only [hq, mfld_simps]
       · apply diff_l.mdifferentiable_on one_le_n
         simp only [s'l, hq, mfld_simps]
-      · simp only [mfld_simps] at hp
-        simp only [hp, mfld_simps]
+      · simp only [mfld_simps] at hp; simp only [hp, mfld_simps]
     have B : tangentMapWithin I I l.symm s'l (il.symm (Dl q)) = q :=
       by
       have :
@@ -601,8 +585,7 @@ theorem ContMdiffOn.contMdiffOn_tangentMapWithin (hf : ContMdiffOn I I' n f s) (
           tangentMap I' I' r (tangentMapWithin I I' f s' q) :=
         by
         apply tangentMapWithin_eq_tangentMap
-        · apply IsOpen.uniqueMdiffWithinAt _ r.open_source
-          simp [hq]
+        · apply IsOpen.uniqueMdiffWithinAt _ r.open_source; simp [hq]
         · refine' mdifferentiableAt_atlas _ (chart_mem_atlas _ _) _
           simp only [hq, mfld_simps]
       have : f p.proj = (tangentMapWithin I I' f s p).1 := rfl
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_mfderiv
-! leanprover-community/mathlib commit 17fe3632366bfefa54c240db521ce21beeb7a28a
+! leanprover-community/mathlib commit 3a69562db5a458db8322b190ec8d9a8bbd8a5b14
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -202,7 +202,7 @@ theorem ContMdiffAt.mfderiv {x₀ : N} (f : N → M → M') (g : N → M)
       rintro x ⟨hx, h2x⟩
       simp_rw [writtenInExtChartAt, Function.comp_apply]
       rw [(extChartAt I (g x₂)).left_inv hx, (extChartAt I' (f x₂ (g x₂))).left_inv h2x]
-    refine' Filter.EventuallyEq.fderivWithin_eq_nhds (I.unique_diff _ <| mem_range_self _) _
+    refine' Filter.EventuallyEq.fderivWithin_eq_nhds _
     refine' eventually_of_mem (inter_mem _ _) this
     · exact extChartAt_preimage_mem_nhds' _ _ hx₂ (extChartAt_source_mem_nhds I (g x₂))
     refine' extChartAt_preimage_mem_nhds' _ _ hx₂ _
@@ -704,15 +704,13 @@ theorem tangentMap_tangentBundle_pure (p : TangentBundle I M) :
   simp only [Bundle.zeroSection, tangentMap, mfderiv, total_space.proj_mk, A, if_pos, chart_at,
     FiberBundle.chartedSpace_chartAt, TangentBundle.trivializationAt_apply, tangentBundleCore,
     Function.comp, ContinuousLinearMap.map_zero, mfld_simps]
-  rw [← fderivWithin_inter N (I.unique_diff (I ((chart_at H x) x)) (Set.mem_range_self _))] at B
-  rw [← fderivWithin_inter N (I.unique_diff (I ((chart_at H x) x)) (Set.mem_range_self _)), ← B]
+  rw [← fderivWithin_inter N] at B
+  rw [← fderivWithin_inter N, ← B]
   congr 2
-  apply fderivWithin_congr _ fun y hy => _
-  · simp only [Prod.mk.inj_iff, mfld_simps]
-  · apply UniqueDiffWithinAt.inter (I.unique_diff _ _) N
-    simp only [mfld_simps]
+  refine' fderivWithin_congr (fun y hy => _) _
   · simp only [mfld_simps] at hy
     simp only [hy, Prod.mk.inj_iff, mfld_simps]
+  · simp only [Prod.mk.inj_iff, mfld_simps]
 #align tangent_bundle.tangent_map_tangent_bundle_pure TangentBundle.tangentMap_tangentBundle_pure
 
 end TangentBundle
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_mfderiv
-! leanprover-community/mathlib commit 0187644979f2d3e10a06e916a869c994facd9a87
+! leanprover-community/mathlib commit 17fe3632366bfefa54c240db521ce21beeb7a28a
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -113,6 +113,161 @@ theorem Smooth.mdifferentiableWithinAt (hf : Smooth I I' f) : MdifferentiableWit
   hf.MdifferentiableAt.MdifferentiableWithinAt
 #align smooth.mdifferentiable_within_at Smooth.mdifferentiableWithinAt
 
+/-! ### The derivative of a smooth function is smooth -/
+
+
+section mfderiv
+
+include Is I's Js
+
+/-- The function that sends `x` to the `y`-derivative of `f(x,y)` at `g(x)` is `C^m` at `x₀`,
+where the derivative is taken as a continuous linear map.
+We have to assume that `f` is `C^n` at `(x₀, g(x₀))` for `n ≥ m + 1` and `g` is `C^m` at `x₀`.
+We have to insert a coordinate change from `x₀` to `x` to make the derivative sensible.
+This result is used to show that maps into the 1-jet bundle and cotangent bundle are smooth.
+`cont_mdiff_at.mfderiv_id` and `cont_mdiff_at.mfderiv_const` are special cases of this.
+
+This result should be generalized to a `cont_mdiff_within_at` for `mfderiv_within`.
+If we do that, we can deduce `cont_mdiff_on.cont_mdiff_on_tangent_map_within` from this.
+-/
+theorem ContMdiffAt.mfderiv {x₀ : N} (f : N → M → M') (g : N → M)
+    (hf : ContMdiffAt (J.Prod I) I' n (Function.uncurry f) (x₀, g x₀)) (hg : ContMdiffAt J I m g x₀)
+    (hmn : m + 1 ≤ n) :
+    ContMdiffAt J 𝓘(𝕜, E →L[𝕜] E') m
+      (inTangentCoordinates I I' g (fun x => f x (g x)) (fun x => mfderiv I I' (f x) (g x)) x₀)
+      x₀ :=
+  by
+  have h4f : ContinuousAt (fun x => f x (g x)) x₀ := by
+    apply ContinuousAt.comp (by apply hf.continuous_at) (continuous_at_id.prod hg.continuous_at)
+  have h4f := h4f.preimage_mem_nhds (extChartAt_source_mem_nhds I' (f x₀ (g x₀)))
+  have h3f := cont_mdiff_at_iff_cont_mdiff_at_nhds.mp (hf.of_le <| (self_le_add_left 1 m).trans hmn)
+  have h2f : ∀ᶠ x₂ in 𝓝 x₀, ContMdiffAt I I' 1 (f x₂) (g x₂) :=
+    by
+    refine' ((continuous_at_id.prod hg.continuous_at).Tendsto.Eventually h3f).mono fun x hx => _
+    exact hx.comp (g x) (cont_mdiff_at_const.prod_mk contMdiffAt_id)
+  have h2g := hg.continuous_at.preimage_mem_nhds (extChartAt_source_mem_nhds I (g x₀))
+  have :
+    ContDiffWithinAt 𝕜 m
+      (fun x =>
+        fderivWithin 𝕜
+          (extChartAt I' (f x₀ (g x₀)) ∘ f ((extChartAt J x₀).symm x) ∘ (extChartAt I (g x₀)).symm)
+          (range I) (extChartAt I (g x₀) (g ((extChartAt J x₀).symm x))))
+      (range J) (extChartAt J x₀ x₀) :=
+    by
+    rw [contMdiffAt_iff] at hf hg
+    simp_rw [Function.comp, uncurry, extChartAt_prod, LocalEquiv.prod_coe_symm,
+      ModelWithCorners.range_prod] at hf⊢
+    refine' ContDiffWithinAt.fderivWithin _ hg.2 I.unique_diff hmn (mem_range_self _) _
+    · simp_rw [extChartAt_to_inv]
+      exact hf.2
+    · rw [← image_subset_iff]
+      rintro _ ⟨x, hx, rfl⟩
+      exact mem_range_self _
+  have :
+    ContMdiffAt J 𝓘(𝕜, E →L[𝕜] E') m
+      (fun x =>
+        fderivWithin 𝕜 (extChartAt I' (f x₀ (g x₀)) ∘ f x ∘ (extChartAt I (g x₀)).symm) (range I)
+          (extChartAt I (g x₀) (g x)))
+      x₀ :=
+    by
+    simp_rw [contMdiffAt_iff_source_of_mem_source (mem_chart_source G x₀),
+      contMdiffWithinAt_iff_contDiffWithinAt, Function.comp]
+    exact this
+  have :
+    ContMdiffAt J 𝓘(𝕜, E →L[𝕜] E') m
+      (fun x =>
+        fderivWithin 𝕜
+          (extChartAt I' (f x₀ (g x₀)) ∘
+            (extChartAt I' (f x (g x))).symm ∘
+              writtenInExtChartAt I I' (g x) (f x) ∘
+                extChartAt I (g x) ∘ (extChartAt I (g x₀)).symm)
+          (range I) (extChartAt I (g x₀) (g x)))
+      x₀ :=
+    by
+    refine' this.congr_of_eventually_eq _
+    filter_upwards [h2g, h2f]
+    intro x₂ hx₂ h2x₂
+    have :
+      ∀
+        x ∈
+          (extChartAt I (g x₀)).symm ⁻¹' (extChartAt I (g x₂)).source ∩
+            (extChartAt I (g x₀)).symm ⁻¹' (f x₂ ⁻¹' (extChartAt I' (f x₂ (g x₂))).source),
+        (extChartAt I' (f x₀ (g x₀)) ∘
+              (extChartAt I' (f x₂ (g x₂))).symm ∘
+                writtenInExtChartAt I I' (g x₂) (f x₂) ∘
+                  extChartAt I (g x₂) ∘ (extChartAt I (g x₀)).symm)
+            x =
+          extChartAt I' (f x₀ (g x₀)) (f x₂ ((extChartAt I (g x₀)).symm x)) :=
+      by
+      rintro x ⟨hx, h2x⟩
+      simp_rw [writtenInExtChartAt, Function.comp_apply]
+      rw [(extChartAt I (g x₂)).left_inv hx, (extChartAt I' (f x₂ (g x₂))).left_inv h2x]
+    refine' Filter.EventuallyEq.fderivWithin_eq_nhds (I.unique_diff _ <| mem_range_self _) _
+    refine' eventually_of_mem (inter_mem _ _) this
+    · exact extChartAt_preimage_mem_nhds' _ _ hx₂ (extChartAt_source_mem_nhds I (g x₂))
+    refine' extChartAt_preimage_mem_nhds' _ _ hx₂ _
+    exact h2x₂.continuous_at.preimage_mem_nhds (extChartAt_source_mem_nhds _ _)
+  /- The conclusion is equal to the following, when unfolding coord_change of
+      `tangent_bundle_core` -/
+  have :
+    ContMdiffAt J 𝓘(𝕜, E →L[𝕜] E') m
+      (fun x =>
+        (fderivWithin 𝕜 (extChartAt I' (f x₀ (g x₀)) ∘ (extChartAt I' (f x (g x))).symm) (range I')
+              (extChartAt I' (f x (g x)) (f x (g x)))).comp
+          ((mfderiv I I' (f x) (g x)).comp
+            (fderivWithin 𝕜 (extChartAt I (g x) ∘ (extChartAt I (g x₀)).symm) (range I)
+              (extChartAt I (g x₀) (g x)))))
+      x₀ :=
+    by
+    refine' this.congr_of_eventually_eq _
+    filter_upwards [h2g, h2f, h4f]
+    intro x₂ hx₂ h2x₂ h3x₂
+    symm
+    rw [(h2x₂.mdifferentiable_at le_rfl).mfderiv]
+    have hI :=
+      (contDiffWithinAt_ext_coord_change I (g x₂) (g x₀) <|
+            LocalEquiv.mem_symm_trans_source _ hx₂ <|
+              mem_ext_chart_source I (g x₂)).DifferentiableWithinAt
+        le_top
+    have hI' :=
+      (contDiffWithinAt_ext_coord_change I' (f x₀ (g x₀)) (f x₂ (g x₂)) <|
+            LocalEquiv.mem_symm_trans_source _ (mem_ext_chart_source I' (f x₂ (g x₂)))
+              h3x₂).DifferentiableWithinAt
+        le_top
+    have h3f := (h2x₂.mdifferentiable_at le_rfl).2
+    refine' fderivWithin.comp₃ _ hI' h3f hI _ _ _ _ (I.unique_diff _ <| mem_range_self _)
+    · exact fun x _ => mem_range_self _
+    · exact fun x _ => mem_range_self _
+    ·
+      simp_rw [writtenInExtChartAt, Function.comp_apply,
+        (extChartAt I (g x₂)).left_inv (mem_ext_chart_source I (g x₂))]
+    · simp_rw [Function.comp_apply, (extChartAt I (g x₀)).left_inv hx₂]
+  refine' this.congr_of_eventually_eq _
+  filter_upwards [h2g, h4f]with x hx h2x
+  rw [inTangentCoordinates_eq]
+  · rfl
+  · rwa [extChartAt_source] at hx
+  · rwa [extChartAt_source] at h2x
+#align cont_mdiff_at.mfderiv ContMdiffAt.mfderiv
+
+omit Js
+
+/-- The derivative `D_yf(y)` is `C^m` at `x₀`, where the derivative is taken as a continuous
+linear map. We have to assume that `f` is `C^n` at `x₀` for some `n ≥ m + 1`.
+We have to insert a coordinate change from `x₀` to `x` to make the derivative sensible.
+This is a special case of `cont_mdiff_at.mfderiv` where `f` does not contain any parameters and
+`g = id`.
+-/
+theorem ContMdiffAt.mfderiv_const {x₀ : M} {f : M → M'} (hf : ContMdiffAt I I' n f x₀)
+    (hmn : m + 1 ≤ n) :
+    ContMdiffAt I 𝓘(𝕜, E →L[𝕜] E') m (inTangentCoordinates I I' id f (mfderiv I I' f) x₀) x₀ :=
+  haveI : ContMdiffAt (I.prod I) I' n (fun x : M × M => f x.2) (x₀, x₀) :=
+    ContMdiffAt.comp (x₀, x₀) hf contMdiffAt_snd
+  this.mfderiv (fun x => f) id contMdiffAt_id hmn
+#align cont_mdiff_at.mfderiv_const ContMdiffAt.mfderiv_const
+
+end mfderiv
+
 /-! ### The tangent map of a smooth function is smooth -/
 
 
Diff
@@ -1,14 +1,13 @@
 /-
 Copyright (c) 2020 Sébastien Gouëzel. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
-Authors: Sébastien Gouëzel
+Authors: Sébastien Gouëzel, Floris van Doorn
 
 ! This file was ported from Lean 3 source module geometry.manifold.cont_mdiff_mfderiv
-! leanprover-community/mathlib commit f2ce6086713c78a7f880485f7917ea547a215982
+! leanprover-community/mathlib commit 0187644979f2d3e10a06e916a869c994facd9a87
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
-import Mathbin.Geometry.Manifold.ContMdiff
 import Mathbin.Geometry.Manifold.Mfderiv
 
 /-!
@@ -26,9 +25,9 @@ and related notions.
 -/
 
 
-open Set Function Filter ChartedSpace SmoothManifoldWithCorners
+open Set Function Filter ChartedSpace SmoothManifoldWithCorners Bundle
 
-open Topology Manifold
+open Topology Manifold Bundle
 
 /-! ### Definition of smooth functions between manifolds -/
 
@@ -54,6 +53,10 @@ 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']
+  -- declare some additional normed spaces, used for fibers of vector bundles
+  {F₁ : Type _}
+  [NormedAddCommGroup F₁] [NormedSpace 𝕜 F₁] {F₂ : Type _} [NormedAddCommGroup F₂]
+  [NormedSpace 𝕜 F₂]
   -- declare functions, sets, points and smoothness indices
   {f f₁ : M → M'}
   {s s₁ t : Set M} {x : M} {m n : ℕ∞}
@@ -121,7 +124,7 @@ space are model spaces in models with corners. The general fact is proved in
 `cont_mdiff_on.continuous_on_tangent_map_within`-/
 theorem ContMdiffOn.continuousOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
     (hf : ContMdiffOn I I' n f s) (hn : 1 ≤ n) (hs : UniqueMdiffOn I s) :
-    ContinuousOn (tangentMapWithin I I' f s) (TangentBundle.proj I H ⁻¹' s) :=
+    ContinuousOn (tangentMapWithin I I' f s) (π (TangentSpace I) ⁻¹' s) :=
   by
   suffices h :
     ContinuousOn
@@ -138,7 +141,7 @@ theorem ContMdiffOn.continuousOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
       ((tangentBundleModelSpaceHomeomorph H' I').symm.Continuous.comp_continuousOn h).comp' A
     have :
       univ ∩ ⇑(tangentBundleModelSpaceHomeomorph H I) ⁻¹' (Prod.fst ⁻¹' s) =
-        TangentBundle.proj I H ⁻¹' s :=
+        π (TangentSpace I) ⁻¹' s :=
       by
       ext ⟨x, v⟩
       simp only [mfld_simps]
@@ -200,7 +203,7 @@ are model spaces in models with corners. The general fact is proved in
 `cont_mdiff_on.cont_mdiff_on_tangent_map_within` -/
 theorem ContMdiffOn.contMdiffOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
     (hf : ContMdiffOn I I' n f s) (hmn : m + 1 ≤ n) (hs : UniqueMdiffOn I s) :
-    ContMdiffOn I.tangent I'.tangent m (tangentMapWithin I I' f s) (TangentBundle.proj I H ⁻¹' s) :=
+    ContMdiffOn I.tangent I'.tangent m (tangentMapWithin I I' f s) (π (TangentSpace I) ⁻¹' s) :=
   by
   have m_le_n : m ≤ n := by
     apply le_trans _ hmn
@@ -220,7 +223,7 @@ theorem ContMdiffOn.contMdiffOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
   have A :
     range I ×ˢ univ ∩
         ((Equiv.sigmaEquivProd H E).symm ∘ fun p : E × E => (I.symm p.fst, p.snd)) ⁻¹'
-          (TangentBundle.proj I H ⁻¹' s) =
+          (π (TangentSpace I) ⁻¹' s) =
       (range I ∩ I.symm ⁻¹' s) ×ˢ univ :=
     by
     ext ⟨x, v⟩
@@ -269,7 +272,7 @@ include Is I's
 is `C^m` when `m+1 ≤ n`. -/
 theorem ContMdiffOn.contMdiffOn_tangentMapWithin (hf : ContMdiffOn I I' n f s) (hmn : m + 1 ≤ n)
     (hs : UniqueMdiffOn I s) :
-    ContMdiffOn I.tangent I'.tangent m (tangentMapWithin I I' f s) (TangentBundle.proj I M ⁻¹' s) :=
+    ContMdiffOn I.tangent I'.tangent m (tangentMapWithin I I' f s) (π (TangentSpace I) ⁻¹' s) :=
   by
   /- The strategy of the proof is to avoid unfolding the definitions, and reduce by functoriality
     to the case of functions on the model spaces, where we have already proved the result.
@@ -299,28 +302,28 @@ theorem ContMdiffOn.contMdiffOn_tangentMapWithin (hf : ContMdiffOn I I' n f s) (
   -- First step: local reduction on the space, to a set `s'` which is contained in chart domains.
   refine' contMdiffOn_of_locally_contMdiffOn fun p hp => _
   have hf' := contMdiffOn_iff.1 hf
-  simp [TangentBundle.proj] at hp
-  let l := chart_at H p.1
+  simp only [mfld_simps] at hp
+  let l := chart_at H p.proj
   set Dl := chart_at (ModelProd H E) p with hDl
-  let r := chart_at H' (f p.1)
+  let r := chart_at H' (f p.proj)
   let Dr := chart_at (ModelProd H' E') (tangentMapWithin I I' f s p)
   let il := chart_at (ModelProd H E) (tangentMap I I l p)
   let ir := chart_at (ModelProd H' E') (tangentMap I I' (r ∘ f) p)
   let s' := f ⁻¹' r.source ∩ s ∩ l.source
-  let s'_lift := TangentBundle.proj I M ⁻¹' s'
+  let s'_lift := π (TangentSpace I) ⁻¹' s'
   let s'l := l.target ∩ l.symm ⁻¹' s'
-  let s'l_lift := TangentBundle.proj I H ⁻¹' s'l
+  let s'l_lift := π (TangentSpace I) ⁻¹' s'l
   rcases continuousOn_iff'.1 hf'.1 r.source r.open_source with ⟨o, o_open, ho⟩
   suffices h : ContMdiffOn I.tangent I'.tangent m (tangentMapWithin I I' f s) s'_lift
-  · refine' ⟨TangentBundle.proj I M ⁻¹' (o ∩ l.source), _, _, _⟩
-    show IsOpen (TangentBundle.proj I M ⁻¹' (o ∩ l.source))
-    exact (IsOpen.inter o_open l.open_source).Preimage (tangentBundle_proj_continuous _ _)
-    show p ∈ TangentBundle.proj I M ⁻¹' (o ∩ l.source)
-    · simp [TangentBundle.proj]
-      have : p.1 ∈ f ⁻¹' r.source ∩ s := by simp [hp]
+  · refine' ⟨π (TangentSpace I) ⁻¹' (o ∩ l.source), _, _, _⟩
+    show IsOpen (π (TangentSpace I) ⁻¹' (o ∩ l.source))
+    exact (IsOpen.inter o_open l.open_source).Preimage (continuous_proj E _)
+    show p ∈ π (TangentSpace I) ⁻¹' (o ∩ l.source)
+    · simp
+      have : p.proj ∈ f ⁻¹' r.source ∩ s := by simp [hp]
       rw [ho] at this
       exact this.1
-    · have : TangentBundle.proj I M ⁻¹' s ∩ TangentBundle.proj I M ⁻¹' (o ∩ l.source) = s'_lift :=
+    · have : π (TangentSpace I) ⁻¹' s ∩ π (TangentSpace I) ⁻¹' (o ∩ l.source) = s'_lift :=
         by
         dsimp only [s'_lift, s']
         rw [ho]
@@ -364,8 +367,8 @@ theorem ContMdiffOn.contMdiffOn_tangentMapWithin (hf : ContMdiffOn I I' n f s) (
     by
     have A : ContMdiffOn I'.tangent I'.tangent m Dr.symm Dr.target := contMdiffOn_chart_symm
     apply ContMdiffOn.comp A diff_irrfl_lift fun p hp => _
-    simp only [s'l_lift, TangentBundle.proj, mfld_simps] at hp
-    simp only [ir, @LocalEquiv.refl_coe (ModelProd H' E'), hp, mfld_simps]
+    simp only [s'l_lift, mfld_simps] at hp
+    simp only [ir, hp, mfld_simps]
   -- conclusion of this step: the composition of all the maps above is smooth
   have diff_DrirrflilDl :
     ContMdiffOn I.tangent I'.tangent m
@@ -375,14 +378,14 @@ theorem ContMdiffOn.contMdiffOn_tangentMapWithin (hf : ContMdiffOn I I' n f s) (
     have A' : ContMdiffOn I.tangent I.tangent m Dl s'_lift :=
       by
       apply A.mono fun p hp => _
-      simp only [s'_lift, TangentBundle.proj, mfld_simps] at hp
+      simp only [s'_lift, mfld_simps] at hp
       simp only [Dl, hp, mfld_simps]
     have B : ContMdiffOn I.tangent I.tangent m il.symm il.target := contMdiffOn_chart_symm
     have C : ContMdiffOn I.tangent I.tangent m (il.symm ∘ Dl) s'_lift :=
       ContMdiffOn.comp B A' fun p hp => by simp only [il, mfld_simps]
     apply ContMdiffOn.comp diff_Drirrfl_lift C fun p hp => _
-    simp only [s'_lift, TangentBundle.proj, mfld_simps] at hp
-    simp only [il, s'l_lift, hp, TangentBundle.proj, mfld_simps]
+    simp only [s'_lift, mfld_simps] at hp
+    simp only [il, s'l_lift, hp, total_space.proj, mfld_simps]
   /- Third step: check that the composition of all the maps indeed coincides with the derivative we
     are looking for -/
   have eq_comp :
@@ -391,7 +394,7 @@ theorem ContMdiffOn.contMdiffOn_tangentMapWithin (hf : ContMdiffOn I I' n f s) (
         (Dr.symm ∘ ir ∘ tangentMapWithin I I' (r ∘ f ∘ l.symm) s'l ∘ il.symm ∘ Dl) q :=
     by
     intro q hq
-    simp only [s'_lift, TangentBundle.proj, mfld_simps] at hq
+    simp only [s'_lift, mfld_simps] at hq
     have U'q : UniqueMdiffWithinAt I s' q.1 := by
       apply U'
       simp only [hq, s', mfld_simps]
@@ -447,7 +450,7 @@ theorem ContMdiffOn.contMdiffOn_tangentMapWithin (hf : ContMdiffOn I I' n f s) (
           simp [hq]
         · refine' mdifferentiableAt_atlas _ (chart_mem_atlas _ _) _
           simp only [hq, mfld_simps]
-      have : f p.1 = (tangentMapWithin I I' f s p).1 := rfl
+      have : f p.proj = (tangentMapWithin I I' f s p).1 := rfl
       rw [A]
       dsimp [r, Dr]
       rw [this, tangentMap_chart]
@@ -471,9 +474,9 @@ theorem ContMdiffOn.contMdiffOn_tangentMapWithin (hf : ContMdiffOn I I' n f s) (
 derivative is continuous there. -/
 theorem ContMdiffOn.continuousOn_tangentMapWithin (hf : ContMdiffOn I I' n f s) (hmn : 1 ≤ n)
     (hs : UniqueMdiffOn I s) :
-    ContinuousOn (tangentMapWithin I I' f s) (TangentBundle.proj I M ⁻¹' s) :=
+    ContinuousOn (tangentMapWithin I I' f s) (π (TangentSpace I) ⁻¹' s) :=
   haveI :
-    ContMdiffOn I.tangent I'.tangent 0 (tangentMapWithin I I' f s) (TangentBundle.proj I M ⁻¹' s) :=
+    ContMdiffOn I.tangent I'.tangent 0 (tangentMapWithin I I' f s) (π (TangentSpace I) ⁻¹' s) :=
     hf.cont_mdiff_on_tangent_map_within hmn hs
   this.continuous_on
 #align cont_mdiff_on.continuous_on_tangent_map_within ContMdiffOn.continuousOn_tangentMapWithin
@@ -499,172 +502,12 @@ theorem ContMdiff.continuous_tangentMap (hf : ContMdiff I I' n f) (hmn : 1 ≤ n
 
 end tangentMap
 
-/-! ### Smoothness of the projection in a basic smooth bundle -/
-
-
-namespace BasicSmoothVectorBundleCore
-
-variable (Z : BasicSmoothVectorBundleCore I M E')
-
-/-- A version of `cont_mdiff_at_iff_target` when the codomain is the total space of
-  a `basic_smooth_vector_bundle_core`. The continuity condition in the RHS is weaker. -/
-theorem contMdiffAt_iff_target {f : N → Z.toVectorBundleCore.TotalSpace} {x : N} {n : ℕ∞} :
-    ContMdiffAt J (I.Prod 𝓘(𝕜, E')) n f x ↔
-      ContinuousAt (Bundle.TotalSpace.proj ∘ f) x ∧
-        ContMdiffAt J 𝓘(𝕜, E × E') n (extChartAt (I.Prod 𝓘(𝕜, E')) (f x) ∘ f) x :=
-  by
-  let Z' := Z.to_vector_bundle_core
-  rw [contMdiffAt_iff_target, and_congr_left_iff]
-  refine' fun hf => ⟨fun h => Z'.continuous_proj.continuous_at.comp h, fun h => _⟩
-  exact
-    (Z'.local_triv ⟨chart_at _ (f x).1, chart_mem_atlas _ _⟩).continuousAt_of_comp_left h
-      (mem_chart_source _ _) (h.prod hf.continuous_at.snd)
-#align basic_smooth_vector_bundle_core.cont_mdiff_at_iff_target BasicSmoothVectorBundleCore.contMdiffAt_iff_target
-
-theorem smooth_iff_target {f : N → Z.toVectorBundleCore.TotalSpace} :
-    Smooth J (I.Prod 𝓘(𝕜, E')) f ↔
-      Continuous (Bundle.TotalSpace.proj ∘ f) ∧
-        ∀ x, SmoothAt J 𝓘(𝕜, E × E') (extChartAt (I.Prod 𝓘(𝕜, E')) (f x) ∘ f) x :=
-  by
-  simp_rw [Smooth, SmoothAt, ContMdiff, Z.cont_mdiff_at_iff_target, forall_and,
-    continuous_iff_continuousAt]
-#align basic_smooth_vector_bundle_core.smooth_iff_target BasicSmoothVectorBundleCore.smooth_iff_target
-
-theorem contMdiff_proj : ContMdiff (I.Prod 𝓘(𝕜, E')) I n Z.toVectorBundleCore.proj :=
-  by
-  intro x
-  rw [ContMdiffAt, contMdiffWithinAt_iff']
-  refine' ⟨Z.to_vector_bundle_core.continuous_proj.continuous_within_at, _⟩
-  simp only [(· ∘ ·), chart_at, chart, mfld_simps]
-  apply cont_diff_within_at_fst.congr
-  · rintro ⟨a, b⟩ hab
-    simp only [mfld_simps] at hab
-    simp only [hab, mfld_simps]
-  · simp only [mfld_simps]
-#align basic_smooth_vector_bundle_core.cont_mdiff_proj BasicSmoothVectorBundleCore.contMdiff_proj
-
-theorem smooth_proj : Smooth (I.Prod 𝓘(𝕜, E')) I Z.toVectorBundleCore.proj :=
-  contMdiff_proj Z
-#align basic_smooth_vector_bundle_core.smooth_proj BasicSmoothVectorBundleCore.smooth_proj
-
-theorem contMdiffOn_proj {s : Set Z.toVectorBundleCore.TotalSpace} :
-    ContMdiffOn (I.Prod 𝓘(𝕜, E')) I n Z.toVectorBundleCore.proj s :=
-  Z.contMdiff_proj.ContMdiffOn
-#align basic_smooth_vector_bundle_core.cont_mdiff_on_proj BasicSmoothVectorBundleCore.contMdiffOn_proj
-
-theorem smoothOn_proj {s : Set Z.toVectorBundleCore.TotalSpace} :
-    SmoothOn (I.Prod 𝓘(𝕜, E')) I Z.toVectorBundleCore.proj s :=
-  contMdiffOn_proj Z
-#align basic_smooth_vector_bundle_core.smooth_on_proj BasicSmoothVectorBundleCore.smoothOn_proj
-
-theorem contMdiffAt_proj {p : Z.toVectorBundleCore.TotalSpace} :
-    ContMdiffAt (I.Prod 𝓘(𝕜, E')) I n Z.toVectorBundleCore.proj p :=
-  Z.contMdiff_proj.ContMdiffAt
-#align basic_smooth_vector_bundle_core.cont_mdiff_at_proj BasicSmoothVectorBundleCore.contMdiffAt_proj
-
-theorem smoothAt_proj {p : Z.toVectorBundleCore.TotalSpace} :
-    SmoothAt (I.Prod 𝓘(𝕜, E')) I Z.toVectorBundleCore.proj p :=
-  Z.contMdiffAt_proj
-#align basic_smooth_vector_bundle_core.smooth_at_proj BasicSmoothVectorBundleCore.smoothAt_proj
-
-theorem contMdiffWithinAt_proj {s : Set Z.toVectorBundleCore.TotalSpace}
-    {p : Z.toVectorBundleCore.TotalSpace} :
-    ContMdiffWithinAt (I.Prod 𝓘(𝕜, E')) I n Z.toVectorBundleCore.proj s p :=
-  Z.contMdiffAt_proj.ContMdiffWithinAt
-#align basic_smooth_vector_bundle_core.cont_mdiff_within_at_proj BasicSmoothVectorBundleCore.contMdiffWithinAt_proj
-
-theorem smoothWithinAt_proj {s : Set Z.toVectorBundleCore.TotalSpace}
-    {p : Z.toVectorBundleCore.TotalSpace} :
-    SmoothWithinAt (I.Prod 𝓘(𝕜, E')) I Z.toVectorBundleCore.proj s p :=
-  Z.contMdiffWithinAt_proj
-#align basic_smooth_vector_bundle_core.smooth_within_at_proj BasicSmoothVectorBundleCore.smoothWithinAt_proj
-
-/-- If an element of `E'` is invariant under all coordinate changes, then one can define a
-corresponding section of the fiber bundle, which is smooth. This applies in particular to the
-zero section of a vector bundle. Another example (not yet defined) would be the identity
-section of the endomorphism bundle of a vector bundle. -/
-theorem smooth_const_section (v : E')
-    (h : ∀ i j : atlas H M, ∀ x ∈ i.1.source ∩ j.1.source, Z.coordChange i j (i.1 x) v = v) :
-    Smooth I (I.Prod 𝓘(𝕜, E')) (show M → Z.toVectorBundleCore.TotalSpace from fun x => ⟨x, v⟩) :=
-  by
-  intro x
-  rw [ContMdiffAt, contMdiffWithinAt_iff']
-  constructor
-  · apply Continuous.continuousWithinAt
-    apply FiberBundleCore.continuous_const_section
-    intro i j y hy
-    exact h _ _ _ hy
-  · have : ContDiff 𝕜 ⊤ fun y : E => (y, v) := cont_diff_id.prod contDiff_const
-    apply this.cont_diff_within_at.congr
-    · intro y hy
-      simp only [mfld_simps] at hy
-      simp only [chart, hy, chart_at, Prod.mk.inj_iff, to_vector_bundle_core, mfld_simps]
-      apply h
-      simp only [hy, Subtype.val_eq_coe, mfld_simps]
-    · simp only [chart, chart_at, Prod.mk.inj_iff, to_vector_bundle_core, mfld_simps]
-      apply h
-      simp only [Subtype.val_eq_coe, mfld_simps]
-#align basic_smooth_vector_bundle_core.smooth_const_section BasicSmoothVectorBundleCore.smooth_const_section
-
-end BasicSmoothVectorBundleCore
-
-/-! ### Smoothness of the tangent bundle projection -/
-
-
 namespace TangentBundle
 
 include Is
 
-theorem contMdiff_proj : ContMdiff I.tangent I n (proj I M) :=
-  BasicSmoothVectorBundleCore.contMdiff_proj _
-#align tangent_bundle.cont_mdiff_proj TangentBundle.contMdiff_proj
-
-theorem smooth_proj : Smooth I.tangent I (proj I M) :=
-  BasicSmoothVectorBundleCore.smooth_proj _
-#align tangent_bundle.smooth_proj TangentBundle.smooth_proj
-
-theorem contMdiffOn_proj {s : Set (TangentBundle I M)} : ContMdiffOn I.tangent I n (proj I M) s :=
-  BasicSmoothVectorBundleCore.contMdiffOn_proj _
-#align tangent_bundle.cont_mdiff_on_proj TangentBundle.contMdiffOn_proj
-
-theorem smoothOn_proj {s : Set (TangentBundle I M)} : SmoothOn I.tangent I (proj I M) s :=
-  BasicSmoothVectorBundleCore.smoothOn_proj _
-#align tangent_bundle.smooth_on_proj TangentBundle.smoothOn_proj
-
-theorem contMdiffAt_proj {p : TangentBundle I M} : ContMdiffAt I.tangent I n (proj I M) p :=
-  BasicSmoothVectorBundleCore.contMdiffAt_proj _
-#align tangent_bundle.cont_mdiff_at_proj TangentBundle.contMdiffAt_proj
-
-theorem smoothAt_proj {p : TangentBundle I M} : SmoothAt I.tangent I (proj I M) p :=
-  BasicSmoothVectorBundleCore.smoothAt_proj _
-#align tangent_bundle.smooth_at_proj TangentBundle.smoothAt_proj
-
-theorem contMdiffWithinAt_proj {s : Set (TangentBundle I M)} {p : TangentBundle I M} :
-    ContMdiffWithinAt I.tangent I n (proj I M) s p :=
-  BasicSmoothVectorBundleCore.contMdiffWithinAt_proj _
-#align tangent_bundle.cont_mdiff_within_at_proj TangentBundle.contMdiffWithinAt_proj
-
-theorem smoothWithinAt_proj {s : Set (TangentBundle I M)} {p : TangentBundle I M} :
-    SmoothWithinAt I.tangent I (proj I M) s p :=
-  BasicSmoothVectorBundleCore.smoothWithinAt_proj _
-#align tangent_bundle.smooth_within_at_proj TangentBundle.smoothWithinAt_proj
-
 variable (I M)
 
-/-- The zero section of the tangent bundle -/
-def zeroSection : M → TangentBundle I M := fun x => ⟨x, 0⟩
-#align tangent_bundle.zero_section TangentBundle.zeroSection
-
-variable {I M}
-
-theorem smooth_zeroSection : Smooth I I.tangent (zeroSection I M) :=
-  by
-  apply BasicSmoothVectorBundleCore.smooth_const_section (tangentBundleCore I M) 0
-  intro i j x hx
-  simp only [tangentBundleCore, ContinuousLinearMap.map_zero, ContinuousLinearMap.coe_coe,
-    mfld_simps]
-#align tangent_bundle.smooth_zero_section TangentBundle.smooth_zeroSection
-
 open Bundle
 
 /-- The derivative of the zero section of the tangent bundle maps `⟨x, v⟩` to `⟨⟨x, 0⟩, ⟨v, 0⟩⟩`.
@@ -682,7 +525,7 @@ may seem.
 
 TODO define splittings of vector bundles; state this result invariantly. -/
 theorem tangentMap_tangentBundle_pure (p : TangentBundle I M) :
-    tangentMap I I.tangent (TangentBundle.zeroSection I M) p = ⟨⟨p.1, 0⟩, ⟨p.2, 0⟩⟩ :=
+    tangentMap I I.tangent (zeroSection (TangentSpace I)) p = ⟨⟨p.proj, 0⟩, ⟨p.2, 0⟩⟩ :=
   by
   rcases p with ⟨x, v⟩
   have N : I.symm ⁻¹' (chart_at H x).target ∈ 𝓝 (I ((chart_at H x) x)) :=
@@ -691,10 +534,11 @@ theorem tangentMap_tangentBundle_pure (p : TangentBundle I M) :
     apply (LocalHomeomorph.open_target _).Preimage I.continuous_inv_fun
     simp only [mfld_simps]
   have A : MdifferentiableAt I I.tangent (fun x => @total_space_mk M (TangentSpace I) x 0) x :=
-    tangent_bundle.smooth_zero_section.mdifferentiable_at
+    haveI : Smooth I (I.prod 𝓘(𝕜, E)) (zero_section (TangentSpace I : M → Type _)) :=
+      Bundle.smooth_zeroSection 𝕜 (TangentSpace I : M → Type _)
+    this.mdifferentiable_at
   have B :
-    fderivWithin 𝕜 (fun x_1 : E => (x_1, (0 : E))) (Set.range ⇑I) (I ((chart_at H x) x)) v =
-      (v, 0) :=
+    fderivWithin 𝕜 (fun x' : E => (x', (0 : E))) (Set.range ⇑I) (I ((chart_at H x) x)) v = (v, 0) :=
     by
     rw [fderivWithin_eq_fderiv, DifferentiableAt.fderiv_prod]
     · simp
@@ -702,9 +546,9 @@ theorem tangentMap_tangentBundle_pure (p : TangentBundle I M) :
     · exact differentiableAt_const _
     · exact ModelWithCorners.unique_diff_at_image I
     · exact differentiable_at_id'.prod (differentiableAt_const _)
-  simp only [TangentBundle.zeroSection, tangentMap, mfderiv, A, if_pos, chart_at,
-    BasicSmoothVectorBundleCore.chart, BasicSmoothVectorBundleCore.toVectorBundleCore,
-    tangentBundleCore, Function.comp, ContinuousLinearMap.map_zero, mfld_simps]
+  simp only [Bundle.zeroSection, tangentMap, mfderiv, total_space.proj_mk, A, if_pos, chart_at,
+    FiberBundle.chartedSpace_chartAt, TangentBundle.trivializationAt_apply, tangentBundleCore,
+    Function.comp, ContinuousLinearMap.map_zero, mfld_simps]
   rw [← fderivWithin_inter N (I.unique_diff (I ((chart_at H x) x)) (Set.mem_range_self _))] at B
   rw [← fderivWithin_inter N (I.unique_diff (I ((chart_at H x) x)) (Set.mem_range_self _)), ← B]
   congr 2

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
@@ -167,7 +167,7 @@ protected theorem ContMDiffAt.mfderiv {x₀ : N} (f : N → M → M') (g : N →
       (contDiffWithinAt_ext_coord_change I' (f x₀ (g x₀)) (f x₂ (g x₂)) <|
             PartialEquiv.mem_symm_trans_source _ (mem_extChartAt_source I' (f x₂ (g x₂)))
               h3x₂).differentiableWithinAt le_top
-    have h3f := (h2x₂.mdifferentiableAt le_rfl).2
+    have h3f := (h2x₂.mdifferentiableAt le_rfl).differentiableWithinAt_writtenInExtChartAt
     refine' fderivWithin.comp₃ _ hI' h3f hI _ _ _ _ (I.unique_diff _ <| mem_range_self _)
     · exact fun x _ => mem_range_self _
     · exact fun x _ => mem_range_self _
chore: adapt to multiple goal linter 2 (#12361)

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

Diff
@@ -380,10 +380,10 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (
   rcases continuousOn_iff'.1 hf'.1 r.source r.open_source with ⟨o, o_open, ho⟩
   suffices h : ContMDiffOn I.tangent I'.tangent m (tangentMapWithin I I' f s) s'_lift by
     refine' ⟨π E (TangentSpace I) ⁻¹' (o ∩ l.source), _, _, _⟩
-    show IsOpen (π E (TangentSpace I) ⁻¹' (o ∩ l.source));
-    exact (o_open.inter l.open_source).preimage (FiberBundle.continuous_proj E _)
-    show p ∈ π E (TangentSpace I) ⁻¹' (o ∩ l.source)
-    · simp only [l, preimage_inter, mem_inter_iff, mem_preimage, mem_chart_source, and_true]
+    · show IsOpen (π E (TangentSpace I) ⁻¹' (o ∩ l.source));
+      exact (o_open.inter l.open_source).preimage (FiberBundle.continuous_proj E _)
+    · show p ∈ π E (TangentSpace I) ⁻¹' (o ∩ l.source)
+      simp only [l, preimage_inter, mem_inter_iff, mem_preimage, mem_chart_source, and_true]
       have : p.proj ∈ f ⁻¹' r.source ∩ s := by simp [r, hp]
       rw [ho] at this
       exact this.1
@@ -573,8 +573,8 @@ theorem tangentMap_tangentBundle_pure (p : TangentBundle I M) :
   rcases p with ⟨x, v⟩
   have N : I.symm ⁻¹' (chartAt H x).target ∈ 𝓝 (I ((chartAt H x) x)) := by
     apply IsOpen.mem_nhds
-    apply (PartialHomeomorph.open_target _).preimage I.continuous_invFun
-    simp only [mfld_simps]
+    · apply (PartialHomeomorph.open_target _).preimage I.continuous_invFun
+    · simp only [mfld_simps]
   have A : MDifferentiableAt I I.tangent (fun x => @TotalSpace.mk M E (TangentSpace I) x 0) x :=
     haveI : Smooth I (I.prod 𝓘(𝕜, E)) (zeroSection E (TangentSpace I : M → Type _)) :=
       Bundle.smooth_zeroSection 𝕜 (TangentSpace I : M → Type _)
chore: prepare Lean version bump with explicit simp (#10999)

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

Diff
@@ -383,12 +383,13 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (
     show IsOpen (π E (TangentSpace I) ⁻¹' (o ∩ l.source));
     exact (o_open.inter l.open_source).preimage (FiberBundle.continuous_proj E _)
     show p ∈ π E (TangentSpace I) ⁻¹' (o ∩ l.source)
-    · simp
-      have : p.proj ∈ f ⁻¹' r.source ∩ s := by simp [hp]
+    · simp only [l, preimage_inter, mem_inter_iff, mem_preimage, mem_chart_source, and_true]
+      have : p.proj ∈ f ⁻¹' r.source ∩ s := by simp [r, hp]
       rw [ho] at this
       exact this.1
     · have : π E (TangentSpace I) ⁻¹' s ∩ π E (TangentSpace I) ⁻¹' (o ∩ l.source) = s'_lift := by
-        dsimp only; rw [ho]; mfld_set_tac
+        unfold_let s'_lift s'
+        rw [ho]; mfld_set_tac
       rw [this]
       exact h
   /- Second step: check that all functions are smooth, and use the chain rule to write the bundled
@@ -400,16 +401,17 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (
     rw [ho, inter_comm]
     exact hs.inter o_open
   have U'l : UniqueMDiffOn I s'l := U'.uniqueMDiffOn_preimage (mdifferentiable_chart _ _)
-  have diff_f : ContMDiffOn I I' n f s' := hf.mono (by mfld_set_tac)
+  have diff_f : ContMDiffOn I I' n f s' := hf.mono (by unfold_let s'; mfld_set_tac)
   have diff_r : ContMDiffOn I' I' n r r.source := contMDiffOn_chart
   have diff_rf : ContMDiffOn I I' n (r ∘ f) s' := by
     refine ContMDiffOn.comp diff_r diff_f fun x hx => ?_
-    simp only [mfld_simps] at hx; simp only [hx, mfld_simps]
+    simp only [s', mfld_simps] at hx; simp only [hx, mfld_simps]
   have diff_l : ContMDiffOn I I n l.symm s'l :=
     haveI A : ContMDiffOn I I n l.symm l.target := contMDiffOn_chart_symm
-    A.mono (by mfld_set_tac)
+    A.mono (by unfold_let s'l; mfld_set_tac)
   have diff_rfl : ContMDiffOn I I' n (r ∘ f ∘ l.symm) s'l := by
     apply ContMDiffOn.comp diff_rf diff_l
+    unfold_let s'l
     mfld_set_tac
   have diff_rfl_lift :
     ContMDiffOn I.tangent I'.tangent m (tangentMapWithin I I' (r ∘ f ∘ l.symm) s'l) s'l_lift :=
@@ -417,16 +419,17 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (
   have diff_irrfl_lift :
     ContMDiffOn I.tangent I'.tangent m (ir ∘ tangentMapWithin I I' (r ∘ f ∘ l.symm) s'l) s'l_lift :=
     haveI A : ContMDiffOn I'.tangent I'.tangent m ir ir.source := contMDiffOn_chart
-    ContMDiffOn.comp A diff_rfl_lift fun p _ => by simp only [mfld_simps]
+    ContMDiffOn.comp A diff_rfl_lift fun p _ => by
+      simp only [s'l, s', ir, mfld_simps]
   have diff_Drirrfl_lift :
     ContMDiffOn I.tangent I'.tangent m (Dr.symm ∘ ir ∘ tangentMapWithin I I' (r ∘ f ∘ l.symm) s'l)
       s'l_lift := by
     have A : ContMDiffOn I'.tangent I'.tangent m Dr.symm Dr.target := contMDiffOn_chart_symm
     refine ContMDiffOn.comp A diff_irrfl_lift fun p hp => ?_
-    simp only [mfld_simps] at hp
+    simp only [s'l_lift, s'l, s', mfld_simps] at hp
     -- Porting note: added `rw` because `simp` can't see through some `ModelProd _ _ = _ × _`
     rw [mem_preimage, TangentBundle.mem_chart_target_iff]
-    simp only [hp, mfld_simps]
+    simp only [s'l, ir, hp, mfld_simps]
   -- conclusion of this step: the composition of all the maps above is smooth
   have diff_DrirrflilDl :
     ContMDiffOn I.tangent I'.tangent m
@@ -434,14 +437,15 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (
     have A : ContMDiffOn I.tangent I.tangent m Dl Dl.source := contMDiffOn_chart
     have A' : ContMDiffOn I.tangent I.tangent m Dl s'_lift := by
       refine A.mono fun p hp => ?_
-      simp only [mfld_simps] at hp
-      simp only [hp, mfld_simps]
+      simp only [Dl, s', s'_lift, mfld_simps] at hp
+      simp only [Dl, hp, mfld_simps]
     have B : ContMDiffOn I.tangent I.tangent m il.symm il.target := contMDiffOn_chart_symm
     have C : ContMDiffOn I.tangent I.tangent m (il.symm ∘ Dl) s'_lift :=
-      ContMDiffOn.comp B A' fun p _ => by simp only [mfld_simps]
+      ContMDiffOn.comp B A' fun p _ => by
+        simp only [Dl, il, mfld_simps]
     refine diff_Drirrfl_lift.comp C fun p hp => ?_
-    simp only [mfld_simps] at hp
-    simp only [hp, TotalSpace.proj, mfld_simps]
+    simp only [s'_lift, s', l, r, mfld_simps] at hp
+    simp only [Dl, s'l_lift, s'l, s', l, il, hp, TotalSpace.proj, mfld_simps]
   /- Third step: check that the composition of all the maps indeed coincides with the derivative we
     are looking for -/
   have eq_comp :
@@ -449,30 +453,31 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (
         tangentMapWithin I I' f s q =
           (Dr.symm ∘ ir ∘ tangentMapWithin I I' (r ∘ f ∘ l.symm) s'l ∘ il.symm ∘ Dl) q := by
     intro q hq
-    simp only [mfld_simps] at hq
-    have U'q : UniqueMDiffWithinAt I s' q.1 := by apply U'; simp only [hq, mfld_simps]
-    have U'lq : UniqueMDiffWithinAt I s'l (Dl q).1 := by apply U'l; simp only [hq, mfld_simps]
+    simp only [s'_lift, s', l, r, mfld_simps] at hq
+    have U'q : UniqueMDiffWithinAt I s' q.1 := by apply U'; simp only [s', hq, mfld_simps]
+    have U'lq : UniqueMDiffWithinAt I s'l (Dl q).1 := by
+      apply U'l; simp only [Dl, s'l, s', hq, mfld_simps]
     have A :
       tangentMapWithin I I' ((r ∘ f) ∘ l.symm) s'l (il.symm (Dl q)) =
         tangentMapWithin I I' (r ∘ f) s' (tangentMapWithin I I l.symm s'l (il.symm (Dl q))) := by
       refine' tangentMapWithin_comp_at (il.symm (Dl q)) _ _ (fun p hp => _) U'lq
       · apply diff_rf.mdifferentiableOn one_le_n
-        simp only [hq, mfld_simps]
+        simp only [hq, s', Dl, l, il, mfld_simps]
       · apply diff_l.mdifferentiableOn one_le_n
-        simp only [hq, mfld_simps]
-      · simp only [mfld_simps] at hp; simp only [hp, mfld_simps]
+        simp only [Dl, s'l, il, s', hq, mfld_simps]
+      · simp only [s'l, s', l, mfld_simps] at hp; simp only [s', hp, mfld_simps]
     have B : tangentMapWithin I I l.symm s'l (il.symm (Dl q)) = q := by
       have : tangentMapWithin I I l.symm s'l (il.symm (Dl q)) =
           tangentMap I I l.symm (il.symm (Dl q)) := by
         refine' tangentMapWithin_eq_tangentMap U'lq _
         -- Porting note: the arguments below were underscores.
         refine' mdifferentiableAt_atlas_symm I (chart_mem_atlas H (TotalSpace.proj p)) _
-        simp only [hq, mfld_simps]
+        simp only [Dl, il, hq, mfld_simps]
       rw [this, tangentMap_chart_symm, hDl]
-      · simp only [hq, mfld_simps]
+      · simp only [il, hq, mfld_simps]
         have : q ∈ (chartAt (ModelProd H E) p).source := by simp only [hq, mfld_simps]
         exact (chartAt (ModelProd H E) p).left_inv this
-      · simp only [hq, mfld_simps]
+      · simp only [il, Dl, hq, mfld_simps]
     have C :
       tangentMapWithin I I' (r ∘ f) s' q =
         tangentMapWithin I' I' r r.source (tangentMapWithin I I' f s' q) := by
@@ -480,8 +485,8 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (
       · apply diff_r.mdifferentiableOn one_le_n
         simp only [hq, mfld_simps]
       · apply diff_f.mdifferentiableOn one_le_n
-        simp only [hq, mfld_simps]
-      · simp only [mfld_simps] at hr
+        simp only [s', hq, mfld_simps]
+      · simp only [s', mfld_simps] at hr
         simp only [hr, mfld_simps]
     have D :
       Dr.symm (ir (tangentMapWithin I' I' r r.source (tangentMapWithin I I' f s' q))) =
@@ -495,7 +500,7 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (
         · exact mdifferentiableAt_atlas I' (chart_mem_atlas H' (f p.proj)) hq.1.1
       have : f p.proj = (tangentMapWithin I I' f s p).1 := rfl
       rw [A]
-      dsimp
+      dsimp [Dr, ir, s', r, l]
       rw [this, tangentMap_chart]
       · simp only [hq, mfld_simps]
         have :
@@ -505,7 +510,7 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (
         exact (chartAt (ModelProd H' E') (tangentMapWithin I I' f s p)).left_inv this
       · simp only [hq, mfld_simps]
     have E : tangentMapWithin I I' f s' q = tangentMapWithin I I' f s q := by
-      refine' tangentMapWithin_subset (by mfld_set_tac) U'q _
+      refine' tangentMapWithin_subset (by unfold_let; mfld_set_tac) U'q _
       apply hf.mdifferentiableOn one_le_n
       simp only [hq, mfld_simps]
     dsimp only [Function.comp_def] at A B C D E ⊢
chore: remove stream-of-consciousness uses of have, replace and suffices (#10640)

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

This follows on from #6964.

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

Diff
@@ -232,8 +232,8 @@ theorem ContMDiffOn.continuousOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
       (fun p : H × E =>
         (f p.fst,
           (fderivWithin 𝕜 (writtenInExtChartAt I I' p.fst f) (I.symm ⁻¹' s ∩ range I)
-                ((extChartAt I p.fst) p.fst) : E →L[𝕜] E') p.snd)) (Prod.fst ⁻¹' s)
-  · have A := (tangentBundleModelSpaceHomeomorph H I).continuous
+                ((extChartAt I p.fst) p.fst) : E →L[𝕜] E') p.snd)) (Prod.fst ⁻¹' s) by
+    have A := (tangentBundleModelSpaceHomeomorph H I).continuous
     rw [continuous_iff_continuousOn_univ] at A
     have B :=
       ((tangentBundleModelSpaceHomeomorph H' I').symm.continuous.comp_continuousOn h).comp' A
@@ -255,11 +255,11 @@ theorem ContMDiffOn.continuousOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
     ContinuousOn
       (fun p : H × E =>
         (fderivWithin 𝕜 (I' ∘ f ∘ I.symm) (I.symm ⁻¹' s ∩ range I) (I p.fst) : E →L[𝕜] E') p.snd)
-      (Prod.fst ⁻¹' s)
-  · dsimp [writtenInExtChartAt, extChartAt]
+      (Prod.fst ⁻¹' s) by
+    dsimp [writtenInExtChartAt, extChartAt]
     exact (ContinuousOn.comp hf.continuousOn continuous_fst.continuousOn Subset.rfl).prod h
-  suffices h : ContinuousOn (fderivWithin 𝕜 (I' ∘ f ∘ I.symm) (I.symm ⁻¹' s ∩ range I)) (I '' s)
-  · have C := ContinuousOn.comp h I.continuous_toFun.continuousOn Subset.rfl
+  suffices h : ContinuousOn (fderivWithin 𝕜 (I' ∘ f ∘ I.symm) (I.symm ⁻¹' s ∩ range I)) (I '' s) by
+    have C := ContinuousOn.comp h I.continuous_toFun.continuousOn Subset.rfl
     have A : Continuous fun q : (E →L[𝕜] E') × E => q.1 q.2 :=
       isBoundedBilinearMap_apply.continuous
     have B :
@@ -300,8 +300,8 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
       (((fun p : H' × E' => (I' p.fst, p.snd)) ∘ TotalSpace.toProd H' E') ∘
         tangentMapWithin I I' f s ∘
           (TotalSpace.toProd H E).symm ∘ fun p : E × E => (I.symm p.fst, p.snd))
-      ((range I ∩ I.symm ⁻¹' s) ×ˢ univ)
-  · -- Porting note: was `simpa [(· ∘ ·)] using h`
+      ((range I ∩ I.symm ⁻¹' s) ×ˢ univ) by
+    -- Porting note: was `simpa [(· ∘ ·)] using h`
     convert h using 1
     · ext1 ⟨x, y⟩
       simp only [mfld_simps]; rfl
@@ -323,8 +323,8 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
   suffices C :
     ContDiffOn 𝕜 m
       (fun p : E × E => (fderivWithin 𝕜 (I' ∘ f ∘ I.symm) (I.symm ⁻¹' s ∩ range I) p.1 : _) p.2)
-      ((range I ∩ I.symm ⁻¹' s) ×ˢ (univ : Set E))
-  · refine ContDiffOn.prod B ?_
+      ((range I ∩ I.symm ⁻¹' s) ×ˢ (univ : Set E)) by
+    refine ContDiffOn.prod B ?_
     refine C.congr fun p hp => ?_
     simp only [mfld_simps] at hp
     simp only [mfderivWithin, hf.mdifferentiableOn one_le_n _ hp.2, hp.1, if_pos, mfld_simps]
@@ -378,8 +378,8 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (
   let s'l := l.target ∩ l.symm ⁻¹' s'
   let s'l_lift := π E (TangentSpace I) ⁻¹' s'l
   rcases continuousOn_iff'.1 hf'.1 r.source r.open_source with ⟨o, o_open, ho⟩
-  suffices h : ContMDiffOn I.tangent I'.tangent m (tangentMapWithin I I' f s) s'_lift
-  · refine' ⟨π E (TangentSpace I) ⁻¹' (o ∩ l.source), _, _, _⟩
+  suffices h : ContMDiffOn I.tangent I'.tangent m (tangentMapWithin I I' f s) s'_lift by
+    refine' ⟨π E (TangentSpace I) ⁻¹' (o ∩ l.source), _, _, _⟩
     show IsOpen (π E (TangentSpace I) ⁻¹' (o ∩ l.source));
     exact (o_open.inter l.open_source).preimage (FiberBundle.continuous_proj E _)
     show p ∈ π E (TangentSpace I) ⁻¹' (o ∩ l.source)
@@ -463,8 +463,8 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (
       · simp only [mfld_simps] at hp; simp only [hp, mfld_simps]
     have B : tangentMapWithin I I l.symm s'l (il.symm (Dl q)) = q := by
       have : tangentMapWithin I I l.symm s'l (il.symm (Dl q)) =
-        tangentMap I I l.symm (il.symm (Dl q))
-      · refine' tangentMapWithin_eq_tangentMap U'lq _
+          tangentMap I I l.symm (il.symm (Dl q)) := by
+        refine' tangentMapWithin_eq_tangentMap U'lq _
         -- Porting note: the arguments below were underscores.
         refine' mdifferentiableAt_atlas_symm I (chart_mem_atlas H (TotalSpace.proj p)) _
         simp only [hq, mfld_simps]
@@ -574,9 +574,9 @@ theorem tangentMap_tangentBundle_pure (p : TangentBundle I M) :
     haveI : Smooth I (I.prod 𝓘(𝕜, E)) (zeroSection E (TangentSpace I : M → Type _)) :=
       Bundle.smooth_zeroSection 𝕜 (TangentSpace I : M → Type _)
     this.mdifferentiableAt
-  have B :
-    fderivWithin 𝕜 (fun x' : E => (x', (0 : E))) (Set.range I) (I ((chartAt H x) x)) v = (v, 0)
-  · rw [fderivWithin_eq_fderiv, DifferentiableAt.fderiv_prod]
+  have B : fderivWithin 𝕜 (fun x' : E ↦ (x', (0 : E))) (Set.range I) (I ((chartAt H x) x)) v
+      = (v, 0) := by
+    rw [fderivWithin_eq_fderiv, DifferentiableAt.fderiv_prod]
     · simp
     · exact differentiableAt_id'
     · exact differentiableAt_const _
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
@@ -137,8 +137,8 @@ protected theorem ContMDiffAt.mfderiv {x₀ : N} (f : N → M → M') (g : N →
       rw [(extChartAt I (g x₂)).left_inv hx, (extChartAt I' (f x₂ (g x₂))).left_inv h2x]
     refine' Filter.EventuallyEq.fderivWithin_eq_nhds _
     refine' eventually_of_mem (inter_mem _ _) this
-    · exact extChartAt_preimage_mem_nhds' _ _ hx₂ (extChartAt_source_mem_nhds I (g x₂))
-    refine' extChartAt_preimage_mem_nhds' _ _ hx₂ _
+    · exact extChartAt_preimage_mem_nhds' _ hx₂ (extChartAt_source_mem_nhds I (g x₂))
+    refine' extChartAt_preimage_mem_nhds' _ hx₂ _
     exact h2x₂.continuousAt.preimage_mem_nhds (extChartAt_source_mem_nhds _ _)
   /- The conclusion is equal to the following, when unfolding coord_change of
       `tangentBundleCore` -/
chore: correct hypothesis order in dot notation lemma (#9568)

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

Diff
@@ -490,7 +490,8 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (
         tangentMapWithin I' I' r r.source (tangentMapWithin I I' f s' q) =
           tangentMap I' I' r (tangentMapWithin I I' f s' q) := by
         apply tangentMapWithin_eq_tangentMap
-        · apply IsOpen.uniqueMDiffWithinAt _ r.open_source; simp [hq]
+        · apply r.open_source.uniqueMDiffWithinAt _
+          simp [hq]
         · exact mdifferentiableAt_atlas I' (chart_mem_atlas H' (f p.proj)) hq.1.1
       have : f p.proj = (tangentMapWithin I I' f s p).1 := rfl
       rw [A]
refactor(Geometry/Manifold/MFDeriv): split file (#9565)

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

Diff
@@ -3,7 +3,7 @@ Copyright (c) 2020 Sébastien Gouëzel. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel, Floris van Doorn
 -/
-import Mathlib.Geometry.Manifold.MFDeriv.Basic
+import Mathlib.Geometry.Manifold.MFDeriv.UniqueDifferential
 import Mathlib.Geometry.Manifold.ContMDiffMap
 
 #align_import geometry.manifold.cont_mdiff_mfderiv from "leanprover-community/mathlib"@"e473c3198bb41f68560cab68a0529c854b618833"
chore: move Geometry/Manifold/MFDeriv (#9588)

To preserve most git history when splitting the file in #9565.

Diff
@@ -3,7 +3,7 @@ Copyright (c) 2020 Sébastien Gouëzel. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel, Floris van Doorn
 -/
-import Mathlib.Geometry.Manifold.MFDeriv
+import Mathlib.Geometry.Manifold.MFDeriv.Basic
 import Mathlib.Geometry.Manifold.ContMDiffMap
 
 #align_import geometry.manifold.cont_mdiff_mfderiv from "leanprover-community/mathlib"@"e473c3198bb41f68560cab68a0529c854b618833"
@@ -59,7 +59,7 @@ variable {𝕜 : Type*} [NontriviallyNormedField 𝕜]
   {s s₁ t : Set M} {x : M} {m n : ℕ∞}
 
 -- Porting note: section about deducing differentiability from smoothness moved to
--- `Geometry.Manifold.MFDeriv`
+-- `Geometry.Manifold.MFDeriv.Basic`
 
 /-! ### The derivative of a smooth function is smooth -/
 
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
@@ -381,7 +381,7 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (
   suffices h : ContMDiffOn I.tangent I'.tangent m (tangentMapWithin I I' f s) s'_lift
   · refine' ⟨π E (TangentSpace I) ⁻¹' (o ∩ l.source), _, _, _⟩
     show IsOpen (π E (TangentSpace I) ⁻¹' (o ∩ l.source));
-    exact (IsOpen.inter o_open l.open_source).preimage (FiberBundle.continuous_proj E _)
+    exact (o_open.inter l.open_source).preimage (FiberBundle.continuous_proj E _)
     show p ∈ π E (TangentSpace I) ⁻¹' (o ∩ l.source)
     · simp
       have : p.proj ∈ f ⁻¹' r.source ∩ s := by simp [hp]
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
@@ -97,7 +97,7 @@ protected theorem ContMDiffAt.mfderiv {x₀ : N} (f : N → M → M') (g : N →
           (range I) (extChartAt I (g x₀) (g ((extChartAt J x₀).symm x))))
       (range J) (extChartAt J x₀ x₀) := by
     rw [contMDiffAt_iff] at hf hg
-    simp_rw [Function.comp, uncurry, extChartAt_prod, LocalEquiv.prod_coe_symm,
+    simp_rw [Function.comp, uncurry, extChartAt_prod, PartialEquiv.prod_coe_symm,
       ModelWithCorners.range_prod] at hf ⊢
     refine' ContDiffWithinAt.fderivWithin _ hg.2 I.unique_diff hmn (mem_range_self _) _
     · simp_rw [extChartAt_to_inv]; exact hf.2
@@ -161,11 +161,11 @@ protected theorem ContMDiffAt.mfderiv {x₀ : N} (f : N → M → M') (g : N →
     symm
     rw [(h2x₂.mdifferentiableAt le_rfl).mfderiv]
     have hI := (contDiffWithinAt_ext_coord_change I (g x₂) (g x₀) <|
-      LocalEquiv.mem_symm_trans_source _ hx₂ <|
+      PartialEquiv.mem_symm_trans_source _ hx₂ <|
         mem_extChartAt_source I (g x₂)).differentiableWithinAt le_top
     have hI' :=
       (contDiffWithinAt_ext_coord_change I' (f x₀ (g x₀)) (f x₂ (g x₂)) <|
-            LocalEquiv.mem_symm_trans_source _ (mem_extChartAt_source I' (f x₂ (g x₂)))
+            PartialEquiv.mem_symm_trans_source _ (mem_extChartAt_source I' (f x₂ (g x₂)))
               h3x₂).differentiableWithinAt le_top
     have h3f := (h2x₂.mdifferentiableAt le_rfl).2
     refine' fderivWithin.comp₃ _ hI' h3f hI _ _ _ _ (I.unique_diff _ <| mem_range_self _)
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
@@ -567,7 +567,7 @@ theorem tangentMap_tangentBundle_pure (p : TangentBundle I M) :
   rcases p with ⟨x, v⟩
   have N : I.symm ⁻¹' (chartAt H x).target ∈ 𝓝 (I ((chartAt H x) x)) := by
     apply IsOpen.mem_nhds
-    apply (LocalHomeomorph.open_target _).preimage I.continuous_invFun
+    apply (PartialHomeomorph.open_target _).preimage I.continuous_invFun
     simp only [mfld_simps]
   have A : MDifferentiableAt I I.tangent (fun x => @TotalSpace.mk M E (TangentSpace I) x 0) x :=
     haveI : Smooth I (I.prod 𝓘(𝕜, E)) (zeroSection E (TangentSpace I : M → Type _)) :=
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
@@ -507,7 +507,7 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (
       refine' tangentMapWithin_subset (by mfld_set_tac) U'q _
       apply hf.mdifferentiableOn one_le_n
       simp only [hq, mfld_simps]
-    dsimp only [(· ∘ ·)] at A B C D E ⊢
+    dsimp only [Function.comp_def] at A B C D E ⊢
     simp only [A, B, C, D, ← E]
   exact diff_DrirrflilDl.congr eq_comp
 #align cont_mdiff_on.cont_mdiff_on_tangent_map_within ContMDiffOn.contMDiffOn_tangentMapWithin
@@ -581,9 +581,9 @@ theorem tangentMap_tangentBundle_pure (p : TangentBundle I M) :
     · exact differentiableAt_const _
     · exact ModelWithCorners.unique_diff_at_image I
     · exact differentiableAt_id'.prod (differentiableAt_const _)
-  simp only [Bundle.zeroSection, tangentMap, mfderiv, A, if_pos, chartAt,
-    FiberBundle.chartedSpace_chartAt, TangentBundle.trivializationAt_apply, tangentBundleCore,
-    Function.comp, ContinuousLinearMap.map_zero, mfld_simps]
+  simp (config := { unfoldPartialApp := true }) only [Bundle.zeroSection, tangentMap, mfderiv, A,
+    if_pos, chartAt, FiberBundle.chartedSpace_chartAt, TangentBundle.trivializationAt_apply,
+    tangentBundleCore, Function.comp_def, ContinuousLinearMap.map_zero, mfld_simps]
   rw [← fderivWithin_inter N] at B
   rw [← fderivWithin_inter N, ← B]
   congr 1
Revert "chore: revert #7703 (#7710)"

This reverts commit f3695eb2.

Diff
@@ -328,6 +328,7 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
     refine C.congr fun p hp => ?_
     simp only [mfld_simps] at hp
     simp only [mfderivWithin, hf.mdifferentiableOn one_le_n _ hp.2, hp.1, if_pos, mfld_simps]
+    rfl
   have D :
     ContDiffOn 𝕜 m (fun x => fderivWithin 𝕜 (I' ∘ f ∘ I.symm) (I.symm ⁻¹' s ∩ range I) x)
       (range I ∩ I.symm ⁻¹' s) := by
chore: revert #7703 (#7710)

This reverts commit 26eb2b0a.

Diff
@@ -328,7 +328,6 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
     refine C.congr fun p hp => ?_
     simp only [mfld_simps] at hp
     simp only [mfderivWithin, hf.mdifferentiableOn one_le_n _ hp.2, hp.1, if_pos, mfld_simps]
-    rfl
   have D :
     ContDiffOn 𝕜 m (fun x => fderivWithin 𝕜 (I' ∘ f ∘ I.symm) (I.symm ⁻¹' s ∩ range I) x)
       (range I ∩ I.symm ⁻¹' s) := by
chore: bump toolchain to v4.2.0-rc2 (#7703)

This includes all the changes from #7606.

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

Diff
@@ -328,6 +328,7 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
     refine C.congr fun p hp => ?_
     simp only [mfld_simps] at hp
     simp only [mfderivWithin, hf.mdifferentiableOn one_le_n _ hp.2, hp.1, if_pos, mfld_simps]
+    rfl
   have D :
     ContDiffOn 𝕜 m (fun x => fderivWithin 𝕜 (I' ∘ f ∘ I.symm) (I.symm ⁻¹' s ∩ range I) x)
       (range I ∩ I.symm ⁻¹' s) := by
chore: tidy various files (#7009)
Diff
@@ -70,7 +70,7 @@ where the derivative is taken as a continuous linear map.
 We have to assume that `f` is `C^n` at `(x₀, g(x₀))` for `n ≥ m + 1` and `g` is `C^m` at `x₀`.
 We have to insert a coordinate change from `x₀` to `x` to make the derivative sensible.
 This result is used to show that maps into the 1-jet bundle and cotangent bundle are smooth.
-`cont_mdiff_at.mfderiv_id` and `ContMDiffAt.mfderiv_const` are special cases of this.
+`ContMDiffAt.mfderiv_const` is a special case of this.
 
 This result should be generalized to a `ContMDiffWithinAt` for `mfderivWithin`.
 If we do that, we can deduce `ContMDiffOn.contMDiffOn_tangentMapWithin` from this.
@@ -596,9 +596,9 @@ end TangentBundle
 
 namespace ContMDiffMap
 
--- These helpers for dot notation have been moved here from `geometry.manifold.cont_mdiff_map`
--- to avoid needing to import `geometry.manifold.cont_mdiff_mfderiv` there.
--- (However as a consequence we import `geometry.manifold.cont_mdiff_map` here now.)
+-- These helpers for dot notation have been moved here from
+-- `Mathlib/Geometry/Manifold/ContMDiffMap.lean` to avoid needing to import this file there.
+-- (However as a consequence we import `Mathlib/Geometry/Manifold/ContMDiffMap.lean` here now.)
 -- They could be moved to another file (perhaps a new file) if desired.
 open scoped Manifold
 
chore: rename isBoundedBilinearMapApply to isBoundedBilinearMap_apply (#6963)
Diff
@@ -261,7 +261,7 @@ theorem ContMDiffOn.continuousOn_tangentMapWithin_aux {f : H → H'} {s : Set H}
   suffices h : ContinuousOn (fderivWithin 𝕜 (I' ∘ f ∘ I.symm) (I.symm ⁻¹' s ∩ range I)) (I '' s)
   · have C := ContinuousOn.comp h I.continuous_toFun.continuousOn Subset.rfl
     have A : Continuous fun q : (E →L[𝕜] E') × E => q.1 q.2 :=
-      isBoundedBilinearMapApply.continuous
+      isBoundedBilinearMap_apply.continuous
     have B :
       ContinuousOn
         (fun p : H × E => (fderivWithin 𝕜 (I' ∘ f ∘ I.symm) (I.symm ⁻¹' s ∩ range I) (I p.1), p.2))
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
@@ -29,30 +29,30 @@ open scoped Topology Manifold Bundle
 /-! ### 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]
   [Is : 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']
   [I's : SmoothManifoldWithCorners I' 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]
   [Js : 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']
   [J's : SmoothManifoldWithCorners J' N']
   -- declare some additional normed spaces, used for fibers of vector bundles
-  {F₁ : Type _}
-  [NormedAddCommGroup F₁] [NormedSpace 𝕜 F₁] {F₂ : Type _} [NormedAddCommGroup F₂]
+  {F₁ : Type*}
+  [NormedAddCommGroup F₁] [NormedSpace 𝕜 F₁] {F₂ : Type*} [NormedAddCommGroup F₂]
   [NormedSpace 𝕜 F₂]
   -- declare functions, sets, points and smoothness indices
   {f f₁ : M → M'}
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_mfderiv
-! leanprover-community/mathlib commit e473c3198bb41f68560cab68a0529c854b618833
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Geometry.Manifold.MFDeriv
 import Mathlib.Geometry.Manifold.ContMDiffMap
 
+#align_import geometry.manifold.cont_mdiff_mfderiv from "leanprover-community/mathlib"@"e473c3198bb41f68560cab68a0529c854b618833"
+
 /-!
 ### Interactions between differentiability, smoothness and manifold derivatives
 
chore: cleanup whitespace (#5988)

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

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

Diff
@@ -204,7 +204,7 @@ theorem ContMDiffAt.mfderiv_const {x₀ : M} {f : M → M'} (hf : ContMDiffAt I
 We have to assume that `f` is `C^(n+1)` at `(x₀, g(x₀))` and `g` is `C^n` at `x₀`.
 We have to insert a coordinate change from `x₀` to `g₁(x)` to make the derivative sensible.
 
-This is  similar to `ContMDiffAt.mfderiv`, but where the continuous linear map is applied to a
+This is similar to `ContMDiffAt.mfderiv`, but where the continuous linear map is applied to a
 (variable) vector.
 -/
 theorem ContMDiffAt.mfderiv_apply {x₀ : N'} (f : N → M → M') (g : N → M) (g₁ : N' → N) (g₂ : N' → E)
feat: port Geometry.Manifold.ContMdiffMfderiv (#5496)

Dependencies 12 + 888

889 files ported (98.7%)
398403 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