Zulip Chat Archive
Stream: mathlib4
Topic: Inconsistent simp lemma loop forever
Jz Pan (Jun 27 2025 at 12:53):
Seems that there are some simp lemma in mathlib which will loop forever:
import Mathlib.NumberTheory.Padics.RingHoms
example (p : ℕ) [Fact p.Prime] (x : (ZMod p)ˣ) (h : p ∣ x.1.val * x.2.val) : False := by
/-
tactic 'simp' failed, nested error:
maximum recursion depth has been reached
use `set_option maxRecDepth <num>` to increase limit
use `set_option diagnostics true` to get diagnostic information
-/
simp at h
sorry
Any ideas?
Kenny Lau (Jun 27 2025 at 12:55):
you know, the error tells you exactly how to debug it
Kenny Lau (Jun 27 2025 at 12:55):
Kenny Lau (Jun 27 2025 at 12:55):
and then if you follow it, it tells you that these two lemmas are in conflict, which is weird that the simp linter didn't catch it
Kenny Lau (Jun 27 2025 at 12:56):
Kenny Lau (Jun 27 2025 at 12:56):
it's also weird that this lemma isn't just proved using the first lemma
Kenny Lau (Jun 27 2025 at 12:58):
ah i think it's because Inv is always defined for ZMod n, even when n is not prime (so it won't always match the condition of the first lemma which requires a DivisionMonoid)
Kenny Lau (Jun 27 2025 at 12:58):
now that's a tricky issue
Jz Pan (Jun 28 2025 at 13:16):
Are there any proposed fix of it?
Last updated: Dec 20 2025 at 21:32 UTC