nx_imgsearch_engine_gate.nx
buildroot/runtime/nx_imgsearch_engine_gate.nx
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
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
structs
| none |
consts
| 32 | const EG_N: i64 = 128 // corpus size |
| 33 | const EG_W: i64 = 64 |
| 34 | const EG_H: i64 = 64 |
| 35 | const EG_M: i64 = 24 // images used for the invariance sweep |
| 36 | const EG_Q: i64 = 24 // queries used for the recovery rows |
| 37 | const EG_K: i64 = 8 // top-K |
functions
| 39 | 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 |
| 40 | 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 |
| 41 | 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 |
| 42 | 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 |
| 43 | func g_permille(a: i64, b: i64) -> i64 { if b <= 0 { return 0 } return a * 1000 / b } called by 1: main |
| 45 | func main() -> i64 |