code wiki / _hdl_build / nx_self_compose.nx
nx_self_compose.nx
buildroot/runtime/_hdl_build/nx_self_compose.nx
about
nx_self_compose.nx -- AUTONOMOUS compose+derive (the rung up: the team composes its OWN
targets, no Claude posing them). For each seed: COMPOSE a RANDOM non-trivial target program
T (random op-list over {a,b,+a,+b,*a,*b}; rerolled until it depends on BOTH inputs), then
DERIVE a program G that nmatches T's examples (search sees only (a,b)->T(a,b) points, not T),
then VERIFY G == T on HELD-OUT points. So the team picks WHAT to build (random T) AND builds
it (derives G), zero Claude per-target. Proves the machinery is GENERAL (arbitrary targets,
not hardcoded) AND that specs can be team-composed. Claude authored only the grammar/eval/
search (substrate). license_tier: ORIGINAL
dependencies 2 imports · 0 importers
imports: nx_syscalls.nxnx_itoa_lib.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 11 | const EVO_MAGIC_2862933555777941757: i64 = 2862933555777941757 |
| 12 | const EVO_MAGIC_3037000493: i64 = 3037000493 |
| 13 | const EVO_MAGIC_4000000: i64 = 4000000 |
| 14 | const EVO_MAGIC_2000000: i64 = 2000000 |
| 15 | const EVO_MAGIC_1000000000: i64 = 1000000000 |
| 16 | const EVO_MAGIC_2654435761: i64 = 2654435761 |
| 17 | const EVO_MAGIC_12345: i64 = 12345 |
| 19 | const GLEN: i64 = 4 |
| 20 | const EVO_P: i64 = 256 |
| 21 | const EVO_G: i64 = 1500 |
| 22 | const EVO_T: i64 = 5 |
| 23 | const NTRAIN: i64 = 6 |
| 24 | const NPTS: i64 = 10 |
functions
| 26 | func sc_rand(s: *i64) -> i64 { s[0] = s[0] * EVO_MAGIC_2862933555777941757 + EVO_MAGIC_3037000493; return (s[0] >> 17) & 0x3fffffff } |
| 27 | func sc_abs(x: i64) -> i64 { if x < 0 { return 0 - x } return x } called by 1: sc_fit |
| 28 | func sc_pa(i: i64) -> i64 { if i==0 {return 2} if i==1 {return 4} if i==2 {return 3} if i==3 {return 5} if i==4 {return 6} if i==5 {return 1} if i==6 {return 7} if i==7 {return 3} if i==8 {return 8} return 4 } |
| 29 | func sc_pb(i: i64) -> i64 { if i==0 {return 3} if i==1 {return 5} if i==2 {return 2} if i==3 {return 1} if i==4 {return 2} if i==5 {return 4} if i==6 {return 2} if i==7 {return 3} if i==8 {return 1} return 4 } |
| 32 | func sc_eval(gen: *i64, base: i64, a: i64, b: i64) -> i64 |
| 48 | func sc_compose(state: *i64, T: *i64) -> i64 |
| 63 | func sc_fit(pop: *i64, base: i64, T: *i64) -> i64 |
| 75 | func sc_tourney(fit: *i64, state: *i64) -> i64 |
| 82 | func sc_derive(T: *i64, state: *i64, G: *i64) -> i64 |
| 115 | func sc_p(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 120 | func sc_pn(v: i64) -> i64 { nxi_out(v); return 0 } |
| 121 | func sc_ops(label: *u8, gen: *i64) -> i64 |
| 129 | func sc_run(seed: i64) -> i64 |
| 143 | func main() -> i64 |