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 / research / atemporal / at1 / evaluator / README.md
| 1 | # AT-1 Agent 4: adversarial evaluator |
| 2 | |
| 3 | Independent evaluator for AT-1 (aien-dev/omega#371). It reads only the frozen contracts |
| 4 | `AT1_CASE_V1`, `AT1_RESULT_V1` and `AT0_RESULT_V2` (identical at arch commits `cbe4c8e`, |
| 5 | `81047f5` and `ea91d7c`) and `AT1_SPEC` / `AT1_CHARTER`; it never reads the oracle's |
| 6 | (Agent 2) or the engine's (Agent 3) code. PASS here means conformance to those |
| 7 | documents and nothing else; no statement about physics is made or implied. |
| 8 | |
| 9 | Rust 2021, std only, no Cargo, one `rustc` call; the gate controls need a C11 compiler. |
| 10 | Portable to macOS arm64 (Apple clang 17, GNU make 3.81, rustc 1.97.1): POSIX sh, no |
| 11 | GNU-make-4 features, digests computed in code. No Python. |
| 12 | |
| 13 | ## Run lines |
| 14 | |
| 15 | ```sh |
| 16 | make # build/at1-eval |
| 17 | make test # unit tests, selftest, corpus byte check, mutant receipt (cmp with the committed one), gate controls; writes only under build/ |
| 18 | make receipts # refresh results/MUTANT_RECEIPT.tsv and results/ISOLATION_RECEIPT.txt |
| 19 | make corpus # regenerate cases/ (corpus-check must then report 0 differ) |
| 20 | |
| 21 | # qualify the candidates (templates: {case} = case path, {out} = result path; without {out}, stdout) |
| 22 | sh run.sh '<engine> {case} {out}' '<oracle> {case} {out}' [cases] [out-dir] [hidden-dir] |
| 23 | |
| 24 | # isolation gate G2 on the candidates' compute objects (not on static executables, see limits) |
| 25 | sh gates/isolation.sh ./build/at1-eval <object.o>... |
| 26 | |
| 27 | # single tools |
| 28 | ./build/at1-eval case <file> [--why] # codec: AT1_CASE_OK or one stderr line, exit 2 |
| 29 | ./build/at1-eval shadow <case> # exact (or double-double) model values |
| 30 | ./build/at1-eval verify --case <case> <result> # exit 0 PASS, 1 FAIL, 3 INCONCLUSIVE |
| 31 | ./build/at1-eval verify --case <case> --oracle-record <rec> |
| 32 | ./build/at1-eval splice <engine-result> <oracle-record> <out> |
| 33 | ``` |
| 34 | |
| 35 | A dry run with the built-in honest synthetic engine and oracle (all gates PASS): |
| 36 | `B=$PWD/build/at1-eval; sh run.sh "$B synth-engine {case} {out}" "$B synth-oracle {case} {out}"`. |
| 37 | |
| 38 | ## What is here |
| 39 | |
| 40 | | Path | Content | |
| 41 | |---|---| |
| 42 | | `cases/` | public corpus, 96 files: 12 positive (P1a/b/c, P2 KAT, P2 variants t4 global phase i and t5 scale 2, P3, P3b, P4 ref t1, P4 ref t0, P5, P6), 12 negative (N1 to N1f IDEAL target, N2, N3, N4a, N4b, N5, N6), 72 refusals (spec 13.5 rows R0a to R14, AT-0 rows R01 to R39 re-expressed, charter-reading rows X1 to X6, and X7 `clock_dim 0` with `clock_energies none`). `MANIFEST.tsv` gives each file's expected codec response. | |
| 43 | | `src/` | codec (`case.rs`), strict result parser and writer (`result.rs`), check re-derivation (`judge.rs`), verifier (`verify.rs`), shadow model (`model.rs`), runner splice and synthetic candidates (`synth.rs`), corpus generator (`corpus.rs`), mutants (`mutants.rs`), hidden-set generator (`hidden.rs`), instruction scanner (`scan.rs`), qualification and selftest (`qualify.rs`) | |
| 44 | | `gates/` | isolation gate `isolation.sh` and its four C controls: clean, hidden clock (`clock_gettime`), counter (inline `mrs cntvct_el0` / `rdtsc`), raw syscall (inline `svc` / `syscall`); these are spec 9.2 mutant M7 | |
| 45 | | `results/MUTANT_RECEIPT.tsv` | mutant kill receipt (deterministic and host-independent; `make test` regenerates it under build/ and compares) | |
| 46 | | `results/ISOLATION_RECEIPT.txt` | gate controls receipt from the host that last ran `make receipts` | |
| 47 | | `HIDDEN_COMMITMENT.txt` | SHA-256 commitment of the 27-case hidden set; seed and files withheld | |
| 48 | |
| 49 | ## Design |
| 50 | |
| 51 | - **Codec.** Independent `AT1_CASE_V1` parser; every refusal row must give exactly its code |
| 52 | (one stderr line, exit 2) from my codec, the engine and the oracle (gate G1). The KAT |
| 53 | `at1-kat-rotated-level-n4` reproduces case_file_sha256 `76e282fe...9ba4`, case_id |
| 54 | `890980a4...25f1` and acceptance_id `d63246c3...4d8f` (selftest). |
| 55 | - **Shadow model.** Exact rational arithmetic when every phase is a quarter turn, otherwise |
| 56 | double-double with a claimed bound of 1e-24. It reproduces the spec 13.2 hand tables |
| 57 | exactly and the 13.3 deviation maxima (selftest, 549 assertions). |
| 58 | - **Runner splice.** The engine writes engine lines with `reference_*` undefined; the |
| 59 | splice copies all four reference families from the oracle record, binds oracle |
| 60 | provenance, re-judges checks 1 to 12 per `AT0_RESULT_V2` sections 4 and 5 and reseals |
| 61 | `verdict_id` and `evidence_sha256`. An oracle ERROR record gives ERROR `ORACLE_UNAVAILABLE`. |
| 62 | - **Verify.** Re-derives every check, the outcome, the codes and the expectation from the |
| 63 | written values and compares; decides check 3 (trivial kernel) from the exact shadow, as |
| 64 | AT-0 did, while the splice judges on the engine's own claim; compares every engine and |
| 65 | reference value with the shadow. Engine lines: beyond bound plus tolerance is a FAIL; |
| 66 | beyond only its own bound is a FAIL for RIGOROUS, INCONCLUSIVE for ESTIMATED, nothing for |
| 67 | NONE. Reference lines are calibration data and are judged on the value alone: farther than |
| 68 | the tolerance from the exact value is a FAIL whatever bound is written beside it, so a wrong |
| 69 | reference cannot hide behind a wide bound, also where no check reads it (`reference_ideal` |
| 70 | under an INTERACTING target, or on a trivial kernel). |
| 71 | - **Per-case table.** `qualify` writes `TABLE.tsv` (PASS / FAIL / INDETERMINATE per case; |
| 72 | INCONCLUSIVE findings map to INDETERMINATE) and `VERDICT_IDS.tsv`, prints the gate lines |
| 73 | G1, G3, G4, G5 and T9 (engine run twice with another time zone and an extra environment |
| 74 | variable), and exits 0 only when all pass. G2 is `gates/isolation.sh`; G6 and G7 belong |
| 75 | to Agents 6 and 7. |
| 76 | |
| 77 | ### Finding codes |
| 78 | |
| 79 | | Code | Severity | Meaning | |
| 80 | |---|---|---| |
| 81 | | E4-PARSE | FAIL | result not byte-exact `AT1_RESULT_V1` | |
| 82 | | E4-VERDICT-ID, E4-EVIDENCE-DIGEST | FAIL | identity digest does not recompute | |
| 83 | | E4-CASE-SHA, E4-CASE-BINDING | FAIL | copied case lines do not rebuild the case file, or ids do not match the case | |
| 84 | | E4-PROV-ORACLE-RECORD, -ORACLE-IS-ENGINE, -NONE, -TIME-ORDER | FAIL | provenance rule broken | |
| 85 | | E4-PROV-CONTRACT-UNKNOWN, E4-PROV-DIRTY-TREE | INCONCLUSIVE | contract commit off the allowlist, or dirty tree | |
| 86 | | E4-PLACEHOLDER-SHAPE, E4-RUN-NOT-COMPLETED, E4-UNDEFINED-DISCIPLINE, E4-TRIVIAL-SHAPE, E4-ORACLE-TRIVIAL, E4-LABEL-RULE, E4-BOUND-NONE-NONZERO | FAIL | shape rules of the result contract | |
| 87 | | E4-CHECK-MISMATCH, -OUTCOME-MISMATCH, -CODES-MISMATCH, -EXPECTATION-MISMATCH | FAIL | written verdict differs from the re-derived one | |
| 88 | | E4-EXPECTATION-NOT-MET | FAIL | candidate's result does not meet the case's expectation | |
| 89 | | E4-EXPECTATION-INDETERMINATE | INCONCLUSIVE | the only discrepancy is `PRECISION_INSUFFICIENT` | |
| 90 | | E4-SHADOW-KERNEL-DIM, -TRIVIAL, -POVM, -CLOCK, -LABEL, -PAULI | FAIL | engine value disagrees with the shadow | |
| 91 | | E4-ORACLE-CLOCK, -LABEL, -INTERACTING, -IDEAL | FAIL | spliced reference disagrees with the shadow (gate G3) | |
| 92 | | E4-BOUND-CLAIM-FALSE | FAIL | RIGOROUS bound does not cover the shadow difference | |
| 93 | | E4-BOUND-ESTIMATE-LOW | INCONCLUSIVE | ESTIMATED bound does not cover the shadow difference | |
| 94 | |
| 95 | ### Mutants (`results/MUTANT_RECEIPT.tsv`, 244 cells, 0 unexpected) |
| 96 | |
| 97 | Each cell is KILLED (its intended finding fires), FLAGGED (INCONCLUSIVE by design), |
| 98 | BLIND (predicted from spec 9.2 or from the honest values; any unpredicted blindness fails |
| 99 | the receipt), UNEXPECTED (killed although predicted blind, so the mutant is not the one the |
| 100 | spec describes; fails the receipt), ACCIDENT (killed only by an unintended finding, fails the |
| 101 | receipt) or SURVIVED. Oracle-mutant blindness is predicted the same way: O2 where M1 is blind |
| 102 | (P1, P1c); O3 where M4 is blind (P6, N1f), on trivial kernels (every reference undefined), and |
| 103 | on real-data cases with P(Y+) = 1/2 on every DEFINED label, where a phase-sign flip is complex |
| 104 | conjugation (N3). |
| 105 | |
| 106 | | Mutant | Killed | Blind (predicted) | |
| 107 | |---|---|---| |
| 108 | | M1 drop V | 15 | 3 (P1a, P1b, P1c) | |
| 109 | | M2 flip V | 15 | 3 | |
| 110 | | M3 wrong level | 16 | 2 | |
| 111 | | M4 phase sign | 16 | 2 (P6, N1f) | |
| 112 | | M5 Y sign, M6 axis swap | 16, 18 | 2, 0 | |
| 113 | | M8 IDEAL marginal from engine instead of w/N | 15 | 3 | |
| 114 | | M9 stale label status, M10 NONE bound nonzero | 1, 1 | 0 | |
| 115 | | O1 oracle IDEAL without h, O2 oracle drop V, O3 oracle phase sign (all 24 valid cases) | 24, 21, 19 | 0, 3, 5 | |
| 116 | | F1 to F18 file forgeries, F9 oracle record presented as candidate, F19/F20 wrong `reference_ideal` behind a bound of 1 (P2, N2) | 18 killed, 2 flagged (F15, F16) | 0 | |
| 117 | | M7 counter and raw-syscall clock (gate controls) | 3 of 3 mutants FAIL the gate, clean control PASS | | |
| 118 | |
| 119 | All 24 honest controls PASS. M2 is trivial on P3 and P6, as spec 9.2 states. |
| 120 | |
| 121 | ## Hidden set |
| 122 | |
| 123 | `at1-eval hidden-gen <seed> <dir>` draws 27 cases (families F0 to F8 of spec 13.1 item 7, |
| 124 | index mod 9) from a SHA-256 counter-mode stream keyed by a private 256-bit seed; a draw is |
| 125 | kept only if its honest verdict has the family's intended codes and it meets the spec 8.3 |
| 126 | margin rule. Only the commitment is in the repository (`HIDDEN_COMMITMENT.txt`, procedure of |
| 127 | spec 12.3 item 3). At reveal, `run.sh` recomputes the commitment before running the cases. |
| 128 | Agent 7 keeps its own, separate hidden set. |
| 129 | |
| 130 | ## Limits |
| 131 | |
| 132 | 1. Isolation is procedural on one host and one account: the hidden-set digest proves the |
| 133 | identity of the files later revealed, not that nobody read them. |
| 134 | 2. The gate scans compute objects. Static executables contain libc's own `svc` and clock |
| 135 | code, so apply it to the candidates' object files or compute-only archives. |
| 136 | 3. The x86-64 instruction scan is a byte-pattern scan and can report false positives in |
| 137 | data inside executable sections; the aarch64 scan decodes aligned words. |
| 138 | 4. The shadow's double-double path (non-quarter-turn phases) is not exact; it claims 1e-24, |
| 139 | far inside every tolerance in the corpus, and is checked against the exact path in selftest. |
| 140 | 5. ESTIMATED engine bounds that miss the shadow give INCONCLUSIVE, not FAIL. |
| 141 | `E4-BOUND-NONE-NONZERO` applies to every line, references included (AT1_RESULT_V1 section 2: |
| 142 | NONE means every bound `0@0`). When the engine and oracle bound kinds differ, the spliced file |
| 143 | carries the engine's kind over the oracle's bounds; `qualify` notes it as |
| 144 | `NOTE:bound_kind-mixed` in the table (contract note below). |
| 145 | 6. Check 2 aggregates over references as well as engine values, as `AT0_RESULT_V2` section 4 |
| 146 | reads; `PRECISION_INSUFFICIENT` from an engine label is read from engine lines only. |
| 147 | 7. The hidden-set seed is passed on the command line (visible to local process listings |
| 148 | while the generator runs, about 0.1 s). |
| 149 | 8. No real engine or oracle existed on any remote branch when this was built; the |
| 150 | qualification so far ran against the synthetic candidates only. |
| 151 | 9. The hidden-set metadata is public by design: the generator is in the repository, so the |
| 152 | family of each index (index mod 9) and the 12 positive / 15 negative split are known; the |
| 153 | seed and the drawn parameters are not. |
| 154 | 10. Portability was checked on the MacBook (macOS arm64, Apple clang 17, GNU make 3.81, |
| 155 | rustc 1.97.1) from source in a temporary directory: `make test` passes there, and |
| 156 | `MUTANT_RECEIPT.tsv`, `VERDICT_IDS.tsv` and `TABLE.tsv` of the synthetic dry run are |
| 157 | byte-identical to the Spark run. The temporary directory was deleted afterwards. |
| 158 | |
| 159 | ## Contract notes (for Agent 0) |
| 160 | |
| 161 | - The two items spec 13.5 left out (an `AT0_CASE_V1` header, a non-canonical coupling index |
| 162 | token) are in the corpus as X1 (`CASE_PARSE_ERROR`) and X3 (`CASE_NONCANONICAL`), per charter |
| 163 | readings (d) and (e). |
| 164 | - `none` is read as the empty list everywhere (AT1_CASE_V1 section 2), so `clock_dim 0` with |
| 165 | `clock_energies none` passes the shape pass and is `CASE_INVALID_PARAMETER` (row X7). A list |
| 166 | whose only item would be the token `none` cannot be written; no numeric list is affected. |
| 167 | - R13 uses the value-preserving `6/20` for the spec's "2/10" example, which is the same |
| 168 | rational and still non-canonical. |
| 169 | - Open question: the runner splices oracle reference bounds under the engine's `bound_kind`; |
| 170 | the contracts do not say what the spliced file's `bound_kind` means when the two kinds |
| 171 | differ (for example a NONE engine with nonzero oracle bounds, which section 2 then makes a |
| 172 | FAIL). |