nx_lemma_import.nx
buildroot/runtime/nx_lemma_import.nx
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
imports: nx_kernel_v2.nx
imported by: nx_ot_replay.nxnx_wiedijk_100.nx
structs
| 78 | struct ImportedLemma |
| 90 | struct LemmaLib |
consts
| 48 | const NX_LEMMA_SRC_NATIVE: nx_int = 0 |
| 49 | const NX_LEMMA_SRC_HOL_LIGHT: nx_int = 1 |
| 50 | const NX_LEMMA_SRC_COQ: nx_int = 2 |
| 51 | const NX_LEMMA_SRC_LEAN: nx_int = 3 |
| 52 | const NX_LEMMA_SRC_ISABELLE: nx_int = 4 |
| 53 | const NX_LEMMA_SRC_MIZAR: nx_int = 5 |
| 54 | const NX_LEMMA_SRC_METAMATH: nx_int = 6 |
| 55 | const NX_LEMMA_SRC_PVS: nx_int = 7 |
| 56 | const NX_LEMMA_SRC_AGDA: nx_int = 8 |
| 57 | const NX_LEMMA_SRC_TPTP: nx_int = 9 |
| 58 | const NX_LEMMA_SRC_SMTLIB: nx_int = 10 |
| 73 | const NX_LEMMA_PROVED_NATIVE: nx_int = 0 |
| 74 | const NX_LEMMA_PROVED_NATIVE_REPLAYED: nx_int = 1 |
| 75 | const NX_LEMMA_PENDING: nx_int = 2 |
| 87 | const NX_LEMMA_BYTES: nx_int = 56 |
| 95 | const NX_LEMMA_LIB_BYTES: nx_int = 24 |
| 115 | const NX_FNV_OFFSET: nx_int = -3750763034362895579 |
| 116 | const NX_FNV_PRIME: nx_int = 1099511628211 |
functions
| 97 | func nx_lemma_lib_new(cap: nx_int) -> *LemmaLib |
| 105 | func nx_lemma_lib_at(lib: *LemmaLib, i: nx_int) -> *ImportedLemma |
| 118 | func nx_fnv_mix(h: nx_int, x: nx_int) -> nx_int called by 1: nx_term_fnv_h |
| 129 | func nx_term_fnv_h(t: *Term, h: nx_int) -> nx_int |
| 141 | func nx_term_canonical_hash(t: *Term) -> *u8 |
| 166 | func nx_lemma_import( |
| 192 | func nx_lemma_count_by_src(lib: *LemmaLib, src: nx_int) -> nx_int |
| 204 | func nx_lemma_count_by_status(lib: *LemmaLib, status: nx_int) -> nx_int |
| 217 | func nx_lemma_find_by_hash(lib: *LemmaLib, hash: *u8) -> nx_int calls 1: nx_lemma_lib_at |
| 236 | func nx_lemma_pending_count(lib: *LemmaLib) -> nx_int |