Skip to main content
Glama

Verify formal (real Lean kernel)

verify_formal
Read-onlyIdempotent

Check Lean 4 proofs and snippets with the actual kernel. Submit a statement and proof for verification, or a full snippet for typechecking.

Instructions

Run the REAL Lean 4 kernel (NO LLM). Two modes: (1) pass lean (a full snippet, e.g. 'example : 2 + 2 = 4 := rfl') to typecheck it as-is; (2) pass proof to PROOF-CHECK — statement must then be the Lean 4 proposition and proof YOUR proof (term or 'by ...' tactic block); mathlas builds theorem _mathlas_check : <statement> := <proof> and the kernel returns proof_status VERIFIED_PROOF / REFUTED (kernel_error carries the kernel's exact complaint — use it to repair the proof and re-call) / UNDETERMINED (no toolchain / timeout / unresolvable import — honest, never fake). sorry/admit are REJECTED. mathlas never writes proofs, only checks them. Find declaration names first with search_formal_math. Args: statement, lean?, proof?.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
statementYesthe claim being checked; with `proof` it MUST be the Lean 4 proposition to prove, e.g. '∀ n : Nat, n + 0 = n'
leanNoLean 4 snippet to kernel-check as-is, e.g. "example : 2 + 2 = 4 := rfl" (omit both this and `proof` and the verdict is an honest UNDETERMINED — statement text alone is not checkable)
proofNoYOUR Lean 4 proof of `statement` — a term ('rfl') or tactic block ('by\n intro n\n rfl'). Checked by the real kernel; on REFUTED, repair using `kernel_error` and re-call. sorry/admit holes are rejected.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
statementNo
modeNo'proof_check' iff `proof` was supplied
lean_providedNo
proof_providedNo
lean_availableYes
tierNo
proof_statusNoproof mode only — the kernel's verdict on YOUR proof
typechecksYes
appliesNo
checkedYestrue iff the Lean kernel actually ran and gave a verdict
declarationNoproof mode only — the exact declaration the kernel checked
detailNo
kernel_errorNoproof mode, REFUTED only — the kernel's error verbatim; the repair-loop payload
remediationNopresent iff not checked — exactly what unblocks a real kernel check
noteNo
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Disclosures beyond annotations: states 'REAL Lean 4 kernel (NO LLM)', rejects 'sorry'/'admit', promises honest results (never fake), lists three outcome categories with meaning. Annotations (readOnlyHint, idempotentHint) are consistent and description adds significant behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Description is front-loaded with 'Run the REAL Lean 4 kernel (NO LLM)', then clearly splits modes with examples and outcomes. Slightly long but every sentence serves a purpose; structured for quick parsing. Minor redundancy could be trimmed.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given tool complexity (two modes, multiple outcomes, constraints), description covers all aspects: parameter combinations, expected behavior, error handling, and guidance to use sibling tool. No gaps for agent invocation. Output schema presence implied but not needed due to description of outcomes.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with descriptions, but description adds value by explaining the two usage modes, clarifying that 'proof' must be a Lean 4 proof of 'statement', and noting that omitting both 'lean' and 'proof' results in UNDETERMINED. Adds context not in schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states it runs the real Lean 4 kernel, distinguishes two modes (typecheck and proof-check), and emphasizes it never writes proofs. Specific verbs like 'typecheck', 'proof-check', and 'returns proof_status' make purpose unambiguous. Differentiates from sibling verify_numeric.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly describes when to use each mode: pass 'lean' for typechecking, pass 'proof' for proof-checking. Advises to find declaration names first with search_formal_math. Explains how to handle REFUTED outcome. Does not explicitly exclude cases like using for numeric verification, but context implies alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Archerkattri/mathlas'

If you have feedback or need assistance with the MCP directory API, please join our Discord server