Zulip Chat Archive

Stream: mathlib4

Topic: Ordinal.pred


Violeta Hernández (Feb 11 2025 at 20:23):

I've always been a bit puzzled about what to make of docs#Ordinal.pred. To me it seems like a definition that can obviously be generalized, except that there's no obvious target for generalization, and maybe we don't even need it anyways?

Violeta Hernández (Feb 11 2025 at 20:27):

To get some obvious ideas out of the way:

  • This can't be turned into a docs#PredOrder instance, since it doesn't satisfy min_of_le_pred (pred ω = ω but ¬ IsMin ω)
  • In general pred x ≠ x - 1 (e.g. pred (ω + 1) = ω but (ω + 1) - 1 = ω + 1 because ordinal subtraction is right subtraction)

Violeta Hernández (Feb 11 2025 at 20:29):

Ordinal.pred satisfies a pretty nice property: it forms a Galois connection with Order.succ. That is, pred a ≤ b ↔ a ≤ succ b.

Violeta Hernández (Feb 11 2025 at 20:41):

And in fact, this property generalizes to the analogous function defined on any linear order without a maximum:

Proof

Violeta Hernández (Feb 11 2025 at 20:43):

So this shows (in my opinion) that there's at least some mathematical value in this definition. Perhaps that warrants giving it a proper name and some API?

Violeta Hernández (Feb 11 2025 at 20:46):

On the other hand, Ordinal.pred is almost completely unused. It only ever appears in the definition of docs#Ordinal.log, where it could easily be inlined or removed.

Violeta Hernández (Feb 11 2025 at 20:46):

So I'm stuck on what should be done.

Violeta Hernández (Feb 11 2025 at 22:01):

(if we do want to keep Ordinal.pred, I opened #21751 cleaning up its API)

Floris van Doorn (Feb 12 2025 at 11:41):

I would not eagerly generalize a rarely used definition, just for the sake of generalization, if you have no application for it (and unifying with Nat.pred is not a good enough reason, since that will be defined in Lean Core anyway). If there are compelling other places we already want it, we could generalize it.

Violeta Hernández (Feb 12 2025 at 19:47):

I have to agree. I guess the thing that really irks me is that there's no reason for pred not to be defined for other structures like cardinals. But if you actually follow that line of thought there's little reason for it to be defined on ordinals either.


Last updated: May 02 2025 at 03:31 UTC