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#158 (code only)
Apply it
git checkout -b patch-4a5aede2ca01613a 07004a828b2a04c1b38217c13d521d359435240e curl -fsSL https://interplane.io/drakestapleton/omega-mv/patches/4a5aede2ca01613a.patch | git am
Provenance
github-import 1
aien-dev/omega-mv
158
e333c735224fdd59fdfc4f58bbb626bf425afdfb
{"kind":"github-import","owner":"aien-dev","repo":"omega-mv","number":158,"url":"https://github.com/aien-dev/omega-mv/pull/158","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:36:33Z","metadata":"unavailable","state_derived":true}
Changes
diff --git a/research/dirac-oracle/CORPUS-FORMAT.md b/research/dirac-oracle/CORPUS-FORMAT.md new file mode 100644 index 000000000..8051a8cad --- /dev/null +++ b/research/dirac-oracle/CORPUS-FORMAT.md @@ -0,0 +1,101 @@ +# DIRAC-0 known-answer corpus format (v1, written, not built) + +Status: NOT_RUN. Public conformance corpus only. Sealed experiment keys are never stored here (ORACLE-SPEC.md section 8). + +## 1. File shape +Line oriented UTF-8 text, LF endings, no trailing spaces, no tabs. Order is deterministic: records sorted by `kind` in the order listed in section 3, then by `id` bytewise. File name: `dirac-kat-<sha256>.txt` where the hash is the corpus digest below. + +``` +OMEGA-DIRAC-KAT v1 +domain omega.dirac.kat.v1 +record_count <u32 decimal> +<records> +corpus_digest <64 lowercase hex> +end +``` + +## 2. Canonical encodings +- Integer: decimal, optional leading `-`, no leading zeros, no `+`. Zero is `0`. +- Rational: `n/d`, d >= 1, gcd(|n|,d) = 1, d = 1 written `n/1`. +- Complex: `(re;im)` where re and im are rationals, no spaces. Example `(1/2;-3/1)`. +- Matrix: `n` rows separated by `|`, entries in a row separated by `,`. Example `[(1/1;0/1),(0/1;0/1)|(0/1;0/1),(-1/1;0/1)]`. +- Metric: comma separated integers, diagonal only, in generator order. Example `1,-1`. +- Scaled decimal (high precision): `N@k` meaning N / 10^k, N integer, k >= 0; bound `B@k` is a non-negative integer with the same k. +- No floating point text anywhere (no `.`, no `e`). + +Corpus digest: SHA-256 over bytes `omega.dirac.kat.v1` || 0x00 || every line of the file above the `corpus_digest` line, each followed by LF. The digest line itself and `end` are excluded. + +## 3. Record kinds (in this order) +Every record is `record <kind> <id>` then `key value` lines then `endrecord`. Fields marked (E) are evaluator-only and must be stripped before any export toward the AIEN side. + +1. GAMMA_REP: `rep_name` (E), `dim` (generators d), `size` (matrix size n), `metric`, `g0` .. `g<d-1>` (matrices). +2. CLIFFORD_CHECK: `rep_ref` (id of a GAMMA_REP), `expect` (`PASS` or `FAIL`), `failing_pairs` (list `i:j` or `none`). +3. PLANE_WAVE: `rep_ref`, `m`, `p` (rationals), `energy` (rational or scaled decimal with bound), `amplitude` (matrix n x 1, unnormalized), `convention_note` (E). +4. DISPERSION: `m`, `p`, `energy_squared` (rational), `energy` (rational, or scaled decimal plus `bound`), `error_kind` (EXACT or BOUNDED_DETERMINISTIC). +5. BASIS_CHANGE: `rep_from`, `rep_to`, `S`, `S_inv`, `observable` (`dispersion` or `trace_products`), `expect`. +6. HIPREC_REF: `quantity` (E), `value` (scaled decimal), `bound` (scaled decimal), `route_a_digest`, `route_b_digest` (SHA-256 of each route's decimal output). + +## 4. Worked examples (checked by hand) + +Representation 1, Dirac style, metric diag(+1,-1): g0 = sigma_z, g1 = i sigma_y. +``` +record GAMMA_REP rep-a +rep_name dirac-1p1 +dim 2 +size 2 +metric 1,-1 +g0 [(1/1;0/1),(0/1;0/1)|(0/1;0/1),(-1/1;0/1)] +g1 [(0/1;0/1),(1/1;0/1)|(-1/1;0/1),(0/1;0/1)] +endrecord +``` +Hand check. g0 g0 = I, so g0^2 = +I = metric(0,0) I with factor 2: {g0,g0} = 2 I. OK. +g1 g1 = [[0,1],[-1,0]] times itself = [[-1,0],[0,-1]] = -I, so {g1,g1} = -2 I = 2 metric(1,1) I. OK. +g0 g1 = [[1,0],[0,-1]] [[0,1],[-1,0]] = [[0,1],[1,0]]. g1 g0 = [[0,1],[-1,0]] [[1,0],[0,-1]] = [[0,-1],[-1,0]]. Sum is the zero matrix, matching 2 metric(0,1) I = 0. OK. +``` +record CLIFFORD_CHECK cliff-a +rep_ref rep-a +expect PASS +failing_pairs none +endrecord +``` + +Representation 2, Weyl style: g0 = sigma_x, g1 = -i sigma_y. +``` +record GAMMA_REP rep-b +rep_name weyl-1p1 +dim 2 +size 2 +metric 1,-1 +g0 [(0/1;0/1),(1/1;0/1)|(1/1;0/1),(0/1;0/1)] +g1 [(0/1;0/1),(-1/1;0/1)|(1/1;0/1),(0/1;0/1)] +endrecord +``` +Hand check. g0^2 = [[0,1],[1,0]]^2 = I. g1^2 = [[0,-1],[1,0]]^2 = [[-1,0],[0,-1]] = -I. g0 g1 = [[0,1],[1,0]] [[0,-1],[1,0]] = [[1,0],[0,-1]]. g1 g0 = [[0,-1],[1,0]] [[0,1],[1,0]] = [[-1,0],[0,1]]. Sum is zero. OK. + +Basis change from rep-a to rep-b with S = [[1,1],[1,-1]], S_inv = (1/2) S (S S_inv = (1/2) [[2,0],[0,2]] = I). +S g0 S_inv with g0 = sigma_z: S sigma_z = [[1,-1],[1,1]]; times (1/2) S = (1/2) [[1-1, 1+1],[1+1, 1-1]] = [[0,1],[1,0]] = sigma_x = rep-b g0. OK. +S g1 S_inv with g1 = [[0,1],[-1,0]]: S g1 = [[-1,1],[1,1]]; times (1/2) S = (1/2) [[-1+1, -1-1],[1+1, 1-1]] = [[0,-1],[1,0]] = rep-b g1. OK. +``` +record BASIS_CHANGE basis-ab +rep_from rep-a +rep_to rep-b +S [(1/1;0/1),(1/1;0/1)|(1/1;0/1),(-1/1;0/1)] +S_inv [(1/2;0/1),(1/2;0/1)|(1/2;0/1),(-1/2;0/1)] +observable trace_products +expect PASS +endrecord +``` + +Dispersion, exact case m = 1, p = 3/4: E^2 = 9/16 + 1 = 25/16, E = 5/4. +``` +record DISPERSION disp-a +m 1/1 +p 3/4 +energy_squared 25/16 +energy 5/4 +error_kind EXACT +endrecord +``` + +## 5. Verification (written, not run) +`src/oracle_kat_verify.sh` recomputes the corpus digest with `sha256sum` and compares it to the `corpus_digest` line and the file name. `src/oracle_clifford.c` checks CLIFFORD_CHECK style relations on matrices given in the section 2 encoding (the first version reads a simplified fixed layout, see its header comment). diff --git a/research/dirac-oracle/ORACLE-SPEC.md b/research/dirac-oracle/ORACLE-SPEC.md new file mode 100644 index 000000000..1c2427989 --- /dev/null +++ b/research/dirac-oracle/ORACLE-SPEC.md @@ -0,0 +1,80 @@ +# DIRAC-0 independent oracle specification (PR D-02, evaluator side only) + +Status: NOT_RUN. Nothing in this directory is built, compiled or executed. The machine quiet flag was up when this was written. +Authority: `aien-architecture` `docs/plans/dirac/DIRAC-0-SPEC.md` (PROPOSED) and Drake's DIRAC-0 brief of 2026-10-01. The brief wins on any difference. + +## 1. What the oracle is + +The oracle is the evaluator's own, separate way to know the right answer for the Dirac conformance fixture. It checks an Omega candidate. It is never checked by it, never imported by it, and never needed to build it. + +Hard properties: +1. Shares no source, header, build rule or test harness with any Omega implementation. It does not include `src/` headers, does not link `omega_numeric` or the M20 tensor layer, and has no Makefile hook. +2. Is never an Omega dependency. Removing this directory must leave every Omega build and test unchanged. +3. Dirac is not an Omega primitive. This document proposes no Dirac-named builtin (no DiracSpinor, GammaMatrix, Electron, Mass, Spin). Omega-side work in D-03 to D-06 is generic (complex scalar, operator relations, constraint-defined algebras, differential operators) and justifies itself without this oracle. +4. Evaluator world only. Gamma matrices, the equation, interpretation and answer-key mappings live here and nowhere on the AIEN side. See section 8. +5. No libm, no floating point for reference values. Plain C and POSIX sh, integer arithmetic only. No outside dependencies. No Python. + +## 2. Capabilities (evaluator capabilities, not AIEN facts) + +### 2.1 Gamma representations +Declared per record: dimension `d` (number of generators, time plus space), matrix size `n`, metric diagonal, and a representation name. +- 1+1D first: n = 2, generators g0, g1, metric diag(+1,-1) (signature declared, never assumed). +- Representations: Dirac (g0 diagonal), Weyl/chiral (g0 off diagonal), Majorana (all entries real or purely imaginary as the signature requires). +- 3+1D later (Wave 4 step D1C-7): n = 4, g0..g3, metric diag(+1,-1,-1,-1). +- Matrix entries are Gaussian rationals (a/b + (c/d)i). No floating text. + +### 2.2 Clifford relation check +For every pair i,j: g_i g_j + g_j g_i = 2 metric(i,j) I, exactly, in Gaussian rational arithmetic. Result is a list of failing pairs. Zero failures is PASS, anything else FAIL. No tolerance: the check is algebraic. + +### 2.3 Analytic plane-wave cases +For declared rest parameter m and momentum p (rationals), the oracle states the exact energy where it is rational and a rational interval otherwise. Spinor amplitudes are given up to the declared normalization. The corpus carries the case, the representation, and the expected values. + +### 2.4 Dispersion cases +Relation E^2 = p^2 + m^2 (units declared in the record). Cases are chosen so E is rational where possible (for example m = 1, p = 3/4 gives E = 5/4) and otherwise carry a high precision value with a declared bound. + +### 2.5 Basis-change equivalence +Two representations A and B are equivalent if an invertible S exists with S g_i^A S^-1 = g_i^B for all i. The oracle checks the supplied S and S^-1 exactly (S S^-1 = I and the conjugation identity), then checks that declared observables (here: the dispersion energy and the trace of products of generators) agree between the two. Observables, not matrices, are what must agree. + +### 2.6 High precision references +Arbitrary precision implemented in this directory using only integer arithmetic (a simple in-file big integer over base 10^9 limbs, or exact rationals, no outside code). Every value is declared as `value = N / 10^k` with an integer bound `B` meaning |true - value| <= B / 10^k. A reference value is accepted into the corpus only when two independent routes agree within the declared bound: +- Route A: direct evaluation of the closed form (for example an integer square root by Newton iteration on the scaled integer). +- Route B: bracketing by bisection on exact rational squares. +Disagreement beyond the bound is a corpus defect, recorded, not patched around. + +### 2.7 Wave 4 ladder (capabilities added in this order, each its own PR, none are AIEN facts) +D1C-1 momenta, D1C-2 rest parameters, D1C-3 superpositions, D1C-4 wave packets, D1C-5 external fields, D1C-6 higher dimensions, D1C-7 full 3+1 Clifford. + +## 3. Tolerance policy +- Algebraic checks (Clifford, basis change, exact dispersion): exact, no tolerance. +- Numeric candidate outputs compared with oracle values: integer bounds, named as FORGE names them, `error_rel_ppb` (relative, parts per billion) and `error_abs` (absolute, in declared units of the last place), with the FORGE error kind (EXACT, BOUNDED_DETERMINISTIC, BOUNDED_STOCHASTIC, MEASURED_DISTRIBUTION) declared per case. Bit-level comparisons on the E1 side use the existing compare vocabulary (OMEGA_CMP_BIT_EXACT, OMEGA_CMP_INT_EXACT) unchanged. +- A bound is declared before the candidate runs and never widened after seeing a result. + +## 4. Mutation test plan (written, not run) +The oracle must reject broken fixtures. A scratch copy of the corpus is mutated and the verifier must fail with a named check: +1. Flip one sign in g1 (so g1^2 = +I under metric -1): CLIFFORD_CHECK must fail. +2. Swap g0 and g1 without swapping metric entries: CLIFFORD_CHECK must fail. +3. Drop the factor 2 in the anticommutator target: must fail. +4. Perturb S^-1 by one entry: BASIS_CHANGE must fail. +5. Change one dispersion digit beyond its bound: DISPERSION must fail. +6. Change one byte in the corpus body: digest check must fail. +Each mutation is a documented patch, applied to a scratch copy only. + +## 5. Independence checklist (reviewer ticks each before D-02 merges) +- [ ] No `#include` of anything under Omega `src/`. +- [ ] No shared constants or tables copied by reference (copy by value is allowed only for published textbook representations, and is cited). +- [ ] No Makefile, mk/ or test-runner hook. +- [ ] Reference values produced by two routes (section 2.6). +- [ ] Authors of any future Omega implementation do not edit this directory (lane B is independent of lane A). +- [ ] No Python files; no libm. + +## 6. Corpus format +See `CORPUS-FORMAT.md`. + +## 7. Source in this directory (all NOT_RUN) +`src/oracle_clifford.c` (exact Clifford relation check), `src/oracle_kat_verify.sh` (digest check), `README-NOT-BUILT.md`. + +## 8. Keeping the corpus out of AIEN reach +- The corpus and oracle live only in this evaluator-only directory. They are never copied into Omega `src/`, `tests/`, `evidence/`, `docs/`, any Cortex store, prompt, Skill or graph. +- Filenames, directory names and metadata that could reveal the answer (words such as Dirac, gamma, spinor, Clifford) must not appear on anything AIEN can read. The AIEN side receives only numeric observations, channel ids, timestamps, permitted interventions and uncertainty, produced later by the sealed dataset generator (D-11) from evaluator inputs. +- Sealing uses the existing G3 sealed-holdout commitment scheme (`spec/searchtrace/G3_SEALED_HOLDOUT_COMMITMENT_V1.md`); real sealing is BLOCKED_OPERATOR today. +- Note for reviewers: this directory is in the omega repository, which AIEN could read. Therefore everything here is the PUBLIC conformance corpus (textbook representations and relations that reveal nothing about a hidden experiment). Sealed experiment parameters and answer keys never go in this repository; they belong in the private sealed store owned by the operator. diff --git a/research/dirac-oracle/README-NOT-BUILT.md b/research/dirac-oracle/README-NOT-BUILT.md new file mode 100644 index 000000000..4b2fc6d4c --- /dev/null +++ b/research/dirac-oracle/README-NOT-BUILT.md @@ -0,0 +1,3 @@ +# NOT BUILT +Nothing here has been compiled or run (status NOT_RUN). There is no Makefile hook and none may be added to Omega `src/`, `tests/` or `mk/`. To build later, by hand, in a quiet window: +`cc -std=c11 -O0 -Wall -Wextra -o /tmp/oracle_clifford src/oracle_clifford.c` (no -lm, none needed). diff --git a/research/dirac-oracle/src/oracle_clifford.c b/research/dirac-oracle/src/oracle_clifford.c new file mode 100644 index 000000000..6e8bc7cf4 --- /dev/null +++ b/research/dirac-oracle/src/oracle_clifford.c @@ -0,0 +1,85 @@ +/* + * DIRAC-0 independent oracle: exact Clifford relation check. + * STATUS: NOT_RUN. Not compiled, not executed. No libm, no floating point. + * Shares no code with Omega. Entries are Gaussian INTEGERS (re,im as long long), + * which covers the small hand corpus; rational entries (such as 1/2) are for the + * basis-change check and are out of scope for this first file. + * + * Input on stdin (whitespace separated integers): + * d n generators and matrix size (n <= 4, d <= 4) + * m_0 .. m_{d-1} metric diagonal entries (integers) + * then for each generator, n*n entries as pairs "re im", row major. + * Bounds: every entry magnitude must be <= 1048576 (2^20) and each metric entry + * must be in {-1,0,1}; inputs outside are rejected (exit 2), so no overflow occurs. + * Output: one line "FAIL i j" per failing pair, then "PASS" or "FAIL_COUNT k". + * Exit status 0 on PASS, 1 on FAIL, 2 on bad input. + */ +#include <stdio.h> + +#define MAXD 4 +#define MAXN 4 + +typedef struct { long long re, im; } gi; +typedef struct { gi a[MAXN][MAXN]; } mat; + +static gi gmul(gi x, gi y) { + gi r; + r.re = x.re * y.re - x.im * y.im; + r.im = x.re * y.im + x.im * y.re; + return r; +} + +static void matmul(const mat *x, const mat *y, int n, mat *out) { + int i, j, k; + for (i = 0; i < n; i++) + for (j = 0; j < n; j++) { + gi s = {0, 0}; + for (k = 0; k < n; k++) { + gi t = gmul(x->a[i][k], y->a[k][j]); + s.re += t.re; + s.im += t.im; + } + out->a[i][j] = s; + } +} + +int main(void) { + int d, n, i, j, r, c; + long long metric[MAXD]; + mat g[MAXD]; + int fails = 0; + + if (scanf("%d %d", &d, &n) != 2) return 2; + if (d < 1 || d > MAXD || n < 1 || n > MAXN) return 2; + for (i = 0; i < d; i++) + if (scanf("%lld", &metric[i]) != 1 || metric[i] < -1 || metric[i] > 1) return 2; + for (i = 0; i < d; i++) + for (r = 0; r < n; r++) + for (c = 0; c < n; c++) + if (scanf("%lld %lld", &g[i].a[r][c].re, &g[i].a[r][c].im) != 2 || g[i].a[r][c].re > 1048576 || g[i].a[r][c].re < -1048576 || g[i].a[r][c].im > 1048576 || g[i].a[r][c].im < -1048576) return 2; + + for (i = 0; i < d; i++) + for (j = i; j < d; j++) { + mat p, q; + int bad = 0; + matmul(&g[i], &g[j], n, &p); + matmul(&g[j], &g[i], n, &q); + for (r = 0; r < n; r++) + for (c = 0; c < n; c++) { + long long want = (r == c && i == j) ? 2 * metric[i] : 0; + /* off-diagonal generators: target is 2*metric(i,j) I, metric is diagonal so it is 0 */ + if (p.a[r][c].re + q.a[r][c].re != want) bad = 1; + if (p.a[r][c].im + q.a[r][c].im != 0) bad = 1; + } + if (bad) { + printf("FAIL %d %d\n", i, j); + fails++; + } + } + if (fails == 0) { + printf("PASS\n"); + return 0; + } + printf("FAIL_COUNT %d\n", fails); + return 1; +} diff --git a/research/dirac-oracle/src/oracle_kat_verify.sh b/research/dirac-oracle/src/oracle_kat_verify.sh new file mode 100755 index 000000000..7a74ee7ea --- /dev/null +++ b/research/dirac-oracle/src/oracle_kat_verify.sh @@ -0,0 +1,14 @@ +#!/bin/sh +# DIRAC-0 oracle corpus digest check. STATUS: NOT_RUN. POSIX sh plus sha256sum only. +# usage: oracle_kat_verify.sh dirac-kat-<sha256>.txt +set -eu +f="$1" +[ "$(tail -c1 "$f" | od -An -c | tr -d " ")" = "\\n" ] || { echo "FAIL missing trailing LF"; exit 1; } +[ "$(tail -n1 "$f")" = "end" ] || { echo "FAIL missing end marker"; exit 1; } +want=$(sed -n 's/^corpus_digest //p' "$f") +name=$(basename "$f" .txt) +name=${name#dirac-kat-} +got=$( { printf 'omega.dirac.kat.v1\000'; sed '/^corpus_digest /,$d' "$f"; } | sha256sum | cut -d' ' -f1 ) +[ "$got" = "$want" ] || { echo "FAIL digest line mismatch"; exit 1; } +[ "$got" = "$name" ] || { echo "FAIL file name mismatch"; exit 1; } +echo PASS