Zulip Chat Archive

Stream: general

Topic: Topological (scoped) notation in doc-gen


Filippo A. E. Nuccio (Dec 23 2025 at 17:46):

In https://github.com/leanprover-community/mathlib4/blob/8fc0483a875e84b83c6cdb6f5c124bcbb3530370/Mathlib/Topology/Defs/Basic.lean#L189 one finds the definition of open/closed/etc... with respect to non-standard topologies, so that one can write IsOpen[T] (U : Set X), for instance, to mean that a set U is open wrt to the topology T rather than wrt any other topology that might be synthesized on X. This I find very convenient, but it does not show up in the doc-gen so that, for example, while reading docs#LinearMap.mem_span_iff_continuous_of_finite online one has no clue of the topology on E with respect to which φ would be continuous — whereas in the source this is very clear.

I wonder whether

  1. is there anything that can be done to force the website to contain more notation;
  2. we should embrace the policy of forcing all declarations using this notation to contain a docComment in the form/-- ... -/ (rather than just a /- ... -/ comment) so that this will show up in the website.

Yaël Dillies (Dec 23 2025 at 17:47):

My preference would be for n°1, by writing a custom delaborator checking for canonicity of instances. This will also be very useful in measure theory land, for the same reasons.

Filippo A. E. Nuccio (Dec 23 2025 at 17:48):

I completely agree, but I cannot assess how hard this would be.

Yaël Dillies (Dec 23 2025 at 17:49):

It should be relatively easy. Maybe open a good-first-issue on the mathlib repo?

Thomas Murrills (Dec 23 2025 at 17:50):

Off the top of your head, does this involve synthesizing instances during prettyprinting? If so I’ll revive my bugfix PR to core for an issue related to that. :)

Filippo A. E. Nuccio (Dec 23 2025 at 17:52):

I'm not entirely sure this has to do with prettyprinting, but @Yaël Dillies will certainly know better.

Filippo A. E. Nuccio (Dec 23 2025 at 17:54):

Yaël Dillies said:

It should be relatively easy. Maybe open a good-first-issue on the mathlib repo?

https://github.com/leanprover-community/mathlib4/issues/33238

Yaël Dillies (Dec 23 2025 at 17:55):

It is about pretty-printing indeed (doc-gen is a glorified pretty printer after all). There's a cheap way to write this delaborator for the most common cases (check whether there are two TopologicalSpace Foo hypotheses in context), but the proper solution would indeed involve synthesizing instances.

Chris Henson (Dec 23 2025 at 18:08):

Also to my knowledge, scoped notations appearing in documentation is still blocked by lean4#6050. The comments link to a previous Zulip thread. (Please upvote if like myself you find this important!)

Aaron Liu (Dec 23 2025 at 20:31):

linking #metaprogramming / tactics > Delaborators for `IsOpen[t]` etc here

Eric Wieser (Dec 23 2025 at 21:33):

Right, there is already a (open?) PR for what Yael describes

Eric Wieser (Dec 23 2025 at 21:33):

But if the notation is scoped it doesn't help


Last updated: Feb 28 2026 at 14:05 UTC