Skip to main content
Mike Shulman's user avatar
Mike Shulman's user avatar
Mike Shulman's user avatar
Mike Shulman
  • Member for 2 years, 10 months
  • Last seen more than a week ago
awarded
comment
How to implement separate compilation?
Cool, I didn't know about langdev.stackexchange.com, thanks!
comment
How to implement separate compilation?
Yes, I already keep track of what's been loaded since even when loading everything from source I don't want to load things multiple times. To tell which unit something comes from, my current idea is that each "identity" is actually a pair of integers, one labeling the unit it came from and one counting the definitions in that unit. Then the compiled file and the loading process both store a correspondence between loaded absolute file paths and numbers, and combining them we obtain a function from numbers to numbers that we apply to the first components of identities as we walk the terms.
comment
How to implement separate compilation?
Thanks, I look forward to it. Having now written out the problem carefully, I think I can imagine a solution a bit better. Each compiled unit maintains a list of all the other units it imported, the identity offsets for each of them, and the range of identities that came from that unit. Then when loading it, whenever we encounter an identity in a stored term, we look it up to find what unit it came from, subtract the stored offset for that unit, and then add the corresponding offset for that same unit in the current run. Is that sufficient?
comment
How to implement separate compilation?
As I said, I could write some code that tries to do this, but it's starting to feel about as complicated as manually munging De Bruijn indices when weakening under binders, and hence as easy to get wrong. So I was hoping that someone else had written out instructions or sample code that I could just copy and be more confident of not making a mistake.
comment
How to implement separate compilation?
But now at the point that $A$ is loaded, maybe we've already loaded $B$ and shifted its $M_B$ by a different constant $C_B'$. So when we pass through the $A$ terms, we don't just have to rename all the $A$ identities by adding one constant $C_A$, we have to rename all the $B$ identities by subtracting $C_B$ and adding $C_B'$. So that means that when we encounter an identity while traversing the $A$ terms, we have to be able to tell which unit it came from originally, and have stored enough information to know what to add to it.
comment
How to implement separate compilation?
Yes, this is indeed the first thing I thought of also. Thanks for writing it out clearly with justification. The complication that I was not sure what to do about is that the unit $A$ could itself import another unit $B$, which might already have been compiled at the time $A$ was compiled. So there is an $M_B$ from when $B$ was compiled, and then when $A$ is compiled it had to shift $M_B$ by adding a constant $C_B$ and those are the identities of the $B$ constants appearing in the saved $A$ terms.
comment
How to implement separate compilation?
Just storing type-checked internal versions of terms.
Loading…
awarded
awarded
comment
How do real-world proof assistants bind variables and check equality?
I'd be happy to discuss that more, but this probably isn't really the place for an extended discussion about it.
comment
How do real-world proof assistants bind variables and check equality?
Thanks! Equality checking is what I really wanted to know about, so I hope an actual expert shows up. I'm not sure why you're so exercised about my asking what actual proof assistants do currently; it seems to me like a perfectly reasonable thing to want to know. I didn't say I was planning to copy them. I've read plenty about the "right" or "future" way to do things; is it so ridiculous to want to be able to compare that in an informed way with what people have done in the past?
comment
How do real-world proof assistants bind variables and check equality?
The best description of "glued evaluation" I've found so far is github.com/AndrasKovacs/…. Is there anything more written about it than that?
comment
How do real-world proof assistants bind variables and check equality?
After I read through the elaboration zoo, will I know what is done in Agda and in Coq? If not, I don't regard it as an answer. I want to avoid digging through their source code myself; I assumed that there was someone in the world who's already familiar with that source code and would be able to tell me what it does.
comment
How do real-world proof assistants bind variables and check equality?
I'm sure the elaboration zoo is wonderful! I'm just saying it's not an answer to the question that I asked.
comment
How do real-world proof assistants bind variables and check equality?
@AndrejBauer Not a fully dependently typed language; I'm using GADTs and type-level natural numbers in OCaml.
comment
How do real-world proof assistants bind variables and check equality?
And for Bindlib to count as an answer, how does it actually represent variables?
comment
How do real-world proof assistants bind variables and check equality?
I don't think spartan type theory and the elaboration zoo are "real-world" proof assistants in the sense I meant. I want to know what implementation techniques have actually been proven scalable.
comment
How do real-world proof assistants bind variables and check equality?
Do you use the same representation for terms and values in NbE? And can you give a reference for the "glued evaluator approach"?
1
2 3 4 5
12