Zulip Chat Archive
Stream: lean4
Topic: simp? suggestion creates broken code
Ruben Van de Velde (Oct 04 2024 at 13:33):
In vs code, given
def foo (a : Nat) : Nat := a + 1
@[simp]
theorem foo_______________________________________________________________________________ : foo 1 = 2 := rfl
example (h : foo 1 = 2) : True := by
simp? at h
trivial
gives
Try this: simp only [foo_______________________________________________________________________________] at h
but when clicking it, I get
simp only [foo_______________________________________________________________________________] at
h
and expected '*' or checkColGt
. Only
simp only [foo_______________________________________________________________________________]
at h
with at
on the next line works. Is this:
- A bug in lean for not supporting
at
at the end of a line - A bug in lean for suggesting code that doesn't work
- A bug outside of lean for reformatting the output badly
?
Damiano Testa (Oct 04 2024 at 13:55):
- a bug in your theorem name.
Eric Wieser (Oct 04 2024 at 14:04):
A simpler repro:
import Lean
run_cmd do
let stx ← `(tactic|
simp only [__________________________________________________________________________________________________] at h)
Lean.logInfo m!"Got: {stx}"
Eric Wieser (Oct 04 2024 at 14:04):
So the issue is that the formatter for the simp
syntax doesn't round-trip with the parser
Damiano Testa (Oct 04 2024 at 14:05):
Maybe at
and the targets should not be separable.
Eric Wieser (Oct 04 2024 at 14:06):
Weirdly, it's fine with *
Eric Wieser (Oct 04 2024 at 14:06):
import Lean
theorem _____________________________________________________________________________________________________________ : True = True := sorry
example (h : True) : True := by
rw [_____________________________________________________________________________________________________________] at
* -- ok
example (h : True) : True := by
rw [_____________________________________________________________________________________________________________] at
h -- not ok
example (h : True) : True := by
rw [_____________________________________________________________________________________________________________]
at h -- ok
Eric Wieser (Oct 04 2024 at 14:06):
So I think the parser/formatter for at
is just screwy
Ruben Van de Velde (Oct 04 2024 at 14:08):
Damiano Testa said:
- a bug in your theorem name.
(It also happens if you have multiple theorems that happen to combine to the right length)
Last updated: May 02 2025 at 03:31 UTC