code wiki / _hdl_build / nx_ad_exceed_gate.nx

nx_ad_exceed_gate.nx source

↩ module page · 91 lines · 4710 B

1// nx_ad_exceed_gate.nx -- GATE (runnable) for the ad-system MEASURED-EXCEED CENSUS. Emits the cited, 2// organ-graded census (stdout + knowledge/status/ad_exceed.log) AND proves the grader is honest: 3// 4// LIAR-KILL : the monotone grader ax_level cannot be tricked into skipping a rung -- a claim of 5// "beats the bar" with no "measured" is REFUSED (capped at GATED), and a not-exists 6// capability is ABSENT regardless of any claim. (mirrors detector_fired / snoop_fired) 7// DISCRIMINATE : the live census is not stuck-at-one-value -- an axis with real evidence (PRIVACY) 8// grades strictly ABOVE one without it (VIEWABILITY). 9// EVIDENCE-GATED: we DO NOT claim what we have not built -- VIEWABILITY is ABSENT and SIGNUP is at 10// most STUB until their organs exist (honesty over flattery). 11// BACKED : PRIVACY=EXCEEDS is tied to the LIVE k-anon predicate (sub-k suppressed, >=k 12// released), not a free assertion; if it regresses the gate goes RED. 13// 14// Evidence -> knowledge/status/ad_exceed.log (ADEXCEEDGATE ... verdict=GREEN). license_tier: ORIGINAL 15import "nx_ad_exceed.nx" 16import "nx_ad_h2h.nx" 17import "nx_ad_store.nx" 18import "nx_syscalls.nx" 19import "nx_gate_verdict.nx" 20 21const AX_LOG: *u8 = "knowledge/status/ad_exceed.log" 22 23func main() -> i64 { 24 let rules: *i64 = sys_mmap(8 * 64) as *i64 25 let nrules: i64 = ads_botrules(rules, 32) 26 let k: i64 = ads_kanon_k() 27 28 let lv: *i64 = sys_mmap(8 * 8) as *i64 29 ax_census_levels(lv) 30 31 // emit the census (operator-readable) to stdout + the durable log 32 ax_report(1, lv, k) 33 let lf: i64 = sys_openat_append(AX_LOG, 420) 34 if lf >= 0 { ax_report(lf, lv, k) } 35 36 var ok: i64 = 1 37 38 // precondition: the sovereign store is seeded (else bot/privacy evidence cannot be gathered) 39 if nrules < 1 { ok = 0 } 40 if k < 2 { ok = 0 } 41 42 // LIAR-KILL: the grader is a monotone evidence chain -- no rung-skipping 43 if ax_level(1, 1, 1, 0, 1) != 3 { ok = 0 } // beats=1 but measured=0 -> capped at GATED (cannot fake EXCEEDS) 44 if ax_level(1, 1, 0, 1, 1) != 2 { ok = 0 } // measured/beats claimed but not gated -> BUILT 45 if ax_level(0, 1, 1, 1, 1) != 0 { ok = 0 } // not exists -> ABSENT regardless of every claim 46 if ax_level(1, 0, 1, 1, 1) != 1 { ok = 0 } // not built -> STUB 47 if ax_level(1, 1, 1, 1, 1) != 5 { ok = 0 } // full evidence chain -> EXCEEDS 48 49 // DISCRIMINATE: an EXCEEDS axis ranks strictly above a held-MEASURED axis (not stuck-at-one-value) 50 if lv[2] <= lv[1] { ok = 0 } // PRIVACY (EXCEEDS=5) strictly above VIEWABILITY (MEASURED=4) 51 52 // PRIVACY=EXCEEDS backed by the live k-anon predicate (sub-k suppressed, >=k released) 53 if ev_privacy(rules, nrules, k) != 1 { ok = 0 } 54 if lv[2] != 5 { ok = 0 } 55 56 // VIEWABILITY=MEASURED backed by the live viewport rule (refuses served-but-unseen, MRC-compliant) 57 if ev_viewability() != 1 { ok = 0 } 58 if lv[1] != 4 { ok = 0 } 59 60 // BOTFILTER held at MEASURED (>= GATED always; richer IVT rules -> MEASURED). NOT pushed to EXCEEDS: 61 // incumbents do deeper SIVT via per-user fingerprinting we REFUSE, so a "beat" would be overclaim. 62 if lv[3] < 4 { ok = 0 } 63 64 // DELIVERY / SIGNUP / TRANSPARENCY = EXCEEDS, each BACKED by a measured head-to-head beat (liar-kill 65 // already proven in nx_ad_h2h_gate: you cannot get a beat without ours strictly lower). 66 if ev_signup() != 1 { ok = 0 } 67 if h2h_delivery() != 1 { ok = 0 } 68 if h2h_signup() != 1 { ok = 0 } 69 if h2h_transparency() != 1 { ok = 0 } 70 if lv[0] != 5 { ok = 0 } 71 if lv[4] != 5 { ok = 0 } 72 if lv[5] != 5 { ok = 0 } 73 74 if ok == 1 { xw(1, "ADEXCEEDGATE authored=organ source=store+srch_*.raw verdict=GREEN\n" as *u8) } 75 if ok != 1 { xw(1, "ADEXCEEDGATE authored=organ source=store+srch_*.raw verdict=RED\n" as *u8) } 76 if lf >= 0 { 77 if ok == 1 { xw(lf, "ADEXCEEDGATE authored=organ source=store+srch_*.raw verdict=GREEN\n" as *u8) } 78 if ok != 1 { xw(lf, "ADEXCEEDGATE authored=organ source=store+srch_*.raw verdict=RED\n" as *u8) } 79 sys_close(lf) 80 } 81 82 // MIGRATED onto nx_gate_verdict by nx_gate_dry_apply (D001, minimal form): every check 83 // row above is untouched, so the PASS/FAIL vector cannot change; only the hand-rolled 84 // verdict emission is replaced by the ONE shared base class. Proven by nx_gate_migrate verify. 85 let ctr__dry: *i64 = gv_ctr() 86 ctr__dry[0] = ok 87 ctr__dry[1] = 1 88 let rc__dry: i64 = gv_verdict("AD-EXCEED-GATE" as *u8, ctr__dry, "teeth unchanged; verdict emission migrated onto the shared base class" as *u8) 89 sys_exit(rc__dry) 90 return rc__dry 91}