Skip to content

(WIP) Use ndjson format - #67

Open
JasonGross wants to merge 2 commits into
rocq-community:masterfrom
theorem-labs:lean4export-ndjson
Open

(WIP) Use ndjson format#67
JasonGross wants to merge 2 commits into
rocq-community:masterfrom
theorem-labs:lean4export-ndjson

Conversation

@JasonGross

Copy link
Copy Markdown
Member

No description provided.

ebmoon and others added 2 commits June 2, 2026 00:43
The pnni/logic/quot ndjson dumps were trivial stub exports, far shorter
than the legacy line dumps. Repoint them at real upstream Lean modules
exported via lean4export (the same path that produces the line dumps):

  pnni  -> Init.Data.Nat.Basic  (4225 decls)
  logic -> Init.PropLemmas      (7703 decls)
  quot  -> Init.WF              (4336 decls; carries the Quot primitives,
                                 matching the quotient-centric legacy dump)

Commit the dumps as git-LFS *.ndjson.zip (like init/stdlib); tests/Makefile
decompresses them on demand. The tests are now parse-only (Set Lean Just
Parsing), matching ndjson_core/ndjson_init, since full translation of
library-scale dumps is slow/pathological.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@JasonGross
JasonGross requested a review from SkySkimmer July 6, 2026 15:19
Comment thread Makefile

# coq_makefile passes CAMLPKGS as compile/link flags but omits them from the
# generated plugin META, so `Declare ML Module` cannot dynlink yojson. Patch
# the generated META to add yojson to its findlib requires.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commit the META instead of generating it and seding it

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or we could go full dune and drop rocq makefile

Comment thread src/leanParseNdjson.ml
| `String ("opaque" | "abbrev") -> ()
| `Assoc fields -> (
match List.assoc_opt "regular" fields with
| Some (`Int _) -> ()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be added to the parsed data and used instead of the "height" strategy when available

Comment thread src/leanParseNdjson.ml
forbid_member ~lcnt "isUnsafe" payload;
require_reducibility_hint ~lcnt payload;
require_safety ~lcnt payload;
ignore (require_list ~lcnt "all" payload);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this "all" thing?

Comment thread src/leanParseNdjson.mli

val empty_state : parsing_state
val is_ndjson_line : string -> bool
val do_prefix_line : lcnt:int -> parsing_state -> string -> parsing_state

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's this "prefix" stuff about?

Comment thread .gitattributes
Comment on lines 1 to +2
dumps/mathlib.out.zip filter=lfs diff=lfs merge=lfs -text
dumps/*.ndjson.zip filter=lfs diff=lfs merge=lfs -text

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe should be

Suggested change
dumps/mathlib.out.zip filter=lfs diff=lfs merge=lfs -text
dumps/*.ndjson.zip filter=lfs diff=lfs merge=lfs -text
dumps/*.zip filter=lfs diff=lfs merge=lfs -text

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants