Zulip Chat Archive

Stream: mathlib4

Topic: Ditch CompleteSemilatticeSup


Violeta Hernández (Jan 11 2026 at 13:30):

docs#CompleteSemilatticeInf and docs#CompleteSemilatticeSup are entirely equivalent to docs#CompleteLattice. The former contains the data for the infimum, and the latter contains the data from the maximum, so they're not strictly equivalent from the viewpoint of the typeclass system, but the other half can always be completed from docs#completeLatticeOfCompleteSemilatticeInf or docs#completeLatticeOfCompleteSemilatticeSup, so mathematically neither is stronger than the others.

I believe we should remove CompleteSemilatticeInf and CompleteSemilatticeSup entirely, turning them into two constructors for CompleteLattice. Any objections?

Eric Wieser (Jan 11 2026 at 14:19):

Is there an argument for keeping them to match the MinimalAxioms types?

Junyan Xu (Jan 11 2026 at 14:39):

Docstring says:

Note that we rarely use CompleteSemilatticeInf (in fact, any such object is always a CompleteLattice, so it's usually best to start there).
Nevertheless it is sometimes a useful intermediate step in constructions.

Violeta Hernández (Jan 11 2026 at 14:39):

Well, we do have some API stated using CompleteSemilatticeInf, see e.g. docs#sInf_le. My claim is that we should have none.

Violeta Hernández (Jan 11 2026 at 14:40):

Eric Wieser said:

Is there an argument for keeping them to match the MinimalAxioms types?

What's up with them? I don't really understand their design.

Junyan Xu (Jan 11 2026 at 14:43):

e.g. docs#sInf_le. My claim is that we should have none.

If we're not removing CompleteSemilatticeInf I don't think we should change the assumption; some automated tool might change it back ...

Violeta Hernández (Jan 11 2026 at 14:44):

No need for automated tools: #33740

Yury G. Kudryashov (Jan 11 2026 at 14:48):

Initially, I added one of them as a constructor for CompleteLattice, then @Kim Morrison added these typeclasses in !3#6797

Eric Wieser (Jan 11 2026 at 15:10):

Violeta Hernández said:

Eric Wieser said:

Is there an argument for keeping them to match the MinimalAxioms types?

What's up with them? I don't really understand their design.

I think it's just a way of making the custom constructor for the real typeclass more convenient, docs#Monoid.ofMinimalAxioms let's you use {} notation to name arguments

Eric Wieser (Jan 11 2026 at 15:12):

Oh nevermind, we don't have these for algebra, only for order

Eric Wieser (Jan 11 2026 at 15:12):

Then I agree that the design of these is fishy too

Violeta Hernández (Jan 11 2026 at 15:35):

Yeah, surely we could remove docs#Order.Frame.MinimalAxioms entirely and replace its functionality with a constructor for docs#Order.Frame, analogously to what docs#Ring.ofMinimalAxioms does currently.

Yury G. Kudryashov (Jan 11 2026 at 15:42):

I don't think that Order.Frame.MinimalAxioms should be a class.

Yury G. Kudryashov (Jan 11 2026 at 15:43):

If it's a "named args for a constructor" thing, then it should be a struct, and the constructor should be an abbrev.

Violeta Hernández (Jan 11 2026 at 16:52):

Order.Frame.MinimalAxioms is just a single axiom on top of CompleteLattice. I don't think it even needs to be a struct.

Eric Wieser (Jan 11 2026 at 17:30):

Yury G. Kudryashov said:

I don't think that Order.Frame.MinimalAxioms should be a class.

I think it's a class because it extends a class

Eric Wieser (Jan 11 2026 at 17:31):

I claim that structures extending classes are usually a bad design, even if nothing actually breaks

Artie Khovanov (Jan 11 2026 at 18:35):

I support this refactor

Yury G. Kudryashov (Jan 12 2026 at 04:22):

Let's wait for @Kim Morrison who turned a constructor into a class.

Kim Morrison (Jan 23 2026 at 10:19):

Sorry, it's been a long time. I don't have any attachment to my change.


Last updated: Feb 28 2026 at 14:05 UTC