nx_kda_gate.nx
buildroot/runtime/nx_kda_gate.nx
about
nx_kda_gate.nx -- two things nx_nofloat_kda_gate does NOT cover:
(A) the ALGEBRAIC IDENTITY that licenses the shipped kernel's factored update, and
(B) the KDA:MLA interleave schedule, a separate census feature that no organ implemented.
(A) WHY IT MATTERS. Kimi Linear (arXiv 2510.26692) states the rule as
S_t = (I - beta k k^T) Diag(alpha) S_{t-1} + beta k v^T
which literally builds a d_k x d_k matrix: O(d_k^2 * d_v). The shipped kernel
(_hdl_build/nx_nofloat_kda.nx) does NOT do that -- it computes pred = k^T S, then S += k (x) beta(v-pred),
which is O(d_k * d_v). That is a real optimisation and it is CORRECT only because (I - beta k k^T) is
identity-plus-rank-1. nx_nofloat_kda_gate proves the kernel's BEHAVIOUR (overwrite, gating, determinism);
nothing proved the factorisation itself. T1 does, over two steps from a NON-ZERO state -- one step from
S=0 would agree even for a wrong factorisation.
T3 guards against proving the identity on a DEGENERATE case: if k were a basis vector, (I - beta k k^T)
would be diagonal and both forms would agree trivially. T3 asserts the off-diagonal term is non-zero, so
T1 exercised the genuinely non-diagonal path.
Deliberately NOT retested here (owned by nx_nofloat_kda_gate 5/5): delta-overwrite idempotence,
per-channel vs scalar gating, bit-exact determinism.
license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_gate_verdict.nxnx_kda.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
| 25 | const KG_FP: i64 = 1024 |
functions
| 27 | func kg_mul(a: i64, b: i64) -> i64 { return (a * b) / KG_FP } |
| 29 | func kg_state(dk: i64, dv: i64) -> *i64 |
| 37 | func kg_step_factored(S: *i64, dk: i64, dv: i64, alpha: *i64, beta: i64, k: *i64, v: *i64, sc: *i64) -> i64 |
| 65 | func kg_step_naive(S: *i64, dk: i64, dv: i64, alpha: *i64, beta: i64, k: *i64, v: *i64) -> i64 |
| 100 | func main() -> i64 |