Zulip Chat Archive

Stream: general

Topic: trouble with algebras


Scott Morrison (Jul 13 2020 at 04:02):

Any advice for resolving:

import data.polynomial

set_option pp.all true

example {R : Type} [comm_ring R] (r : R) : polynomial  →+* R :=
(polynomial.aeval  R r).to_ring_hom

/- fails with:
```
synthesized type class instance is not definitionally equal to expression inferred by typing rules, synthesized
  @polynomial.algebra'.{0 0} int int.comm_semiring int (@comm_semiring.to_semiring.{0} int int.comm_semiring)
    (@algebra_int.{0} int int.ring)
inferred
  @polynomial.algebra'.{0 0} int int.comm_semiring int (@comm_semiring.to_semiring.{0} int int.comm_semiring)
    (@algebra.id.{0} int int.comm_semiring)
```
-/

Scott Morrison (Jul 13 2020 at 04:52):

I can get

example {R : Type} [comm_ring R] (r : R) : polynomial  →+* R :=
(by convert (polynomial.aeval  R r) : polynomial  [] R).to_ring_hom

by first providing the instance subsingleton (algebra ℤ R), but it's not an ideal solution.

Scott Morrison (Jul 13 2020 at 04:54):

Because this doesn't help if someone quite reasonably writes (polynomial.aeval ℤ R r).to_ring_hom...

Scott Morrison (Jul 13 2020 at 05:04):

(And the convert results in a completely unusable term...)

Johan Commelin (Jul 13 2020 at 05:33):

Hmm, frustrating. I wonder if it is in some way related to https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/splitting.20field.20timeout


Last updated: Dec 20 2023 at 11:08 UTC