LeanWarp

v0.2.11
io.github.Isagoge-Labs/leanwarp Checked 2 hours ago Published 14 hours ago

Check and verify Lean 4 proofs on hosted, warm Lean and Mathlib workers.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

doctor

Show the project's toolchain and environment and whether it runs, and any connect in progress. Does not start compute.

files

List the Lean files that would upload, their sizes and any problems. .gitignore and .leanwarpignore in the project exclude files. With dependencies, also each path dependency connect sends: its dir and its files with sizes. Needs no key and uploads nothing.

ParameterTypeDescription
dependenciesboolean

versions

List the Lean toolchains LeanWarp supports.

environments

List this account's environments: each project's build status and dependencies.

account

Show credit: balance, reserved and available, as microdollar strings ($1 = 1000000).

resources

Show the published worker's resources and pricing. Does not start compute.

connect

Connect this project. A new environment build uses prepaid credit. The project's toolchain, lakefile, lockfile and path dependencies define its environment; LeanWarp builds it once and this waits up to 40 seconds. Pass retry after fixing what made a build fail. Each dependency's default libraries are built; pass libraries (each package/Target, such as mathlib/Archive) to build others too, as a check refusing an import names. Plain files run with Mathlib; pass mathlib false for core Lean alone, which starts faster and builds nothing. Chan…

ParameterTypeDescription
libraries
mathlib
max_spend_microusd
retry
workspace_id

workspaces

List the account's workspaces; this_project marks the one this project uses.

history

One page of stored operations and results, newest first; default this project's. Pass the previous page's next_cursor as cursor to read older ones. Finished history is kept for a window only.

ParameterTypeDescription
cursor
detailstring
workspace_id

status

Show the workspace and an operation's state: the latest, or operation_id. It never includes a result; call wait with the operation_id for that.

ParameterTypeDescription
operation_id

check

Compile a file and report Lean errors and warnings. Uploads changed files first. draft defaults to false: a strict check that fails on errors, sorry and extra axioms. draft=true is faster while editing: Lean reuses its work on the unchanged part of the file, and `sorry` is only a warning, so finish with a strict check or verify_target. status is ok, error or rejected (failure.kind says why), or, with no verdict, timeout, infrastructure_failure or not_checked: then retry, when failure.retryable, rather than change the proof. retention="sh…

ParameterTypeDescription
file *string
detailstring
draftboolean
retentionstring
wait_secondsnumber

inspect

Show goals at a tactic or proof hole. Lines and character columns start at 1. no_goals means a known empty tactic state. omitted counts hidden goals. Use detail="full" for a selection too large for the compact answer. retention="short" lets LeanWarp remove the finished result after about a minute. May start a worker, which uses credit.

ParameterTypeDescription
column *integer
file *string
line *integer
detailstring
retentionstring
wait_secondsnumber

try_tactics

Try tactics at a position without editing the file. Read each result's outcome. The default limit covers the sum of the tactic budgets plus overhead, up to the operation maximum. A shorter explicit limit scales tactic budgets down. Read each outcome to see whether the tactic closed its goal. retention="short" lets LeanWarp remove the finished result after about a minute. May use credit.

ParameterTypeDescription
column *integer
file *string
line *integer
tactics *array
detailstring
retentionstring
wait_secondsnumber

verify_target

Check that a declaration proves exactly the user's statement. May use credit. target_context holds the imports and definitions the statement needs, such as `import Mathlib`; it may import only the environment's packages, never this project's modules. Never weaken the statement or context to make a proof pass. fresh runs on a separate worker that stops afterwards. success needs status ok and a receipt; rejected is a verdict (failure.kind: target_mismatch, axioms, ...), while timeout and infrastructure_failure decide nothing: retry.

ParameterTypeDescription
candidate_declaration *string
file *string
target_statement *string
detailstring
freshboolean
target_contextstring
wait_secondsnumber

