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 / research / atemporal / at0 / oracle / README.md

210 lines · 13174 bytes Raw Blame History Rendered
1# AT-0 reference oracle (Rust, standard library only)
2
3Independent cross-check for the AT-0 Page-Wootters qualification. Given an `AT0_CASE_V1`
4file it rebuilds the finite model from scratch, conditions the stationary state on each
5clock outcome by direct complex linear algebra, computes X/Y/Z probabilities two more ways
6without any clock matrix, judges every check in exact arithmetic, and writes an
7`AT0_RESULT_V2` record. Reproducing the known mathematics here is a calibration result,
8not a discovery.
9
10Owner: Agent 2 (charter `aien-dev/aien-architecture` ADR-0038, `omega#358`). Everything
11lives in this directory. Nothing here is the candidate engine and nothing here is used by
12it: `research/atemporal/at0/model/` (Agent 3, C11, merged in `omega#360`) and this
13directory share no source, no parser, no arithmetic and no build step.
14
15## Rulings this code follows
16
17- Drake, 2026-10-09 (relayed on `omega#358`): Rust, standard library only. No crates, no
18 Cargo, no Python anywhere. Built by `rustc` directly with pinned flags.
19- Agent 0, `omega#358` comment `6090404007`: result records are `AT0_RESULT_V2`
20 (`OMEGA-AT0-RESULT v2`, `domain omega.at0.result.v2`, verdict tag `omega.at0.verdict.v2`,
21 evidence tag `omega.at0.evidence.v2`). On a trivial kernel every label is `UNDEFINED` and
22 `constraint_residual`, `clock_probability` and `pauli` lines read `undefined 0@0`;
23 `povm_residual` and `reference` lines stay real. The parser refuses `undefined` anywhere
24 else. Case files stay `AT0_CASE_V1`.
25- Agent 0, `omega#358` (component outputs): the oracle's output is a component output, not
26 a third interface. Its `reference <k> <AXIS> <SIGN> <value> <bound>` lines are byte-valid
27 per the V2 values-block grammar and order (k ascending, then X Y Z, then PLUS MINUS) so
28 Agent 5's runner can splice them next to the engine block verbatim. This oracle emits no
29 wrapper format of its own: the whole file is one `AT0_RESULT_V2` record. Any future
30 wrapper line would be versioned here and would need Agent 5 re-review.
31
32Contracts: `AT0_CASE_V1` frozen at `aien-architecture` `044c9d1` (`CASE_CONTRACT_COMMIT`),
33`AT0_RESULT_V2` added at `c7a7181` and recorded in `AT0_FREEZE` at
34`fe86e43aae63370b3084f78e971a33b81ce75a9d`, which is the `contract_commit` every record
35writes (`CONTRACT_COMMIT`; Agent 5 finding D7, evaluator allowlist). The hand-table tests
36and the `spec-*` fixtures target the mathematical contract `AT0_SPEC.md`, merged as
37`68f47e26764a9f0b46d91194bf073824d04333bb` (`SPEC_COMMIT` in `src/at0/mod.rs`; Agent 5
38finding D8). Re-verified against that commit on 2026-10-09: section 13.2 P1 and P1c, and
3913.3 N1 to N5 agree with the fixtures below, and 13.2 P2 was added as a fixture.
40
41## Layout
42
43```
44build.sh exact rustc invocation (build | test | lib)
45isolation.sh symbol-isolation gate for the compute crate (source rule + nm -u + mutant)
46rust-toolchain.toml rustc 1.98.1 pin (informational; build.sh records the real version)
47src/main.rs the only file that touches files, git, the process table or the wall clock;
48 CLI (emit | fixtures | check) and the test suite
49src/at0/mod.rs compute crate root; SPEC_COMMIT
50src/at0/rational.rs i128 rationals (exact spectrum, kernel pairs, identities)
51src/at0/sha256.rs own SHA-256 (case_id, acceptance_id, verdict_id, evidence_digest)
52src/at0/exact.rs fixed-point big integers: exact comparison of f64 tokens with scaled decimals
53src/at0/complex.rs complex numbers and dense complex matrices (Vec<Vec<C>>)
54src/at0/case.rs AT0_CASE_V1 parser/validator in contract order, case builder for tests
55src/at0/matrix_path.rs H_C, H_S, H_total, kernel projector, Psi, POVM, conditioning, rho_k, Pauli
56src/at0/reference.rs analytic paths: Schrodinger closed form and Bloch/Rodrigues rotation
57src/at0/result.rs values block, exact judge, verdict block, AT0_RESULT_V2 writer and values parser
58src/at0/fixtures.rs the 22 calibration fixtures and their hand-derived expectations
59fixtures/ <name>.case, <name>.values, CALIBRATION.md (all generated, deterministic)
60NUMERICAL_ERROR.md stated bounds, measured errors, limitations
61```
62
63## Build
64
65Exact command (`./build.sh build`):
66
67```
68rustc --edition 2021 -C opt-level=2 -C codegen-units=1 -C debuginfo=0 -C panic=abort -D warnings \
69 --crate-name at0_oracle src/main.rs -o target/at0-oracle
70```
71
72`build.sh` exports the compiler's own `rustc --version` line, host triple and the flag
73string into the binary (`option_env!`), which is where `build_cc` and `build_flags` in the
74provenance block come from. The test build uses the same flags minus `-C panic=abort`
75(the test harness needs unwinding) plus `--test`. `./build.sh lib` builds the compute crate
76alone as an rlib for the isolation gate.
77
78Toolchain the fixtures and numbers in this directory were produced with:
79
80```
81rustc 1.98.1 (48a229cea 2026-09-01)
82binary: rustc
83commit-hash: 48a229ceaefd4985c50990b14116b6d856af0985
84commit-date: 2026-09-01
85host: aarch64-unknown-linux-gnu
86release: 1.98.1
87LLVM version: 22.1.8
88```
89
90No Cargo, no crates, no `build.rs`, no network, no C library beyond what Rust's standard
91library links itself.
92
93## Use
94
95```
96./build.sh # target/at0-oracle
97./build.sh test # 14 tests (4 unit, 10 contract/physics)
98./isolation.sh # ISOLATION PASS expected
99target/at0-oracle check <case> # validate; prints case_id, acceptance_id, file sha256
100target/at0-oracle emit <case> [--dephased] [-o out] # AT0_RESULT_V2 record
101target/at0-oracle fixtures <dir> # regenerate fixtures/ (45 files)
102```
103
104A refused case prints exactly `AT0_CASE_REFUSED <code>` on stderr, writes nothing and exits
1052. `--dephased` replaces the pure physical state by its kernel-branch dephasing (negative
106control) and marks `build_cc` with `(dephased control)`; such a record is a control, never
107a qualification result.
108
109Provenance: `source_commit`/`source_tree_clean` come from `git` run in this directory.
110Every record is marked as oracle output so it can never be cited as the candidate engine's
111result (Agent 0 condition on the omega#359 approval): `build_cc` begins with the literal
112`oracle ` and `engine_sha256` equals `oracle_sha256`, both the SHA-256 of the running
113oracle executable (the matrix path and the analytic path are two modules of one binary).
114The writer refuses to produce a record that violates either rule (tested). `verdict_id` depends
115only on the case and the values; `evidence_digest` covers the timestamps too, so two runs
116agree on `verdict_id` and differ in `evidence_digest` (tested).
117
118## What is independent, and how that is enforced
119
120- Own parser and validator for `AT0_CASE_V1` reproducing the contract's known-answer
121 digests (`case_id 3cf4ca4f...`, `acceptance_id a13fb02d...`, file sha `ed16c95c...`).
122- Own SHA-256, own rationals, own complex/matrix arithmetic, own exact decimal comparison.
123 No line is shared with, derived from or linked against the C11 engine.
124- Three routes to every Pauli probability: dense matrix conditioning (`rho_k`), the
125 closed-form Schrodinger evolution, and a Bloch-vector rotation in real arithmetic. All
126 three must agree to `1e-12` in the tests; they agree to about `2e-16`.
127- Two routes inside the matrix path: condition the vector, or condition the density matrix
128 `|Psi><Psi|` and renormalize. Both must agree (tested, Frobenius `<= 1e-12`).
129- The compute crate (`src/at0/`) may not read the clock, files, environment, processes,
130 threads, network or randomness. `isolation.sh` enforces this in three steps: a source rule
131 (grep for the forbidden facilities), an object rule (`nm -u` on the compute rlib for
132 `clock_gettime`, `getrandom`, `pthread_create`, `socket`, `open64`, `getenv`, ... ), and a
133 negative control that plants a `std::time` read in a copy and checks that the source rule
134 and the object rule each catch it on their own. The object rule bans two symbol families:
135 libc entry points and mangled Rust std paths (`3std4time`, `3std2fs`, ...), because a
136 `std::time` call leaves no libc symbol in the rlib (Agent 5 finding D5).
137- Exact judging: every check compares the written `f64:` token, converted exactly, against
138 the exact scaled-decimal tolerance. No float comparison decides a verdict.
139
140## Tests (`./build.sh test`)
141
142`known_answer_digests_and_kernel`, `refusals_in_contract_order` (version, parse, canonical
143form, duplicate keys, CRLF, invalid parameters, irrational spectrum, identity mismatch,
144acceptance rules, size limit), `case_name_outside_identity_and_tokens`,
145`reference_model_hand_table` (exact constraint, POVM completeness, uniform `1/N`, the X/Y/Z
146table), `density_matrix_properties_and_routes` (Hermitian, unit trace, eigenvalues in
147`[0,1]`, probabilities in `[0,1]`, vector route = density route),
148`multiple_n_offsets_phases_tilts` (`N` in 3,4,5,6,8,12; reference label `t1..t3`; tilted
149and `h0`-shifted fields; global phases `i`, `-1`, `2`, `-3i`), `negative_controls`
150(dephased mixture, uncovered and half-covered spectra, wrong weight, broken clock, rigorous
151demand), `spec_draft_reference_model` (draft theorems, T4 eigenstate, T5 relational phase,
152N3, N4), `record_shape_and_wall_clock_independence`, `fixtures_render_and_meet_expectations`,
153plus unit tests for SHA-256 (FIPS vectors), rationals, complex algebra and exact comparison.
154
155## Fixtures and how their expectations were derived
156
157`fixtures/` holds 22 cases, their `.values` (values block, verdict block, `verdict_id`) and
158`CALIBRATION.md`. All of it is written by `target/at0-oracle fixtures fixtures/` with no
159wall clock, so re-running it reproduces the files byte for byte. The `.case` files are
160identical to the ones first published on this branch (checked with `cmp`).
161
162Expectations are hand-derived exact rationals, not numbers copied from a run:
163
164- Ideal clock (`E_j = j - (N-1)/2`, `H_S = sigma_z/2`, `psi_0 = |+>`, `tau = 1/N`, `w = 1`):
165 the kernel is spanned by `|E=1/2>|1>` and `|E=-1/2>|0>`, so every `p(k) = 1/N` exactly,
166 and with `theta_k = 2 pi k / N` the table is `P(X+) = (1 + cos theta)/2`,
167 `P(Y+) = (1 - sin theta)/2`, `P(Z+) = 1/2`. Expectations are recorded only at labels where
168 `cos`/`sin` are rational (`0`, `+-1/2`, `+-1`), which is why `N = 3, 5` check 7 values and
169 `N = 4, 6, 8` check 14 or 28.
170- Offset reference `t2`: same table shifted by two labels. Global phase `i` and the
171 unnormalized state `(2, 2)`: same table as the ideal case (phase and norm cancel).
172- Draft spec model (`E = -1, 0`, `H_S = diag(0, 1)` written as `h0 = 1/2, hz = -1/2`,
173 `w = 1/2`): the spec's own table; `hz = -1/2` flips the sign of `sin`, so
174 `P(Y+) = (1 - sin theta)/2`. T4 (`psi_0 = |0>`): `P(Z+) = 1`, X and Y `1/2` at every label.
175 T5 (`psi_0 = (1, i)`): the table shifted one label backwards, i.e. `theta -> theta - pi/2`.
176- Spec section 13.2 P2 (`spec-p2-tilted-h0`: `h0 = 1/10`, `h = (3/10, 0, 2/5)`, clock
177 `E = -3/5, 2/5`, `psi_0 = |0>`, `w = 1/2`): the Bloch vector `(0, 0, 1)` rotated about
178 `n = (3/5, 0, 4/5)` by `k pi / 2` gives `(12/25, -3/5, 16/25)`, `(24/25, 0, 7/25)`,
179 `(12/25, 3/5, 16/25)`, so `P(X+) = 1/2, 37/50, 49/50, 37/50`, `P(Y+) = 1/2, 1/5, 1/2, 4/5`,
180 `P(Z+) = 1, 41/50, 16/25, 41/50`, `p(k) = 1/4`. Fully rational, so all 16 values are checked.
181- Negative controls carry no rational expectations; their expectation is the failure code
182 set declared in the case's own acceptance block, and `expectation_met YES` means the
183 oracle produced exactly those codes.
184
185`CALIBRATION.md` lists per fixture the number of exact values checked and the largest
186deviation seen; the worst is `2.2e-16` (one unit in the last place of `1/2`).
187
188## Findings worth knowing (calibration, not discovery)
189
1901. A broken clock (`tau = 1/3` with `N = 4`) and the correct weight `w = N/M` fails only
191 `povm_normalization`; the clock probabilities still sum to one. A wrong weight fails both
192 `povm_normalization` and `probability_sum`.
1932. In the draft spec's convention the sign of the Y row depends on the sign of `hz`; the
194 closed form and the matrix path agree, so any disagreement with another implementation is
195 a convention error, not numerics.
1963. The relational phase `(1, i)` shifts the pattern one label backwards, not forwards.
1974. On a trivial kernel (fixture `n1-uncovered`) V2 section 4 fixes check 3 `FAIL` and checks
198 4, 6, 7, 8, 9, 10 `NOT_EVALUATED` even though the `reference` lines are still written;
199 the first release of this oracle evaluated check 7 on those lines (Agent 5 finding D4),
200 fixed and tested since.
2015. Dephasing the kernel branches keeps `p(k) = 1/N` and Hermitian unit-trace `rho_k` but
202 flattens every X and Y probability to `1/2`: the clock correlation survives, the
203 interference pattern does not. This is the `nc-dephased-control` fixture.
204
205## What this is not
206
207Not the candidate engine, not a verifier of Agent 3's internals, not a RIGOROUS bound
208(see `NUMERICAL_ERROR.md`), and not a statement about any physical experiment. It never
209reads evaluator-private held-out data or hidden qualification parameters; every input is a
210public `.case` file in this directory or one handed to it on the command line.