Zulip Chat Archive

Stream: lean4

Topic: analogue of `trace_state`


Scott Morrison (Oct 12 2022 at 05:59):

Is there a Lean4 analogue of trace_state, which just prints the current goal state? (In TacticM.)

Mario Carneiro (Oct 12 2022 at 08:30):

trace_state is a lean 4 tactic, so the DIY answer is to find out what it does

Mario Carneiro (Oct 12 2022 at 08:32):

you find the following:

@[builtinTactic traceState] def evalTraceState : Tactic := fun _ => do
  let gs  getUnsolvedGoals
  withPPForTacticGoal <| addRawTrace (goalsToMessageData gs)

but the most important part is that you use goalsToMessageData and then print it. I would just do logInfo (goalsToMessageData (<- getGoals))

Mario Carneiro (Oct 12 2022 at 08:33):

if you just pass an MVarId to throwError or logInfo m!"..." the results are surprisingly readable


Last updated: Dec 20 2023 at 11:08 UTC