nx_phash_index_gate.nx
buildroot/runtime/nx_phash_index_gate.nx
about
nx_phash_index_gate.nx -- referee for the sublinear Hamming index (nx_phash_index, BK-tree).
PROVES, in-process (no external elf, no shell orchestration), what a TinEye-scale index must
guarantee:
row1 EXACTNESS (clustered): over K clustered near-dup queries the BK-tree match SET equals the
linear O(N) brute-force set -- no false positives, no recall loss.
row2 MEASURED-EXCEED: average candidates examined by the BK-tree << N (sublinear pruning),
printed as an honest ratio on a realistic clustered corpus.
row3 EXACTNESS (adversarial uniform-random): correctness HOLDS even where pruning is weak --
the answer is exact regardless of speed (the liar-kill that separates "fast" from "right").
row4 DETERMINISM: identical query -> identical candidates-examined AND identical match count,
twice (bit-exact; the sovereign moat over float ANN indexes).
row5 BUILD INTEGRITY: every one of the N fingerprints is present in the tree.
GREEN iff 5/5. Deterministic corpus (MMIX LCG, fixed seed) so the verdict is reproducible.
Durable verdict -> knowledge/status/phash_index_gate.log. license_tier: ORIGINAL
dependencies 1 imports · 0 importers
imports: nx_phash_index.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| none |
functions
| 17 | func g_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } called by 1: main |
| 18 | func g_num(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=(48 as u8);k=1}; while m>0{t[k]=((48+(m%10)) as u8);m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(1,bb,k); return 0 } called by 1: main |
| 19 | func g_w(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 } called by 1: main |
| 20 | func g_wn(fd: i64, v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=(48 as u8);k=1}; while m>0{t[k]=((48+(m%10)) as u8);m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(fd,bb,k); return 0 } called by 1: main |
| 23 | func g_rng(s: *i64) -> i64 { let x: i64 = s[0] * 0x5851F42D4C957F2D + 0x14057B7EF767814F; s[0]=x; return x } |
| 25 | func g_bitpos(s: *i64) -> i64 { return (g_rng(s) >> 20) & 63 } |
| 27 | func g_jitter(s: *i64, center: i64, k: i64) -> i64 { var v: i64=center; var i: i64=0; while i<k { v = v ^ (1 << g_bitpos(s)); i=i+1 } return v } |
| 30 | func g_brute(fp: *i64, pay: *i64, n: i64, q: i64, r: i64, out: *i64, out_cap: i64) -> i64 |
| 35 | func g_memzero(memb: *u8, n: i64) -> i64 { var i: i64=0; while i<n { memb[i]=0 as u8; i=i+1 } return 0 } called by 1: main |
| 36 | func g_memmark(memb: *u8, out: *i64, cnt: i64) -> i64 { var i: i64=0; while i<cnt { memb[out[i]]=1 as u8; i=i+1 } return 0 } called by 1: main |
| 37 | func g_memeq(a: *u8, b: *u8, n: i64) -> i64 { var i: i64=0; while i<n { if a[i]!=b[i] { return 0 } i=i+1 } return 1 } called by 1: main |
| 39 | func main() -> i64 |