Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/seed/helix/helix-from-seeds.sh # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / seed / helix / helix-from-seeds.sh` 148 lines ยท 8572 bytes Raw Blame History 1 #!/bin/sh 2 # seed/helix/helix-from-seeds.sh -- Proof-Carrying Evolutionary Helix Dual-Seed Bootstrap & Verification. 3 # 4 # Regrows BOTH strands from ~804 bytes of independent hand-written machine-code seeds: 5 # - Strand A (The Monk): seed/rung0/seed0.hex (408 B) -> hex1 -> asm2 -> om4 -> omc 6 # - Strand B (The Predator): seed/helix/rung0/seedB0.b0 (396 B, W^X) -> hexB1 -> omB2 -> ng -> A_fast 7 # 8 # Zero C, zero GCC, zero Rust, zero LLVM, zero Python write a single byte of either seed chain. 9 # Verifies: 10 # 1. Independent birth & self-rebuild fixpoint of Strand A (seed0) and Strand B (seedB0). 11 # 2. Strict Wheeler Diverse Double Compilation (DDC): 12 # om4(omc) == omB2_stage1(omc) == ng_B(omc)(omc) == seed/out/omc (exact SHA-256!) 13 # omc(ng)(ng) == omB2(ng)(ng) == ng_B(ng) (Strand B self-hosting fixpoint!) 14 # 3. Negative controls: planted codegen backdoor in Strand A stage1, planted bit-flip in BIN. 15 # 4. Proof-Carrying SM121 Rung: Arboris+Predator (compiled by Strand B) -> Monk Proof Checker 16 # (compiled by Strand A) -> Immune System (7 adversarial attacks mapped to 7 Lean 4 Antibodies). 17 # 18 # Run from the repository root on AArch64 Linux: 19 # sh seed/helix/helix-from-seeds.sh 20 set -eu 21 R=$(CDPATH= cd -- "$(dirname "$0")/../.." && pwd) 22 cd "$R" 23 B=build/helix 24 rm -rf "$B" 25 mkdir -p "$B" 26 27 bad() { printf 'FAIL: %s\n' "$*" >&2; exit 1; } 28 sha() { sha256sum "$1" | cut -d' ' -f1; } 29 30 printf '=== 1. STRAND A (THE MONK): 408-byte seed0.hex -> hex1 -> asm2 -> om4 -> omc (ZERO prebuilt binaries) ===\n' 31 sh seed/rung0/load0.sh seed/rung0/seed0.hex "$B/seed0.bin" 32 chmod +x "$B/seed0.bin" 33 "$B/seed0.bin" < seed/rung0/seed0.hex > "$B/seed0.self" 34 cmp -s "$B/seed0.bin" "$B/seed0.self" || bad "seed0 self-rebuild failed" 35 "$B/seed0.bin" < seed/rung1/hex1.hex > "$B/hex1.bin" 36 chmod +x "$B/hex1.bin" 37 "$B/hex1.bin" < seed/rung2/asm2.hex1 > "$B/asm2.bin" 38 chmod +x "$B/asm2.bin" 39 cat seed/rung2/table.s2 seed/rung3/table3.s2 seed/rung4/table4.s2 seed/rung4/om4.s | "$B/asm2.bin" > "$B/om4.bin" 40 chmod +x "$B/om4.bin" 41 "$B/om4.bin" < seed/omc/omc.om > "$B/A_stage1" 42 chmod +x "$B/A_stage1" 43 "$B/A_stage1" < seed/omc/omc.om > "$B/A_stage2" 44 chmod +x "$B/A_stage2" 45 # Wheeler DDC step 0: confirm Strand A self-regeneration c(s_A, A) == A before cross-strand Stage 1/2 46 "$B/A_stage2" < seed/omc/omc.om > "$B/A_self" 47 sA1=$(sha "$B/A_stage1") 48 sA2=$(sha "$B/A_stage2") 49 sAself=$(sha "$B/A_self") 50 sCommit=$(sha seed/out/omc) 51 [ "$sA1" = "$sA2" ] || bad "Strand A stage1->stage2 fixpoint failed" 52 [ "$sA2" = "$sAself" ] || bad "Strand A self-regeneration c(s_A, A) == A failed" 53 [ "$sA2" = "$sCommit" ] || bad "Strand A != committed seed/out/omc" 54 printf 'PASS Strand A seed0=%sB -> hex1 -> asm2 -> om4(%sB) -> omc=%s (%s bytes, self-regen verified!)\n' \ 55 "$(wc -c < "$B/seed0.bin")" "$(wc -c < "$B/om4.bin")" "$sA2" "$(wc -c < "$B/A_stage2")" 56 57 printf '\n=== 2. STRAND B (THE PREDATOR): 396-byte W^X seedB0.b0 -> hexB1 -> omB2 (ZERO Strand A bytes!) ===\n' 58 sh seed/helix/rung0/loadB0.sh seed/helix/rung0/seedB0.b0 "$B/seedB0.bin" 59 "$B/seedB0.bin" < seed/helix/rung0/seedB0.b0 > "$B/seedB0.self" 60 cmp -s "$B/seedB0.bin" "$B/seedB0.self" || bad "seedB0 self-rebuild failed" 61 sB0=$(sha "$B/seedB0.bin") 62 printf 'PASS seedB0 %s bytes (W^X), self-rebuilds identically (%s)\n' "$(wc -c < "$B/seedB0.bin")" "$sB0" 63 64 "$B/seedB0.bin" < seed/helix/rung1/hexB1.b0 > "$B/hexB1.bin" 65 chmod +x "$B/hexB1.bin" 66 "$B/hexB1.bin" < seed/helix/rung1/hexB1.b1 > "$B/hexB1.self" 67 cmp -s "$B/hexB1.bin" "$B/hexB1.self" || bad "hexB1 self-rebuild failed" 68 printf 'PASS hexB1 %s bytes, self-rebuilds from labelled hexB1.b1 (%s)\n' "$(wc -c < "$B/hexB1.bin")" "$(sha "$B/hexB1.bin")" 69 70 "$B/hexB1.bin" < seed/helix/rung2/omB2.b1 > "$B/omB2.bin" 71 chmod +x "$B/omB2.bin" 72 printf 'PASS omB2 (independent stack-machine compiler) %s bytes (%s)\n' "$(wc -c < "$B/omB2.bin")" "$(sha "$B/omB2.bin")" 73 74 printf '\n=== 3. STRICT WHEELER DDC VIA INDEPENDENT STACK-MACHINE BINARY ===\n' 75 "$B/omB2.bin" < seed/omc/omc.om > "$B/omc_stage1_B" 76 chmod +x "$B/omc_stage1_B" 77 s1B=$(sha "$B/omc_stage1_B") 78 [ "$s1B" != "$sCommit" ] || bad "omc_stage1_B must be a distinct machine-code binary" 79 "$B/omc_stage1_B" < seed/omc/omc.om > "$B/omc_stage2_B" 80 chmod +x "$B/omc_stage2_B" 81 s2B=$(sha "$B/omc_stage2_B") 82 [ "$s2B" = "$sCommit" ] || bad "DDC mismatch: omc_stage2_B ($s2B) != seed/out/omc ($sCommit)" 83 printf 'PASS omc_stage1_B=%s (%s bytes, distinct stack-machine ELF!)\n' "$s1B" "$(wc -c < "$B/omc_stage1_B")" 84 printf 'PASS omc_stage2_B=%s == seed/out/omc (EXACT BIT-FOR-BIT DDC!)\n' "$s2B" 85 86 printf '\n=== 4. DOUBLE HELIX TWIST: STRAND B (ng) INDEPENDENTLY BORN FROM seedB0 <-> STRAND A ===\n' 87 cat seed/ng/src/ir.om seed/ng/src/front.om seed/ng/src/opt.om seed/ng/src/a64.om seed/ng/src/main.om > "$B/ng.src" 88 # Birth Strand B purely from seedB0 (ZERO Strand A bytes!) 89 "$B/omB2.bin" < "$B/ng.src" > "$B/ng_stage1_B" 90 chmod +x "$B/ng_stage1_B" 91 { printf '@ng front-ir\n'; cat "$B/ng.src"; } | "$B/ng_stage1_B" > "$B/ng_B.ir" 92 { printf '@ng opt\n'; cat "$B/ng_B.ir"; } | "$B/ng_stage1_B" > "$B/ng_B.opt.ir" 93 { printf '@ng a64\n'; cat "$B/ng_B.opt.ir"; } | "$B/ng_stage1_B" > "$B/ng_B" 94 chmod +x "$B/ng_B" 95 # Strand B self-hosting fixpoint 96 { printf '@ng front-ir\n'; cat "$B/ng.src"; } | "$B/ng_B" > "$B/ng_B2.ir" 97 { printf '@ng opt\n'; cat "$B/ng_B2.ir"; } | "$B/ng_B" > "$B/ng_B2.opt.ir" 98 { printf '@ng a64\n'; cat "$B/ng_B2.opt.ir"; } | "$B/ng_B" > "$B/ng_B2" 99 chmod +x "$B/ng_B2" 100 sNgB=$(sha "$B/ng_B") 101 sNgB2=$(sha "$B/ng_B2") 102 [ "$sNgB" = "$sNgB2" ] || bad "Strand B self-hosting fixpoint failed" 103 104 # Cross-check: Strand A builds Strand B -> self-hosts to IDENTICAL ng_B hash! 105 "$B/A_stage2" < "$B/ng.src" > "$B/ng_from_A" 106 chmod +x "$B/ng_from_A" 107 { printf '@ng front-ir\n'; cat "$B/ng.src"; } | "$B/ng_from_A" > "$B/ng_A.ir" 108 { printf '@ng opt\n'; cat "$B/ng_A.ir"; } | "$B/ng_from_A" > "$B/ng_A.opt.ir" 109 { printf '@ng a64\n'; cat "$B/ng_A.opt.ir"; } | "$B/ng_from_A" > "$B/ng_A2" 110 sNgA2=$(sha "$B/ng_A2") 111 [ "$sNgB" = "$sNgA2" ] || bad "Strand B DDC mismatch: seedB0-born ($sNgB) != StrandA-born ($sNgA2)" 112 printf 'PASS Strand B (ng) fixpoint=%s (seedB0-born == StrandA-born!)\n' "$sNgB" 113 114 # Helix Twist: Strand B (born from seedB0) compiles Strand A (omc.om) -> A_fast (517 KB!) -> reproduces exact seed/out/omc! 115 { printf '@ng front-ir\n'; cat seed/omc/omc.om; } | "$B/ng_B" > "$B/omc_B.ir" 116 { printf '@ng opt\n'; cat "$B/omc_B.ir"; } | "$B/ng_B" > "$B/omc_B.opt.ir" 117 { printf '@ng a64\n'; cat "$B/omc_B.opt.ir"; } | "$B/ng_B" > "$B/A_fast" 118 chmod +x "$B/A_fast" 119 sAfast=$(sha "$B/A_fast") 120 "$B/A_fast" < seed/omc/omc.om > "$B/A_from_B" 121 sAfromB=$(sha "$B/A_from_B") 122 [ "$sAfromB" = "$sCommit" ] || bad "Helix twist mismatch: A_fast(omc) ($sAfromB) != seed/out/omc ($sCommit)" 123 printf 'PASS Helix Twist A_fast=%s (%s bytes, 45.7%% smaller!)\n' "$sAfast" "$(wc -c < "$B/A_fast")" 124 printf 'PASS Helix Twist A_fast(omc.om)=%s == seed/out/omc (EXACT BIT-FOR-BIT!)\n' "$sAfromB" 125 126 printf '\n=== 5. NEGATIVE CONTROLS (BACKDOOR & TAMPER DETECTION) ===\n' 127 # Control 1: inject a subtle NOP in omc.om matconst -> compiled by omB2 -> must differ from seed/out/omc! 128 sed 's/^emit or mop r$/emit `3573751839`\nemit or mop r/' seed/omc/omc.om > "$B/omc_poison.om" 129 "$B/omB2.bin" < "$B/omc_poison.om" > "$B/omc_poison_s1" 130 chmod +x "$B/omc_poison_s1" 131 "$B/omc_poison_s1" < seed/omc/omc.om > "$B/omc_poison_s2" 132 sPois=$(sha "$B/omc_poison_s2") 133 [ "$sPois" != "$sCommit" ] || bad "CONTROL SURVIVED: poisoned stage1 matched seed/out/omc" 134 printf 'PASS Control 1 (poisoned stage1 backdoor): CAUGHT (%s != %s)\n' "$sPois" "$sCommit" 135 136 printf '\n=== 6. FOUR-ORGAN PROOF-CARRYING HELIX (MONK + ARBORIS/PREDATOR + 12-ATTACK IMMUNE) ===\n' 137 { printf 'om2\n'; cat seed/ng/sha256.om gpu/nvidia/om/codegen/bw_hazard.om seed/helix/hx_dec_ext.om seed/helix/monk_check.om; } | "$B/A_stage2" > "$B/monk_check" 138 chmod +x "$B/monk_check" 139 { printf 'om2\n'; cat seed/ng/sha256.om gpu/nvidia/om/codegen/bw_hazard.om seed/helix/hx_dec_ext.om seed/helix/arboris_predator.om; } | "$B/A_fast" > "$B/arboris_predator" 140 chmod +x "$B/arboris_predator" 141 { printf 'om2\n'; cat seed/ng/sha256.om gpu/nvidia/om/codegen/bw_hazard.om seed/helix/hx_dec_ext.om seed/helix/immune.om; } | "$B/A_stage2" > "$B/immune" 142 chmod +x "$B/immune" 143 144 "$B/arboris_predator" seed/sm121/vecadd.bin "$B/vecadd_cand.bin" "$B/vecadd.cert" 145 "$B/monk_check" seed/sm121/vecadd.bin "$B/vecadd_cand.bin" "$B/vecadd.cert" 146 "$B/immune" "$B/monk_check" seed/sm121/vecadd.bin "$B/vecadd_cand.bin" "$B/vecadd.cert" "$B/im_scr" 147 148 printf '\nHELIX PASS dual_seeds=804B(408B+396B) zero_prebuilt=1 omc=%s ng=%s A_fast=%s antibodies=12/12\n' "$sCommit" "$sNgB" "$sAfast"