TLA⁺ model checking has a pretty good abstraction where you don’t really need to know how it works to use it, but any curious person will eventually want to know more. For those of you so inclined, I wrote this tutorial on how to create your own TLA⁺ tools! The tutorial is an attempt to distill my knowledge gained from working on the TLA⁺ tools the past few years. By working through the tutorial, you will learn the basics of lexing, parsing, interpretation, and finally finite-state model checking for the TLA⁺ formal specification language. It will prepare you for writing advanced TLA⁺ specs, reasoning about their model checking performance, and even contributing to the TLA⁺ tools yourself. Finally, you will end up with a minimal TLA⁺ model checker of your own which is easy to extend with fun new experimental features!
I started writing this tutorial in mid-2025 and only recently completed it after a long hiatus. It was all conceived & written entirely by hand without LLM involvement, although LLMs were eventually used for final validation & bug-checking. I wrote most of the tutorial as a sidequest while on a generous grant from the TLA⁺ Foundation - grateful to them and their sponsors!
The tutorial format
The tutorial is in the “create your own X” style where you are guided through writing your own model checker. In this way it resembles a literate program, but you also see the program in primitive stages of completion instead of only reading through the final product. The presentation thus takes the form of a stacked series of program diffs interspersed with explanatory text which ultimately produces a working model checker.
The tutorial is a wrapper around the excellent free online textbook Crafting Interpreters by Robert Nystrom. The TLA⁺ tutorial chapters generally correspond to Crafting Interpreters chapters, diverging more & more toward the end. Motivated learners might want to skip my tutorial and only read Crafting Interpreters, adapting it to a TLA⁺ model checker of their own! Thus my tutorial can just be used as an answer key to the puzzle of how to make a very minimal TLA⁺ model checker, a puzzle you can experience the pleasure of solving yourself. I think I came up with quite a nice solution, and it went through many iterations in pursuit of simplicity.
The tutorial is hosted on https://docs.tlapl.us, the “standard” TLA⁺ documentation wiki. I put standard in quotations because that’s what the wiki was planned to be in early 2025, but it hasn’t necessarily panned out. The tutorial seems like a better fit for a static website using mdBook or Sphinx instead of a wiki, so I might adapt it if docs.tlapl.us continues to languish.
Request for feedback
This tutorial has seen some amount of review by others, but if you work through it yourself I would love to hear from you about the following questions:
- Is it compelling? Or do your eyes glaze over and you lose motivation as you copy code back and forth between the tutorial and your editor?
- Does its status as a wrapper around Crafting Interpreters hinder its effectiveness? The tutorial often asks you to read through a chapter of Crafting Interpreters, and then the tutorial presents how that chapter would be adapted to TLA⁺. Does that add enough to make this tutorial worth it?
- Does the wiki format inhibit your immersion? I can’t be the only one who has an odd aversion to reading long-form wiki text; I can’t even say why this is, particularly. Perhaps it is the accretive nature, the cobbling together of many voices. Should I switch to mdBook or Sphinx sooner rather than later?
- Are there any TLA⁺ language topics you wished would be covered which were not?
Any other free-form feedback is also helpful!
What was the point of making this
Okay look, we are at the end of 2026 and I’m not going to pretend things are the same as mid-2025 when I started writing this tutorial1. I thought about spilling my various ruminations here about how professional technical education content is basically dead, but nah2. I’m happy I spent the time to finish this tutorial. I finished a thing I started and have a fun minimal TLA⁺ model checker to show for it! You’ll either grant this tutorial a slice of your time in the Great Attention War or you will not. If you do, I hope it brings you the enjoyment of understanding.
Future extensions
I did originally plan to extend this tutorial with a presentation of liveness checking & perhaps even formal proof checking. I think that is unlikely to ever happen, but certainly TLA⁺ liveness checking needs to be documented somewhere central - it is scattered across a number of textbooks and papers, which I have read but not yet distilled. So I think the future role of this tutorial model checker will mostly be as a test-bed for prototyping new TLA⁺ language features, such as:
- Monotonic datatypes
- Checking machine closure of fairness formulas
- Checking reachability properties
- Functioning as the oracle of a linearizability checker
Plus others, I’m sure. Anyway, I hope you find the tutorial useful! It starts here and the chapters with source code can be found here.
-
No fewer than four vibe-coded TLA⁺ model checkers have been posted in the past few months (1, 2, 3, 4). ↩︎
-
Constrained to a footnote: beyond the inability of static content to compete with an interactive tutor able to present things at exactly your level & patiently indulge every digression, understanding how things work previously had both instrumental value (I have to understand how this works because it’s the only way to make it work) and some kind of spiritual value (it is virtuous to understand how things work). The instrumental value has been substantially weakened, and in my more cynical moments I start to think the spiritual value was just a society-wide psyop to encourage production of capable engineers. ↩︎