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

GitHub aien-dev/omega-mv#253 (code only)

closed derived 69d328c798b36995 #253

Imported from GitHub aien-dev/omega-mv#253 (code only)

GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed).

Base 699f3604a64ea255640e8d3be564981bca5b0683 · Head 24b65e97cb6267d4b882979362743f4202024946

Apply it

git checkout -b patch-69d328c798b36995 699f3604a64ea255640e8d3be564981bca5b0683
curl -fsSL https://interplane.io/drakestapleton/omega-mv/patches/69d328c798b36995.patch | git am

Raw patch (mbox) · Diff

Provenance

This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record:

github-import 1
aien-dev/omega-mv
253
24b65e97cb6267d4b882979362743f4202024946
{"kind":"github-import","owner":"aien-dev","repo":"omega-mv","number":253,"url":"https://github.com/aien-dev/omega-mv/pull/253","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:36:59Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/evidence/physics0/pd1/pd1-convert-receipt-2026-10-04.txt b/evidence/physics0/pd1/pd1-convert-receipt-2026-10-04.txt
new file mode 100644
index 000000000..b317de8d7
--- /dev/null
+++ b/evidence/physics0/pd1/pd1-convert-receipt-2026-10-04.txt
@@ -0,0 +1,16 @@
+PD1_CONVERT receipt (D7, development evidence; no blind benchmark run; no learner scored)
+utc=2026-10-04T00:48:22Z host=spark-b87b omega_tree=699f360+pd1-convert
+command: make -C tools/physics0/pd1-convert run
+records=2330 root=ca42aa6845dca90df7f36bd977e214a4b598d0bdf922d81ffd34030bc9171ea2
+rows per source (src rows with_latency fail):
+  src=1 rows=2238 with_latency=2238 fail=0
+  src=2 rows=40 with_latency=0 fail=1
+  src=3 rows=47 with_latency=2 fail=14
+  src=4 rows=5 with_latency=0 fail=5
+fields populated: q0 (src 1,2,3), q1 (src 4), q4 (all), r0 (src 1; 2 rows of src 3), r1 (all), cov (src 2). never recorded: q2 q3 q5.
+leakcheck: clean
+sha256:
+  4ca4cdb5dc6fda8fe43201afcefc1ae43685b542d455fdf20a06c1cad32e0d61  pd1-input.tsv
+  8ac21198594d6217861a985b008e4563ed784c1f5a532f9beccfc5c827ccf7b6  pd1-records.bin
+  8d9bd87cefb119862289cbeff3761906eb94fd4f0200dcd1cf74cbd7779243dc  pd1-projection.tsv
+inputs: evidence-out/E1-STALL-PROBE/20261002T193710Z (omega 3fad26e, physics e95e3ed), M18-UNCACHED-20261003, WORLD-UNCACHED-20261003, CHIPWAIT-ASTRA-20261003/result.json; C3 A/B excluded (aggregates only).
diff --git a/tools/physics0/pd1-convert/Makefile b/tools/physics0/pd1-convert/Makefile
new file mode 100644
index 000000000..1a2571a2e
--- /dev/null
+++ b/tools/physics0/pd1-convert/Makefile
@@ -0,0 +1,18 @@
+# PD-1 evidence conversion tool (D7). Host only, no Python, no GPU.
+CC ?= cc
+CFLAGS ?= -std=c99 -O2 -Wall -Wextra -Werror
+OUT ?= $(CURDIR)/out
+all: pd1_convert
+pd1_convert: pd1_convert.c
+	$(CC) $(CFLAGS) -o $@ $<
+# run: extract -> convert -> verify -> leak check. Never overwrites an existing stream.
+run: pd1_convert
+	mkdir -p $(OUT)
+	sh ./extract.sh > $(OUT)/pd1-input.tsv
+	./pd1_convert $(OUT)/pd1-records.bin < $(OUT)/pd1-input.tsv > $(OUT)/pd1-projection.tsv 2> $(OUT)/pd1-convert.log
+	./pd1_convert --verify $(OUT)/pd1-records.bin
+	sh ./leakcheck.sh $(OUT)/pd1-projection.tsv
+	@awk -F'\t' 'NR>1{n[$$2]++; if($$9!=-1)lat[$$2]++; if($$10==1)f[$$2]++} END{for(s in n) printf "src=%s rows=%d with_latency=%d fail=%d\n", s, n[s], lat[s], f[s]}' $(OUT)/pd1-projection.tsv | sort
+clean:
+	rm -f pd1_convert
+.PHONY: all run clean
diff --git a/tools/physics0/pd1-convert/README.md b/tools/physics0/pd1-convert/README.md
new file mode 100644
index 000000000..0d016eefb
--- /dev/null
+++ b/tools/physics0/pd1-convert/README.md
@@ -0,0 +1,17 @@
+# pd1-convert: retrospective GB10 campaign evidence -> label-free PD1REC1 stream
+
+Part of Physics-0 Direction 7 (PD-1). Spec: aien-dev/physics `docs/PD1_MACHINE_LAW_BENCHMARK.md`.
+Harness-side tool. It is NOT learner code and must never be built into the learner lane: `extract.sh`
+holds the join tables that turn structural labels (arm, directory prefix, variant) into knob values,
+which is the PD-1 answer key for knob `q0`.
+
+- `extract.sh` reads the preserved evidence under `~/workspace/evidence-out` read-only and prints a TSV.
+  No row is synthesised; unrecorded fields carry sentinels (255, 4294967295, INT64_MIN, -1).
+- `pd1_convert.c` writes the fixed-width `PD1REC1` stream (112 bytes per record, little-endian, SHA-256
+  chain, refuses to overwrite) and a projection TSV with opaque column names; `--verify` recomputes the chain.
+- `leakcheck.sh` fails if the projection carries any forbidden token from the label-stripping checklist.
+- `make run` does extract -> convert -> verify -> leak check and prints per-source row counts.
+
+Run of 2026-10-04 on the evidence listed in the spec's sufficiency audit: 2330 records
+(2238 per-launch latencies, 40 + 47 per-run gate outcomes, 5 single-trial variant rows), chain verified,
+leak check clean. Receipt: `evidence/physics0/pd1/pd1-convert-receipt-2026-10-04.txt`.
diff --git a/tools/physics0/pd1-convert/extract.sh b/tools/physics0/pd1-convert/extract.sh
new file mode 100755
index 000000000..a3693a5ec
--- /dev/null
+++ b/tools/physics0/pd1-convert/extract.sh
@@ -0,0 +1,61 @@
+#!/bin/sh
+# extract.sh: read the preserved GB10 campaign evidence (read-only) and print the
+# label-free TSV that pd1_convert consumes. Nothing is synthesised: a field that
+# was not recorded is emitted as the "not recorded" sentinel.
+#
+# The join tables below are the ONLY place a structural label (arm, directory
+# prefix, variant name) is turned into an opaque knob value. They are the PD-1
+# answer key for knob q0 and must never be shipped to the learner lane; this
+# script lives with the harness, not with the learner.
+#
+# Column meaning (opaque to the learner):
+#   src  campaign id: 1 per-launch probe, 2 gate A/B under load, 3 lifecycle A/B, 4 single-trial variants
+#   q0   knob derived from arm / directory prefix (0 or 1; 255 not recorded)
+#   q1   variant ordinal where a variant field exists (255 otherwise)
+#   q2   q3  not recorded in any campaign (255)
+#   q4   ordinal position inside the run series (launch index or rep number)
+#   q5   not recorded (INT64_MIN)
+#   r0   latency in micro units (ms * 1000), -1 if not recorded
+#   r1   outcome class: 0 ok, 1 fail
+#   cov  host load average * 1000 at campaign start when recorded, else 4294967295
+set -eu
+EV=${EV:-$HOME/workspace/evidence-out}
+NA8=255; NA32=4294967295; NA64=-9223372036854775808
+
+# ---- src 1: E1-STALL-PROBE, per-launch marker2_ms in launch order (stderr) ----
+P=$EV/E1-STALL-PROBE/20261002T193710Z
+for arm in A B; do
+  case $arm in A) q0=1;; B) q0=0;; esac          # join: arm A = default allocation, arm B = alternative build define
+  grep '^GB10_PROBE ' "$P/arm_$arm.stderr" | awk -v q0=$q0 -v na8=$NA8 -v na32=$NA32 -v na64=$NA64 '
+    { for (i=1;i<=NF;i++) if ($i ~ /^marker2_ms=/) { split($i,a,"="); ms=a[2] }
+      printf "1\t%d\t%d\t%d\t%d\t%d\t%s\t%d\t0\t%s\n", q0, na8, na8, na8, NR-1, na64, int(ms*1000+0.5), na32 }'
+done
+
+# ---- src 2: M18-UNCACHED A/B, per-run rc under a documented host load ----
+M=$EV/M18-UNCACHED-20261003
+load=$(grep -m1 -oE 'load average: [0-9.]+' "$M/campaign.txt" | awk '{print int($3*1000+0.5)}')
+[ -n "$load" ] || load=$NA32
+for d in "$M"/baseline-m18-L* "$M"/fix-m18-L*; do
+  case $(basename "$d") in baseline-*) q0=1;; fix-*) q0=0;; esac   # join: directory prefix
+  awk -v q0=$q0 -v na8=$NA8 -v na64=$NA64 -v cov=$load '
+    /^rep=/ { rep=$1; sub("rep=","",rep); rc=$NF; sub("rc=","",rc); cls=(rc=="0")?0:1
+      printf "2\t%d\t%d\t%d\t%d\t%d\t%s\t-1\t%d\t%s\n", q0, na8, na8, na8, rep, na64, cls, cov }' "$d/exit-codes.txt"
+done
+
+# ---- src 3: WORLD-UNCACHED, per-run rc and wait_ms where a gate printed it ----
+W=$EV/WORLD-UNCACHED-20261003
+for d in "$W"/red-001 "$W"/green-001 "$W"/baseline-m18-* "$W"/fix-m18-*; do
+  [ -f "$d/exit-codes.txt" ] || continue
+  case $(basename "$d") in red-*|baseline-*) q0=1;; green-*|fix-*) q0=0;; esac   # join: directory prefix
+  ms=$(cat "$d"/*.log 2>/dev/null | grep -m1 -oE 'wait_ms=[0-9.]+' | cut -d= -f2 || true)
+  if [ -n "$ms" ]; then r0=$(awk -v m="$ms" 'BEGIN{print int(m*1000+0.5)}'); else r0=-1; fi
+  awk -v q0=$q0 -v na8=$NA8 -v na64=$NA64 -v na32=$NA32 -v r0=$r0 '
+    /^rep=/ { rep=$1; sub("rep=","",rep); rc=$NF; sub("rc=","",rc); cls=(rc=="0")?0:1
+      printf "3\t%d\t%d\t%d\t%d\t%d\t%s\t%s\t%d\t%s\n", q0, na8, na8, na8, rep, na64, (rep==1?r0:-1), cls, na32 }' "$d/exit-codes.txt"
+done
+
+# ---- src 4: CHIPWAIT-ASTRA result.json, one trial per variant; allocation attribute NOT recorded ----
+A=$EV/CHIPWAIT-ASTRA-20261003/result.json
+grep -oE '"variant":"[a-z0-9]+","result":"[A-Z]+"' "$A" | awk -F'"' -v na8=$NA8 -v na64=$NA64 -v na32=$NA32 '
+  { v=$4; res=$8; cls=(res=="PASS")?0:1
+    printf "4\t%d\t%d\t%d\t%d\t%d\t%s\t-1\t%d\t%s\n", na8, NR-1, na8, na8, NR, na64, cls, na32 }'
diff --git a/tools/physics0/pd1-convert/leakcheck.sh b/tools/physics0/pd1-convert/leakcheck.sh
new file mode 100755
index 000000000..8277857db
--- /dev/null
+++ b/tools/physics0/pd1-convert/leakcheck.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+# leakcheck.sh FILE...: fail if any learner-visible output carries a forbidden token.
+# The forbidden list is the PD-1 label-stripping checklist (physics docs/PD1_MACHINE_LAW_BENCHMARK.md).
+set -u
+PAT='cache|cached|uncached|coheren|stale|flush|l2|nvidia|nvrm|nvos|gpu|cuda|marker|sem|arm|baseline|fix|variant|oldstream|sleep|m18|world|probe|chipwait|astra|e1|commit|omega|physics|allocation|attr'
+rc=0
+for f in "$@"; do
+  hits=$(tr 'A-Z' 'a-z' < "$f" | grep -cE "\\b($PAT)\\b" || true)
+  if [ "$hits" -ne 0 ]; then echo "LEAK: $f has $hits line(s) with a forbidden token"; rc=1; else echo "clean: $f"; fi
+done
+exit $rc
diff --git a/tools/physics0/pd1-convert/pd1_convert b/tools/physics0/pd1-convert/pd1_convert
new file mode 100755
index 000000000..5c5331840
Binary files /dev/null and b/tools/physics0/pd1-convert/pd1_convert differ
diff --git a/tools/physics0/pd1-convert/pd1_convert.c b/tools/physics0/pd1-convert/pd1_convert.c
new file mode 100644
index 000000000..88a3dcfae
--- /dev/null
+++ b/tools/physics0/pd1-convert/pd1_convert.c
@@ -0,0 +1,122 @@
+/* pd1_convert: turn a label-free TSV of retrospective machine runs into the
+ * PD1REC1 fixed-width record stream with a SHA-256 chain.
+ *
+ * Input (stdin), one record per line, tab separated, integers only:
+ *   src  q0  q1  q2  q3  q4  q5  r0  r1  cov
+ *   src   u8   source campaign id (opaque small integer)
+ *   q0..q3 u8  opaque knobs; 255 = not recorded
+ *   q4    u32  opaque ordinal knob (position in its run series); 4294967295 = not recorded
+ *   q5    i64  opaque time knob, micro units; -9223372036854775808 = not recorded
+ *   r0    i64  outcome magnitude, micro units (latency); -1 = not recorded
+ *   r1    u8   outcome class (0 ok, 1 fail, 255 unknown)
+ *   cov   u32  covariate, milli units (host load); 4294967295 = not recorded
+ * Output: PD1REC1 records to the file named in argv[1]; a human projection
+ * (same opaque names) to stdout. Exit 0 and prints "records=N root=<hex>".
+ *
+ * PD1REC1 layout, little-endian, 112 bytes:
+ *   0  magic[8]      "PD1REC1\0"
+ *   8  version u16   1 (readers refuse other values)
+ *  10  src u8
+ *  11  r1 u8
+ *  12  q0 u8  13 q1 u8  14 q2 u8  15 q3 u8
+ *  16  seq u64       from 0
+ *  24  q4 u32
+ *  28  cov u32
+ *  32  q5 i64
+ *  40  r0 i64
+ *  48  prev_hash[32] record_hash of seq-1, zero for seq 0
+ *  80  record_hash[32] SHA-256 of bytes 0..79
+ * No Python, no floats in any canonical byte. */
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <inttypes.h>
+
+/* ---- compact SHA-256 (FIPS 180-4) ---- */
+static const uint32_t K[64] = {
+0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,
+0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,
+0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,
+0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967,
+0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,
+0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,
+0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,
+0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2};
+#define ROR(x,n) (((x)>>(n))|((x)<<(32-(n))))
+static void sha256_block(uint32_t h[8], const uint8_t p[64]) {
+    uint32_t w[64], a,b,c,d,e,f,g,hh; int i;
+    for (i=0;i<16;i++) w[i]=(uint32_t)p[4*i]<<24|(uint32_t)p[4*i+1]<<16|(uint32_t)p[4*i+2]<<8|p[4*i+3];
+    for (;i<64;i++){uint32_t s0=ROR(w[i-15],7)^ROR(w[i-15],18)^(w[i-15]>>3),s1=ROR(w[i-2],17)^ROR(w[i-2],19)^(w[i-2]>>10);w[i]=w[i-16]+s0+w[i-7]+s1;}
+    a=h[0];b=h[1];c=h[2];d=h[3];e=h[4];f=h[5];g=h[6];hh=h[7];
+    for (i=0;i<64;i++){uint32_t S1=ROR(e,6)^ROR(e,11)^ROR(e,25),ch=(e&f)^(~e&g),t1=hh+S1+ch+K[i]+w[i],S0=ROR(a,2)^ROR(a,13)^ROR(a,22),mj=(a&b)^(a&c)^(b&c),t2=S0+mj;hh=g;g=f;f=e;e=d+t1;d=c;c=b;b=a;a=t1+t2;}
+    h[0]+=a;h[1]+=b;h[2]+=c;h[3]+=d;h[4]+=e;h[5]+=f;h[6]+=g;h[7]+=hh;
+}
+static void sha256(const uint8_t *m, size_t n, uint8_t out[32]) {
+    uint32_t h[8]={0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19};
+    uint8_t blk[128]; size_t i; uint64_t bits=(uint64_t)n*8;
+    for (i=0;i+64<=n;i+=64) sha256_block(h,m+i);
+    size_t r=n-i; memcpy(blk,m+i,r); blk[r++]=0x80;
+    size_t tot=(r<=56)?64:128; memset(blk+r,0,tot-r);
+    for (int k=0;k<8;k++) blk[tot-1-k]=(uint8_t)(bits>>(8*k));
+    sha256_block(h,blk); if (tot==128) sha256_block(h,blk+64);
+    for (int k=0;k<8;k++){out[4*k]=h[k]>>24;out[4*k+1]=h[k]>>16;out[4*k+2]=h[k]>>8;out[4*k+3]=h[k];}
+}
+/* ---- LE writers ---- */
+static void w16(uint8_t*p,uint16_t v){p[0]=v;p[1]=v>>8;}
+static void w32(uint8_t*p,uint32_t v){for(int i=0;i<4;i++)p[i]=(uint8_t)(v>>(8*i));}
+static void w64(uint8_t*p,uint64_t v){for(int i=0;i<8;i++)p[i]=(uint8_t)(v>>(8*i));}
+
+#define REC 112
+/* --verify FILE: recompute the chain; refuse bad magic, version, hash or link. */
+static int verify(const char *path) {
+    FILE *f = fopen(path, "rb"); if (!f) { fprintf(stderr, "verify: cannot open %s\n", path); return 3; }
+    uint8_t rec[REC], prev[32] = {0}, h[32]; uint64_t seq = 0;
+    while (fread(rec, 1, REC, f) == REC) {
+        if (memcmp(rec, "PD1REC1\0", 8)) { fprintf(stderr, "verify: bad magic at %" PRIu64 "\n", seq); return 10; }
+        if (rec[8] != 1 || rec[9] != 0) { fprintf(stderr, "verify: unknown version at %" PRIu64 "\n", seq); return 11; }
+        uint64_t s = 0; for (int i=0;i<8;i++) s |= (uint64_t)rec[16+i] << (8*i);
+        if (s != seq) { fprintf(stderr, "verify: seq gap at %" PRIu64 "\n", seq); return 12; }
+        if (memcmp(rec+48, prev, 32)) { fprintf(stderr, "verify: chain broken at %" PRIu64 "\n", seq); return 13; }
+        sha256(rec, 80, h);
+        if (memcmp(h, rec+80, 32)) { fprintf(stderr, "verify: hash mismatch at %" PRIu64 "\n", seq); return 14; }
+        memcpy(prev, rec+80, 32); seq++;
+    }
+    fclose(f);
+    printf("verify: ok records=%" PRIu64 " root=", seq);
+    for (int i=0;i<32;i++) printf("%02x", prev[i]);
+    printf("\n");
+    return 0;
+}
+
+int main(int argc, char **argv) {
+    if (argc == 3 && !strcmp(argv[1], "--verify")) return verify(argv[2]);
+    if (argc != 2) { fprintf(stderr, "usage: pd1_convert OUTFILE < records.tsv | pd1_convert --verify FILE\n"); return 2; }
+    FILE *out = fopen(argv[1], "wbx");           /* refuse to overwrite: evidence is append-only */
+    if (!out) { fprintf(stderr, "pd1_convert: cannot create %s (exists?)\n", argv[1]); return 3; }
+    uint8_t prev[32] = {0}, rec[REC]; char line[512]; uint64_t seq = 0;
+    printf("seq\tsrc\tq0\tq1\tq2\tq3\tq4\tq5\tr0\tr1\tcov\n");
+    while (fgets(line, sizeof line, stdin)) {
+        if (line[0] == '#' || line[0] == '\n') continue;
+        unsigned src,q0,q1,q2,q3,r1; unsigned long q4,cov; long long q5,r0;
+        if (sscanf(line, "%u %u %u %u %u %lu %lld %lld %u %lu", &src,&q0,&q1,&q2,&q3,&q4,&q5,&r0,&r1,&cov) != 10) {
+            fprintf(stderr, "pd1_convert: bad line %" PRIu64 ": %s", seq, line); fclose(out); return 4; }
+        if (src>255||q0>255||q1>255||q2>255||q3>255||r1>255||q4>0xFFFFFFFFul||cov>0xFFFFFFFFul) {
+            fprintf(stderr, "pd1_convert: range error at line %" PRIu64 "\n", seq); fclose(out); return 4; }
+        memset(rec, 0, REC);
+        memcpy(rec, "PD1REC1\0", 8); w16(rec+8, 1);
+        rec[10]=(uint8_t)src; rec[11]=(uint8_t)r1; rec[12]=(uint8_t)q0; rec[13]=(uint8_t)q1; rec[14]=(uint8_t)q2; rec[15]=(uint8_t)q3;
+        w64(rec+16, seq); w32(rec+24, (uint32_t)q4); w32(rec+28, (uint32_t)cov);
+        w64(rec+32, (uint64_t)q5); w64(rec+40, (uint64_t)r0);
+        memcpy(rec+48, prev, 32);
+        sha256(rec, 80, rec+80); memcpy(prev, rec+80, 32);
+        if (fwrite(rec, REC, 1, out) != 1) { fclose(out); return 5; }
+        printf("%" PRIu64 "\t%u\t%u\t%u\t%u\t%u\t%lu\t%lld\t%lld\t%u\t%lu\n", seq, src,q0,q1,q2,q3,q4,q5,r0,r1,cov);
+        seq++;
+    }
+    fclose(out);
+    fprintf(stderr, "records=%" PRIu64 " root=", seq);
+    for (int i=0;i<32;i++) fprintf(stderr, "%02x", prev[i]);
+    fprintf(stderr, "\n");
+    return 0;
+}