Using Lean for joy
I am using Lean to build two companies, in very serious industries.
At hestia.ai, we work on personal data and AI, where the questions are about people's rights and how they can exercise them. At StartClaims, we build claims software, where the questions are about evidence, rules and who gets paid what. In both cases, it matters that the reasoning is right, not just that it looks right. Lean lets us state the rules precisely and have a machine check that the code follows them.
That is serious work. But the same curiosity and the same skills can be pointed at play. So I have started lean-games, a small site of games and workshops whose rules are written and checked in Lean, to play with my kids.
What is in there
GraviTrax workshop. GraviTrax is a marble-run construction toy. The workshop lets you manage your pieces, draw or generate circuits, and then prove in Lean that the marble arrives. Each circuit is a theorem: the plan is valid, the pieces are in stock, and the marble that leaves the launcher always reaches a finish tile. You prove it with tactics that follow the marble, cell by cell. A generator can even propose circuits from a sentence, with Lean checking every wish.
GraviCut. A companion app for laser-cutting wooden supports for GraviTrax, calibrated to your wood and your machine. It does not use Lean yet: its formulas and its support design are the next things to be stated and proved.
Logic puzzles. Nurikabe, Nonogram and King Max, playable in the browser. The rules of each game are written in Lean. For Nurikabe, the rules, the checker and two solving tactics are proved: an untrusted search produces a certificate, a small program checks it, and a theorem shows that an accepted certificate means a solved grid. A catalogue lists every tactic with examples.
How it works
The rules of each game are propositions, and the programs that check solutions come with a theorem: if they accept, the statement holds. Tactics that are not proved yet are marked as such.
The same Lean code runs in two places. Compiled to WebAssembly, it answers the pages directly in the browser, with no server. For GraviTrax, a local server can also send proofs through Lean's full elaborator and kernel. The site itself, like this one, is generated with Verso.
Why bother
Because it is fun. Proving that a marble reaches the end of a track is a small thing, but it is the same gesture as proving that a claim is computed correctly: say exactly what should be true, then let Lean check it. Doing it with my kids is a good reminder of why I like this way of working in the first place.
Get new notes by email
Occasional notes on data, AI, rights and mathematics, sent when they are published.
A few emails a year. Unsubscribe in one click. Sent with Mailcoach, hosted in the EU.