Skip to content

fix: report runAt tactic probes that use the declaration being proved - #413

Draft
ejgallego wants to merge 2 commits into
mainfrom
codex/runat-self-reference-20261028
Draft

ejgallego wants to merge 2 commits into
mainfrom
codex/runat-self-reference-20261028

Conversation

@ejgallego

Copy link
Copy Markdown
Collaborator

This PR stops runAt tactic probes from reporting success when their result uses the declaration being proved. While a declaration elaborates, Lean exposes it to its own body as an auxiliary local and checks every such use for termination only when it finalizes the declaration. A probe has no finalization step, so a probe such as exact countDown n or exact tacticSelf previously returned success: true whether or not the real edit would pass Lean's termination check, including for unsound circular proofs.

  • Tactic probes whose assigned terms reference the enclosing declaration's auxiliary local, or another member of its mutual block, now return success: false with the original proof state, no successor handle, and a message naming the declaration and pointing to edit-and-sync.
  • The check covers only the terms assigned to the probe's starting goals; the rest of the body was already checked by the document's own elaboration. Each handle step is checked against its own starting goals.
  • Valid structural or well-founded recursion, and partial/unsafe definitions, now also report the probe as unchecked rather than succeeding. That is a deliberate trade: no probe answer is wrong, at the cost of requiring edit-and-sync for recursive proofs. Running Lean's termination check on a speculatively completed declaration is possible later work.
  • Command probes are unchanged; they elaborate complete declarations through Lean's normal termination checks.
  • Docs (STATUS, MCP, skill workflow reference) describe the new boundary; tests cover tactic, term, hole, structural recursion, and mutual-block self-reference plus later declarations staying unknown.

A tactic probe could reference the enclosing declaration (or a member of its
mutual block) through Lean's auxiliary local and report success, although Lean
checks such references for termination only when it finalizes the declaration.
Report these probes as unsuccessful with the original proof state and a message
naming the declaration, and document the sync-to-check workflow.
@ejgallego ejgallego added this to the 0.2.1 milestone Nov 2, 2026
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