For those of us who grew up on Gödel's incompleteness theorem, can someone explain how these kernels can prove their own consistency?
They can't — any kind of formal verification is always with respect to a TCB — but you can get pretty high assurance through making the TCBs smaller and smaller, and making multiple independent TCBs. The Lean community has done both. I think at this point the chance of there being an error is smaller than the chance that aliens show up in the next year or similar.
I feel like the real answer has gotten buried here, so I will answer my own question. The kernels are not "proven consistent" in any absolute sense. They are proven equiconsistent with ZFC plus inaccessible cardinals. This means it is "as consistent as everything else we have been doing for the last century," which is good enough.
I am sure you will get some more detailed answers; I am a bit lazy today; so I will give you the very high level / informal version of the answer (Edit from the future: It grew longer than expected, whelp :D):
Gödel's two incompleteness theorems basically amount to "As soon as your system can do a ridicolously little amount of things, then either of two things is true in this system: 1) You can express facts in your system that you cannot prove within your system or 2) your system claims that some false statement is true."
Now, because 2) is way way worse than 1), you design your systems so that you are firmly in the 1) camp - that way, we gain full confidence in the results our systems proofs, and the price we pay is that our system is less powerfull than it could be.
With Lean, it's similar. The foundation of Lean comes from type theory. There, we do something that is familar to above: We restrict our power (i.e. "which Lean statements do get verified by lean?", and we gain absolute confidence in its proofs (ignoring implementation errors, hardware limitations etc. for now). Intuitively: We have to work harder to satisfy the typechecker/prover, but when it is satisfied, then we have confidence in it.
-------------- Deeper down the rabbit hole
You might have noticed that I seem to muddle the waters a bit with programs, proofs, types and so on... There is a deep reason behind it! In a very strong sense, programs = types = proofs... So, here is how it is all connected (including the RH):
- Lean is a programming language (like Haskell, Rust, ... There is nothing stopping you from writing a server in Lean and deploying that binary somewhere in the cloud. Regarding developer experience, you could think of it like a modern Haskell without lazy evaluation and without its historical warts)
- programs can be tied to types: We first check if the whole program as such has a type ("do all of its parts fit together in a strictly defined way?"). Only if it does, we proceed (and for example, run it). If it does not, then the compiler declares "this program is not good! here is a type error!". Now, here is the price hat Gödel proved we cannot avoid (if we want to trust the typechecker): There are programs that don't type check, but behave perfectly fine at runtime. (That's the "we limit our power" part - those are perfectly good programs where the compiler throws their hand in the air and gives up!)
- Enter the third puzzle piece: proofs and the Riemann Hypothesis: turns out, we can think of types as theorems, and a successful type check as a correct proof! And the RH is a hypothesis we would like to prove...
- So here is how it all ties together: RH is written so that it can be used as a type, in the Lean programming language. The "main program" is basically just another ordinary function with some input types, and returns the type version of the RH being true. Because the function needs an implementation, we are forced to implement that function body - which are many small functions that correspond to mathematical theorems/lemmas if you look at it with the proof glasses on. From the programming pov, it is just functions that call functions that call functions and so on. And from the typechecking point of view; we compose a bunch of functions and check whether input types and output types match up.
Finally, the payoff: *If that program typechecks, then we know RH is true*, which is what just happened!
(PS: The same principle is behind the computational proof of the four-color-theorem. The proof of the four color theorem is "simply" a program that typechecks, where the final type happens to correspond to "can we color any planar graph with at most 4 colors?")
-------------- Further reading
If you want to read up more about this, here would be some sources (note: I am not up to date with how the cool kids these days learn about this topic; so there might now be better resources to learn from!):
- Here is how I learned about it first: https://existentialtype.wordpress.com/2011/03/27/the-holy-trinity/
- wiki: https://en.wikipedia.org/wiki/Curry%E2%80%93Howard_correspondence
- "That's all cute and stuff, but basically fast food for me, give me the good stuff!" okay, okay! how about...
- tying quantum physics, topology, logic and computing together? https://math.ucr.edu/home/baez/rosetta.pdf
- anything on the nLab (a wiki/community(?) that collects and explores those kinds of things... nerds, I tell ya (no, I am not envious at all, naaaah)). For example, this page is about the relation between logic and types: https://ncatlab.org/nlab/show/propositions+as+typesThey don't - the lean kernel isn't written in lean.
They prove its consistency relative to another mathematical theory we assume to be consistent. That is if that mathematical theory is consistent then so is the kernel. In the case of Lean's con-leche and con-ron, it is proved consistent relative to ZFC + infinitely many inaccessible cardinals.
ZFC + infinitely many inaccessible cardinals is a fairly weak extension of ZFC widely thought by set theorists to be consistent. This is especially the case if ZFC is consistent (although by Godel we can't know for sure!).
ZFC + infinitely many inaccessible cardinals being inconsistent would be a really big deal! Given how confident set theorists are about inaccessible cardinals most likely it would mean that ZFC itself is inconsistent.