I don't know Lean..
But looking at the code, I can't help but wonder:
Who on Earth can understand that ?
Random example: https://github.com/lsernau/grh-lean/blob/main/grh-compact/sr...
Genuine question for people who know Lean: How realistic is it for a human to read this code, 'grok' it and verify that it is correct ?
Most of the hard-to-grok code there is proof bodies rather than theorem statements. Assuming you can parse the statements, you can follow the proof pretty loosely and reconstruct it yourself. Such is the tradition in math generally
Plus, these proofs are actually quite tame compared to human-written Lean proofs.
> How realistic is it for a human to read this code, 'grok' it and verify that it is correct ?
You don't need to verify any of this, but for the final theorem statements. That's the point of formal methods.
This is just programming
To properly understand a proof you need to run it interactively (or at least I do), which is kind of running in a debugger
I mean the here's the gist of what takes to understand a proof
To prove a theorem in Lean (or similar theorem provers; I'm actually more familiar with Rocq) you have goals, which are the things that are left to prove. The "main goal" is what you want to prove right now, and the other goals are other things you also need to prove
When the list of goals becomes empty, you have proved the theorem. You start with a single goal: the theorem itself
It proceeds like a game. Depending on what the main goal looks like, you can eliminate it calling some piece of code (there's more to it but let's say it's a tactic). But more often than not, eliminating a complex goal just pushes more, hopefully simpler goals into the goal list. So you need to be, well, strategic in what tactics you employ - you need to go into the direction of making things easier to prove, not harder
So what looks like to run a proof interactively? You can go through the proof step by step, all the while you observe how the goal list changes. That's analogous to run a C program in a debugger, watching the local variables of each stack frame
Ok so that's how you (or at least I would) understand a proof - run it interactively, which is like watching a professor write down each step of the proof in a white board, all the while she carefully keeps track of what's left to prove
But anyway. The innovative thing about theorem provers in general is that to verify a proof you run a program (a kernel) which is just a trusted type checker. Unfortunately the official kernel is written in C++ and agents found bugs before (that made the kernel accept theorems that were false). However, there's multiple kernels, so if all of them type checks the proof (and the proof doesn't contain stuff like "sorry", which means it's not proved at all), there's a high confidence in the result
Besides this being the compact version, a decent chunk of it (typically everything after the first `by` in each declaration) is proof tactics, which are not really needed to verify that it's correct because they're mechanically checked by the compiler.
Just for your reference. you linked to the compact version
https://github.com/lsernau/grh-lean/blob/main/grh/src/New/Up...
This is the non-compact 'Human Readable' version. Still pretty intense!
For me, this is more readable than many "human-language" paper proofs.
I don't understand the math or logic here, but the syntax is not half bad.
Code in the sciences often looks like that. You have to have domain-specific knowledge to read it and there's no escaping that.
>How realistic is it for a human to read this code, 'grok' it and verify that it is correct ?
Data presented this way isn't simply read and understood, it often has to be studied.
The grh-compact version is not very readable (it is deliberately minimized), I'd read the 300kloc version in the grh folder instead, which looks fairly clean to me.
This is nearly as ugly as ABAP, only misses the comments in German
Something that I wonder where is the "eureka" part of this proof, or perhaps the top 10 "eureka" moments.
Lean syntax is alright. You can get used to it. The hardcore part is the jargon.
> Scaled Hecke operators repair divisibility at inert primes pairing tops
Literally every word here has a precise definition. Probability takes forever to get an intuition for all of that. But that's always the problem with math.