Install
openclaw skills install lean-proof-to-code-translator-c-rust-wasmLean Proof To Code Translator - C Rust Wasm: Start asynchronous Lean proof export. Use when an agent needs lean proof to code translator c rust wasm, lean to code translator w proof c rust wasm, 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, generate, source archive file id through AgentPMT-hosted remote tool calls.
openclaw skills install lean-proof-to-code-translator-c-rust-wasmLast updated: 2026-06-09.
If the current date is more than 7 days after the last updated date, reinstall this skill from skills.sh or ClawHub before relying on endpoints, schemas, setup steps, or examples.
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.
Full step-by-step tutorial:
https://www.agentpmt.com/docs/tutorials/write-lean-input-for-code-generationDownload the working example zip:
https://www.agentpmt.com/downloads/lean-proof-code-generation-example.zipThis service does not accept arbitrary Lean programs and "turn them into C". It accepts Lean source that builds a value of:
HeytingLean.LeanCP.CProgramDeclThe selected entry_symbol must elaborate to that type. The generated c,
rust, and wasm artifacts are emitted from that LeanCP intermediate
representation.
generate or verify.get_task with the returned task_id until status is completed or failed.Upload a .zip file whose top-level entries are Lean source files under
UserProofs/.
Required:
UserProofs/Main.lean or another module referenced by entry_module.lean files under UserProofs/Do not include:
lakefile.leanlean-toolchainlake-manifest.json.lake/The platform supplies the pinned Lean toolchain and the pinned LeanCP runtime.
You can use ordinary Lean definitions to build your program value. For example, it is fine to use:
namespace, open, def, letWhat actually gets exported is only the final CProgramDecl value. General Lean
code is authoring support, not emitted output by itself.
Import the LeanCP declaration and syntax modules:
import HeytingLean.LeanCP.Lang.CDecl
import HeytingLean.LeanCP.Lang.CSyntax
import HeytingLean.LeanCP.Core.HProp
open HeytingLean.LeanCP
Your exported symbol must be a CProgramDecl:
def exportProgram : CProgramDecl := {
defs := []
main := {
name := "add_one"
params := [("x", .int)]
retType := .int
body := .ret (.binop .add (.var "x") (.intLit 1))
}
}
CProgramDecl contains:
defs : List CFunDeclmain : CFunDeclEach CFunDecl contains:
name : Stringparams : List (String × CType)retType : CTypebody : CStmtThe exported IR currently supports these CType constructors:
.int.intSized signedness intSize.float.double.ptr ty.array ty n.funcPtr ret args.struct name.union name.enum name.typedef name.voidIn practice, the most stable surface today is:
CExpr currently supports:
.var name.intLit n.floatLit v.null.sizeOf ty.cast ty expr.binop op lhs rhs.deref ptrExpr.arrayAccess arr idx.addrOf varName.fieldAccess base field.call functionName argsSupported binary operators (BinOp):
.add, .sub, .mul, .div, .mod.eq, .ne, .lt, .le, .gt, .ge.and, .or, .lAnd, .lOr.bitAnd, .bitOr, .bitXor, .shl, .shrCStmt currently supports:
.skip.assign lhs rhs.seq s1 s2.ite cond thenStmt elseStmt.whileInv cond invariant body.block locals body.switch expr tag caseBody defaultBody.forLoop init cond step body.break.continue.ret expr.alloc varName cellCount.free expr cellCount.decl varName tyUseful helper:
switchMany expr cases defaultStmtNotes:
whileInv takes a loop invariant of type HProp. Use HProp.htrue when you need a permissive invariant.block takes a list of local declarations as (String × CType).alloc and free work at the LeanCP memory-model level with explicit cell counts.Simple arithmetic function:
def applyTax : CFunDecl := {
name := "apply_tax"
params := [("subtotal", .int), ("tax_rate", .int)]
retType := .int
body := .ret
(.binop .add
(.var "subtotal")
(.binop .div
(.binop .mul (.var "subtotal") (.var "tax_rate"))
(.intLit 100)))
}
Conditional return:
def shippingProgram : CProgramDecl := {
defs := []
main := {
name := "shipping_quote"
params := [("weight_kg", .int)]
retType := .int
body := .ite (.binop .le (.var "weight_kg") (.intLit 5))
(.ret (.intLit 8))
(.ret (.intLit 15))
}
}
Loop with invariant:
def loyaltyProgram : CProgramDecl := {
defs := []
main := {
name := "loyalty_points"
params := [("orders", .int), ("points_each", .int)]
retType := .int
body := .block [("total", .int), ("i", .int)] (
.seq (.assign (.var "total") (.intLit 0)) (
.seq (.assign (.var "i") (.intLit 0)) (
.seq (.whileInv (.binop .lt (.var "i") (.var "orders")) HProp.htrue (
.seq (.assign (.var "total") (.binop .add (.var "total") (.var "points_each")))
(.assign (.var "i") (.binop .add (.var "i") (.intLit 1)))))
(.ret (.var "total")))))
}
}
Pointer and array access:
def basketProgram : CProgramDecl := {
defs := []
main := {
name := "basket_head_total"
params := [("prices", .ptr .int)]
retType := .int
body := .ret (.binop .add
(.arrayAccess (.var "prices") (.intLit 0))
(.arrayAccess (.var "prices") (.intLit 1)))
}
}
These inputs are outside the supported contract:
entry_symbol whose type is not CProgramDecllakefile.leanCProgramDeclAll targets start from the same CProgramDecl.
c is the baseline and most direct emission pathrust is a deterministic translation of the same C IR and uses unsafe for pointer semanticswasm is the most restrictive path and should be treated as preview-grade compared with cLean Proof To Code Translator - C Rust Wasm on AgentPMT.generate, get_targets, get_task, list_tasks, verify.file-management, page: https://clawhub.ai/agentpmt/file-management; skills.sh: npx skills add AgentPMT/agent-skills --skill file-management) - Use this companion skill to inspect, download, upload, and manage files referenced by this product.No categories or industry tags are published for this tool.
Complete generated action schema: ./schema.md.
Supported action count: 5.
x402 availability: not enabled for this product.
generate (action slug: generate): Compile a source-only Lean archive into verified C, Rust, or Wasm artifacts using the platform-pinned runtime and shared cache. This action starts an asynchronous task and returns a task_id immediately. Price: 5 credits. Parameters: entry_module, entry_symbol, source_archive_file_id, target_language, timeout_seconds, use_vendored_runtime.get_targets (action slug: get-targets): List the currently supported target languages and bundle requirements. Price: 5 credits. Parameters: none.get_task (action slug: get-task): Check the status of a generate or verify task and retrieve results when complete. Price: 5 credits. Parameters: task_id.list_tasks (action slug: list-tasks): List recent generate and verify tasks for the current budget. Price: 5 credits. Parameters: limit.verify (action slug: verify): Verify a previously generated Lean proof export bundle against the same pinned runtime and shared cache. This action starts an asynchronous task and returns a task_id immediately. Price: 5 credits. Parameters: bundle_file_id, target_language, timeout_seconds, verification_mode.Use the compact schema above for ordinary calls. Before a new production integration, or whenever parameters, enum values, nested objects, outputs, or examples are unclear, fetch live details first.
agentpmt-tool-search-and-execution with action: "get_schema", and tool_id: "lean-to-code-translator-w-proof-c-rust-wasm".agentpmt-tool-search-and-execution with action: "get_instructions" and tool_id: "lean-to-code-translator-w-proof-c-rust-wasm", or call this product with action: "get_instructions" when the product tool is already selected.MCP schema lookup through the main AgentPMT MCP server:
{
"method": "tools/call",
"params": {
"name": "AgentPMT-Tool-Search-and-Execution",
"arguments": {
"action": "get_schema",
"tool_id": "lean-to-code-translator-w-proof-c-rust-wasm"
}
}
}
For live examples, keep the same MCP tool and use these arguments:
{
"action": "get_instructions",
"tool_id": "lean-to-code-translator-w-proof-c-rust-wasm"
}
Authenticated AgentPMT REST schema lookup body:
{
"name": "agentpmt-tool-search-and-execution",
"parameters": {
"action": "get_schema",
"tool_id": "lean-to-code-translator-w-proof-c-rust-wasm"
}
}
Authenticated AgentPMT REST live examples body:
{
"name": "agentpmt-tool-search-and-execution",
"parameters": {
"action": "get_instructions",
"tool_id": "lean-to-code-translator-w-proof-c-rust-wasm"
}
}
Product slug: lean-to-code-translator-w-proof-c-rust-wasm
Marketplace page: https://www.agentpmt.com/marketplace/lean-to-code-translator-w-proof-c-rust-wasm
../agentpmt-account-mcp-rest-api-setup to connect the main MCP server or REST API for an Agent Group where this tool is enabled.../what-is-agentpmt for marketplace, Agent Group, workflow, MCP, REST, and payment concepts.If those setup skills are not installed beside this product skill, use the downloads below.
Core AgentPMT setup skills:
openclaw skills install what-is-agentpmtnpx skills add AgentPMT/agent-skills --skill what-is-agentpmtopenclaw skills install agentpmt-account-mcp-rest-api-setupnpx skills add AgentPMT/agent-skills --skill agentpmt-account-mcp-rest-api-setupskills.sh install script:
npx skills add AgentPMT/agent-skills --skill what-is-agentpmt
npx skills add AgentPMT/agent-skills --skill agentpmt-account-mcp-rest-api-setup
MCP call shape after the main AgentPMT MCP server is connected:
{
"method": "tools/call",
"params": {
"name": "Lean-Proof-To-Code-Translator---C-Rust-Wasm",
"arguments": {
"action": "generate",
"entry_module": "example entry module",
"entry_symbol": "example entry symbol",
"source_archive_file_id": "example source archive file id",
"target_language": "c",
"timeout_seconds": 10,
"use_vendored_runtime": true
}
}
}
Use the exact tool name returned by tools/list; the name above is the expected readable form.
Authenticated AgentPMT REST call body:
{
"name": "lean-to-code-translator-w-proof-c-rust-wasm",
"parameters": {
"action": "generate",
"entry_module": "example entry module",
"entry_symbol": "example entry symbol",
"source_archive_file_id": "example source archive file id",
"target_language": "c",
"timeout_seconds": 10,
"use_vendored_runtime": true
}
}
Use the setup skill for the account connection details before making REST calls.
passed or success-style boolean, use it as the workflow gate.get_schema or get_instructions before retrying.generate fails, preserve the request parameters and retry only after fixing schema, auth, or payment errors.what-is-agentpmt, page: https://clawhub.ai/agentpmt/what-is-agentpmt; skills.sh: npx skills add AgentPMT/agent-skills --skill what-is-agentpmt)agentpmt-account-mcp-rest-api-setup, page: https://clawhub.ai/agentpmt/agentpmt-account-mcp-rest-api-setup; skills.sh: npx skills add AgentPMT/agent-skills --skill agentpmt-account-mcp-rest-api-setup)