code wiki / (root) / nx_lemma_import.nx

nx_lemma_import.nx

buildroot/runtime/nx_lemma_import.nx

8663 B238 linesdepth 6pulls 6 transitivereach 4 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_lemma_import.nx -- Mass-ingestion bridge for imported lemmas. Per user 2026-05-15: "i mean wtf are we doing in preschool level when we can exceed". Reality: HOL Light has ~10K lemmas accumulated over 27 years. Lean Mathlib has 200K+ accumulated by hundreds of contributors. Coq stdlib + Mathcomp + UniMath have 50K+. Isabelle AFP has tens of thousands across hundreds of entries. Mizar has 70K+ theorems. We will not hand-write 10K NishiLang derivation chains. The realistic stomp path -- the same one Lean Mathlib used to grow past Coq stdlib in 5 years -- is INGESTION + PROVENANCE. This module is the bridge. Any external lemma can be imported as a v2 kernel axiom by calling nx_lemma_import(). Each imported axiom carries: - source system (sealed enum: HOL_LIGHT / COQ / LEAN / ISABELLE / MIZAR / NATIVE) - canonical name in the source system - the formal statement as a *Term (using nx_unify Term machinery) - sha256 of the statement bytes (for content-addressing / deduplication / provenance auditing) - import status: PROVED_NATIVE / IMPORTED_TRUSTED / IMPORTED_REPLAYED HONEST DISCLAIMER: IMPORTED_TRUSTED means we trust the source system's verification. The kernel itself does NOT re-verify the source's proof. This is the same approach Lean Mathport used to seed Mathlib4 from Mathlib3 and how every cross-system import works in practice. IMPORTED_REPLAYED means we re-derive the lemma natively in v2. This is the gold standard but expensive. Track the verification debt explicitly via the status field. PROVED_NATIVE means we have a v2 kernel chain for it. These are first-class.

dependencies 1 imports · 2 importers

nx_kernel_v2.nx nx_lemma_import.nx nx_ot_replay.nx nx_wiedijk_100.nx

imports: nx_kernel_v2.nx

imported by: nx_ot_replay.nxnx_wiedijk_100.nx

structs

78struct ImportedLemma
90struct LemmaLib

consts

48const NX_LEMMA_SRC_NATIVE: nx_int = 0
49const NX_LEMMA_SRC_HOL_LIGHT: nx_int = 1
50const NX_LEMMA_SRC_COQ: nx_int = 2
51const NX_LEMMA_SRC_LEAN: nx_int = 3
52const NX_LEMMA_SRC_ISABELLE: nx_int = 4
53const NX_LEMMA_SRC_MIZAR: nx_int = 5
54const NX_LEMMA_SRC_METAMATH: nx_int = 6
55const NX_LEMMA_SRC_PVS: nx_int = 7
56const NX_LEMMA_SRC_AGDA: nx_int = 8
57const NX_LEMMA_SRC_TPTP: nx_int = 9
58const NX_LEMMA_SRC_SMTLIB: nx_int = 10
73const NX_LEMMA_PROVED_NATIVE: nx_int = 0
74const NX_LEMMA_PROVED_NATIVE_REPLAYED: nx_int = 1
75const NX_LEMMA_PENDING: nx_int = 2
87const NX_LEMMA_BYTES: nx_int = 56
95const NX_LEMMA_LIB_BYTES: nx_int = 24
115const NX_FNV_OFFSET: nx_int = -3750763034362895579
116const NX_FNV_PRIME: nx_int = 1099511628211

functions

97func nx_lemma_lib_new(cap: nx_int) -> *LemmaLib
105func nx_lemma_lib_at(lib: *LemmaLib, i: nx_int) -> *ImportedLemma
118func nx_fnv_mix(h: nx_int, x: nx_int) -> nx_int
called by 1: nx_term_fnv_h
129func nx_term_fnv_h(t: *Term, h: nx_int) -> nx_int
141func nx_term_canonical_hash(t: *Term) -> *u8
called by 1: nx_lemma_import calls 1: nx_term_fnv_h
166func nx_lemma_import(
192func nx_lemma_count_by_src(lib: *LemmaLib, src: nx_int) -> nx_int
called by 1: main calls 1: nx_lemma_lib_at
204func nx_lemma_count_by_status(lib: *LemmaLib, status: nx_int) -> nx_int
217func nx_lemma_find_by_hash(lib: *LemmaLib, hash: *u8) -> nx_int
calls 1: nx_lemma_lib_at
236func nx_lemma_pending_count(lib: *LemmaLib) -> nx_int
called by 1: main calls 1: nx_lemma_count_by_status