Skip to content

[llm] add -trace LINE[:COL] for single-sentence before/after goals#1018

Closed
strub wants to merge 1 commit into
mainfrom
llm-format
Closed

[llm] add -trace LINE[:COL] for single-sentence before/after goals#1018
strub wants to merge 1 commit into
mainfrom
llm-format

Conversation

@strub
Copy link
Copy Markdown
Member

@strub strub commented May 26, 2026

Runs every sentence before the target, prints the goal state, runs the
target sentence, prints the state again. Output uses stable
=== BEFORE / TACTIC / AFTER === delimiters so callers can split. Exit
codes: 0 ok, 1 if the target sentence failed, 2 if no sentence at or
after the target. Mutually exclusive with -upto.

@strub strub self-assigned this May 26, 2026
Runs every sentence before the target, prints the goal state, runs the
target sentence, prints the state again. Output uses stable
=== BEFORE / TACTIC / AFTER === delimiters so callers can split. Exit
codes: 0 ok, 1 if the target sentence failed, 2 if no sentence at or
after the target. Mutually exclusive with -upto.
strub added a commit that referenced this pull request May 27, 2026
Add a -trace flag to the LOAD REPL command. When set, LOAD compiles the
prefix exactly as today (using the existing LINE[:COL] argument, or up
to EOF if omitted), but defers the last sentence and runs it under
goal capture, then returns a response body with four delimited blocks:

  === BEFORE: line L (col C) ===
  <focused goal before the sentence>
  === TACTIC (lines L:C - L':C') ===
  <exact source text of the sentence>
  === AFTER: line L (col C) ===
  <new focused goal + any new sibling goals>
  === SUMMARY ===
  open goals: N1 -> N2

Adapted from PR #1018 (-trace LINE[:COL] for batch mode): same
delimiters and the same new-or-modified-head filtering for AFTER. The
position is taken from LOAD's existing LINE[:COL] argument; the tag is
the regular [loaded:file:LINE].

If the deferred sentence is outside a proof context, or there is no
sentence to trace, the reply uses the ERROR envelope with a clear
message. If the sentence fails, the BEFORE/TACTIC blocks are still
delivered, AFTER carries a <sentence failed> marker, and the formatted
exception is appended.

Expose EcCommands.in_proof so the REPL can check the pre-execution
proof status without inspecting scope internals.
@strub
Copy link
Copy Markdown
Member Author

strub commented May 27, 2026

Superseded by #1019, which integrates the -trace semantics into the LLM REPL as a LOAD ... -trace flag.

@strub strub closed this May 27, 2026
strub added a commit that referenced this pull request May 27, 2026
Add a -trace flag to the LOAD REPL command. When set, LOAD compiles the
prefix exactly as today (using the existing LINE[:COL] argument, or up
to EOF if omitted), but defers the last sentence and runs it under
goal capture, then returns a response body with four delimited blocks:

  === BEFORE: line L (col C) ===
  <focused goal before the sentence>
  === TACTIC (lines L:C - L':C') ===
  <exact source text of the sentence>
  === AFTER: line L (col C) ===
  <new focused goal + any new sibling goals>
  === SUMMARY ===
  open goals: N1 -> N2

Adapted from PR #1018 (-trace LINE[:COL] for batch mode): same
delimiters and the same new-or-modified-head filtering for AFTER. The
position is taken from LOAD's existing LINE[:COL] argument; the tag is
the regular [loaded:file:LINE].

If the deferred sentence is outside a proof context, or there is no
sentence to trace, the reply uses the ERROR envelope with a clear
message. If the sentence fails, the BEFORE/TACTIC blocks are still
delivered, AFTER carries a <sentence failed> marker, and the formatted
exception is appended.

Expose EcCommands.in_proof so the REPL can check the pre-execution
proof status without inspecting scope internals.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant