interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / seed / helix / ollm_factory / neuro-symbolic-gate.sh

89 lines · 5266 bytes Raw Blame History
1#!/bin/sh
2# seed/helix/ollm_factory/neuro-symbolic-gate.sh
3# Pure Seeded OM-2 AArch64 Host Verification Gate for the Neuro-Symbolic Stack:
4# - om_synth.om (Obs-Equiv BFS + Branch + Fold + Wave-2 Wake-Sleep Mining)
5# - om_synth_sm121.om (SM121 L2 Table Contract & Invariant Simulator)
6# - om_synth_gb10.om (Zero-CUDA Static AArch64 ELF SM121 GPU Kernel Emitter & Launcher)
7# - om_prior.om (24-Feature L1-Cache-Resident I/O Operator Prior)
8# - om_sketch.om (151-Skeleton Recursion-Scheme Sketcher across all 5 shapes)
9# - om_retriever.om (Zero-Weight Verified Idiom Retriever)
10# - om_formalize.om (Zero-Leakage English-Only Dual-Pass Formalizer)
11# Zero GPU required in host gate; zero expect.txt leakage; zero C/Python in the engines.
12set -eu
13R=$(CDPATH= cd -- "$(dirname "$0")/../../.." && pwd)
14cd "$R"
15
16bad() { printf 'NEURO_SYM_GATE FAIL: %s\n' "$*" >&2; exit 1; }
17sha() { sha256sum "$1" | cut -d' ' -f1; }
18
19B=build/neuro-sym-gate
20rm -rf "$B"
21mkdir -p "$B/bin" "$B/work" "$B/sass"
22
23OMC=seed/out/omc
24[ -x "$OMC" ] || bad "seed/out/omc missing (run sh seed/omega-from-seed.sh)"
25
26printf '=== [1/6] COMPILE 7 PURE SEEDED OM-2 MODULES WITH seed/out/omc ===\n'
27for name in om_synth om_synth_sm121 om_prior om_sketch om_retriever om_formalize; do
28 src="seed/helix/ollm_factory/${name}.om"
29 "$OMC" < "$src" > "$B/bin/$name" || bad "omc failed on $src"
30 chmod +x "$B/bin/$name"
31 printf 'PASS %s (%s)\n' "$name" "$(sha "$B/bin/$name")"
32done
33sh seed/helix/ollm_factory/build-synth-gb10.sh "$OMC" "$B/bin/om_synth_gb10" || bad "build-synth-gb10 failed"
34"$OMC" < train/omega-llm/tools/bench/bench.om > "$B/bin/bench" || bad "omc failed on bench.om"
35chmod +x "$B/bin/bench"
36
37printf '\n=== [2/6] MODULE SELF-CHECKS & SM121 SASS KERNEL DUMP ===\n'
38"$B/bin/om_synth" selfcheck || bad "om_synth selfcheck failed"
39F=seed/helix/ollm_factory
40{ sed '/^fn main to int$/,$d' "$F/om_synth.om"; cat "$F/frontier-check.om"; } | "$OMC" > "$B/bin/frontier-check"
41chmod +x "$B/bin/frontier-check"
42"$B/bin/frontier-check" || bad "wide BFS frontier or full-pool closure"
43"$B/bin/om_synth" solve "$F/frontier-min.spec" "$B/work/min.om" || bad "wide-frontier CLI regression"
44{ cat "$B/work/min.om"; echo 'fn main to int'
45 awk '$1=="case" {print "if ne solve ulong " $2 " ulong " $3 " ulong " $4 "\nret 1\nend"}' "$F/frontier-min.spec"
46 echo 'ret 0'; echo 'end'
47} | "$OMC" > "$B/bin/frontier-result"
48chmod +x "$B/bin/frontier-result"
49"$B/bin/frontier-result" || bad "wide-frontier program disagrees with supplied cases"
50echo "PASS wide BFS frontiers, full-pool closure and compiled CLI result"
51
52"$B/bin/om_synth_sm121" layout || bad "om_synth_sm121 layout failed"
53"$B/bin/om_synth_sm121" selfcheck || bad "om_synth_sm121 selfcheck failed"
54"$B/bin/om_synth_gb10" dump "$B/sass" || bad "om_synth_gb10 dump failed"
55"$B/bin/om_prior" selfcheck || bad "om_prior selfcheck failed"
56"$B/bin/om_sketch" selfcheck || bad "om_sketch selfcheck failed"
57"$B/bin/om_retriever" selfcheck || bad "om_retriever selfcheck failed"
58"$B/bin/om_formalize" selfcheck || bad "om_formalize selfcheck failed"
59
60printf '\n=== [3/6] WAKE-SLEEP WAVE-2 COMBINATOR MINING + OMC COMPILE + ZERO LEAKAGE ===\n'
61"$B/bin/om_synth" mine "$B/work/mined_lib.om" || bad "om_synth mine failed"
62{ echo "om2"; tr '\0' '\n' < "$B/work/mined_lib.om"; echo "fn main to int"; echo "ret 0"; echo "end"; } | "$OMC" > "$B/work/mined_test" || bad "mined_lib failed omc compile"
63SEEN_OUT=$("$B/bin/bench" seen train/omega-llm/tools/bench/tasks.om "$B/work/mined_lib.om")
64printf '%s\n' "$SEEN_OUT"
65printf '%s\n' "$SEEN_OUT" | grep -q 'SEENSUM tasks 165 seen 0 ' || bad "mined_lib leaked benchmark task"
66
67printf '\n=== [4/6] RETRIEVER ON WAKE-SLEEP MINED COMBINATORS ===\n'
68printf 'note round down to multiple of 14\nfn solve a ulong to ulong\n' > "$B/work/q1.om"
69"$B/bin/om_retriever" retrieve "$B/work/mined_lib.om" "$B/work/q1.om" 2 500 "$B/work/q1_out.om" || bad "retriever failed"
70grep -q 'fn lib_comb_0' "$B/work/q1_out.om" || bad "retriever missed mined combinator"
71
72printf '\n=== [5/6] ZERO-LEAKAGE FORMALIZE -> OM_PRIOR -> OM_SYNTH -> OMC ===\n'
73printf 'note return the argument rounded down to a multiple of 14\nfn solve a ulong to ulong\n' > "$B/work/p_syn.om"
74"$B/bin/om_formalize" formalize "$B/work/p_syn.om" "$B/work/p_syn.spec" || bad "formalize failed on synthetic spec"
75"$B/bin/om_prior" rank "$B/work/p_syn.spec" || bad "om_prior rank failed"
76"$B/bin/om_synth" solve "$B/work/p_syn.spec" "$B/work/p_syn_out.om" || bad "om_synth solve failed on formalized spec"
77{ echo "om2"; cat "$B/work/p_syn_out.om"; echo "fn main to int"; echo "if ne solve 41 28"; echo "ret 1"; echo "end"; echo "ret 0"; echo "end"; } | "$OMC" > "$B/work/p_syn_bin" || bad "synthesized code failed omc compile"
78chmod +x "$B/work/p_syn_bin"
79"$B/work/p_syn_bin" || bad "synthesized binary failed execution check"
80
81printf '\n=== [6/6] VERIFY SM121 KERNEL ARTIFACTS (10 OPS, NON-EMPTY) ===\n'
82kcnt=0
83for op in 4 5 6 7 8 9 10 11 12 13; do
84 [ -s "$B/sass/op_${op}.bin" ] || bad "missing SM121 SASS op_${op}.bin"
85 kcnt=$((kcnt + 1))
86done
87[ "$kcnt" -eq 10 ] || bad "expected 10 SM121 SASS kernels"
88
89printf '\nNEURO_SYM_GATE PASS modules=7/7 sm121_kernels=10 sm121_invariants=3/3 wave2_compress=1 mined_seen=0 e2e_exec=1\n'