SpecBridge is a Rust implementation that turns natural language problem descriptions from the CLEVER Improved dataset into Lean specifications. It loads each task's public description and Lean signature, runs model based generation and Lean checking, and saves the generated specification and run record.
- Python 3.10 or later and Rust 1.97.1 or later
elan,lake, and the Lean toolchain pinned inlean-toolchain- Network access to install the pinned Mathlib dependencies and call a configured model
Install the Lean dependencies once from this directory:
lake update
lake exe cache getCopy .env.sample to .env and set OPENAI_BASE and OPENAI_KEY to your model endpoint and key. Set SPECBRIDGE_MODEL to the model name your endpoint supports, or pass --model to the command. The local .env and run outputs are ignored by Git.
./forwardThe default command runs clever_0 and clever_1. To choose other tasks:
./forward clever_8 clever_12 --model gpt-6-lunaThe command uses the packaged prompt bundle in specbridge-rs/prompts/generation/.
The generator records the public requirement in the paper's five-module NLFP
format; the decoder turns that plan into a Lean problem_spec and repairs
compilation errors. The prompts include reusable guidance for CLEVER Improved
task families, Lean types and APIs, guard scope, boundary cases, ordered
collections, numeric semantics, and output counterexamples. The public task
and supplied Lean signature determine the result for each invocation. The
run artifacts record the consumed prompt hashes.
The command prints each generated Lean specification and writes full artifacts under runs/<unique-id>/. Provide --output /path/to/new-directory to choose an artifact directory. The directory must not already exist. Task IDs must be distinct, and each invocation accepts 2–20 tasks. A failed model request, Lean check, or missing specification causes a nonzero exit code; inspect the printed run directory for details.
The project includes the Rust source and prompts in specbridge-rs/, the 161 reviewed Improved task instances in clever-dataset/, Lean support definitions in clever/ and clever-improving/, and the Lean/Python helpers used by the runtime. The task loader verifies each bundled Lean source against its recorded SHA-256 hash. Cargo.lock, lake-manifest.json, and lean-toolchain pin the build dependencies. Generation uses the configured live model; Lean compilation and model based review are part of the run.
The original CLEVER dataset license is included at clever/LICENSE.