code wiki / _hdl_build / nx_evo_synth.nx

nx_evo_synth.nx

buildroot/runtime/_hdl_build/nx_evo_synth.nx

9718 B197 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tooltopic evo
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_evo_synth.nx

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

main evo_p sys_write evo_atoi sys_mmap evo_randfill evo_rand evo_eval evo_abs evo_rand ↻ evo_catn evo_catn ↻ sys_mmap ↻ sys_write ↻ evo_cat sys_openat_wr sys_close

structs

none

consts

30const EVO_MAGIC_2862933555777941757: i64 = 2862933555777941757
31const EVO_MAGIC_3037000493: i64 = 3037000493
32const EVO_MAGIC_2654435761: i64 = 2654435761
33const EVO_MAGIC_12345: i64 = 12345
34const EVO_MAGIC_1000000000: i64 = 1000000000
35const EVO_MAGIC_65536: i64 = 65536
37const EVO_L: i64 = 6 // ops per genome
38const EVO_P: i64 = 64 // population
39const EVO_G: i64 = 400 // max generations

functions

41func evo_rand(state: *i64) -> i64
called by 2: evo_randfillmain
45func evo_abs(x: i64) -> i64 { if x < 0 { return 0 - x } return x }
called by 1: main
48func evo_eval(pop: *i64, base: i64, start: i64) -> i64
called by 1: main
61func evo_copy(pop: *i64, dst: i64, src: i64) -> i64
67func evo_randfill(pop: *i64, base: i64, state: *i64) -> i64
called by 1: main calls 1: evo_rand
77func 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
78func evo_catn(dst: *u8, off: i64, v: i64) -> i64
called by 2: evo_catnmain calls 2: evo_catnsys_mmap
88func 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 }
called by 1: main calls 1: sys_write
89func evo_atoi(s: *u8) -> i64
called by 1: main
97func main(argc: i64, argv: *i64) -> i64