Zulip Chat Archive

Stream: mathlib4

Topic: Problem with linarith


Dan Velleman (Mar 14 2023 at 16:07):

This example works:

example (k n : Nat) (h : k  n) : k  n + 1 := by linarith

This one doesn't:

example {R : Type} [CommMonoid R] (k n : Nat) (h1 : k  n) (x y : R) (h2 : x = y) : k  n + 1 := by linarith

The error message is ""failed to synthesize AddGroup R". I guess linarith is trying to figure out how to make use of h2, and it can't figure it out. Shouldn't it be smart enough to throw away hypotheses that it doesn't know how to make use of?

Reid Barton (Mar 14 2023 at 16:09):

Maybe not very helpful but I'm pretty sure this has been discussed here before--try searching for linarith?

Eric Wieser (Mar 14 2023 at 16:26):

It's this thread

Dan Velleman (Mar 14 2023 at 18:13):

Yes, that looks like the same bug. And apparently a fix is already in the works. Thanks.


Last updated: Dec 20 2023 at 11:08 UTC