code wiki / _hdl_build / nx_evo_synth.nx
nx_evo_synth.nx
buildroot/runtime/_hdl_build/nx_evo_synth.nx
about
nx_evo_synth.nx -- EVOLUTIONARY PROGRAM SYNTHESIS (X-AUT-006L): SELF-BUILDING CODE.
The leap past the emitter ladder. Rungs 006g..006k made the team able to EMIT a
program from a hand-written DATA spec. This organ makes the team DISCOVER a
program by EVOLUTIONARY SEARCH -- it is given only a TARGET (a desired output for
a start input), NOT the answer, and SEARCHES op-list program-space until it finds
code that hits the target, then MATERIALIZES that discovered code as a real
sovereign compiled organ. Genotype (op-list genome) -> phenotype (its computed
result) -> fitness (distance to target) -> selection+mutation -> next generation:
this is genetic programming / an (1+lambda) evolution strategy, the substrate of
"evolutionary computation, self-building code".
nx_evo_synth <champion_basename> <start> <target> <seed>
- deterministic (seeded LCG) so a run is reproducible/gateable.
- genome = EVO_L ops (opcode add/mul/sub + operand 1..9); pop = EVO_P;
gens = EVO_G; (1+lambda): elite best + lambda mutants of best each gen.
- prints FOUND/NEAR gen=<g> dist=<d> result=<r> genome=<ops>.
- WRITES runtime/_hdl_build/<champion_basename>.nx = the DISCOVERED program
(an op-list organ) so the gate can COMPILE+RUN it and confirm it really
produces the target -- the unfakeable proof the evolved code is real.
no-false-green: different targets -> different DISCOVERED genomes, each verified by
compiling+running the materialized champion to the target; the champion is NOT
hand-written and (for non-trivial targets) NOT found at generation 0 -- the search
must climb. Sovereign, no gcc/.sh. HONEST SCOPE: linear op-list genomes over one
i64 (the 006g phenotype), distance fitness, mutation-only ES; NOT yet crossover /
branch+loop genomes / multi-example fitness -- but it is GENUINE program synthesis
by evolution, the seed of the research arc. license_tier: ORIGINAL
dependencies 1 imports · 0 importers
imports: nx_syscalls.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
| 30 | const EVO_MAGIC_2862933555777941757: i64 = 2862933555777941757 |
| 31 | const EVO_MAGIC_3037000493: i64 = 3037000493 |
| 32 | const EVO_MAGIC_2654435761: i64 = 2654435761 |
| 33 | const EVO_MAGIC_12345: i64 = 12345 |
| 34 | const EVO_MAGIC_1000000000: i64 = 1000000000 |
| 35 | const EVO_MAGIC_65536: i64 = 65536 |
| 37 | const EVO_L: i64 = 6 // ops per genome |
| 38 | const EVO_P: i64 = 64 // population |
| 39 | const EVO_G: i64 = 400 // max generations |
functions
| 41 | func evo_rand(state: *i64) -> i64 |
| 45 | func evo_abs(x: i64) -> i64 { if x < 0 { return 0 - x } return x } called by 1: main |
| 48 | func evo_eval(pop: *i64, base: i64, start: i64) -> i64 called by 1: main |
| 61 | func evo_copy(pop: *i64, dst: i64, src: i64) -> i64 |
| 67 | func evo_randfill(pop: *i64, base: i64, state: *i64) -> i64 |
| 77 | func evo_cat(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { dst[off+i] = s[i]; i = i + 1 } return off + i } called by 1: main |
| 78 | func evo_catn(dst: *u8, off: i64, v: i64) -> i64 |
| 88 | func evo_p(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 89 | func evo_atoi(s: *u8) -> i64 called by 1: main |
| 97 | func main(argc: i64, argv: *i64) -> i64 |