Zulip Chat Archive

Stream: mathlib4

Topic: Diamond issue in Algebra.Star.Basic


Frédéric Dupuis (Jan 04 2023 at 22:51):

In mathlib4#1331, a diamond issue has showed up that has me stumped. Here's a MWE of the problem:

import Mathlib.Algebra.Ring.Aut

class StarRing' (R : Type _) [NonUnitalSemiring R]
def starGizmo [CommSemiring R] [StarRing' R] : R  R := id
lemma starGizmo_foo [CommRing R] [StarRing' R] (x : R) : starGizmo x = x  := rfl    -- failed to synthesize instance StarRing' R

If we unpack this a bit, we find out that Lean is failing to unify @StarRing' R NonUnitalCommSemiring.toNonUnitalSemiring with @StarRing' R NonUnitalRing.toNonUnitalSemiring. It's easy to check that these two are in fact defeq. I don't know what's going on; perhaps @Gabriel Ebner or @Mario Carneiro could have a look...?

Frédéric Dupuis (Jan 04 2023 at 22:52):

@Jireh Loreaux

Eric Wieser (Jan 04 2023 at 23:23):

Are you sure they're defeq?

Eric Wieser (Jan 04 2023 at 23:23):

This looks like something that is only true because of structure eta, and a problem that we didn't have in lean 3 due to the use of old flat structures

Frédéric Dupuis (Jan 04 2023 at 23:26):

This works, at any rate:

example [CommRing R] : @StarRing' R NonUnitalCommSemiring.toNonUnitalSemiring =
    @StarRing' R NonUnitalRing.toNonUnitalSemiring := rfl

Heather Macbeth (Jan 04 2023 at 23:27):

If they're not defeq, seems like it would break the whole linear/semilinear map setup.

Chris Hughes (Jan 05 2023 at 00:02):

Eric Wieser said:

This looks like something that is only true because of structure eta, and a problem that we didn't have in lean 3 due to the use of old flat structures

Structural eta is a defeq in Lean4

Eric Wieser (Jan 05 2023 at 00:42):

Indeed; my unfounded hunch was that somehow it's a "lesser" defeq that can't be applied in all cases

Kevin Buzzard (Jan 26 2023 at 22:22):

Minimised here.


Last updated: Dec 20 2023 at 11:08 UTC