code wiki / _hdl_build / nx_self_sufficiency_test.nx

nx_self_sufficiency_test.nx source

↩ module page · 45 lines · 3541 B

1// nx_self_sufficiency_test.nx -- honest map of the full loop. Two cases: 2// (A) target whose SEARCH SPACE ALREADY EXISTS (e.g. "synthesize circuit for truth-table T", or 3// "reduce matrix M") -> the loop is FULLY CLOSED: target->spec->author->RUN->judge->bank with no 4// Claude. All 7 stages team-owned. THIS is the self-sufficient loop, and it works today. 5// (B) target needing a BRAND-NEW module/search-space -> OPEN at S3 only (novel-module authoring = the 6// LLM-gap Claude still writes by hand). 6/7 team-owned. The map to full self-sufficiency = close S3. 7// Exit 0 on 6/6. license_tier: ORIGINAL 8 9import "nx_self_sufficiency.nx" 10import "nx_syscalls.nx" 11 12func st_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } 13func st_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 } 14 15func main() -> i64 { 16 st_puts("=== SELF-SUFFICIENCY MAP: given a target, where is the loop closed vs open? ===\n" as *u8) 17 18 // CASE A: search space exists -> the loop is CLOSED 19 let closed_a: i64 = ss_loop_closed(1) 20 let team_a: i64 = ss_team_stages(1) 21 let open_a: i64 = ss_open_stage(1) 22 // CASE B: new module needed -> OPEN at S3 23 let closed_b: i64 = ss_loop_closed(0) 24 let team_b: i64 = ss_team_stages(0) 25 let open_b: i64 = ss_open_stage(0) 26 let novel_b: i64 = ss_open_is_novel_module(0) 27 28 st_puts(" stages: TARGET->SPEC->SPACE->AUTHOR->VERIFY(runner)->JUDGE->BANK\n" as *u8) 29 st_puts(" CASE A (space exists): loop-closed=" as *u8); st_num(closed_a); st_puts(" team-owns=" as *u8); st_num(team_a); st_puts("/7 open-stage=" as *u8); st_num(open_a); st_puts(" (-1=none) -> SELF-SUFFICIENT TODAY\n" as *u8) 30 st_puts(" CASE B (new module): loop-closed=" as *u8); st_num(closed_b); st_puts(" team-owns=" as *u8); st_num(team_b); st_puts("/7 open-stage=S" as *u8); st_num(open_b); st_puts(" (novel-module=" as *u8); st_num(novel_b); st_puts(") <-- Claude still writes this\n" as *u8) 31 st_puts(" MAP: 6/7 stages team-owned; the ONLY open stage is S3 novel-module-authoring -> close it via the custom Nishi LLM / local backup = FULL self-sufficiency.\n" as *u8) 32 33 let r: *i64 = sys_mmap(8*8) as *i64 34 r[0] = 0; if closed_a == 1 { r[0] = 1 } // loop closed when the space exists 35 r[1] = 0; if team_a == 7 { r[1] = 1 } // all 7 stages team-owned (self-sufficient today) 36 r[2] = 0; if open_a == 0 - 1 { r[2] = 1 } // nothing open 37 r[3] = 0; if closed_b == 0 { r[3] = 1 } // not closed when a new module is needed 38 r[4] = 0; if team_b == 6 { r[4] = 1 } // 6/7 team-owned 39 r[5] = 0; if open_b == SS_SPACE { if novel_b == 1 { r[5] = 1 } } // the one gap = novel-module authoring 40 var pass: i64 = 0; var i: i64 = 0 41 while i < 6 { pass = pass + r[i]; i = i + 1 } 42 st_puts("----\n passed " as *u8); st_num(pass); st_puts("/6\n" as *u8) 43 if pass == 6 { st_puts(" MAPPED HONESTLY: given a target with an existing search space, the team runs the FULL loop itself (spec->author->run->judge->bank). The one open stage is authoring a NEW module -- the last LLM-gap on the road to full self-sufficiency.\n" as *u8); sys_exit(0); return 0 } 44 st_puts(" FAIL\n" as *u8); sys_exit(1); return 1 45}