Skip to content

LSP#871

Draft
strub wants to merge 4 commits into
mainfrom
vscode
Draft

LSP#871
strub wants to merge 4 commits into
mainfrom
vscode

Conversation

@strub
Copy link
Copy Markdown
Member

@strub strub commented Jan 21, 2026

No description provided.

@strub strub self-assigned this Jan 21, 2026
@strub strub added the feature label Jan 21, 2026
@strub strub force-pushed the vscode branch 9 times, most recently from 8062d89 to fea1243 Compare January 23, 2026 14:02
@strub strub force-pushed the vscode branch 3 times, most recently from 07d9e6d to 62cbd2d Compare March 26, 2026 13:15
strub added 3 commits May 28, 2026 12:05
When `pragma +strict_bullets` is set, the bullet tokens `-`, `+`, `*`
(and their repeated forms `--`, `++`, `**`, ...) become Coq-style
focusing operators: each phrase's bullet is checked against a per-proof
stack so that a subgoal must be discharged before its sibling is
addressed, and so that bullet characters identify nesting levels. The
default behavior is unchanged: without the pragma, bullets remain pure
decoration, preserving every existing proof script.

Repeated bullet characters are emitted by the lexer as single
PLUSn/MINUSn/STARn tokens (carrying their literal), which makes them
usable both as deeper bullet levels and as user-defined binary
operators (`op (--) ...`).

The final sibling of a split point can be continued at the parent
level without a bullet: when the previous sibling is closed and
exactly one sibling remains, the inner frame pops automatically (and
cascades through nested last-sibling frames). This keeps the standard
phl idiom of long `seq N : <post>' chains flat instead of forcing
ever-deeper indentation under a `+' for each continuation. Multi-way
splits keep their enumeration discipline for all but the last
subgoal.
Introduce an interactive REPL for LLM coding agents driving EasyCrypt
(`easycrypt llm`) using a line-oriented protocol over stdin/stdout, plus
two CLI flags for goal inspection:

  - `-upto <pos>`  compile up to a given position and print the goals
  - `-lastgoals`   print the last unproven goals at end-of-file

REPL protocol (see `doc/llm/CLAUDE.md` for the full guide):

  - LOAD "file.ec" [LINE[:COL]] -- compile, optionally up to a position
  - UNDO / REVERT <uuid|name>   -- navigate proof state
  - GOALS / GOALS ALL           -- inspect current or all subgoals
  - CHECKPOINT <name>           -- named bookmarks for branching
  - SEARCH <pattern>            -- lemma search
  - QUIET ON/OFF                -- suppress goal display for bulk input
  - Direct EasyCrypt input (tactics, declarations, search, print, ...)

Responses use a typed envelope (OK/ERROR with uuid) terminated by an
`<END>` sentinel for reliable parsing. LOAD reports the last processed
line in the response tag; error messages include the offending source
text; only the current subgoal is shown by default with a remaining
count.
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 strub force-pushed the vscode branch 2 times, most recently from 62cbd2d to 827db35 Compare May 29, 2026 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant