Zulip Chat Archive
Stream: general
Topic: semiring with 0 ≠ 1
Chris Hughes (May 12 2018 at 08:15):
Is there a type class for a semiring with 0 ≠ 1
?
Chris Hughes (May 12 2018 at 08:19):
I tried [semiring α] [zero_ne_one_class α]
but then I ended up with two different definitions of one.
Kenny Lau (May 12 2018 at 08:20):
try to use old structure command and build a new class
Kenny Lau (May 12 2018 at 08:20):
the diamond death you just experienced
Johan Commelin (May 12 2018 at 08:27):
I tried
[semiring α] [zero_ne_one_class α]
but then I ended up with two different definitions of one.
Did you also end up with two different definitions of zero?
Chris Hughes (May 12 2018 at 08:31):
Yes.
Chris Hughes (May 12 2018 at 08:35):
Same question for ring
.
Chris Hughes (May 12 2018 at 08:59):
Would it have been better to define zero_ne_one_class
as
class zero_ne_one_class (α : Type*) [has_zero α] [has_one α] : Prop := (zero_ne_one : 0 ≠ 1)
Mario Carneiro (May 12 2018 at 09:04):
Yes. There is not much I can do about it
Johan Commelin (May 12 2018 at 09:05):
Well, we can define our own has_zero_ne_one
, right?
Johan Commelin (May 12 2018 at 09:05):
In the way that Chris suggested
Mario Carneiro (May 12 2018 at 09:08):
Sure. I would ask the reason for the use though, it seems not so useful
Chris Hughes (May 12 2018 at 09:09):
I'm doing univariate polys, and I'm trying to prove degree_of (X : uv_polynomial α) = 1
Mario Carneiro (May 12 2018 at 09:11):
how is degree_of defined?
Mario Carneiro (May 12 2018 at 09:11):
and X
Chris Hughes (May 12 2018 at 09:12):
after unfolding it looks like this sup ((single 1 1).support) id = 1
Chris Hughes (May 12 2018 at 09:12):
unfolding single makes it become this sup (ite (1 = 0) ∅ (singleton 1)) id = 1
Mario Carneiro (May 12 2018 at 09:13):
is there decidable equality?
Mario Carneiro (May 12 2018 at 09:13):
or are you classical
Chris Hughes (May 12 2018 at 09:14):
Yes.
Chris Hughes (May 12 2018 at 09:14):
there is decidable equality
Chris Hughes (May 12 2018 at 09:18):
I could probably get around it by proving alternative lemmas like degree_of_monomial
. Or just make 0 \ne 1
an argument to the theorem.
Mario Carneiro (May 12 2018 at 09:27):
I used a typeclass nonzero_ring
in my metamath formalization of this one. Perhaps is_nonzero
can be a typeclass depending on ring
instead of has_zero
and has_one
?
Mario Carneiro (May 12 2018 at 09:29):
nonzero semiring seems like a bad idea though, it's not nearly as nice as it sounds since it is not cancellative
Kevin Buzzard (May 12 2018 at 09:37):
Chris, from a mathematical point of view I am not so sure that people care too much about semirings. However I know lean is different. All I'm saying is that if it's easier to work with rings than semirings then from the point of view of mathematical applications you'll be losing essentially nothing.
Chris Hughes (May 12 2018 at 10:38):
I have the same problem with rings.
Chris Hughes (May 12 2018 at 10:59):
I used a typeclass
nonzero_ring
in my metamath formalization of this one. Perhapsis_nonzero
can be a typeclass depending onring
instead ofhas_zero
andhas_one
?
Do you mean extending ring
or with ring
as an argument?
Mario Carneiro (May 12 2018 at 12:17):
nonzero_ring
would extends ring
, is_nonzero : Prop
would have [ring A]
Last updated: Dec 20 2023 at 11:08 UTC