Docs · Looking something up
Reference
The commands, the formats and the contracts, for when you know what you are looking for.
The full documents (README.md, AGENTS.md and docs/) are in the source download.
Commands#
These are the ones you will use most. flash help VERB explains one, and flash help all lists every one.
The project
flash start- get Lean if needed, make or find a project, build it, set flash up
flash start --lean- the same, with a plain Lean project instead of Mathlib
flash start --yes- the same, without asking first (for scripts)
flash init- set flash up in a Lean project you have already built
flash which- the pin this directory uses, and the rule that chose it
flash doctor- check the installation and the route, each problem with its fix
flash config- every setting, its value and where it came from
flash config set KEY VALUE- change one setting, in
flash.toml flash pin refresh NAME- set the pin up again after
lake updateor a new toolchain
Checking and proving
flash check FILE- Lean’s messages; exit 0 when the file has no error
flash check --exact FILE- against exactly the file’s imports
flash prove FILE- proofs for the file’s sorries, in order
flash prove FILE --write- and write them into the file
flash prove FILE --decl NAME- one declaration
flash prove --engine c- the C search alone (8.x’s flash search)
flash search FILE- in 9.0.x, flash prove’s alias
Looking before you write
flash twins FILE- the declarations of FILE that already exist, under any name
flash find WORDS- declarations by name
flash type NAME- a declaration’s statement
flash suggest FILE- the lemmas that apply at the file’s first open sorry
flash why FILE LEMMA- where LEMMA stopped on that goal
flash resolve NAME- where a declaration lives, its state, the import that brings it
Claims
flash frontier- the open claims, the most rested-on first
flash frontier --take --as ID- lease the first free open claim for ten minutes
flash frontier --release NAME- give it back
flash frontier --refresh- re-check stale files, one at a time
flash frontier --retire NAME --why TEXT- retire a claim whose file stays
flash watch NAME --until STATE- wait until a claim reaches a state
The solution interface
flash si FILE.lean- each claim as the kernel holds it
flash si FILE.lean --to text- the text layer;
--to latexand--to leanlikewise flash si --project -o si/- every file of the project, one document a module
The installation
flash status- the project’s Lean workers, as one JSON line
flash down- stop every process of the pin, and verify it
flash self list- the installed releases (
self use V,self update,self gc) flash metrics- measure checks, searches and twins on this machine
flash help agents- how an AI agent should use flash
The judged line#
r7n is a second kernel, built into flash. For each theorem it judges the argument as a composition: the proof term, with every constant it uses taken as given and typed by that constant’s own statement. Its verdict is the judged line of the solution interface.
It runs by itself: once a module of a project checks clean, r7n judges its proofs in the background, and flash frontier counts the verdicts beside the claims. interface.judge = "off" turns this off, and flash si --no-judge leaves the line out of a .si. Lean stays the authority: no verdict changes a claim’s state.
| Verdict | What it means |
|---|---|
composed | r7n accepts the proof as a composition of the statements it uses, Lean checks it without unfolding a definition (instances and reducible ones aside), and no auxiliary declaration of the claim’s own carries part of it. An open claim composes through sorryAx. |
computation · WHERE | The argument needs a step Lean takes by computation: unfolding a definition, a recursor, a literal. WHERE says at what: the statement, a constant’s type, the proof against its statement, or a step of the proof. |
none · WHY | The argument could not be judged. Either it does not fit r7n’s fixed capacities (64 postulates in one context, 128 uses in one judgment, 64 KiB of postulate types, 512 levels of term depth), or part of it lives in an auxiliary declaration made by elaboration. |
The .si format and layers#
A .si is plain text: a header, then one block per declaration. A claim is shown only in a text that, elaborated again in the same environment and in a fresh scope, gives a term with the declaration’s own identity.
The header
| Line | What it holds |
|---|---|
si 1 | the format |
@module M | the module of the source |
@import A B | the source’s imports |
@pin P | the setup the claims were rendered in |
@goal TEXT | what the work is for, written by people and kept |
A block
A block starts with claim NAME, def NAME, axiom NAME, type NAME, decl NAME or gone NAME, followed by key lines:
| Key | What it holds |
|---|---|
id | the identity of the statement, 64 hex digits |
state | proved, open, reduced to A · B, error or defined |
twin | the index holds the same statement under this name |
for · assume · given | a data binder, a hypothesis, an instance binder |
show · is · value | the conclusion; a definition’s type and value |
rests · uses | the project’s theorems the proof uses; the library’s |
axioms | the axioms it depends on, or none; sorryAx means still open |
judged | r7n’s verdict on the argument |
note | what elaboration chose that the display can hide: truncated subtraction and division on ℕ, a coercion and its types, a numeral’s type, an auto-bound implicit, an instance synthesis would not find |
render | the rung whose text came back, or none |
because · tried · belief · decide | notes written by people, kept by identity |
stale | the statement changed since the notes were written |
The render ladder
flash tries each rung in turn, from the most readable form to the most explicit, and stops at the first whose text comes back as the same term:
| Rung | The text |
|---|---|
| 1 | Lean’s ordinary display |
| 2 | with Lean’s own analysis of what must be explicit to elaborate back |
| 3 | with the types of coercions and numerals |
| 4 | without notation |
| 5 | with every implicit argument |
| 6 | with everything: implicit arguments, instances, coercions, universes |
A claim no rung brings back is reported as render none, and its statement is not shown.
The four layers
| Layer | Command | What it is |
|---|---|---|
| .si | flash si FILE.lean -o FILE.si | the format above |
| text | flash si FILE.lean --to text | for a terminal: each claim’s state first, the statement as hypotheses over ⊢ |
| LaTeX | flash si FILE.si --to latex -o FILE.tex | a standalone document, for lualatex or xelatex |
| Lean | flash si FILE.si --to lean -o FILE.lean | each claim declared again, proofs left as sorry |
Without --to, the extension of -o names the layer, and without either, interface.default does. The Lean that --to lean writes is checked: a claim that does not come back is named, and the exit status is 1. Lean to .si to Lean is a fixed point: the second .si and the second Lean equal the third, byte for byte.
For AI agents#
flash help agents prints the contract for an AI agent proving theorems in a Lean 4 project.
flash which # the pin this directory uses, and the rule that chose it flash init # if the rule is not the project's workspace or its .flash-pin (once) flash help agents # the contract, and this project's section
What an agent can rely on
"proved": truemeans Lean checked it: no error, nosorry, only the standard axioms, and not using the goal itself. Nothing else is a proof."reason": "reduced"is not a proof. The goal follows from the lemmas in"reduced_to", which still have a sorry. Report it that way.- Checking is cheap once a worker holds a file’s imports, and a source checked before is answered from memory (
"memo": true). Check after every edit rather than reasoning about whether it will compile. - flash builds whatever a file imports that has no current build, so do not run
lake buildwhile you work, and do not runlake updateor change the toolchain.
The loop
- Look before you write:
flash twins FILE,flash find WORDS,flash type NAME,flash resolve NAME. - State the theorem and the lemmas it needs, each with
sorry, above it or in modules it imports. - Check with
flash check FILE --json, and fix errors before proving. - Prove with
flash prove FILE --json, which prints one JSON object a declaration;--writeputs the proofs in. - Act on each reason (Reading a result →). With several agents, take lemmas with
flash frontier --take --as ID --json. - Repeat until
flash check FILEshowssorries 0.
Exit statuses#
| Command | 0 | 1 | 2 | 3 |
|---|---|---|---|---|
flash check FILE or DIR | no errors | errors | could not check | |
flash prove FILE --decl NAME | proved | a goal open | refused | a goal refuted |
flash prove FILE | nothing left open | a goal open | refused | a goal refuted |
flash frontier --take | took one | nothing free to take | error | |
flash watch NAME | the state changed | the timeout passed | error | |
flash resolve NAME | known | not known here | error | |
flash si | every claim shown | a claim not shown, or Lean written that did not come back | error |
JSON#
| Field | What it holds |
|---|---|
ok | true when the file has no error |
sorries | how many declarations use sorry |
messages | Lean’s messages: pos ([line, column]), severity, text |
decls | each declaration: name, kind, axioms (with sorryAx among them, still open) |
memo | true when the answer was remembered |
environment | the pin, the imports, the libraries and their builds |
| Field | What it holds |
|---|---|
goals | each sorry: decl, pos, kind, goal as Lean prints it, verdict (proved, reduced, refuted, open), by, text (what replaces the sorry), rests, counterexample, extract, tried (each tactic: by, ok, ms, cause, error) |
decls | each declaration: name, verdict, goals, closed, axioms (from the re-check) |
filled | the source with every checked closure in place (what --write writes) |
changed | whether filled differs from the file |
errors_before, errors_after | the file’s errors before and after the closures were written in |
portfolio, jobs, heartbeats, wall_ms | what ran: the tactics in order, threads, each run’s caps |
The C search alone (flash prove --engine c) has its own JSON, 8.x’s flash search JSON.
| Command | Prints |
|---|---|
flash frontier --json | pin, the four counts, judged (r7n’s counts), frontier (each with name, where, rests_on_it, and leased_by when taken) and reduced_claims (each with reduced_to) |
flash frontier --take --as ID --json | take: name, where, by, until, rests_on_it |
flash resolve NAME --json | name, found, state, module, where, import |
flash watch NAME --json | name, from, to, where, when the state changes |
flash twins FILE --json | schema flash-twins/1: each declaration with its identity, statement and twins |
flash si FILE.lean --json | each claim as the worker answered it |