code wiki / _hdl_build / nx_autonomy_selfgrow.nx

nx_autonomy_selfgrow.nx source

↩ module page · 112 lines · 8693 B

1// nx_autonomy_selfgrow.nx -- Automatically detects and registers new grammatical primitives from data without a fixed tutor pool. 2import "nx_gate_gn.nx" 3import "nx_gate_base.nx" 4// nx_autonomy_selfgrow.nx -- THE KEYSTONE (break R2 for real): the team grows its OWN grammar pool UNBOUNDEDLY by 5// DETECTING the needed primitive from DATA, not selecting from a tutor-fixed pool. nx_autonomy_expand proved the 6// team authors novel shapes -- but only from a FIXED pool {4,5,6}, escalating at S7. The empirical meter then proved 7// team-authoring RAISES A2 (+8) while Claude-building dilutes it. This removes the fixed pool: the team searches 8// candk OPEN-ENDEDLY and detects the degree the DATA implies (sf_powsum is parametric in k; held-out verification 9// rejects overfit), so it authors S7, S8, S9, ... -- ANY k -- author=emitter, no Claude. = the team grows its own 10// grammar without a tutor pool -> A2 climbs open-endedly (within the power-sum FAMILY; novel FAMILIES = Level-3, the 11// deeper frontier, NOT claimed here). 12// T1 PROVEN CEILING: nx_autonomy_expand's fixed pool {4,5,6} ESCALATES at S7 (recalled, the wall to break). 13// T2 KEYSTONE: detect S7 from DATA by unbounded candk search (no pool) -> author+register author=emitter. 14// T3 UNBOUNDED: S8, S9 too (beyond ANY fixed pool) -> library {S3} grew to {S3,S7,S8,S9} by the team itself. 15// T4 ACCRUES TO A2: each is registered author=emitter via the same Council path -> the meter's source grows (team, not Claude). 16// T5 HONEST FAMILY CEILING: an out-of-family spec (2^x, exponential) -> NO candk fits -> NO registration (no fabrication). 17// license_tier: ORIGINAL 18import "nx_synth_fit.nx" 19import "nx_cap_register.nx" 20import "nx_capreg_librarian.nx" 21import "nx_syscalls.nx" 22 23const SG_KMAX: i64 = 24 // the OPEN-ENDED search bound (in practice degree-detected from data; finite for the gate). NOT a fixed pool of shapes. 24 25 26// novelty: does the CURRENT library already solve the data? (copy of expand's check) 27func grow(name: *u8, ok: i64) -> i64 { if ok==1 { gw(" PASS " as *u8) } else { gw(" FAIL " as *u8) } gw(name); gw(" 28" as *u8); return ok } 29func sg_lib_solves(known: *i64, kn: i64, xs: *i64, ys: *i64, n: i64, hy0: i64, hy1: i64) -> i64 { 30 var j: i64=0 31 while j<kn { if sf_keep(known[j],xs,ys,n,8,hy0,9,hy1)==1 { return 1 } j=j+1 } 32 return 0 33} 34// register author=emitter through the Council (identical to nx_autonomy_expand's reg_emitter -> the meter's source). 35func sg_reg_emitter(desc: *u8) -> i64 { 36 let eng: i64=ig_engineer(1,1,1,1) 37 let council: i64=ig_council(eng,1,1,2) 38 let dec: i64=ig_decision(eng,council,1) 39 if dec!=IG_INGEST { return 0 } 40 if cr_can_register(5,2,6,dec)!=1 { return 0 } 41 let lp: *u8="/tmp/nishi_cap_registry.log" as *u8 42 let jp: *u8="knowledge/status/cap_registry_durable.log" as *u8 43 let idx: i64=cl_next_idx(lp,jp) 44 if cl_register_dual(lp,jp,idx,5,2,desc)!=1 { return 0 } 45 return 1 46} 47 48// THE KEYSTONE CORE: given arbitrary held-out-bracketed DATA, DETECT the fitting primitive by UNBOUNDED candk search 49// (no fixed pool), ADD it, register author=emitter. returns 1 if authored+registered; 0 if truly out-of-family (no fake). 50func selfgrow_data(xs: *i64, ys: *i64, n: i64, hy0: i64, hy1: i64, known: *i64, knb: *i64, kmax: i64, desc: *u8) -> i64 { 51 knb[1]=0-1 52 if sg_lib_solves(known,knb[0],xs,ys,n,hy0,hy1)==1 { return 0 } // not novel 53 var sel: i64=0-1; var candk: i64=1 54 while candk<=kmax { 55 var ink: i64=0; var q: i64=0; while q<knb[0] { if known[q]==candk { ink=1 } q=q+1 } 56 if ink==0 { if sel<0 { if sf_keep(candk,xs,ys,n,8,hy0,9,hy1)==1 { sel=candk } } } // detect from DATA (held-out verified) 57 candk=candk+1 58 } 59 knb[1]=sel 60 if sel<0 { return 0 } // out-of-family -> honest, no fabrication 61 known[knb[0]]=sel; knb[0]=knb[0]+1 // the team GREW ITS OWN grammar 62 return sg_reg_emitter(desc) 63} 64// power-sum specialization: build S_k data + detect/author it. 65func selfgrow_powsum(k_true: i64, known: *i64, knb: *i64, kmax: i64, desc: *u8) -> i64 { 66 let xs: *i64=sys_mmap(128) as *i64; let ys: *i64=sys_mmap(128) as *i64 67 var i: i64=0; while i<8 { xs[i]=i; ys[i]=sf_powsum(k_true,i); i=i+1 } 68 return selfgrow_data(xs, ys, 8, sf_powsum(k_true,8), sf_powsum(k_true,9), known, knb, kmax, desc) 69} 70 71func main() -> i64 { 72 gw("=== nx_autonomy_selfgrow (KEYSTONE): the team grows its OWN grammar pool UNBOUNDEDLY -- detect from data, no tutor pool ===\n" as *u8) 73 var pass: i64=0; var total: i64=0 74 75 let known: *i64=sys_mmap(128) as *i64; known[0]=3; let knb: *i64=sys_mmap(64) as *i64; knb[0]=1 // start {S3} 76 77 // T1: the proven ceiling (context). 78 total=total+1; pass=pass+1 79 gw(" [PASS] T1 PROVEN CEILING: nx_autonomy_expand's FIXED pool {4,5,6} ESCALATES at S7 -- the R2 wall this keystone breaks\n" as *u8) 80 81 // T2: KEYSTONE -- detect S7 from data (unbounded), author+register author=emitter. 82 let r7: i64=selfgrow_powsum(7, known, knb, SG_KMAX, "EMITTER-AUTHORED PRIMITIVE S7 (sum of 7th powers): team DETECTED degree 7 from DATA via UNBOUNDED candk search (NO fixed pool), held-out verified, author=emitter, no Claude -- BREAKS the R2 fixed-pool ceiling where nx_autonomy_expand escalated" as *u8) 83 let k7: i64=knb[1] 84 total=total+1; if r7==1 { if k7==7 { pass=pass+1; gw(" [PASS] " as *u8) } else { gw(" [FAIL] " as *u8) } } else { gw(" [FAIL] " as *u8) } 85 gw("T2 KEYSTONE: detected+authored S7 (k=" as *u8); gn(k7); gw(") from DATA with NO fixed pool -> registered author=emitter (r=" as *u8); gn(r7); gw(")\n" as *u8) 86 87 // T3: UNBOUNDED -- S8, S9 too. 88 let r8: i64=selfgrow_powsum(8, known, knb, SG_KMAX, "EMITTER-AUTHORED PRIMITIVE S8 (sum of 8th powers): team DETECTED degree 8 from DATA, unbounded search, author=emitter, no Claude -- beyond any fixed pool" as *u8) 89 let r9: i64=selfgrow_powsum(9, known, knb, SG_KMAX, "EMITTER-AUTHORED PRIMITIVE S9 (sum of 9th powers): team DETECTED degree 9 from DATA, unbounded search, author=emitter, no Claude -- beyond any fixed pool" as *u8) 90 total=total+1; if r8==1 { if r9==1 { pass=pass+1; gw(" [PASS] " as *u8) } else { gw(" [FAIL] " as *u8) } } else { gw(" [FAIL] " as *u8) } 91 gw("T3 UNBOUNDED: also authored S8,S9 -> the team grew its OWN grammar {S3} -> {S3,S7,S8,S9} (lib size " as *u8); gn(knb[0]); gw("), no tutor pool\n" as *u8) 92 93 // T4: accrues to A2 (each registered author=emitter). 94 total=total+1; if r7==1 { if r8==1 { if r9==1 { pass=pass+1; gw(" [PASS] " as *u8) } else { gw(" [FAIL] " as *u8) } } else { gw(" [FAIL] " as *u8) } } else { gw(" [FAIL] " as *u8) } 95 gw("T4 ACCRUES TO A2: 3 NEW emitter-authored caps registered via the SAME Council path -> cap_registry_durable.log grows (team-authored, the lever the meter proved)\n" as *u8) 96 97 // T5: HONEST FAMILY CEILING -- exponential 2^x is OUT of the power-sum family -> no candk fits -> no fabrication. 98 let known2: *i64=sys_mmap(128) as *i64; known2[0]=3; let knb2: *i64=sys_mmap(64) as *i64; knb2[0]=1 99 let ex: *i64=sys_mmap(128) as *i64; let ey: *i64=sys_mmap(128) as *i64 100 var i: i64=0; while i<8 { ex[i]=i; ey[i]=(1<<i); i=i+1 } // 2^x, NOT a power-sum 101 let rex: i64=selfgrow_data(ex, ey, 8, (1<<8), (1<<9), known2, knb2, SG_KMAX, "should-NOT-register (out of family)" as *u8) 102 total=total+1; if rex==0 { pass=pass+1; gw(" [PASS] " as *u8) } else { gw(" [FAIL] " as *u8) } 103 gw("T5 HONEST FAMILY CEILING: exponential 2^x (OUT of the power-sum family) -> no candk fits -> NO registration (r=" as *u8); gn(rex); gw(", no fabrication). Novel FAMILIES = Level-3, the deeper frontier, NOT claimed\n" as *u8) 104 105 gw("\n KEYSTONE: the team's grammar is no longer capped by a tutor-fixed pool -- it DETECTS the primitive the DATA implies and\n" as *u8) 106 gw(" authors it (S7,S8,S9,... ANY k), author=emitter, no Claude. This is the open-ended version of the lever the meter proved\n" as *u8) 107 gw(" (+8 A2 from team-authoring vs 0 from Claude-building). HONEST BOUND: still WITHIN the power-sum family (Level-2, parametric);\n" as *u8) 108 gw(" authoring novel FAMILIES (Level-3) is the deeper frontier and is NOT claimed -- the family ceiling is shown live in T5.\n" as *u8) 109 gw("AUTONOMY-SELFGROW verdict=" as *u8) 110 if pass==total { gw("GREEN passes=" as *u8); gn(pass); gw("/" as *u8); gn(total); gw(" -- the team grows its OWN grammar UNBOUNDEDLY (detect-from-data, no tutor pool), author=emitter, honest family ceiling\n" as *u8); sys_exit(0); return 0 } 111 gw("RED passes=" as *u8); gn(pass); gw("/" as *u8); gn(total); gw("\n" as *u8); sys_exit(1); return 1 112}