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
omega-mv / seed / helix / cold-regrowth.sh
| 1 | #!/bin/sh |
| 2 | # seed/helix/cold-regrowth.sh -- Phase 4 Single-Command Clean-Room Cold Regrowth Harness. |
| 3 | # |
| 4 | # Starts strictly from ~804 bytes of independent hand-written machine-code seeds: |
| 5 | # - Seed A: seed/rung0/seed0.hex (408 B) |
| 6 | # - Seed B: seed/helix/rung0/seedB0.b0 (396 B, W^X) |
| 7 | # Zero network access. Zero Python. Zero CUDA. |
| 8 | # |
| 9 | # Usage (from repository root on AArch64 Linux): |
| 10 | # sh seed/helix/cold-regrowth.sh [--lean] |
| 11 | set -eu |
| 12 | R=$(CDPATH= cd -- "$(dirname "$0")/../.." && pwd) |
| 13 | cd "$R" |
| 14 | RUN_LEAN=0 |
| 15 | for arg in "$@"; do |
| 16 | case "$arg" in |
| 17 | --lean) RUN_LEAN=1 ;; |
| 18 | *) printf 'usage: cold-regrowth.sh [--lean]\n' >&2; exit 2 ;; |
| 19 | esac |
| 20 | done |
| 21 | |
| 22 | B=build/cold-regrowth |
| 23 | rm -rf "$B" |
| 24 | mkdir -p "$B/gen0" "$B/gen1" "$B/gen2" "$B/q36_kernels" |
| 25 | |
| 26 | bad() { printf 'COLD_REGROWTH FAIL: %s\n' "$*" >&2; exit 1; } |
| 27 | sha() { sha256sum "$1" | cut -d' ' -f1; } |
| 28 | |
| 29 | printf '=== [1/7] REGROW BOTH STRANDS FROM 804 BYTES OF INDEPENDENT SEEDS (ZERO C / PYTHON / CUDA) ===\n' |
| 30 | sh seed/helix/helix-from-seeds.sh |
| 31 | cp build/helix/A_stage2 "$B/omc_A" |
| 32 | cp build/helix/A_fast "$B/omc_B_fast" |
| 33 | cp build/helix/ng_B "$B/ng_B" |
| 34 | cp build/helix/monk_check "$B/monk_check" |
| 35 | cp build/helix/arboris_predator "$B/arboris_predator" |
| 36 | cp build/helix/immune "$B/immune" |
| 37 | |
| 38 | printf '\n=== [1b/7] PHASE 1: PURE-OMEGA RFC 8032 ED25519 DDC RECEIPT SIGNING & VERIFICATION ===\n' |
| 39 | { printf 'om2\n'; cat protocol/omnet/om/sha512/sha512.om protocol/omnet/om/ed25519/ed25519.om protocol/uor-gpu/ed_sign.om seed/helix/sign_ddc.om; } | "$B/omc_A" > "$B/sign_ddc_A" |
| 40 | { printf 'om2\n'; cat protocol/omnet/om/sha512/sha512.om protocol/omnet/om/ed25519/ed25519.om protocol/uor-gpu/ed_sign.om seed/helix/sign_ddc.om; } | "$B/omc_B_fast" > "$B/sign_ddc_B" |
| 41 | cmp -s "$B/sign_ddc_A" "$B/sign_ddc_B" || bad "sign_ddc diverged between Strand A and Strand B" |
| 42 | chmod +x "$B/sign_ddc_A" |
| 43 | printf 'HELIX-DDC-V2\nseedA=%s\nseedB=%s\nomc_stage2=%s\nng_B=%s\nA_fast=%s\n' \ |
| 44 | "$(sha seed/rung0/seed0.hex)" "$(sha seed/helix/rung0/seedB0.b0)" \ |
| 45 | "$(sha "$B/omc_A")" "$(sha "$B/ng_B")" "$(sha "$B/omc_B_fast")" > "$B/ddc-canonical.txt" |
| 46 | "$B/sign_ddc_A" selftest "$B/ddc-canonical.txt" "$B/ddc.pk" "$B/ddc.sig" |
| 47 | "$B/sign_ddc_A" verify "$B/ddc-canonical.txt" "$B/ddc.pk" "$B/ddc.sig" |
| 48 | |
| 49 | printf '\n=== [2/7] PHASE 2: EGP2 STRUCTURAL E-GRAPH + STRAND A DUAL-CHECKER + 12-ANTIBODY IMMUNE ===\n' |
| 50 | { printf 'om2\n'; cat seed/helix/egraph_opt.om; } | "$B/omc_B_fast" > "$B/egraph_opt" |
| 51 | chmod +x "$B/egraph_opt" |
| 52 | { printf 'om2\n'; cat seed/helix/dual_checker.om; } | "$B/omc_A" > "$B/dual_checker" |
| 53 | chmod +x "$B/dual_checker" |
| 54 | "$B/egraph_opt" "$B/egraph.egp2" |
| 55 | "$B/dual_checker" "$B/egraph.egp2" |
| 56 | |
| 57 | printf '\n=== [3/7] PHASE 2: 46 PRODUCTION SM121 KERNELS (31 emit_fast + 5 emit_head + 10 om_synth_gb10) -> PREDATOR -> MONK -> 12-ATTACK IMMUNE ===\n' |
| 58 | sh seed/helix/sweep_sm121.sh "$B/omc_A" "$B/omc_B_fast" "$B/monk_check" "$B/arboris_predator" "$B/immune" "$B/q36_kernels" |
| 59 | cp "$B/q36_kernels/extract_q36" "$B/extract_q36" |
| 60 | printf 'PASS all 46 production SM121 kernels verified by Predator -> Monk (CFG+rawFloor=6+I2FP) -> 12+4=16 Antibodies!\n' |
| 61 | |
| 62 | printf '\n=== [4/7] PHASE 3: ARBORIS NERVOUS SYSTEM BENCHMARKS (TRACKS 3A / 3B / 3C) ===\n' |
| 63 | { printf 'om2\n'; cat seed/helix/arboris_nervous_bench.om; } | "$B/omc_B_fast" > "$B/arboris_bench" |
| 64 | chmod +x "$B/arboris_bench" |
| 65 | "$B/arboris_bench" |
| 66 | |
| 67 | printf '\n=== [5/7] COMPILE uor-gpu & aienux PURE-OMEGA UNITS FROM REGROWN COMPILERS ===\n' |
| 68 | if [ -f aienux/units-gate.om ]; then |
| 69 | { printf 'om2\n'; cat seed/ng/sha256.om aienux/units-gate.om; } | "$B/omc_A" > "$B/aienux_gate_A" |
| 70 | { printf 'om2\n'; cat seed/ng/sha256.om aienux/units-gate.om; } | "$B/omc_B_fast" > "$B/aienux_gate_B" |
| 71 | cmp -s "$B/aienux_gate_A" "$B/aienux_gate_B" || bad "aienux/units-gate.om diverged between Strand A and Strand B" |
| 72 | printf 'PASS aienux/units-gate.om bit-for-bit identical across Strand A & Strand B (%s)\n' "$(sha "$B/aienux_gate_A")" |
| 73 | fi |
| 74 | if [ -f protocol/units-gate.om ]; then |
| 75 | { printf 'om2\n'; cat seed/ng/sha256.om protocol/units-gate.om; } | "$B/omc_A" > "$B/protocol_gate_A" |
| 76 | { printf 'om2\n'; cat seed/ng/sha256.om protocol/units-gate.om; } | "$B/omc_B_fast" > "$B/protocol_gate_B" |
| 77 | cmp -s "$B/protocol_gate_A" "$B/protocol_gate_B" || bad "protocol/units-gate.om diverged between Strand A and Strand B" |
| 78 | printf 'PASS protocol/units-gate.om bit-for-bit identical across Strand A & Strand B (%s)\n' "$(sha "$B/protocol_gate_A")" |
| 79 | fi |
| 80 | if [ -f protocol/uor-gpu/uor-gpu-gate.om ]; then |
| 81 | UOR_SRCS="si/directives/om2.om om/tls/sha2.om protocol/uor-gpu/b3_uor.om protocol/omnet/om/sha512/sha512.om protocol/omnet/om/ed25519/ed25519.om protocol/uor-gpu/canonical.om protocol/uor-gpu/payload_vm.om protocol/uor-gpu/verify.om protocol/uor-gpu/gate.om protocol/uor-gpu/emit_kernels.om protocol/uor-gpu/ed_sign.om protocol/uor-gpu/uor-gpu-gate.om" |
| 82 | cat $UOR_SRCS | "$B/omc_A" > "$B/uor_gpu_gate_A" |
| 83 | cat $UOR_SRCS | "$B/omc_B_fast" > "$B/uor_gpu_gate_B" |
| 84 | cmp -s "$B/uor_gpu_gate_A" "$B/uor_gpu_gate_B" || bad "uor_gpu_gate diverged between Strand A and Strand B" |
| 85 | chmod +x "$B/uor_gpu_gate_A" |
| 86 | "$B/uor_gpu_gate_A" |
| 87 | printf 'PASS uor-gpu-gate bit-for-bit identical across Strand A & Strand B AND executed PASS (%s)\n' "$(sha "$B/uor_gpu_gate_A")" |
| 88 | fi |
| 89 | |
| 90 | printf '\n=== [6/7] PHASE 4: TWO-GENERATION HELICAL SELF-RECOMPILATION OF ZERO-CUDA 35B AI SERVER ===\n' |
| 91 | build_q36() { |
| 92 | comp=$1; outdir=$2 |
| 93 | mkdir -p "$outdir" |
| 94 | { echo om2; cat gpu/nvidia/native/nvrm/context.om gpu/nvidia/native/blackwell/vector.om gpu/nvidia/native/blackwell/launch.om gpu/nvidia/native/blackwell/batch.om om/encoder/bw_enc_sm121.om om/gpu/q36/emit_fast.om om/gpu/q36/arboris/prefetch.om om/gpu/q36/native_run.om; } | "$comp" > "$outdir/q36-native" |
| 95 | chmod +x "$outdir/q36-native" |
| 96 | { echo om2 |
| 97 | cat gpu/nvidia/native/nvrm/context.om gpu/nvidia/native/blackwell/vector.om gpu/nvidia/native/blackwell/launch.om gpu/nvidia/native/blackwell/batch.om om/encoder/bw_enc_sm121.om om/gpu/q36/emit_fast.om |
| 98 | [ -f om/gpu/q36/emit_prefill.om ] && cat om/gpu/q36/emit_prefill.om |
| 99 | cat om/gpu/q36/head/emit_head.om om/gpu/q36/arboris/prefetch.om |
| 100 | sed '/^fn main to int$/,$d' om/gpu/q36/decode/decode_run.om |
| 101 | [ -f om/gpu/q36/decode/prefill_host.om ] && cat om/gpu/q36/decode/prefill_host.om |
| 102 | cat om/gpu/q36/serve/tokenizer.om om/gpu/q36/serve/serve_run.om |
| 103 | } | "$comp" > "$outdir/q36-serve" |
| 104 | chmod +x "$outdir/q36-serve" |
| 105 | } |
| 106 | # Gen 0 (Strand A), Gen 1 (Strand B A_fast), Gen 2 (Strand B -> re-twist -> A_fast_gen2 -> q36) |
| 107 | build_q36 "$B/omc_A" "$B/gen0" |
| 108 | build_q36 "$B/omc_B_fast" "$B/gen1" |
| 109 | { printf '@ng front-ir\n'; cat seed/omc/omc.om; } | "$B/ng_B" > "$B/g2.ir" |
| 110 | { printf '@ng opt\n'; cat "$B/g2.ir"; } | "$B/ng_B" > "$B/g2.opt.ir" |
| 111 | { printf '@ng a64\n'; cat "$B/g2.opt.ir"; } | "$B/ng_B" > "$B/omc_B_fast_gen2" |
| 112 | chmod +x "$B/omc_B_fast_gen2" |
| 113 | build_q36 "$B/omc_B_fast_gen2" "$B/gen2" |
| 114 | cmp -s "$B/gen0/q36-serve" "$B/gen1/q36-serve" || bad "Gen0 vs Gen1 q36-serve mismatch" |
| 115 | cmp -s "$B/gen1/q36-serve" "$B/gen2/q36-serve" || bad "Gen1 vs Gen2 q36-serve mismatch" |
| 116 | cmp -s "$B/gen0/q36-native" "$B/gen2/q36-native" || bad "Gen0 vs Gen2 q36-native mismatch" |
| 117 | printf 'PASS Gen0==Gen1==Gen2 q36-serve=%s (static ELF, zero CUDA)\n' "$(sha "$B/gen2/q36-serve")" |
| 118 | printf 'PASS Gen0==Gen1==Gen2 q36-native=%s (static ELF, zero CUDA)\n' "$(sha "$B/gen2/q36-native")" |
| 119 | |
| 120 | printf '\n=== [7/7] LEAN 4 FORMAL PROOF CHECKS ===\n' |
| 121 | if [ "$RUN_LEAN" = "1" ]; then |
| 122 | lean seed/helix/proofs/HelixSoundness.lean |
| 123 | lean seed/helix/proofs/HelixAntibodies.lean |
| 124 | lean seed/helix/proofs/HelixKernelIR.lean |
| 125 | lean protocol/uor-gpu/proofs/UorGpuWorld.lean |
| 126 | printf 'PASS Lean 4 proofs verified (HelixSoundness + HelixAntibodies + HelixKernelIR + UorGpuWorld)\n' |
| 127 | else |
| 128 | printf 'INFO pass --lean (with Lean 4 on PATH) to re-check all 4 Lean 4 proof files\n' |
| 129 | fi |
| 130 | |
| 131 | printf '\nCOLD_REGROWTH PASS dual_seeds=804B zero_prebuilt=1 zero_c=1 zero_python=1 zero_cuda=1 sm121_kernels=46 antibodies=16/16 gens=3\n' |