Skip to content

Commit a3af3cf

Browse files
grunwegbryangingechen
authored andcommitted
feat: custom elaborators for TangentSpace and tangentMap(Within) (leanprover-community#36155)
And use these to golf the differential geometry files a bit further.
1 parent 17fc289 commit a3af3cf

11 files changed

Lines changed: 161 additions & 106 deletions

File tree

Mathlib/Geometry/Manifold/ContMDiffMFDeriv.lean

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -274,18 +274,18 @@ variable [Is : IsManifold I 1 M] [I's : IsManifold I' 1 M']
274274
is `C^m` when `m+1 ≤ n`. -/
275275
theorem ContMDiffOn.contMDiffOn_tangentMapWithin
276276
(hf : CMDiff[s] n f) (hmn : m + 1 ≤ n) (hs : UniqueMDiffOn I s) :
277-
CMDiff[(π E (TangentSpace I) ⁻¹' s)] m (tangentMapWithin I I' f s) := by
277+
CMDiff[(π E (TangentSpace I) ⁻¹' s)] m (tangentMap[s] f) := by
278278
intro x₀ hx₀
279279
let s' : Set (TangentBundle I M) := (π E (TangentSpace I) ⁻¹' s)
280280
let b₁ : TangentBundle I M → M := fun p ↦ p.1
281-
let v : Π (y : TangentBundle I M), TangentSpace I (b₁ y) := fun y ↦ y.2
281+
let v : Π (y : TangentBundle I M), TangentSpace% (b₁ y) := fun y ↦ y.2
282282
have hv : ContMDiffWithinAt I.tangent I.tangent m (fun y ↦ (v y : TangentBundle I M)) s' x₀ :=
283283
contMDiffWithinAt_id
284284
let b₂ : TangentBundle I M → M' := f ∘ b₁
285285
have hb₂ : CMDiffAt[s'] m b₂ x₀ :=
286286
((hf (b₁ x₀) hx₀).of_le (le_self_add.trans hmn)).comp _
287287
(contMDiffWithinAt_proj (TangentSpace I)) (fun x h ↦ h)
288-
let ϕ : Π (y : TangentBundle I M), TangentSpace I (b₁ y) →L[𝕜] TangentSpace I' (b₂ y) :=
288+
let ϕ : Π (y : TangentBundle I M), TangentSpace% (b₁ y) →L[𝕜] TangentSpace% (b₂ y) :=
289289
fun y ↦ mfderiv[s] f (b₁ y)
290290
have hϕ : CMDiffAt[s'] m (fun y ↦ ContinuousLinearMap.inCoordinates E (TangentSpace I (M := M)) E'
291291
(TangentSpace I' (M := M')) (b₁ x₀) (b₁ y) (b₂ x₀) (b₂ y) (ϕ y)) x₀ := by
@@ -299,21 +299,21 @@ theorem ContMDiffOn.contMDiffOn_tangentMapWithin
299299
derivative is continuous there. -/
300300
theorem ContMDiffOn.continuousOn_tangentMapWithin (hf : CMDiff[s] n f) (hmn : 1 ≤ n)
301301
(hs : UniqueMDiffOn I s) :
302-
ContinuousOn (tangentMapWithin I I' f s) (π E (TangentSpace I) ⁻¹' s) := by
303-
have : CMDiff[π E (TangentSpace I) ⁻¹' s] 0 (tangentMapWithin I I' f s) :=
302+
ContinuousOn (tangentMap[s] f) (π E (TangentSpace I) ⁻¹' s) := by
303+
have : CMDiff[π E (TangentSpace I) ⁻¹' s] 0 (tangentMap[s] f) :=
304304
hf.contMDiffOn_tangentMapWithin hmn hs
305305
exact this.continuousOn
306306

307307
/-- If a function is `C^n`, then its bundled derivative is `C^m` when `m+1 ≤ n`. -/
308308
theorem ContMDiff.contMDiff_tangentMap (hf : CMDiff n f) (hmn : m + 1 ≤ n) :
309-
CMDiff m (tangentMap I I' f) := by
309+
CMDiff m (tangentMap% f) := by
310310
rw [← contMDiffOn_univ] at hf ⊢
311311
convert! hf.contMDiffOn_tangentMapWithin hmn uniqueMDiffOn_univ
312312
rw [tangentMapWithin_univ]
313313

314314
/-- If a function is `C^n`, with `1 ≤ n`, then its bundled derivative is continuous. -/
315315
theorem ContMDiff.continuous_tangentMap (hf : CMDiff n f) (hmn : 1 ≤ n) :
316-
Continuous (tangentMap I I' f) := by
316+
Continuous (tangentMap% f) := by
317317
rw [← contMDiffOn_univ] at hf
318318
rw [← continuousOn_univ]
319319
convert! hf.continuousOn_tangentMapWithin hmn uniqueMDiffOn_univ
@@ -342,7 +342,7 @@ may seem.
342342
TODO define splittings of vector bundles; state this result invariantly. -/
343343
theorem tangentMap_tangentBundle_pure [Is : IsManifold I 1 M]
344344
(p : TangentBundle I M) :
345-
tangentMap I I.tangent (zeroSection E (TangentSpace I)) p = ⟨⟨p.proj, 0⟩, ⟨p.2, 0⟩⟩ := by
345+
tangentMap% (zeroSection (B := M) E (TangentSpace I)) p = ⟨⟨p.proj, 0⟩, ⟨p.2, 0⟩⟩ := by
346346
rcases p with ⟨x, v⟩
347347
have N : I.symm ⁻¹' (chartAt H x).target ∈ 𝓝 (I ((chartAt H x) x)) := by
348348
apply IsOpen.mem_nhds
@@ -404,7 +404,7 @@ bundles. -/
404404

405405
lemma equivTangentBundleProd_eq_tangentMap_prod_tangentMap :
406406
equivTangentBundleProd I M I' M' = fun (p : TangentBundle (I.prod I') (M × M')) ↦
407-
(tangentMap (I.prod I') I Prod.fst p, tangentMap (I.prod I') I' Prod.snd p) := by
407+
(tangentMap% (@Prod.fst M M') p, tangentMap% (@Prod.snd M M') p) := by
408408
simp only [tangentMap_prodFst, tangentMap_prodSnd]; rfl
409409

410410
variable [IsManifold I 1 M] [IsManifold I' 1 M']

Mathlib/Geometry/Manifold/GroupLieAlgebra.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ variable (I G) in
5353
`GroupLieAlgebra` instead of `LieAlgebra` as the latter is taken as a generic class. -/
5454
@[to_additive /-- The Lie algebra of an additive Lie group, i.e., its tangent space at zero. We use
5555
the word `AddGroupLieAlgebra` instead of `LieAlgebra` as the latter is taken as a generic class. -/]
56-
abbrev GroupLieAlgebra : Type _ := TangentSpace I (1 : G)
56+
abbrev GroupLieAlgebra : Type _ := TangentSpace% (1 : G)
5757

5858
/-- The invariant vector field associated to a vector `v` in the Lie algebra. At a point `g`, it
5959
is given by the image of `v` under left-multiplication by `g`. -/
6060
@[to_additive /-- The invariant vector field associated to a vector `v` in the Lie algebra. At a
6161
point `g`, it is given by the image of `v` under left-addition by `g`. -/]
62-
noncomputable def mulInvariantVectorField (v : GroupLieAlgebra I G) (g : G) : TangentSpace I g :=
62+
noncomputable def mulInvariantVectorField (v : GroupLieAlgebra I G) (g : G) : TangentSpace% g :=
6363
mfderiv% (g * ·) (1 : G) v
6464

6565
set_option backward.isDefEq.respectTransparency false in
@@ -134,7 +134,7 @@ lemma mpullback_mulInvariantVectorField (g : G) (v : GroupLieAlgebra I G) :
134134

135135
set_option backward.isDefEq.respectTransparency false in
136136
@[to_additive]
137-
lemma mulInvariantVectorField_eq_mpullback (g : G) (V : Π (g : G), TangentSpace I g) :
137+
lemma mulInvariantVectorField_eq_mpullback (g : G) (V : Π (g : G), TangentSpace% g) :
138138
mulInvariantVectorField (V 1) g = mpullback I I (g⁻¹ * ·) V g := by
139139
have A : 1 = g⁻¹ * g := by simp
140140
simp only [mulInvariantVectorField, mpullback, inverse_mfderiv_mul_left]
@@ -171,7 +171,7 @@ theorem contMDiff_mulInvariantVectorField (v : GroupLieAlgebra I G) :
171171
(equivTangentBundleProd I G I G).symm
172172
have S₂ : CMDiff (minSmoothness 𝕜 2) F₂ := contMDiff_equivTangentBundleProd_symm
173173
let F₃ : TangentBundle (I.prod I) (G × G) → TangentBundle I G :=
174-
tangentMap (I.prod I) I (fun (p : G × G) ↦ p.1 * p.2)
174+
tangentMap% (fun (p : G × G) ↦ p.1 * p.2)
175175
have S₃ : CMDiff (minSmoothness 𝕜 2) F₃ := by
176176
apply ContMDiff.contMDiff_tangentMap _ (m := minSmoothness 𝕜 2) le_rfl
177177
rw [A]

Mathlib/Geometry/Manifold/IntegralCurve/Basic.lean

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Authors: Winston Yin
66
module
77

88
public import Mathlib.Geometry.Manifold.MFDeriv.Tangent
9+
public import Mathlib.Geometry.Manifold.Notation
910

1011
/-!
1112
# Integral curves of vector fields on a manifold
@@ -62,21 +63,21 @@ variable
6263
/-- If `γ : ℝ → M` is $C^1$ on `s : Set ℝ` and `v` is a vector field on `M`,
6364
`IsMIntegralCurveOn γ v s` means `γ t` is tangent to `v (γ t)` for all `t ∈ s`. The value of `γ`
6465
outside of `s` is irrelevant and considered junk. -/
65-
def IsMIntegralCurveOn (γ : ℝ → M) (v : (x : M) → TangentSpace I x) (s : Set ℝ) : Prop :=
66+
def IsMIntegralCurveOn (γ : ℝ → M) (v : (x : M) → TangentSpace% x) (s : Set ℝ) : Prop :=
6667
∀ t ∈ s, HasMFDerivAt[s] γ t ((1 : ℝ →L[ℝ] ℝ).smulRight <| v (γ t))
6768

6869
/-- If `v` is a vector field on `M` and `t₀ : ℝ`, `IsMIntegralCurveAt γ v t₀` means `γ : ℝ → M` is a
6970
local integral curve of `v` in a neighbourhood containing `t₀`. The value of `γ` outside of this
7071
interval is irrelevant and considered junk. -/
71-
def IsMIntegralCurveAt (γ : ℝ → M) (v : (x : M) → TangentSpace I x) (t₀ : ℝ) : Prop :=
72+
def IsMIntegralCurveAt (γ : ℝ → M) (v : (x : M) → TangentSpace% x) (t₀ : ℝ) : Prop :=
7273
∀ᶠ t in 𝓝 t₀, HasMFDerivAt% γ t ((1 : ℝ →L[ℝ] ℝ).smulRight <| v (γ t))
7374

7475
/-- If `v : M → TM` is a vector field on `M`, `IsMIntegralCurve γ v` means `γ : ℝ → M` is a global
7576
integral curve of `v`. That is, `γ t` is tangent to `v (γ t)` for all `t : ℝ`. -/
76-
def IsMIntegralCurve (γ : ℝ → M) (v : (x : M) → TangentSpace I x) : Prop :=
77+
def IsMIntegralCurve (γ : ℝ → M) (v : (x : M) → TangentSpace% x) : Prop :=
7778
∀ t : ℝ, HasMFDerivAt% γ t ((1 : ℝ →L[ℝ] ℝ).smulRight (v (γ t)))
7879

79-
variable {γ γ' : ℝ → M} {v : (x : M) → TangentSpace I x} {s s' : Set ℝ} {t₀ : ℝ}
80+
variable {γ γ' : ℝ → M} {v : (x : M) → TangentSpace% x} {s s' : Set ℝ} {t₀ : ℝ}
8081

8182
lemma IsMIntegralCurve.isMIntegralCurveOn (h : IsMIntegralCurve γ v) (s : Set ℝ) :
8283
IsMIntegralCurveOn γ v s := fun t _ ↦ (h t).hasMFDerivWithinAt

Mathlib/Geometry/Manifold/MFDeriv/NormedSpace.lean

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -276,15 +276,15 @@ This lemma phrases the formula using the equiv `NormedSpace.fromTangentSpace`, w
276276
canonical identification. (It would also be possible to phrase the formula without this equiv,
277277
instead using casting and definitional abuse.) -/
278278
private lemma HasMFDerivAt.smul
279-
{f' : TangentSpace I x →L[𝕜] 𝕜}
279+
{f' : TangentSpace% x →L[𝕜] 𝕜}
280280
(hs : HasMFDerivAt% f x ((fromTangentSpace (f x)).symm.toContinuousLinearMap ∘L f'))
281-
{g' : TangentSpace I x →L[𝕜] V}
281+
{g' : TangentSpace% x →L[𝕜] V}
282282
(hg : HasMFDerivAt% g x ((fromTangentSpace (g x)).symm.toContinuousLinearMap ∘L g')) :
283283
-- canonically identify `g'` with a linear map into the tangent space at `(f • g) x`
284-
letI g'_ : TangentSpace I x →L[𝕜] TangentSpace 𝓘(𝕜, V) ((f • g) x) :=
284+
letI g'_ : TangentSpace% x →L[𝕜] TangentSpace 𝓘(𝕜, V) ((f • g) x) :=
285285
(fromTangentSpace _).symm.toContinuousLinearMap ∘L g'
286286
-- canonically identify `g x` with a linear map into a tangent space at `(f • g) x`
287-
letI gx : 𝕜 →L[𝕜] TangentSpace 𝓘(𝕜, V) ((f • g) x) :=
287+
letI gx : 𝕜 →L[𝕜] TangentSpace% ((f • g) x) :=
288288
toSpanSingleton 𝕜 ((fromTangentSpace _).symm (g x))
289289
-- now the main statement typechecks
290290
HasMFDerivAt% (f • g) x (f x • g'_ + gx ∘L f') := by
@@ -382,7 +382,7 @@ typecheck we need a phrasing involving the canonical identification `NormedSpace
382382
between the vector space `V` and the tangent space to this vector space at any point. This is
383383
because two different tangent spaces (at `(f • g) x` and `g x`) appear in the equation. -/
384384
private lemma fromTangentSpace_mfderiv_smul_apply (hf : MDiffAt f x) (hg : MDiffAt g x)
385-
(v : TangentSpace I x) :
385+
(v : TangentSpace% x) :
386386
fromTangentSpace _ (mfderiv% (f • g) x v)
387387
= f x • fromTangentSpace _ (mfderiv% g x v) + fromTangentSpace _ (mfderiv% f x v) • g x := by
388388
simpa using congr($(fromTangentSpace_mfderiv_smul hf hg) v)
@@ -400,7 +400,7 @@ because two different tangent spaces (at `(f • g) x` and `g x`) appear in the
400400
This is a defeq variant of the main lemma `fromTangentSpace_mfderiv_smul_apply`, in which we work in
401401
the tangent space at `f x • g x` (the simp-normal form) rather than at `(f • g) x`. -/
402402
private lemma fromTangentSpace_mfderiv_smul_apply' (hf : MDiffAt f x) (hg : MDiffAt g x)
403-
(v : TangentSpace I x) :
403+
(v : TangentSpace% x) :
404404
fromTangentSpace (f x • g x) (mfderiv% (f • g) x v)
405405
= f x • fromTangentSpace _ (mfderiv% g x v) + fromTangentSpace _ (mfderiv% f x v) • g x :=
406406
fromTangentSpace_mfderiv_smul_apply hf hg v
@@ -428,7 +428,7 @@ Future: this could be generalised to functions into additive torsors over abelia
428428
-/
429429
@[expose]
430430
noncomputable def mvfderiv (g : M → F) :
431-
Π x : M, TangentSpace I x →L[𝕜] F :=
431+
Π x : M, TangentSpace% x →L[𝕜] F :=
432432
fun x ↦ (NormedSpace.fromTangentSpace <| g x).toContinuousLinearMap ∘L (mfderiv% g x)
433433
@[deprecated (since := "2026-05-17")] alias extDerivFun := mvfderiv
434434

0 commit comments

Comments
 (0)