code wiki / _hdl_build / nx_ad_exceed_gate.nx
nx_ad_exceed_gate.nx source
↩ module page · 83 lines · 4175 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"
19
20const AX_LOG: *u8 = "knowledge/status/ad_exceed.log"
21
22func main() -> i64 {
23 let rules: *i64 = sys_mmap(8 * 64) as *i64
24 let nrules: i64 = ads_botrules(rules, 32)
25 let k: i64 = ads_kanon_k()
26
27 let lv: *i64 = sys_mmap(8 * 8) as *i64
28 ax_census_levels(lv)
29
30 // emit the census (operator-readable) to stdout + the durable log
31 ax_report(1, lv, k)
32 let lf: i64 = sys_openat_append(AX_LOG, 420)
33 if lf >= 0 { ax_report(lf, lv, k) }
34
35 var ok: i64 = 1
36
37 // precondition: the sovereign store is seeded (else bot/privacy evidence cannot be gathered)
38 if nrules < 1 { ok = 0 }
39 if k < 2 { ok = 0 }
40
41 // LIAR-KILL: the grader is a monotone evidence chain -- no rung-skipping
42 if ax_level(1, 1, 1, 0, 1) != 3 { ok = 0 } // beats=1 but measured=0 -> capped at GATED (cannot fake EXCEEDS)
43 if ax_level(1, 1, 0, 1, 1) != 2 { ok = 0 } // measured/beats claimed but not gated -> BUILT
44 if ax_level(0, 1, 1, 1, 1) != 0 { ok = 0 } // not exists -> ABSENT regardless of every claim
45 if ax_level(1, 0, 1, 1, 1) != 1 { ok = 0 } // not built -> STUB
46 if ax_level(1, 1, 1, 1, 1) != 5 { ok = 0 } // full evidence chain -> EXCEEDS
47
48 // DISCRIMINATE: an EXCEEDS axis ranks strictly above a held-MEASURED axis (not stuck-at-one-value)
49 if lv[2] <= lv[1] { ok = 0 } // PRIVACY (EXCEEDS=5) strictly above VIEWABILITY (MEASURED=4)
50
51 // PRIVACY=EXCEEDS backed by the live k-anon predicate (sub-k suppressed, >=k released)
52 if ev_privacy(rules, nrules, k) != 1 { ok = 0 }
53 if lv[2] != 5 { ok = 0 }
54
55 // VIEWABILITY=MEASURED backed by the live viewport rule (refuses served-but-unseen, MRC-compliant)
56 if ev_viewability() != 1 { ok = 0 }
57 if lv[1] != 4 { ok = 0 }
58
59 // BOTFILTER held at MEASURED (>= GATED always; richer IVT rules -> MEASURED). NOT pushed to EXCEEDS:
60 // incumbents do deeper SIVT via per-user fingerprinting we REFUSE, so a "beat" would be overclaim.
61 if lv[3] < 4 { ok = 0 }
62
63 // DELIVERY / SIGNUP / TRANSPARENCY = EXCEEDS, each BACKED by a measured head-to-head beat (liar-kill
64 // already proven in nx_ad_h2h_gate: you cannot get a beat without ours strictly lower).
65 if ev_signup() != 1 { ok = 0 }
66 if h2h_delivery() != 1 { ok = 0 }
67 if h2h_signup() != 1 { ok = 0 }
68 if h2h_transparency() != 1 { ok = 0 }
69 if lv[0] != 5 { ok = 0 }
70 if lv[4] != 5 { ok = 0 }
71 if lv[5] != 5 { ok = 0 }
72
73 if ok == 1 { xw(1, "ADEXCEEDGATE authored=organ source=store+srch_*.raw verdict=GREEN\n" as *u8) }
74 if ok != 1 { xw(1, "ADEXCEEDGATE authored=organ source=store+srch_*.raw verdict=RED\n" as *u8) }
75 if lf >= 0 {
76 if ok == 1 { xw(lf, "ADEXCEEDGATE authored=organ source=store+srch_*.raw verdict=GREEN\n" as *u8) }
77 if ok != 1 { xw(lf, "ADEXCEEDGATE authored=organ source=store+srch_*.raw verdict=RED\n" as *u8) }
78 sys_close(lf)
79 }
80
81 if ok == 1 { return 0 }
82 return 1
83}