prove

prove is a command for coding agents from punt-labs/z-spec. It costs 10 tokens per session (6,161 once invoked), scanned A, original, MIT.

A command that turns a Z specification—a formal description of a system—into Lean 4 statements that must be proven. It focuses on starting with a valid state and keeping that state valid after each operation.

In plain words
What is it for?
Use it to generate Lean 4 proof obligations from a Z specification, checking initialization and operation-preservation properties, with optional coverage for all, initialization, or preservation obligations.
Why use it?
It makes the key correctness checks explicit instead of leaving them as informal claims. Lean can then check whether those statements have valid proofs.

Command

Part of the z-spec-dev plugin — 42 commands, 1 hook shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/punt-labs/z-spec/prove
Clone the repo
git clone --depth 1 https://github.com/punt-labs/z-spec

Or install z-spec-dev, the plugin that ships this one along with the rest of its 42 commands, 1 hook.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for prove

README.md
[![agentmods](https://agentmods.dev/badge/commands/punt-labs/z-spec/prove.svg)](https://agentmods.dev/commands/punt-labs/z-spec/prove)
Your own site
<a href="https://agentmods.dev/commands/punt-labs/z-spec/prove"><img src="https://agentmods.dev/badge/commands/punt-labs/z-spec/prove.svg" alt="Measured on agentmods" height="20"></a>
Per session 10 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 6,161 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00010 $0.06161
Opus 5 $0.00005 $0.03080
Sonnet 5 $0.00002 $0.01232
Haiku 4.5 $0.00001 $0.00616

Measured 5d ago against content hash 02a21043710e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

prove scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugin/commands/prove.md · 875 lines

How it starts

The opening of the file, as written. The whole thing — 875 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/z-spec:prove - Generate Lean 4 Proof Obligations

Translate a Z specification into Lean 4 proof obligations that formalize the key correctness properties: initialization establishes the state invariant, and every operation preserves it.

Input

Arguments: $ARGUMENTS

Parse arguments:

  • First positional argument: Z specification file (default: search docs/*.tex)
  • --obligations=all|init|preserve - which proof obligations to generate (default: all)
  • --no-mathlib - generate standalone Lean without Mathlib dependency (simpler but fewer tactics)

Process

0. Prerequisites

Verify Lean 4 and Lake are installed:

which lean >/dev/null 2>&1 || echo "LEAN_NOT_FOUND"
which lake >/dev/null 2>&1 || echo "LAKE_NOT_FOUND"

If lean or lake not found: Stop and tell the user:

Lean 4 is not installed. Run /z-spec:setup lean to install the Lean 4 toolchain via elan.

Verify version compatibility:

lean --version 2>&1

The output should show Lean 4.x. If it shows Lean 3.x or an error, advise the user to update via elan update.

The Z specification should already exist and have been type-checked (via /z-spec:check). If the user has not done this, suggest it but do not block — the translation can still proceed from a syntactically valid spec.

1. Locate the Specification

If a file path is provided, use it directly.

If no file specified:

  • Look in docs/ for .tex files containing Z specifications
  • If multiple found, ask user to specify

Read the specification file.

2. Parse the Specification

Scan the specification and extract the following constructs. Each subsection describes what to look for and what to record.

2a. Given Sets

Look for given set declarations in \begin{zed} blocks:

\begin{zed}
[USERID, SESSIONID]
\end{zed}

Record each name. These become opaque types in Lean.

2b. Free Types

Look for free type definitions in \begin{zed} blocks:

\begin{zed}
Status ::= pending | active | suspended | closed
\end{zed}

Read the full file on GitHub · 875 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 875 lines · 10 tokens per session scan A 02a21043710e

Subscribe to this mod's changes

prove is a command published in the GitHub repository punt-labs/z-spec (5 stars, last pushed yesterday), licensed MIT. It adds 10 tokens to every session and 6,161 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.