code wiki / (root) / nx_imgsearch_engine_gate.nx

nx_imgsearch_engine_gate.nx

buildroot/runtime/nx_imgsearch_engine_gate.nx

23042 B379 linesdepth 9pulls 21 transitivereach 0 importersview sourcekind gate/prooftopic imgsearch
docsdependenciesstructsconstsfunctions

about

nx_imgsearch_engine_gate.nx -- referee for the multi-tier reverse-image engine. The ruler (nx_imgbench) says WHERE we are weak. This gate proves the fixes are REAL, and it does so adversarially: the deformations are applied by nx_imgxform (the attacker) while the invariance is supplied by nx_imgorient (the defender), which implements its geometry from scratch. A shared implementation would let one sign error cancel itself out and score as a pass. row1 D4 CANONICAL INVARIANCE -- canonical(g.A) == canonical(A) for all 8 group elements, all images. This is the mathematical claim the orientation tier rests on; if it is false the tier is a coincidence generator. Also the only row that can catch the SIGNED-COMPARE trap (a fingerprint with bit 63 set reads negative; a signed min picks a different orbit representative per variant and invariance silently breaks). row2 ORBIT NON-DEGENERACY -- the 8 orientations of an asymmetric image really are different images. Without this, row1 could pass trivially by transforming nothing. row3 HEAP EXACTNESS -- the O(N log K) bounded-heap top-K returns the SAME distance sequence as an O(N^2) selection-sort reference. Speed that changes the answer is not speed. row4 MIRROR RECOVERY -- measured against the ruler's baseline of 0 permille. row5 CROP RECOVERY -- measured against the ruler's baseline of 31 permille at crop-20. row6 FUSION ORDERING -- fused results come back in non-increasing score order. row7 HONEST ABSENT -- an image that is not in the corpus returns -1, not the nearest thing anyway. row8 DETERMINISM -- same query twice, identical payloads and scores, bit for bit. Also DERIVES (does not assume) the similarity tier's match threshold by measuring the separation between true-source L1 and unrelated-image L1, so the constant is data-driven per the no-magic- numbers law rather than chosen by taste. GREEN iff 8/8. Durable verdict -> knowledge/status/imgsearch_engine_gate.log. license_tier: ORIGINAL

dependencies 4 imports · 0 importers

nx_imgsearch_engine.nx nx_imgxform.nx nx_imgcorpus.nx nx_gate_verdict.nx nx_imgsearch_engine_gate.nx

imports: nx_imgsearch_engine.nxnx_imgxform.nxnx_imgcorpus.nxnx_gate_verdict.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main g_puts nx_imgcorpus_new nx_imgcorpus_gen ic_pos ic_rng nx_orient_canonical nx_orient_hashes nx_orient_apply nx_orient_dims or_swaps_dims nx_phash_dhash nx_phash_downscale or_ult nx_orient_count nx_orient_apply ↻ g_num nx_orient_hashes ↻ nx_imgengine_new nx_imgengine_add_tier nx_imgtier_idx_dim ie_tier_is_hash nx_imgtier_idx_dim ↻ nx_imgtier_kind pi_init_children nx_imgtier_new nx_imgtier_copy_init nx_imgtier_orient_init nx_imgtier_similar_init nx_imgtier_local_init kp_pack_dim nx_imgkp_query_dim nx_imgengine_add_image nx_imgengine_tier ie_desc_at nx_imgengine_tier ↻ nx_imgtier_idx_dim ↻ nx_imgtier_describe_index ie_accel pi_insert

structs

none

consts

32const EG_N: i64 = 128 // corpus size
33const EG_W: i64 = 64
34const EG_H: i64 = 64
35const EG_M: i64 = 24 // images used for the invariance sweep
36const EG_Q: i64 = 24 // queries used for the recovery rows
37const EG_K: i64 = 8 // top-K

functions

39func 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
40func 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
41func 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
42func 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
43func g_permille(a: i64, b: i64) -> i64 { if b <= 0 { return 0 } return a * 1000 / b }
called by 1: main
45func main() -> i64