R7N for Lean 4
Formal made faster
The Lean Environment Navigation System (LENS) and its flash CLI work beside you in Lean 4. They check your files as you write, find the proofs they are missing, and can write them in for you. Lens Flash can only ever tell you what Lean’s kernel has checked.
Welcome to Lens Flash.
We’re glad you’re here. LENS is a companion for working in Lean 4, and flash is how you talk to it: it checks what you write, finds the proofs you’re missing, and can write them in for you.
Two commands are all it takes to begin.
The first installs it. Paste it into a terminal:
curl -fsSL https://r7n.solutions/install.sh | shThen, in a new terminal, this one sets everything up and takes you to your first proof:
flash startWhat flash does
Each is a single command, shown with what flash prints, trimmed a little.
-
It proves, and Lean decides
Where your file has a
sorry, Lean’s placeholder for a missing proof,flash proveruns Lean’s own tactics in the warm worker that checks the file —grind,simp,exact?,aesop,omegaand the rest of the portfolio, several at once — and then the C search on whatever is still open. A proof is reported only when the file with it written in checks again with no error, nosorryleft and only the standard axioms. A goal nothing closes is reported open, with what is left; a false one is refuted.flash prove Chain.lean4:2 proved double_pos by grind [double] 7:2 proved c_two by grind [double] 10:2 open not_always Chain.lean: 3 sorries — 2 closed, 0 refuted, 1 open (3.5 s, 4 threads); --write writes them
-
Proofs build on each other
The sorries in a file are searched from the top down, and each search can use the theorems above it, including the ones it has just proved. Here
c_twois proved with the project’s lemmadouble_pos, and thenc_fourfollows fromc_two.Chain.lean, as writtenflash prove Chain.lean --writetheorem c_two (m : Nat) (hm : 0 < m) : 0 < double (double m) := by apply Nat.add_pos_left <;> (apply double_pos <;> assumption) theorem c_four (k : Nat) (hk : 0 < k) : 0 < double (double (double (double k))) := by apply c_two <;> (apply c_two <;> assumption)
-
You always know what is left
When a goal follows only from lemmas that are not proved yet, flash names them, and never calls the goal proved.
flash frontierlists what is left to prove, the lemmas that most of your work rests on first. Once those are proved, everything waiting on them is proved without you asking.flash frontier… open doc_h1 DocH.lean open doc_h2 DocH.lean …
-
Every theorem, as the kernel holds it
flash sishows each theorem of a file as the kernel holds it: its hypotheses and its statement, in a form that elaborates back to exactly the term Lean checked, what its proof rests on, and any other theorem with the same statement. It writes the solution interface (.si), and the same as text, LaTeX or Lean.flash si Chain.lean --to text… proved c_two the same statement as doc_a m : Nat hm : 0 < m ⊢ 0 < double (double m) rests on double_pos …
-
Many agents can share a project
Programs working in one project share its Lean workers and everything Lean has already answered.
flash frontier --takegives each agent a different lemma to work on, andflash watchreturns the moment a theorem you are waiting for is proved.flash frontier --take --as agent-1took doc_h1 (/path/to/project/LeanOnly/DocH.lean) for 10 minutes; 0 rest on it
How a session goes
You set a project up once. After that it is a short loop: write some Lean, check it, let flash prove what is missing, and go again.
-
Set the project up
Once.
flash startgets Lean if you need it, makes or finds your project, and sets flash up; in a project you have already built,flash initdoes the last part.flash start -
Check a file
You get Lean’s own messages. The exit status is 0 when the file has no error; a sorry is only a warning.
flash check Work.leanok errors 0 sorries 3 … ms exact Work.lean:3:8: warning: declaration uses `sorry` -
Prove what’s missing
flash runs Lean’s tactics at every sorry, then the C search on what’s left, and Lean checks each proof with the whole file.
--writeputs them in.flash prove Work.leanWork.lean: 3 of 3 proved (w_add, w_double, w_append); … s
To try it from nothing, step by step, follow Get started →