-
Notifications
You must be signed in to change notification settings - Fork 14
Transition to ndjson export format #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
format_ndjson.md
Outdated
| Expr.lit (Literal.strVal) | ||
| ``` | ||
| { | ||
| "lit": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not seem to be what your program currently actually prints?
| .lit (.natVal i) => return .mkObj [("natVal", s!"{i}")]
| .lit (.strVal s) => return .mkObj [("strVal", s)]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I've pushed a correction for the format specification.
format_ndjson.md
Outdated
| "levelParams": Array<integer>, | ||
| "type": integer, | ||
| "value": integer, | ||
| "hints": Array<"opaque" | "abbrev" | integer> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is also incorrectly documented afaict?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
Corrects two errors in the format specification for string literals and reducibility hints.
Correct a typo of `deBruijnIndex`
|
The open comments should be resolved, and I believe I addressed the remaining points in #10 |
+ Namespaces backreferences from a generic "i" to "in", "il", and "ie" for name, level, and expr. + Abbreviates some json attribute names
|
Thanks! (Seeing how slow lean4export is I’m inclined to rewrite the exporter to use simple string interpolation into hardcoded JSON lines, at least for everything that only contains numbers, but that can wait until other dust has settled.) |
Modifies the export procedure and format to export the components of an inductive declaration (the inductive specification(s), constructors, and recursors) together. Consumers are generally going to want to find these related declarations anyway, and with the introduction of the auxiliary `.rec_<N>` recursors motivated by nested inductive support, (in my opinion) this is a more comprehensible format.
|
I've added one commit 50db814 to implement the change mentioned elsewhere, packaging related elements of an inductive declaration. |
|
Great! Are declarations now following the Lean.Declaration type consistently, so that a lean-using importer can parse to that type directly? Hmm, it seems we now have a somewhat odd mix of |
I'm not sure how one would be able to parse anything directly regardless of format since (a) we're using integer pointers and (b) it was already suggested that we make simplifying cuts that would prevent direct parsing, like removing
In the previous round of format changes, it was decided that the exporter should include additional information (like "targets" for the recursors and rec rules, Eq/Quot declarations, etc.). With this additional info it's much easier to bootstrap new checkers, implement certain memory optimizations, and have things like parallel checkers. Looking at |
|
I didn’t mean “parse generically”, but I meant “parse export to But thanks for the historical perspective, agreed on that count. |
These are always ever unsafe, so not of high importance here? But in principle you are right. |
Exports elements of mutual theorem and def/opaque blocks together.
Should be done in 7188ec9 modulo style issues. |
|
Am I reading this right that it doesn't distinguish between a normal definition and a singly-recursive definition? It seems that of that's the case, import information is lost. I assume that's why Lean.Declaration is explicit in where the mutual groups are. But maybe lean forgets that information so it's hard to reproduce the declaration here? |
|
Hmm, the Kernel certainly doesn’t seem to remember whether a declaration came from a Ah! But the kernel treats any unsafe declaration as recursive, even if not in a mutual block. Odd. But not partial declarations. I find it confusing. In any case, I think I’m leaning towards an export format that more closely matches |
I have no issue with that. To the earlier question, I think examination of |
When ready, will close #3 (also see that issue for relevant discussion).
The format is described in
format_ndjsonand the README has been updated accordingly, along with the recommended command for invocation; the old README recommended invokinglake exe, which will not correctly set up the lake env in the most common use case, something like exporting mathlib.