Zulip Chat Archive
Stream: mathlib4
Topic: Adding an extra hypothesis breaks linarith
Eric Wieser (Aug 12 2025 at 12:47):
It looks like some surprising unification is going on here:
import Mathlib.Tactic.Linarith
theorem foo {i m : ℕ} : i ∣ 2 ^ m → True := fun _ => trivial
theorem bad1 (k a i : ℕ)
(useless : i ≤ i)
(h : (↑a : ℤ) * 2 ^ k = 2 ^ i) : True := by
have := foo ⟨2^k, by linarith⟩
trivial
theorem bad2 (k a i : ℕ)
(h : (↑a : ℤ) * 2 ^ k = 2 ^ i)
(useless : i ≤ i) : True := by
have := foo ⟨2^k, by linarith⟩
trivial
theorem ok3 (k a i : ℕ)
(h : (↑a : ℤ) * 2 ^ k = 2 ^ i) : True := by
have := foo ⟨2^k, by linarith⟩
trivial
I'm able to fix bad1, but my fix doesn't work for bad2
Eric Wieser (Aug 12 2025 at 15:33):
(#28290 is the fix for bad1)
Aaron Liu (Aug 12 2025 at 15:34):
you have metavariables :/
Eric Wieser (Aug 12 2025 at 15:35):
Yes, that much I know :)
Last updated: Dec 20 2025 at 21:32 UTC