Why should it? Do we award prizes to calculators for being able to multiply numbers with high precision and speed? I don't understand anthropomorphising token prediction that is hooked to an interpreter (i.e. some tokens cause some tool execution)
I am not in the front row, but what you say alligns with how I would assume things play out, unfortunately (and short-sightedly; how easy would it have been to not antagonize the mathematical community, i.e. by redirecting a few 10M$ into scholarships, conferences etc... also maybe 1-2 fulltime positions that focus on human-LLM-collaboration as in "how can we this new technology to increase understanding?", which seems to still be an afterthought for the big AI companies...)
Slightly related: I am fairly confident that we can let LLMs loose on those 17M lines of code with the instruction to refactor the heck out of it: Instead of "optimize that program so that it runs faster" (which AlphaCode did to great success already), the task would be "optimize that program so that it uses less theorems" etc... which is a very easy-to-verify task, since we after each refactor, the end result will never change! I predict that 1) this will be done more; once this first wave settled down a bit 2) this too might be a way to help us (humans) discover and understand new mathematics. For the LLM, it might have been just a boring ordinary code refactoring by extracting some common code out; for mathematitians, this might actually correspond to a deep connection between two areas.
Which is pretty cool IMO, it's basically an army of statistical parots that mine abstractions all day, and they only can succeed because at the end it is still the same outer lean statement being checked (we just rearange some stuff under the hood)
Yes, absolutely. You might take part of your big proof and extract it out in a named lemma. Then you might find that if you strengthen this lemma a bit, you can suddenly use it a multiple places in your main proof (the analogy here to programming and extracting things into generalised functions should be obvious). But you might also take whole subparts of your proof and prove it in a different ways, but as long as the assumptions and conclusions (input / output) stays compatible, it does not need to change much in the main proof.
I am 100% sure that yes, it's just not mainstream yet. (Why? Because lean proofs are computer programs)
----------------
The big caveat: This is only if the proof is formulated as a computer program, which is the case here with the Riemann Hypothesis proof. (Lean is a general programming language; and every "proof formalized in Lean" is also a Lean computer program.)
Much of mathematics is not yet formualated in such way (although much progress was made by countless contributions of researchers and amateurs in the last years, both in Lean but also in other proof assistants. Lean seems to become the de facto standard though, but I am watching from the sidelines, so take that with a pinch of salt please)
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+types
So while I'm not going to question if that's good approach, because if it's so popular, it must be good enough.
But on intuitive level it looks so weird to encode math in types.
When I was taught math, the proofs were more like sequence of statements. So if I would decide to implement proof checker, I'd invent formal language, which looks very close to commonly used math language and which allows to just write proof like it's written in book. Probably a lot more verbose, without skips and implied statements, but in the end, it'd look just like a verbose and formal proof.
Why did math gone this lean type way and not the way I described?
This is a very good question! There are two answers.
First off, you can absolutely do what you are describing. There are systems like Metamath that assume nothing beyond first-order logic and the axioms of set theory, and apply these verbose rewrites. See https://en.wikipedia.org/wiki/Metamath for more. However, Lean (and many past theorem provers, too) have 1) preferred to represent mathematical objects as types rather than sets, and 2) built a large amount of interactive tooling rather than the blind rewriting of Metamath. The first choice is essentially of elegance -- the Curry-Howard correspondence indeed lets you write propositions as types and proofs as terms inhabiting those types, which is a connection of deep beauty. Ontologically, there is also an argument to be made that representing a mathematical object as a type is more "correct". We don't really think of ex. two as "{{},{{}}}" or "{{{}}}". We think of it as "Two", or maybe "Zero +1 +1". This is a win for types. Mathematical objects are not grocery bags.
Second, the historical approach to theorem proving has been interactive theorem proving. Theorem provers were supposed to be a second brain for students and computer scientists and mathematicians... keeping track of assumptions, suggesting possible tactics to take... aiding the human in the process of proof (and subsequently understanding), rather than replacing them. The path of uncritical adoption of AI that Lean has taken, sadly, much replaces the human. There is no real pragmatic reason for Lean to retain its interactive (human) elements any more (besides inertia) as AI scales up. It might as well be Metamath, indeed.
Lean also does a lot of things under the hood that make the process of checking a proof tricky, (but make writing the proof easier), it strikes me that maybe in 2026 we should be making writing the proof a bit harder at the expense of making reading the proof easier.
Agreed. The formal proof field has not focused on readability. E.g., Lean and Coq both use the opaque term “intro” instead of the more readable “assume”.
There are proof systems like you describe. Mizar was created in the 1970s and was still being used in the 2010s. Its proofs resemble those from Euclid’s Elements from 300 BC that you were taught.
The answer to “why use type theory in Lean” is that math developed. When Russell and Whitehead tried to prove everything from axioms in the 1910s, they ran into a paradox. To avoid Russell’s Paradox, they created the first Type Theory.
Since then, the field of Proof Theory developed. It found the Curry-Howard Correspondence, which connected logic, programming and Type Theory. In parallel, computers became popular. Some programming languages’ type systems were based on Type Theory.
So, when it came to writing new provers, computer scientists were familiar with Type Theory and Proof Theory had show that it was a simpler and more powerful foundation.
The main issue is on how you define a "Type". There are two different logics here;
1) Classical Logic/Set Theory (this is the one you are talking about). Here Type = Set of values defined by membership rules (extensional/intensional).
2) Intuitionistic Constructive Logic/Type Theory (this is what is preferred for proof assistants). Here Type = Set of constructive (often inductive) proofs where the proof itself is the value.
As an example, think of defining the Type "Even_t"; under (1) it can be a predicate "x % 2 == 0", while under (2) it is defined inductively as "0 is Even_t; if construct(n) is Even_t so is construct(n+2)".
Notice that in the latter case a Type maps nicely into the idea of "a computation" and the fact that the very act of generation of one of its inhabitants constitutes "the proof" that the value has that property!
Whereas in Set theory Types are just subsets. But because you can mix anything into a set, an untyped term can be nonsense and will only get caught when you try to use it. Type Theory disallows it by construction.
This idea of "Typing" can further be extended (with additions of Dependent Types etc.) giving a complex matrix of powerful Type Theories represented by what is known as "Lambda Cube" (https://en.wikipedia.org/wiki/Lambda_cube) and their implementations in proof assistants eg. Calculus of Constructions (CoC), Calculus of Inductive Constructions (CIC) etc.
Finally, note that not all proof assistants use constructive logic, several use straight ZFC/HOL. Amongst those that use constructive logic it is usually only the kernel (containing the Type System) which models it while the rest of the system still uses classical logic.
> When I was taught math, the proofs were more like sequence of statements. So if I would decide to implement proof checker, I'd invent formal language, which looks very close to commonly used math language and which allows to just write proof like it's written in book. Probably a lot more verbose, without skips and implied statements, but in the end, it'd look just like a verbose and formal proof.
Yes, one can build it, and it's a hell of a lot more verbose:
sorry for the AI slop readmes, etc. This is very much a side project and I don't really feel the need to necessarily clean it up unless someone takes a real interest in it.
If you want to see it "in action" a bit more topical, here is a swing at verifying the logical framework of the other RH poof (turned out that as published, there is an obvious error):
To add to the other answers, let me address the experience of "a series of steps" versus "a big single expression with a type" - real life is calling, so I have to make this quicker than I would like to; feel free to ask any followup questions / for clarification! I am sure others or later, I when I am back on the screen can answer :)
So the very short version: There is no difference between those two worlds if you squint your eyes hard enough! They are equally powerfull; just different ways of expressing the same truth. This is the whole declarative ("WHAT should the end result be") vs. implerative ("HOW to achieve the end result")stuff, but it's all the same at the end. Some examples:
- SQL is declarative; but under the hood, it will get translated to a sequence of operations on the database by the query engine (or however it's called)
- HTML is declarative; but there is no theoretical reason stopping you from building some sort of "imperative" HTML where you just add elements and stuff in a sequence of steps and at the end; are shown the same webpage (in fact, there are GUI frameworks that build up the GUI in an imperative manner; for the web, transmitting a declaration of what you want rather than a program that constructs it was the more practical choice I assume)
- Haskell is often considered declarative (for good reasons), but if you think about the IO type as ("Hey I am a wrapper type and all I do is to enforce that step A happens before step B"), then you are pretty close to a imperative way of doing things again
- Go/Java/C#/Python with types are almost always considered imperative; but you can also put on the type checking hat and pretend that the program is just one big function that will - if written correctly - have a final type. How does composition happen here? It's basically the line break, line :103 is executed before line :104, so lines :103-:104 can be viewed as: "the function that does whatever :103 does, then whatever :104 does", and it has the type "whatever input type :103 has and whatever input type :104 has", and type checking ensures that all those pieces fit together neatly.
They can even be mixed; in the proof assistant Rocq (formerly known as coq), there where both styles used often. In Lean, as I vaguely remember, you can pick both style too, so to say.
I think the pragmatic answer is that most such languages originated from the "one big function" school, and so it is more natural to program/proove in that way.
---------------------------
*Wait, does this mean that every proof I learned can also be done in this "one big function" way, instead of "a series of steps"?*
Yep! But you will find that it is not really practical to do so. A good exercise for sure though; and something I did (by that I mean: infering types on paper; not really taking proofs I know and doing them be type inference on paper) by hand when diving deeper into this topic in grad school.
LEAN code looks actually exactly like you propose; it supports most conventional (Unicode-linearizable) math notation, and you just write expressions like in any other functional language. Close to the textbook, but more verbose and stiff as it's a formal language, while math notation isn't.
It's not intuitive. In isolation, if you took practical computer science and got a theoretical math background and didn't know about curry-howard correspondence, you would not intuitively figure out that propositions are types and proofs are terms. I would have guessed that propositions are functions, sets/classes are types, and elements are terms.
> I would have guessed that propositions are functions, sets/classes are types, and elements are terms.
And how do you proof anything here? You need a system which tells you about properties of the named entities.
It was always the type checker which gave you the feedback whether something is sound or not, in any programming language.
In a more rigid one it not only says whether something is more or less OK, it proves it free of contradictions.
This is very intuitive, even if you never heard about the Curry-Howard correspondence (which you anyway definitively should in case you do any formal logic, a prerequisite to create formal proofs).
That lack of relative verbosity and stiffness of mathnotation (what a thing to say haha) to be considered as a proper strength evtly. I'm consider myself as layity in this, but is an interface thinkable?
> But the statement as written has 4 points, none of which rests on the human involvement.
The theory and implementation of Lean is very much so a result of human involvement, on a massive scale even. Just because it is something repeatable does not lower that in any way.
Distrust of LLM output should not turn into distrust of automation, I think. The former I totally get (and deeply hold myself), the later is likely to hold one back - imagine banning calculators because there is not human in the loop, to make an extreme example.
Cool! (And massive thanks for all the great work you and your team do!) An idea I had was to "finetune" the KV cache compression to a dataset that represents what data one uses - but sliding window kinda achieves that out of the box, neat!
Some more ideas, most if not all were likely tried out already:
- add a decay to the KV cache: Each KV cell has an age, and if not read for a long enough time; we can throw that cell out and free that memory? (as I understood, KV cache stores intermediate results that can be restored on the fly - so if we throw out a cell that will be used in the future; it can just be recomputed)
- could expand on that: If we "revive" a KV cell that we killed; we could decrease it's likelyhood to get killed again...
- could we dynamically learn what input leads to what KV cache usage? this would be a start time thing - maybe we could preemptively set many KV cells to 2,3,4 bit and just bump their accuracy once accessed at least once? (this is related to the sliding window approach I think)
- last; I think probabilistic data structures lurk somewhere around the edges here and wait for their chance to shine... ;D "need to storage big amount of information in a set AND have a fast way to verify/falsify whether set membership (i.e. KV cell in the KV cache") was correct" seems to be applicable; but I don't have a clue how! And I am a huge fan of probalistic datastructures in general; so I might be a victim of "if everything is a hammer, ..." ;)
Yes the decay is not a bad idea - I think there were some research papers on this but I forgot haha - sparse attention partially does this, where if beforehand we know softmax(QK^T/sqrt(d)) will have a 0 cell, we can skip the calculation of QK^T for that cell (ie that KV row has 0 weight)
The main issue though is Q and K still need to be whole, so cannot be compressed. However one can do some sort of KV cache "double cache" where we can offload KV rows that are not that attended to - so the "cold KV rows" to RAM and or SSD, and the "hot KV rows" are in VRAM - this might work, but sounds complex
Cautionary note (and a serious one, not to be snarky): Being well off financially is not a protection against gambling addiction (which can also take the form of day trading, for example); which is a pretty efficient way to ruin ones financial wealth, amongst other things.
As with many other psychological phenomenona, finances and education only protect to a certain degree or not at all, depending on what one is talking about in detail.
This is not a comment about correlation or causation of wealth with mental health, but rather a warning to keep in the back of ones head; success and a sharp mind don't make one immune against mental health issues in general and gambling addiction in particular.
To me, the difference is a form of classism. Addiction to drugs is for the lower class. Addiction to gambling from making money from investing is something only upper class people can have.
I feel like this is just straight from the Kalshi marketing department. The wealthy make money from speculation by taking calculated risks and offsetting those risks with other investments. They're not betting everything on black at the roulette table or bettin on the outcome of football games.
Always nice seeing others arriving at similar conclusions! Those two jump out to me:
- "Most compilers hard-code a cost model. Vx reads one. A machine file describes the memory hierarchy and interconnect of a real part, and the compiler admits or rejects placements against it." I also designed it so that the target system is described by a single file that is picked up by the static analysis - cool!
- "Where data lives is part of its type" also doing that - when I got my project to an mvp state; I need to check out how vxlang does what it does: do they use a literal typesystem, or also compile checks outside of that? If its a type system, is it a dependent type system, or another flavor?
Yet another motivation to finally get my side project starting (forth-adjacent, many similar claims with regards to compile-time checks as vxlang; however, I still have to achieve that, while they already seem to have at least those and more in place; kudos to the vxlang team!)
reply