suggest

Find a tactic that closes the hole at a position; call apply straight after. Without tactics, LeanWarp ranks its own portfolio for the goal; timeout_ms bounds each tactic. success means a tactic closed the hole, changing nothing else. verification says how far the recheck reached: strict, the whole file, by the independent checker; declaration, this declaration (others still have holes), an editing aid and not a verdict: run check on the finished file. A hole in a declaration that keeps other holes is not closed (declaration_has_other_ho…

ParameterTypeDescription
column *integer
file *string
line *integer
detailstring
tactics
timeout_ms
wait_secondsnumber

holes

List sorry and ?_ positions with their observed state from one elaboration. Lines and columns are 1-based. States are resolved, sorry, unresolved, or unknown. unfinished_count counts only sorry/unresolved placeholders; unknown_count is separate and must not be treated as proof completion. The legacy unfinished flag stays true for unknowns; only resolved is false. hole_count includes resolved syntax placeholders. Goals are bounded to the first 16 unfinished/unknown entries; omitted contexts are explicit. success means the listing ran; sta…

ParameterTypeDescription
file *string
detailstring
goalsboolean
wait_secondsnumber

proof_states

Every tactic Lean ran in the file, with its goals before and after, one page at a time. One call replaces an inspect per tactic. Rows are in command order, a tactic before those nested in it; each has source_range (1-based lines and columns), occurrence (a tactic run once per goal repeats its range) and before/after with status available (state: an id in the page's states), no_goals, omitted (too large) or unavailable. Call again with next_cursor as cursor until it is null. max_bytes bounds the page (4096 to 524288). status unsupported m…

ParameterTypeDescription
file *string
cursorinteger
detailstring
max_bytesinteger
wait_secondsnumber

extract_decls

List the declarations a file adds, with types and dependencies. May use credit.

ParameterTypeDescription
file *string
detailstring
wait_secondsnumber

sorry2lemma

Move each unfinished theorem's proof into a named lemma; call apply to write it. The original theorem then calls the new lemma, which keeps its sorry: prove each one next, for example with suggest. name_prefix names them. Section variables are preserved in the generated lemma application. A failed transformation leaves the source unchanged. The file is not changed until apply. May use credit.

ParameterTypeDescription
file *string
detailstring
max_extractionsinteger
name_prefix
strict_final_checkboolean
wait_secondsnumber

have2lemma

Move each named `have` in a theorem's proof into its own lemma; call apply to write it. The `have` then calls the new lemma, which takes the theorem's parameters. LeanWarp returns the new file only after checking that every statement is unchanged and nothing else was added; status rejected, with reason, means that audit refused it. The file is not changed until apply. May use credit.

ParameterTypeDescription
file *string
detailstring
max_extractionsinteger
name_prefix
wait_secondsnumber

simplify_proofs

Replace theorem proofs with shorter tactic proofs; call apply to write the file. Each candidate is kept only if the whole file still checks with it and it is at least min_reduction_bytes shorter; timeout_ms bounds each attempt (each tactic's own budget without it). Each theorem it edits must end complete with Lean's standard axioms only, and no statement may change; status rejected, with reason, means LeanWarp's audit refused the rewritten file. Tactics may not use sorry or admit. The file is not changed until apply. May use credit.…

ParameterTypeDescription
file *string
detailstring
max_simplificationsinteger
min_reduction_bytesinteger
tactics
timeout_ms
wait_secondsnumber

repair_proofs

Try to repair sorry holes. Call apply only when source_changed is true. Every attempt checks the whole patched file; timeout_ms bounds each one (each tactic's own budget without it), and sorrys that do not fit the operation's time come back skipped. Each theorem it edits must end complete with Lean's standard axioms only: a theorem that keeps another sorry is refused (declaration_has_other_holes). Solve its remaining holes together or manually separate them into lemmas. Tactics may not use sorry or admit. A rejected response gives the au…

ParameterTypeDescription
file *string
detailstring
max_repairsinteger
tactics
timeout_ms
wait_secondsnumber

check_files

Check up to 64 files in one operation; success is true only if every file passed. Strict by default: sorry, errors and non-standard axioms fail a file. draft accepts files that compile; timeout bounds each file in seconds (default 60, at most 300, which needs the default operation deadline). Each file's status is ok, error or rejected (a verdict), or timeout, infrastructure_failure or not_checked (no verdict: retry those, do not change the proof). The batch is ok, failed (a file was refused) or incomplete. May use credit.

ParameterTypeDescription
files *array
detailstring
draftboolean
timeout
wait_secondsnumber

verify_batch

Check up to 64 inline proofs in one operation; success is true only if all passed. Each code is {"custom_id": ..., "proof": ...} with a unique custom_id; no file is uploaded. Proofs may import the environment's packages, such as Mathlib, but not this project's modules (use check_files for those). Without a target, ok means the source compiles, its declarations pass the kernel and it uses no extra axioms, not that it proves what you meant: add "target": {"context": imports, "statement": the Prop, "declaration": the theorem's name} to bind…

ParameterTypeDescription
codes *array
detailstring
draftboolean
timeout
wait_secondsnumber

apply

Write the latest successful suggest or file-rewrite result into its file, then upload it. Refuses if the file changed since the result was computed. If the upload response was lost, retry apply. For revision_conflict, inspect the local file, run reconcile, review the changes, then run any operation (it uploads first). Run check or verify_target afterwards to confirm the proof.

wait

Wait up to timeout seconds (at most 40) for an operation: the latest, or operation_id. If it is still running, success is null: call wait again with its operation_id. With operation_id, wait only reads that operation. Without it, wait first resends a saved request whose response was lost, which can upload source changes, including deletions, and start the operation it carried.

ParameterTypeDescription
detailstring
operation_id
timeoutnumber

recover

Resend the saved create, sync or submit request after a lost response. Any other tool that writes resends it first, so this is needed only to see the outcome on its own. An operation_id means the submission was recovered: wait instead of resubmitting. A workspace and revision only confirm create or sync: then run the intended operation.

ParameterTypeDescription
detailstring

cancel

Cancel an operation, the latest or operation_id; wait until it finishes.

ParameterTypeDescription
detailstring
operation_id

stop

Stop the worker so it stops using credit. Saved files are kept.

ParameterTypeDescription
generation

feedback

Report a confirmed problem with LeanWarp itself to the LeanWarp team. For a bug you reproduced, a result that contradicts the guide, a confusing error, a capability you needed and lacked, or slowness that held up the work; never for Lean errors in the user's proof. One report per issue, at a pause between steps, then continue the task. Free; starts no compute. If recorded is false, carry on without retrying.

ParameterTypeDescription
detailsstringWhat you did, expected and got, up to 4000 characters. Never the user's source, proofs or secrets.
kindstringRequired. An unlisted kind is recorded as other.
operation_idstringThe operation it is about; defaults to the latest one.
severitystring
summarystringRequired. One line, 8 to 200 characters: what is wrong or missing.

reconcile

Adopt the workspace's revision after another client changed its files. Use only after a revision_conflict you have resolved. The result lists the paths the next sync uploads or deletes, overwriting the other client's files, and under remote_only the files only the workspace has, which stay.

prune

Delete files that only the workspace has, such as beyond a partial checkout. Without confirm, lists them and deletes nothing. Show the user that list and ask. Pass the returned confirm token only after they agree: this cannot be undone and the files may be a teammate's.

ParameterTypeDescription
confirm

disconnect

Forget this project's stopped workspace so it can connect to another environment.

delete

Permanently delete a workspace with its files and results; credit is kept. Only when the user asked to delete that workspace. Cannot be undone.

ParameterTypeDescription
workspace_id *string