Zulip Chat Archive

Stream: Is there code for X?

Topic: Different casts from zmod


Heather Macbeth (Jul 15 2021 at 04:58):

How do I prove that cast of cast equals cast, coming out of zmod?

import data.zmod.basic
import data.complex.basic

example {m : } (i : zmod m) : ((i:):) = (i:) := sorry

Johan Commelin (Jul 15 2021 at 05:31):

That cast should really die.

Johan Commelin (Jul 15 2021 at 05:33):

There should be a lemma saying that ((i:int):R) = (i:R) for char 0 rings R.

Johan Commelin (Jul 15 2021 at 05:40):

example {m : } (i : zmod m) : ((i:):) = (i:) :=
begin
  conv {
    rw [ zmod.int_cast_comp_cast],
    to_rhs,
    rw [ zmod.int_cast_comp_cast] },
  norm_cast,
end

Heather Macbeth (Jul 15 2021 at 05:41):

Thanks!

Eric Wieser (Jul 15 2021 at 08:26):

Are we just missing some norm_cast attributes?

Johan Commelin (Jul 15 2021 at 08:30):

@Eric Wieser I'm not a norm_cast expert, but zmod.int_cast_comp_cast will loop if you apply it in the \l direction.

Johan Commelin (Jul 15 2021 at 08:30):

(That's why I have the complicated conv { rw, to_rhs, rw } construction.

Kevin Buzzard (Jul 15 2021 at 08:33):

This thread is making my stomach hurt. Why do we even have casts from Z/mZ to R or C? Why would I expect the example to be true? It's not mathematically meaningful. There are monoid homs from Z/mZ to C taking values in 0 union roots of unity which I could imagine in a parallel universe were used as casts, and then the example would be false.

Eric Wieser (Jul 15 2021 at 08:35):

Attempting a doc link: docs#zmod.cast

Johan Commelin (Jul 15 2021 at 08:36):

Johan Commelin said:

That cast should really die.

I stand by my point.

Eric Wieser (Jul 15 2021 at 08:37):

That cast is piggy-backing on a similar cast that fin n has (edit: fin.val is not zmod.val)

Eric Wieser (Jul 15 2021 at 08:38):

But maybe that one isn't so bad because at least fin is morally positive in some sense, at least when you ignore addition

Johan Commelin (Jul 15 2021 at 08:40):

We can protect ourselves by assuming char_p R n for the cast. Then it will only show up in sensible places.

Eric Wieser (Jul 15 2021 at 08:56):

That's probably safe, although the cast is also valid when n=0

Johan Commelin (Jul 15 2021 at 09:06):

Yes, there is a meaningful cast zmod n -> R when char_p R m and m | n.

Johan Commelin (Jul 15 2021 at 09:06):

But I wouldn't mind having no cast at all, and just using docs#zmod.cast_hom instead.


Last updated: Dec 20 2023 at 11:08 UTC