TLA+ Proof
Outputs
- Updated proof-bearing TLA+ module(s):
*.tla
- TLAPS run artifacts:
.tla-proof/runs/<run-id>/...
Non-Negotiables (Honesty Rules)
- Never claim full system correctness from a partial proof.
- Always report what was proved, what failed, and what was omitted.
- Always surface trust boundaries (
ASSUME, AXIOM, omitted proofs, imported facts).
- Never conflate TLC outcomes with TLAPS outcomes; treat them as different evidence.
- Always keep theorem statements stable while debugging unless the user approves spec changes.
Workflow (Target Class -> Proof Plan -> TLAPS -> Iterate)
1) Pin Down Target and Trust Boundary
Record:
- theorem statement(s) in scope
- proof class: direct fact, inductive invariant, refinement, formula equivalence, safety, liveness
- assumptions/environment model
- required imported definitions/lemmas
- candidate strengthening invariants or helper lemmas if the target does not look inductive yet
- proof granularity target (quick progress vs fully structured proof)
If theorem intent is ambiguous, state candidate interpretations and choose one explicitly.
If the user is refactoring a spec and wants semantic preservation, consider a direct equivalence theorem (F <=> G) instead of only bounded TLC evidence.
2) Draft Minimal Hierarchical Proof Structure
Start with the smallest stable structure:
THEOREM ...
PROOF
SUFFICES, HAVE, CASE, PICK, TAKE, WITNESS, QED as needed
Prefer explicit sub-lemmas over long single-step BY clauses.
Use BY DEF ... only for required definitions.
Formula-equivalence proofs for refactors are a supported pattern, for example THEOREM F <=> G BY DEF F, G.
Match the structure to the proof class:
- inductive invariant/safety: isolate base case vs step case and split
Next by action
- refinement: state the abstraction relation/refinement mapping and prove init/step obligations separately
- formula equivalence: start with
THEOREM F <=> G; if a one-line proof fails, split into F => G and G => F
- liveness/starvation freedom: pin down fairness and ranking assumptions before proof search, then expect auxiliary lemmas
3) Run TLAPS Deterministically
Prereqs:
Run from the skill directory:
scripts/tlaps_check.sh --spec path/to/Foo.tla
Artifacts:
.tla-proof/runs/<run-id>/summary.json
.tla-proof/runs/<run-id>/tlaps.stdout
.tla-proof/runs/<run-id>/tlaps.stderr
4) Triage Failing Obligations
Classify failures before editing:
- missing strengthening invariant or helper lemma
- missing context facts
- insufficient decomposition
- missing definition expansion
- backend/tactic mismatch
- malformed theorem/proof structure
- wrong target framing (for example, an equivalence theorem is the real goal)
Patch minimally, then re-run.
If the same inductive step keeps failing, stop cycling tactics and propose the smallest strengthening fact that would make the step go through.
5) Report Progress Precisely
Report:
- theorem(s) checked
- proved/failed/omitted obligations
- assumptions and trust boundaries
- remaining proof gaps
If counts are inconclusive, say so explicitly.
Common refactor-proof target: prove a rewritten formula or action is equivalent to the original, rather than only model-checking F <=> G with TLC.
Resources
scripts/
scripts/tlaps_check.sh: run tlapm, capture logs, emit summary.json
references/
references/proof_skeleton.md: minimal hierarchical proof templates
references/local_moves.md: TLAPS-specific logical moves and proof-shape defaults
references/proof_debugging.md: failure taxonomy and remediation playbook
references/tactics_quickref.md: tactic/backend guidance and escalation order
references/case_bank.md: discussion-derived proof classes and non-trivial example ideas
1---2name: tla-proof3description: Write and iteratively refine TLA+ theorem proofs in `.tla` modules with TLAPS (`tlapm`); run proof checks and summarize proved vs failed/omitted obligations with explicit assumptions and trust boundaries. Use when asked to create or fix `THEOREM` or `PROOF` blocks, diagnose TLAPS failures, strengthen inductive invariants, prove equivalence, or tune proof structure.4---56# TLA+ Proof78## Outputs910- Updated proof-bearing TLA+ module(s): `*.tla`11- TLAPS run artifacts: `.tla-proof/runs/<run-id>/...`1213## Non-Negotiables (Honesty Rules)1415- Never claim full system correctness from a partial proof.16- Always report what was proved, what failed, and what was omitted.17- Always surface trust boundaries (`ASSUME`, `AXIOM`, omitted proofs, imported facts).18- Never conflate TLC outcomes with TLAPS outcomes; treat them as different evidence.19- Always keep theorem statements stable while debugging unless the user approves spec changes.2021## Workflow (Target Class -> Proof Plan -> TLAPS -> Iterate)2223### 1) Pin Down Target and Trust Boundary2425Record:26- theorem statement(s) in scope27- proof class: direct fact, inductive invariant, refinement, formula equivalence, safety, liveness28- assumptions/environment model29- required imported definitions/lemmas30- candidate strengthening invariants or helper lemmas if the target does not look inductive yet31- proof granularity target (quick progress vs fully structured proof)3233If theorem intent is ambiguous, state candidate interpretations and choose one explicitly.34If the user is refactoring a spec and wants semantic preservation, consider a direct equivalence theorem (`F <=> G`) instead of only bounded TLC evidence.3536### 2) Draft Minimal Hierarchical Proof Structure3738Start with the smallest stable structure:39- `THEOREM ...`40- `PROOF`41- `SUFFICES`, `HAVE`, `CASE`, `PICK`, `TAKE`, `WITNESS`, `QED` as needed4243Prefer explicit sub-lemmas over long single-step `BY` clauses.44Use `BY DEF ...` only for required definitions.45Formula-equivalence proofs for refactors are a supported pattern, for example `THEOREM F <=> G BY DEF F, G`.46Match the structure to the proof class:47- inductive invariant/safety: isolate base case vs step case and split `Next` by action48- refinement: state the abstraction relation/refinement mapping and prove init/step obligations separately49- formula equivalence: start with `THEOREM F <=> G`; if a one-line proof fails, split into `F => G` and `G => F`50- liveness/starvation freedom: pin down fairness and ranking assumptions before proof search, then expect auxiliary lemmas5152### 3) Run TLAPS Deterministically5354Prereqs:55- `bash`56- `jq`57- `tlapm`5859Run from the skill directory:6061```bash62scripts/tlaps_check.sh --spec path/to/Foo.tla63```6465Artifacts:66- `.tla-proof/runs/<run-id>/summary.json`67- `.tla-proof/runs/<run-id>/tlaps.stdout`68- `.tla-proof/runs/<run-id>/tlaps.stderr`6970### 4) Triage Failing Obligations7172Classify failures before editing:73- missing strengthening invariant or helper lemma74- missing context facts75- insufficient decomposition76- missing definition expansion77- backend/tactic mismatch78- malformed theorem/proof structure79- wrong target framing (for example, an equivalence theorem is the real goal)8081Patch minimally, then re-run.82If the same inductive step keeps failing, stop cycling tactics and propose the smallest strengthening fact that would make the step go through.8384### 5) Report Progress Precisely8586Report:87- theorem(s) checked88- proved/failed/omitted obligations89- assumptions and trust boundaries90- remaining proof gaps9192If counts are inconclusive, say so explicitly.93Common refactor-proof target: prove a rewritten formula or action is equivalent to the original, rather than only model-checking `F <=> G` with TLC.9495## Resources9697### scripts/9899- `scripts/tlaps_check.sh`: run `tlapm`, capture logs, emit `summary.json`100101### references/102103- `references/proof_skeleton.md`: minimal hierarchical proof templates104- `references/local_moves.md`: TLAPS-specific logical moves and proof-shape defaults105- `references/proof_debugging.md`: failure taxonomy and remediation playbook106- `references/tactics_quickref.md`: tactic/backend guidance and escalation order107- `references/case_bank.md`: discussion-derived proof classes and non-trivial example ideas