Zulip Chat Archive

Stream: mathlib4

Topic: hint only suggests the first line of a suggestion


Julian Berman (Dec 05 2024 at 15:00):

The hint tactic seems to drop all but the first line of any suggestions. A minimal reproducer is below, but really this will happen any time a tactic (e.g. simp(_all)) emits multiple lines in its suggestion:

import Lean.Meta.Tactic.TryThis
import Mathlib.Tactic.Hint

namespace Lean.Meta.Tactic.TryThis
open Lean Elab Tactic

elab "suggestion" : tactic => do
  addSuggestion ( getRef) { suggestion := "\n  trivial" }

register_hint suggestion

example : 37 = 37 := by suggestion -- works fine, inserts trivial on a new line
example : 37 = 37 := by hint -- empty replacement

end Lean.Meta.Tactic.TryThis

Kim Morrison (Dec 05 2024 at 22:15):

PR welcome. :-) Hopefully the problem is at the Mathlib end.

Eric Wieser (Dec 05 2024 at 22:42):

I have a fix for this

Eric Wieser (Dec 05 2024 at 22:45):

#19756, I have no idea why that code was even there

Eric Wieser (Dec 05 2024 at 23:41):

The right solution here would probably be to inspect the infotrees created by running the tactic, but I have no idea how to do that


Last updated: May 02 2025 at 03:31 UTC