Zulip Chat Archive
Stream: lean4
Topic: Grind failure for CommSemiring, not Semiring
Bolton Bailey (Jan 02 2026 at 20:13):
Here is an MWE, thanks Riccardo Brasca for noting this in #25925.
I figured that grind would have all the same tools available for CommSemiring as Semiring, so I don't know why this fails, does anyone have an explanation or guidance to what I could change to fix this?
import Mathlib
example {R : Type*} [Semiring R] (f r : R) (hg : f * r ≠ 0) :
f ≠ 0 := by
intro hf
grind -- success
example {R : Type*} [CommSemiring R] (f r : R) (hg : f * r ≠ 0) :
f ≠ 0 := by
intro hf
grind -- failed
Riccardo Brasca (Jan 02 2026 at 20:33):
Mathlib free
example {R : Type} [Lean.Grind.Semiring R] (f r : R) (hg : f * r ≠ 0) :
f ≠ 0 := by
grind -- success
example {R : Type} [Lean.Grind.CommSemiring R] (f r : R) (hg : f * r ≠ 0) :
f ≠ 0 := by
grind -- failed
Notification Bot (Jan 02 2026 at 20:35):
This topic was moved here from #mathlib4 > Grind failure for CommSemiring, not Semiring by Riccardo Brasca.
Riccardo Brasca (Jan 02 2026 at 20:35):
Since it's not mathlib related I am moving the discussion here.
Riccardo Brasca (Jan 02 2026 at 20:35):
cc @Kim Morrison
Kim Morrison (Jan 03 2026 at 10:23):
I've opened a fix: https://github.com/leanprover/lean4/pull/11881
The issue was that propagateMul (which handles 0 * a = 0 and a * 0 = 0) was only firing for "unsupported" semirings. CommSemiring was considered "supported" because it uses a ring envelope for normalization, but that approach doesn't propagate these equalities back to original terms.
Last updated: Feb 28 2026 at 14:05 UTC