Zulip Chat Archive

Stream: Is there code for X?

Topic: Cotangent Bundle as a Manifold


Dominic Steinitz (Nov 30 2025 at 11:13):

I have found that the tangent bundle has an instance as a manifold but not for the cotangent bundle; indeed I couldn’t even find a ChartedSpace instance.

Sébastien Gouëzel (Nov 30 2025 at 11:19):

Given two bundles, we have ways to construct new bundles (endowed automatically with their manifold structure). The cotangent bundle is the bundle of continuous linear maps from the tangent space to the real line (seen as a trivial bundle), so it fits in this framework.

Dominic Steinitz (Nov 30 2025 at 11:33):

That’s great - where should I look for more information?

Kevin Buzzard (Nov 30 2025 at 11:46):

One possible future answer to this could be "in Imperial's course notes" but I am not competent to write the code myself. My vision for the course notes is that they become a collection of examples of how to state undergraduate-level mathematics in Lean (and I was certainly taught about cotangent bundles for finite-dimensional smooth real manifolds as an undergrad).

Dominic Steinitz (Nov 30 2025 at 11:52):

I didn’t mean the cotangent bundle mathematically - I also learnt that as an undergraduate and even that one can construct it without the existence of the tangent bundle (a fun fact) - what I meant was the Lean documentation that tells one how to construct a new bundle from old with its corresponding IsManifold instance

Kevin Buzzard (Nov 30 2025 at 12:12):

Right, and that's what I mean too -- the Imperial repo would love to contain Lean code which explains how to do this mathematical construction in Lean (and also tensor products of finite-dimensional vector bundles over a finite-dimensional smooth manifold).

Michael Rothgang (Nov 30 2025 at 13:26):

I'll be teaching a class on differential geometry in Lean in January. Perhaps I'll have time for vector bundles also, and then this could also live there. (And of yourse, you're welcome to steal these, Kevin. Or tell me everything that could be improved there, so I can also improve those!)

Sébastien Gouëzel (Nov 30 2025 at 13:36):

Here is a snippet showing that typeclass inference founds by itself the manifold structure on the total space on the cotangent bundle, and how to express the fact that a section of the cotangent bundle is smooth.

import Mathlib

open Manifold Bundle
open scoped ContDiff Topology

variable
  {EB : Type*} [NormedAddCommGroup EB] [NormedSpace  EB]
  {HB : Type*} [TopologicalSpace HB] {IB : ModelWithCorners  EB HB} {n n' : WithTop }
  {B : Type*} [TopologicalSpace B] [ChartedSpace HB B]
  [IsManifold IB  B]

#synth IsManifold (IB.prod 𝓘(, EB L[] )) 
    (TotalSpace (EB L[] ) (fun (b : B)  (TangentSpace IB b L[] )))

lemma foo (g : Π (x : B), TangentSpace IB x L[] ) :
    ContMDiff IB (IB.prod 𝓘(, EB L[] )) 
      (fun b  TotalSpace.mk' (EB L[] ) b (g b)) := by
  sorry

@Michael Rothgang, I couldn't get the nice elaborators to work here, possibly because it's just impossible to guess everything there.

Sébastien Gouëzel (Nov 30 2025 at 14:03):

Note that this would already be enough to define, say, the curvature of a Riemannian manifold (as a bilinear map into the endomorphisms of the tangent space) and to state that this is a smooth map:

variable [RiemannianBundle (fun (x : B)  TangentSpace IB x)]
  [IsContMDiffRiemannianBundle IB  EB (fun (x : B)  TangentSpace IB x)]
  [EMetricSpace B] [IsRiemannianManifold IB B]

def curvature (b : B) : TangentSpace IB b L[] TangentSpace IB b L[]
    (TangentSpace IB b L[] TangentSpace IB b) := sorry

theorem contMDiff_curvature :
    ContMDiff IB (IB.prod 𝓘(, EB L[] EB L[] EB L[] EB)) 
      (fun (b : B)  TotalSpace.mk'
      (E := fun (b : B)  TangentSpace IB b L[] TangentSpace IB b L[]
        (TangentSpace IB b L[] TangentSpace IB b))
      (EB L[] EB L[] EB L[] EB) b (curvature b)) := sorry

Sébastien Gouëzel (Nov 30 2025 at 14:07):

(This is quite a mouthful to state as Lean is a little bit confused by the complexity of the objects, so one has to help it through additional type information, but hopefully we will get more robust elaborators that will hide all this behind notation)

Michael Rothgang (Nov 30 2025 at 22:46):

About the elaborators: indeed, that is not supported yet. In the following code, you get an error "Failed with error: Having a TotalSpace as source is not yet supported" - i.e., this is simply not implemented yet. Help is welcome, as always! (The other error might be everything being hard to guess: in the snippet I provided lots of type information so there should be no more ambiguity left.)

Code with diagnostic output


Last updated: Dec 20 2025 at 21:32 UTC