lean-proof

Orchestrates the Leanstral prover to generate and kernel-check Lean 4 proof terms.

1|Updated Dec 13, 2025
One-click install
npx skills add https://github.com/ZK-Theory/TDL --skill lean-proof-zk-theory
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: lean-proof
Source: https://github.com/ZK-Theory/TDL/tree/main/.agents/skills/lean-proof
Command: npx skills add https://github.com/ZK-Theory/TDL --skill lean-proof-zk-theory

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Automating Lean 4 proof generation requires coordinating an external prover, handling authentication failures, feeding kernel errors back for repair, and verifying results — all without hand-authoring proofs or mutating frozen theorem statements. This Skill encodes that orchestration discipline so proof spikes like S2 run headless on Windows without silent pipeline failures. ## Core Features & Use Cases - Headless prover invocation: Drives the Leanstral prover via vibe -p "<prompt>" --agent lean --trust in programmatic mode, avoiding interactive sessions that hang under automation. - Generate-compile-heal loop: Lifts frozen theorem statements verbatim, generates proof terms, kernel-checks with lake env lean or named lake build targets, and re-prompts the prover with exact kernel error messages (capped at ~5 iterations). - Mandatory preflight and guardrails: Smoke-tests authentication before any proof work, enforces frozen signatures, keeps defs out of promoted files, and records prover_identity and prover_data_exposure provenance honestly. - Use Case: Running a Lean proof spike such as S2.MaxAriBound — the orchestrator decomposes a hard lemma into helper lemmas, lets Leanstral fill them, verifies the axiom set with #print axioms, and reports an obstruction with a pre-authored fallback if the prover cannot close the goal. ## Quick Start Ask the agent to drive the Leanstral prover to generate and kernel-check a Lean 4 proof for a frozen theorem statement, starting with the mandatory smoke-test preflight.

Frequently Asked Questions about lean-proof

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run the Leanstral prover headless on Windows?▼

Invoke vibe in programmatic mode with `vibe -p "<prompt>" --agent lean --trust` after setting the MISTRAL_API_KEY environment variable. The bare positional prompt opens an interactive session that blocks on stdin and hangs under automation.

How do I verify a generated Lean 4 proof term?▼

Kernel-check standalone files with `lake env lean <file>`, or integrate into the project and build a named target like `lake build S2.MaxAriBound`. Confirm the axiom set with `#print axioms` — a clean set contains propext, Classical.choice, and Quot.sound with no sorryAx.

Why does vibe return Invalid API key during Lean proof generation?▼

The vibe CLI's stored config key can lapse independently of flags, producing the Invalid API key error. Run the mandatory smoke-test preflight first; on auth failure, stop and escalate to the owner rather than hunting keys or editing .env files.

Why does Lean fail with 'expected token' at 1:0 on Windows?▼

PowerShell 5.1's `Out-File -Encoding utf8` emits a UTF-8 BOM that Lean rejects at position 1:0. Write files BOM-free using `[IO.File]::WriteAllText(path, text, (New-Object Text.UTF8Encoding $false))`.

What should I do when the prover cannot close a Lean lemma?▼

Decompose the hard lemma into helper lemmas and re-prompt with exact kernel error messages, capped at about five iterations. If it still resists, deliver the pre-authored fallback with an obstruction report — never hand-write the proof term.

Can I edit a frozen Lean theorem statement to make a proof go through?▼

No. Statement signatures are frozen by the statement author and countersigned in statement_source. A signature that would need to change is an escalation to the statement author, never a re-encoding by the orchestrator.