Skip to content

Run SANY before invoking TLAPS proof commands#527

Merged
lemmy merged 1 commit into
tlaplus:masterfrom
lemmy:sany-before-tlaps
Jun 24, 2026
Merged

Run SANY before invoking TLAPS proof commands#527
lemmy merged 1 commit into
tlaplus:masterfrom
lemmy:sany-before-tlaps

Conversation

@lemmy

@lemmy lemmy commented Jun 17, 2026

Copy link
Copy Markdown
Member

Closes #526.

TLAPS and SANY do not accept exactly the same language: TLAPS accepts some specifications that SANY (the standard TLA+ front end) correctly rejects (e.g. modules containing raw TLA syntax). Because the extension's SANY and TLAPS commands can be invoked independently, a user could obtain a successful TLAPS result for a module that SANY rejects, i.e. that is not a valid TLA+ module. The TLA+ Toolbox historically prevented this by requiring a successful SANY parse before enabling/invoking the prover.

This PR restores that invariant for the tlaplus.tlaps.check-step command (the only entry point that invokes TLAPS). Before forwarding the proof check to the TLAPS LSP server, the extension now:

  1. Saves the module if it has unsaved changes.
  2. Parses it with SANY, reusing parseSpec (the implementation behind tlaplus.parse).
  3. Publishes SANY diagnostics to the shared tlaplus diagnostic collection (Problems view).
  4. Aborts if SANY reports any error-level diagnostics.
  5. Invokes TLAPS only once SANY has accepted the module.

@lemmy
lemmy force-pushed the sany-before-tlaps branch from 4a84bf8 to f1c4333 Compare June 18, 2026 13:28
@lemmy lemmy added the enhancement New feature or request label Jun 18, 2026
@lemmy
lemmy requested a review from kape1395 June 18, 2026 13:29
@lemmy
lemmy force-pushed the sany-before-tlaps branch from f1c4333 to fcd03c5 Compare June 18, 2026 13:33
@lemmy lemmy self-assigned this Jun 18, 2026
@lemmy
lemmy requested a review from Copilot June 18, 2026 13:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Restores the Toolbox-style invariant that TLAPS proof checking only runs after the current module has been successfully accepted by SANY, preventing “successful” proofs on syntactically/semantically invalid TLA+ modules.

Changes:

  • Adds a SANY parse-and-diagnostics gate before forwarding tlaplus.tlaps.check-step requests to the TLAPS LSP command.
  • Saves dirty buffers before running SANY/TLAPS to ensure both tools see identical content.
  • Threads the shared DiagnosticCollection into TlapsClient to publish SANY diagnostics to the Problems view.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/tlaps.ts Adds SANY pre-check logic for proof-step checking and publishes SANY diagnostics before invoking TLAPS.
src/main.ts Passes the shared diagnostic collection into TlapsClient.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/tlaps.ts Outdated
Comment thread src/tlaps.ts
Comment thread src/tlaps.ts
TLAPS accepts "raw TLA" (rTLA) that SANY rejects: formulas that are not
insensitive to stuttering, permitting unrestrictive assertions about
behaviors that should be unassertable in TLA+. Without a SANY check, a
user can obtain a passing TLAPS result for a module that is not valid
TLA+. Parse the saved module with SANY first (reusing tlaplus.parse) and
abort the proof check, surfacing diagnostics, when SANY reports errors.

Closes Github issue tlaplus#526
tlaplus#526

[Feature][TLAPS]

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Markus Alexander Kuppe <github.com@lemmster.de>
@lemmy
lemmy force-pushed the sany-before-tlaps branch from fcd03c5 to 868bed4 Compare June 18, 2026 14:07
@lemmy
lemmy requested a review from muenchnerkindl June 18, 2026 14:14

@FedericoPonzi FedericoPonzi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lemmy
lemmy merged commit 99c29cb into tlaplus:master Jun 24, 2026
4 checks passed
@lemmy
lemmy deleted the sany-before-tlaps branch July 6, 2026 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Development

Successfully merging this pull request may close these issues.

Run SANY before invoking TLAPS proof commands

3 participants