code wiki / (root) / nx_lean_ingest.nx

nx_lean_ingest.nx

buildroot/runtime/nx_lean_ingest.nx

11211 B292 linesdepth 5pulls 6 transitivereach 8 importersview sourcekind librarytopic lean
docsdependenciesstructsconstsfunctions

about

nx_lean_ingest.nx -- ingest Lean 4 theorem STATEMENTS (L0 phase). We do not implement a Lean kernel. Instead we parse the statement-level structure of .lean files (theorem / lemma / def / axiom declarations) and emit them into the QED database with verification_status = TRUSTED_LEAN_KERNEL. L1+ phases add statement-to-card mapping, local-proof cross-check, and reverse export. genealogy_id: de_moura_lean_2013 + lean4_2021 + scholze_liquid_tensor + tao_pfr lineage_id: dependent_type_theory + formal_statement_parsing axioms: NX_AX_ZFC_SEPARATION

dependencies 4 imports · 7 importers

nx_syscalls.nx nx_axioms.nx nx_lex.nx nx_ascii.nx nx_lean_ingest.nx nx_corpus_drive.nx nx_five_systems_test.nx nx_ingest_pipeline.nx nx_lean_dir_ingest.nx nx_lean_ingest_test.nx nx_lean_stream_ingest.nx nx_lean_stream_ingest_test.nx

imports: nx_syscalls.nxnx_axioms.nxnx_lex.nxnx_ascii.nx

imported by: nx_corpus_drive.nxnx_five_systems_test.nxnx_ingest_pipeline.nxnx_lean_dir_ingest.nxnx_lean_ingest_test.nxnx_lean_stream_ingest.nxnx_lean_stream_ingest_test.nx

structs

47struct LeanDecl
56struct LeanDb

consts

28const NX_LEAN_TOK_NONE: i64 = 0
29const NX_LEAN_TOK_THEOREM: i64 = 1
30const NX_LEAN_TOK_LEMMA: i64 = 2
31const NX_LEAN_TOK_DEF: i64 = 3
32const NX_LEAN_TOK_AXIOM: i64 = 4
33const NX_LEAN_TOK_COLON: i64 = 5
34const NX_LEAN_TOK_ASSIGN: i64 = 6 // :=
35const NX_LEAN_TOK_LBRACE: i64 = 7 // { for tactic block
36const NX_LEAN_TOK_RBRACE: i64 = 8
37const NX_LEAN_TOK_BY: i64 = 9 // by-block proof
38const NX_LEAN_TOK_IDENT: i64 = 10
39const NX_LEAN_TOK_NEWLINE: i64 = 11
40const NX_LEAN_TOK_COMMENT: i64 = 12
44const NX_LEAN_MAX_NAME_LEN: i64 = 256
45const NX_LEAN_MAX_STATEMENT_LEN: i64 = 4096
54const NX_LEAN_DECL_BYTES: i64 = 32
66const NX_LEAN_MAX_DECLS: i64 = 262144 // bumped from 65536 to fit full mathlib4 (~194k raw)

functions

68func nx_lean_db_alloc() -> *LeanDb
called by 1: nx_lean_ingest_corpus calls 1: sys_mmap
77func nx_lean_decl_at(db: *LeanDb, i: i64) -> *LeanDecl
90func nx_lean_skip_ws(buf: *u8, pos: *i64, len: i64) -> i64
called by 1: nx_lean_next_token calls 1: nx_lex_is_ws
127func nx_lean_next_token(buf: *u8, pos: *i64, len: i64, out_label: *u8) -> i64
202func nx_lean_ingest_corpus(buf: *u8, len: i64) -> *LeanDb
283func nx_lean_count_kind(db: *LeanDb, kind: i64) -> i64
called by 2: mainmain calls 1: nx_lean_decl_at