Skip to content

Re-check a store from scratch

Run lema reverify to replay every accepted object in a store through the pinned Lean 4.34.1 kernel with zero cached .olean modules, and verify all stored receipts and axiom footprints.

During day-to-day authoring with lema add and lema publish, Lema keeps proof checking fast by saving compiled delta modules (.olean files) in the runtime’s module cache (output/modules/). When you or your AI coding agent add a new theorem, the sandboxed checker imports the cached .olean modules for already-accepted dependencies and replays only the new declarations through the pinned Lean 4.34.1 kernel (How acceptance works).

When you want to remove the incremental .olean module cache from your trust chain, such as during a security audit or before cutting a production release, lema reverify replays the store’s accepted objects from their raw canonical encodings in a fresh Lean environment with zero cached modules, and checks that every recomputed axiom footprint matches the receipt stored on disk.

Before you start

  • A Lema project or a running server backed by a full checking runtime configuration (one that includes distribution pointing to the verified Lean 4.34.1 toolchain; a VM-only deployment runtime cannot run reverify).
  • No active HALTED supervision latch on the runtime output directory or shared lock.

1. Check the number of accepted objects (lema info)

Inspect the store summary to see how many accepted objects it holds:

Shell
lema info
Output
{
  "accepted": 214,
  "aliases": 48,
  "allowed_axioms": [
    "Classical.choice",
    "Quot.sound",
    "propext"
  ],
  "modules": 12,
  "namespace": "4305157d7b8a…",
  "native_call_budget": null,
  "native_calls_used": 14,
  "objects": 412,
  "tooling_sha256": "..."
}

A single reverify native call can replay up to 20,000 objects within the sandbox’s 600-second wall-clock timeout. If objects is at or below 20,000, run Step 2 to re-verify the entire store in one call. If objects exceeds 20,000, use Step 3 to re-verify in root batches.

2. Re-verify the entire store (lema reverify)

Run lema reverify:

Shell
lema reverify
Output
{
  "call": "reverify-1",
  "notes": 198,
  "objects": 412,
  "receipts": 214
}

Here is what each field in the response confirms:

  • objects (412): Total number of accepted store objects replayed in a single fresh Lean 4.34.1 kernel environment without reading output/modules/.
  • receipts (214): Number of primary kernel-checked objects (declaration, record, family, and external) whose proofs and types were re-accepted by addDeclCore and whose freshly computed transitive axiom footprints matched their stored receipts on disk and the store’s allowed_axioms policy.
  • notes (198): Number of supporting objects (statement, template, proof, and satisfaction) verified by being referenced and decoded inside at least one declaration replayed during this call.
  • call ("reverify-1"): The native call reservation/completion identifier recorded in output/ledger.jsonl.

3. Re-verify large stores in batches (roots)

For a large store containing more than 20,000 objects, pass a list of top-level roots to call reverify:

Shell
lema call reverify --params '{"roots": ["<root_id_1>", "<root_id_2>"]}'

Passing roots replays the full transitive dependency closure of those root IDs from scratch with zero cached .olean modules. Choose two or three sets of root IDs whose closures together cover every accepted object in the store, keeping each batch comfortably under 15,000 to 20,000 objects so each sandboxed call finishes well inside the 600-second wall-clock limit.

Common refusals

Refusal message containsCause and fix
nothing to re-verifyThe store contains only the initial namespace object and no accepted declarations yet.
... objects exceed one re-verification call (20000); re-verify in parts with rootsThe store has more than 20,000 objects. Use lema call reverify --params '{"roots": [...]}' in batches (Step 3).
... is not acceptedOne of the IDs passed in roots (or an object in its closure) is not an accepted object in this store.
the kernel refused accepted objects [...] on re-verification; see ...The pinned Lean 4.34.1 kernel rejected an object during replay (for example, if an object file on disk was corrupted or tampered with). Inspect the call log named in the error message.
re-verification failed (...): footprints or receipts differ for [...]; nothing replayed now checks [...]A recomputed axiom footprint differed from the receipt on disk, or an orphaned supporting object (statement, template, proof, satisfaction) was not used by any replayed declaration.
vm-only: Lean calls refusedThe server was started with a VM-only runtime configuration that omits distribution. Restart the server with a full checking runtime configuration.
native calls halted; see ...A HALTED supervision latch is present on the runtime output directory or host lock. Follow Recover from a HALTED latch.

Lema v0.3.2 · Updated 29 October 2026 · Version and compatibility