← Interactive tools

Lean Grimoire

A proof-crafting game. Combine the statements you already hold — the potions 🧪, each a proof hA : A — with the recipes (Lean-named laws) to brew new statements, until you craft the goal. A live Lean proof assembles itself in the spellbook as you play. A rebuilt, Lean-flavoured descendant of the QED game.

Map — progression tree
Achievements


    
How to play

Select one or more potions on your bench; the recipes light up with the statements they let you brew from that selection. Click a brew to add it to your bench — and watch the corresponding have appear in the spellbook. Craft the goal to finish the proof (the sorry turns into the final step). Undo steps back; names like hAB are auto-chosen but the objects and their types are kept typographically distinct. The Lean produced is deliberately plain, step-by-step pseudo-Lean — the point is to see the proof being built, not to write the slickest tactic.

On the scroll shelf you can write any formula the level can use, with backslash shortcuts for the symbols: \and, \or, \to, \not, \iff, and from Chapter 11 \forall and \exists, each expanding on space or Tab. A quantifier is written as Lean writes it — ∀ x : Ω, P(x), or ∀ x, P(x) to let the level's own sort be understood, or ∀ x y, Q(x, y) for two at once. The plain words work as well, whichever notation the rest of the page is showing: for all x, P(x), exists x, P(x), A and B, A implies not B all parse. The ∀ and ∃ buttons beside the shelf type the glyphs for you once a level can use them.

The ★ tutorial levels — 1.1, 2.1, and so on up to 20.1 — each introduce one new mechanic, and each carries a hint under the goal naming the first move to make. Every practice level in between has one too, but keeps it behind a 💡 Hint button: knowing instinctively why something is true is not the same as seeing which moves will get you there, and the hint says what the shape of the proof is without saying how long it runs.

Each level also shows the length of the shortest proof known to the game, in moves, beside the count of the moves you have made. Matching it rims the level gold on the map; coming in under it turns the level gold — and means you have found something better than the proof this game was built around, which is worth telling me about: a shorter proof that is sent in becomes the one the game knows, and is credited beside the level it belongs to. Thirty-nine of the lengths below are a reader’s rather than mine already — a quarter of the game. One cut a proof from eight moves to three, another did a congruence in five where I had taken eight, and a third proved that the inverse of an inverse is the thing itself in five moves against my twelve. The spellbook shows the proof three ways: Lean alone, the informal reading alone, or — as it opens — both, each step read in words on the line above the Lean it produced. Clicking a line that opens a sub-proof folds it, as an editor folds a function. Copy and Save export what the “both” view shows: a file that is a proof in words and a Lean file at once, and compiles on There is no import line — Lean 4 takes Init by itself, and nothing here needs Mathlib — but solving a lemma mints it as a recipe, so a proof that uses one carries your proof of that lemma along with it, and the chain can run deeper than the proof you just finished.

↗ Playground sends the same text to the Lean 4 web playground, which is the real thing: Lean itself, compiled to run in your browser. That is the place to find out what this game will not tell you — what Lean says when a proof is wrong. Move a bracket in a statement, drop a hypothesis, swap And.left for And.right, and read the error. Nothing here can be built malformed, by design; over there everything can, and the error messages are half of what using a proof assistant actually is. The proof travels inside the link, after the #, which browsers keep to themselves — it is not uploaded anywhere, and this page still makes no network request of its own. It is also the one button that leaves the game.

What this app is not

This is not a full Lean tutorial, and it teaches only a small subset of the available Lean tactics. In particular, the powerful ability of Lean tactics to modify the goal is completely untapped here: every move works forwards, from what you already have towards the goal, whereas real Lean proofs freely work backwards as well. The automation that does most of the work in practice — simp, omega, decide, exact?, and the rest — is absent by design, since the point of the game is to perform each logical step yourself.

For the same reason, the Lean written out as you play should not be taken as an indication of best practice for idiomatic Lean code. It is deliberately plain and step-by-step so that the shape of the proof stays visible; an experienced Lean user would write most of these proofs in a line or two. To learn Lean properly, start with the Lean community's learning resources.

If what you want is another game rather than a textbook, the Lean Game Server runs several — the Natural Number Game is the usual place to start. They are played in real Lean, so the kernel itself checks each step, and the tactics you type are the ones a Lean user really writes.

Numbering, and the relation to QED

Each chapter here is one mechanic: chapter N opens with exercise N.1, the level that introduces the mechanic, and the rest of the chapter is practice that needs nothing newer. So the twenty tutorial levels are exactly 1.1, 2.1, …, 20.1, and an exercise never depends on a higher number than its own.

That numbering is Grimoire's own, and it does not follow QED, whose sections are organised by topic instead. Where a level descends from a QED exercise it says so under the goal — and says when QED states the same thing differently, which is usually QED's assumption environments where Grimoire uses an implication, or its group-theory sections, which carry the axioms as hypotheses where Grimoire puts them in the theory of the sort. QED's own sections on free variables and on "push"/"pull" have no counterpart here: Grimoire makes no distinction between free and bound variables, so those moves have nothing left to do. Some chapters are new, and about a fifth of the levels have no QED ancestor at all.

Written up at “Lean Grimoire” (What’s new, 11 November 2026) — playtesting reports, and shorter proofs than the ones the game knows, are welcome in the comments there.

The applet source is released under the MIT license; the mathematical content is reserved.