code wiki / _hdl_build / nx_publish_review_test.nx
nx_publish_review_test.nx source
↩ module page · 47 lines · 4376 B
1// nx_publish_review_test.nx -- the evaluation+publishing layer end to end: Examiner & Claude dual-
2// grade (agree -> trust, diverge -> tie-break + name the missing input), Critic & Examiner judge each
3// other, and the Scientist gates papers so an OVERCLAIM never meets the world. Exit 0 if all hold.
4// license_tier: ORIGINAL
5
6import "nx_peer_review.nx"
7import "nx_scientist.nx"
8import "nx_syscalls.nx"
9
10func pt_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
11func pt_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;k=1}; while m>0 {t[k]=48+(m%10); 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 }
12
13func main() -> i64 {
14 pt_puts("=== PEER REVIEW + PUBLISHING: evaluators check each other; no overclaim meets the world ===\n" as *u8)
15 // DUAL GRADE the vector-quant result: Examiner A-parity (3), Claude A-parity (3)
16 let ex_vq: i64 = SG_A_PARITY; let cl_vq: i64 = SG_A_PARITY
17 let agree_vq: i64 = pr_agreement(ex_vq, cl_vq)
18 pt_puts(" [dual] VQ: Examiner=" as *u8); pt_num(ex_vq); pt_puts(" Claude=" as *u8); pt_num(cl_vq); pt_puts(" -> " as *u8); if agree_vq==PR_AGREE {pt_puts("AGREE (trust)\n" as *u8)} else {pt_puts("DIVERGE\n" as *u8)}
19 // a DIVERGENCE: Examiner A (3, lacked the SOTA baseline), Claude S (4) -> tie-break + cause
20 let resolved: i64 = pr_resolve(SG_A_PARITY, SG_S_EXCEED, SG_A_PARITY) // human tie-break -> A
21 let cause: i64 = pr_divergence_cause(0, 1) // no SOTA baseline -> Researcher
22 pt_puts(" [diverge] Examiner A vs Claude S -> tie-break resolves to " as *u8); pt_num(resolved); pt_puts(" cause=" as *u8); pt_num(cause); pt_puts(" (1=need Researcher SOTA, 2=need Librarian evidence)\n" as *u8)
23 // MUTUAL JUDGE: Critic judges the Examiner's grading soundness; Examiner grades the Critic
24 let critic_on_examiner: i64 = pr_critic_judges_examiner(3, 0, 1) // triangulated, no counter -> LAW
25 let examiner_on_critic: i64 = pr_examiner_grades_critic(74) // Critic at 74 -> passes
26 pt_puts(" [mutual] Critic judges Examiner grading -> " as *u8); pt_num(critic_on_examiner); pt_puts(" (2=LAW/sound) Examiner grades Critic -> pass=" as *u8); pt_num(examiner_on_critic); pt_puts("\n" as *u8)
27
28 // SCIENTIST gates papers (claim tiers: S=4 A=3 B=2)
29 let p_overclaim: i64 = sci_review(1,1,1,1,1,1, SG_S_EXCEED, SG_A_PARITY) // claims S, honest A -> REJECT
30 let p_honest: i64 = sci_review(1,1,1,1,1,1, SG_A_PARITY, SG_A_PARITY) // claims A, honest A -> PUBLISH
31 let p_sclass: i64 = sci_review(1,1,1,1,1,1, SG_S_EXCEED, SG_S_EXCEED) // legit S paper -> PUBLISH
32 let p_incomplete:i64 = sci_review(1,1,0,1,1,1, SG_A_PARITY, SG_A_PARITY) // missing evidence -> REVISE
33 pt_puts(" [paper] VQ-claims-S -> " as *u8); pt_num(p_overclaim); pt_puts(" (0=REJECT overclaim) VQ-claims-A -> " as *u8); pt_num(p_honest); pt_puts(" (2=PUBLISH)\n" as *u8)
34 pt_puts(" [paper] boolean-claims-S -> " as *u8); pt_num(p_sclass); pt_puts(" (2=PUBLISH) missing-evidence -> " as *u8); pt_num(p_incomplete); pt_puts(" (1=REVISE)\n" as *u8)
35
36 let r: *i64 = sys_mmap(8*8) as *i64
37 r[0] = 0; if agree_vq == PR_AGREE { if resolved == SG_A_PARITY { r[0] = 1 } } // dual grade + tie-break
38 r[1] = 0; if cause == PR_NEED_SOTA { r[1] = 1 } // divergence -> Researcher dependency
39 r[2] = 0; if critic_on_examiner == CRIT_LAW { if examiner_on_critic == 1 { r[2] = 1 } } // mutual judging
40 r[3] = 0; if p_overclaim == SCI_REJECT { if p_honest == SCI_PUBLISH { r[3] = 1 } } // overclaim rejected, honest published
41 r[4] = 0; if p_sclass == SCI_PUBLISH { if p_incomplete == SCI_REVISE { r[4] = 1 } } // S-paper ok, incomplete revised
42 var pass: i64 = 0; var i: i64 = 0
43 while i < 5 { pass = pass + r[i]; i = i + 1 }
44 pt_puts("----\n passed " as *u8); pt_num(pass); pt_puts("/5\n" as *u8)
45 if pass == 5 { pt_puts(" PUBLISHING LAYER LIVE: evaluators check each other (tie-break to human), and the Scientist REJECTS overclaims -- the team's papers survive outside critics.\n" as *u8); sys_exit(0); return 0 }
46 pt_puts(" FAIL\n" as *u8); sys_exit(1); return 1
47}