AgentPMT
Lean Proof To Code Translator - C Rust Wasm

Lean Proof To Code Translator - C Rust Wasm

Function

Available ActionsEach successful request consumes credits as outlined below.

generate5crverify5crget_targets5crget_task5crlist_tasks5cr

Details

The Lean to Code Translator converts exportable Lean proof programs into auditable C, Rust, or WebAssembly deliverables. Upload a Lean source bundle, choose the entry module and symbol, and get generated code plus a certificate, logs, and a verification bundle so you can preserve provenance, re-run validation, and confirm the artifact still matches the original source under the pinned runtime.

Use Cases

Compile Lean proof programs to C for native integration, Generate Rust exports from pinned Lean proof bundles, Produce constrained Wasm artifacts from Lean proof code, Package code generation runs with certificates and logs, Verify previously generated bundles before shipping or publication, Preserve reproducible build evidence for audits and reviews, Archive proof export bundles for downstream teams

Connect Your Agent In 5 Min

Watch the setup guide for your platform

Or Install Locally

STDIO connector for Claude Code, Codex, Cursor, Zed, and other LLMs that require STDIO or custom connections. This lightweight connector routes requests to https://api.agentpmt.com/mcp. All tool execution happens in the cloud and the server cannot edit any files on your computer.

npm install -g @agentpmt/mcp-routeragentpmt-setup

About this Product

Compile Lean proofs into auditable code artifacts

Proof Code Compiler starts asynchronous Lean proof export and verification jobs that produce reproducible C, Rust, or WebAssembly artifacts plus the files needed to audit and verify them later.

Read the full Lean input tutorial or download the working example zip.

Async workflow
  1. Call generate or verify. The tool returns a task_id immediately.
  2. Poll get_task with that task ID.
  3. When the task reaches completed, read the result payload for artifact metadata and file IDs.
  4. Use list_tasks to review recent jobs for the current budget.
What to upload for generation

Upload a .zip with a top-level UserProofs/ directory that contains only Lean source files.

user_source.zip
└── UserProofs/
├── Main.lean
├── Helpers.lean
└── Submodule/Util.lean

Do not upload lakefile.lean, lean-toolchain, lake-manifest.json, or .lake/. The platform supplies the pinned Lean toolchain and runtime.

Generate inputs
  1. source_archive_file_id
  2. entry_module, such as UserProofs.Main
  3. entry_symbol, such as exportProgram
  4. target_language: c, rust, or wasm

You may also set use_vendored_runtime for the built-in smoke-test program or adjust timeout_seconds within 10-300 seconds.

Verification inputs

Use the bundle_file_id from a completed generation task. Choose fast to re-check hashes and certificate details, or full to rebuild and compare regenerated output under the pinned runtime.

Task results

Completed tasks can return generated output metadata, a verification bundle, a certificate, a generation log, and normalized source-archive metadata. Keep the bundle file ID if you want to verify the export later.

Frequently Asked Questions

Can I upload `lakefile.lean`, `lean-toolchain`, or my own build configuration?

No. The platform pins the Lean toolchain and exporter runtime for you. Do not include `lakefile.lean`, `lean-toolchain`, `lake-manifest.json`, or `.lake/` in the uploaded archive.

Does this compile any Lean program?

No. The selected definition must elaborate to `HeytingLean.LeanCP.CProgramDecl`, which is the exportable LeanCP program form supported by the current compiler path.

What do `entry_module` and `entry_symbol` mean?

`entry_module` is the Lean module imported from your uploaded source tree, such as `UserProofs.Main`. `entry_symbol` is the definition exported from that module, such as `exportProgram`.

What do I upload to Proof Code Compiler?

Upload a `.zip` whose top-level folder is `UserProofs/` and whose contents are Lean source files only. A single-file project can be as small as `UserProofs/Main.lean`.

What is the difference between `fast` and `full` verification?

`fast` checks certificate details and hashes without rebuilding. `full` rebuilds and re-exports under the pinned runtime, then compares the regenerated output with the stored artifact for stronger assurance.

What should I save after a successful generation?

Save the generated output file, the certificate, the generation log, and especially `artifacts.bundle.file_id`. The bundle is what you need for later verification.

Which target should I choose?

Use `c` when you want the broadest and lowest-risk support. Use `rust` when you want the same export path with Rust output. Use `wasm` only when you are comfortable with the current target being more constrained than `c`.

Looking for help integrating AI into your business? Set up a free consultation.