LEAP: Lean 4 Formal Verification as Policy for Robot Control

LEAP (`arXiv:2611.36564`, Nanyang Technological University S-Lab) reverses conventional robot policy generation: instead of emitting one unverified trajectory from a VLA or Code-as-Policies model, an LLM agent writes the entire feasible action set in Lean 4 over a library of physical laws. An objective selects `q*`, which is verified via exact interval arithmetic and the Lean kernel before the robot moves.
LEAP: Lean 4 Formal Verification as Policy for Robot Control: LEAP (`arXiv:2611.36564`, Nanyang Technological University S-Lab) reverses conventional robot policy generation: instead of emitting one unverified trajectory from a VLA or Code-as-Policies model, an LLM agent writes the entire feasible action set in Lean 4 over a library of physical laws. An objective selects `q*`, which is verified via exact interval arithmetic and the Lean kernel before the robot moves. Designed as a zero-dependency, open-source TypeScript architecture under the MIT License with native Model Context Protocol (MCP) support and deterministic phase state machines.
- Constraint-First Action Families: Encodes goal, contact physics with physical units, and embodiment joint limits in Lean 4 before choosing a trajectory.
- Pre-Execution Soundness Gate: Verifies the chosen command `q* = argmin J(q)` over ball neighborhoods `B_r(q)` via exact interval arithmetic and optionally the Lean 4 kernel.
- Clean Preference Separation: Decouples hard safety/physics feasibility (`F(theta)`) from soft user preferences like path clearance or shortest travel.
- 10/10 Trajectory Judge Accuracy: Achieves 10/10 judge accuracy across Tennis, Baseball, and Golf ball grasping vs 0/10–1/10 for Astra, validated across RoboDojo, RoboCasa365, and LIBERO-Pro.
import { createAgent } from '@smoke-monkey/harness';const roboticsVerifier = createAgent({agentId: 'leap-lean4-policy-agent',provider: 'custom',baseUrl: 'http://127.0.0.1:8000/v1',model: 'qwen3.8:27b',workspacePath: process.cwd(),permissions: {read_file: 'allow',write_file: 'allow',run_command: 'ask',},mcpServers: {leanKernel: {command: 'npx',args: ['-y', '@smoke-monkey/mcp-lean4', '--interval-check', 'strict'],},},});async function synthesizeAndVerifyPolicy() {const result = await roboticsVerifier.run('Synthesize a Lean 4 feasible grasp set F(theta) for the ceramic mug under joint-torque limits, minimize path length J(q), and verify q* with interval arithmetic before actuator dispatch.');console.log('LEAP Verification Result:', result.summary);}synthesizeAndVerifyPolicy().catch(console.error);
Watch: Related Video Guides
LEAP: Gradient Flow Augmented Lagrangian Trajectory Optimization for Contact Constrained Robots
Diffusion Policy: LeRobot Research Presentation #2 by Cheng Chi
What Is LEAP? Reversing Policy Synthesis & Verification
LEAP (Lean-as-Policy, arXiv:2611.36564) introduces a formal-methods control paradigm for robotic manipulation. Vision-Language-Action (VLA) models, Code-as-Policies (CaP), and human teleoperators all produce a single trajectory q(t) whose safety and physical validity are only discovered by executing it on hardware.
LEAP flips that execution order inside LEAP-Harness: an LLM agent first translates observations and instructions into a Lean 4 action family F(theta) = {q in Q : g_i(q', theta) >= 0} backed by a shared library of typed physical laws with units and interval uncertainty Theta. Once the feasible set is defined, an optimizer picks one candidate q* according to a separate preference objective J(q), and exact interval arithmetic—optionally backed by the Lean 4 kernel—verifies q* before a single motor command leaves the controller.
LEAP vs VLA, Agent & Code-as-Policies Capabilities & Benchmarks
Evaluating LEAP against VLA policies, plain agents, and Code-as-Policies highlights how representing full action sets eliminates silent physical violations.
| Dimension / Task Metric | VLA | Plain Agent | Code-as-Policies | LEAP (Lean-as-Policy) |
|---|---|---|---|---|
| Policy Representation | Single Trajectory | Single Trajectory | Single Trajectory | Lean 4 Feasible Action Set |
| Pre-Execution Check | None | None | Partial / Ad-hoc | Interval Arithmetic + Lean Kernel |
| Typed Physics & Units | No | No | No | Yes (Shared Law Library) |
Interval Uncertainty (F_rob) | No | No | No | Yes (Intersection over `Theta`) |
| Tennis Ball (Success / Judge Acc) | — | Astra: 3/5 (1/10) | — | 5/5 (10/10) |
| Baseball (Success / Judge Acc) | — | Astra: 0/5 (0/10) | — | 4/5 (10/10) |
| Golf Ball (Success / Judge Acc) | — | Astra: 2/5 (1/10) | — | 4/5 (10/10) |
Across real-world Marvin humanoid arm evaluations and simulated suites (RoboDojo, RoboCasa365, and LIBERO-Pro), LEAP turns rejected trajectories into structured failure reasons (Rejection with a reason) that guide belief adaptation without hardware collisions.
Scope of Formal Guarantees
As the LEAP authors emphasize, pre-execution verification covers exactly what the Lean 4 action family specifies. Modeling accurate contact geometry and sensor uncertainty intervals (`Theta`) in the shared physical law library remains essential.
Inspecting LEAP-Harness & Lean 4 Policy Repositories
Clone the official WeichenFan/LEAP repository (CC BY 4.0) to inspect the Lean 4 physical-law library, interval verifier, and LEAP-Harness simulation connectors.
# Clone LEAP and inspect Lean 4 physical law definitions and LEAP-Harness
git clone https://github.com/WeichenFan/LEAP.git && cd LEAP
curl -sL https://arxiv.org/pdf/2611.36564 -o leap-2611.36564.pdf
# Check Lean 4 toolchain version and project structure
cat lean-toolchain 2>/dev/null || ls -laEnforcing Deterministic Verification Gates in Smoke Monkey Harness
LEAP shares the core philosophy of Smoke Monkey Harness: never trust single-shot stochastic model outputs against critical physical or production state. Wrapping Lean 4 kernel checks as MCP verification tools lets Smoke Monkey agents iterate on failed constraints cleanly before committing irreversible actions.
Frequently Asked Questions
Q:How does LEAP differ from Code-as-Policies?
Code-as-Policies emits imperative Python code that outputs one candidate trajectory without a formal specification. LEAP outputs a declarative Lean 4 feasible action set separating physics/goal constraints from optimization preferences, then proves candidate commands satisfy the constraints before execution.
Q:Does LEAP run the full Lean 4 theorem prover on every robot control tick?
LEAP invokes the LLM once per action family and checks candidate solutions `q*` using fast exact interval arithmetic over ball neighborhoods `B_r(q)` with optional Lean kernel checking.
Q:Which robotics benchmarks validate LEAP?
The paper evaluates LEAP on `RoboDojo`, `RoboCasa365`, `LIBERO-Pro`, and real Marvin humanoid arms, achieving 10/10 trajectory judge accuracy on precision ball-grasping tasks.
Q:How does LEAP handle sensor or pose uncertainty?
Uncertainty parameters `theta in Theta` are represented as intervals, and LEAP computes the robust feasible set `F_rob` as the intersection across all parameter values in `Theta`.
Related Alternatives & Comparisons
Related Architecture Guides
View all guidesBest Open Source Coding Agents in 2026: Free, Local & Fully Hackable Harnesses
MCP Server Security Best Practices: Hardening Model Context Protocol Agents in 2026
Open Source Coding Agent Harness: Build a Forkable, Local AI Engineering Runtime
Build with Smoke Monkey Harness
Zero dependencies. 24 built-in tools. Human-in-the-loop safety. 100% open source under the MIT License.