code wiki / _hdl_build / nx_cms_exceed.nx

nx_cms_exceed.nx source

↩ module page · 57 lines · 2691 B

1// nx_cms_exceed.nx -- the W-RE-004 head-to-head EXCEED harness (reusable per-feature template). 2// The no-wave law: a win is MEASURED, never asserted. EXCEED = OUR organ scores strictly higher than the 3// incumbent oracle on a real axis over a real corpus, AND a no-overclaim Referee passes. This organ holds 4// the SCORING + VERDICT + REFEREE only; each per-feature gate supplies the corpus, runs BOTH sides on the 5// same inputs, and feeds the measured (our_correct, incumbent_correct, n) here. The verdict is COMPUTED 6// from those counts -- it cannot be hand-set. 7// module: nishi-core.cms.exceed 8// depends: nishi-core.io.syscalls 9// capability: CMS 10// license_tier: ORIGINAL 11import "nx_syscalls.nx" 12 13const XCD_BEHIND: i64 = 0 - 1 14const XCD_PARITY: i64 = 0 15const XCD_AHEAD: i64 = 1 16 17// per-axis verdict, computed purely from the two measured scores (never asserted): 18// AHEAD iff ours strictly beats the incumbent 19// PARITY iff equal 20// BEHIND iff worse 21func xcd_verdict(our_correct: i64, inc_correct: i64) -> i64 { 22 if our_correct > inc_correct { return XCD_AHEAD } 23 if our_correct < inc_correct { return XCD_BEHIND } 24 return XCD_PARITY 25} 26 27// no-overclaim REFEREE: an AHEAD claim is honest ONLY if (a) there was a real measurement (n > 0) and 28// (b) ours is actually fully correct on the axis (our_correct == n). You cannot claim to EXCEED while 29// still failing cases -- that would be "less wrong", not "ahead". Returns 1 if the claim is honest, else 0. 30func xcd_referee_ok(verdict: i64, our_correct: i64, n: i64) -> i64 { 31 if n <= 0 { return 0 } // no measurement -> no claim 32 if verdict == XCD_AHEAD { if our_correct != n { return 0 } } 33 return 1 34} 35 36func xcd_vname(v: i64) -> *u8 { 37 if v == XCD_AHEAD { return "AHEAD" as *u8 } 38 if v == XCD_PARITY { return "PARITY" as *u8 } 39 return "BEHIND" as *u8 40} 41 42// PERF verdict: a COST metric where LOWER is better (bytes transferred, ops, cycles). 43// AHEAD iff ours is strictly cheaper; PARITY iff equal; BEHIND iff costlier. 44func xcd_verdict_perf(our_cost: i64, inc_cost: i64) -> i64 { 45 if our_cost < inc_cost { return XCD_AHEAD } 46 if our_cost > inc_cost { return XCD_BEHIND } 47 return XCD_PARITY 48} 49 50// no-overclaim PERF referee: an AHEAD perf claim is honest ONLY if (a) there was a real measurement 51// (n > 0) AND (b) ours stayed fully CORRECT (our_correct == n). A perf "win" bought by serving stale or 52// wrong output is not a win -- correctness must not be traded for speed. 53func xcd_referee_perf_ok(verdict: i64, our_correct: i64, n: i64) -> i64 { 54 if n <= 0 { return 0 } 55 if verdict == XCD_AHEAD { if our_correct != n { return 0 } } 56 return 1 57}