Zulip Chat Archive

Stream: new members

Topic: Why doesn't `?m_2 ≠ 0` unify with `2 ≠ 0`?


Martin C. Martin (Feb 16 2023 at 18:55):

Why does the following give me an error?

import data.nat.gcd

example {k n : }  (h : 2 * (2 * k^2) = 2 * n^2) : 2 * k^2 = n^2 :=
begin
  exact (mul_right_inj' two_ne_zero).mp h
end

Shouldn't it be able to deduce that the type is nat? Or is there something else going wrong?

Ruben Van de Velde (Feb 16 2023 at 18:57):

Does the proof go through if you help it along, like with @two_ne_zero \N _ _ _ (for some number of underscores)?

Martin C. Martin (Feb 16 2023 at 19:00):

Yes it does, thanks for the tip! I thought the problem was in mul_right_inj', but I see it's in two_ne_zero.

Ruben Van de Velde (Feb 16 2023 at 19:39):

I think the problem is that both of those lemmas are generic, so lean finds it hard to figure out their types simultaneously


Last updated: Dec 20 2023 at 11:08 UTC