proof-simplify
БесплатноБез исполняемых скриптовНе проверенUse verified TLA+ specs and Lean proofs to simplify real code safely — delete defensive checks the invariants make dead, remove locks/transactions/retries…
от opum-ai★ 30 звёзд на GitHubОб этом скилле
proof-simplify
A proof tells you what is always true of the system. Code written without that knowledge defends against states that cannot happen: guards that never fail, locks that protect nothing, retries that never fire, flags that duplicate other state. Each piece costs reading time, test time, and latency, and each is a place for new bugs.
This skill turns proven facts into deletions. It proves every deletion safe before making it, then re-verifies afterwards.
The standard of evidence: a simplification is justified only by a property the model proved, under assumptions the code actually enforces. Anything less is a guess dressed up in proof vocabulary.
Preconditions
You need all four of these; without them there is nothing to justify a deletion. If any is
missing, run formal-verify (W1) first:
- a model that passes (TLA+ at stated bounds, or Lean with
check_trust.shclean); - frozen properties (
Properties.tla/Properties.lean); - the model's sanity checks passed (must-fail invariants fail, bug toggles fail);
CORRESPONDENCE.md, including its Assumptions list.
Workflow
Harvest candidates. Read the model and the code side by side. Use
references/catalog.mdfor the eight kinds of candidate and how to spot each:- a guard implied by the invariant,
- redundant synchronization,
- a dead branch or unreachable state,
- a dead retry or timeout path,
- a redundant variable or flag,
- mergeable (bisimilar) states,
- an implementation replaceable by a simpler proven-equal one,
- an invariant that can be encoded in types.
List each candidate with its code location, the model element it maps to, and the fact that would justify it.
Prove each candidate in the model before touching code. Techniques, from cheapest to strongest (
references/equivalence.md):- Re-check. Apply the simplification to the model, then re-run every frozen property, the sanity checks, and the bug toggles, at the same or larger bounds.
- Guard implication. In Lean, prove the guard follows from the invariant in every
reachable state. In TLA+, check
Enabled_A_without_G => Gas an invariant. - Refinement. Show the simplified spec implements the current one: TLA+
INSTANCE … WITHchecked as a PROPERTY, or a Lean simulation theorem. All safety properties then transfer automatically. Liveness must be re-checked. - Reachable-state equivalence (Lean
reach_iff). The two versions reach exactly the same states. This is the strongest form. - Function equality (Lean
theorem simple_eq : ∀ x, simple x = current x). Use it for replacing an algorithm.
Audit assumptions. For each candidate, list which Assumptions from CORRESPONDENCE.md the proof relies on, then decide:
- Remove when every assumption is enforced by code or infrastructure you control (a type, a DB constraint, a single-writer design).
- Downgrade to an assertion (a debug assert, a metric, or a log-and-continue) when the proof holds but an assumption is only conventional. The next person who breaks the assumption then gets a signal instead of silent corruption.
- Keep when the code sits on a trust boundary (network input, user input, disk, another team's service, a rolling deploy with mixed versions), or when the assumption is outside your control. Internal invariants never justify deleting validation of external input.
Apply one simplification at a time. For each accepted candidate:
- make the code change,
- update the model to match it (the simplified model is now the model),
- update CORRESPONDENCE.md,
- run the project's tests and the reproduction tests from earlier findings,
- re-run the model.
Use one commit per simplification, whose message names the property that justifies it.
Report. Add
simplifications[]toformal/findings.json, then publish the Artifact report (formal-verify/references/report-artifact.md, section "Simplifications"). For each change it shows:- the diff,
- the justifying property or theorem, and its evidence,
- the assumptions relied on,
- the decision (removed / downgraded / kept), and
- the lines-of-code delta.
Also include the candidates you rejected, with the reason. They are useful knowledge ("the lock looks redundant but protects the cron path, which is not modeled").
Worked examples (both verified)
- TLA+: a lock that does nothing.
assets/tla/CancelOrder.tlamodels a cancel handler that takes a row lock and uses a conditional UPDATE, while the payment webhook never takes the lock.MC_current.cfgandMC_cas_only.cfgpass.MC_lock_only.cfgfails (exit 13): the lock alone never preventedpaid → cancelled.CancelOrderSimple.tlaremoves the lock, andMC_refines.cfgproves it refines the current spec under a mapping that reconstructs the lock.
Установить proof-simplify в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл proof-simplify?
Use verified TLA+ specs and Lean proofs to simplify real code safely — delete defensive checks the invariants make dead, remove locks/transactions/retries that do no work, collapse redundant states and flags, replace complex implementations with simpler ones proven equivalent, and encode invariants in types — re-verifying every change (re-check, refinement, reachable-state equivalence) before touching code. Use this skill whenever the user asks to simplify, clean up, de-risk a refactor, or reduce complexity in code that has (or could get) a formal model; asks "do we still need this lock / check / retry / state"; wants to turn proofs into code improvements; or finishes a formal-verify bug hunt and wants the payoff. If no verified model exists yet, it starts one via formal-verify first.
Как установить скилл proof-simplify?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл proof-simplify запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic