

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
Dynamic MCP Setup
Connect once through AgentPMT Dynamic MCP, then use approved tools from the same agent connection.
30 Second Setup
STDIO connector for Claude Code, Codex, Cursor, Zed, and other LLMs that require STDIO or custom connections.
npm install -g @agentpmt/mcp-routeragentpmt-setupHosted Streamable HTTPS
MCP endpoint for browser-based apps like ChatGPT, Claude, Grok, or any time you want a streamable connection with no local install.
https://api.agentpmt.com/mcpConfig Example
Use the hosted endpoint directly in clients that support remote MCP. Store your Bearer token in the client config or secret field.
{
"mcpServers": {
"agentpmt": {
"type": "streamable-http",
"url": "https://api.agentpmt.com/mcp",
"headers": {
"Authorization": "Bearer <AGENTPMT_BEARER_TOKEN>",
"x-instance-metadata": "{\"client\":\"generic-mcp\",\"platform\":\"remote\"}"
}
}
}
}Need client videos, organization controls, audit details, and the full feature overview?
More About Dynamic MCPAbout 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
- Call generate or verify. The tool returns a task_id immediately.
- Poll get_task with that task ID.
- When the task reaches completed, read the result payload for artifact metadata and file IDs.
- 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
- source_archive_file_id
- entry_module, such as UserProofs.Main
- entry_symbol, such as exportProgram
- 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
How do I connect this tool to an external agent?
You can install the local MCP server by opening a terminal and running:
Install commands
npm install -g @agentpmt/mcp-router
agentpmt-setupThis will connect you to local agents like Claude Code, Windsurf, Grok Build, Cursor, etc.
Alternatively you can connect to the hosted version with this config block, no installation required:
Hosted MCP config
{
"mcpServers": {
"agentpmt": {
"type": "streamable-http",
"url": "https://api.agentpmt.com/mcp",
"headers": {
"Authorization": "Bearer <AGENTPMT_BEARER_TOKEN>",
"x-instance-metadata": "{\"client\":\"generic-mcp\",\"platform\":\"remote\"}"
}
}
}
}View MCP Connection Instructions for more details.
How does an external agent use this tool?
After the external agent is connected to an Agent Group that can use this tool, paste this prompt into the agent:
Agent prompt
Use the AgentPMT-Tool-Search-and-Execution tool. First call action 'get_instructions' so you know how to use the tool search interface. Then call action 'get_schema' with tool_id 69cdb31aff055c86b8b8a224 ("Lean Proof To Code Translator - C Rust Wasm"). After reading the schema and any returned instructions, tell me what this tool can do, we are going to be using it
The agent should fetch the tool schema first, collect the required parameters for your request, and then call the tool through AgentPMT.
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`.


