2025-09-18
TL;DR: I tried to learn the fundamentals of the Lean programming language. This was mostly fun but also increasingly frustrating and confusing. I found the language itself to be accessible, but as I dug further into Lean’s proof assistant features, I realized that I don’t actually have that much training in formal systems. To make more progress, I’ll need to step back and learn more about how to write proofs in the first place before being able to write them in Lean.
This is a lot different from my usual projects because I didn’t really build anything, and the little snippets of code that I did write were only incidental to the explicit goal of exploring Lean. Nominally all my projects are firstly about learning new things, but I usually balance the discomfort of learning with the desire to complete a specific project. That didn’t seem feasible in this case because Lean and its surrounding concepts are quite far from what I normally work on. I figured it would be better to take some pressure off and just try to pick up some basics.
I won’t (and can’t) give many details about what I tried to learn because they’re all in the various sources that I’ve linked below, and in any case my incomplete understanding is less valuable than the original texts. Still, if you think your brain might be similar to mine, you might benefit from my opinions on the sources themselves. Between every source and student there is a boundary which can be viewed as an impedance discontinuity, and if the mismatch is substantial then most of the knowledge will be reflected instead of transmitted. I’ve found it important to identify sources (and modalities) that present new ideas with minimal impedance mismatch to my mind. In other words, a Lean text that’s meant primarily for mathematicians is much less valuable to me than a similar text meant for programmers. Explanations that index into the receiver’s existing knowledge tend to stick better.
Here are the sources I poked around in, listed in descending order of value. I didn’t fully consume any one of these, and I certainly didn’t find them in this order. Instead, I jumped between them as my wandering interest dictated.
playground.lean
file open in VS Code
with the recommended extension. Try stuff out, and do the
exercises.\a
to get
.
Hovering over symbols will also tell you, but sometimes you can’t get
the symbol to appear somewhere in the first place.I will say that Lean presents a tantalizing world that I want to explore further. Encoding propositions as types is beautiful, and the few times I got something simple to work in Lean gave me that feeling of having made a sublime and indivisible object, like a perfectly formed ball bearing. I can see why some people devote their careers to chasing that. Formal verification has seemed like distant magic to me since I first heard of it, but over the years I’ve developed the opinion that I can learn anything given enough time and effort—assuming it can be learned by anyone at all. I doubt I’ll become a master of formal verification or even use it for anything in particular, but it just seems cool, and that’s enough for now. ∎