Zulip Chat Archive

Stream: mathlib4

Topic: Complete Ordered AddCommMonoid


Antoine Chambert-Loir (Aug 10 2023 at 14:52):

I want to introduce an Ordered AddCommMonoid which is also a CompleteLinearOrder.
If I introduce successively [CompleteLinearOrder R] and [OrderedAddCommMonoid R], the two orderings on R
seem to be distinct…
How to do that?

Anatole Dedecker (Aug 10 2023 at 15:08):

I think the best solution is to use the fact that OrderedAddCommMonoid is really a bundled version of CovariantClass M M (· + ·) (· ≤ ·), and hope that whatever result you need from Mathlib actually assumes that instead of OrderedAddCommMonoid (which I think should always be the case?)

Martin Dvořák (Oct 09 2023 at 12:00):

I will probably end up doing the same (defining a typeclass for OrderedAddCommMonoid and CompleteLinearOrder together).

Eric Wieser (Oct 09 2023 at 12:03):

What types do you intend to cover with such a typeclass?

Martin Dvořák (Oct 09 2023 at 12:04):

Reals without multiplication.

Eric Wieser (Oct 09 2023 at 12:09):

Why not just use the reals?

Martin Dvořák (Oct 09 2023 at 12:09):

[messages in wrong order]

Eric Wieser (Oct 09 2023 at 12:09):

You can pretend the multiplication isn't there

Martin Dvořák (Oct 09 2023 at 12:19):

Actually, I want OrderedAddCommMonoid and CompleteLattice together.
Then I can consider tuples of real numbers with elementwise addition.

Eric Wieser (Oct 09 2023 at 12:22):

That sounds like a good motivation!

Eric Wieser (Oct 09 2023 at 12:22):

Though (tuples of) real numbers aren't a complete lattice

Martin Dvořák (Oct 09 2023 at 12:25):

I made a mistake. Tuples of EReal with elementwise addition would be the thing.

Eric Wieser (Oct 09 2023 at 12:27):

Note that to justify a new typeclass you should have at least two examples, but I assume they are:

  • EReal
  • Tuples of EReal (via Pi and Prod)

Eric Wieser (Oct 09 2023 at 12:28):

I think the answer to your question might be [CompleteLattice R] [AddCommMonoid R] [CovariantClass R R (· + ·) (· ≤ ·)] or similar

Martin Dvořák (Oct 09 2023 at 12:30):

Eric Wieser said:

Note that to justify a new typeclass you should have at least two examples, but I assume they are:

  • EReal
  • Tuples of EReal (via Pi and Prod)

Are you suggesting that CompleteOrderedAddCommMonoid should go to mathlib?

Damiano Testa (Oct 09 2023 at 12:31):

Maybe also ENNReals are an instance.

Eric Wieser (Oct 09 2023 at 12:40):

Are you suggesting that CompleteOrderedAddCommMonoid should go to mathlib?

I was, but now I'm suggesting that you can make do with [CompleteLattice R] [AddCommMonoid R] [CovariantClass R R (· + ·) (· ≤ ·)] for now

Eric Wieser (Oct 09 2023 at 12:41):

Because otherwise you're likely to find you want:

  • CompleteOrderedAddCommMonoid
  • CompleteOrderedAddCommGroup
  • ConditionallyCompleteOrderedAddCommGroup
  • ...

And the number of combinations quickly explodes

Martin Dvořák (Oct 09 2023 at 12:43):

Eric Wieser said:

I was, but now I'm suggesting that you can make do with [CompleteLattice R] [AddCommMonoid R] [CovariantClass R R (· + ·) (· ≤ ·)] for now

Is it guaranteed that
[CompleteLattice R] and [CovariantClass R R (· + ·) (· ≤ ·)]
talk about the same
and that
[AddCommMonoid R] and [CovariantClass R R (· + ·) (· ≤ ·)]
talk about the same addition?

Eric Wieser (Oct 09 2023 at 12:48):

[CompleteLattice R] provides a , CovariantClass talks about a

Eric Wieser (Oct 09 2023 at 12:49):

The problem arises when two typeclasses provide a notation

Eric Wieser (Oct 09 2023 at 12:49):

You can tell that CovariantClass doesn't provide a because you needed the already to even state it

Damiano Testa (Oct 09 2023 at 12:50):

In fact, you can use any relation there and CovariantClass will work with that.

Peter Nelson (Nov 01 2023 at 01:55):

Is ENat not also an example?

Peter Nelson (Nov 01 2023 at 01:56):

I think there was a zulip thread about this not too long ago, but I’m on mobile


Last updated: Dec 20 2023 at 11:08 UTC