Zulip Chat Archive

Stream: maths

Topic: canonical group_with_zero {-1,0,1}


Johan Commelin (Nov 05 2021 at 19:08):

  • Do we have a canonical multiplicative group with zero of cardinality three? (Candidates: zmod 3)
  • Related: Do we have a canonical multiplicative group of cardinality two? (Candidates: units ℤ, units (zmod 3))

I'm not so happy with zmod 3. Intuitively it's too ringy. A group_with_zero_hom zmod 3 →* ℤ (or any ring for that matter) just feels morally wrong.

Johan Commelin (Nov 05 2021 at 19:08):

Should I ignore this feeling, and use zmod 3 nonetheless? Or is there a better candidate? Or do we want/need a new type?

Kevin Buzzard (Nov 05 2021 at 19:08):

Do we have a canonical cyclic group of any order? Maria has been using multiplicative int for the infinite cyclic group.

Kevin Buzzard (Nov 05 2021 at 19:10):

So with_zero (multiplicative (zmod 2)) is my suggestion for your first question.

Kevin Buzzard (Nov 05 2021 at 19:11):

OTOH since addition was defined on fin 2 to match zmod 2 (despite my protestations ;-) ) you could also use that...

Johan Commelin (Nov 05 2021 at 19:16):

I think it would be nice to have the notations -1, 0, 1 for the three elements. Your with_zero (multiplicate _) will not have that out of the box, right?
Also, it's a pretty long name for a simple thing...

Eric Wieser (Nov 05 2021 at 19:17):

That notation should work for with_zero (units Z), right?

Kevin Buzzard (Nov 05 2021 at 19:17):

I mean, there are a ton of ways to do it

Eric Wieser (Nov 05 2021 at 19:18):

Does it make sense to have a units_or_zero type?

Kevin Buzzard (Nov 05 2021 at 19:19):

I see -- somehow the issue is not that Johan wants "cyclic groups with zero" at this point (although Maria did for valuation theory) -- he just wants {-1,0,1}. I hadn't read the title of the thread because it was cut off in the app :-)

Eric Wieser (Nov 05 2021 at 19:20):

Eric Wieser said:

That notation should work for with_zero (units Z), right?

#check (1 : with_zero (units ))  -- ok
#check (0 : with_zero (units ))  -- ok
#check (-1 : with_zero (units ))  -- fail :(

Yakov Pechersky (Nov 05 2021 at 19:21):

Your coercions are too eager

Johan Commelin (Nov 05 2021 at 19:21):

Kevin Buzzard said:

I mean, there are a ton of ways to do it

Exactly. Hence my question.

Kevin Buzzard (Nov 05 2021 at 19:22):

Now I understand that you want the notation, I think zmod 3 is a clever choice ;-)

Yakov Pechersky (Nov 05 2021 at 19:22):

You'll need ((-1 : units int) : with_zero blah), and hope that neg works properly for units int.

Eric Wieser (Nov 05 2021 at 19:22):

We're missing:

section
attribute [semireducible] with_zero
instance {α} [has_neg α] : has_neg (with_zero α) := λ a, option.map has_neg.neg a
end

Eric Wieser (Nov 05 2021 at 19:23):

If we add that the example above works

Kevin Buzzard (Nov 05 2021 at 19:23):

I think that's better than the zmod 3 hack

Adam Topaz (Nov 05 2021 at 19:24):

Should we define galois_field 1 n? :wink: (sorry)

Yakov Pechersky (Nov 05 2021 at 19:24):

IIRC doing the semireducible trick could make things annoying later on. We hit that with with_top before.

Yakov Pechersky (Nov 05 2021 at 19:25):

Rather, a with_zero.rec definition would be kinder to api users

Eric Wieser (Nov 05 2021 at 19:26):

#10194

Eric Wieser (Nov 05 2021 at 19:28):

Yakov Pechersky said:

IIRC doing the semireducible trick could make things annoying later on. We hit that with with_top before.

I'm just copying what is already done for the has_mul instance

Yury G. Kudryashov (Nov 05 2021 at 19:29):

-1 works for zmod 3 too

Kevin Buzzard (Nov 05 2021 at 19:35):

yeah but it's a hack

Floris van Doorn (Nov 05 2021 at 22:40):

One thing worth considering:
Do you ever want to define a map using pattern matching like this?

def f : with_zero (units Z) -> X
| (-1) := ...
| 0    := ...
| 1    := ...

Depending on the choice this may not work.
But maybe this is not important, because you might only care about monoid_with_zero_hom out of this type?

Eric Wieser (Nov 06 2021 at 00:29):

Does that actually work right now, @Floris van Doorn?

Kevin Buzzard (Nov 06 2021 at 00:34):

oh surely not (edit: no)

Johan Commelin (Nov 06 2021 at 06:12):

Right. With zmod 3 you can do something very close to that, I guess.

Johan Commelin (Nov 06 2021 at 06:12):

Anyway, with any type, we can get reasonably close to that by writing a custom recursor.

Floris van Doorn (Nov 06 2021 at 09:48):

I just meant that there are ways to make it work, but if you do that you cannot reuse stuff from the library, so it's probably not worth it.


Last updated: Dec 20 2023 at 11:08 UTC