A new proof interface for Lean 4.

Paperproof vscode

Paperproof will inspect how the hypotheses and goals were changing throughout the Lean 4 proof, and display this history - making it equivalent to how we think of a mathematical proof on paper.

We created a few videos about Paperproof:

Here you can read about Paperproof in context of other proof trees:

And here you can read how Paperproof analyzes Lean's InfoTree to build the trees you see in the user interface: link.

In the following tables, you can see what tactics such as apply, rw, or cases look like in Paperproof; and how Paperproof renders real proofs from well-known repos.

Common tactics
Lean Paperproof


theorem apply (a b: ℝ) : a = b := by
  apply le_antisymm


theorem have (a b: ℝ)
(h1: a ≤ b) (h2: b ≤ a) : True := by
  have hi := le_antisymm h1 h2


theorem intro
: ∀ (N: ℕ), ∃ M, N + N = M := by
  intro n


theorem rw (a b: ℕ)
(h1: a = b) : (10 * a = 666) := by
  rw [h1]


theorem by_contra (m: ℕ)
: 2 ≤ m := by
  by_contra h


theorem use
: ∃ x: ℕ, x = 5 := by
  use 42


theorem induction (n: ℕ)
: Nat.mul 0 n = 0 := by
  induction' n with k ih


theorem casesN (n: ℕ)
: Nat.mul 0 n = 0 := by
  cases' n with m
theorem casesAnd (A B C: Prop)
(h: A ∧ B) : C := by
  cases' h with a b
theorem casesOr (A B C: Prop)
(h: A ∨ B) : C := by
  cases' h with a b
inductive Random where
  | hi: ℕ → String → Random
  | hello: (2 + 2 = 4) → Random 
  | wow: Random
theorem casesRandom (C: Prop)
(h: Random) : C := by
  cases' h with a b c
Full-fledged proofs

Mathematics in Lean (Jeremy Avigad, Patrick Massot)

Mathematics in Lean - Paperproof


Mathlib - Paperproof

Hitchhiker's Guide to Logical Verification
(Anne Baanen, Alexander Bentkamp, Jasmin Blanchette, Johannes Hölzl, Jannis Limperg)

Hitchhiker's Guide to Logical Verification - Paperproof


  1. Install the "Paperproof" vscode extension (link).

  2. [TEMPORARY STEP] Downgrade "lean4" vscode extension to version 0.0.144


    Explanation: Paperproof depends on lean4 extension in order to avoid loading your computer with excessive Lean server instances; however lean4 api regularly updates in a way that introduces breaking changes, resulting in a blank screen in Paperproof. Hopefully their api stabilizes soon and we can remove this step, but at the moment - please downgrade lean4, and turn off automatic extension updates for lean4.

  3. In your lakefile.lean, write:

    require Paperproof from git ""@"main"/"lean"
  4. Then, in your terminal, run:

    lake update Paperproof

    Note: if you're getting "error: unexpected arguments: Paperproof", it means you're on the older version of Lean, and it doesn't support per-package updates. In that case, just run lake build.

  5. In a Lean file with your theorems, write:

    import Paperproof
  6. You're done!

    Now, click on the paperproof icon (after you installed the Paperproof extension, it should appear in all .lean files), this will open a Paperproof panel within vscode.

    You can click on any theorem now (well, only tactic-based proofs, those starting with by, are supported now) - you should see your proof tree rendered.


If you worked with formal proofs before, you might find Paperproof most similar to proof trees/Gentzen trees. The resemblance is not spurious, we can easily mimic Semantic Tableaux and Natural Deduction trees with Paperproof. All of these interfaces show "the history of a proof" - the way hypotheses and nodes were changing throughout the proof.

Unlike Gentzen, we can make use of css and javascript - so there are many visual syntax sugars on top of what would be a formal proof tree:

  • hypotheses aren't repeated when used multiple times,
  • goals and hypotheses are visually differentiated,
  • variable scopes are shown as darkening backgrounds,
  • available hypotheses are indicated via node transparencies,
  • and so on.

Below, you will see a table with the main features of Paperproof.

Paperproof walkthrough
Lean Paperproof
Hypotheses are displayed as green nodes, goals are displayed as red nodes, tactics are displayed as transparent nodes with dashed borders.
image image
A proof should be read "towards the middle" - so, hypotheses should be read from top to bottom; and goals should be read bottom up.
image image
If you dragged tactic/goal/hypothesis nodes around, you would see arrows; however we stack these nodes on top of each other and collapse these arrows into invisible "0-length" arrows for cleaner UI.
Opaque nodes represent a focused goal, and currently available hypotheses.
In general - slightly darker backgrounds denote variable scopes - you can only use hypotheses that are in or outside of your scope box, you can never dive into another box. Don't overthink this however, we'll always highlight the available hypotheses as you're writing the proof, consider backgrounds a visual hint that will eventually become second nature.
To zoom in on a particular dark box, you can click on it.


To update Paperproof, you only need to rerun lake update Paperproof. This will fetch the newest version of the Paperproof Lean library from this github repo, and build it.

Vscode extensions are automatically updated, however you can check for new updates with
cmd+shift+p => "Extensions: Show Extension Updates".

Paperproof is a package that's usually only used during development, so you might want to remove it from your lakefile.lean when you're pushing to production. In order to do that, just remove the Paperproof require from lakefile.lean, and run lake update Paperproof. This will clean up lake-manifest.json and lake-packages for you.


You're welcome to contribute to Paperproof, see the instructions in