Zulip Chat Archive
Stream: lean4
Topic: Strange behavior of congr tactic
Yuval Filmus (Dec 26 2024 at 13:12):
Consider the following code:
example {n m : Nat} (h : m = 1) :
n / 1 = n / m := by
congr
simp [h]
This doesn't compile (on 4.15.0-rc1) since congr creates a duplicate goal.
If I change it to congr 1 then it compiles correctly.
What is going on here?
Kyle Miller (Dec 26 2024 at 20:59):
It's going deep into the OfNat expression. You can get a hint of what's going on by doing congr 2
(congr 3
is what congr
itself does).
The Mathlib congr!
tactic avoids this issue.
Kyle Miller (Dec 26 2024 at 21:09):
(In any case, there's no problem with congr
creating duplicate goals. That just means you have to prove the goal multiple times.)
Last updated: May 02 2025 at 03:31 UTC