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