Zulip Chat Archive

Stream: lean4

Topic: Bootstrapping


Hanting Zhang (Jun 02 2022 at 17:50):

I'm looking through the Lean source code for Expr and I'm confused by how Lean in defining itself. Before Expr is defined, are Lean binaries elaborating Lean code into some kind of Exprs? If that question even makes any sense. I guess in general, how is Lean bootstrapping itself?

Sebastian Ullrich (Jun 02 2022 at 20:09):

It's no different from other bootstrapping compilers. The Expr that is compiled into the binary is completely independent from the Expr that is eventually elaborated in the stdlib and finally compiled into the next stage's binary.

Hanting Zhang (Jun 02 2022 at 20:17):

Oh wait, I see. I was confusing myself thinking the binaries and Expr were working together in some way

Sebastian Ullrich (Jun 03 2022 at 07:39):

That would be true for elaborators etc. run in the interpreter, but all elaborators in the stdlib are built-in, i.e. not executed before being compiled into the next stage's binary

Sebastian Ullrich (Jun 03 2022 at 07:41):

We do run some other programs such as parsers in the interpreter though, which is when you get to the fun bootstrapping issues described in https://leanprover.github.io/lean4/doc/dev/bootstrap.html#further-bootstrapping-complications


Last updated: Dec 20 2023 at 11:08 UTC