diff --git a/.crumb b/.crumb index e06bafddb..1ecf072d4 100644 --- a/.crumb +++ b/.crumb @@ -75,8 +75,8 @@ "purpose": "Directory polyglot. Purpose not yet described by a human." }, { - "digest": "44e165ded3c0da0114cf29ee58b52602b028850cf14adc1f7a1784e6d62f0ece", - "last_commit": "84fd7ab", + "digest": "ed5c8fdc724f43a6826bc619953f14a3b1d073793cb7452461bc45c4a39ad99b", + "last_commit": "9862488", "name": "research", "purpose": "Directory research. Purpose not yet described by a human." }, @@ -105,15 +105,15 @@ "purpose": "Directory tools. Purpose not yet described by a human." } ], - "children_root": "sha256:be86fdd09629e1a2d56ccfe72ceb5c5fba3545ee56e8f9cb50183c27cbc93965", - "compiled_at": "2026-10-09T22:45:44Z", + "children_root": "sha256:a583e7ad628303c2dc0b9a546476cb840c2c0dbc3c2e05a44a9bfa2194ea1ca3", + "compiled_at": "2026-10-09T22:54:25Z", "compiler": "crumb-compile/1", - "digest": "sha256:9b439fcd36855d398eea2d233e1d32ee7ef9f27bf44f05e2c906e65028000a30", + "digest": "sha256:879bc98477488ff2ee501cc9bc5d71ddf908facac4568a0a7c7047236a05bcf5", "evidence_files": 4847, "evidence_root": "sha256:8a1e306ee977789a3394c51305afc3121a0ba0d5e1735b29b2cc16ffd12f668a", - "files": 6876, - "generated_at_commit": "84fd7ab949fc95594f62c201618a17dcb0dc610e", - "source_tree": "sha256:a00da1ca4c7ff798d6ace49766b8fdd8230d467f7409ba5db1a2d5e35b7c370e" + "files": 6936, + "generated_at_commit": "98624882f542a3ad77b6edbd5e431af08fb4b625", + "source_tree": "sha256:b1e07573c03669d5af22a2ff8c727886f7347b1dd6c644d6dddf0025eaac94d8" }, "owner_lane": "", "provenance": { diff --git a/research/.crumb b/research/.crumb index 283a49826..56edcabbd 100644 --- a/research/.crumb +++ b/research/.crumb @@ -21,8 +21,8 @@ "generated": { "children": [ { - "digest": "9bd41455d908ebc17d819fa5352dd0f2aebdf786103ca2a2055ff5baafa6cf2f", - "last_commit": "84fd7ab", + "digest": "39bd5d405d08cb1c080b4b886b5e36fff9b609102394cc81234917e5e376d40d", + "last_commit": "9862488", "name": "atemporal", "purpose": "AT-0 Clock-Free Universe research program: relational (Page-Wootters) quantum models with no ext" }, @@ -33,15 +33,15 @@ "purpose": "Directory research/dirac-oracle. Purpose not yet described by a human." } ], - "children_root": "sha256:23834cc3d9d5d9d183921352ab1f62c6fa00aa99cf779de7e3ad4ef99a13ca9b", - "compiled_at": "2026-10-09T22:45:44Z", + "children_root": "sha256:d8570da519d1d2825952f527c3eeba431ec80171fd037b46fdd25d45d7798b12", + "compiled_at": "2026-10-09T22:54:25Z", "compiler": "crumb-compile/1", - "digest": "sha256:44e165ded3c0da0114cf29ee58b52602b028850cf14adc1f7a1784e6d62f0ece", + "digest": "sha256:ed5c8fdc724f43a6826bc619953f14a3b1d073793cb7452461bc45c4a39ad99b", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "files": 164, - "generated_at_commit": "84fd7ab949fc95594f62c201618a17dcb0dc610e", - "source_tree": "sha256:3d737da4cf5a4a8fc4d17cf42bda1285894da95c1dd37c32519a63b2795764e5" + "files": 224, + "generated_at_commit": "98624882f542a3ad77b6edbd5e431af08fb4b625", + "source_tree": "sha256:52c28962ff5a9ee0b10ea71d8e5db6d2bf692787afff16e64cd30ce5876ea157" }, "owner_lane": "", "provenance": { diff --git a/research/atemporal/.crumb b/research/atemporal/.crumb index af4da3e6b..227f6dce5 100644 --- a/research/atemporal/.crumb +++ b/research/atemporal/.crumb @@ -3,21 +3,21 @@ "generated": { "children": [ { - "digest": "15c7532e6dcf6d819d40281b58ce6c61e22efacf50d568ffd1eec5e264aa65c6", - "last_commit": "84fd7ab", + "digest": "47989e5a75e0c57d727c4e30df41409c6f1b19d788b448cba9c78e08271eec5e", + "last_commit": "9862488", "name": "at0", "purpose": "AT-0 V1: finite clock plus one qubit under the AT0_CASE_V1 / AT0_RESULT_V1 contracts" } ], - "children_root": "sha256:0d172028ae30d6629b7a8e6ce92a2c417c8209ac787158891055d99b4b01e526", - "compiled_at": "2026-10-09T22:45:44Z", + "children_root": "sha256:5e1db8ab35a7e3b9ea51606f3dc16453e2780216653078997dd74c614276c219", + "compiled_at": "2026-10-09T22:54:25Z", "compiler": "crumb-compile/1", - "digest": "sha256:9bd41455d908ebc17d819fa5352dd0f2aebdf786103ca2a2055ff5baafa6cf2f", + "digest": "sha256:39bd5d405d08cb1c080b4b886b5e36fff9b609102394cc81234917e5e376d40d", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "files": 18, - "generated_at_commit": "84fd7ab949fc95594f62c201618a17dcb0dc610e", - "source_tree": "sha256:5b4bcd2ea2633e7056e743cf7338296a48eeaf4ed8888b4792c721ecc5c79071" + "files": 78, + "generated_at_commit": "98624882f542a3ad77b6edbd5e431af08fb4b625", + "source_tree": "sha256:a6bcb1bd91f996955e1c5fcc0d231c126a473b077fc8f93a032ff802ca419627" } }, "name": "atemporal", diff --git a/research/atemporal/at0/.crumb b/research/atemporal/at0/.crumb index bde52c684..62cf000d9 100644 --- a/research/atemporal/at0/.crumb +++ b/research/atemporal/at0/.crumb @@ -4,20 +4,26 @@ "children": [ { "digest": "470b8c119df44842fffddc8393b528c87f163bb6e0155341cbc6da0650e19483", - "last_commit": "84fd7ab", + "last_commit": "b3a9476", "name": "model", "purpose": "Agent 3 candidate relational quantum engine in portable C11: state, Hamiltonians, constraint ker" + }, + { + "digest": "f210d0c620bca32c38a0a62c888bd82cdc020e8da40269b050199dcc34a886be", + "last_commit": "9862488", + "name": "oracle", + "purpose": "AT-0 reference oracle (Rust, standard library only, built by rustc directly; research cross-chec" } ], - "children_root": "sha256:4dbf85ee8646fc1ed4d83283afe11dd8f47c65aec88192dc17c39f4fb2119ff3", - "compiled_at": "2026-10-09T22:45:44Z", + "children_root": "sha256:8ecb59ef0065be19dbf08487115e9e0dfd3b6465ae287467fd5e520946482c42", + "compiled_at": "2026-10-09T22:54:25Z", "compiler": "crumb-compile/1", - "digest": "sha256:15c7532e6dcf6d819d40281b58ce6c61e22efacf50d568ffd1eec5e264aa65c6", + "digest": "sha256:47989e5a75e0c57d727c4e30df41409c6f1b19d788b448cba9c78e08271eec5e", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "files": 18, - "generated_at_commit": "84fd7ab949fc95594f62c201618a17dcb0dc610e", - "source_tree": "sha256:5b4bcd2ea2633e7056e743cf7338296a48eeaf4ed8888b4792c721ecc5c79071" + "files": 78, + "generated_at_commit": "98624882f542a3ad77b6edbd5e431af08fb4b625", + "source_tree": "sha256:a6bcb1bd91f996955e1c5fcc0d231c126a473b077fc8f93a032ff802ca419627" } }, "name": "at0", diff --git a/research/atemporal/at0/oracle/.crumb b/research/atemporal/at0/oracle/.crumb new file mode 100644 index 000000000..cbe9842c8 --- /dev/null +++ b/research/atemporal/at0/oracle/.crumb @@ -0,0 +1,26 @@ +{ + "extensions": { + "generated": { + "children": [ + { + "digest": "34e48910c68fa6e767c6f054b865af1be8ab4482f42baec5de00561f31a5ed20", + "last_commit": "9e10d61", + "name": "fixtures", + "purpose": "Deterministic AT-0 oracle calibration fixtures: case files, computed values/verdict blocks, CALI" + } + ], + "children_root": "sha256:8b48d10c3058cfc94212b896439d5b49c787a861767ee556a7cb06f0d48310b7", + "compiled_at": "2026-10-09T22:54:25Z", + "compiler": "crumb-compile/1", + "digest": "sha256:f210d0c620bca32c38a0a62c888bd82cdc020e8da40269b050199dcc34a886be", + "evidence_files": 0, + "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "files": 60, + "generated_at_commit": "98624882f542a3ad77b6edbd5e431af08fb4b625", + "source_tree": "sha256:16344701b9d010aec27afacd8ac78f4f911077eb483f1831d8dba79b42c78411" + } + }, + "name": "oracle", + "purpose": "AT-0 reference oracle (Rust, standard library only, built by rustc directly; research cross-check, not part of active execution): AT0_CASE_V1 parser, direct-matrix and analytic paths, exact judge, AT0_RESULT_V2 writer, tests, isolation gate", + "schema_version": "1.0.0" +} diff --git a/research/atemporal/at0/oracle/.gitignore b/research/atemporal/at0/oracle/.gitignore new file mode 100644 index 000000000..3aff6d249 --- /dev/null +++ b/research/atemporal/at0/oracle/.gitignore @@ -0,0 +1,3 @@ +target/ +__pycache__/ +*.pyc diff --git a/research/atemporal/at0/oracle/NUMERICAL_ERROR.md b/research/atemporal/at0/oracle/NUMERICAL_ERROR.md new file mode 100644 index 000000000..6a115323e --- /dev/null +++ b/research/atemporal/at0/oracle/NUMERICAL_ERROR.md @@ -0,0 +1,77 @@ +# Numerical error documentation for the AT-0 reference oracle + +Every record this oracle writes says `arithmetic BINARY64`, `bound_kind ESTIMATED`, +`threads 1`. ESTIMATED means: the bounds below are stated numerical estimates backed by +the analysis and the measurements here, not proven enclosures. A RIGOROUS claim would need +directed-rounding interval arithmetic with enclosed `cos`, `sin` and `exp`; Rust's +standard library does not provide that and this oracle pulls in nothing else, so it does +not claim it. A case that demands `min_bound_kind RIGOROUS` therefore fails +`bound_kind_sufficient` here by design (fixture `n5-rigorous-demand`). + +`eps` below is `2^-52` (about `2.2e-16`), the binary64 unit roundoff for values of order 1. + +## What is exact + +- Every validity decision, both identities, the kernel pairs and the kernel dimension: + exact rational arithmetic on `i128` numerators and denominators (`src/at0/rational.rs`), + no float involved. Inputs are bounded by the contract (`|n|, d <= 1048576`, `N <= 64`), so + no intermediate exceeds `i128`. +- Every acceptance check: decided on the written `f64:` tokens converted exactly to + fixed-point big integers with unit `2^-1074 * 10^-40` (`src/at0/exact.rs`), against exact + scaled-decimal tolerances and bounds (AT0_RESULT_V2 section 4). The checker never + compares floats. Unit tests confirm `0.5 == 5@1`, `0.1 > 1@1` and the smallest denormal. +- Input conversion: every case rational is converted once as `n as f64 / d as f64`; with + `|n|, d <= 2^20` both operands are exact and the quotient is correctly rounded, so each + input carries at most `eps/2` relative error. The ideal fixtures use dyadic rationals + (`-3/2`, `1/4`, ...), which convert exactly. + +## Stated bounds + +| Quantity | Path | Stated absolute bound | Reasoning | +|---|---|---|---| +| `constraint_residual` | matrix | `8 (N + M) eps` | `H_total Psi` is a sum of at most `2N` products of inputs of size `max|E|, |h|` by amplitudes of size `<= 1`; for the ideal cases every product is exactly representable and the result is exactly `0`. The factor `8 (N + M)` covers the matrix-vector sums and the normalization. | +| `povm_residual` | matrix | `8 (N + M) eps` | `M` rank-one terms of size `w/N`, each with error about `eps` per complex exponential (`cos`/`sin` from the platform libm, accurate to a few ulp), summed in a fixed order, then a Frobenius norm. Absolute error grows at most linearly in `M`. | +| `clock_probability k` | matrix | `8 (N + M) eps` | `||phi_k||^2 / ||Psi||^2` with `phi_k` an `N`-term sum; error linear in `N`. | +| `pauli k AXIS SIGN` | matrix | `8 (N + M) eps` | `Tr(rho_k Pi)` with `rho_k` normalized by `||phi_k||^2`; two `2 x 2` products on top of the `phi_k` error. | +| `reference k AXIS SIGN` | analytic | `64 eps (1 + |t| (|h0| + |h|))` | one `cos`, one `sin`, one unit-modulus phase of argument up to `|h0 t|`, a handful of complex multiplies; the argument-size term covers the absolute error of trig functions at large arguments. | + +Bounds are written as scaled decimals at the twentieth decimal place, rounded up and then +increased by one further unit (`bound_token`), so the written bound is never smaller than +the float estimate even if the decimal scaling itself rounded. + +At the contract maximum `N = 64`, `M = 256` the matrix bound is `8 * 320 * eps`, about +`5.7e-13`, under the frozen example's tolerances `1@12`. For the ideal fixtures +(`N = M = 4`) it is `1421087@20`, about `1.4e-14`. + +## Measured errors (fixtures, rustc 1.98.1, aarch64-unknown-linux-gnu, glibc libm) + +| Measurement | Value | Where | +|---|---|---| +| Largest deviation of any matrix-path or analytic-path Pauli probability from its hand-derived exact rational, over the 11 fixtures that carry expectations (N in 3..8, offsets, phases, draft spec) | `2.2e-16` | `fixtures/CALIBRATION.md` | +| Same for the clock probabilities `1/N` | `<= 2.2e-16` | same | +| `constraint_residual`, ideal cases | exactly `0` | `*.values` | +| `constraint_residual`, tilted field (`p2-tilted-3-10-2-5`, `p2-h0-shift`) | `9.8e-18` | `*.values` | +| `povm_residual`, `N = 4` | `2.6e-16` | `*.values` | +| `povm_residual`, `N = 8` | `1.8e-15` | `*.values` | +| Agreement between the three independent routes (matrix, Schrodinger closed form, Bloch rotation) | `<= 1e-12` asserted, `~1e-16` observed | tests | +| Agreement between the vector route and the density-matrix route inside the matrix path | `<= 1e-12` asserted | tests | +| Bit-for-bit agreement of every `f64:` value token with the earlier Python/CPython 3.12 version of this oracle on the same machine | all 21 fixtures identical | checked with `cmp` before that version was removed | + +Observed errors sit one to two orders of magnitude below the stated bounds and three to +four below the `1@12` tolerances. The margin is intentional: ESTIMATED bounds must not be +tight. + +## Known limitations + +1. **Portability of the last bits.** `f64::cos`, `f64::sin` and the derived phases come + from the platform C library. Two machines may differ in the last bit of a `reference` or + `pauli` token, which changes `verdict_id`. The verdict outcome does not change unless a + value sits within one ulp of a tolerance edge, which none of the fixtures does. +2. **ESTIMATED, not RIGOROUS.** The bounds are analysis plus measurement, not interval + enclosures. +3. **Dense arithmetic.** `O(N^2 M)` complex operations; at the contract maximum this is + about a million operations, well under a second, and the dimension limits are enforced by + the parser. +4. **`i128` rationals.** Exact arithmetic relies on the contract's `1048576` limit on + numerators and denominators; the parser refuses anything larger, so overflow cannot be + reached from a valid case. diff --git a/research/atemporal/at0/oracle/README.md b/research/atemporal/at0/oracle/README.md new file mode 100644 index 000000000..5ecc90734 --- /dev/null +++ b/research/atemporal/at0/oracle/README.md @@ -0,0 +1,195 @@ +# AT-0 reference oracle (Rust, standard library only) + +Independent cross-check for the AT-0 Page-Wootters qualification. Given an `AT0_CASE_V1` +file it rebuilds the finite model from scratch, conditions the stationary state on each +clock outcome by direct complex linear algebra, computes X/Y/Z probabilities two more ways +without any clock matrix, judges every check in exact arithmetic, and writes an +`AT0_RESULT_V2` record. Reproducing the known mathematics here is a calibration result, +not a discovery. + +Owner: Agent 2 (charter `aien-dev/aien-architecture` ADR-0038, `omega#358`). Everything +lives in this directory. Nothing here is the candidate engine and nothing here is used by +it: `research/atemporal/at0/model/` (Agent 3, C11, merged in `omega#360`) and this +directory share no source, no parser, no arithmetic and no build step. + +## Rulings this code follows + +- Drake, 2026-10-09 (relayed on `omega#358`): Rust, standard library only. No crates, no + Cargo, no Python anywhere. Built by `rustc` directly with pinned flags. +- Agent 0, `omega#358` comment `6090404007`: result records are `AT0_RESULT_V2` + (`OMEGA-AT0-RESULT v2`, `domain omega.at0.result.v2`, verdict tag `omega.at0.verdict.v2`, + evidence tag `omega.at0.evidence.v2`). On a trivial kernel every label is `UNDEFINED` and + `constraint_residual`, `clock_probability` and `pauli` lines read `undefined 0@0`; + `povm_residual` and `reference` lines stay real. The parser refuses `undefined` anywhere + else. Case files stay `AT0_CASE_V1`. +- Agent 0, `omega#358` (component outputs): the oracle's output is a component output, not + a third interface. Its `reference ` lines are byte-valid + per the V2 values-block grammar and order (k ascending, then X Y Z, then PLUS MINUS) so + Agent 5's runner can splice them next to the engine block verbatim. This oracle emits no + wrapper format of its own: the whole file is one `AT0_RESULT_V2` record. Any future + wrapper line would be versioned here and would need Agent 5 re-review. + +Contracts: `AT0_CASE_V1` and `AT0_RESULT_V1/V2` frozen at `aien-architecture` +`044c9d11256d8642f80eedd42cbae8763faf63f5` (`contract_commit` in every record). The +hand-table tests also target the draft mathematical spec `AT0_SPEC` at +`aien-architecture` pull request 176, commit `0efd1a14cbdf117bc694b556bb61d031cf80c8f9` +(`SPEC_DRAFT_COMMIT` in `src/at0/mod.rs`); that draft is not merged and the tests say so. + +## Layout + +``` +build.sh exact rustc invocation (build | test | lib) +isolation.sh symbol-isolation gate for the compute crate (source rule + nm -u + mutant) +rust-toolchain.toml rustc 1.98.1 pin (informational; build.sh records the real version) +src/main.rs the only file that touches files, git, the process table or the wall clock; + CLI (emit | fixtures | check) and the test suite +src/at0/mod.rs compute crate root; SPEC_DRAFT_COMMIT +src/at0/rational.rs i128 rationals (exact spectrum, kernel pairs, identities) +src/at0/sha256.rs own SHA-256 (case_id, acceptance_id, verdict_id, evidence_digest) +src/at0/exact.rs fixed-point big integers: exact comparison of f64 tokens with scaled decimals +src/at0/complex.rs complex numbers and dense complex matrices (Vec>) +src/at0/case.rs AT0_CASE_V1 parser/validator in contract order, case builder for tests +src/at0/matrix_path.rs H_C, H_S, H_total, kernel projector, Psi, POVM, conditioning, rho_k, Pauli +src/at0/reference.rs analytic paths: Schrodinger closed form and Bloch/Rodrigues rotation +src/at0/result.rs values block, exact judge, verdict block, AT0_RESULT_V2 writer and values parser +src/at0/fixtures.rs the 21 calibration fixtures and their hand-derived expectations +fixtures/ .case, .values, CALIBRATION.md (all generated, deterministic) +NUMERICAL_ERROR.md stated bounds, measured errors, limitations +``` + +## Build + +Exact command (`./build.sh build`): + +``` +rustc --edition 2021 -C opt-level=2 -C codegen-units=1 -C debuginfo=0 -C panic=abort -D warnings \ + --crate-name at0_oracle src/main.rs -o target/at0-oracle +``` + +`build.sh` exports the compiler's own `rustc --version` line, host triple and the flag +string into the binary (`option_env!`), which is where `build_cc` and `build_flags` in the +provenance block come from. The test build uses the same flags minus `-C panic=abort` +(the test harness needs unwinding) plus `--test`. `./build.sh lib` builds the compute crate +alone as an rlib for the isolation gate. + +Toolchain the fixtures and numbers in this directory were produced with: + +``` +rustc 1.98.1 (48a229cea 2026-09-01) +binary: rustc +commit-hash: 48a229ceaefd4985c50990b14116b6d856af0985 +commit-date: 2026-09-01 +host: aarch64-unknown-linux-gnu +release: 1.98.1 +LLVM version: 22.1.8 +``` + +No Cargo, no crates, no `build.rs`, no network, no C library beyond what Rust's standard +library links itself. + +## Use + +``` +./build.sh # target/at0-oracle +./build.sh test # 14 tests (4 unit, 10 contract/physics) +./isolation.sh # ISOLATION PASS expected +target/at0-oracle check # validate; prints case_id, acceptance_id, file sha256 +target/at0-oracle emit [--dephased] [-o out] # AT0_RESULT_V2 record +target/at0-oracle fixtures # regenerate fixtures/ (43 files) +``` + +A refused case prints exactly `AT0_CASE_REFUSED ` on stderr, writes nothing and exits +2. `--dephased` replaces the pure physical state by its kernel-branch dephasing (negative +control) and marks `build_cc` with `(dephased control)`; such a record is a control, never +a qualification result. + +Provenance: `source_commit`/`source_tree_clean` come from `git` run in this directory. +Every record is marked as oracle output so it can never be cited as the candidate engine's +result (Agent 0 condition on the omega#359 approval): `build_cc` begins with the literal +`oracle ` and `engine_sha256` equals `oracle_sha256`, both the SHA-256 of the running +oracle executable (the matrix path and the analytic path are two modules of one binary). +The writer refuses to produce a record that violates either rule (tested). `verdict_id` depends +only on the case and the values; `evidence_digest` covers the timestamps too, so two runs +agree on `verdict_id` and differ in `evidence_digest` (tested). + +## What is independent, and how that is enforced + +- Own parser and validator for `AT0_CASE_V1` reproducing the contract's known-answer + digests (`case_id 3cf4ca4f...`, `acceptance_id a13fb02d...`, file sha `ed16c95c...`). +- Own SHA-256, own rationals, own complex/matrix arithmetic, own exact decimal comparison. + No line is shared with, derived from or linked against the C11 engine. +- Three routes to every Pauli probability: dense matrix conditioning (`rho_k`), the + closed-form Schrodinger evolution, and a Bloch-vector rotation in real arithmetic. All + three must agree to `1e-12` in the tests; they agree to about `2e-16`. +- Two routes inside the matrix path: condition the vector, or condition the density matrix + `|Psi>`, `tau = 1/N`, `w = 1`): + the kernel is spanned by `|E=1/2>|1>` and `|E=-1/2>|0>`, so every `p(k) = 1/N` exactly, + and with `theta_k = 2 pi k / N` the table is `P(X+) = (1 + cos theta)/2`, + `P(Y+) = (1 - sin theta)/2`, `P(Z+) = 1/2`. Expectations are recorded only at labels where + `cos`/`sin` are rational (`0`, `+-1/2`, `+-1`), which is why `N = 3, 5` check 7 values and + `N = 4, 6, 8` check 14 or 28. +- Offset reference `t2`: same table shifted by two labels. Global phase `i` and the + unnormalized state `(2, 2)`: same table as the ideal case (phase and norm cancel). +- Draft spec model (`E = -1, 0`, `H_S = diag(0, 1)` written as `h0 = 1/2, hz = -1/2`, + `w = 1/2`): the spec's own table; `hz = -1/2` flips the sign of `sin`, so + `P(Y+) = (1 - sin theta)/2`. T4 (`psi_0 = |0>`): `P(Z+) = 1`, X and Y `1/2` at every label. + T5 (`psi_0 = (1, i)`): the table shifted one label backwards, i.e. `theta -> theta - pi/2`. +- Negative controls carry no rational expectations; their expectation is the failure code + set declared in the case's own acceptance block, and `expectation_met YES` means the + oracle produced exactly those codes. + +`CALIBRATION.md` lists per fixture the number of exact values checked and the largest +deviation seen; the worst is `2.2e-16` (one unit in the last place of `1/2`). + +## Findings worth knowing (calibration, not discovery) + +1. A broken clock (`tau = 1/3` with `N = 4`) and the correct weight `w = N/M` fails only + `povm_normalization`; the clock probabilities still sum to one. A wrong weight fails both + `povm_normalization` and `probability_sum`. +2. In the draft spec's convention the sign of the Y row depends on the sign of `hz`; the + closed form and the matrix path agree, so any disagreement with another implementation is + a convention error, not numerics. +3. The relational phase `(1, i)` shifts the pattern one label backwards, not forwards. +4. Dephasing the kernel branches keeps `p(k) = 1/N` and Hermitian unit-trace `rho_k` but + flattens every X and Y probability to `1/2`: the clock correlation survives, the + interference pattern does not. This is the `nc-dephased-control` fixture. + +## What this is not + +Not the candidate engine, not a verifier of Agent 3's internals, not a RIGOROUS bound +(see `NUMERICAL_ERROR.md`), and not a statement about any physical experiment. It never +reads evaluator-private held-out data or hidden qualification parameters; every input is a +public `.case` file in this directory or one handed to it on the command line. diff --git a/research/atemporal/at0/oracle/build.sh b/research/atemporal/at0/oracle/build.sh new file mode 100755 index 000000000..f0d486339 --- /dev/null +++ b/research/atemporal/at0/oracle/build.sh @@ -0,0 +1,25 @@ +#!/bin/sh +# Build the AT-0 reference oracle with a direct rustc invocation (no cargo, no crates). +# Usage: ./build.sh -> target/at0-oracle +# ./build.sh test -> builds and runs target/at0-oracle-test +set -eu +cd "$(dirname "$0")" +mkdir -p target +RUSTC_VERSION="$(rustc -V)" +RUSTC_HOST="$(rustc -vV | sed -n 's/^host: //p')" +FLAGS="--edition 2021 -C opt-level=2 -C codegen-units=1 -C debuginfo=0 -C panic=abort -D warnings" +export AT0_RUSTC_VERSION="$RUSTC_VERSION" AT0_RUSTC_HOST="$RUSTC_HOST" AT0_BUILD_FLAGS="$FLAGS" +case "${1:-build}" in + build) + rustc $FLAGS --crate-name at0_oracle src/main.rs -o target/at0-oracle + echo "built target/at0-oracle with $RUSTC_VERSION ($RUSTC_HOST)" ;; + test) + # tests need unwinding panics; everything else identical + rustc --edition 2021 -C opt-level=2 -C codegen-units=1 -C debuginfo=0 -D warnings --test --crate-name at0_oracle src/main.rs -o target/at0-oracle-test + ./target/at0-oracle-test "${2:-}" ;; + lib) + # compute crate alone, for the isolation gate (no main.rs, so no I/O layer) + rustc $FLAGS --crate-type lib --crate-name at0 src/at0/mod.rs -o target/libat0.rlib + echo "built target/libat0.rlib" ;; + *) echo "usage: $0 [build|test|lib]" >&2; exit 1 ;; +esac diff --git a/research/atemporal/at0/oracle/fixtures/.crumb b/research/atemporal/at0/oracle/fixtures/.crumb new file mode 100644 index 000000000..b6629c095 --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/.crumb @@ -0,0 +1,19 @@ +{ + "extensions": { + "generated": { + "children": [], + "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "compiled_at": "2026-10-09T22:50:50Z", + "compiler": "crumb-compile/1", + "digest": "sha256:34e48910c68fa6e767c6f054b865af1be8ab4482f42baec5de00561f31a5ed20", + "evidence_files": 0, + "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "files": 43, + "generated_at_commit": "9e10d61488f571083d2d2cc7b9b5b893ab0534ca", + "source_tree": "sha256:09e4b23bf31ed2aabe57762e1667dad51d26a3f800399b073ed3556a636fc6e7" + } + }, + "name": "fixtures", + "purpose": "Deterministic AT-0 oracle calibration fixtures: case files, computed values/verdict blocks, CALIBRATION.md", + "schema_version": "1.0.0" +} diff --git a/research/atemporal/at0/oracle/fixtures/CALIBRATION.md b/research/atemporal/at0/oracle/fixtures/CALIBRATION.md new file mode 100644 index 000000000..43a54c09c --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/CALIBRATION.md @@ -0,0 +1,37 @@ +# AT-0 oracle calibration fixtures + +Generated by `target/at0-oracle fixtures` (deterministic, no wall clock). Reproducing the known +mathematics here is a calibration result, not a discovery. `exact values checked` counts +hand-derived rational expectations compared; `max dev` is the largest deviation seen +against them (matrix path and reference path), in absolute probability units. + +| fixture | state | kernel dim | outcome | failure codes | expectation_met | exact values checked | max dev | verdict_id | +|---|---|---|---|---|---|---|---|---| +| at0-kat-ideal-qubit-n4 | pure | 2 | PASS | none | YES | 28 | 2.220e-16 | `88de580d3afaaab81abc4238bacb12b20f8eeb801d6bb7976ea85829eecb6f4b` | +| p1-ideal-n6 | pure | 2 | PASS | none | YES | 14 | 2.220e-16 | `fea6f54296da5a05bc7ebdc751c27412b6dd4b5866f835f797fa85043479573a` | +| p1-ideal-n8 | pure | 2 | PASS | none | YES | 28 | 2.220e-16 | `15bd131e279b780745b1601b71d66b5864f16d2df35fe86c495c1f42b7f435a1` | +| p1-ideal-n3 | pure | 2 | PASS | none | YES | 7 | 2.220e-16 | `f34f003c4c52e9ce811051dcc3a8c9c4929f2b1bb9bac59565250d69286fbd7b` | +| p1-ideal-n5 | pure | 2 | PASS | none | YES | 7 | 2.220e-16 | `cdc13ac50439bd0ef222936f38b596b21dc201800568c7ee2c83f357f6d21238` | +| p1-offset-ref-t2 | pure | 2 | PASS | none | YES | 28 | 2.220e-16 | `2917531cf4bfcbf8944a04e779d4e6ab7b31a09c984ebff6dd906e87e93a9398` | +| p1-global-phase-i | pure | 2 | PASS | none | YES | 28 | 2.220e-16 | `efa8863d660399b2bb5cd8b33c6f395f57a012a2479929092e426d3251d76ced` | +| p1-unnormalized-2 | pure | 2 | PASS | none | YES | 28 | 2.220e-16 | `92d215231b6132f3f3877f4c631446d4ca07e175ee7799e659495f367a1f46a6` | +| p2-tilted-3-10-2-5 | pure | 2 | PASS | none | YES | 0 | 0.000e0 | `3d2d11e9a20fa950566b48a22421d2a165728c10f7e7adceb4f8ab8f3b6a4f32` | +| p2-h0-shift | pure | 2 | PASS | none | YES | 0 | 0.000e0 | `5e2d2fbe4a8c13fec7eb0f3a7db2bca94b0ecc2227817bc0c1858a219189c034` | +| n1-uncovered | pure | 0 | FAIL | TRIVIAL_PHYSICAL_STATE | YES | 0 | 0.000e0 | `9d5d757ce34242b8b737ebaf11aea8d592671f8b3e7ac60c58f4727b7fb75f71` | +| n2-half-covered | pure | 1 | FAIL | SCHRODINGER_DEVIATION_EXCEEDED | YES | 0 | 0.000e0 | `577c0ed350f62b7df313b569f63087c359d0ddf5cae086dc1fce7cf6e2cbe3cf` | +| n4-wrong-weight | pure | 2 | FAIL | POVM_NORMALIZATION_EXCEEDED,PROBABILITY_SUM_EXCEEDED | YES | 0 | 0.000e0 | `3d1b3beb7374055af1ab1c4ea385a65212d2de5c9eb0e73134af0e62d3129836` | +| n3-broken-clock-tau-1-3 | pure | 2 | FAIL | POVM_NORMALIZATION_EXCEEDED | YES | 0 | 0.000e0 | `471d325ed6b6f7362f1ccc7c75bcc7d0e43f2330c63eb4239f62a810bc3020b4` | +| n5-rigorous-demand | pure | 2 | FAIL | BOUND_KIND_INSUFFICIENT | YES | 0 | 0.000e0 | `e921cc889a105ddc7d95c1d2a38de0b0a5699f22e3b15f9a80840df1ff043d8d` | +| spec-ref-model-n4 | pure | 2 | PASS | none | YES | 28 | 2.220e-16 | `0472c9c93ccb61e4375e3ce3b5aa2bdbd48f2165adf74e9d19042f0c4bd91514` | +| spec-t4-eigenstate-00 | pure | 2 | PASS | none | YES | 28 | 5.551e-17 | `78224941fd9084a57faa778af485532c345749b2a22396432797b03c2c4c7d10` | +| spec-t5-relational-phase | pure | 2 | PASS | none | YES | 28 | 2.220e-16 | `407fbb62ccd7180b0abbcdb8ad59399ca29c19a61d6132bb21d68a58ae9d6384` | +| spec-n3-wrong-weight | pure | 2 | FAIL | POVM_NORMALIZATION_EXCEEDED,PROBABILITY_SUM_EXCEEDED | YES | 0 | 0.000e0 | `1cfcb09a64ad6aa1042d2c67ebfdcf3f77c4ef77d6c1a3616516e4bc4b0fd150` | +| spec-n4-dropped-effect | pure | 2 | FAIL | POVM_NORMALIZATION_EXCEEDED,PROBABILITY_SUM_EXCEEDED | YES | 0 | 0.000e0 | `88e01e412c8b6e750dc91e6fec54eacd4ddfae337a286fbddcc1748a2623de10` | +| nc-dephased-control | dephased | 2 | FAIL | SCHRODINGER_DEVIATION_EXCEEDED | YES | 28 | 0.000e0 | `eec3e050cf5e0a509d6121dd22b8b1dfe80529ded33384a65558b1dec53e0a64` | + +Hand-derived tables: ideal clock, `H_S = Z/2` (even N) or `Z` (odd N), `psi_0 = |+>`, so +`P(X+) = (1 + cos a)/2`, `P(Y+) = (1 + sin a)/2`, `P(Z+) = 1/2`, `p(k) = 1/N`, with +`a = 2|h| * 2 pi (k - r) / N`; only labels whose angle is a multiple of a quarter turn +have rational expectations and are counted. Spec fixtures use `H_S = diag(0, 1)` (`hz = -1/2`), +so `P(Y+) = (1 - sin theta)/2`. The dephased control expects `1/2` everywhere. +Values blocks follow AT0_RESULT_V2 (f64: tokens, scaled-decimal bounds, bound_kind ESTIMATED). diff --git a/research/atemporal/at0/oracle/fixtures/at0-kat-ideal-qubit-n4.case b/research/atemporal/at0/oracle/fixtures/at0-kat-ideal-qubit-n4.case new file mode 100644 index 000000000..3f4c2c03d --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/at0-kat-ideal-qubit-n4.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name at0-kat-ideal-qubit-n4 +begin semantic +model_family PAGE_WOOTTERS_FINITE_IDEAL +energy_unit DIMENSIONLESS_HBAR_1 +clock_dim 4 +clock_energies -3/2,-1/2,1/2,3/2 +system_dim 2 +system_hamiltonian_pauli 0/1,0/1,0/1,1/2 +interaction NONE +constraint SUM_HC_HS +physical_state NULLSPACE_PROJECTION +reference_clock_label t0 +reference_system_state (1/1;0/1),(1/1;0/1) +clock_povm COVARIANT_DISCRETE +povm_tau_turns 1/4 +povm_weight 1/1 +clock_label_count 4 +clock_label 0 t0 +clock_label 1 t1 +clock_label 2 t2 +clock_label 3 t3 +observables PAULI_X,PAULI_Y,PAULI_Z +end semantic +begin acceptance +control_kind POSITIVE +expected_outcome PASS +expected_failure_codes none +min_bound_kind ESTIMATED +tol_constraint_residual 1@12 +tol_povm_residual 1@12 +tol_probability 1@12 +tol_zero_probability 1@9 +tol_schrodinger 1@12 +end acceptance +case_id 3cf4ca4f882b5b9691ddcd905e65e15010855adcd2be200e19ebc3184655b44d +acceptance_id a13fb02dd674b8042ef8c0a197f03d58768709f782ba59cd26545eef6d41a228 +end diff --git a/research/atemporal/at0/oracle/fixtures/at0-kat-ideal-qubit-n4.values b/research/atemporal/at0/oracle/fixtures/at0-kat-ideal-qubit-n4.values new file mode 100644 index 000000000..276d85aa3 --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/at0-kat-ideal-qubit-n4.values @@ -0,0 +1,78 @@ +begin values +physical_state_kernel_dim 2 +constraint_residual f64:0000000000000000 1421087@20 +povm_residual f64:3cb2a8eb3f35f924 1421087@20 +label 0 t0 DEFINED +label 1 t1 DEFINED +label 2 t2 DEFINED +label 3 t3 DEFINED +clock_probability 0 f64:3fd0000000000000 1421087@20 +clock_probability 1 f64:3fd0000000000000 1421087@20 +clock_probability 2 f64:3fd0000000000000 1421087@20 +clock_probability 3 f64:3fd0000000000000 1421087@20 +pauli 0 X PLUS f64:3ff0000000000000 1421087@20 +pauli 0 X MINUS f64:0000000000000000 1421087@20 +pauli 0 Y PLUS f64:3fe0000000000000 1421087@20 +pauli 0 Y MINUS f64:3fe0000000000000 1421087@20 +pauli 0 Z PLUS f64:3fe0000000000000 1421087@20 +pauli 0 Z MINUS f64:3fe0000000000000 1421087@20 +pauli 1 X PLUS f64:3fe0000000000001 1421087@20 +pauli 1 X MINUS f64:3fdffffffffffffe 1421087@20 +pauli 1 Y PLUS f64:3ff0000000000000 1421087@20 +pauli 1 Y MINUS f64:0000000000000000 1421087@20 +pauli 1 Z PLUS f64:3fe0000000000000 1421087@20 +pauli 1 Z MINUS f64:3fe0000000000000 1421087@20 +pauli 2 X PLUS f64:0000000000000000 1421087@20 +pauli 2 X MINUS f64:3ff0000000000000 1421087@20 +pauli 2 Y PLUS f64:3fe0000000000001 1421087@20 +pauli 2 Y MINUS f64:3fdfffffffffffff 1421087@20 +pauli 2 Z PLUS f64:3fe0000000000000 1421087@20 +pauli 2 Z MINUS f64:3fe0000000000000 1421087@20 +pauli 3 X PLUS f64:3fdffffffffffffe 1421087@20 +pauli 3 X MINUS f64:3fe0000000000001 1421087@20 +pauli 3 Y PLUS f64:0000000000000000 1421087@20 +pauli 3 Y MINUS f64:3ff0000000000000 1421087@20 +pauli 3 Z PLUS f64:3fe0000000000000 1421087@20 +pauli 3 Z MINUS f64:3fe0000000000000 1421087@20 +reference 0 X PLUS f64:3feffffffffffffe 1421087@20 +reference 0 X MINUS f64:0000000000000000 1421087@20 +reference 0 Y PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 Y MINUS f64:3fdffffffffffffe 1421087@20 +reference 0 Z PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 Z MINUS f64:3fdffffffffffffe 1421087@20 +reference 1 X PLUS f64:3fe0000000000000 2537205@20 +reference 1 X MINUS f64:3fdffffffffffffc 2537205@20 +reference 1 Y PLUS f64:3feffffffffffffe 2537205@20 +reference 1 Y MINUS f64:3950000000000000 2537205@20 +reference 1 Z PLUS f64:3fdffffffffffffe 2537205@20 +reference 1 Z MINUS f64:3fdffffffffffffe 2537205@20 +reference 2 X PLUS f64:393377ce858a5d46 3653323@20 +reference 2 X MINUS f64:3feffffffffffffe 3653323@20 +reference 2 Y PLUS f64:3fdffffffffffffe 3653323@20 +reference 2 Y MINUS f64:3fdffffffffffffe 3653323@20 +reference 2 Z PLUS f64:3fdffffffffffffe 3653323@20 +reference 2 Z MINUS f64:3fdffffffffffffe 3653323@20 +reference 3 X PLUS f64:3fdffffffffffffc 4769441@20 +reference 3 X MINUS f64:3fe0000000000000 4769441@20 +reference 3 Y PLUS f64:3950000000000000 4769441@20 +reference 3 Y MINUS f64:3feffffffffffffe 4769441@20 +reference 3 Z PLUS f64:3fdffffffffffffe 4769441@20 +reference 3 Z MINUS f64:3fdffffffffffffe 4769441@20 +end values +begin verdict +check bound_kind_sufficient PASS +check values_finite PASS +check physical_state_nontrivial PASS +check constraint_residual PASS +check povm_normalization PASS +check clock_probability_sum PASS +check probability_range PASS +check pauli_pair_sum PASS +check conditional_defined PASS +check schrodinger_agreement PASS +outcome PASS +failure_codes none +error_code none +expectation_met YES +end verdict +verdict_id 88de580d3afaaab81abc4238bacb12b20f8eeb801d6bb7976ea85829eecb6f4b diff --git a/research/atemporal/at0/oracle/fixtures/n1-uncovered.case b/research/atemporal/at0/oracle/fixtures/n1-uncovered.case new file mode 100644 index 000000000..471d5aa27 --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/n1-uncovered.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name n1-uncovered +begin semantic +model_family PAGE_WOOTTERS_FINITE_IDEAL +energy_unit DIMENSIONLESS_HBAR_1 +clock_dim 4 +clock_energies 1/1,2/1,3/1,4/1 +system_dim 2 +system_hamiltonian_pauli 0/1,0/1,0/1,1/2 +interaction NONE +constraint SUM_HC_HS +physical_state NULLSPACE_PROJECTION +reference_clock_label t0 +reference_system_state (1/1;0/1),(1/1;0/1) +clock_povm COVARIANT_DISCRETE +povm_tau_turns 1/4 +povm_weight 1/1 +clock_label_count 4 +clock_label 0 t0 +clock_label 1 t1 +clock_label 2 t2 +clock_label 3 t3 +observables PAULI_X,PAULI_Y,PAULI_Z +end semantic +begin acceptance +control_kind NEGATIVE +expected_outcome FAIL +expected_failure_codes TRIVIAL_PHYSICAL_STATE +min_bound_kind ESTIMATED +tol_constraint_residual 1@12 +tol_povm_residual 1@12 +tol_probability 1@12 +tol_zero_probability 1@9 +tol_schrodinger 1@12 +end acceptance +case_id 6f514d4f59ba56fbd58aa202bcc8b1a396ac95084e18a741ed76850ad33dc5cb +acceptance_id b9cbcd95b3c4ae102a33cc055aaaf18f2c9bf67144e2b2c34c3d9a381cd1ac97 +end diff --git a/research/atemporal/at0/oracle/fixtures/n1-uncovered.values b/research/atemporal/at0/oracle/fixtures/n1-uncovered.values new file mode 100644 index 000000000..709c7b755 --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/n1-uncovered.values @@ -0,0 +1,78 @@ +begin values +physical_state_kernel_dim 0 +constraint_residual undefined 0@0 +povm_residual f64:3cb38a7bb4164dcb 1421087@20 +label 0 t0 UNDEFINED +label 1 t1 UNDEFINED +label 2 t2 UNDEFINED +label 3 t3 UNDEFINED +clock_probability 0 undefined 0@0 +clock_probability 1 undefined 0@0 +clock_probability 2 undefined 0@0 +clock_probability 3 undefined 0@0 +pauli 0 X PLUS undefined 0@0 +pauli 0 X MINUS undefined 0@0 +pauli 0 Y PLUS undefined 0@0 +pauli 0 Y MINUS undefined 0@0 +pauli 0 Z PLUS undefined 0@0 +pauli 0 Z MINUS undefined 0@0 +pauli 1 X PLUS undefined 0@0 +pauli 1 X MINUS undefined 0@0 +pauli 1 Y PLUS undefined 0@0 +pauli 1 Y MINUS undefined 0@0 +pauli 1 Z PLUS undefined 0@0 +pauli 1 Z MINUS undefined 0@0 +pauli 2 X PLUS undefined 0@0 +pauli 2 X MINUS undefined 0@0 +pauli 2 Y PLUS undefined 0@0 +pauli 2 Y MINUS undefined 0@0 +pauli 2 Z PLUS undefined 0@0 +pauli 2 Z MINUS undefined 0@0 +pauli 3 X PLUS undefined 0@0 +pauli 3 X MINUS undefined 0@0 +pauli 3 Y PLUS undefined 0@0 +pauli 3 Y MINUS undefined 0@0 +pauli 3 Z PLUS undefined 0@0 +pauli 3 Z MINUS undefined 0@0 +reference 0 X PLUS f64:3feffffffffffffe 1421087@20 +reference 0 X MINUS f64:0000000000000000 1421087@20 +reference 0 Y PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 Y MINUS f64:3fdffffffffffffe 1421087@20 +reference 0 Z PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 Z MINUS f64:3fdffffffffffffe 1421087@20 +reference 1 X PLUS f64:3fe0000000000000 2537205@20 +reference 1 X MINUS f64:3fdffffffffffffc 2537205@20 +reference 1 Y PLUS f64:3feffffffffffffe 2537205@20 +reference 1 Y MINUS f64:3950000000000000 2537205@20 +reference 1 Z PLUS f64:3fdffffffffffffe 2537205@20 +reference 1 Z MINUS f64:3fdffffffffffffe 2537205@20 +reference 2 X PLUS f64:393377ce858a5d46 3653323@20 +reference 2 X MINUS f64:3feffffffffffffe 3653323@20 +reference 2 Y PLUS f64:3fdffffffffffffe 3653323@20 +reference 2 Y MINUS f64:3fdffffffffffffe 3653323@20 +reference 2 Z PLUS f64:3fdffffffffffffe 3653323@20 +reference 2 Z MINUS f64:3fdffffffffffffe 3653323@20 +reference 3 X PLUS f64:3fdffffffffffffc 4769441@20 +reference 3 X MINUS f64:3fe0000000000000 4769441@20 +reference 3 Y PLUS f64:3950000000000000 4769441@20 +reference 3 Y MINUS f64:3feffffffffffffe 4769441@20 +reference 3 Z PLUS f64:3fdffffffffffffe 4769441@20 +reference 3 Z MINUS f64:3fdffffffffffffe 4769441@20 +end values +begin verdict +check bound_kind_sufficient PASS +check values_finite PASS +check physical_state_nontrivial FAIL +check constraint_residual NOT_EVALUATED +check povm_normalization PASS +check clock_probability_sum NOT_EVALUATED +check probability_range PASS +check pauli_pair_sum NOT_EVALUATED +check conditional_defined NOT_EVALUATED +check schrodinger_agreement NOT_EVALUATED +outcome FAIL +failure_codes TRIVIAL_PHYSICAL_STATE +error_code none +expectation_met YES +end verdict +verdict_id 9d5d757ce34242b8b737ebaf11aea8d592671f8b3e7ac60c58f4727b7fb75f71 diff --git a/research/atemporal/at0/oracle/fixtures/n2-half-covered.case b/research/atemporal/at0/oracle/fixtures/n2-half-covered.case new file mode 100644 index 000000000..a680f0c58 --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/n2-half-covered.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name n2-half-covered +begin semantic +model_family PAGE_WOOTTERS_FINITE_IDEAL +energy_unit DIMENSIONLESS_HBAR_1 +clock_dim 4 +clock_energies 1/2,3/2,5/2,7/2 +system_dim 2 +system_hamiltonian_pauli 0/1,0/1,0/1,1/2 +interaction NONE +constraint SUM_HC_HS +physical_state NULLSPACE_PROJECTION +reference_clock_label t0 +reference_system_state (1/1;0/1),(1/1;0/1) +clock_povm COVARIANT_DISCRETE +povm_tau_turns 1/4 +povm_weight 1/1 +clock_label_count 4 +clock_label 0 t0 +clock_label 1 t1 +clock_label 2 t2 +clock_label 3 t3 +observables PAULI_X,PAULI_Y,PAULI_Z +end semantic +begin acceptance +control_kind NEGATIVE +expected_outcome FAIL +expected_failure_codes SCHRODINGER_DEVIATION_EXCEEDED +min_bound_kind ESTIMATED +tol_constraint_residual 1@12 +tol_povm_residual 1@12 +tol_probability 1@12 +tol_zero_probability 1@9 +tol_schrodinger 1@12 +end acceptance +case_id 29acd7d9abaa74277187b096d3165c2b7bb22cfbc8945caa913a157427db82c1 +acceptance_id 756c1914e6fc0579bc038b958da0f00ef5dcab36b1abdce1f0d092b8183241dd +end diff --git a/research/atemporal/at0/oracle/fixtures/n2-half-covered.values b/research/atemporal/at0/oracle/fixtures/n2-half-covered.values new file mode 100644 index 000000000..c21e045c5 --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/n2-half-covered.values @@ -0,0 +1,78 @@ +begin values +physical_state_kernel_dim 1 +constraint_residual f64:0000000000000000 1421087@20 +povm_residual f64:3cce7e27e939e4af 1421087@20 +label 0 t0 DEFINED +label 1 t1 DEFINED +label 2 t2 DEFINED +label 3 t3 DEFINED +clock_probability 0 f64:3fd0000000000000 1421087@20 +clock_probability 1 f64:3fd0000000000000 1421087@20 +clock_probability 2 f64:3fd0000000000000 1421087@20 +clock_probability 3 f64:3fd0000000000000 1421087@20 +pauli 0 X PLUS f64:3fe0000000000000 1421087@20 +pauli 0 X MINUS f64:3fe0000000000000 1421087@20 +pauli 0 Y PLUS f64:3fe0000000000000 1421087@20 +pauli 0 Y MINUS f64:3fe0000000000000 1421087@20 +pauli 0 Z PLUS f64:0000000000000000 1421087@20 +pauli 0 Z MINUS f64:3ff0000000000000 1421087@20 +pauli 1 X PLUS f64:3fe0000000000000 1421087@20 +pauli 1 X MINUS f64:3fe0000000000000 1421087@20 +pauli 1 Y PLUS f64:3fe0000000000000 1421087@20 +pauli 1 Y MINUS f64:3fe0000000000000 1421087@20 +pauli 1 Z PLUS f64:0000000000000000 1421087@20 +pauli 1 Z MINUS f64:3ff0000000000000 1421087@20 +pauli 2 X PLUS f64:3fe0000000000000 1421087@20 +pauli 2 X MINUS f64:3fe0000000000000 1421087@20 +pauli 2 Y PLUS f64:3fe0000000000000 1421087@20 +pauli 2 Y MINUS f64:3fe0000000000000 1421087@20 +pauli 2 Z PLUS f64:0000000000000000 1421087@20 +pauli 2 Z MINUS f64:3ff0000000000000 1421087@20 +pauli 3 X PLUS f64:3fe0000000000000 1421087@20 +pauli 3 X MINUS f64:3fe0000000000000 1421087@20 +pauli 3 Y PLUS f64:3fe0000000000000 1421087@20 +pauli 3 Y MINUS f64:3fe0000000000000 1421087@20 +pauli 3 Z PLUS f64:0000000000000000 1421087@20 +pauli 3 Z MINUS f64:3ff0000000000000 1421087@20 +reference 0 X PLUS f64:3feffffffffffffe 1421087@20 +reference 0 X MINUS f64:0000000000000000 1421087@20 +reference 0 Y PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 Y MINUS f64:3fdffffffffffffe 1421087@20 +reference 0 Z PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 Z MINUS f64:3fdffffffffffffe 1421087@20 +reference 1 X PLUS f64:3fe0000000000000 2537205@20 +reference 1 X MINUS f64:3fdffffffffffffc 2537205@20 +reference 1 Y PLUS f64:3feffffffffffffe 2537205@20 +reference 1 Y MINUS f64:3950000000000000 2537205@20 +reference 1 Z PLUS f64:3fdffffffffffffe 2537205@20 +reference 1 Z MINUS f64:3fdffffffffffffe 2537205@20 +reference 2 X PLUS f64:393377ce858a5d46 3653323@20 +reference 2 X MINUS f64:3feffffffffffffe 3653323@20 +reference 2 Y PLUS f64:3fdffffffffffffe 3653323@20 +reference 2 Y MINUS f64:3fdffffffffffffe 3653323@20 +reference 2 Z PLUS f64:3fdffffffffffffe 3653323@20 +reference 2 Z MINUS f64:3fdffffffffffffe 3653323@20 +reference 3 X PLUS f64:3fdffffffffffffc 4769441@20 +reference 3 X MINUS f64:3fe0000000000000 4769441@20 +reference 3 Y PLUS f64:3950000000000000 4769441@20 +reference 3 Y MINUS f64:3feffffffffffffe 4769441@20 +reference 3 Z PLUS f64:3fdffffffffffffe 4769441@20 +reference 3 Z MINUS f64:3fdffffffffffffe 4769441@20 +end values +begin verdict +check bound_kind_sufficient PASS +check values_finite PASS +check physical_state_nontrivial PASS +check constraint_residual PASS +check povm_normalization PASS +check clock_probability_sum PASS +check probability_range PASS +check pauli_pair_sum PASS +check conditional_defined PASS +check schrodinger_agreement FAIL +outcome FAIL +failure_codes SCHRODINGER_DEVIATION_EXCEEDED +error_code none +expectation_met YES +end verdict +verdict_id 577c0ed350f62b7df313b569f63087c359d0ddf5cae086dc1fce7cf6e2cbe3cf diff --git a/research/atemporal/at0/oracle/fixtures/n3-broken-clock-tau-1-3.case b/research/atemporal/at0/oracle/fixtures/n3-broken-clock-tau-1-3.case new file mode 100644 index 000000000..574ea5da8 --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/n3-broken-clock-tau-1-3.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name n3-broken-clock-tau-1-3 +begin semantic +model_family PAGE_WOOTTERS_FINITE_IDEAL +energy_unit DIMENSIONLESS_HBAR_1 +clock_dim 4 +clock_energies -3/2,-1/2,1/2,3/2 +system_dim 2 +system_hamiltonian_pauli 0/1,0/1,0/1,1/2 +interaction NONE +constraint SUM_HC_HS +physical_state NULLSPACE_PROJECTION +reference_clock_label t0 +reference_system_state (1/1;0/1),(1/1;0/1) +clock_povm COVARIANT_DISCRETE +povm_tau_turns 1/3 +povm_weight 1/1 +clock_label_count 4 +clock_label 0 t0 +clock_label 1 t1 +clock_label 2 t2 +clock_label 3 t3 +observables PAULI_X,PAULI_Y,PAULI_Z +end semantic +begin acceptance +control_kind NEGATIVE +expected_outcome FAIL +expected_failure_codes POVM_NORMALIZATION_EXCEEDED +min_bound_kind ESTIMATED +tol_constraint_residual 1@12 +tol_povm_residual 1@12 +tol_probability 1@12 +tol_zero_probability 1@9 +tol_schrodinger 1@12 +end acceptance +case_id eb15305809cd0dfc1485d2c58daa95422c34af57a576498c4ae5f9dca8046960 +acceptance_id 6beea6cc9b9a92bbd16213999a6a0eb6de6b1cd89820401aa80b26f6269e310a +end diff --git a/research/atemporal/at0/oracle/fixtures/n3-broken-clock-tau-1-3.values b/research/atemporal/at0/oracle/fixtures/n3-broken-clock-tau-1-3.values new file mode 100644 index 000000000..93c00681d --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/n3-broken-clock-tau-1-3.values @@ -0,0 +1,78 @@ +begin values +physical_state_kernel_dim 2 +constraint_residual f64:0000000000000000 1421087@20 +povm_residual f64:3ff9ec474a261264 1421087@20 +label 0 t0 DEFINED +label 1 t1 DEFINED +label 2 t2 DEFINED +label 3 t3 DEFINED +clock_probability 0 f64:3fd0000000000000 1421087@20 +clock_probability 1 f64:3fd0000000000000 1421087@20 +clock_probability 2 f64:3fcfffffffffffff 1421087@20 +clock_probability 3 f64:3fd0000000000000 1421087@20 +pauli 0 X PLUS f64:3ff0000000000000 1421087@20 +pauli 0 X MINUS f64:0000000000000000 1421087@20 +pauli 0 Y PLUS f64:3fe0000000000000 1421087@20 +pauli 0 Y MINUS f64:3fe0000000000000 1421087@20 +pauli 0 Z PLUS f64:3fe0000000000000 1421087@20 +pauli 0 Z MINUS f64:3fe0000000000000 1421087@20 +pauli 1 X PLUS f64:3fd0000000000002 1421087@20 +pauli 1 X MINUS f64:3fe7ffffffffffff 1421087@20 +pauli 1 Y PLUS f64:3feddb3d742c2656 1421087@20 +pauli 1 Y MINUS f64:3fb126145e9ecd50 1421087@20 +pauli 1 Z PLUS f64:3fe0000000000000 1421087@20 +pauli 1 Z MINUS f64:3fe0000000000000 1421087@20 +pauli 2 X PLUS f64:3fcffffffffffff8 1421087@20 +pauli 2 X MINUS f64:3fe8000000000002 1421087@20 +pauli 2 Y PLUS f64:3fb126145e9ecd58 1421087@20 +pauli 2 Y MINUS f64:3feddb3d742c2655 1421087@20 +pauli 2 Z PLUS f64:3fe0000000000000 1421087@20 +pauli 2 Z MINUS f64:3fe0000000000000 1421087@20 +pauli 3 X PLUS f64:3ff0000000000000 1421087@20 +pauli 3 X MINUS f64:0000000000000000 1421087@20 +pauli 3 Y PLUS f64:3fdffffffffffffe 1421087@20 +pauli 3 Y MINUS f64:3fe0000000000001 1421087@20 +pauli 3 Z PLUS f64:3fe0000000000000 1421087@20 +pauli 3 Z MINUS f64:3fe0000000000000 1421087@20 +reference 0 X PLUS f64:3feffffffffffffe 1421087@20 +reference 0 X MINUS f64:0000000000000000 1421087@20 +reference 0 Y PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 Y MINUS f64:3fdffffffffffffe 1421087@20 +reference 0 Z PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 Z MINUS f64:3fdffffffffffffe 1421087@20 +reference 1 X PLUS f64:3fd0000000000001 2909244@20 +reference 1 X MINUS f64:3fe7ffffffffffff 2909244@20 +reference 1 Y PLUS f64:3feddb3d742c2654 2909244@20 +reference 1 Y MINUS f64:3fb126145e9ecd53 2909244@20 +reference 1 Z PLUS f64:3fe0000000000000 2909244@20 +reference 1 Z MINUS f64:3fe0000000000000 2909244@20 +reference 2 X PLUS f64:3fcffffffffffff6 4397401@20 +reference 2 X MINUS f64:3fe7ffffffffffff 4397401@20 +reference 2 Y PLUS f64:3fb126145e9ecd5c 4397401@20 +reference 2 Y MINUS f64:3feddb3d742c2650 4397401@20 +reference 2 Z PLUS f64:3fdffffffffffffc 4397401@20 +reference 2 Z MINUS f64:3fdffffffffffffc 4397401@20 +reference 3 X PLUS f64:3feffffffffffffe 5885559@20 +reference 3 X MINUS f64:395377ce858a5d46 5885559@20 +reference 3 Y PLUS f64:3fdffffffffffffc 5885559@20 +reference 3 Y MINUS f64:3fe0000000000001 5885559@20 +reference 3 Z PLUS f64:3fdffffffffffffe 5885559@20 +reference 3 Z MINUS f64:3fdffffffffffffe 5885559@20 +end values +begin verdict +check bound_kind_sufficient PASS +check values_finite PASS +check physical_state_nontrivial PASS +check constraint_residual PASS +check povm_normalization FAIL +check clock_probability_sum PASS +check probability_range PASS +check pauli_pair_sum PASS +check conditional_defined PASS +check schrodinger_agreement PASS +outcome FAIL +failure_codes POVM_NORMALIZATION_EXCEEDED +error_code none +expectation_met YES +end verdict +verdict_id 471d325ed6b6f7362f1ccc7c75bcc7d0e43f2330c63eb4239f62a810bc3020b4 diff --git a/research/atemporal/at0/oracle/fixtures/n4-wrong-weight.case b/research/atemporal/at0/oracle/fixtures/n4-wrong-weight.case new file mode 100644 index 000000000..8aa18692d --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/n4-wrong-weight.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name n4-wrong-weight +begin semantic +model_family PAGE_WOOTTERS_FINITE_IDEAL +energy_unit DIMENSIONLESS_HBAR_1 +clock_dim 4 +clock_energies -3/2,-1/2,1/2,3/2 +system_dim 2 +system_hamiltonian_pauli 0/1,0/1,0/1,1/2 +interaction NONE +constraint SUM_HC_HS +physical_state NULLSPACE_PROJECTION +reference_clock_label t0 +reference_system_state (1/1;0/1),(1/1;0/1) +clock_povm COVARIANT_DISCRETE +povm_tau_turns 1/4 +povm_weight 2/1 +clock_label_count 4 +clock_label 0 t0 +clock_label 1 t1 +clock_label 2 t2 +clock_label 3 t3 +observables PAULI_X,PAULI_Y,PAULI_Z +end semantic +begin acceptance +control_kind NEGATIVE +expected_outcome FAIL +expected_failure_codes POVM_NORMALIZATION_EXCEEDED,PROBABILITY_SUM_EXCEEDED +min_bound_kind ESTIMATED +tol_constraint_residual 1@12 +tol_povm_residual 1@12 +tol_probability 1@12 +tol_zero_probability 1@9 +tol_schrodinger 1@12 +end acceptance +case_id 7dfd105da7db1ca1dc94c2f47580b87dfb7b2556431d366a94693d1a28088f83 +acceptance_id 65237dc22e695264cf3a1a0bd09bc80061d1c5f206fe67275391d22203cd57ae +end diff --git a/research/atemporal/at0/oracle/fixtures/n4-wrong-weight.values b/research/atemporal/at0/oracle/fixtures/n4-wrong-weight.values new file mode 100644 index 000000000..a4daed55f --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/n4-wrong-weight.values @@ -0,0 +1,78 @@ +begin values +physical_state_kernel_dim 2 +constraint_residual f64:0000000000000000 1421087@20 +povm_residual f64:4000000000000000 1421087@20 +label 0 t0 DEFINED +label 1 t1 DEFINED +label 2 t2 DEFINED +label 3 t3 DEFINED +clock_probability 0 f64:3fe0000000000000 1421087@20 +clock_probability 1 f64:3fe0000000000000 1421087@20 +clock_probability 2 f64:3fe0000000000000 1421087@20 +clock_probability 3 f64:3fe0000000000000 1421087@20 +pauli 0 X PLUS f64:3ff0000000000000 1421087@20 +pauli 0 X MINUS f64:0000000000000000 1421087@20 +pauli 0 Y PLUS f64:3fe0000000000000 1421087@20 +pauli 0 Y MINUS f64:3fe0000000000000 1421087@20 +pauli 0 Z PLUS f64:3fe0000000000000 1421087@20 +pauli 0 Z MINUS f64:3fe0000000000000 1421087@20 +pauli 1 X PLUS f64:3fe0000000000001 1421087@20 +pauli 1 X MINUS f64:3fdffffffffffffe 1421087@20 +pauli 1 Y PLUS f64:3ff0000000000000 1421087@20 +pauli 1 Y MINUS f64:0000000000000000 1421087@20 +pauli 1 Z PLUS f64:3fe0000000000000 1421087@20 +pauli 1 Z MINUS f64:3fe0000000000000 1421087@20 +pauli 2 X PLUS f64:0000000000000000 1421087@20 +pauli 2 X MINUS f64:3ff0000000000000 1421087@20 +pauli 2 Y PLUS f64:3fe0000000000001 1421087@20 +pauli 2 Y MINUS f64:3fdfffffffffffff 1421087@20 +pauli 2 Z PLUS f64:3fe0000000000000 1421087@20 +pauli 2 Z MINUS f64:3fe0000000000000 1421087@20 +pauli 3 X PLUS f64:3fdffffffffffffe 1421087@20 +pauli 3 X MINUS f64:3fe0000000000001 1421087@20 +pauli 3 Y PLUS f64:0000000000000000 1421087@20 +pauli 3 Y MINUS f64:3ff0000000000000 1421087@20 +pauli 3 Z PLUS f64:3fe0000000000000 1421087@20 +pauli 3 Z MINUS f64:3fe0000000000000 1421087@20 +reference 0 X PLUS f64:3feffffffffffffe 1421087@20 +reference 0 X MINUS f64:0000000000000000 1421087@20 +reference 0 Y PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 Y MINUS f64:3fdffffffffffffe 1421087@20 +reference 0 Z PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 Z MINUS f64:3fdffffffffffffe 1421087@20 +reference 1 X PLUS f64:3fe0000000000000 2537205@20 +reference 1 X MINUS f64:3fdffffffffffffc 2537205@20 +reference 1 Y PLUS f64:3feffffffffffffe 2537205@20 +reference 1 Y MINUS f64:3950000000000000 2537205@20 +reference 1 Z PLUS f64:3fdffffffffffffe 2537205@20 +reference 1 Z MINUS f64:3fdffffffffffffe 2537205@20 +reference 2 X PLUS f64:393377ce858a5d46 3653323@20 +reference 2 X MINUS f64:3feffffffffffffe 3653323@20 +reference 2 Y PLUS f64:3fdffffffffffffe 3653323@20 +reference 2 Y MINUS f64:3fdffffffffffffe 3653323@20 +reference 2 Z PLUS f64:3fdffffffffffffe 3653323@20 +reference 2 Z MINUS f64:3fdffffffffffffe 3653323@20 +reference 3 X PLUS f64:3fdffffffffffffc 4769441@20 +reference 3 X MINUS f64:3fe0000000000000 4769441@20 +reference 3 Y PLUS f64:3950000000000000 4769441@20 +reference 3 Y MINUS f64:3feffffffffffffe 4769441@20 +reference 3 Z PLUS f64:3fdffffffffffffe 4769441@20 +reference 3 Z MINUS f64:3fdffffffffffffe 4769441@20 +end values +begin verdict +check bound_kind_sufficient PASS +check values_finite PASS +check physical_state_nontrivial PASS +check constraint_residual PASS +check povm_normalization FAIL +check clock_probability_sum FAIL +check probability_range PASS +check pauli_pair_sum PASS +check conditional_defined PASS +check schrodinger_agreement PASS +outcome FAIL +failure_codes POVM_NORMALIZATION_EXCEEDED,PROBABILITY_SUM_EXCEEDED +error_code none +expectation_met YES +end verdict +verdict_id 3d1b3beb7374055af1ab1c4ea385a65212d2de5c9eb0e73134af0e62d3129836 diff --git a/research/atemporal/at0/oracle/fixtures/n5-rigorous-demand.case b/research/atemporal/at0/oracle/fixtures/n5-rigorous-demand.case new file mode 100644 index 000000000..03b26879f --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/n5-rigorous-demand.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name n5-rigorous-demand +begin semantic +model_family PAGE_WOOTTERS_FINITE_IDEAL +energy_unit DIMENSIONLESS_HBAR_1 +clock_dim 4 +clock_energies -3/2,-1/2,1/2,3/2 +system_dim 2 +system_hamiltonian_pauli 0/1,0/1,0/1,1/2 +interaction NONE +constraint SUM_HC_HS +physical_state NULLSPACE_PROJECTION +reference_clock_label t0 +reference_system_state (1/1;0/1),(1/1;0/1) +clock_povm COVARIANT_DISCRETE +povm_tau_turns 1/4 +povm_weight 1/1 +clock_label_count 4 +clock_label 0 t0 +clock_label 1 t1 +clock_label 2 t2 +clock_label 3 t3 +observables PAULI_X,PAULI_Y,PAULI_Z +end semantic +begin acceptance +control_kind NEGATIVE +expected_outcome FAIL +expected_failure_codes BOUND_KIND_INSUFFICIENT +min_bound_kind RIGOROUS +tol_constraint_residual 1@12 +tol_povm_residual 1@12 +tol_probability 1@12 +tol_zero_probability 1@9 +tol_schrodinger 1@12 +end acceptance +case_id 3cf4ca4f882b5b9691ddcd905e65e15010855adcd2be200e19ebc3184655b44d +acceptance_id 300e1441c7b3ec7abfe42b1c23b1ea219ea93033d5c6f4a801be2070a46176eb +end diff --git a/research/atemporal/at0/oracle/fixtures/n5-rigorous-demand.values b/research/atemporal/at0/oracle/fixtures/n5-rigorous-demand.values new file mode 100644 index 000000000..abe6cf803 --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/n5-rigorous-demand.values @@ -0,0 +1,78 @@ +begin values +physical_state_kernel_dim 2 +constraint_residual f64:0000000000000000 1421087@20 +povm_residual f64:3cb2a8eb3f35f924 1421087@20 +label 0 t0 DEFINED +label 1 t1 DEFINED +label 2 t2 DEFINED +label 3 t3 DEFINED +clock_probability 0 f64:3fd0000000000000 1421087@20 +clock_probability 1 f64:3fd0000000000000 1421087@20 +clock_probability 2 f64:3fd0000000000000 1421087@20 +clock_probability 3 f64:3fd0000000000000 1421087@20 +pauli 0 X PLUS f64:3ff0000000000000 1421087@20 +pauli 0 X MINUS f64:0000000000000000 1421087@20 +pauli 0 Y PLUS f64:3fe0000000000000 1421087@20 +pauli 0 Y MINUS f64:3fe0000000000000 1421087@20 +pauli 0 Z PLUS f64:3fe0000000000000 1421087@20 +pauli 0 Z MINUS f64:3fe0000000000000 1421087@20 +pauli 1 X PLUS f64:3fe0000000000001 1421087@20 +pauli 1 X MINUS f64:3fdffffffffffffe 1421087@20 +pauli 1 Y PLUS f64:3ff0000000000000 1421087@20 +pauli 1 Y MINUS f64:0000000000000000 1421087@20 +pauli 1 Z PLUS f64:3fe0000000000000 1421087@20 +pauli 1 Z MINUS f64:3fe0000000000000 1421087@20 +pauli 2 X PLUS f64:0000000000000000 1421087@20 +pauli 2 X MINUS f64:3ff0000000000000 1421087@20 +pauli 2 Y PLUS f64:3fe0000000000001 1421087@20 +pauli 2 Y MINUS f64:3fdfffffffffffff 1421087@20 +pauli 2 Z PLUS f64:3fe0000000000000 1421087@20 +pauli 2 Z MINUS f64:3fe0000000000000 1421087@20 +pauli 3 X PLUS f64:3fdffffffffffffe 1421087@20 +pauli 3 X MINUS f64:3fe0000000000001 1421087@20 +pauli 3 Y PLUS f64:0000000000000000 1421087@20 +pauli 3 Y MINUS f64:3ff0000000000000 1421087@20 +pauli 3 Z PLUS f64:3fe0000000000000 1421087@20 +pauli 3 Z MINUS f64:3fe0000000000000 1421087@20 +reference 0 X PLUS f64:3feffffffffffffe 1421087@20 +reference 0 X MINUS f64:0000000000000000 1421087@20 +reference 0 Y PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 Y MINUS f64:3fdffffffffffffe 1421087@20 +reference 0 Z PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 Z MINUS f64:3fdffffffffffffe 1421087@20 +reference 1 X PLUS f64:3fe0000000000000 2537205@20 +reference 1 X MINUS f64:3fdffffffffffffc 2537205@20 +reference 1 Y PLUS f64:3feffffffffffffe 2537205@20 +reference 1 Y MINUS f64:3950000000000000 2537205@20 +reference 1 Z PLUS f64:3fdffffffffffffe 2537205@20 +reference 1 Z MINUS f64:3fdffffffffffffe 2537205@20 +reference 2 X PLUS f64:393377ce858a5d46 3653323@20 +reference 2 X MINUS f64:3feffffffffffffe 3653323@20 +reference 2 Y PLUS f64:3fdffffffffffffe 3653323@20 +reference 2 Y MINUS f64:3fdffffffffffffe 3653323@20 +reference 2 Z PLUS f64:3fdffffffffffffe 3653323@20 +reference 2 Z MINUS f64:3fdffffffffffffe 3653323@20 +reference 3 X PLUS f64:3fdffffffffffffc 4769441@20 +reference 3 X MINUS f64:3fe0000000000000 4769441@20 +reference 3 Y PLUS f64:3950000000000000 4769441@20 +reference 3 Y MINUS f64:3feffffffffffffe 4769441@20 +reference 3 Z PLUS f64:3fdffffffffffffe 4769441@20 +reference 3 Z MINUS f64:3fdffffffffffffe 4769441@20 +end values +begin verdict +check bound_kind_sufficient FAIL +check values_finite PASS +check physical_state_nontrivial PASS +check constraint_residual PASS +check povm_normalization PASS +check clock_probability_sum PASS +check probability_range PASS +check pauli_pair_sum PASS +check conditional_defined PASS +check schrodinger_agreement PASS +outcome FAIL +failure_codes BOUND_KIND_INSUFFICIENT +error_code none +expectation_met YES +end verdict +verdict_id e921cc889a105ddc7d95c1d2a38de0b0a5699f22e3b15f9a80840df1ff043d8d diff --git a/research/atemporal/at0/oracle/fixtures/nc-dephased-control.case b/research/atemporal/at0/oracle/fixtures/nc-dephased-control.case new file mode 100644 index 000000000..101f54975 --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/nc-dephased-control.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name nc-dephased-control +begin semantic +model_family PAGE_WOOTTERS_FINITE_IDEAL +energy_unit DIMENSIONLESS_HBAR_1 +clock_dim 4 +clock_energies -3/2,-1/2,1/2,3/2 +system_dim 2 +system_hamiltonian_pauli 0/1,0/1,0/1,1/2 +interaction NONE +constraint SUM_HC_HS +physical_state NULLSPACE_PROJECTION +reference_clock_label t0 +reference_system_state (1/1;0/1),(1/1;0/1) +clock_povm COVARIANT_DISCRETE +povm_tau_turns 1/4 +povm_weight 1/1 +clock_label_count 4 +clock_label 0 t0 +clock_label 1 t1 +clock_label 2 t2 +clock_label 3 t3 +observables PAULI_X,PAULI_Y,PAULI_Z +end semantic +begin acceptance +control_kind NEGATIVE +expected_outcome FAIL +expected_failure_codes SCHRODINGER_DEVIATION_EXCEEDED +min_bound_kind ESTIMATED +tol_constraint_residual 1@12 +tol_povm_residual 1@12 +tol_probability 1@12 +tol_zero_probability 1@9 +tol_schrodinger 1@12 +end acceptance +case_id 3cf4ca4f882b5b9691ddcd905e65e15010855adcd2be200e19ebc3184655b44d +acceptance_id 756c1914e6fc0579bc038b958da0f00ef5dcab36b1abdce1f0d092b8183241dd +end diff --git a/research/atemporal/at0/oracle/fixtures/nc-dephased-control.values b/research/atemporal/at0/oracle/fixtures/nc-dephased-control.values new file mode 100644 index 000000000..45fa8d24f --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/nc-dephased-control.values @@ -0,0 +1,79 @@ +note values computed from the DEPHASED kernel-branch mixture of this case (negative control) +begin values +physical_state_kernel_dim 2 +constraint_residual f64:0000000000000000 1421087@20 +povm_residual f64:3cb2a8eb3f35f924 1421087@20 +label 0 t0 DEFINED +label 1 t1 DEFINED +label 2 t2 DEFINED +label 3 t3 DEFINED +clock_probability 0 f64:3fd0000000000000 1421087@20 +clock_probability 1 f64:3fd0000000000000 1421087@20 +clock_probability 2 f64:3fd0000000000000 1421087@20 +clock_probability 3 f64:3fd0000000000000 1421087@20 +pauli 0 X PLUS f64:3fe0000000000000 1421087@20 +pauli 0 X MINUS f64:3fe0000000000000 1421087@20 +pauli 0 Y PLUS f64:3fe0000000000000 1421087@20 +pauli 0 Y MINUS f64:3fe0000000000000 1421087@20 +pauli 0 Z PLUS f64:3fe0000000000000 1421087@20 +pauli 0 Z MINUS f64:3fe0000000000000 1421087@20 +pauli 1 X PLUS f64:3fe0000000000000 1421087@20 +pauli 1 X MINUS f64:3fe0000000000000 1421087@20 +pauli 1 Y PLUS f64:3fe0000000000000 1421087@20 +pauli 1 Y MINUS f64:3fe0000000000000 1421087@20 +pauli 1 Z PLUS f64:3fe0000000000000 1421087@20 +pauli 1 Z MINUS f64:3fe0000000000000 1421087@20 +pauli 2 X PLUS f64:3fe0000000000000 1421087@20 +pauli 2 X MINUS f64:3fe0000000000000 1421087@20 +pauli 2 Y PLUS f64:3fe0000000000000 1421087@20 +pauli 2 Y MINUS f64:3fe0000000000000 1421087@20 +pauli 2 Z PLUS f64:3fe0000000000000 1421087@20 +pauli 2 Z MINUS f64:3fe0000000000000 1421087@20 +pauli 3 X PLUS f64:3fe0000000000000 1421087@20 +pauli 3 X MINUS f64:3fe0000000000000 1421087@20 +pauli 3 Y PLUS f64:3fe0000000000000 1421087@20 +pauli 3 Y MINUS f64:3fe0000000000000 1421087@20 +pauli 3 Z PLUS f64:3fe0000000000000 1421087@20 +pauli 3 Z MINUS f64:3fe0000000000000 1421087@20 +reference 0 X PLUS f64:3feffffffffffffe 1421087@20 +reference 0 X MINUS f64:0000000000000000 1421087@20 +reference 0 Y PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 Y MINUS f64:3fdffffffffffffe 1421087@20 +reference 0 Z PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 Z MINUS f64:3fdffffffffffffe 1421087@20 +reference 1 X PLUS f64:3fe0000000000000 2537205@20 +reference 1 X MINUS f64:3fdffffffffffffc 2537205@20 +reference 1 Y PLUS f64:3feffffffffffffe 2537205@20 +reference 1 Y MINUS f64:3950000000000000 2537205@20 +reference 1 Z PLUS f64:3fdffffffffffffe 2537205@20 +reference 1 Z MINUS f64:3fdffffffffffffe 2537205@20 +reference 2 X PLUS f64:393377ce858a5d46 3653323@20 +reference 2 X MINUS f64:3feffffffffffffe 3653323@20 +reference 2 Y PLUS f64:3fdffffffffffffe 3653323@20 +reference 2 Y MINUS f64:3fdffffffffffffe 3653323@20 +reference 2 Z PLUS f64:3fdffffffffffffe 3653323@20 +reference 2 Z MINUS f64:3fdffffffffffffe 3653323@20 +reference 3 X PLUS f64:3fdffffffffffffc 4769441@20 +reference 3 X MINUS f64:3fe0000000000000 4769441@20 +reference 3 Y PLUS f64:3950000000000000 4769441@20 +reference 3 Y MINUS f64:3feffffffffffffe 4769441@20 +reference 3 Z PLUS f64:3fdffffffffffffe 4769441@20 +reference 3 Z MINUS f64:3fdffffffffffffe 4769441@20 +end values +begin verdict +check bound_kind_sufficient PASS +check values_finite PASS +check physical_state_nontrivial PASS +check constraint_residual PASS +check povm_normalization PASS +check clock_probability_sum PASS +check probability_range PASS +check pauli_pair_sum PASS +check conditional_defined PASS +check schrodinger_agreement FAIL +outcome FAIL +failure_codes SCHRODINGER_DEVIATION_EXCEEDED +error_code none +expectation_met YES +end verdict +verdict_id eec3e050cf5e0a509d6121dd22b8b1dfe80529ded33384a65558b1dec53e0a64 diff --git a/research/atemporal/at0/oracle/fixtures/p1-global-phase-i.case b/research/atemporal/at0/oracle/fixtures/p1-global-phase-i.case new file mode 100644 index 000000000..9eff85cf6 --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/p1-global-phase-i.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name p1-global-phase-i +begin semantic +model_family PAGE_WOOTTERS_FINITE_IDEAL +energy_unit DIMENSIONLESS_HBAR_1 +clock_dim 4 +clock_energies -3/2,-1/2,1/2,3/2 +system_dim 2 +system_hamiltonian_pauli 0/1,0/1,0/1,1/2 +interaction NONE +constraint SUM_HC_HS +physical_state NULLSPACE_PROJECTION +reference_clock_label t0 +reference_system_state (0/1;1/1),(0/1;1/1) +clock_povm COVARIANT_DISCRETE +povm_tau_turns 1/4 +povm_weight 1/1 +clock_label_count 4 +clock_label 0 t0 +clock_label 1 t1 +clock_label 2 t2 +clock_label 3 t3 +observables PAULI_X,PAULI_Y,PAULI_Z +end semantic +begin acceptance +control_kind POSITIVE +expected_outcome PASS +expected_failure_codes none +min_bound_kind ESTIMATED +tol_constraint_residual 1@12 +tol_povm_residual 1@12 +tol_probability 1@12 +tol_zero_probability 1@9 +tol_schrodinger 1@12 +end acceptance +case_id 8ca1e43791531bb0f60de1ff75f069e9e46bfc7a8368478dde10e2c85b73c64f +acceptance_id a13fb02dd674b8042ef8c0a197f03d58768709f782ba59cd26545eef6d41a228 +end diff --git a/research/atemporal/at0/oracle/fixtures/p1-global-phase-i.values b/research/atemporal/at0/oracle/fixtures/p1-global-phase-i.values new file mode 100644 index 000000000..387f9cbee --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/p1-global-phase-i.values @@ -0,0 +1,78 @@ +begin values +physical_state_kernel_dim 2 +constraint_residual f64:0000000000000000 1421087@20 +povm_residual f64:3cb2a8eb3f35f924 1421087@20 +label 0 t0 DEFINED +label 1 t1 DEFINED +label 2 t2 DEFINED +label 3 t3 DEFINED +clock_probability 0 f64:3fd0000000000000 1421087@20 +clock_probability 1 f64:3fd0000000000000 1421087@20 +clock_probability 2 f64:3fd0000000000000 1421087@20 +clock_probability 3 f64:3fd0000000000000 1421087@20 +pauli 0 X PLUS f64:3ff0000000000000 1421087@20 +pauli 0 X MINUS f64:0000000000000000 1421087@20 +pauli 0 Y PLUS f64:3fe0000000000000 1421087@20 +pauli 0 Y MINUS f64:3fe0000000000000 1421087@20 +pauli 0 Z PLUS f64:3fe0000000000000 1421087@20 +pauli 0 Z MINUS f64:3fe0000000000000 1421087@20 +pauli 1 X PLUS f64:3fe0000000000001 1421087@20 +pauli 1 X MINUS f64:3fdffffffffffffe 1421087@20 +pauli 1 Y PLUS f64:3ff0000000000000 1421087@20 +pauli 1 Y MINUS f64:0000000000000000 1421087@20 +pauli 1 Z PLUS f64:3fe0000000000000 1421087@20 +pauli 1 Z MINUS f64:3fe0000000000000 1421087@20 +pauli 2 X PLUS f64:0000000000000000 1421087@20 +pauli 2 X MINUS f64:3ff0000000000000 1421087@20 +pauli 2 Y PLUS f64:3fe0000000000001 1421087@20 +pauli 2 Y MINUS f64:3fdfffffffffffff 1421087@20 +pauli 2 Z PLUS f64:3fe0000000000000 1421087@20 +pauli 2 Z MINUS f64:3fe0000000000000 1421087@20 +pauli 3 X PLUS f64:3fdffffffffffffe 1421087@20 +pauli 3 X MINUS f64:3fe0000000000001 1421087@20 +pauli 3 Y PLUS f64:0000000000000000 1421087@20 +pauli 3 Y MINUS f64:3ff0000000000000 1421087@20 +pauli 3 Z PLUS f64:3fe0000000000000 1421087@20 +pauli 3 Z MINUS f64:3fe0000000000000 1421087@20 +reference 0 X PLUS f64:3feffffffffffffe 1421087@20 +reference 0 X MINUS f64:0000000000000000 1421087@20 +reference 0 Y PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 Y MINUS f64:3fdffffffffffffe 1421087@20 +reference 0 Z PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 Z MINUS f64:3fdffffffffffffe 1421087@20 +reference 1 X PLUS f64:3fe0000000000000 2537205@20 +reference 1 X MINUS f64:3fdffffffffffffc 2537205@20 +reference 1 Y PLUS f64:3feffffffffffffe 2537205@20 +reference 1 Y MINUS f64:3950000000000000 2537205@20 +reference 1 Z PLUS f64:3fdffffffffffffe 2537205@20 +reference 1 Z MINUS f64:3fdffffffffffffe 2537205@20 +reference 2 X PLUS f64:393377ce858a5d46 3653323@20 +reference 2 X MINUS f64:3feffffffffffffe 3653323@20 +reference 2 Y PLUS f64:3fdffffffffffffe 3653323@20 +reference 2 Y MINUS f64:3fdffffffffffffe 3653323@20 +reference 2 Z PLUS f64:3fdffffffffffffe 3653323@20 +reference 2 Z MINUS f64:3fdffffffffffffe 3653323@20 +reference 3 X PLUS f64:3fdffffffffffffc 4769441@20 +reference 3 X MINUS f64:3fe0000000000000 4769441@20 +reference 3 Y PLUS f64:3950000000000000 4769441@20 +reference 3 Y MINUS f64:3feffffffffffffe 4769441@20 +reference 3 Z PLUS f64:3fdffffffffffffe 4769441@20 +reference 3 Z MINUS f64:3fdffffffffffffe 4769441@20 +end values +begin verdict +check bound_kind_sufficient PASS +check values_finite PASS +check physical_state_nontrivial PASS +check constraint_residual PASS +check povm_normalization PASS +check clock_probability_sum PASS +check probability_range PASS +check pauli_pair_sum PASS +check conditional_defined PASS +check schrodinger_agreement PASS +outcome PASS +failure_codes none +error_code none +expectation_met YES +end verdict +verdict_id efa8863d660399b2bb5cd8b33c6f395f57a012a2479929092e426d3251d76ced diff --git a/research/atemporal/at0/oracle/fixtures/p1-ideal-n3.case b/research/atemporal/at0/oracle/fixtures/p1-ideal-n3.case new file mode 100644 index 000000000..282519743 --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/p1-ideal-n3.case @@ -0,0 +1,39 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name p1-ideal-n3 +begin semantic +model_family PAGE_WOOTTERS_FINITE_IDEAL +energy_unit DIMENSIONLESS_HBAR_1 +clock_dim 3 +clock_energies -1/1,0/1,1/1 +system_dim 2 +system_hamiltonian_pauli 0/1,0/1,0/1,1/1 +interaction NONE +constraint SUM_HC_HS +physical_state NULLSPACE_PROJECTION +reference_clock_label t0 +reference_system_state (1/1;0/1),(1/1;0/1) +clock_povm COVARIANT_DISCRETE +povm_tau_turns 1/3 +povm_weight 1/1 +clock_label_count 3 +clock_label 0 t0 +clock_label 1 t1 +clock_label 2 t2 +observables PAULI_X,PAULI_Y,PAULI_Z +end semantic +begin acceptance +control_kind POSITIVE +expected_outcome PASS +expected_failure_codes none +min_bound_kind ESTIMATED +tol_constraint_residual 1@12 +tol_povm_residual 1@12 +tol_probability 1@12 +tol_zero_probability 1@9 +tol_schrodinger 1@12 +end acceptance +case_id c0ab39243d17b0d9da09826eb4f5eb6fe9192febeded94badd52bd31e80f490f +acceptance_id a13fb02dd674b8042ef8c0a197f03d58768709f782ba59cd26545eef6d41a228 +end diff --git a/research/atemporal/at0/oracle/fixtures/p1-ideal-n3.values b/research/atemporal/at0/oracle/fixtures/p1-ideal-n3.values new file mode 100644 index 000000000..fc7b2493f --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/p1-ideal-n3.values @@ -0,0 +1,64 @@ +begin values +physical_state_kernel_dim 2 +constraint_residual f64:0000000000000000 1065816@20 +povm_residual f64:3ccafb41f432002e 1065816@20 +label 0 t0 DEFINED +label 1 t1 DEFINED +label 2 t2 DEFINED +clock_probability 0 f64:3fd5555555555557 1065816@20 +clock_probability 1 f64:3fd5555555555556 1065816@20 +clock_probability 2 f64:3fd5555555555557 1065816@20 +pauli 0 X PLUS f64:3ff0000000000000 1065816@20 +pauli 0 X MINUS f64:0000000000000000 1065816@20 +pauli 0 Y PLUS f64:3fe0000000000000 1065816@20 +pauli 0 Y MINUS f64:3fe0000000000000 1065816@20 +pauli 0 Z PLUS f64:3fe0000000000000 1065816@20 +pauli 0 Z MINUS f64:3fe0000000000000 1065816@20 +pauli 1 X PLUS f64:3fcffffffffffffc 1065816@20 +pauli 1 X MINUS f64:3fe8000000000001 1065816@20 +pauli 1 Y PLUS f64:3fb126145e9ecd58 1065816@20 +pauli 1 Y MINUS f64:3feddb3d742c2655 1065816@20 +pauli 1 Z PLUS f64:3fe0000000000000 1065816@20 +pauli 1 Z MINUS f64:3fe0000000000000 1065816@20 +pauli 2 X PLUS f64:3fd0000000000008 1065816@20 +pauli 2 X MINUS f64:3fe7fffffffffffc 1065816@20 +pauli 2 Y PLUS f64:3feddb3d742c2658 1065816@20 +pauli 2 Y MINUS f64:3fb126145e9ecd44 1065816@20 +pauli 2 Z PLUS f64:3fe0000000000000 1065816@20 +pauli 2 Z MINUS f64:3fe0000000000000 1065816@20 +reference 0 X PLUS f64:3feffffffffffffe 1421087@20 +reference 0 X MINUS f64:0000000000000000 1421087@20 +reference 0 Y PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 Y MINUS f64:3fdffffffffffffe 1421087@20 +reference 0 Z PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 Z MINUS f64:3fdffffffffffffe 1421087@20 +reference 1 X PLUS f64:3fcffffffffffff6 4397401@20 +reference 1 X MINUS f64:3fe7ffffffffffff 4397401@20 +reference 1 Y PLUS f64:3fb126145e9ecd5c 4397401@20 +reference 1 Y MINUS f64:3feddb3d742c2650 4397401@20 +reference 1 Z PLUS f64:3fdffffffffffffc 4397401@20 +reference 1 Z MINUS f64:3fdffffffffffffc 4397401@20 +reference 2 X PLUS f64:3fd0000000000008 7373716@20 +reference 2 X MINUS f64:3fe7fffffffffffa 7373716@20 +reference 2 Y PLUS f64:3feddb3d742c2656 7373716@20 +reference 2 Y MINUS f64:3fb126145e9ecd41 7373716@20 +reference 2 Z PLUS f64:3fdffffffffffffe 7373716@20 +reference 2 Z MINUS f64:3fdffffffffffffe 7373716@20 +end values +begin verdict +check bound_kind_sufficient PASS +check values_finite PASS +check physical_state_nontrivial PASS +check constraint_residual PASS +check povm_normalization PASS +check clock_probability_sum PASS +check probability_range PASS +check pauli_pair_sum PASS +check conditional_defined PASS +check schrodinger_agreement PASS +outcome PASS +failure_codes none +error_code none +expectation_met YES +end verdict +verdict_id f34f003c4c52e9ce811051dcc3a8c9c4929f2b1bb9bac59565250d69286fbd7b diff --git a/research/atemporal/at0/oracle/fixtures/p1-ideal-n5.case b/research/atemporal/at0/oracle/fixtures/p1-ideal-n5.case new file mode 100644 index 000000000..2e6d11cd8 --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/p1-ideal-n5.case @@ -0,0 +1,41 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name p1-ideal-n5 +begin semantic +model_family PAGE_WOOTTERS_FINITE_IDEAL +energy_unit DIMENSIONLESS_HBAR_1 +clock_dim 5 +clock_energies -2/1,-1/1,0/1,1/1,2/1 +system_dim 2 +system_hamiltonian_pauli 0/1,0/1,0/1,1/1 +interaction NONE +constraint SUM_HC_HS +physical_state NULLSPACE_PROJECTION +reference_clock_label t0 +reference_system_state (1/1;0/1),(1/1;0/1) +clock_povm COVARIANT_DISCRETE +povm_tau_turns 1/5 +povm_weight 1/1 +clock_label_count 5 +clock_label 0 t0 +clock_label 1 t1 +clock_label 2 t2 +clock_label 3 t3 +clock_label 4 t4 +observables PAULI_X,PAULI_Y,PAULI_Z +end semantic +begin acceptance +control_kind POSITIVE +expected_outcome PASS +expected_failure_codes none +min_bound_kind ESTIMATED +tol_constraint_residual 1@12 +tol_povm_residual 1@12 +tol_probability 1@12 +tol_zero_probability 1@9 +tol_schrodinger 1@12 +end acceptance +case_id 2a6968f5910ee7a1300c3b4ca9a26a82ff64a8ac7c8c225782c5f9a2423cc9a9 +acceptance_id a13fb02dd674b8042ef8c0a197f03d58768709f782ba59cd26545eef6d41a228 +end diff --git a/research/atemporal/at0/oracle/fixtures/p1-ideal-n5.values b/research/atemporal/at0/oracle/fixtures/p1-ideal-n5.values new file mode 100644 index 000000000..8762882d2 --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/p1-ideal-n5.values @@ -0,0 +1,92 @@ +begin values +physical_state_kernel_dim 2 +constraint_residual f64:0000000000000000 1776358@20 +povm_residual f64:3cc1906d51932c26 1776358@20 +label 0 t0 DEFINED +label 1 t1 DEFINED +label 2 t2 DEFINED +label 3 t3 DEFINED +label 4 t4 DEFINED +clock_probability 0 f64:3fc9999999999999 1776358@20 +clock_probability 1 f64:3fc9999999999998 1776358@20 +clock_probability 2 f64:3fc9999999999999 1776358@20 +clock_probability 3 f64:3fc9999999999999 1776358@20 +clock_probability 4 f64:3fc9999999999999 1776358@20 +pauli 0 X PLUS f64:3ff0000000000000 1776358@20 +pauli 0 X MINUS f64:0000000000000000 1776358@20 +pauli 0 Y PLUS f64:3fe0000000000000 1776358@20 +pauli 0 Y MINUS f64:3fe0000000000000 1776358@20 +pauli 0 Z PLUS f64:3fe0000000000000 1776358@20 +pauli 0 Z MINUS f64:3fe0000000000000 1776358@20 +pauli 1 X PLUS f64:3fb8722191a02d68 1776358@20 +pauli 1 X MINUS f64:3fecf1bbcdcbfa53 1776358@20 +pauli 1 Y PLUS f64:3fe96791823aad30 1776358@20 +pauli 1 Y MINUS f64:3fca61b9f7154b40 1776358@20 +pauli 1 Z PLUS f64:3fe0000000000000 1776358@20 +pauli 1 Z MINUS f64:3fe0000000000000 1776358@20 +pauli 2 X PLUS f64:3fe4f1bbcdcbfa53 1776358@20 +pauli 2 X MINUS f64:3fd61c8864680b5a 1776358@20 +pauli 2 Y PLUS f64:3f990f1ecbbab000 1776358@20 +pauli 2 Y MINUS f64:3fef378709a22a80 1776358@20 +pauli 2 Z PLUS f64:3fe0000000000000 1776358@20 +pauli 2 Z MINUS f64:3fe0000000000000 1776358@20 +pauli 3 X PLUS f64:3fe4f1bbcdcbfa55 1776358@20 +pauli 3 X MINUS f64:3fd61c8864680b56 1776358@20 +pauli 3 Y PLUS f64:3fef378709a22a7f 1776358@20 +pauli 3 Y MINUS f64:3f990f1ecbbab020 1776358@20 +pauli 3 Z PLUS f64:3fe0000000000000 1776358@20 +pauli 3 Z MINUS f64:3fe0000000000000 1776358@20 +pauli 4 X PLUS f64:3fb8722191a02d58 1776358@20 +pauli 4 X MINUS f64:3fecf1bbcdcbfa55 1776358@20 +pauli 4 Y PLUS f64:3fca61b9f7154b4a 1776358@20 +pauli 4 Y MINUS f64:3fe96791823aad2e 1776358@20 +pauli 4 Z PLUS f64:3fe0000000000000 1776358@20 +pauli 4 Z MINUS f64:3fe0000000000000 1776358@20 +reference 0 X PLUS f64:3feffffffffffffe 1421087@20 +reference 0 X MINUS f64:0000000000000000 1421087@20 +reference 0 Y PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 Y MINUS f64:3fdffffffffffffe 1421087@20 +reference 0 Z PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 Z MINUS f64:3fdffffffffffffe 1421087@20 +reference 1 X PLUS f64:3fb8722191a02d62 3206876@20 +reference 1 X MINUS f64:3fecf1bbcdcbfa52 3206876@20 +reference 1 Y PLUS f64:3fe96791823aad2e 3206876@20 +reference 1 Y MINUS f64:3fca61b9f7154b43 3206876@20 +reference 1 Z PLUS f64:3fdffffffffffffe 3206876@20 +reference 1 Z MINUS f64:3fdffffffffffffe 3206876@20 +reference 2 X PLUS f64:3fe4f1bbcdcbfa51 4992664@20 +reference 2 X MINUS f64:3fd61c8864680b59 4992664@20 +reference 2 Y PLUS f64:3f990f1ecbbaaff9 4992664@20 +reference 2 Y MINUS f64:3fef378709a22a7d 4992664@20 +reference 2 Z PLUS f64:3fdffffffffffffe 4992664@20 +reference 2 Z MINUS f64:3fdffffffffffffe 4992664@20 +reference 3 X PLUS f64:3fe4f1bbcdcbfa55 6778453@20 +reference 3 X MINUS f64:3fd61c8864680b54 6778453@20 +reference 3 Y PLUS f64:3fef378709a22a7e 6778453@20 +reference 3 Y MINUS f64:3f990f1ecbbab01c 6778453@20 +reference 3 Z PLUS f64:3fdfffffffffffff 6778453@20 +reference 3 Z MINUS f64:3fdfffffffffffff 6778453@20 +reference 4 X PLUS f64:3fb8722191a02d57 8564242@20 +reference 4 X MINUS f64:3fecf1bbcdcbfa52 8564242@20 +reference 4 Y PLUS f64:3fca61b9f7154b46 8564242@20 +reference 4 Y MINUS f64:3fe96791823aad2c 8564242@20 +reference 4 Z PLUS f64:3fdffffffffffffd 8564242@20 +reference 4 Z MINUS f64:3fdffffffffffffd 8564242@20 +end values +begin verdict +check bound_kind_sufficient PASS +check values_finite PASS +check physical_state_nontrivial PASS +check constraint_residual PASS +check povm_normalization PASS +check clock_probability_sum PASS +check probability_range PASS +check pauli_pair_sum PASS +check conditional_defined PASS +check schrodinger_agreement PASS +outcome PASS +failure_codes none +error_code none +expectation_met YES +end verdict +verdict_id cdc13ac50439bd0ef222936f38b596b21dc201800568c7ee2c83f357f6d21238 diff --git a/research/atemporal/at0/oracle/fixtures/p1-ideal-n6.case b/research/atemporal/at0/oracle/fixtures/p1-ideal-n6.case new file mode 100644 index 000000000..76055b591 --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/p1-ideal-n6.case @@ -0,0 +1,42 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name p1-ideal-n6 +begin semantic +model_family PAGE_WOOTTERS_FINITE_IDEAL +energy_unit DIMENSIONLESS_HBAR_1 +clock_dim 6 +clock_energies -5/2,-3/2,-1/2,1/2,3/2,5/2 +system_dim 2 +system_hamiltonian_pauli 0/1,0/1,0/1,1/2 +interaction NONE +constraint SUM_HC_HS +physical_state NULLSPACE_PROJECTION +reference_clock_label t0 +reference_system_state (1/1;0/1),(1/1;0/1) +clock_povm COVARIANT_DISCRETE +povm_tau_turns 1/6 +povm_weight 1/1 +clock_label_count 6 +clock_label 0 t0 +clock_label 1 t1 +clock_label 2 t2 +clock_label 3 t3 +clock_label 4 t4 +clock_label 5 t5 +observables PAULI_X,PAULI_Y,PAULI_Z +end semantic +begin acceptance +control_kind POSITIVE +expected_outcome PASS +expected_failure_codes none +min_bound_kind ESTIMATED +tol_constraint_residual 1@12 +tol_povm_residual 1@12 +tol_probability 1@12 +tol_zero_probability 1@9 +tol_schrodinger 1@12 +end acceptance +case_id 606e0140b8c2baf2e4a65775ba8917c8e6c8b1549aef4dd189e534d9c997edf9 +acceptance_id a13fb02dd674b8042ef8c0a197f03d58768709f782ba59cd26545eef6d41a228 +end diff --git a/research/atemporal/at0/oracle/fixtures/p1-ideal-n6.values b/research/atemporal/at0/oracle/fixtures/p1-ideal-n6.values new file mode 100644 index 000000000..91aab825b --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/p1-ideal-n6.values @@ -0,0 +1,106 @@ +begin values +physical_state_kernel_dim 2 +constraint_residual f64:0000000000000000 213163@19 +povm_residual f64:3ce01cc1700a2955 213163@19 +label 0 t0 DEFINED +label 1 t1 DEFINED +label 2 t2 DEFINED +label 3 t3 DEFINED +label 4 t4 DEFINED +label 5 t5 DEFINED +clock_probability 0 f64:3fc5555555555557 213163@19 +clock_probability 1 f64:3fc5555555555556 213163@19 +clock_probability 2 f64:3fc5555555555556 213163@19 +clock_probability 3 f64:3fc5555555555557 213163@19 +clock_probability 4 f64:3fc5555555555556 213163@19 +clock_probability 5 f64:3fc5555555555558 213163@19 +pauli 0 X PLUS f64:3ff0000000000000 213163@19 +pauli 0 X MINUS f64:0000000000000000 213163@19 +pauli 0 Y PLUS f64:3fe0000000000000 213163@19 +pauli 0 Y MINUS f64:3fe0000000000000 213163@19 +pauli 0 Z PLUS f64:3fe0000000000000 213163@19 +pauli 0 Z MINUS f64:3fe0000000000000 213163@19 +pauli 1 X PLUS f64:3fe8000000000001 213163@19 +pauli 1 X MINUS f64:3fcffffffffffffc 213163@19 +pauli 1 Y PLUS f64:3feddb3d742c2656 213163@19 +pauli 1 Y MINUS f64:3fb126145e9ecd54 213163@19 +pauli 1 Z PLUS f64:3fe0000000000000 213163@19 +pauli 1 Z MINUS f64:3fe0000000000000 213163@19 +pauli 2 X PLUS f64:3fd0000000000002 213163@19 +pauli 2 X MINUS f64:3fe7ffffffffffff 213163@19 +pauli 2 Y PLUS f64:3feddb3d742c2656 213163@19 +pauli 2 Y MINUS f64:3fb126145e9ecd4c 213163@19 +pauli 2 Z PLUS f64:3fe0000000000000 213163@19 +pauli 2 Z MINUS f64:3fe0000000000000 213163@19 +pauli 3 X PLUS f64:0000000000000000 213163@19 +pauli 3 X MINUS f64:3ff0000000000000 213163@19 +pauli 3 Y PLUS f64:3fe0000000000001 213163@19 +pauli 3 Y MINUS f64:3fdfffffffffffff 213163@19 +pauli 3 Z PLUS f64:3fe0000000000000 213163@19 +pauli 3 Z MINUS f64:3fe0000000000000 213163@19 +pauli 4 X PLUS f64:3fcffffffffffffc 213163@19 +pauli 4 X MINUS f64:3fe8000000000001 213163@19 +pauli 4 Y PLUS f64:3fb126145e9ecd58 213163@19 +pauli 4 Y MINUS f64:3feddb3d742c2655 213163@19 +pauli 4 Z PLUS f64:3fe0000000000000 213163@19 +pauli 4 Z MINUS f64:3fe0000000000000 213163@19 +pauli 5 X PLUS f64:3fe7fffffffffffc 213163@19 +pauli 5 X MINUS f64:3fd0000000000005 213163@19 +pauli 5 Y PLUS f64:3fb126145e9ecd4c 213163@19 +pauli 5 Y MINUS f64:3feddb3d742c2656 213163@19 +pauli 5 Z PLUS f64:3fdfffffffffffff 213163@19 +pauli 5 Z MINUS f64:3fdfffffffffffff 213163@19 +reference 0 X PLUS f64:3feffffffffffffe 1421087@20 +reference 0 X MINUS f64:0000000000000000 1421087@20 +reference 0 Y PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 Y MINUS f64:3fdffffffffffffe 1421087@20 +reference 0 Z PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 Z MINUS f64:3fdffffffffffffe 1421087@20 +reference 1 X PLUS f64:3fe7ffffffffffff 2165166@20 +reference 1 X MINUS f64:3fcffffffffffffc 2165166@20 +reference 1 Y PLUS f64:3feddb3d742c2654 2165166@20 +reference 1 Y MINUS f64:3fb126145e9ecd57 2165166@20 +reference 1 Z PLUS f64:3fdffffffffffffe 2165166@20 +reference 1 Z MINUS f64:3fdffffffffffffe 2165166@20 +reference 2 X PLUS f64:3fd0000000000001 2909244@20 +reference 2 X MINUS f64:3fe7ffffffffffff 2909244@20 +reference 2 Y PLUS f64:3feddb3d742c2654 2909244@20 +reference 2 Y MINUS f64:3fb126145e9ecd53 2909244@20 +reference 2 Z PLUS f64:3fe0000000000000 2909244@20 +reference 2 Z MINUS f64:3fe0000000000000 2909244@20 +reference 3 X PLUS f64:393377ce858a5d46 3653323@20 +reference 3 X MINUS f64:3feffffffffffffe 3653323@20 +reference 3 Y PLUS f64:3fdffffffffffffe 3653323@20 +reference 3 Y MINUS f64:3fdffffffffffffe 3653323@20 +reference 3 Z PLUS f64:3fdffffffffffffe 3653323@20 +reference 3 Z MINUS f64:3fdffffffffffffe 3653323@20 +reference 4 X PLUS f64:3fcffffffffffff6 4397401@20 +reference 4 X MINUS f64:3fe7ffffffffffff 4397401@20 +reference 4 Y PLUS f64:3fb126145e9ecd5c 4397401@20 +reference 4 Y MINUS f64:3feddb3d742c2650 4397401@20 +reference 4 Z PLUS f64:3fdffffffffffffc 4397401@20 +reference 4 Z MINUS f64:3fdffffffffffffc 4397401@20 +reference 5 X PLUS f64:3fe7fffffffffffc 514148@19 +reference 5 X MINUS f64:3fd0000000000005 514148@19 +reference 5 Y PLUS f64:3fb126145e9ecd49 514148@19 +reference 5 Y MINUS f64:3feddb3d742c2656 514148@19 +reference 5 Z PLUS f64:3fdffffffffffffe 514148@19 +reference 5 Z MINUS f64:3fdffffffffffffe 514148@19 +end values +begin verdict +check bound_kind_sufficient PASS +check values_finite PASS +check physical_state_nontrivial PASS +check constraint_residual PASS +check povm_normalization PASS +check clock_probability_sum PASS +check probability_range PASS +check pauli_pair_sum PASS +check conditional_defined PASS +check schrodinger_agreement PASS +outcome PASS +failure_codes none +error_code none +expectation_met YES +end verdict +verdict_id fea6f54296da5a05bc7ebdc751c27412b6dd4b5866f835f797fa85043479573a diff --git a/research/atemporal/at0/oracle/fixtures/p1-ideal-n8.case b/research/atemporal/at0/oracle/fixtures/p1-ideal-n8.case new file mode 100644 index 000000000..6ab8b4481 --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/p1-ideal-n8.case @@ -0,0 +1,44 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name p1-ideal-n8 +begin semantic +model_family PAGE_WOOTTERS_FINITE_IDEAL +energy_unit DIMENSIONLESS_HBAR_1 +clock_dim 8 +clock_energies -7/2,-5/2,-3/2,-1/2,1/2,3/2,5/2,7/2 +system_dim 2 +system_hamiltonian_pauli 0/1,0/1,0/1,1/2 +interaction NONE +constraint SUM_HC_HS +physical_state NULLSPACE_PROJECTION +reference_clock_label t0 +reference_system_state (1/1;0/1),(1/1;0/1) +clock_povm COVARIANT_DISCRETE +povm_tau_turns 1/8 +povm_weight 1/1 +clock_label_count 8 +clock_label 0 t0 +clock_label 1 t1 +clock_label 2 t2 +clock_label 3 t3 +clock_label 4 t4 +clock_label 5 t5 +clock_label 6 t6 +clock_label 7 t7 +observables PAULI_X,PAULI_Y,PAULI_Z +end semantic +begin acceptance +control_kind POSITIVE +expected_outcome PASS +expected_failure_codes none +min_bound_kind ESTIMATED +tol_constraint_residual 1@12 +tol_povm_residual 1@12 +tol_probability 1@12 +tol_zero_probability 1@9 +tol_schrodinger 1@12 +end acceptance +case_id 1edbfb9f8ba61695ecfda672c953bbde99773dd0cd0af40ade47c8b3a80a0ede +acceptance_id a13fb02dd674b8042ef8c0a197f03d58768709f782ba59cd26545eef6d41a228 +end diff --git a/research/atemporal/at0/oracle/fixtures/p1-ideal-n8.values b/research/atemporal/at0/oracle/fixtures/p1-ideal-n8.values new file mode 100644 index 000000000..f3b8ee849 --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/p1-ideal-n8.values @@ -0,0 +1,134 @@ +begin values +physical_state_kernel_dim 2 +constraint_residual f64:0000000000000000 2842172@20 +povm_residual f64:3cdfd56a1d0d8768 2842172@20 +label 0 t0 DEFINED +label 1 t1 DEFINED +label 2 t2 DEFINED +label 3 t3 DEFINED +label 4 t4 DEFINED +label 5 t5 DEFINED +label 6 t6 DEFINED +label 7 t7 DEFINED +clock_probability 0 f64:3fbffffffffffffe 2842172@20 +clock_probability 1 f64:3fbffffffffffffd 2842172@20 +clock_probability 2 f64:3fbfffffffffffff 2842172@20 +clock_probability 3 f64:3fbffffffffffffe 2842172@20 +clock_probability 4 f64:3fbffffffffffffe 2842172@20 +clock_probability 5 f64:3fbffffffffffffd 2842172@20 +clock_probability 6 f64:3fbfffffffffffff 2842172@20 +clock_probability 7 f64:3fbffffffffffffe 2842172@20 +pauli 0 X PLUS f64:3ff0000000000000 2842172@20 +pauli 0 X MINUS f64:0000000000000000 2842172@20 +pauli 0 Y PLUS f64:3fe0000000000000 2842172@20 +pauli 0 Y MINUS f64:3fe0000000000000 2842172@20 +pauli 0 Z PLUS f64:3fe0000000000000 2842172@20 +pauli 0 Z MINUS f64:3fe0000000000000 2842172@20 +pauli 1 X PLUS f64:3feb504f333f9de6 2842172@20 +pauli 1 X MINUS f64:3fc2bec333018866 2842172@20 +pauli 1 Y PLUS f64:3feb504f333f9de6 2842172@20 +pauli 1 Y MINUS f64:3fc2bec333018866 2842172@20 +pauli 1 Z PLUS f64:3fe0000000000000 2842172@20 +pauli 1 Z MINUS f64:3fe0000000000000 2842172@20 +pauli 2 X PLUS f64:3fe0000000000001 2842172@20 +pauli 2 X MINUS f64:3fdfffffffffffff 2842172@20 +pauli 2 Y PLUS f64:3ff0000000000000 2842172@20 +pauli 2 Y MINUS f64:0000000000000000 2842172@20 +pauli 2 Z PLUS f64:3fe0000000000000 2842172@20 +pauli 2 Z MINUS f64:3fe0000000000000 2842172@20 +pauli 3 X PLUS f64:3fc2bec33301886a 2842172@20 +pauli 3 X MINUS f64:3feb504f333f9de6 2842172@20 +pauli 3 Y PLUS f64:3feb504f333f9de7 2842172@20 +pauli 3 Y MINUS f64:3fc2bec333018864 2842172@20 +pauli 3 Z PLUS f64:3fe0000000000000 2842172@20 +pauli 3 Z MINUS f64:3fe0000000000000 2842172@20 +pauli 4 X PLUS f64:0000000000000000 2842172@20 +pauli 4 X MINUS f64:3ff0000000000000 2842172@20 +pauli 4 Y PLUS f64:3fe0000000000001 2842172@20 +pauli 4 Y MINUS f64:3fdfffffffffffff 2842172@20 +pauli 4 Z PLUS f64:3fe0000000000000 2842172@20 +pauli 4 Z MINUS f64:3fe0000000000000 2842172@20 +pauli 5 X PLUS f64:3fc2bec333018866 2842172@20 +pauli 5 X MINUS f64:3feb504f333f9de6 2842172@20 +pauli 5 Y PLUS f64:3fc2bec333018866 2842172@20 +pauli 5 Y MINUS f64:3feb504f333f9de6 2842172@20 +pauli 5 Z PLUS f64:3fe0000000000000 2842172@20 +pauli 5 Z MINUS f64:3fe0000000000000 2842172@20 +pauli 6 X PLUS f64:3fdfffffffffffff 2842172@20 +pauli 6 X MINUS f64:3fe0000000000001 2842172@20 +pauli 6 Y PLUS f64:0000000000000000 2842172@20 +pauli 6 Y MINUS f64:3ff0000000000000 2842172@20 +pauli 6 Z PLUS f64:3fe0000000000000 2842172@20 +pauli 6 Z MINUS f64:3fe0000000000000 2842172@20 +pauli 7 X PLUS f64:3feb504f333f9de6 2842172@20 +pauli 7 X MINUS f64:3fc2bec33301886a 2842172@20 +pauli 7 Y PLUS f64:3fc2bec333018862 2842172@20 +pauli 7 Y MINUS f64:3feb504f333f9de8 2842172@20 +pauli 7 Z PLUS f64:3fe0000000000000 2842172@20 +pauli 7 Z MINUS f64:3fe0000000000000 2842172@20 +reference 0 X PLUS f64:3feffffffffffffe 1421087@20 +reference 0 X MINUS f64:0000000000000000 1421087@20 +reference 0 Y PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 Y MINUS f64:3fdffffffffffffe 1421087@20 +reference 0 Z PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 Z MINUS f64:3fdffffffffffffe 1421087@20 +reference 1 X PLUS f64:3feb504f333f9de4 1979146@20 +reference 1 X MINUS f64:3fc2bec333018865 1979146@20 +reference 1 Y PLUS f64:3feb504f333f9de4 1979146@20 +reference 1 Y MINUS f64:3fc2bec333018866 1979146@20 +reference 1 Z PLUS f64:3fdffffffffffffd 1979146@20 +reference 1 Z MINUS f64:3fdffffffffffffd 1979146@20 +reference 2 X PLUS f64:3fe0000000000000 2537205@20 +reference 2 X MINUS f64:3fdffffffffffffc 2537205@20 +reference 2 Y PLUS f64:3feffffffffffffe 2537205@20 +reference 2 Y MINUS f64:3950000000000000 2537205@20 +reference 2 Z PLUS f64:3fdffffffffffffe 2537205@20 +reference 2 Z MINUS f64:3fdffffffffffffe 2537205@20 +reference 3 X PLUS f64:3fc2bec333018867 3095264@20 +reference 3 X MINUS f64:3feb504f333f9de4 3095264@20 +reference 3 Y PLUS f64:3feb504f333f9de6 3095264@20 +reference 3 Y MINUS f64:3fc2bec333018864 3095264@20 +reference 3 Z PLUS f64:3fdffffffffffffe 3095264@20 +reference 3 Z MINUS f64:3fdffffffffffffe 3095264@20 +reference 4 X PLUS f64:393377ce858a5d46 3653323@20 +reference 4 X MINUS f64:3feffffffffffffe 3653323@20 +reference 4 Y PLUS f64:3fdffffffffffffe 3653323@20 +reference 4 Y MINUS f64:3fdffffffffffffe 3653323@20 +reference 4 Z PLUS f64:3fdffffffffffffe 3653323@20 +reference 4 Z MINUS f64:3fdffffffffffffe 3653323@20 +reference 5 X PLUS f64:3fc2bec333018865 4211382@20 +reference 5 X MINUS f64:3feb504f333f9de4 4211382@20 +reference 5 Y PLUS f64:3fc2bec333018866 4211382@20 +reference 5 Y MINUS f64:3feb504f333f9de4 4211382@20 +reference 5 Z PLUS f64:3fdffffffffffffd 4211382@20 +reference 5 Z MINUS f64:3fdffffffffffffd 4211382@20 +reference 6 X PLUS f64:3fdffffffffffffc 4769441@20 +reference 6 X MINUS f64:3fe0000000000000 4769441@20 +reference 6 Y PLUS f64:3950000000000000 4769441@20 +reference 6 Y MINUS f64:3feffffffffffffe 4769441@20 +reference 6 Z PLUS f64:3fdffffffffffffe 4769441@20 +reference 6 Z MINUS f64:3fdffffffffffffe 4769441@20 +reference 7 X PLUS f64:3feb504f333f9de4 53275@18 +reference 7 X MINUS f64:3fc2bec33301886a 53275@18 +reference 7 Y PLUS f64:3fc2bec333018863 53275@18 +reference 7 Y MINUS f64:3feb504f333f9de6 53275@18 +reference 7 Z PLUS f64:3fdffffffffffffe 53275@18 +reference 7 Z MINUS f64:3fdffffffffffffe 53275@18 +end values +begin verdict +check bound_kind_sufficient PASS +check values_finite PASS +check physical_state_nontrivial PASS +check constraint_residual PASS +check povm_normalization PASS +check clock_probability_sum PASS +check probability_range PASS +check pauli_pair_sum PASS +check conditional_defined PASS +check schrodinger_agreement PASS +outcome PASS +failure_codes none +error_code none +expectation_met YES +end verdict +verdict_id 15bd131e279b780745b1601b71d66b5864f16d2df35fe86c495c1f42b7f435a1 diff --git a/research/atemporal/at0/oracle/fixtures/p1-offset-ref-t2.case b/research/atemporal/at0/oracle/fixtures/p1-offset-ref-t2.case new file mode 100644 index 000000000..6dccca9f2 --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/p1-offset-ref-t2.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name p1-offset-ref-t2 +begin semantic +model_family PAGE_WOOTTERS_FINITE_IDEAL +energy_unit DIMENSIONLESS_HBAR_1 +clock_dim 4 +clock_energies -3/2,-1/2,1/2,3/2 +system_dim 2 +system_hamiltonian_pauli 0/1,0/1,0/1,1/2 +interaction NONE +constraint SUM_HC_HS +physical_state NULLSPACE_PROJECTION +reference_clock_label t2 +reference_system_state (1/1;0/1),(1/1;0/1) +clock_povm COVARIANT_DISCRETE +povm_tau_turns 1/4 +povm_weight 1/1 +clock_label_count 4 +clock_label 0 t0 +clock_label 1 t1 +clock_label 2 t2 +clock_label 3 t3 +observables PAULI_X,PAULI_Y,PAULI_Z +end semantic +begin acceptance +control_kind POSITIVE +expected_outcome PASS +expected_failure_codes none +min_bound_kind ESTIMATED +tol_constraint_residual 1@12 +tol_povm_residual 1@12 +tol_probability 1@12 +tol_zero_probability 1@9 +tol_schrodinger 1@12 +end acceptance +case_id da21dde2dff2d60141e6e6d3029f78880abae14359bd5d15292d0606607818ff +acceptance_id a13fb02dd674b8042ef8c0a197f03d58768709f782ba59cd26545eef6d41a228 +end diff --git a/research/atemporal/at0/oracle/fixtures/p1-offset-ref-t2.values b/research/atemporal/at0/oracle/fixtures/p1-offset-ref-t2.values new file mode 100644 index 000000000..bad36b6a8 --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/p1-offset-ref-t2.values @@ -0,0 +1,78 @@ +begin values +physical_state_kernel_dim 2 +constraint_residual f64:0000000000000000 1421087@20 +povm_residual f64:3cb2a8eb3f35f924 1421087@20 +label 0 t0 DEFINED +label 1 t1 DEFINED +label 2 t2 DEFINED +label 3 t3 DEFINED +clock_probability 0 f64:3fd0000000000000 1421087@20 +clock_probability 1 f64:3fd0000000000000 1421087@20 +clock_probability 2 f64:3fd0000000000000 1421087@20 +clock_probability 3 f64:3fd0000000000000 1421087@20 +pauli 0 X PLUS f64:0000000000000000 1421087@20 +pauli 0 X MINUS f64:3ff0000000000000 1421087@20 +pauli 0 Y PLUS f64:3fdfffffffffffff 1421087@20 +pauli 0 Y MINUS f64:3fe0000000000001 1421087@20 +pauli 0 Z PLUS f64:3fe0000000000000 1421087@20 +pauli 0 Z MINUS f64:3fe0000000000000 1421087@20 +pauli 1 X PLUS f64:3fdffffffffffffe 1421087@20 +pauli 1 X MINUS f64:3fe0000000000001 1421087@20 +pauli 1 Y PLUS f64:0000000000000000 1421087@20 +pauli 1 Y MINUS f64:3ff0000000000000 1421087@20 +pauli 1 Z PLUS f64:3fe0000000000000 1421087@20 +pauli 1 Z MINUS f64:3fe0000000000000 1421087@20 +pauli 2 X PLUS f64:3ff0000000000000 1421087@20 +pauli 2 X MINUS f64:0000000000000000 1421087@20 +pauli 2 Y PLUS f64:3fe0000000000000 1421087@20 +pauli 2 Y MINUS f64:3fe0000000000000 1421087@20 +pauli 2 Z PLUS f64:3fe0000000000000 1421087@20 +pauli 2 Z MINUS f64:3fe0000000000000 1421087@20 +pauli 3 X PLUS f64:3fe0000000000001 1421087@20 +pauli 3 X MINUS f64:3fdffffffffffffe 1421087@20 +pauli 3 Y PLUS f64:3ff0000000000000 1421087@20 +pauli 3 Y MINUS f64:0000000000000000 1421087@20 +pauli 3 Z PLUS f64:3fe0000000000000 1421087@20 +pauli 3 Z MINUS f64:3fe0000000000000 1421087@20 +reference 0 X PLUS f64:393377ce858a5d46 3653323@20 +reference 0 X MINUS f64:3feffffffffffffe 3653323@20 +reference 0 Y PLUS f64:3fdffffffffffffe 3653323@20 +reference 0 Y MINUS f64:3fdffffffffffffe 3653323@20 +reference 0 Z PLUS f64:3fdffffffffffffe 3653323@20 +reference 0 Z MINUS f64:3fdffffffffffffe 3653323@20 +reference 1 X PLUS f64:3fe0000000000000 2537205@20 +reference 1 X MINUS f64:3fdffffffffffffc 2537205@20 +reference 1 Y PLUS f64:3950000000000000 2537205@20 +reference 1 Y MINUS f64:3feffffffffffffe 2537205@20 +reference 1 Z PLUS f64:3fdffffffffffffe 2537205@20 +reference 1 Z MINUS f64:3fdffffffffffffe 2537205@20 +reference 2 X PLUS f64:3feffffffffffffe 1421087@20 +reference 2 X MINUS f64:0000000000000000 1421087@20 +reference 2 Y PLUS f64:3fdffffffffffffe 1421087@20 +reference 2 Y MINUS f64:3fdffffffffffffe 1421087@20 +reference 2 Z PLUS f64:3fdffffffffffffe 1421087@20 +reference 2 Z MINUS f64:3fdffffffffffffe 1421087@20 +reference 3 X PLUS f64:3fe0000000000000 2537205@20 +reference 3 X MINUS f64:3fdffffffffffffc 2537205@20 +reference 3 Y PLUS f64:3feffffffffffffe 2537205@20 +reference 3 Y MINUS f64:3950000000000000 2537205@20 +reference 3 Z PLUS f64:3fdffffffffffffe 2537205@20 +reference 3 Z MINUS f64:3fdffffffffffffe 2537205@20 +end values +begin verdict +check bound_kind_sufficient PASS +check values_finite PASS +check physical_state_nontrivial PASS +check constraint_residual PASS +check povm_normalization PASS +check clock_probability_sum PASS +check probability_range PASS +check pauli_pair_sum PASS +check conditional_defined PASS +check schrodinger_agreement PASS +outcome PASS +failure_codes none +error_code none +expectation_met YES +end verdict +verdict_id 2917531cf4bfcbf8944a04e779d4e6ab7b31a09c984ebff6dd906e87e93a9398 diff --git a/research/atemporal/at0/oracle/fixtures/p1-unnormalized-2.case b/research/atemporal/at0/oracle/fixtures/p1-unnormalized-2.case new file mode 100644 index 000000000..db440ffe4 --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/p1-unnormalized-2.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name p1-unnormalized-2 +begin semantic +model_family PAGE_WOOTTERS_FINITE_IDEAL +energy_unit DIMENSIONLESS_HBAR_1 +clock_dim 4 +clock_energies -3/2,-1/2,1/2,3/2 +system_dim 2 +system_hamiltonian_pauli 0/1,0/1,0/1,1/2 +interaction NONE +constraint SUM_HC_HS +physical_state NULLSPACE_PROJECTION +reference_clock_label t0 +reference_system_state (2/1;0/1),(2/1;0/1) +clock_povm COVARIANT_DISCRETE +povm_tau_turns 1/4 +povm_weight 1/1 +clock_label_count 4 +clock_label 0 t0 +clock_label 1 t1 +clock_label 2 t2 +clock_label 3 t3 +observables PAULI_X,PAULI_Y,PAULI_Z +end semantic +begin acceptance +control_kind POSITIVE +expected_outcome PASS +expected_failure_codes none +min_bound_kind ESTIMATED +tol_constraint_residual 1@12 +tol_povm_residual 1@12 +tol_probability 1@12 +tol_zero_probability 1@9 +tol_schrodinger 1@12 +end acceptance +case_id 2c7542ef6fb6e902c8eee659e2327eab12e038505af9cb4b8afe271c995c5483 +acceptance_id a13fb02dd674b8042ef8c0a197f03d58768709f782ba59cd26545eef6d41a228 +end diff --git a/research/atemporal/at0/oracle/fixtures/p1-unnormalized-2.values b/research/atemporal/at0/oracle/fixtures/p1-unnormalized-2.values new file mode 100644 index 000000000..736db86ec --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/p1-unnormalized-2.values @@ -0,0 +1,78 @@ +begin values +physical_state_kernel_dim 2 +constraint_residual f64:0000000000000000 1421087@20 +povm_residual f64:3cb2a8eb3f35f924 1421087@20 +label 0 t0 DEFINED +label 1 t1 DEFINED +label 2 t2 DEFINED +label 3 t3 DEFINED +clock_probability 0 f64:3fd0000000000000 1421087@20 +clock_probability 1 f64:3fd0000000000000 1421087@20 +clock_probability 2 f64:3fd0000000000000 1421087@20 +clock_probability 3 f64:3fd0000000000000 1421087@20 +pauli 0 X PLUS f64:3ff0000000000000 1421087@20 +pauli 0 X MINUS f64:0000000000000000 1421087@20 +pauli 0 Y PLUS f64:3fe0000000000000 1421087@20 +pauli 0 Y MINUS f64:3fe0000000000000 1421087@20 +pauli 0 Z PLUS f64:3fe0000000000000 1421087@20 +pauli 0 Z MINUS f64:3fe0000000000000 1421087@20 +pauli 1 X PLUS f64:3fe0000000000001 1421087@20 +pauli 1 X MINUS f64:3fdffffffffffffe 1421087@20 +pauli 1 Y PLUS f64:3ff0000000000000 1421087@20 +pauli 1 Y MINUS f64:0000000000000000 1421087@20 +pauli 1 Z PLUS f64:3fe0000000000000 1421087@20 +pauli 1 Z MINUS f64:3fe0000000000000 1421087@20 +pauli 2 X PLUS f64:0000000000000000 1421087@20 +pauli 2 X MINUS f64:3ff0000000000000 1421087@20 +pauli 2 Y PLUS f64:3fe0000000000001 1421087@20 +pauli 2 Y MINUS f64:3fdfffffffffffff 1421087@20 +pauli 2 Z PLUS f64:3fe0000000000000 1421087@20 +pauli 2 Z MINUS f64:3fe0000000000000 1421087@20 +pauli 3 X PLUS f64:3fdffffffffffffe 1421087@20 +pauli 3 X MINUS f64:3fe0000000000001 1421087@20 +pauli 3 Y PLUS f64:0000000000000000 1421087@20 +pauli 3 Y MINUS f64:3ff0000000000000 1421087@20 +pauli 3 Z PLUS f64:3fe0000000000000 1421087@20 +pauli 3 Z MINUS f64:3fe0000000000000 1421087@20 +reference 0 X PLUS f64:3feffffffffffffe 1421087@20 +reference 0 X MINUS f64:0000000000000000 1421087@20 +reference 0 Y PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 Y MINUS f64:3fdffffffffffffe 1421087@20 +reference 0 Z PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 Z MINUS f64:3fdffffffffffffe 1421087@20 +reference 1 X PLUS f64:3fe0000000000000 2537205@20 +reference 1 X MINUS f64:3fdffffffffffffc 2537205@20 +reference 1 Y PLUS f64:3feffffffffffffe 2537205@20 +reference 1 Y MINUS f64:3950000000000000 2537205@20 +reference 1 Z PLUS f64:3fdffffffffffffe 2537205@20 +reference 1 Z MINUS f64:3fdffffffffffffe 2537205@20 +reference 2 X PLUS f64:393377ce858a5d46 3653323@20 +reference 2 X MINUS f64:3feffffffffffffe 3653323@20 +reference 2 Y PLUS f64:3fdffffffffffffe 3653323@20 +reference 2 Y MINUS f64:3fdffffffffffffe 3653323@20 +reference 2 Z PLUS f64:3fdffffffffffffe 3653323@20 +reference 2 Z MINUS f64:3fdffffffffffffe 3653323@20 +reference 3 X PLUS f64:3fdffffffffffffc 4769441@20 +reference 3 X MINUS f64:3fe0000000000000 4769441@20 +reference 3 Y PLUS f64:3950000000000000 4769441@20 +reference 3 Y MINUS f64:3feffffffffffffe 4769441@20 +reference 3 Z PLUS f64:3fdffffffffffffe 4769441@20 +reference 3 Z MINUS f64:3fdffffffffffffe 4769441@20 +end values +begin verdict +check bound_kind_sufficient PASS +check values_finite PASS +check physical_state_nontrivial PASS +check constraint_residual PASS +check povm_normalization PASS +check clock_probability_sum PASS +check probability_range PASS +check pauli_pair_sum PASS +check conditional_defined PASS +check schrodinger_agreement PASS +outcome PASS +failure_codes none +error_code none +expectation_met YES +end verdict +verdict_id 92d215231b6132f3f3877f4c631446d4ca07e175ee7799e659495f367a1f46a6 diff --git a/research/atemporal/at0/oracle/fixtures/p2-h0-shift.case b/research/atemporal/at0/oracle/fixtures/p2-h0-shift.case new file mode 100644 index 000000000..8d6b9fd90 --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/p2-h0-shift.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name p2-h0-shift +begin semantic +model_family PAGE_WOOTTERS_FINITE_IDEAL +energy_unit DIMENSIONLESS_HBAR_1 +clock_dim 4 +clock_energies -1/1,0/1,1/1,2/1 +system_dim 2 +system_hamiltonian_pauli 1/2,3/10,0/1,2/5 +interaction NONE +constraint SUM_HC_HS +physical_state NULLSPACE_PROJECTION +reference_clock_label t0 +reference_system_state (1/1;0/1),(1/1;0/1) +clock_povm COVARIANT_DISCRETE +povm_tau_turns 1/4 +povm_weight 1/1 +clock_label_count 4 +clock_label 0 t0 +clock_label 1 t1 +clock_label 2 t2 +clock_label 3 t3 +observables PAULI_X,PAULI_Y,PAULI_Z +end semantic +begin acceptance +control_kind POSITIVE +expected_outcome PASS +expected_failure_codes none +min_bound_kind ESTIMATED +tol_constraint_residual 1@12 +tol_povm_residual 1@12 +tol_probability 1@12 +tol_zero_probability 1@9 +tol_schrodinger 1@12 +end acceptance +case_id 34c108a37a14c02fce48c527f13383545e69d2eee58b20b9fb7e3101d9dc786e +acceptance_id a13fb02dd674b8042ef8c0a197f03d58768709f782ba59cd26545eef6d41a228 +end diff --git a/research/atemporal/at0/oracle/fixtures/p2-h0-shift.values b/research/atemporal/at0/oracle/fixtures/p2-h0-shift.values new file mode 100644 index 000000000..c43ea56b3 --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/p2-h0-shift.values @@ -0,0 +1,78 @@ +begin values +physical_state_kernel_dim 2 +constraint_residual f64:3c66a09e667f3bcd 1421087@20 +povm_residual f64:3cb38a7bb4164dcb 1421087@20 +label 0 t0 DEFINED +label 1 t1 DEFINED +label 2 t2 DEFINED +label 3 t3 DEFINED +clock_probability 0 f64:3fd0000000000000 1421087@20 +clock_probability 1 f64:3fd0000000000000 1421087@20 +clock_probability 2 f64:3fcfffffffffffff 1421087@20 +clock_probability 3 f64:3fd0000000000000 1421087@20 +pauli 0 X PLUS f64:3ff0000000000000 1421087@20 +pauli 0 X MINUS f64:0000000000000000 1421087@20 +pauli 0 Y PLUS f64:3fe0000000000000 1421087@20 +pauli 0 Y MINUS f64:3fe0000000000000 1421087@20 +pauli 0 Z PLUS f64:3fe0000000000000 1421087@20 +pauli 0 Z MINUS f64:3fe0000000000000 1421087@20 +pauli 1 X PLUS f64:3fe5c28f5c28f5c2 1421087@20 +pauli 1 X MINUS f64:3fd47ae147ae147c 1421087@20 +pauli 1 Y PLUS f64:3fecccccccccccce 1421087@20 +pauli 1 Y MINUS f64:3fb9999999999998 1421087@20 +pauli 1 Z PLUS f64:3fe7ae147ae147ae 1421087@20 +pauli 1 Z MINUS f64:3fd0a3d70a3d70a4 1421087@20 +pauli 2 X PLUS f64:3fd70a3d70a3d709 1421087@20 +pauli 2 X MINUS f64:3fe47ae147ae147c 1421087@20 +pauli 2 Y PLUS f64:3fe0000000000001 1421087@20 +pauli 2 Y MINUS f64:3fe0000000000000 1421087@20 +pauli 2 Z PLUS f64:3fef5c28f5c28f5d 1421087@20 +pauli 2 Z MINUS f64:3f947ae147ae1483 1421087@20 +pauli 3 X PLUS f64:3fe5c28f5c28f5c2 1421087@20 +pauli 3 X MINUS f64:3fd47ae147ae147c 1421087@20 +pauli 3 Y PLUS f64:3fb9999999999998 1421087@20 +pauli 3 Y MINUS f64:3fecccccccccccce 1421087@20 +pauli 3 Z PLUS f64:3fe7ae147ae147ae 1421087@20 +pauli 3 Z MINUS f64:3fd0a3d70a3d70a4 1421087@20 +reference 0 X PLUS f64:3feffffffffffffe 1421087@20 +reference 0 X MINUS f64:0000000000000000 1421087@20 +reference 0 Y PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 Y MINUS f64:3fdffffffffffffe 1421087@20 +reference 0 Z PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 Z MINUS f64:3fdffffffffffffe 1421087@20 +reference 1 X PLUS f64:3fe5c28f5c28f5c1 3653323@20 +reference 1 X MINUS f64:3fd47ae147ae147a 3653323@20 +reference 1 Y PLUS f64:3feccccccccccccb 3653323@20 +reference 1 Y MINUS f64:3fb9999999999996 3653323@20 +reference 1 Z PLUS f64:3fe7ae147ae147ab 3653323@20 +reference 1 Z MINUS f64:3fd0a3d70a3d70a4 3653323@20 +reference 2 X PLUS f64:3fd70a3d70a3d708 5885559@20 +reference 2 X MINUS f64:3fe47ae147ae147b 5885559@20 +reference 2 Y PLUS f64:3fdfffffffffffff 5885559@20 +reference 2 Y MINUS f64:3fdfffffffffffff 5885559@20 +reference 2 Z PLUS f64:3fef5c28f5c28f5b 5885559@20 +reference 2 Z MINUS f64:3f947ae147ae147f 5885559@20 +reference 3 X PLUS f64:3fe5c28f5c28f5c0 8117794@20 +reference 3 X MINUS f64:3fd47ae147ae147b 8117794@20 +reference 3 Y PLUS f64:3fb9999999999996 8117794@20 +reference 3 Y MINUS f64:3fecccccccccccca 8117794@20 +reference 3 Z PLUS f64:3fe7ae147ae147ac 8117794@20 +reference 3 Z MINUS f64:3fd0a3d70a3d70a2 8117794@20 +end values +begin verdict +check bound_kind_sufficient PASS +check values_finite PASS +check physical_state_nontrivial PASS +check constraint_residual PASS +check povm_normalization PASS +check clock_probability_sum PASS +check probability_range PASS +check pauli_pair_sum PASS +check conditional_defined PASS +check schrodinger_agreement PASS +outcome PASS +failure_codes none +error_code none +expectation_met YES +end verdict +verdict_id 5e2d2fbe4a8c13fec7eb0f3a7db2bca94b0ecc2227817bc0c1858a219189c034 diff --git a/research/atemporal/at0/oracle/fixtures/p2-tilted-3-10-2-5.case b/research/atemporal/at0/oracle/fixtures/p2-tilted-3-10-2-5.case new file mode 100644 index 000000000..cac7bea7b --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/p2-tilted-3-10-2-5.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name p2-tilted-3-10-2-5 +begin semantic +model_family PAGE_WOOTTERS_FINITE_IDEAL +energy_unit DIMENSIONLESS_HBAR_1 +clock_dim 4 +clock_energies -3/2,-1/2,1/2,3/2 +system_dim 2 +system_hamiltonian_pauli 0/1,3/10,0/1,2/5 +interaction NONE +constraint SUM_HC_HS +physical_state NULLSPACE_PROJECTION +reference_clock_label t0 +reference_system_state (1/1;0/1),(1/1;0/1) +clock_povm COVARIANT_DISCRETE +povm_tau_turns 1/4 +povm_weight 1/1 +clock_label_count 4 +clock_label 0 t0 +clock_label 1 t1 +clock_label 2 t2 +clock_label 3 t3 +observables PAULI_X,PAULI_Y,PAULI_Z +end semantic +begin acceptance +control_kind POSITIVE +expected_outcome PASS +expected_failure_codes none +min_bound_kind ESTIMATED +tol_constraint_residual 1@12 +tol_povm_residual 1@12 +tol_probability 1@12 +tol_zero_probability 1@9 +tol_schrodinger 1@12 +end acceptance +case_id 0a30f8cb2fcbfd69ab58f1d6c1ca8b528f0046417cef3bacc200306eb5e9c5b3 +acceptance_id a13fb02dd674b8042ef8c0a197f03d58768709f782ba59cd26545eef6d41a228 +end diff --git a/research/atemporal/at0/oracle/fixtures/p2-tilted-3-10-2-5.values b/research/atemporal/at0/oracle/fixtures/p2-tilted-3-10-2-5.values new file mode 100644 index 000000000..959466d9e --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/p2-tilted-3-10-2-5.values @@ -0,0 +1,78 @@ +begin values +physical_state_kernel_dim 2 +constraint_residual f64:3c66a09e667f3bcd 1421087@20 +povm_residual f64:3cb2a8eb3f35f924 1421087@20 +label 0 t0 DEFINED +label 1 t1 DEFINED +label 2 t2 DEFINED +label 3 t3 DEFINED +clock_probability 0 f64:3fd0000000000000 1421087@20 +clock_probability 1 f64:3fcfffffffffffff 1421087@20 +clock_probability 2 f64:3fcfffffffffffff 1421087@20 +clock_probability 3 f64:3fd0000000000000 1421087@20 +pauli 0 X PLUS f64:3ff0000000000000 1421087@20 +pauli 0 X MINUS f64:0000000000000000 1421087@20 +pauli 0 Y PLUS f64:3fe0000000000000 1421087@20 +pauli 0 Y MINUS f64:3fe0000000000000 1421087@20 +pauli 0 Z PLUS f64:3fe0000000000000 1421087@20 +pauli 0 Z MINUS f64:3fe0000000000000 1421087@20 +pauli 1 X PLUS f64:3fe5c28f5c28f5c3 1421087@20 +pauli 1 X MINUS f64:3fd47ae147ae147b 1421087@20 +pauli 1 Y PLUS f64:3feccccccccccccf 1421087@20 +pauli 1 Y MINUS f64:3fb999999999998e 1421087@20 +pauli 1 Z PLUS f64:3fe7ae147ae147ad 1421087@20 +pauli 1 Z MINUS f64:3fd0a3d70a3d70a7 1421087@20 +pauli 2 X PLUS f64:3fd70a3d70a3d709 1421087@20 +pauli 2 X MINUS f64:3fe47ae147ae147c 1421087@20 +pauli 2 Y PLUS f64:3fe0000000000001 1421087@20 +pauli 2 Y MINUS f64:3fe0000000000000 1421087@20 +pauli 2 Z PLUS f64:3fef5c28f5c28f5d 1421087@20 +pauli 2 Z MINUS f64:3f947ae147ae1483 1421087@20 +pauli 3 X PLUS f64:3fe5c28f5c28f5c2 1421087@20 +pauli 3 X MINUS f64:3fd47ae147ae147c 1421087@20 +pauli 3 Y PLUS f64:3fb9999999999996 1421087@20 +pauli 3 Y MINUS f64:3feccccccccccccd 1421087@20 +pauli 3 Z PLUS f64:3fe7ae147ae147ae 1421087@20 +pauli 3 Z MINUS f64:3fd0a3d70a3d70a3 1421087@20 +reference 0 X PLUS f64:3feffffffffffffe 1421087@20 +reference 0 X MINUS f64:0000000000000000 1421087@20 +reference 0 Y PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 Y MINUS f64:3fdffffffffffffe 1421087@20 +reference 0 Z PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 Z MINUS f64:3fdffffffffffffe 1421087@20 +reference 1 X PLUS f64:3fe5c28f5c28f5c2 2537205@20 +reference 1 X MINUS f64:3fd47ae147ae1478 2537205@20 +reference 1 Y PLUS f64:3fecccccccccccca 2537205@20 +reference 1 Y MINUS f64:3fb9999999999996 2537205@20 +reference 1 Z PLUS f64:3fe7ae147ae147ac 2537205@20 +reference 1 Z MINUS f64:3fd0a3d70a3d70a4 2537205@20 +reference 2 X PLUS f64:3fd70a3d70a3d708 3653323@20 +reference 2 X MINUS f64:3fe47ae147ae147b 3653323@20 +reference 2 Y PLUS f64:3fdfffffffffffff 3653323@20 +reference 2 Y MINUS f64:3fdfffffffffffff 3653323@20 +reference 2 Z PLUS f64:3fef5c28f5c28f5b 3653323@20 +reference 2 Z MINUS f64:3f947ae147ae147f 3653323@20 +reference 3 X PLUS f64:3fe5c28f5c28f5c0 4769441@20 +reference 3 X MINUS f64:3fd47ae147ae147c 4769441@20 +reference 3 Y PLUS f64:3fb9999999999997 4769441@20 +reference 3 Y MINUS f64:3fecccccccccccca 4769441@20 +reference 3 Z PLUS f64:3fe7ae147ae147ac 4769441@20 +reference 3 Z MINUS f64:3fd0a3d70a3d70a2 4769441@20 +end values +begin verdict +check bound_kind_sufficient PASS +check values_finite PASS +check physical_state_nontrivial PASS +check constraint_residual PASS +check povm_normalization PASS +check clock_probability_sum PASS +check probability_range PASS +check pauli_pair_sum PASS +check conditional_defined PASS +check schrodinger_agreement PASS +outcome PASS +failure_codes none +error_code none +expectation_met YES +end verdict +verdict_id 3d2d11e9a20fa950566b48a22421d2a165728c10f7e7adceb4f8ab8f3b6a4f32 diff --git a/research/atemporal/at0/oracle/fixtures/spec-n3-wrong-weight.case b/research/atemporal/at0/oracle/fixtures/spec-n3-wrong-weight.case new file mode 100644 index 000000000..cb8275db3 --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/spec-n3-wrong-weight.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name spec-n3-wrong-weight +begin semantic +model_family PAGE_WOOTTERS_FINITE_IDEAL +energy_unit DIMENSIONLESS_HBAR_1 +clock_dim 2 +clock_energies -1/1,0/1 +system_dim 2 +system_hamiltonian_pauli 1/2,0/1,0/1,-1/2 +interaction NONE +constraint SUM_HC_HS +physical_state NULLSPACE_PROJECTION +reference_clock_label t0 +reference_system_state (1/1;0/1),(1/1;0/1) +clock_povm COVARIANT_DISCRETE +povm_tau_turns 1/4 +povm_weight 1/4 +clock_label_count 4 +clock_label 0 t0 +clock_label 1 t1 +clock_label 2 t2 +clock_label 3 t3 +observables PAULI_X,PAULI_Y,PAULI_Z +end semantic +begin acceptance +control_kind NEGATIVE +expected_outcome FAIL +expected_failure_codes POVM_NORMALIZATION_EXCEEDED,PROBABILITY_SUM_EXCEEDED +min_bound_kind ESTIMATED +tol_constraint_residual 1@12 +tol_povm_residual 1@12 +tol_probability 1@12 +tol_zero_probability 1@9 +tol_schrodinger 1@12 +end acceptance +case_id 59be88c72df1b8d8a0637a3ec3f89c6209364b96004a3a07513090d9235fb8c8 +acceptance_id 65237dc22e695264cf3a1a0bd09bc80061d1c5f206fe67275391d22203cd57ae +end diff --git a/research/atemporal/at0/oracle/fixtures/spec-n3-wrong-weight.values b/research/atemporal/at0/oracle/fixtures/spec-n3-wrong-weight.values new file mode 100644 index 000000000..6f5344a27 --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/spec-n3-wrong-weight.values @@ -0,0 +1,78 @@ +begin values +physical_state_kernel_dim 2 +constraint_residual f64:0000000000000000 1065816@20 +povm_residual f64:3fe6a09e667f3bcd 1065816@20 +label 0 t0 DEFINED +label 1 t1 DEFINED +label 2 t2 DEFINED +label 3 t3 DEFINED +clock_probability 0 f64:3fbffffffffffffe 1065816@20 +clock_probability 1 f64:3fbffffffffffffe 1065816@20 +clock_probability 2 f64:3fbffffffffffffe 1065816@20 +clock_probability 3 f64:3fbffffffffffffe 1065816@20 +pauli 0 X PLUS f64:3ff0000000000000 1065816@20 +pauli 0 X MINUS f64:0000000000000000 1065816@20 +pauli 0 Y PLUS f64:3fe0000000000000 1065816@20 +pauli 0 Y MINUS f64:3fe0000000000000 1065816@20 +pauli 0 Z PLUS f64:3fe0000000000000 1065816@20 +pauli 0 Z MINUS f64:3fe0000000000000 1065816@20 +pauli 1 X PLUS f64:3fe0000000000000 1065816@20 +pauli 1 X MINUS f64:3fdfffffffffffff 1065816@20 +pauli 1 Y PLUS f64:0000000000000000 1065816@20 +pauli 1 Y MINUS f64:3ff0000000000000 1065816@20 +pauli 1 Z PLUS f64:3fe0000000000000 1065816@20 +pauli 1 Z MINUS f64:3fe0000000000000 1065816@20 +pauli 2 X PLUS f64:0000000000000000 1065816@20 +pauli 2 X MINUS f64:3ff0000000000000 1065816@20 +pauli 2 Y PLUS f64:3fdfffffffffffff 1065816@20 +pauli 2 Y MINUS f64:3fe0000000000001 1065816@20 +pauli 2 Z PLUS f64:3fe0000000000000 1065816@20 +pauli 2 Z MINUS f64:3fe0000000000000 1065816@20 +pauli 3 X PLUS f64:3fdffffffffffffe 1065816@20 +pauli 3 X MINUS f64:3fe0000000000001 1065816@20 +pauli 3 Y PLUS f64:3ff0000000000000 1065816@20 +pauli 3 Y MINUS f64:0000000000000000 1065816@20 +pauli 3 Z PLUS f64:3fe0000000000000 1065816@20 +pauli 3 Z MINUS f64:3fe0000000000000 1065816@20 +reference 0 X PLUS f64:3feffffffffffffe 1421087@20 +reference 0 X MINUS f64:0000000000000000 1421087@20 +reference 0 Y PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 Y MINUS f64:3fdffffffffffffe 1421087@20 +reference 0 Z PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 Z MINUS f64:3fdffffffffffffe 1421087@20 +reference 1 X PLUS f64:3fe0000000000000 3653323@20 +reference 1 X MINUS f64:3fdffffffffffffd 3653323@20 +reference 1 Y PLUS f64:3940000000000000 3653323@20 +reference 1 Y MINUS f64:3feffffffffffffe 3653323@20 +reference 1 Z PLUS f64:3fdffffffffffffe 3653323@20 +reference 1 Z MINUS f64:3fdffffffffffffe 3653323@20 +reference 2 X PLUS f64:393377ce858a5d46 5885559@20 +reference 2 X MINUS f64:3feffffffffffffe 5885559@20 +reference 2 Y PLUS f64:3fdffffffffffffd 5885559@20 +reference 2 Y MINUS f64:3fe0000000000000 5885559@20 +reference 2 Z PLUS f64:3fdffffffffffffe 5885559@20 +reference 2 Z MINUS f64:3fdffffffffffffe 5885559@20 +reference 3 X PLUS f64:3fdffffffffffffd 8117794@20 +reference 3 X MINUS f64:3fe0000000000000 8117794@20 +reference 3 Y PLUS f64:3feffffffffffffe 8117794@20 +reference 3 Y MINUS f64:3940000000000000 8117794@20 +reference 3 Z PLUS f64:3fdffffffffffffe 8117794@20 +reference 3 Z MINUS f64:3fdffffffffffffe 8117794@20 +end values +begin verdict +check bound_kind_sufficient PASS +check values_finite PASS +check physical_state_nontrivial PASS +check constraint_residual PASS +check povm_normalization FAIL +check clock_probability_sum FAIL +check probability_range PASS +check pauli_pair_sum PASS +check conditional_defined PASS +check schrodinger_agreement PASS +outcome FAIL +failure_codes POVM_NORMALIZATION_EXCEEDED,PROBABILITY_SUM_EXCEEDED +error_code none +expectation_met YES +end verdict +verdict_id 1cfcb09a64ad6aa1042d2c67ebfdcf3f77c4ef77d6c1a3616516e4bc4b0fd150 diff --git a/research/atemporal/at0/oracle/fixtures/spec-n4-dropped-effect.case b/research/atemporal/at0/oracle/fixtures/spec-n4-dropped-effect.case new file mode 100644 index 000000000..ba0b63ef1 --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/spec-n4-dropped-effect.case @@ -0,0 +1,39 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name spec-n4-dropped-effect +begin semantic +model_family PAGE_WOOTTERS_FINITE_IDEAL +energy_unit DIMENSIONLESS_HBAR_1 +clock_dim 2 +clock_energies -1/1,0/1 +system_dim 2 +system_hamiltonian_pauli 1/2,0/1,0/1,-1/2 +interaction NONE +constraint SUM_HC_HS +physical_state NULLSPACE_PROJECTION +reference_clock_label t0 +reference_system_state (1/1;0/1),(1/1;0/1) +clock_povm COVARIANT_DISCRETE +povm_tau_turns 1/4 +povm_weight 1/2 +clock_label_count 3 +clock_label 0 t0 +clock_label 1 t1 +clock_label 2 t2 +observables PAULI_X,PAULI_Y,PAULI_Z +end semantic +begin acceptance +control_kind NEGATIVE +expected_outcome FAIL +expected_failure_codes POVM_NORMALIZATION_EXCEEDED,PROBABILITY_SUM_EXCEEDED +min_bound_kind ESTIMATED +tol_constraint_residual 1@12 +tol_povm_residual 1@12 +tol_probability 1@12 +tol_zero_probability 1@9 +tol_schrodinger 1@12 +end acceptance +case_id e7fa3493d1e76d0ace84086bb5aeaedf9df4e288feb7ed2d5dfe299786f5df02 +acceptance_id 65237dc22e695264cf3a1a0bd09bc80061d1c5f206fe67275391d22203cd57ae +end diff --git a/research/atemporal/at0/oracle/fixtures/spec-n4-dropped-effect.values b/research/atemporal/at0/oracle/fixtures/spec-n4-dropped-effect.values new file mode 100644 index 000000000..092ef25ed --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/spec-n4-dropped-effect.values @@ -0,0 +1,64 @@ +begin values +physical_state_kernel_dim 2 +constraint_residual f64:0000000000000000 88818@19 +povm_residual f64:3fe0000000000000 88818@19 +label 0 t0 DEFINED +label 1 t1 DEFINED +label 2 t2 DEFINED +clock_probability 0 f64:3fcffffffffffffe 88818@19 +clock_probability 1 f64:3fcffffffffffffe 88818@19 +clock_probability 2 f64:3fcffffffffffffe 88818@19 +pauli 0 X PLUS f64:3ff0000000000000 88818@19 +pauli 0 X MINUS f64:0000000000000000 88818@19 +pauli 0 Y PLUS f64:3fe0000000000000 88818@19 +pauli 0 Y MINUS f64:3fe0000000000000 88818@19 +pauli 0 Z PLUS f64:3fe0000000000000 88818@19 +pauli 0 Z MINUS f64:3fe0000000000000 88818@19 +pauli 1 X PLUS f64:3fe0000000000000 88818@19 +pauli 1 X MINUS f64:3fdfffffffffffff 88818@19 +pauli 1 Y PLUS f64:0000000000000000 88818@19 +pauli 1 Y MINUS f64:3ff0000000000000 88818@19 +pauli 1 Z PLUS f64:3fe0000000000000 88818@19 +pauli 1 Z MINUS f64:3fe0000000000000 88818@19 +pauli 2 X PLUS f64:0000000000000000 88818@19 +pauli 2 X MINUS f64:3ff0000000000000 88818@19 +pauli 2 Y PLUS f64:3fdfffffffffffff 88818@19 +pauli 2 Y MINUS f64:3fe0000000000001 88818@19 +pauli 2 Z PLUS f64:3fe0000000000000 88818@19 +pauli 2 Z MINUS f64:3fe0000000000000 88818@19 +reference 0 X PLUS f64:3feffffffffffffe 1421087@20 +reference 0 X MINUS f64:0000000000000000 1421087@20 +reference 0 Y PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 Y MINUS f64:3fdffffffffffffe 1421087@20 +reference 0 Z PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 Z MINUS f64:3fdffffffffffffe 1421087@20 +reference 1 X PLUS f64:3fe0000000000000 3653323@20 +reference 1 X MINUS f64:3fdffffffffffffd 3653323@20 +reference 1 Y PLUS f64:3940000000000000 3653323@20 +reference 1 Y MINUS f64:3feffffffffffffe 3653323@20 +reference 1 Z PLUS f64:3fdffffffffffffe 3653323@20 +reference 1 Z MINUS f64:3fdffffffffffffe 3653323@20 +reference 2 X PLUS f64:393377ce858a5d46 5885559@20 +reference 2 X MINUS f64:3feffffffffffffe 5885559@20 +reference 2 Y PLUS f64:3fdffffffffffffd 5885559@20 +reference 2 Y MINUS f64:3fe0000000000000 5885559@20 +reference 2 Z PLUS f64:3fdffffffffffffe 5885559@20 +reference 2 Z MINUS f64:3fdffffffffffffe 5885559@20 +end values +begin verdict +check bound_kind_sufficient PASS +check values_finite PASS +check physical_state_nontrivial PASS +check constraint_residual PASS +check povm_normalization FAIL +check clock_probability_sum FAIL +check probability_range PASS +check pauli_pair_sum PASS +check conditional_defined PASS +check schrodinger_agreement PASS +outcome FAIL +failure_codes POVM_NORMALIZATION_EXCEEDED,PROBABILITY_SUM_EXCEEDED +error_code none +expectation_met YES +end verdict +verdict_id 88e01e412c8b6e750dc91e6fec54eacd4ddfae337a286fbddcc1748a2623de10 diff --git a/research/atemporal/at0/oracle/fixtures/spec-ref-model-n4.case b/research/atemporal/at0/oracle/fixtures/spec-ref-model-n4.case new file mode 100644 index 000000000..f8e8b1b63 --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/spec-ref-model-n4.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name spec-ref-model-n4 +begin semantic +model_family PAGE_WOOTTERS_FINITE_IDEAL +energy_unit DIMENSIONLESS_HBAR_1 +clock_dim 2 +clock_energies -1/1,0/1 +system_dim 2 +system_hamiltonian_pauli 1/2,0/1,0/1,-1/2 +interaction NONE +constraint SUM_HC_HS +physical_state NULLSPACE_PROJECTION +reference_clock_label t0 +reference_system_state (1/1;0/1),(1/1;0/1) +clock_povm COVARIANT_DISCRETE +povm_tau_turns 1/4 +povm_weight 1/2 +clock_label_count 4 +clock_label 0 t0 +clock_label 1 t1 +clock_label 2 t2 +clock_label 3 t3 +observables PAULI_X,PAULI_Y,PAULI_Z +end semantic +begin acceptance +control_kind POSITIVE +expected_outcome PASS +expected_failure_codes none +min_bound_kind ESTIMATED +tol_constraint_residual 1@12 +tol_povm_residual 1@12 +tol_probability 1@12 +tol_zero_probability 1@9 +tol_schrodinger 1@12 +end acceptance +case_id ff66342f402dfc26aa267b589e8709a7f9f7c08381f5910093c899c048ac90a7 +acceptance_id a13fb02dd674b8042ef8c0a197f03d58768709f782ba59cd26545eef6d41a228 +end diff --git a/research/atemporal/at0/oracle/fixtures/spec-ref-model-n4.values b/research/atemporal/at0/oracle/fixtures/spec-ref-model-n4.values new file mode 100644 index 000000000..9381829be --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/spec-ref-model-n4.values @@ -0,0 +1,78 @@ +begin values +physical_state_kernel_dim 2 +constraint_residual f64:0000000000000000 1065816@20 +povm_residual f64:3ca79dad2e0f9c1b 1065816@20 +label 0 t0 DEFINED +label 1 t1 DEFINED +label 2 t2 DEFINED +label 3 t3 DEFINED +clock_probability 0 f64:3fcffffffffffffe 1065816@20 +clock_probability 1 f64:3fcffffffffffffe 1065816@20 +clock_probability 2 f64:3fcffffffffffffe 1065816@20 +clock_probability 3 f64:3fcffffffffffffe 1065816@20 +pauli 0 X PLUS f64:3ff0000000000000 1065816@20 +pauli 0 X MINUS f64:0000000000000000 1065816@20 +pauli 0 Y PLUS f64:3fe0000000000000 1065816@20 +pauli 0 Y MINUS f64:3fe0000000000000 1065816@20 +pauli 0 Z PLUS f64:3fe0000000000000 1065816@20 +pauli 0 Z MINUS f64:3fe0000000000000 1065816@20 +pauli 1 X PLUS f64:3fe0000000000000 1065816@20 +pauli 1 X MINUS f64:3fdfffffffffffff 1065816@20 +pauli 1 Y PLUS f64:0000000000000000 1065816@20 +pauli 1 Y MINUS f64:3ff0000000000000 1065816@20 +pauli 1 Z PLUS f64:3fe0000000000000 1065816@20 +pauli 1 Z MINUS f64:3fe0000000000000 1065816@20 +pauli 2 X PLUS f64:0000000000000000 1065816@20 +pauli 2 X MINUS f64:3ff0000000000000 1065816@20 +pauli 2 Y PLUS f64:3fdfffffffffffff 1065816@20 +pauli 2 Y MINUS f64:3fe0000000000001 1065816@20 +pauli 2 Z PLUS f64:3fe0000000000000 1065816@20 +pauli 2 Z MINUS f64:3fe0000000000000 1065816@20 +pauli 3 X PLUS f64:3fdffffffffffffe 1065816@20 +pauli 3 X MINUS f64:3fe0000000000001 1065816@20 +pauli 3 Y PLUS f64:3ff0000000000000 1065816@20 +pauli 3 Y MINUS f64:0000000000000000 1065816@20 +pauli 3 Z PLUS f64:3fe0000000000000 1065816@20 +pauli 3 Z MINUS f64:3fe0000000000000 1065816@20 +reference 0 X PLUS f64:3feffffffffffffe 1421087@20 +reference 0 X MINUS f64:0000000000000000 1421087@20 +reference 0 Y PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 Y MINUS f64:3fdffffffffffffe 1421087@20 +reference 0 Z PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 Z MINUS f64:3fdffffffffffffe 1421087@20 +reference 1 X PLUS f64:3fe0000000000000 3653323@20 +reference 1 X MINUS f64:3fdffffffffffffd 3653323@20 +reference 1 Y PLUS f64:3940000000000000 3653323@20 +reference 1 Y MINUS f64:3feffffffffffffe 3653323@20 +reference 1 Z PLUS f64:3fdffffffffffffe 3653323@20 +reference 1 Z MINUS f64:3fdffffffffffffe 3653323@20 +reference 2 X PLUS f64:393377ce858a5d46 5885559@20 +reference 2 X MINUS f64:3feffffffffffffe 5885559@20 +reference 2 Y PLUS f64:3fdffffffffffffd 5885559@20 +reference 2 Y MINUS f64:3fe0000000000000 5885559@20 +reference 2 Z PLUS f64:3fdffffffffffffe 5885559@20 +reference 2 Z MINUS f64:3fdffffffffffffe 5885559@20 +reference 3 X PLUS f64:3fdffffffffffffd 8117794@20 +reference 3 X MINUS f64:3fe0000000000000 8117794@20 +reference 3 Y PLUS f64:3feffffffffffffe 8117794@20 +reference 3 Y MINUS f64:3940000000000000 8117794@20 +reference 3 Z PLUS f64:3fdffffffffffffe 8117794@20 +reference 3 Z MINUS f64:3fdffffffffffffe 8117794@20 +end values +begin verdict +check bound_kind_sufficient PASS +check values_finite PASS +check physical_state_nontrivial PASS +check constraint_residual PASS +check povm_normalization PASS +check clock_probability_sum PASS +check probability_range PASS +check pauli_pair_sum PASS +check conditional_defined PASS +check schrodinger_agreement PASS +outcome PASS +failure_codes none +error_code none +expectation_met YES +end verdict +verdict_id 0472c9c93ccb61e4375e3ce3b5aa2bdbd48f2165adf74e9d19042f0c4bd91514 diff --git a/research/atemporal/at0/oracle/fixtures/spec-t4-eigenstate-00.case b/research/atemporal/at0/oracle/fixtures/spec-t4-eigenstate-00.case new file mode 100644 index 000000000..56b947dbb --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/spec-t4-eigenstate-00.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name spec-t4-eigenstate-00 +begin semantic +model_family PAGE_WOOTTERS_FINITE_IDEAL +energy_unit DIMENSIONLESS_HBAR_1 +clock_dim 2 +clock_energies -1/1,0/1 +system_dim 2 +system_hamiltonian_pauli 1/2,0/1,0/1,-1/2 +interaction NONE +constraint SUM_HC_HS +physical_state NULLSPACE_PROJECTION +reference_clock_label t0 +reference_system_state (1/1;0/1),(0/1;0/1) +clock_povm COVARIANT_DISCRETE +povm_tau_turns 1/4 +povm_weight 1/2 +clock_label_count 4 +clock_label 0 t0 +clock_label 1 t1 +clock_label 2 t2 +clock_label 3 t3 +observables PAULI_X,PAULI_Y,PAULI_Z +end semantic +begin acceptance +control_kind POSITIVE +expected_outcome PASS +expected_failure_codes none +min_bound_kind ESTIMATED +tol_constraint_residual 1@12 +tol_povm_residual 1@12 +tol_probability 1@12 +tol_zero_probability 1@9 +tol_schrodinger 1@12 +end acceptance +case_id 594aaecbfc669a0c2cf3037bcf5f1b2581272d10f793b1a086f5b389015f890c +acceptance_id a13fb02dd674b8042ef8c0a197f03d58768709f782ba59cd26545eef6d41a228 +end diff --git a/research/atemporal/at0/oracle/fixtures/spec-t4-eigenstate-00.values b/research/atemporal/at0/oracle/fixtures/spec-t4-eigenstate-00.values new file mode 100644 index 000000000..6df88e9f7 --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/spec-t4-eigenstate-00.values @@ -0,0 +1,78 @@ +begin values +physical_state_kernel_dim 2 +constraint_residual f64:0000000000000000 1065816@20 +povm_residual f64:3ca79dad2e0f9c1b 1065816@20 +label 0 t0 DEFINED +label 1 t1 DEFINED +label 2 t2 DEFINED +label 3 t3 DEFINED +clock_probability 0 f64:3fcffffffffffffe 1065816@20 +clock_probability 1 f64:3fcffffffffffffe 1065816@20 +clock_probability 2 f64:3fcffffffffffffe 1065816@20 +clock_probability 3 f64:3fcffffffffffffe 1065816@20 +pauli 0 X PLUS f64:3fe0000000000000 1065816@20 +pauli 0 X MINUS f64:3fe0000000000000 1065816@20 +pauli 0 Y PLUS f64:3fe0000000000000 1065816@20 +pauli 0 Y MINUS f64:3fe0000000000000 1065816@20 +pauli 0 Z PLUS f64:3ff0000000000000 1065816@20 +pauli 0 Z MINUS f64:0000000000000000 1065816@20 +pauli 1 X PLUS f64:3fe0000000000000 1065816@20 +pauli 1 X MINUS f64:3fe0000000000000 1065816@20 +pauli 1 Y PLUS f64:3fe0000000000000 1065816@20 +pauli 1 Y MINUS f64:3fe0000000000000 1065816@20 +pauli 1 Z PLUS f64:3ff0000000000000 1065816@20 +pauli 1 Z MINUS f64:0000000000000000 1065816@20 +pauli 2 X PLUS f64:3fe0000000000000 1065816@20 +pauli 2 X MINUS f64:3fe0000000000000 1065816@20 +pauli 2 Y PLUS f64:3fe0000000000000 1065816@20 +pauli 2 Y MINUS f64:3fe0000000000000 1065816@20 +pauli 2 Z PLUS f64:3ff0000000000000 1065816@20 +pauli 2 Z MINUS f64:0000000000000000 1065816@20 +pauli 3 X PLUS f64:3fe0000000000000 1065816@20 +pauli 3 X MINUS f64:3fe0000000000000 1065816@20 +pauli 3 Y PLUS f64:3fe0000000000000 1065816@20 +pauli 3 Y MINUS f64:3fe0000000000000 1065816@20 +pauli 3 Z PLUS f64:3ff0000000000000 1065816@20 +pauli 3 Z MINUS f64:0000000000000000 1065816@20 +reference 0 X PLUS f64:3fe0000000000000 1421087@20 +reference 0 X MINUS f64:3fe0000000000000 1421087@20 +reference 0 Y PLUS f64:3fe0000000000000 1421087@20 +reference 0 Y MINUS f64:3fe0000000000000 1421087@20 +reference 0 Z PLUS f64:3ff0000000000000 1421087@20 +reference 0 Z MINUS f64:0000000000000000 1421087@20 +reference 1 X PLUS f64:3fe0000000000000 3653323@20 +reference 1 X MINUS f64:3fe0000000000000 3653323@20 +reference 1 Y PLUS f64:3fe0000000000000 3653323@20 +reference 1 Y MINUS f64:3fe0000000000000 3653323@20 +reference 1 Z PLUS f64:3ff0000000000000 3653323@20 +reference 1 Z MINUS f64:0000000000000000 3653323@20 +reference 2 X PLUS f64:3fe0000000000000 5885559@20 +reference 2 X MINUS f64:3fe0000000000000 5885559@20 +reference 2 Y PLUS f64:3fe0000000000000 5885559@20 +reference 2 Y MINUS f64:3fe0000000000000 5885559@20 +reference 2 Z PLUS f64:3ff0000000000000 5885559@20 +reference 2 Z MINUS f64:0000000000000000 5885559@20 +reference 3 X PLUS f64:3fe0000000000000 8117794@20 +reference 3 X MINUS f64:3fe0000000000000 8117794@20 +reference 3 Y PLUS f64:3fe0000000000000 8117794@20 +reference 3 Y MINUS f64:3fe0000000000000 8117794@20 +reference 3 Z PLUS f64:3ff0000000000000 8117794@20 +reference 3 Z MINUS f64:0000000000000000 8117794@20 +end values +begin verdict +check bound_kind_sufficient PASS +check values_finite PASS +check physical_state_nontrivial PASS +check constraint_residual PASS +check povm_normalization PASS +check clock_probability_sum PASS +check probability_range PASS +check pauli_pair_sum PASS +check conditional_defined PASS +check schrodinger_agreement PASS +outcome PASS +failure_codes none +error_code none +expectation_met YES +end verdict +verdict_id 78224941fd9084a57faa778af485532c345749b2a22396432797b03c2c4c7d10 diff --git a/research/atemporal/at0/oracle/fixtures/spec-t5-relational-phase.case b/research/atemporal/at0/oracle/fixtures/spec-t5-relational-phase.case new file mode 100644 index 000000000..b7e235f78 --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/spec-t5-relational-phase.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name spec-t5-relational-phase +begin semantic +model_family PAGE_WOOTTERS_FINITE_IDEAL +energy_unit DIMENSIONLESS_HBAR_1 +clock_dim 2 +clock_energies -1/1,0/1 +system_dim 2 +system_hamiltonian_pauli 1/2,0/1,0/1,-1/2 +interaction NONE +constraint SUM_HC_HS +physical_state NULLSPACE_PROJECTION +reference_clock_label t0 +reference_system_state (1/1;0/1),(0/1;1/1) +clock_povm COVARIANT_DISCRETE +povm_tau_turns 1/4 +povm_weight 1/2 +clock_label_count 4 +clock_label 0 t0 +clock_label 1 t1 +clock_label 2 t2 +clock_label 3 t3 +observables PAULI_X,PAULI_Y,PAULI_Z +end semantic +begin acceptance +control_kind POSITIVE +expected_outcome PASS +expected_failure_codes none +min_bound_kind ESTIMATED +tol_constraint_residual 1@12 +tol_povm_residual 1@12 +tol_probability 1@12 +tol_zero_probability 1@9 +tol_schrodinger 1@12 +end acceptance +case_id e1ea67a6f687deba2d0e849fe15fb1811cd5b6d1958e94593c6059469595e940 +acceptance_id a13fb02dd674b8042ef8c0a197f03d58768709f782ba59cd26545eef6d41a228 +end diff --git a/research/atemporal/at0/oracle/fixtures/spec-t5-relational-phase.values b/research/atemporal/at0/oracle/fixtures/spec-t5-relational-phase.values new file mode 100644 index 000000000..c20858ba0 --- /dev/null +++ b/research/atemporal/at0/oracle/fixtures/spec-t5-relational-phase.values @@ -0,0 +1,78 @@ +begin values +physical_state_kernel_dim 2 +constraint_residual f64:0000000000000000 1065816@20 +povm_residual f64:3ca79dad2e0f9c1b 1065816@20 +label 0 t0 DEFINED +label 1 t1 DEFINED +label 2 t2 DEFINED +label 3 t3 DEFINED +clock_probability 0 f64:3fcffffffffffffe 1065816@20 +clock_probability 1 f64:3fcffffffffffffe 1065816@20 +clock_probability 2 f64:3fcffffffffffffe 1065816@20 +clock_probability 3 f64:3fcffffffffffffe 1065816@20 +pauli 0 X PLUS f64:3fe0000000000000 1065816@20 +pauli 0 X MINUS f64:3fe0000000000000 1065816@20 +pauli 0 Y PLUS f64:3ff0000000000000 1065816@20 +pauli 0 Y MINUS f64:0000000000000000 1065816@20 +pauli 0 Z PLUS f64:3fe0000000000000 1065816@20 +pauli 0 Z MINUS f64:3fe0000000000000 1065816@20 +pauli 1 X PLUS f64:3ff0000000000000 1065816@20 +pauli 1 X MINUS f64:0000000000000000 1065816@20 +pauli 1 Y PLUS f64:3fe0000000000000 1065816@20 +pauli 1 Y MINUS f64:3fdfffffffffffff 1065816@20 +pauli 1 Z PLUS f64:3fe0000000000000 1065816@20 +pauli 1 Z MINUS f64:3fe0000000000000 1065816@20 +pauli 2 X PLUS f64:3fe0000000000001 1065816@20 +pauli 2 X MINUS f64:3fdfffffffffffff 1065816@20 +pauli 2 Y PLUS f64:0000000000000000 1065816@20 +pauli 2 Y MINUS f64:3ff0000000000000 1065816@20 +pauli 2 Z PLUS f64:3fe0000000000000 1065816@20 +pauli 2 Z MINUS f64:3fe0000000000000 1065816@20 +pauli 3 X PLUS f64:0000000000000000 1065816@20 +pauli 3 X MINUS f64:3ff0000000000000 1065816@20 +pauli 3 Y PLUS f64:3fdffffffffffffe 1065816@20 +pauli 3 Y MINUS f64:3fe0000000000001 1065816@20 +pauli 3 Z PLUS f64:3fe0000000000000 1065816@20 +pauli 3 Z MINUS f64:3fe0000000000000 1065816@20 +reference 0 X PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 X MINUS f64:3fdffffffffffffe 1421087@20 +reference 0 Y PLUS f64:3feffffffffffffe 1421087@20 +reference 0 Y MINUS f64:0000000000000000 1421087@20 +reference 0 Z PLUS f64:3fdffffffffffffe 1421087@20 +reference 0 Z MINUS f64:3fdffffffffffffe 1421087@20 +reference 1 X PLUS f64:3feffffffffffffe 3653323@20 +reference 1 X MINUS f64:3940000000000000 3653323@20 +reference 1 Y PLUS f64:3fe0000000000000 3653323@20 +reference 1 Y MINUS f64:3fdffffffffffffd 3653323@20 +reference 1 Z PLUS f64:3fdffffffffffffe 3653323@20 +reference 1 Z MINUS f64:3fdffffffffffffe 3653323@20 +reference 2 X PLUS f64:3fe0000000000000 5885559@20 +reference 2 X MINUS f64:3fdffffffffffffd 5885559@20 +reference 2 Y PLUS f64:393377ce858a5d46 5885559@20 +reference 2 Y MINUS f64:3feffffffffffffe 5885559@20 +reference 2 Z PLUS f64:3fdffffffffffffe 5885559@20 +reference 2 Z MINUS f64:3fdffffffffffffe 5885559@20 +reference 3 X PLUS f64:3940000000000000 8117794@20 +reference 3 X MINUS f64:3feffffffffffffe 8117794@20 +reference 3 Y PLUS f64:3fdffffffffffffd 8117794@20 +reference 3 Y MINUS f64:3fe0000000000000 8117794@20 +reference 3 Z PLUS f64:3fdffffffffffffe 8117794@20 +reference 3 Z MINUS f64:3fdffffffffffffe 8117794@20 +end values +begin verdict +check bound_kind_sufficient PASS +check values_finite PASS +check physical_state_nontrivial PASS +check constraint_residual PASS +check povm_normalization PASS +check clock_probability_sum PASS +check probability_range PASS +check pauli_pair_sum PASS +check conditional_defined PASS +check schrodinger_agreement PASS +outcome PASS +failure_codes none +error_code none +expectation_met YES +end verdict +verdict_id 407fbb62ccd7180b0abbcdb8ad59399ca29c19a61d6132bb21d68a58ae9d6384 diff --git a/research/atemporal/at0/oracle/isolation.sh b/research/atemporal/at0/oracle/isolation.sh new file mode 100755 index 000000000..d44757ee2 --- /dev/null +++ b/research/atemporal/at0/oracle/isolation.sh @@ -0,0 +1,37 @@ +#!/bin/sh +# Isolation gate for the Rust oracle, adapted from tests/physics0/isolation.sh (C, nm on objects). +# 1. Source rule: the compute crate src/at0/ names no std::time, std::fs, std::process, +# std::thread, std::net, std::env, random or clock facility. +# 2. Object rule: the compute crate compiled alone (rlib) has no undefined reference to a +# clock, file, process, socket, thread or random symbol (nm -u over its objects). +# Exit 0 PASS, 1 FAIL. Prints every offending line. +set -u +cd "$(dirname "$0")" +fail=0 +echo "== source rule (src/at0/)" +if grep -n -E 'std::(time|fs|process|thread|net|env|io::std(in|out|err))|SystemTime|Instant::|getrandom|rand::|libc::|extern "C"' src/at0/*.rs; then + echo "FAIL: forbidden facility named in compute code"; fail=1 +else + echo "ok: no clock, file, process, thread, network, environment or random facility named" +fi +echo "== object rule (nm -u on the compute rlib)" +./build.sh lib >/dev/null || { echo "FAIL: compute crate did not build alone"; exit 1; } +rm -rf target/iso && mkdir -p target/iso && (cd target/iso && ar x ../libat0.rlib) || { echo "FAIL: cannot unpack rlib"; exit 1; } +objs=$(ls target/iso/*.o 2>/dev/null) +[ -n "$objs" ] || { echo "FAIL: no objects in rlib"; exit 1; } +banned='clock_gettime|gettimeofday|^time$|nanosleep|getrandom|/dev/urandom|pthread_create|socket|connect|fopen|open64|openat|read64|write64|fork|execve|system|getenv' +if nm -u $objs 2>/dev/null | awk '{print $NF}' | sort -u | grep -E "$banned"; then + echo "FAIL: banned undefined symbol in compute objects"; fail=1 +else + echo "ok: no clock, random, thread, socket, file, process or environment symbol referenced" +fi +echo "== negative control: a copy that reads the clock must be caught" +rm -rf target/mutant && mkdir -p target/mutant && cp -r src/at0 target/mutant/at0 +printf '\npub fn hidden_clock() -> u64 { std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map(|d| d.as_secs()).unwrap_or(0) }\n' >> target/mutant/at0/mod.rs +if grep -q -E 'std::(time|fs|process|thread|net|env)' target/mutant/at0/*.rs; then + echo "ok: mutant caught by the source rule" +else + echo "FAIL: mutant not caught"; fail=1 +fi +[ $fail -eq 0 ] && echo "ISOLATION PASS" || echo "ISOLATION FAIL" +exit $fail diff --git a/research/atemporal/at0/oracle/rust-toolchain.toml b/research/atemporal/at0/oracle/rust-toolchain.toml new file mode 100644 index 000000000..f71b0da05 --- /dev/null +++ b/research/atemporal/at0/oracle/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "1.98.1" +profile = "minimal" diff --git a/research/atemporal/at0/oracle/src/at0/case.rs b/research/atemporal/at0/oracle/src/at0/case.rs new file mode 100644 index 000000000..62dbd34d2 --- /dev/null +++ b/research/atemporal/at0/oracle/src/at0/case.rs @@ -0,0 +1,488 @@ +//! AT0_CASE_V1 codec: byte rules, canonical encodings, exact validity rules +//! in the contract's order (section 4), identities (section 5), kernel pairs. +//! Contract: aien-architecture docs/plans/atemporal/AT0_CASE_V1.md at 044c9d1. + +use super::rational::Rat; +use super::sha256::{sha256_hex, tagged_hex}; + +pub const CONTRACT_COMMIT: &str = "044c9d11256d8642f80eedd42cbae8763faf63f5"; +pub const CASE_DOMAIN: &str = "omega.at0.case.v1"; +pub const ACCEPTANCE_DOMAIN: &str = "omega.at0.acceptance.v1"; +pub const RATIONAL_LIMIT: i128 = 1_048_576; +pub const FAILURE_CODES: [&str; 10] = [ + "BOUND_KIND_INSUFFICIENT", + "CONDITIONAL_UNDEFINED", + "CONSTRAINT_RESIDUAL_EXCEEDED", + "NONFINITE_VALUE", + "POVM_NORMALIZATION_EXCEEDED", + "PRECISION_INSUFFICIENT", + "PROBABILITY_OUT_OF_RANGE", + "PROBABILITY_SUM_EXCEEDED", + "SCHRODINGER_DEVIATION_EXCEEDED", + "TRIVIAL_PHYSICAL_STATE", +]; +pub const BOUND_KINDS: [&str; 3] = ["NONE", "ESTIMATED", "RIGOROUS"]; + +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct Refusal { + pub code: &'static str, + pub detail: String, +} + +fn refuse(code: &'static str, detail: impl Into) -> Result { + Err(Refusal { code, detail: detail.into() }) +} + +/// Scaled decimal n / 10^k (tolerances and bounds). +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct Scaled { + pub n: u128, + pub k: u32, +} + +impl Scaled { + pub fn text(&self) -> String { + format!("{}@{}", self.n, self.k) + } + /// Canonical form: strip trailing zeros of n into k. + pub fn canonical(mut n: u128, mut k: u32) -> Scaled { + if n == 0 { + return Scaled { n: 0, k: 0 }; + } + while k > 0 && n % 10 == 0 { + n /= 10; + k -= 1; + } + Scaled { n, k } + } +} + +#[derive(Clone, Debug)] +pub struct Case { + pub name: String, + pub clock_dim: usize, + pub energies: Vec, + pub pauli: [Rat; 4], + pub ref_label: String, + pub ref_index: usize, + pub state: [(Rat, Rat); 2], + pub tau: Rat, + pub weight: Rat, + pub labels: Vec, + pub control_kind: String, + pub expected_outcome: String, + pub expected_codes: Vec, + pub min_bound_kind: String, + pub tol_constraint: Scaled, + pub tol_povm: Scaled, + pub tol_probability: Scaled, + pub tol_zero: Scaled, + pub tol_schrodinger: Scaled, + pub case_id: String, + pub acceptance_id: String, + pub semantic_block: String, + pub acceptance_block: String, + pub file_sha256: String, + pub h_norm: Rat, + pub eigenvalues: [Rat; 2], +} + +// ---- token parsers ------------------------------------------------------------ + +pub fn parse_int(tok: &str) -> Result { + let digits = tok.strip_prefix('-').unwrap_or(tok); + let ok = !digits.is_empty() + && digits.bytes().all(|b| b.is_ascii_digit()) + && (digits == "0" || !digits.starts_with('0')) + && tok != "-0"; + if !ok { + return refuse("CASE_NONCANONICAL", format!("integer {}", tok)); + } + digits.len().le(&38).then(|| ()).ok_or(Refusal { code: "CASE_INVALID_PARAMETER", detail: "integer too long".into() })?; + let v: i128 = digits.parse().map_err(|_| Refusal { code: "CASE_INVALID_PARAMETER", detail: "integer".into() })?; + Ok(if tok.starts_with('-') { -v } else { v }) +} + +pub fn parse_rational(tok: &str) -> Result { + let (a, b) = match tok.split_once('/') { + Some(p) if !p.1.contains('/') => p, + _ => return refuse("CASE_PARSE_ERROR", format!("rational {}", tok)), + }; + let (n, d) = (parse_int(a)?, parse_int(b)?); + if d < 1 { + return refuse("CASE_NONCANONICAL", format!("rational denominator {}", tok)); + } + if n.abs() > RATIONAL_LIMIT || d > RATIONAL_LIMIT { + return refuse("CASE_INVALID_PARAMETER", format!("rational limit {}", tok)); + } + let r = Rat::new(n, d); + if r.n != n || r.d != d { + return refuse("CASE_NONCANONICAL", format!("rational not reduced {}", tok)); + } + Ok(r) +} + +pub fn parse_complex(tok: &str) -> Result<(Rat, Rat), Refusal> { + let inner = match tok.strip_prefix('(').and_then(|t| t.strip_suffix(')')) { + Some(i) => i, + None => return refuse("CASE_PARSE_ERROR", format!("complex {}", tok)), + }; + match inner.split_once(';') { + Some((a, b)) if !b.contains(';') => Ok((parse_rational(a)?, parse_rational(b)?)), + _ => refuse("CASE_PARSE_ERROR", format!("complex {}", tok)), + } +} + +pub fn parse_scaled(tok: &str) -> Result { + let (a, b) = match tok.split_once('@') { + Some(p) => p, + None => return refuse("CASE_PARSE_ERROR", format!("scaled {}", tok)), + }; + let digits_ok = |s: &str| !s.is_empty() && s.bytes().all(|c| c.is_ascii_digit()) && (s == "0" || !s.starts_with('0')); + if !digits_ok(a) || !digits_ok(b) || a.len() > 38 || b.len() > 2 { + return refuse("CASE_PARSE_ERROR", format!("scaled {}", tok)); + } + let (n, k): (u128, u32) = (a.parse().unwrap(), b.parse().unwrap()); + if k > 40 { + return refuse("CASE_INVALID_PARAMETER", format!("scaled exponent {}", tok)); + } + if (n == 0 && k != 0) || (n != 0 && k != 0 && n % 10 == 0) { + return refuse("CASE_NONCANONICAL", format!("scaled {}", tok)); + } + Ok(Scaled { n, k }) +} + +pub fn parse_list(tok: &str) -> Result, Refusal> { + if tok == "none" { + return Ok(Vec::new()); + } + if tok.is_empty() || tok.starts_with(',') || tok.ends_with(',') || tok.contains(",,") { + return refuse("CASE_PARSE_ERROR", format!("list {}", tok)); + } + Ok(tok.split(',').map(str::to_string).collect()) +} + +pub fn is_label(s: &str) -> bool { + let b = s.as_bytes(); + !b.is_empty() + && b.len() <= 32 + && b[0].is_ascii_lowercase() + && b.iter().all(|c| c.is_ascii_lowercase() || c.is_ascii_digit() || *c == b'_') +} + +pub fn is_name(s: &str) -> bool { + let b = s.as_bytes(); + !b.is_empty() + && b.len() <= 64 + && b[0].is_ascii_alphanumeric() + && b.iter().all(|c| c.is_ascii_alphanumeric() || matches!(c, b'_' | b'.' | b'-')) +} + +pub fn is_digest(s: &str) -> bool { + s.len() == 64 && s.bytes().all(|c| c.is_ascii_digit() || (b'a'..=b'f').contains(&c)) +} + +// ---- byte rules --------------------------------------------------------------- + +pub fn check_bytes(data: &[u8]) -> Result, Refusal> { + if data.last() != Some(&b'\n') { + return refuse("CASE_PARSE_ERROR", "missing final LF"); + } + if let Some(b) = data.iter().find(|b| **b != 0x0A && !(0x20..=0x7E).contains(*b)) { + return refuse("CASE_PARSE_ERROR", format!("byte 0x{:02x}", b)); + } + let text = std::str::from_utf8(data).map_err(|_| Refusal { code: "CASE_PARSE_ERROR", detail: "ascii".into() })?; + let mut lines: Vec<&str> = text.split('\n').collect(); + lines.pop(); // the empty piece after the final LF + for ln in &lines { + if ln.is_empty() || ln.starts_with(' ') || ln.ends_with(' ') || ln.contains(" ") { + return refuse("CASE_PARSE_ERROR", format!("line spacing: {:?}", ln)); + } + } + Ok(lines) +} + +struct Cursor<'a> { + lines: Vec<&'a str>, + pos: usize, +} + +impl<'a> Cursor<'a> { + fn take(&mut self, key: &str) -> Result<&'a str, Refusal> { + let line = match self.lines.get(self.pos) { + Some(l) => *l, + None => return refuse("CASE_PARSE_ERROR", format!("missing {}", key)), + }; + self.pos += 1; + if line == key { + return Ok(""); + } + match line.strip_prefix(key).and_then(|r| r.strip_prefix(' ')) { + Some(v) => Ok(v), + None => refuse("CASE_PARSE_ERROR", format!("expected {}, got {:?}", key, line)), + } + } + fn fixed(&mut self, key: &str, want: &str, code: &'static str) -> Result<(), Refusal> { + let v = self.take(key)?; + if v != want { + return refuse(code, format!("{} {}", key, v)); + } + Ok(()) + } + fn enumerated(&mut self, key: &str, allowed: &[&str]) -> Result { + let v = self.take(key)?; + if !allowed.contains(&v) { + return refuse("CASE_PARSE_ERROR", format!("{} {}", key, v)); + } + Ok(v.to_string()) + } +} + +pub fn block(text: &str, name: &str) -> String { + let lines: Vec<&str> = text.split('\n').collect(); + let (b, e) = (format!("begin {}", name), format!("end {}", name)); + let start = lines.iter().position(|l| *l == b).unwrap_or(0); + let end = lines.iter().position(|l| *l == e).unwrap_or(start); + lines[start..=end].iter().map(|l| format!("{}\n", l)).collect() +} + +pub fn case_id(sem_block: &str) -> String { + tagged_hex(CASE_DOMAIN, sem_block.as_bytes()) +} + +pub fn acceptance_id(acc_block: &str) -> String { + tagged_hex(ACCEPTANCE_DOMAIN, acc_block.as_bytes()) +} + +/// Parse and validate case bytes in the order of AT0_CASE_V1 section 4. +pub fn parse_case(data: &[u8]) -> Result { + let lines = check_bytes(data)?; + let mut c = Cursor { lines, pos: 0 }; + c.fixed("OMEGA-AT0-CASE", "v1", "CASE_UNSUPPORTED_VERSION")?; + c.fixed("domain", "omega.at0.case.v1", "CASE_UNSUPPORTED_VERSION")?; + c.fixed("contract", "AT0_CASE_V1", "CASE_UNSUPPORTED_VERSION")?; + let name = c.take("case_name")?.to_string(); + if !is_name(&name) { + return refuse("CASE_PARSE_ERROR", "case_name"); + } + c.fixed("begin", "semantic", "CASE_PARSE_ERROR")?; + c.fixed("model_family", "PAGE_WOOTTERS_FINITE_IDEAL", "CASE_PARSE_ERROR")?; + c.fixed("energy_unit", "DIMENSIONLESS_HBAR_1", "CASE_PARSE_ERROR")?; + let clock_dim_i = parse_int(c.take("clock_dim")?)?; + let energies: Vec = parse_list(c.take("clock_energies")?)?.iter().map(|t| parse_rational(t)).collect::>()?; + c.fixed("system_dim", "2", "CASE_PARSE_ERROR")?; + let pauli_v: Vec = parse_list(c.take("system_hamiltonian_pauli")?)?.iter().map(|t| parse_rational(t)).collect::>()?; + c.fixed("interaction", "NONE", "CASE_PARSE_ERROR")?; + c.fixed("constraint", "SUM_HC_HS", "CASE_PARSE_ERROR")?; + c.fixed("physical_state", "NULLSPACE_PROJECTION", "CASE_PARSE_ERROR")?; + let ref_label = c.take("reference_clock_label")?.to_string(); + if !is_label(&ref_label) { + return refuse("CASE_PARSE_ERROR", "reference_clock_label"); + } + let state_v: Vec<(Rat, Rat)> = parse_list(c.take("reference_system_state")?)?.iter().map(|t| parse_complex(t)).collect::>()?; + c.fixed("clock_povm", "COVARIANT_DISCRETE", "CASE_PARSE_ERROR")?; + let tau = parse_rational(c.take("povm_tau_turns")?)?; + let weight = parse_rational(c.take("povm_weight")?)?; + let label_count = parse_int(c.take("clock_label_count")?)?; + let mut labels = Vec::new(); + if (1..=256).contains(&label_count) { + for k in 0..label_count { + let v = c.take("clock_label")?; + let (idx, lb) = match v.split_once(' ') { + Some(p) => p, + None => return refuse("CASE_PARSE_ERROR", format!("clock_label {}", v)), + }; + if parse_int(idx)? != k || !is_label(lb) { + return refuse("CASE_PARSE_ERROR", format!("clock_label {}", v)); + } + labels.push(lb.to_string()); + } + } + c.fixed("observables", "PAULI_X,PAULI_Y,PAULI_Z", "CASE_PARSE_ERROR")?; + c.fixed("end", "semantic", "CASE_PARSE_ERROR")?; + c.fixed("begin", "acceptance", "CASE_PARSE_ERROR")?; + let control_kind = c.enumerated("control_kind", &["POSITIVE", "NEGATIVE"])?; + let expected_outcome = c.enumerated("expected_outcome", &["PASS", "FAIL"])?; + let expected_codes = parse_list(c.take("expected_failure_codes")?)?; + let min_bound_kind = c.enumerated("min_bound_kind", &["RIGOROUS", "ESTIMATED", "NONE"])?; + let tol_constraint = parse_scaled(c.take("tol_constraint_residual")?)?; + let tol_povm = parse_scaled(c.take("tol_povm_residual")?)?; + let tol_probability = parse_scaled(c.take("tol_probability")?)?; + let tol_zero = parse_scaled(c.take("tol_zero_probability")?)?; + let tol_schrodinger = parse_scaled(c.take("tol_schrodinger")?)?; + c.fixed("end", "acceptance", "CASE_PARSE_ERROR")?; + let cid = c.take("case_id")?.to_string(); + let aid = c.take("acceptance_id")?.to_string(); + if !is_digest(&cid) || !is_digest(&aid) { + return refuse("CASE_PARSE_ERROR", "digest"); + } + c.fixed("end", "", "CASE_PARSE_ERROR")?; + if c.pos != c.lines.len() { + return refuse("CASE_PARSE_ERROR", "trailing lines"); + } + + // Rule 3: ranges and fixed values. + if !(2..=64).contains(&clock_dim_i) { + return refuse("CASE_INVALID_PARAMETER", "clock_dim"); + } + let clock_dim = clock_dim_i as usize; + if energies.len() != clock_dim || energies.windows(2).any(|w| w[0] >= w[1]) { + return refuse("CASE_INVALID_PARAMETER", "clock_energies"); + } + if pauli_v.len() != 4 { + return refuse("CASE_INVALID_PARAMETER", "system_hamiltonian_pauli"); + } + if state_v.len() != 2 || state_v.iter().all(|(a, b)| a.is_zero() && b.is_zero()) { + return refuse("CASE_INVALID_PARAMETER", "reference_system_state"); + } + if tau <= Rat::zero() || weight <= Rat::zero() { + return refuse("CASE_INVALID_PARAMETER", "povm"); + } + if !(1..=256).contains(&label_count) || labels.len() != label_count as usize { + return refuse("CASE_INVALID_PARAMETER", "clock labels"); + } + let mut sorted = labels.clone(); + sorted.sort(); + sorted.dedup(); + if sorted.len() != labels.len() { + return refuse("CASE_INVALID_PARAMETER", "duplicate clock label"); + } + let ref_index = match labels.iter().position(|l| *l == ref_label) { + Some(i) => i, + None => return refuse("CASE_INVALID_PARAMETER", "reference_clock_label"), + }; + // Rule 4: rational spectrum. + let pauli = [pauli_v[0], pauli_v[1], pauli_v[2], pauli_v[3]]; + let hh = pauli[1].mul(&pauli[1]).add(&pauli[2].mul(&pauli[2])).add(&pauli[3].mul(&pauli[3])); + let h_norm = match hh.sqrt_exact() { + Some(r) => r, + None => return refuse("CASE_IRRATIONAL_SPECTRUM", hh.text()), + }; + let eigenvalues = [pauli[0].add(&h_norm), pauli[0].sub(&h_norm)]; + // Rule 5: identities. + let text = std::str::from_utf8(data).unwrap(); + let semantic_block = block(text, "semantic"); + let acceptance_block = block(text, "acceptance"); + if case_id(&semantic_block) != cid || acceptance_id(&acceptance_block) != aid { + return refuse("CASE_ID_MISMATCH", ""); + } + // Rule 6: acceptance. + if expected_outcome == "PASS" { + if !expected_codes.is_empty() { + return refuse("CASE_INVALID_PARAMETER", "expected_failure_codes"); + } + } else { + let mut s = expected_codes.clone(); + s.sort(); + s.dedup(); + if expected_codes.is_empty() || s != expected_codes || expected_codes.iter().any(|x| !FAILURE_CODES.contains(&x.as_str())) { + return refuse("CASE_INVALID_PARAMETER", "expected_failure_codes"); + } + } + Ok(Case { + name, + clock_dim, + energies, + pauli, + ref_label, + ref_index, + state: [state_v[0], state_v[1]], + tau, + weight, + labels, + control_kind, + expected_outcome, + expected_codes, + min_bound_kind, + tol_constraint, + tol_povm, + tol_probability, + tol_zero, + tol_schrodinger, + case_id: cid, + acceptance_id: aid, + semantic_block, + acceptance_block, + file_sha256: sha256_hex(data), + h_norm, + eigenvalues, + }) +} + +/// Exact kernel of H_total: pairs (j, s) with E_j + e_s = 0; s = 0 is h0 + |h|. +pub fn kernel_pairs(c: &Case) -> Vec<(usize, usize)> { + let mut out = Vec::new(); + for (j, e) in c.energies.iter().enumerate() { + for s in 0..2 { + if e.add(&c.eigenvalues[s]).is_zero() { + out.push((j, s)); + } + } + } + out +} + +/// Acceptance parameters for `build_case`. +#[derive(Clone)] +pub struct Acceptance { + pub control_kind: &'static str, + pub expected_outcome: &'static str, + pub expected_codes: Vec<&'static str>, + pub min_bound_kind: &'static str, + pub tol: [&'static str; 5], +} + +impl Acceptance { + pub fn positive() -> Acceptance { + Acceptance { control_kind: "POSITIVE", expected_outcome: "PASS", expected_codes: vec![], min_bound_kind: "ESTIMATED", tol: ["1@12", "1@12", "1@12", "1@9", "1@12"] } + } + pub fn negative(codes: &[&'static str]) -> Acceptance { + Acceptance { control_kind: "NEGATIVE", expected_outcome: "FAIL", expected_codes: codes.to_vec(), ..Acceptance::positive() } + } +} + +/// Emit canonical case bytes from exact parameters (fixtures and tests). +pub fn build_case(name: &str, energies: &[Rat], pauli: [Rat; 4], ref_label: &str, state: [(Rat, Rat); 2], tau: Rat, weight: Rat, labels: &[&str], acc: &Acceptance) -> Vec { + let mut sem = vec![ + "begin semantic".to_string(), + "model_family PAGE_WOOTTERS_FINITE_IDEAL".into(), + "energy_unit DIMENSIONLESS_HBAR_1".into(), + format!("clock_dim {}", energies.len()), + format!("clock_energies {}", energies.iter().map(Rat::text).collect::>().join(",")), + "system_dim 2".into(), + format!("system_hamiltonian_pauli {}", pauli.iter().map(Rat::text).collect::>().join(",")), + "interaction NONE".into(), + "constraint SUM_HC_HS".into(), + "physical_state NULLSPACE_PROJECTION".into(), + format!("reference_clock_label {}", ref_label), + format!("reference_system_state ({};{}),({};{})", state[0].0.text(), state[0].1.text(), state[1].0.text(), state[1].1.text()), + "clock_povm COVARIANT_DISCRETE".into(), + format!("povm_tau_turns {}", tau.text()), + format!("povm_weight {}", weight.text()), + format!("clock_label_count {}", labels.len()), + ]; + for (k, lb) in labels.iter().enumerate() { + sem.push(format!("clock_label {} {}", k, lb)); + } + sem.push("observables PAULI_X,PAULI_Y,PAULI_Z".into()); + sem.push("end semantic".into()); + let codes = if acc.expected_codes.is_empty() { "none".to_string() } else { acc.expected_codes.join(",") }; + let accl = [ + "begin acceptance".to_string(), + format!("control_kind {}", acc.control_kind), + format!("expected_outcome {}", acc.expected_outcome), + format!("expected_failure_codes {}", codes), + format!("min_bound_kind {}", acc.min_bound_kind), + format!("tol_constraint_residual {}", acc.tol[0]), + format!("tol_povm_residual {}", acc.tol[1]), + format!("tol_probability {}", acc.tol[2]), + format!("tol_zero_probability {}", acc.tol[3]), + format!("tol_schrodinger {}", acc.tol[4]), + "end acceptance".into(), + ]; + let sem_b: String = sem.iter().map(|l| format!("{}\n", l)).collect(); + let acc_b: String = accl.iter().map(|l| format!("{}\n", l)).collect(); + let head = format!("OMEGA-AT0-CASE v1\ndomain omega.at0.case.v1\ncontract AT0_CASE_V1\ncase_name {}\n", name); + let tail = format!("case_id {}\nacceptance_id {}\nend\n", case_id(&sem_b), acceptance_id(&acc_b)); + format!("{}{}{}{}", head, sem_b, acc_b, tail).into_bytes() +} diff --git a/research/atemporal/at0/oracle/src/at0/complex.rs b/research/atemporal/at0/oracle/src/at0/complex.rs new file mode 100644 index 000000000..eff6151c3 --- /dev/null +++ b/research/atemporal/at0/oracle/src/at0/complex.rs @@ -0,0 +1,172 @@ +//! Explicit complex numbers and small dense matrices (Vec>). Written +//! here; no numeric library, nothing shared with the C11 engine. + +use std::ops::{Add, Mul, Neg, Sub}; + +#[derive(Clone, Copy, Debug, PartialEq)] +pub struct C { + pub re: f64, + pub im: f64, +} + +impl C { + pub const ZERO: C = C { re: 0.0, im: 0.0 }; + pub const ONE: C = C { re: 1.0, im: 0.0 }; + pub const I: C = C { re: 0.0, im: 1.0 }; + pub fn new(re: f64, im: f64) -> C { + C { re, im } + } + pub fn real(re: f64) -> C { + C { re, im: 0.0 } + } + pub fn conj(self) -> C { + C { re: self.re, im: -self.im } + } + pub fn norm2(self) -> f64 { + self.re * self.re + self.im * self.im + } + pub fn scale(self, s: f64) -> C { + C { re: self.re * s, im: self.im * s } + } + /// exp(i theta) + pub fn cis(theta: f64) -> C { + C { re: theta.cos(), im: theta.sin() } + } +} + +impl Add for C { + type Output = C; + fn add(self, o: C) -> C { + C { re: self.re + o.re, im: self.im + o.im } + } +} +impl Sub for C { + type Output = C; + fn sub(self, o: C) -> C { + C { re: self.re - o.re, im: self.im - o.im } + } +} +impl Mul for C { + type Output = C; + fn mul(self, o: C) -> C { + C { re: self.re * o.re - self.im * o.im, im: self.re * o.im + self.im * o.re } + } +} +impl Neg for C { + type Output = C; + fn neg(self) -> C { + C { re: -self.re, im: -self.im } + } +} + +pub type Mat = Vec>; + +pub fn zeros(n: usize, m: usize) -> Mat { + vec![vec![C::ZERO; m]; n] +} + +pub fn identity(n: usize) -> Mat { + let mut a = zeros(n, n); + for (i, row) in a.iter_mut().enumerate() { + row[i] = C::ONE; + } + a +} + +pub fn matmul(a: &Mat, b: &Mat) -> Mat { + let (n, k, m) = (a.len(), b.len(), b[0].len()); + let mut out = zeros(n, m); + for i in 0..n { + for j in 0..m { + let mut s = C::ZERO; + for l in 0..k { + s = s + a[i][l] * b[l][j]; + } + out[i][j] = s; + } + } + out +} + +pub fn matvec(a: &Mat, v: &[C]) -> Vec { + a.iter().map(|row| row.iter().zip(v).fold(C::ZERO, |s, (x, y)| s + *x * *y)).collect() +} + +pub fn dagger(a: &Mat) -> Mat { + let (n, m) = (a.len(), a[0].len()); + let mut out = zeros(m, n); + for i in 0..n { + for j in 0..m { + out[j][i] = a[i][j].conj(); + } + } + out +} + +pub fn kron(a: &Mat, b: &Mat) -> Mat { + let (n, m, p, q) = (a.len(), a[0].len(), b.len(), b[0].len()); + let mut out = zeros(n * p, m * q); + for i in 0..n { + for j in 0..m { + for k in 0..p { + for l in 0..q { + out[i * p + k][j * q + l] = a[i][j] * b[k][l]; + } + } + } + } + out +} + +/// a + s * b +pub fn add_scaled(a: &Mat, b: &Mat, s: f64) -> Mat { + a.iter().zip(b).map(|(ra, rb)| ra.iter().zip(rb).map(|(x, y)| *x + y.scale(s)).collect()).collect() +} + +pub fn scale(a: &Mat, s: f64) -> Mat { + a.iter().map(|row| row.iter().map(|x| x.scale(s)).collect()).collect() +} + +/// u v^dagger +pub fn outer(u: &[C], v: &[C]) -> Mat { + u.iter().map(|x| v.iter().map(|y| *x * y.conj()).collect()).collect() +} + +pub fn vnorm2(v: &[C]) -> f64 { + v.iter().map(|x| x.norm2()).sum() +} + +pub fn frobenius(a: &Mat) -> f64 { + a.iter().flatten().map(|x| x.norm2()).sum::().sqrt() +} + +pub fn trace(a: &Mat) -> C { + (0..a.len()).fold(C::ZERO, |s, i| s + a[i][i]) +} + +pub fn real_mat(rows: &[[f64; 2]; 2]) -> Mat { + rows.iter().map(|r| r.iter().map(|x| C::real(*x)).collect()).collect() +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn algebra() { + let x = real_mat(&[[0.0, 1.0], [1.0, 0.0]]); + let y: Mat = vec![vec![C::ZERO, -C::I], vec![C::I, C::ZERO]]; + let z = real_mat(&[[1.0, 0.0], [0.0, -1.0]]); + // X Y = i Z + let xy = matmul(&x, &y); + assert_eq!(xy, scale_c(&z, C::I)); + assert_eq!(trace(&matmul(&x, &x)), C::real(2.0)); + assert_eq!(kron(&identity(2), &identity(3)), identity(6)); + assert_eq!(dagger(&y), y); + assert_eq!(frobenius(&identity(4)), 2.0); + } + + fn scale_c(a: &Mat, c: C) -> Mat { + a.iter().map(|row| row.iter().map(|x| *x * c).collect()).collect() + } +} diff --git a/research/atemporal/at0/oracle/src/at0/exact.rs b/research/atemporal/at0/oracle/src/at0/exact.rs new file mode 100644 index 000000000..a69a98b29 --- /dev/null +++ b/research/atemporal/at0/oracle/src/at0/exact.rs @@ -0,0 +1,228 @@ +//! Exact decisions on written tokens (AT0_RESULT_V1 section 4) without floats. +//! +//! Every binary64 value is m * 2^e with e >= -1074, every scaled decimal is +//! n / 10^k with k <= 40. Both are exact integer multiples of the unit +//! U = 2^-1074 * 10^-40, so each becomes a signed big integer count of U and +//! every comparison, sum and difference is exact integer arithmetic. + +use std::cmp::Ordering; + +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct Big(Vec); // little-endian limbs, no trailing zero limbs + +impl Big { + pub fn zero() -> Big { + Big(Vec::new()) + } + pub fn from_u128(mut v: u128) -> Big { + let mut limbs = Vec::new(); + while v != 0 { + limbs.push(v as u32); + v >>= 32; + } + Big(limbs) + } + fn trim(mut self) -> Big { + while self.0.last() == Some(&0) { + self.0.pop(); + } + self + } + pub fn is_zero(&self) -> bool { + self.0.is_empty() + } + pub fn shl(&self, bits: u32) -> Big { + if self.is_zero() { + return Big::zero(); + } + let (words, rem) = ((bits / 32) as usize, bits % 32); + let mut out = vec![0u32; words]; + let mut carry = 0u32; + for &l in &self.0 { + if rem == 0 { + out.push(l); + } else { + out.push((l << rem) | carry); + carry = l >> (32 - rem); + } + } + if carry != 0 { + out.push(carry); + } + Big(out).trim() + } + pub fn mul_small(&self, m: u32) -> Big { + let mut out = Vec::with_capacity(self.0.len() + 1); + let mut carry = 0u64; + for &l in &self.0 { + let p = l as u64 * m as u64 + carry; + out.push(p as u32); + carry = p >> 32; + } + if carry != 0 { + out.push(carry as u32); + } + Big(out).trim() + } + pub fn mul_pow10(&self, k: u32) -> Big { + let mut out = self.clone(); + for _ in 0..k { + out = out.mul_small(10); + } + out + } + pub fn add(&self, o: &Big) -> Big { + let n = self.0.len().max(o.0.len()); + let mut out = Vec::with_capacity(n + 1); + let mut carry = 0u64; + for i in 0..n { + let s = *self.0.get(i).unwrap_or(&0) as u64 + *o.0.get(i).unwrap_or(&0) as u64 + carry; + out.push(s as u32); + carry = s >> 32; + } + if carry != 0 { + out.push(carry as u32); + } + Big(out).trim() + } + /// self - o, requires self >= o. + pub fn sub(&self, o: &Big) -> Big { + debug_assert!(self.cmp(o) != Ordering::Less); + let mut out = Vec::with_capacity(self.0.len()); + let mut borrow = 0i64; + for i in 0..self.0.len() { + let mut d = self.0[i] as i64 - *o.0.get(i).unwrap_or(&0) as i64 - borrow; + if d < 0 { + d += 1 << 32; + borrow = 1; + } else { + borrow = 0; + } + out.push(d as u32); + } + Big(out).trim() + } +} + +impl Ord for Big { + fn cmp(&self, o: &Big) -> Ordering { + if self.0.len() != o.0.len() { + return self.0.len().cmp(&o.0.len()); + } + for i in (0..self.0.len()).rev() { + if self.0[i] != o.0[i] { + return self.0[i].cmp(&o.0[i]); + } + } + Ordering::Equal + } +} + +impl PartialOrd for Big { + fn partial_cmp(&self, o: &Big) -> Option { + Some(self.cmp(o)) + } +} + +/// A signed exact number as a count of U = 2^-1074 * 10^-40. +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct Exact { + neg: bool, + mag: Big, +} + +const BIN_SHIFT: u32 = 1074; +const DEC_PLACES: u32 = 40; + +impl Exact { + pub fn zero() -> Exact { + Exact { neg: false, mag: Big::zero() } + } + /// Exact value of a finite double. None for NaN or infinity. + pub fn from_f64(x: f64) -> Option { + if !x.is_finite() { + return None; + } + let bits = x.to_bits(); + let neg = bits >> 63 == 1; + let exp = ((bits >> 52) & 0x7ff) as i32; + let frac = bits & ((1u64 << 52) - 1); + let (m, e) = if exp == 0 { (frac, -1074) } else { (frac | (1u64 << 52), exp - 1075) }; + if m == 0 { + return Some(Exact::zero()); + } + let mag = Big::from_u128(m as u128).shl((e + BIN_SHIFT as i32) as u32).mul_pow10(DEC_PLACES); + Some(Exact { neg, mag }) + } + /// n / 10^k, k <= 40. + pub fn from_scaled(n: u128, k: u32) -> Exact { + assert!(k <= DEC_PLACES); + Exact { neg: false, mag: Big::from_u128(n).mul_pow10(DEC_PLACES - k).shl(BIN_SHIFT) } + } + pub fn from_int(i: i64) -> Exact { + Exact { neg: i < 0, mag: Big::from_u128(i.unsigned_abs() as u128).mul_pow10(DEC_PLACES).shl(BIN_SHIFT) } + } + pub fn abs(&self) -> Exact { + Exact { neg: false, mag: self.mag.clone() } + } + pub fn neg(&self) -> Exact { + Exact { neg: !self.neg && !self.mag.is_zero(), mag: self.mag.clone() } + } + pub fn add(&self, o: &Exact) -> Exact { + if self.neg == o.neg { + return Exact { neg: self.neg, mag: self.mag.add(&o.mag) }; + } + match self.mag.cmp(&o.mag) { + Ordering::Equal => Exact::zero(), + Ordering::Greater => Exact { neg: self.neg, mag: self.mag.sub(&o.mag) }, + Ordering::Less => Exact { neg: o.neg, mag: o.mag.sub(&self.mag) }, + } + } + pub fn sub(&self, o: &Exact) -> Exact { + self.add(&o.neg()) + } + pub fn le(&self, o: &Exact) -> bool { + self.cmp(o) != Ordering::Greater + } + pub fn gt(&self, o: &Exact) -> bool { + self.cmp(o) == Ordering::Greater + } +} + +impl Ord for Exact { + fn cmp(&self, o: &Exact) -> Ordering { + match (self.neg, o.neg) { + (false, true) => Ordering::Greater, + (true, false) => Ordering::Less, + (false, false) => self.mag.cmp(&o.mag), + (true, true) => o.mag.cmp(&self.mag), + } + } +} + +impl PartialOrd for Exact { + fn partial_cmp(&self, o: &Exact) -> Option { + Some(self.cmp(o)) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn doubles_and_decimals_meet_exactly() { + assert_eq!(Exact::from_f64(0.5).unwrap(), Exact::from_scaled(5, 1)); + assert_eq!(Exact::from_f64(0.25).unwrap(), Exact::from_scaled(25, 2)); + assert_eq!(Exact::from_f64(1.0).unwrap(), Exact::from_int(1)); + assert_eq!(Exact::from_f64(-0.0).unwrap(), Exact::zero()); + assert!(Exact::from_f64(0.1).unwrap().gt(&Exact::from_scaled(1, 1))); // 0.1 double is above 1/10 + assert!(Exact::from_f64(f64::NAN).is_none()); + let tiny = Exact::from_f64(5e-324).unwrap(); + assert!(tiny.gt(&Exact::zero())); + assert!(tiny.le(&Exact::from_scaled(1, 40))); + let a = Exact::from_f64(0.75).unwrap().sub(&Exact::from_int(1)); + assert_eq!(a.abs(), Exact::from_scaled(25, 2)); + assert_eq!(Exact::from_scaled(1, 12).add(&Exact::from_scaled(1, 12)), Exact::from_scaled(2, 12)); + } +} diff --git a/research/atemporal/at0/oracle/src/at0/fixtures.rs b/research/atemporal/at0/oracle/src/at0/fixtures.rs new file mode 100644 index 000000000..4c4efa881 --- /dev/null +++ b/research/atemporal/at0/oracle/src/at0/fixtures.rs @@ -0,0 +1,170 @@ +//! Deterministic public calibration fixtures. Pure: returns file contents; +//! src/main.rs writes them. Expected tables are exact rationals derived by hand +//! (README.md, "How fixture expectations were derived"). + +use super::case::{build_case, parse_case, Acceptance}; +use super::rational::Rat; +use super::result::{compute, Computed}; + +pub struct Fixture { + pub name: &'static str, + pub case: Vec, + pub dephased: bool, + /// per label: Some((P(X+), P(Y+), P(Z+), p(k))) where a closed form is rational + pub expected: Option>>, +} + +fn r(n: i128, d: i128) -> Rat { + Rat::new(n, d) +} + +fn clock(n: usize) -> Vec { + (0..n).map(|j| r(2 * j as i128 - (n as i128 - 1), 2)).collect() +} + +fn labels(m: usize) -> Vec { + (0..m).map(|k| format!("t{}", k)).collect() +} + +const PLUS: [(Rat, Rat); 2] = [(Rat { n: 1, d: 1 }, Rat { n: 0, d: 1 }), (Rat { n: 1, d: 1 }, Rat { n: 0, d: 1 })]; +const ZEROR: Rat = Rat { n: 0, d: 1 }; + +fn half() -> Rat { + r(1, 2) +} + +/// Ideal clock, H_S = Z/2 (even N) or Z (odd N), psi_0 = |+>: = cos a, = sin a, +/// = 0 with a = 2|h| * 2 pi (k - ref)/N; exact only at quarter turns. +fn kat_table(n: usize, reference: usize) -> Vec> { + let h = if n % 2 == 0 { r(1, 2) } else { r(1, 1) }; + (0..n) + .map(|k| { + let turns = h.mul(&r(2, 1)).mul(&r(k as i128 - reference as i128, n as i128)); + let t = Rat::new(turns.n.rem_euclid(turns.d), turns.d); + let cs = match (t.n, t.d) { + (0, 1) => Some((1i128, 0i128)), + (1, 4) => Some((0, 1)), + (1, 2) => Some((-1, 0)), + (3, 4) => Some((0, -1)), + _ => None, + }; + cs.map(|(c, s)| [r(1 + c, 2), r(1 + s, 2), half(), r(1, n as i128)]) + }) + .collect() +} + +fn table(rows: &[(i128, i128, i128, i128)]) -> Vec> { + // rows as (2 P(X+), 2 P(Y+), 2 P(Z+), 1/p) integers for readability + rows.iter().map(|(x, y, z, p)| Some([r(*x, 2), r(*y, 2), r(*z, 2), r(1, *p)])).collect() +} + +pub fn catalogue() -> Vec { + let pos = Acceptance::positive(); + let neg = |codes: &[&'static str]| Acceptance::negative(codes); + let zhalf = [ZEROR, ZEROR, ZEROR, half()]; + let l4: Vec<&str> = vec!["t0", "t1", "t2", "t3"]; + let mut out = Vec::new(); + for n in [4usize, 6, 8, 3, 5] { + let pauli = if n % 2 == 0 { zhalf } else { [ZEROR, ZEROR, ZEROR, r(1, 1)] }; + let name: &'static str = match n { + 4 => "at0-kat-ideal-qubit-n4", + 6 => "p1-ideal-n6", + 8 => "p1-ideal-n8", + 3 => "p1-ideal-n3", + _ => "p1-ideal-n5", + }; + let lb = labels(n); + let lbs: Vec<&str> = lb.iter().map(String::as_str).collect(); + out.push(Fixture { name, case: build_case(name, &clock(n), pauli, "t0", PLUS, r(1, n as i128), r(1, 1), &lbs, &pos), dephased: false, expected: Some(kat_table(n, 0)) }); + } + out.push(Fixture { name: "p1-offset-ref-t2", case: build_case("p1-offset-ref-t2", &clock(4), zhalf, "t2", PLUS, r(1, 4), r(1, 1), &l4, &pos), dephased: false, expected: Some(kat_table(4, 2)) }); + out.push(Fixture { name: "p1-global-phase-i", case: build_case("p1-global-phase-i", &clock(4), zhalf, "t0", [(ZEROR, r(1, 1)), (ZEROR, r(1, 1))], r(1, 4), r(1, 1), &l4, &pos), dephased: false, expected: Some(kat_table(4, 0)) }); + out.push(Fixture { name: "p1-unnormalized-2", case: build_case("p1-unnormalized-2", &clock(4), zhalf, "t0", [(r(2, 1), ZEROR), (r(2, 1), ZEROR)], r(1, 4), r(1, 1), &l4, &pos), dephased: false, expected: Some(kat_table(4, 0)) }); + out.push(Fixture { name: "p2-tilted-3-10-2-5", case: build_case("p2-tilted-3-10-2-5", &clock(4), [ZEROR, r(3, 10), ZEROR, r(2, 5)], "t0", PLUS, r(1, 4), r(1, 1), &l4, &pos), dephased: false, expected: None }); + out.push(Fixture { name: "p2-h0-shift", case: build_case("p2-h0-shift", &[r(-1, 1), ZEROR, r(1, 1), r(2, 1)], [half(), r(3, 10), ZEROR, r(2, 5)], "t0", PLUS, r(1, 4), r(1, 1), &l4, &pos), dephased: false, expected: None }); + out.push(Fixture { name: "n1-uncovered", case: build_case("n1-uncovered", &[r(1, 1), r(2, 1), r(3, 1), r(4, 1)], zhalf, "t0", PLUS, r(1, 4), r(1, 1), &l4, &neg(&["TRIVIAL_PHYSICAL_STATE"])), dephased: false, expected: None }); + out.push(Fixture { name: "n2-half-covered", case: build_case("n2-half-covered", &[r(1, 2), r(3, 2), r(5, 2), r(7, 2)], zhalf, "t0", PLUS, r(1, 4), r(1, 1), &l4, &neg(&["SCHRODINGER_DEVIATION_EXCEEDED"])), dephased: false, expected: None }); + out.push(Fixture { name: "n4-wrong-weight", case: build_case("n4-wrong-weight", &clock(4), zhalf, "t0", PLUS, r(1, 4), r(2, 1), &l4, &neg(&["POVM_NORMALIZATION_EXCEEDED", "PROBABILITY_SUM_EXCEEDED"])), dephased: false, expected: None }); + out.push(Fixture { name: "n3-broken-clock-tau-1-3", case: build_case("n3-broken-clock-tau-1-3", &clock(4), zhalf, "t0", PLUS, r(1, 3), r(1, 1), &l4, &neg(&["POVM_NORMALIZATION_EXCEEDED"])), dephased: false, expected: None }); + let mut rig = neg(&["BOUND_KIND_INSUFFICIENT"]); + rig.min_bound_kind = "RIGOROUS"; + out.push(Fixture { name: "n5-rigorous-demand", case: build_case("n5-rigorous-demand", &clock(4), zhalf, "t0", PLUS, r(1, 4), r(1, 1), &l4, &rig), dephased: false, expected: None }); + // AT0_SPEC draft (section 12 mapping): two-level clock, H_S = diag(0, 1), omega = 1, phi = 0. + let spec_e = [r(-1, 1), ZEROR]; + let spec_h = [half(), ZEROR, ZEROR, r(-1, 2)]; + out.push(Fixture { name: "spec-ref-model-n4", case: build_case("spec-ref-model-n4", &spec_e, spec_h, "t0", PLUS, r(1, 4), half(), &l4, &pos), dephased: false, expected: Some(table(&[(2, 1, 1, 4), (1, 0, 1, 4), (0, 1, 1, 4), (1, 2, 1, 4)])) }); + out.push(Fixture { name: "spec-t4-eigenstate-00", case: build_case("spec-t4-eigenstate-00", &spec_e, spec_h, "t0", [(r(1, 1), ZEROR), (ZEROR, ZEROR)], r(1, 4), half(), &l4, &pos), dephased: false, expected: Some(table(&[(1, 1, 2, 4); 4])) }); + out.push(Fixture { name: "spec-t5-relational-phase", case: build_case("spec-t5-relational-phase", &spec_e, spec_h, "t0", [(r(1, 1), ZEROR), (ZEROR, r(1, 1))], r(1, 4), half(), &l4, &pos), dephased: false, expected: Some(table(&[(1, 2, 1, 4), (2, 1, 1, 4), (1, 0, 1, 4), (0, 1, 1, 4)])) }); + out.push(Fixture { name: "spec-n3-wrong-weight", case: build_case("spec-n3-wrong-weight", &spec_e, spec_h, "t0", PLUS, r(1, 4), r(1, 4), &l4, &neg(&["POVM_NORMALIZATION_EXCEEDED", "PROBABILITY_SUM_EXCEEDED"])), dephased: false, expected: None }); + out.push(Fixture { name: "spec-n4-dropped-effect", case: build_case("spec-n4-dropped-effect", &spec_e, spec_h, "t0", PLUS, r(1, 4), half(), &l4[..3], &neg(&["POVM_NORMALIZATION_EXCEEDED", "PROBABILITY_SUM_EXCEEDED"])), dephased: false, expected: None }); + out.push(Fixture { name: "nc-dephased-control", case: build_case("nc-dephased-control", &clock(4), zhalf, "t0", PLUS, r(1, 4), r(1, 1), &l4, &neg(&["SCHRODINGER_DEVIATION_EXCEEDED"])), dephased: true, expected: Some(table(&[(1, 1, 1, 4); 4])) }); + out +} + +pub struct Rendered { + pub files: Vec<(String, Vec)>, + pub calibration: String, + pub summary: Vec, +} + +fn dev(a: f64, want: &Rat) -> f64 { + (a - want.to_f64()).abs() +} + +/// Largest deviation of the computed values from the hand table (matrix path, and +/// the reference path unless dephased), and the number of exact values compared. +pub fn calibrate(f: &Fixture, comp: &Computed) -> (usize, f64) { + let (mut checked, mut worst) = (0usize, 0.0f64); + if let Some(table) = &f.expected { + for (k, row) in table.iter().enumerate() { + let (row, pk) = match (row, comp.matrix.pauli.get(k).and_then(|p| *p)) { + (Some(row), Some(pk)) => (row, pk), + _ => continue, + }; + for ax in 0..3 { + worst = worst.max(dev(pk[ax][0], &row[ax])).max(dev(pk[ax][1], &Rat::int(1).sub(&row[ax]))); + if !f.dephased { + worst = worst.max(dev(comp.reference[k].schrodinger[ax][0], &row[ax])); + } + checked += 2; + } + worst = worst.max(dev(comp.matrix.clock_probability[k], &row[3])); + checked += 1; + } + } + (checked, worst) +} + +pub fn render() -> Rendered { + let mut files = Vec::new(); + let mut rows = Vec::new(); + let mut summary = Vec::new(); + for f in catalogue() { + let c = parse_case(&f.case).expect("fixture case must be valid"); + let comp = compute(&c, f.dephased); + files.push((format!("{}.case", f.name), f.case.clone())); + let mut body = String::new(); + if f.dephased { + body.push_str("note values computed from the DEPHASED kernel-branch mixture of this case (negative control)\n"); + } + for l in comp.values.iter().chain(comp.verdict_lines.iter()) { + body.push_str(l); + body.push('\n'); + } + body.push_str(&format!("verdict_id {}\n", comp.verdict_id)); + files.push((format!("{}.values", f.name), body.into_bytes())); + let (checked, worst) = calibrate(&f, &comp); + let met = comp.verdict_lines.iter().find(|l| l.starts_with("expectation_met")).map(|l| l[16..].to_string()).unwrap_or_default(); + let codes = if comp.verdict.codes.is_empty() { "none".to_string() } else { comp.verdict.codes.join(",") }; + rows.push(format!("| {} | {} | {} | {} | {} | {} | {} | {:.3e} | `{}` |", f.name, if f.dephased { "dephased" } else { "pure" }, comp.matrix.kernel_dim, comp.verdict.outcome, codes, met, checked, worst, comp.verdict_id)); + summary.push(format!("{:<26} {:<8} kernel={} {:<4} codes={:<62} met={} dev={:.2e}", f.name, if f.dephased { "dephased" } else { "pure" }, comp.matrix.kernel_dim, comp.verdict.outcome, codes, met, worst)); + } + let mut cal = String::from("# AT-0 oracle calibration fixtures\n\nGenerated by `target/at0-oracle fixtures` (deterministic, no wall clock). Reproducing the known\nmathematics here is a calibration result, not a discovery. `exact values checked` counts\nhand-derived rational expectations compared; `max dev` is the largest deviation seen\nagainst them (matrix path and reference path), in absolute probability units.\n\n| fixture | state | kernel dim | outcome | failure codes | expectation_met | exact values checked | max dev | verdict_id |\n|---|---|---|---|---|---|---|---|---|\n"); + for row in &rows { + cal.push_str(row); + cal.push('\n'); + } + cal.push_str("\nHand-derived tables: ideal clock, `H_S = Z/2` (even N) or `Z` (odd N), `psi_0 = |+>`, so\n`P(X+) = (1 + cos a)/2`, `P(Y+) = (1 + sin a)/2`, `P(Z+) = 1/2`, `p(k) = 1/N`, with\n`a = 2|h| * 2 pi (k - r) / N`; only labels whose angle is a multiple of a quarter turn\nhave rational expectations and are counted. Spec fixtures use `H_S = diag(0, 1)` (`hz = -1/2`),\nso `P(Y+) = (1 - sin theta)/2`. The dephased control expects `1/2` everywhere.\nValues blocks follow AT0_RESULT_V2 (f64: tokens, scaled-decimal bounds, bound_kind ESTIMATED).\n"); + files.push(("CALIBRATION.md".to_string(), cal.clone().into_bytes())); + Rendered { files, calibration: cal, summary } +} diff --git a/research/atemporal/at0/oracle/src/at0/matrix_path.rs b/research/atemporal/at0/oracle/src/at0/matrix_path.rs new file mode 100644 index 000000000..9703baf92 --- /dev/null +++ b/research/atemporal/at0/oracle/src/at0/matrix_path.rs @@ -0,0 +1,256 @@ +//! Direct-matrix path: Page-Wootters numerics by explicit complex linear algebra +//! on the full 2N-dimensional composite space. Produces `clock_probability` and +//! `pauli`. No closed-form Schrodinger formula appears here (see reference.rs). +//! Arithmetic binary64, bounds ESTIMATED (NUMERICAL_ERROR.md). No clock, file, +//! process, thread or random facility. + +use super::case::{kernel_pairs, Case}; +use super::complex::*; + +pub const EPS: f64 = 2.220446049250313e-16; // 2^-52 +pub const TWO_PI: f64 = 2.0 * std::f64::consts::PI; + +pub fn pauli(axis: usize) -> Mat { + match axis { + 0 => real_mat(&[[0.0, 1.0], [1.0, 0.0]]), + 1 => vec![vec![C::ZERO, -C::I], vec![C::I, C::ZERO]], + _ => real_mat(&[[1.0, 0.0], [0.0, -1.0]]), + } +} + +pub fn clock_hamiltonian(c: &Case) -> Mat { + let n = c.clock_dim; + let mut h = zeros(n, n); + for j in 0..n { + h[j][j] = C::real(c.energies[j].to_f64()); + } + h +} + +pub fn system_hamiltonian(c: &Case) -> Mat { + let mut hs = scale(&identity(2), c.pauli[0].to_f64()); + for (i, ax) in (1..4).zip(0..3) { + hs = add_scaled(&hs, &pauli(ax), c.pauli[i].to_f64()); + } + hs +} + +pub fn total_hamiltonian(c: &Case) -> Mat { + let hc = clock_hamiltonian(c); + add_scaled(&kron(&hc, &identity(2)), &kron(&identity(c.clock_dim), &system_hamiltonian(c)), 1.0) +} + +/// P_0, P_1 for eigenvalues h0 + |h| and h0 - |h| (computational split when |h| = 0). +pub fn system_eigenprojectors(c: &Case) -> [Mat; 2] { + let hn = c.h_norm.to_f64(); + if hn == 0.0 { + return [real_mat(&[[1.0, 0.0], [0.0, 0.0]]), real_mat(&[[0.0, 0.0], [0.0, 1.0]])]; + } + let mut ns = zeros(2, 2); + for (i, ax) in (1..4).zip(0..3) { + ns = add_scaled(&ns, &pauli(ax), c.pauli[i].to_f64() / hn); + } + [scale(&add_scaled(&identity(2), &ns, 1.0), 0.5), scale(&add_scaled(&identity(2), &ns, -1.0), 0.5)] +} + +fn clock_basis_projector(n: usize, j: usize) -> Mat { + let mut e = zeros(n, n); + e[j][j] = C::ONE; + e +} + +/// Orthogonal projector onto ker H_total from the exact rational pairs. +pub fn kernel_projector(c: &Case) -> Mat { + let n = c.clock_dim; + let p = system_eigenprojectors(c); + let mut out = zeros(2 * n, 2 * n); + for (j, s) in kernel_pairs(c) { + out = add_scaled(&out, &kron(&clock_basis_projector(n, j), &p[s]), 1.0); + } + out +} + +/// |t_k> = N^(-1/2) sum_j exp(-2 pi i E_j k tau) |E_j> +pub fn clock_state(c: &Case, k: usize) -> Vec { + let amp = 1.0 / (c.clock_dim as f64).sqrt(); + let tau = c.tau.to_f64(); + c.energies.iter().map(|e| C::cis(-TWO_PI * e.to_f64() * k as f64 * tau).scale(amp)).collect() +} + +pub fn reference_system_vector(c: &Case) -> [C; 2] { + [C::new(c.state[0].0.to_f64(), c.state[0].1.to_f64()), C::new(c.state[1].0.to_f64(), c.state[1].1.to_f64())] +} + +/// |Psi> = P_0 (|t_r> (x) |psi_0>), unnormalized. +pub fn physical_state(c: &Case) -> Vec { + let tr = clock_state(c, c.ref_index); + let psi0 = reference_system_vector(c); + let mut v = Vec::with_capacity(2 * c.clock_dim); + for t in &tr { + v.push(*t * psi0[0]); + v.push(*t * psi0[1]); + } + matvec(&kernel_projector(c), &v) +} + +/// || H_total Psi_hat ||_2, None when Psi is numerically zero. +pub fn constraint_residual(c: &Case, psi: &[C]) -> Option { + let n2 = vnorm2(psi); + if n2 == 0.0 { + return None; + } + Some((vnorm2(&matvec(&total_hamiltonian(c), psi)) / n2).sqrt()) +} + +/// || sum_k w |t_k> f64 { + let w = c.weight.to_f64(); + let mut s = scale(&identity(c.clock_dim), -1.0); + for k in 0..c.labels.len() { + let t = clock_state(c, k); + s = add_scaled(&s, &outer(&t, &t), w); + } + frobenius(&s) +} + +/// phi_k = ( [C; 2] { + let t = clock_state(c, k); + let mut phi = [C::ZERO; 2]; + for (j, tj) in t.iter().enumerate() { + for s in 0..2 { + phi[s] = phi[s] + tj.conj() * psi[2 * j + s]; + } + } + phi +} + +pub fn clock_probability(c: &Case, psi: &[C], k: usize) -> f64 { + c.weight.to_f64() * vnorm2(&condition_vector(c, psi, k)) / vnorm2(psi) +} + +/// rho = phi phi^dagger / ||phi||^2, None when phi is numerically zero. +pub fn conditional_density(phi: &[C; 2]) -> Option { + let n2 = vnorm2(phi); + if n2 == 0.0 { + return None; + } + Some(scale(&outer(phi, phi), 1.0 / n2)) +} + +/// [axis][sign] = Tr(rho (I +/- sigma)/2), computed directly, never as 1 - other. +pub fn pauli_probabilities(rho: &Mat) -> [[f64; 2]; 3] { + let mut out = [[0.0; 2]; 3]; + for (ax, row) in out.iter_mut().enumerate() { + for (si, sg) in [1.0, -1.0].iter().enumerate() { + let proj = scale(&add_scaled(&identity(2), &pauli(ax), *sg), 0.5); + row[si] = trace(&matmul(rho, &proj)).re; + } + } + out +} + +// ---- density-matrix route (independent of the vector route above) ------------- + +pub fn density_from_vector(psi: &[C]) -> Mat { + outer(psi, psi) +} + +/// sum over kernel pairs of Pi_js R Pi_js: removes every coherence between distinct +/// kernel branches |E_j>(x)|e_s>. Still annihilated by H_total: a stationary mixed +/// state, the negative control. +pub fn dephase_kernel_branches(c: &Case, r: &Mat) -> Mat { + let n = c.clock_dim; + let p = system_eigenprojectors(c); + let mut out = zeros(2 * n, 2 * n); + for (j, s) in kernel_pairs(c) { + let pi = kron(&clock_basis_projector(n, j), &p[s]); + out = add_scaled(&out, &matmul(&pi, &matmul(r, &pi)), 1.0); + } + out +} + +/// ( (x) I) as a 2 x 2 matrix, and its trace. +pub fn condition_density(c: &Case, r: &Mat, k: usize) -> (Mat, f64) { + let t = clock_state(c, k); + let mut tm = zeros(2 * c.clock_dim, 2); + for (j, tj) in t.iter().enumerate() { + tm[2 * j][0] = *tj; + tm[2 * j + 1][1] = *tj; + } + let red = matmul(&dagger(&tm), &matmul(r, &tm)); + let tr = trace(&red).re; + (red, tr) +} + +pub fn conditional_from_density(c: &Case, r: &Mat, k: usize) -> (f64, Option) { + let (red, tr) = condition_density(c, r, k); + let p = c.weight.to_f64() * tr / trace(r).re; + let rho = if tr != 0.0 { Some(scale(&red, 1.0 / tr)) } else { None }; + (p, rho) +} + +pub fn bound_estimate(c: &Case) -> f64 { + 8.0 * (c.clock_dim + c.labels.len()) as f64 * EPS +} + +pub struct MatrixValues { + pub kernel_dim: usize, + pub psi_norm2: f64, + pub constraint_residual: Option, + pub povm_residual: f64, + pub clock_probability: Vec, + pub rho: Vec>, + pub pauli: Vec>, + pub bound: f64, +} + +impl MatrixValues { + pub fn live(&self) -> bool { + self.kernel_dim >= 1 && self.psi_norm2 > 0.0 + } +} + +/// All matrix-path quantities for a parsed case. +pub fn evaluate(c: &Case, dephased: bool) -> MatrixValues { + let psi = physical_state(c); + let mut out = MatrixValues { + kernel_dim: kernel_pairs(c).len(), + psi_norm2: vnorm2(&psi), + constraint_residual: constraint_residual(c, &psi), + povm_residual: povm_residual(c), + clock_probability: Vec::new(), + rho: Vec::new(), + pauli: Vec::new(), + bound: bound_estimate(c), + }; + if !out.live() { + return out; + } + let mut r = density_from_vector(&psi); + if dephased { + r = dephase_kernel_branches(c, &r); + } + for k in 0..c.labels.len() { + let (p, rho) = if dephased { + conditional_from_density(c, &r, k) + } else { + (clock_probability(c, &psi, k), conditional_density(&condition_vector(c, &psi, k))) + }; + out.clock_probability.push(p); + out.pauli.push(rho.as_ref().map(pauli_probabilities)); + out.rho.push(rho); + } + out +} + +pub fn hermiticity_defect(rho: &Mat) -> f64 { + frobenius(&add_scaled(rho, &dagger(rho), -1.0)) +} + +pub fn eigenvalues_2x2_hermitian(rho: &Mat) -> (f64, f64) { + let tr = trace(rho).re; + let det = (rho[0][0] * rho[1][1] - rho[0][1] * rho[1][0]).re; + let r = (tr * tr - 4.0 * det).max(0.0).sqrt(); + ((tr - r) / 2.0, (tr + r) / 2.0) +} diff --git a/research/atemporal/at0/oracle/src/at0/mod.rs b/research/atemporal/at0/oracle/src/at0/mod.rs new file mode 100644 index 000000000..7af5348a4 --- /dev/null +++ b/research/atemporal/at0/oracle/src/at0/mod.rs @@ -0,0 +1,18 @@ +//! AT-0 reference oracle, compute crate. Standard library only; no clock, file, +//! process, thread, network, environment or random facility anywhere below +//! this module (isolation.sh enforces it). All I/O lives in src/main.rs. +#![allow(dead_code)] // several helpers exist for the test suite and calibration, not the binary + +pub mod case; +pub mod complex; +pub mod exact; +pub mod fixtures; +pub mod matrix_path; +pub mod rational; +pub mod reference; +pub mod result; +pub mod sha256; + +/// Draft mathematical contract the hand-table tests target (aien-architecture +/// pull request 176, not merged): re-check when it merges. +pub const SPEC_DRAFT_COMMIT: &str = "0efd1a14cbdf117bc694b556bb61d031cf80c8f9"; diff --git a/research/atemporal/at0/oracle/src/at0/rational.rs b/research/atemporal/at0/oracle/src/at0/rational.rs new file mode 100644 index 000000000..2cc4aca50 --- /dev/null +++ b/research/atemporal/at0/oracle/src/at0/rational.rs @@ -0,0 +1,120 @@ +//! Exact rationals on i128 for case validation and kernel tests. +//! Inputs are bounded by the contract (|n|, d <= 2^20), so every product here fits. + +use std::cmp::Ordering; + +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] +pub struct Rat { + pub n: i128, + pub d: i128, +} + +fn gcd(mut a: i128, mut b: i128) -> i128 { + a = a.abs(); + b = b.abs(); + while b != 0 { + let t = a % b; + a = b; + b = t; + } + if a == 0 { + 1 + } else { + a + } +} + +pub fn isqrt(n: i128) -> i128 { + if n < 2 { + return n.max(0); + } + let mut x = (n as f64).sqrt() as i128; + while x * x > n { + x -= 1; + } + while (x + 1) * (x + 1) <= n { + x += 1; + } + x +} + +impl Rat { + pub fn new(n: i128, d: i128) -> Rat { + assert!(d != 0, "zero denominator"); + let g = gcd(n, d); + let (mut n, mut d) = (n / g, d / g); + if d < 0 { + n = -n; + d = -d; + } + Rat { n, d } + } + pub fn int(n: i128) -> Rat { + Rat { n, d: 1 } + } + pub fn zero() -> Rat { + Rat { n: 0, d: 1 } + } + pub fn is_zero(&self) -> bool { + self.n == 0 + } + pub fn add(&self, o: &Rat) -> Rat { + Rat::new(self.n * o.d + o.n * self.d, self.d * o.d) + } + pub fn sub(&self, o: &Rat) -> Rat { + Rat::new(self.n * o.d - o.n * self.d, self.d * o.d) + } + pub fn mul(&self, o: &Rat) -> Rat { + Rat::new(self.n * o.n, self.d * o.d) + } + pub fn neg(&self) -> Rat { + Rat { n: -self.n, d: self.d } + } + pub fn to_f64(&self) -> f64 { + // n and d are below 2^53 so each converts exactly; one correctly rounded division. + self.n as f64 / self.d as f64 + } + pub fn text(&self) -> String { + format!("{}/{}", self.n, self.d) + } + /// Exact square root if the (nonnegative) rational is a perfect square. + pub fn sqrt_exact(&self) -> Option { + if self.n < 0 { + return None; + } + let (rn, rd) = (isqrt(self.n), isqrt(self.d)); + if rn * rn == self.n && rd * rd == self.d { + Some(Rat::new(rn, rd)) + } else { + None + } + } +} + +impl PartialOrd for Rat { + fn partial_cmp(&self, o: &Rat) -> Option { + Some(self.cmp(o)) + } +} + +impl Ord for Rat { + fn cmp(&self, o: &Rat) -> Ordering { + (self.n * o.d).cmp(&(o.n * self.d)) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn reduces_and_orders() { + assert_eq!(Rat::new(2, 4), Rat::new(1, 2)); + assert_eq!(Rat::new(1, -2), Rat::new(-1, 2)); + assert!(Rat::new(-3, 2) < Rat::new(-1, 2)); + assert_eq!(Rat::new(1, 2).add(&Rat::new(-1, 2)), Rat::zero()); + assert_eq!(Rat::new(9, 100).sqrt_exact(), Some(Rat::new(3, 10))); + assert_eq!(Rat::new(2, 1).sqrt_exact(), None); + assert_eq!(isqrt(1 << 40), 1 << 20); + } +} diff --git a/research/atemporal/at0/oracle/src/at0/reference.rs b/research/atemporal/at0/oracle/src/at0/reference.rs new file mode 100644 index 000000000..c389a3be6 --- /dev/null +++ b/research/atemporal/at0/oracle/src/at0/reference.rs @@ -0,0 +1,102 @@ +//! Analytic reference path: the Schrodinger prediction without any clock matrix. +//! +//! 1. `schrodinger_probabilities`: exp(-i H_S t) = e^{-i h0 t} (cos(|h| t) I - i sin(|h| t) n.sigma) +//! on psi_0 / ||psi_0||, then ||(I +/- sigma)/2 psi_t||^2. Two complex amplitudes. +//! 2. `bloch_probabilities`: Bloch vector of psi_0 rotated about n by 2 |h| t +//! (Rodrigues), P(+1) = (1 + r_a)/2. Real arithmetic only. +//! t = t_k - t_r = 2 pi tau (k - r); the clock reading is declared data. + +use super::case::Case; +use super::complex::C; +use super::matrix_path::{EPS, TWO_PI}; + +pub fn reading(c: &Case, k: usize) -> f64 { + TWO_PI * k as f64 * c.tau.to_f64() +} + +pub fn elapsed(c: &Case, k: usize) -> f64 { + reading(c, k) - reading(c, c.ref_index) +} + +fn normalized_psi0(c: &Case) -> (C, C) { + let a = C::new(c.state[0].0.to_f64(), c.state[0].1.to_f64()); + let b = C::new(c.state[1].0.to_f64(), c.state[1].1.to_f64()); + let n = (a.norm2() + b.norm2()).sqrt(); + (a.scale(1.0 / n), b.scale(1.0 / n)) +} + +fn field(c: &Case) -> (f64, f64, f64, f64, f64) { + (c.pauli[0].to_f64(), c.pauli[1].to_f64(), c.pauli[2].to_f64(), c.pauli[3].to_f64(), c.h_norm.to_f64()) +} + +/// psi_t = exp(-i H_S (t_k - t_r)) psi_0 / ||psi_0|| +pub fn evolve(c: &Case, k: usize) -> (C, C) { + let (a, b) = normalized_psi0(c); + let (h0, hx, hy, hz, hn) = field(c); + let t = elapsed(c, k); + let ph = C::cis(-h0 * t); + if hn == 0.0 { + return (ph * a, ph * b); + } + let (nx, ny, nz) = (hx / hn, hy / hn, hz / hn); + let (cs, sn) = ((hn * t).cos(), (hn * t).sin()); + // (cos I - i sin n.sigma)(a, b), n.sigma = [[nz, nx - i ny], [nx + i ny, -nz]] + let ua = a.scale(cs) - C::I.scale(sn) * (a.scale(nz) + C::new(nx, -ny) * b); + let ub = b.scale(cs) - C::I.scale(sn) * (C::new(nx, ny) * a - b.scale(nz)); + (ph * ua, ph * ub) +} + +/// [axis][sign] probabilities on psi_t as squared norms of projections. +pub fn schrodinger_probabilities(c: &Case, k: usize) -> [[f64; 2]; 3] { + let (a, b) = evolve(c, k); + [ + [(a + b).norm2() / 2.0, (a - b).norm2() / 2.0], + [(a - C::I * b).norm2() / 2.0, (a + C::I * b).norm2() / 2.0], + [a.norm2(), b.norm2()], + ] +} + +pub fn bloch_vector(c: &Case) -> (f64, f64, f64) { + let (a, b) = normalized_psi0(c); + let ab = a.conj() * b; + (2.0 * ab.re, 2.0 * ab.im, a.norm2() - b.norm2()) +} + +/// Rodrigues rotation of the Bloch vector about n by angle 2 |h| t. +pub fn bloch_probabilities(c: &Case, k: usize) -> [[f64; 2]; 3] { + let (rx, ry, rz) = bloch_vector(c); + let (_h0, hx, hy, hz, hn) = field(c); + let t = elapsed(c, k); + let (vx, vy, vz) = if hn == 0.0 { + (rx, ry, rz) + } else { + let (nx, ny, nz) = (hx / hn, hy / hn, hz / hn); + let th = 2.0 * hn * t; + let (cs, sn) = (th.cos(), th.sin()); + let dot = nx * rx + ny * ry + nz * rz; + let (cx, cy, cz) = (ny * rz - nz * ry, nz * rx - nx * rz, nx * ry - ny * rx); + ( + rx * cs + cx * sn + nx * dot * (1.0 - cs), + ry * cs + cy * sn + ny * dot * (1.0 - cs), + rz * cs + cz * sn + nz * dot * (1.0 - cs), + ) + }; + [[(1.0 + vx) / 2.0, (1.0 - vx) / 2.0], [(1.0 + vy) / 2.0, (1.0 - vy) / 2.0], [(1.0 + vz) / 2.0, (1.0 - vz) / 2.0]] +} + +pub fn bound_estimate(c: &Case, k: usize) -> f64 { + let (h0, _, _, _, hn) = field(c); + 64.0 * EPS * (1.0 + elapsed(c, k).abs() * (h0.abs() + hn)) +} + +pub struct RefValues { + pub schrodinger: [[f64; 2]; 3], + pub bloch: [[f64; 2]; 3], + pub bound: f64, +} + +pub fn evaluate(c: &Case) -> Vec { + (0..c.labels.len()) + .map(|k| RefValues { schrodinger: schrodinger_probabilities(c, k), bloch: bloch_probabilities(c, k), bound: bound_estimate(c, k) }) + .collect() +} diff --git a/research/atemporal/at0/oracle/src/at0/result.rs b/research/atemporal/at0/oracle/src/at0/result.rs new file mode 100644 index 000000000..1a0cb7bb9 --- /dev/null +++ b/research/atemporal/at0/oracle/src/at0/result.rs @@ -0,0 +1,421 @@ +//! AT0_RESULT writer and exact checker. +//! +//! Result version: AT0_RESULT_V2 per Agent 0's ruling on omega#358 (comment +//! 6090404007, 2026-10-09): header `OMEGA-AT0-RESULT v2`, domain +//! `omega.at0.result.v2`, verdict tag `omega.at0.verdict.v2`, evidence tag +//! `omega.at0.evidence.v2`; `undefined` only for a trivial kernel. Case files +//! stay AT0_CASE_V1. Line shape, checks and codes otherwise follow +//! AT0_RESULT_V1 sections 1 to 7 at aien-architecture 044c9d1. +//! Every check is decided in exact arithmetic on the written tokens (exact.rs). + +use super::case::{Case, Scaled, BOUND_KINDS}; +use super::exact::Exact; +use super::matrix_path::MatrixValues; +use super::reference::RefValues; +use super::sha256::tagged_hex; + +pub const RESULT_HEADER: &str = "OMEGA-AT0-RESULT v2"; +pub const RESULT_DOMAIN: &str = "omega.at0.result.v2"; +pub const RESULT_CONTRACT: &str = "AT0_RESULT_V2"; +pub const VERDICT_DOMAIN: &str = "omega.at0.verdict.v2"; +pub const EVIDENCE_DOMAIN: &str = "omega.at0.evidence.v2"; +pub const CHECK_NAMES: [&str; 10] = [ + "bound_kind_sufficient", + "values_finite", + "physical_state_nontrivial", + "constraint_residual", + "povm_normalization", + "clock_probability_sum", + "probability_range", + "pauli_pair_sum", + "conditional_defined", + "schrodinger_agreement", +]; +pub const AXES: [&str; 3] = ["X", "Y", "Z"]; +pub const SIGNS: [&str; 2] = ["PLUS", "MINUS"]; +pub const PROVENANCE_KEYS: [&str; 13] = [ + "source_repo", + "source_commit", + "source_tree_clean", + "contract_commit", + "engine_sha256", + "oracle_repo", + "oracle_commit", + "oracle_sha256", + "build_cc", + "build_flags", + "host", + "run_started_utc", + "run_finished_utc", +]; + +// ---- tokens -------------------------------------------------------------------- + +pub fn f64_token(x: f64) -> String { + if !x.is_finite() { + return "nonfinite".to_string(); + } + let x = if x == 0.0 { 0.0 } else { x }; // folds -0.0 + format!("f64:{:016x}", x.to_bits()) +} + +/// Exact value of a token; Ok(None) for `undefined` / `nonfinite`. +pub fn value_exact(tok: &str) -> Result, String> { + if tok == "undefined" || tok == "nonfinite" { + return Ok(None); + } + let hex = tok.strip_prefix("f64:").filter(|h| h.len() == 16).ok_or_else(|| format!("bad value token {}", tok))?; + let bits = u64::from_str_radix(hex, 16).map_err(|_| format!("bad value token {}", tok))?; + Exact::from_f64(f64::from_bits(bits)).map(Some).ok_or_else(|| "nonfinite bit pattern".to_string()) +} + +/// Scaled decimal >= b: twenty decimal places, rounded up, plus one unit of slack. +pub fn bound_token(b: f64) -> String { + if b == 0.0 { + return "0@0".to_string(); + } + let n = (b * 1e20).ceil() as u128 + 1; + Scaled::canonical(n, 20).text() +} + +fn scaled_exact(s: &Scaled) -> Exact { + Exact::from_scaled(s.n, s.k) +} + +// ---- values block -------------------------------------------------------------- + +pub fn label_status(p: Option<&Exact>, b: &Exact, tol_zero: &Exact) -> &'static str { + match p { + None => "UNDEFINED", + Some(p) => { + if p.add(b).le(tol_zero) { + "UNDEFINED" + } else if p.sub(b).gt(tol_zero) { + "DEFINED" + } else { + "INDETERMINATE" + } + } + } +} + +pub fn values_block(c: &Case, mat: &MatrixValues, refv: &[RefValues]) -> Vec { + let m = c.labels.len(); + let tol_zero = scaled_exact(&c.tol_zero); + let btok = bound_token(mat.bound); + let bex = Exact::from_f64(mat.bound).unwrap(); + let live = mat.live(); + let mut lines = vec!["begin values".to_string(), format!("physical_state_kernel_dim {}", mat.kernel_dim)]; + match (live, mat.constraint_residual) { + (true, Some(r)) => lines.push(format!("constraint_residual {} {}", f64_token(r), btok)), + _ => lines.push("constraint_residual undefined 0@0".to_string()), + } + lines.push(format!("povm_residual {} {}", f64_token(mat.povm_residual), btok)); + let mut statuses = Vec::with_capacity(m); + for k in 0..m { + let st = if live { + let pe = Exact::from_f64(mat.clock_probability[k]); + label_status(pe.as_ref(), &bex, &tol_zero) + } else { + "UNDEFINED" + }; + statuses.push(st); + lines.push(format!("label {} {} {}", k, c.labels[k], st)); + } + for k in 0..m { + if live { + lines.push(format!("clock_probability {} {} {}", k, f64_token(mat.clock_probability[k]), btok)); + } else { + lines.push(format!("clock_probability {} undefined 0@0", k)); + } + } + for k in 0..m { + for (ax, axn) in AXES.iter().enumerate() { + for (si, sgn) in SIGNS.iter().enumerate() { + if !live { + lines.push(format!("pauli {} {} {} undefined 0@0", k, axn, sgn)); + } else { + // A numerically zero phi_k makes rho_k = 0/0: written as nonfinite, never invented. + let v = mat.pauli[k].map(|p| p[ax][si]).unwrap_or(f64::NAN); + lines.push(format!("pauli {} {} {} {} {}", k, axn, sgn, f64_token(v), btok)); + } + } + } + } + for (k, r) in refv.iter().enumerate() { + let rb = bound_token(r.bound); + for (ax, axn) in AXES.iter().enumerate() { + for (si, sgn) in SIGNS.iter().enumerate() { + lines.push(format!("reference {} {} {} {} {}", k, axn, sgn, f64_token(r.schrodinger[ax][si]), rb)); + } + } + } + lines.push("end values".to_string()); + lines +} + +// ---- parsed values (a verifier's view) ------------------------------------------- + +#[derive(Default)] +pub struct Values { + pub kernel_dim: usize, + pub nonfinite: bool, + pub constraint_residual: Option<(Option, Exact)>, + pub povm_residual: Option<(Option, Exact)>, + pub label: Vec<(usize, String)>, + pub clock_probability: Vec<(usize, Option, Exact)>, + pub pauli: Vec<(usize, usize, usize, Option, Exact)>, + pub reference: Vec<(usize, usize, usize, Option, Exact)>, +} + +fn parse_vb(tok: &str) -> Result<(Option, Exact), String> { + Ok((value_exact(tok)?, Exact::zero())) +} + +/// Parse a values block back into exact numbers. Enforces the V2 rule that +/// `undefined` appears only when the kernel is trivial. +pub fn parse_values(lines: &[String]) -> Result { + let mut v = Values::default(); + let scaled = |t: &str| -> Result { + let s = super::case::parse_scaled(t).map_err(|e| e.detail)?; + Ok(scaled_exact(&s)) + }; + let axis = |t: &str| AXES.iter().position(|a| *a == t).ok_or_else(|| format!("axis {}", t)); + let sign = |t: &str| SIGNS.iter().position(|a| *a == t).ok_or_else(|| format!("sign {}", t)); + for ln in &lines[1..lines.len() - 1] { + let t: Vec<&str> = ln.split(' ').collect(); + if t.contains(&"nonfinite") { + v.nonfinite = true; + } + match t[0] { + "physical_state_kernel_dim" => v.kernel_dim = t[1].parse().map_err(|_| "kernel_dim".to_string())?, + "constraint_residual" => v.constraint_residual = Some((parse_vb(t[1])?.0, scaled(t[2])?)), + "povm_residual" => v.povm_residual = Some((parse_vb(t[1])?.0, scaled(t[2])?)), + "label" => v.label.push((t[1].parse().map_err(|_| "label".to_string())?, t[3].to_string())), + "clock_probability" => v.clock_probability.push((t[1].parse().map_err(|_| "k".to_string())?, value_exact(t[2])?, scaled(t[3])?)), + "pauli" => v.pauli.push((t[1].parse().map_err(|_| "k".to_string())?, axis(t[2])?, sign(t[3])?, value_exact(t[4])?, scaled(t[5])?)), + "reference" => v.reference.push((t[1].parse().map_err(|_| "k".to_string())?, axis(t[2])?, sign(t[3])?, value_exact(t[4])?, scaled(t[5])?)), + _ => return Err(format!("unknown values line {}", ln)), + } + } + let trivial = v.kernel_dim == 0 || v.constraint_residual.as_ref().map(|r| r.0.is_none()).unwrap_or(true); + let has_undef = lines.iter().any(|l| l.contains(" undefined ") || l.ends_with(" undefined")); + if has_undef && !trivial { + return Err("undefined token outside a trivial kernel".to_string()); + } + if v.reference.iter().any(|r| r.3.is_none() && !v.nonfinite) { + return Err("reference value undefined".to_string()); + } + Ok(v) +} + +// ---- checks ------------------------------------------------------------------------ + +fn abs_form(v: &Exact, b: &Exact, tol: &Exact) -> &'static str { + if v.abs().add(b).le(tol) { + "PASS" + } else if v.abs().sub(b).gt(tol) { + "FAIL" + } else { + "INDETERMINATE" + } +} + +fn signed_form(v: &Exact, b: &Exact, tol: &Exact) -> &'static str { + if v.add(b).le(tol) { + "PASS" + } else if v.sub(b).gt(tol) { + "FAIL" + } else { + "INDETERMINATE" + } +} + +fn combine(results: &[&'static str]) -> &'static str { + if results.is_empty() { + "NOT_EVALUATED" + } else if results.contains(&"FAIL") { + "FAIL" + } else if results.contains(&"INDETERMINATE") { + "INDETERMINATE" + } else { + "PASS" + } +} + +pub struct Verdict { + pub checks: Vec<(&'static str, &'static str)>, + pub outcome: &'static str, + pub codes: Vec<&'static str>, +} + +/// Decide the ten checks of section 4 from the written values block. +pub fn judge(c: &Case, vlines: &[String], bound_kind: &str) -> Result { + let v = parse_values(vlines)?; + let (tol_c, tol_p, tol_pr, tol_s) = (scaled_exact(&c.tol_constraint), scaled_exact(&c.tol_povm), scaled_exact(&c.tol_probability), scaled_exact(&c.tol_schrodinger)); + let mut checks: Vec<(&'static str, &'static str)> = Vec::new(); + let mut codes: Vec<&'static str> = Vec::new(); + let set = |name: &'static str, res: &'static str, code: &'static str, checks: &mut Vec<(&'static str, &'static str)>, codes: &mut Vec<&'static str>| { + checks.push((name, res)); + if res == "FAIL" && !codes.contains(&code) { + codes.push(code); + } + if res == "INDETERMINATE" && !codes.contains(&"PRECISION_INSUFFICIENT") { + codes.push("PRECISION_INSUFFICIENT"); + } + }; + let bk = BOUND_KINDS.iter().position(|b| *b == bound_kind).unwrap_or(0); + let mk = BOUND_KINDS.iter().position(|b| *b == c.min_bound_kind).unwrap_or(0); + set("bound_kind_sufficient", if bk >= mk { "PASS" } else { "FAIL" }, "BOUND_KIND_INSUFFICIENT", &mut checks, &mut codes); + set("values_finite", if v.nonfinite { "FAIL" } else { "PASS" }, "NONFINITE_VALUE", &mut checks, &mut codes); + let cr = v.constraint_residual.as_ref().ok_or("missing constraint_residual")?; + let live = v.kernel_dim >= 1 && cr.0.is_some(); + set("physical_state_nontrivial", if live { "PASS" } else { "FAIL" }, "TRIVIAL_PHYSICAL_STATE", &mut checks, &mut codes); + set("constraint_residual", match &cr.0 { Some(x) => abs_form(x, &cr.1, &tol_c), None => "NOT_EVALUATED" }, "CONSTRAINT_RESIDUAL_EXCEEDED", &mut checks, &mut codes); + let pr = v.povm_residual.as_ref().ok_or("missing povm_residual")?; + set("povm_normalization", match &pr.0 { Some(x) => abs_form(x, &pr.1, &tol_p), None => "NOT_EVALUATED" }, "POVM_NORMALIZATION_EXCEEDED", &mut checks, &mut codes); + let all_defined = !v.clock_probability.is_empty() && v.clock_probability.iter().all(|p| p.1.is_some()); + let sum_res = if all_defined { + let mut s = Exact::from_int(-1); + let mut sb = Exact::zero(); + for (_, p, b) in &v.clock_probability { + s = s.add(p.as_ref().unwrap()); + sb = sb.add(b); + } + abs_form(&s, &sb, &tol_pr) + } else { + "NOT_EVALUATED" + }; + set("clock_probability_sum", sum_res, "PROBABILITY_SUM_EXCEEDED", &mut checks, &mut codes); + let mut written: Vec<(&Exact, &Exact)> = Vec::new(); + written.extend(v.clock_probability.iter().filter_map(|(_, p, b)| p.as_ref().map(|p| (p, b)))); + written.extend(v.pauli.iter().filter_map(|(_, _, _, p, b)| p.as_ref().map(|p| (p, b)))); + written.extend(v.reference.iter().filter_map(|(_, _, _, p, b)| p.as_ref().map(|p| (p, b)))); + let one = Exact::from_int(1); + let mut rng = Vec::new(); + for (p, b) in &written { + rng.push(signed_form(&p.neg(), b, &tol_pr)); + rng.push(signed_form(&p.sub(&one), b, &tol_pr)); + } + set("probability_range", combine(&rng), "PROBABILITY_OUT_OF_RANGE", &mut checks, &mut codes); + let defined: Vec = v.label.iter().filter(|(_, st)| st == "DEFINED").map(|(k, _)| *k).collect(); + let find = |list: &[(usize, usize, usize, Option, Exact)], k: usize, ax: usize, si: usize| -> Option<(Option, Exact)> { + list.iter().find(|e| e.0 == k && e.1 == ax && e.2 == si).map(|e| (e.3.clone(), e.4.clone())) + }; + let mut pairs = Vec::new(); + let mut agree = Vec::new(); + for &k in &defined { + for ax in 0..3 { + let (pp, pm) = (find(&v.pauli, k, ax, 0), find(&v.pauli, k, ax, 1)); + if let (Some((Some(a), ba)), Some((Some(b), bb))) = (pp, pm) { + pairs.push(abs_form(&a.add(&b).sub(&one), &ba.add(&bb), &tol_pr)); + } + for si in 0..2 { + if let (Some((Some(a), ba)), Some((Some(r), br))) = (find(&v.pauli, k, ax, si), find(&v.reference, k, ax, si)) { + agree.push(abs_form(&a.sub(&r), &ba.add(&br), &tol_s)); + } + } + } + } + set("pauli_pair_sum", combine(&pairs), "PROBABILITY_SUM_EXCEEDED", &mut checks, &mut codes); + let cond = if live { if v.label.iter().any(|(_, st)| st == "UNDEFINED") { "FAIL" } else { "PASS" } } else { "NOT_EVALUATED" }; + set("conditional_defined", cond, "CONDITIONAL_UNDEFINED", &mut checks, &mut codes); + set("schrodinger_agreement", combine(&agree), "SCHRODINGER_DEVIATION_EXCEEDED", &mut checks, &mut codes); + if v.label.iter().any(|(_, st)| st == "INDETERMINATE") && !codes.contains(&"PRECISION_INSUFFICIENT") { + codes.push("PRECISION_INSUFFICIENT"); + } + codes.sort(); + let outcome = if codes.is_empty() { "PASS" } else { "FAIL" }; + Ok(Verdict { checks, outcome, codes }) +} + +pub fn verdict_block(c: &Case, v: &Verdict) -> Vec { + let mut lines = vec!["begin verdict".to_string()]; + for (name, res) in &v.checks { + lines.push(format!("check {} {}", name, res)); + } + lines.push(format!("outcome {}", v.outcome)); + lines.push(format!("failure_codes {}", if v.codes.is_empty() { "none".to_string() } else { v.codes.join(",") })); + lines.push("error_code none".to_string()); + let mut exp: Vec<&str> = c.expected_codes.iter().map(String::as_str).collect(); + exp.sort(); + let met = v.outcome == c.expected_outcome && exp == v.codes; + lines.push(format!("expectation_met {}", if met { "YES" } else { "NO" })); + lines.push("end verdict".to_string()); + lines +} + +pub fn verdict_id(c: &Case, vlines: &[String]) -> String { + let mut body = format!("case_id {}\nacceptance_id {}\n", c.case_id, c.acceptance_id); + for l in vlines { + body.push_str(l); + body.push('\n'); + } + tagged_hex(VERDICT_DOMAIN, body.as_bytes()) +} + +pub fn evidence_digest(lines_above: &[String]) -> String { + let body: String = lines_above.iter().map(|l| format!("{}\n", l)).collect(); + tagged_hex(EVIDENCE_DOMAIN, body.as_bytes()) +} + +pub struct Computed { + pub matrix: MatrixValues, + pub reference: Vec, + pub values: Vec, + pub verdict: Verdict, + pub verdict_lines: Vec, + pub verdict_id: String, +} + +pub fn compute(c: &Case, dephased: bool) -> Computed { + let matrix = super::matrix_path::evaluate(c, dephased); + let reference = super::reference::evaluate(c); + let values = values_block(c, &matrix, &reference); + let verdict = judge(c, &values, "ESTIMATED").expect("own values block parses"); + let verdict_lines = verdict_block(c, &verdict); + let verdict_id = verdict_id(c, &verdict_lines); + Computed { matrix, reference, values, verdict, verdict_lines, verdict_id } +} + +/// Full result record. `provenance` holds PROVENANCE_KEYS in order. +pub fn result_bytes(c: &Case, computed: &Computed, provenance: &[(&str, String)]) -> Result, String> { + let mut lines = vec![RESULT_HEADER.to_string(), format!("domain {}", RESULT_DOMAIN), format!("contract {}", RESULT_CONTRACT), "case_contract AT0_CASE_V1".to_string(), format!("case_name {}", c.name)]; + lines.extend(c.semantic_block.lines().map(str::to_string)); + lines.extend(c.acceptance_block.lines().map(str::to_string)); + lines.push(format!("case_id {}", c.case_id)); + lines.push(format!("acceptance_id {}", c.acceptance_id)); + lines.push(format!("case_file_sha256 {}", c.file_sha256)); + lines.extend(["begin numerics", "arithmetic BINARY64", "bound_kind ESTIMATED", "threads 1", "end numerics"].iter().map(|s| s.to_string())); + lines.extend(computed.values.iter().cloned()); + lines.extend(computed.verdict_lines.iter().cloned()); + lines.push(format!("verdict_id {}", computed.verdict_id)); + lines.push("begin provenance".to_string()); + if provenance.len() != PROVENANCE_KEYS.len() { + return Err("provenance key count".to_string()); + } + let find = |k: &str| provenance.iter().find(|(key, _)| *key == k).map(|(_, v)| v.as_str()); + if find("engine_sha256") != find("oracle_sha256") { + return Err("engine_sha256 must equal oracle_sha256 (both are the oracle binary)".to_string()); + } + for ((key, val), want) in provenance.iter().zip(PROVENANCE_KEYS.iter()) { + if key != want { + return Err(format!("provenance order: {} vs {}", key, want)); + } + let ok = !val.is_empty() && val.len() <= 200 && val.trim() == val && val.bytes().all(|b| (0x20..=0x7E).contains(&b)); + if !ok { + return Err(format!("bad provenance text for {}", key)); + } + // Agent 0 condition (omega#359 approval): every record this oracle writes is marked + // as oracle output so it can never be cited as the candidate engine's result. + if *key == "build_cc" && !val.starts_with("oracle ") { + return Err("build_cc must begin with \"oracle \"".to_string()); + } + lines.push(format!("{} {}", key, val)); + } + lines.push("end provenance".to_string()); + let ed = evidence_digest(&lines); + lines.push(format!("evidence_digest {}", ed)); + lines.push("end".to_string()); + Ok(lines.iter().map(|l| format!("{}\n", l)).collect::().into_bytes()) +} diff --git a/research/atemporal/at0/oracle/src/at0/sha256.rs b/research/atemporal/at0/oracle/src/at0/sha256.rs new file mode 100644 index 000000000..3e2e815ae --- /dev/null +++ b/research/atemporal/at0/oracle/src/at0/sha256.rs @@ -0,0 +1,99 @@ +//! SHA-256 (FIPS 180-4), written here so the oracle shares no digest code with +//! the engine or with omega's src/sha256.c. Verified against the contract's +//! published known-answer digests and the "abc" test vector. + +const K: [u32; 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, +]; + +pub fn sha256(data: &[u8]) -> [u8; 32] { + let mut h: [u32; 8] = [ + 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19, + ]; + let mut msg = data.to_vec(); + let bitlen = (data.len() as u64).wrapping_mul(8); + msg.push(0x80); + while msg.len() % 64 != 56 { + msg.push(0); + } + msg.extend_from_slice(&bitlen.to_be_bytes()); + for chunk in msg.chunks(64) { + let mut w = [0u32; 64]; + for i in 0..16 { + w[i] = u32::from_be_bytes([chunk[4 * i], chunk[4 * i + 1], chunk[4 * i + 2], chunk[4 * i + 3]]); + } + for i in 16..64 { + let s0 = w[i - 15].rotate_right(7) ^ w[i - 15].rotate_right(18) ^ (w[i - 15] >> 3); + let s1 = w[i - 2].rotate_right(17) ^ w[i - 2].rotate_right(19) ^ (w[i - 2] >> 10); + w[i] = w[i - 16].wrapping_add(s0).wrapping_add(w[i - 7]).wrapping_add(s1); + } + let [mut a, mut b, mut c, mut d, mut e, mut f, mut g, mut hh] = h; + for i in 0..64 { + let s1 = e.rotate_right(6) ^ e.rotate_right(11) ^ e.rotate_right(25); + let ch = (e & f) ^ (!e & g); + let t1 = hh.wrapping_add(s1).wrapping_add(ch).wrapping_add(K[i]).wrapping_add(w[i]); + let s0 = a.rotate_right(2) ^ a.rotate_right(13) ^ a.rotate_right(22); + let maj = (a & b) ^ (a & c) ^ (b & c); + let t2 = s0.wrapping_add(maj); + hh = g; + g = f; + f = e; + e = d.wrapping_add(t1); + d = c; + c = b; + b = a; + a = t1.wrapping_add(t2); + } + for (slot, v) in h.iter_mut().zip([a, b, c, d, e, f, g, hh]) { + *slot = slot.wrapping_add(v); + } + } + let mut out = [0u8; 32]; + for (i, v) in h.iter().enumerate() { + out[4 * i..4 * i + 4].copy_from_slice(&v.to_be_bytes()); + } + out +} + +pub fn hex(bytes: &[u8]) -> String { + const DIGITS: &[u8; 16] = b"0123456789abcdef"; + let mut s = String::with_capacity(bytes.len() * 2); + for b in bytes { + s.push(DIGITS[(b >> 4) as usize] as char); + s.push(DIGITS[(b & 15) as usize] as char); + } + s +} + +pub fn sha256_hex(data: &[u8]) -> String { + hex(&sha256(data)) +} + +/// Domain-separated digest: SHA-256(domain || 0x00 || body). +pub fn tagged_hex(domain: &str, body: &[u8]) -> String { + let mut buf = Vec::with_capacity(domain.len() + 1 + body.len()); + buf.extend_from_slice(domain.as_bytes()); + buf.push(0); + buf.extend_from_slice(body); + sha256_hex(&buf) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_vectors() { + assert_eq!(sha256_hex(b"abc"), "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"); + assert_eq!(sha256_hex(b""), "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"); + let long = vec![b'a'; 1000]; + assert_eq!(sha256_hex(&long), "41edece42d63e8d9bf515a9ba6932e1c20cbc9f5a5d134645adb5db1b9737ea3"); + } +} diff --git a/research/atemporal/at0/oracle/src/main.rs b/research/atemporal/at0/oracle/src/main.rs new file mode 100644 index 000000000..b5f6cd33b --- /dev/null +++ b/research/atemporal/at0/oracle/src/main.rs @@ -0,0 +1,532 @@ +//! AT-0 reference oracle, outer layer: the only place that touches files, the +//! process table and the wall clock. Everything that computes lives in src/at0/. +//! +//! Usage: +//! at0-oracle emit [--dephased] [-o ] write an AT0_RESULT_V2 record +//! at0-oracle fixtures write the calibration fixtures +//! at0-oracle check validate only; print case_id +//! A refused case prints exactly `AT0_CASE_REFUSED ` on stderr and exits 2. + +mod at0; + +use at0::case::{parse_case, CONTRACT_COMMIT}; +use at0::result::{compute, result_bytes, PROVENANCE_KEYS}; +use at0::sha256::sha256_hex; +use std::io::Write; +use std::process::Command; +use std::time::{SystemTime, UNIX_EPOCH}; + +fn git(args: &[&str]) -> Option { + let dir = std::env::current_exe().ok()?.parent()?.parent()?.to_path_buf(); + let out = Command::new("git").args(args).current_dir(dir).output().ok()?; + if out.status.success() { + Some(String::from_utf8_lossy(&out.stdout).trim().to_string()) + } else { + None + } +} + +/// UTC timestamp at second resolution without any calendar library. +fn utc_now() -> String { + let secs = SystemTime::now().duration_since(UNIX_EPOCH).map(|d| d.as_secs() as i64).unwrap_or(0); + let (days, rem) = (secs.div_euclid(86400), secs.rem_euclid(86400)); + let (h, m, s) = (rem / 3600, (rem % 3600) / 60, rem % 60); + // civil from days (Howard Hinnant) + let z = days + 719468; + let era = z.div_euclid(146097); + let doe = z.rem_euclid(146097); + let yoe = (doe - doe / 1460 + doe / 36524 - doe / 146096) / 365; + let y = yoe + era * 400; + let doy = doe - (365 * yoe + yoe / 4 - yoe / 100); + let mp = (5 * doy + 2) / 153; + let d = doy - (153 * mp + 2) / 5 + 1; + let mo = if mp < 10 { mp + 3 } else { mp - 9 }; + let y = if mo <= 2 { y + 1 } else { y }; + format!("{:04}-{:02}-{:02}T{:02}:{:02}:{:02}Z", y, mo, d, h, m, s) +} + +fn hostname() -> String { + std::fs::read_to_string("/etc/hostname").map(|s| s.trim().to_string()).ok().filter(|s| !s.is_empty()).unwrap_or_else(|| "unknown".to_string()) +} + +fn exe_sha256() -> String { + std::env::current_exe().ok().and_then(|p| std::fs::read(p).ok()).map(|b| sha256_hex(&b)).unwrap_or_else(|| "0".repeat(64)) +} + +fn emit(args: &[String]) -> i32 { + let dephased = args.iter().any(|a| a == "--dephased"); + let out_path = args.iter().position(|a| a == "-o").and_then(|i| args.get(i + 1)).cloned(); + let inputs: Vec<&String> = args.iter().filter(|a| !a.starts_with('-') && Some(*a) != out_path.as_ref()).collect(); + if inputs.len() != 1 { + eprintln!("usage: at0-oracle emit [--dephased] [-o ]"); + return 1; + } + let started = utc_now(); + let data = match std::fs::read(inputs[0]) { + Ok(d) => d, + Err(e) => { + eprintln!("cannot read {}: {}", inputs[0], e); + return 1; + } + }; + let case = match parse_case(&data) { + Ok(c) => c, + Err(r) => { + eprintln!("AT0_CASE_REFUSED {}", r.code); + return 2; + } + }; + let computed = compute(&case, dephased); + let commit = git(&["rev-parse", "HEAD"]); + let dirty = git(&["status", "--porcelain", "--", "."]).map(|s| !s.is_empty()).unwrap_or(true); + let exe = exe_sha256(); + let rustc = option_env!("AT0_RUSTC_VERSION").unwrap_or("rustc unknown (built without build.sh)"); + let flags = option_env!("AT0_BUILD_FLAGS").unwrap_or("unknown"); + let values: Vec = vec![ + "aien-dev/omega".to_string(), + commit.clone().unwrap_or_else(|| "0".repeat(40)), + if commit.is_some() && !dirty { "YES" } else { "NO" }.to_string(), + CONTRACT_COMMIT.to_string(), + exe.clone(), + "aien-dev/omega".to_string(), + commit.unwrap_or_else(|| "0".repeat(40)), + exe, + format!("oracle {} {}{}", rustc, option_env!("AT0_RUSTC_HOST").unwrap_or("unknown-host"), if dephased { " (dephased control)" } else { "" }), + format!("rustc {} src/main.rs", flags), + hostname(), + started, + utc_now(), + ]; + let prov: Vec<(&str, String)> = PROVENANCE_KEYS.iter().cloned().zip(values).collect(); + let record = match result_bytes(&case, &computed, &prov) { + Ok(r) => r, + Err(e) => { + eprintln!("internal: {}", e); + return 1; + } + }; + match out_path { + Some(p) => std::fs::write(&p, &record).map(|_| 0).unwrap_or_else(|e| { + eprintln!("cannot write {}: {}", p, e); + 1 + }), + None => std::io::stdout().write_all(&record).map(|_| 0).unwrap_or(1), + } +} + +fn fixtures(dir: &str) -> i32 { + if let Err(e) = std::fs::create_dir_all(dir) { + eprintln!("cannot create {}: {}", dir, e); + return 1; + } + let rendered = at0::fixtures::render(); + for (name, bytes) in &rendered.files { + if let Err(e) = std::fs::write(format!("{}/{}", dir, name), bytes) { + eprintln!("cannot write {}: {}", name, e); + return 1; + } + } + println!("wrote {} files to {}", rendered.files.len(), dir); + for line in &rendered.summary { + println!("{}", line); + } + 0 +} + +fn check(path: &str) -> i32 { + let data = match std::fs::read(path) { + Ok(d) => d, + Err(e) => { + eprintln!("cannot read {}: {}", path, e); + return 1; + } + }; + match parse_case(&data) { + Ok(c) => { + println!("case_id {}\nacceptance_id {}\ncase_file_sha256 {}", c.case_id, c.acceptance_id, c.file_sha256); + 0 + } + Err(r) => { + eprintln!("AT0_CASE_REFUSED {}", r.code); + 2 + } + } +} + +fn main() { + let args: Vec = std::env::args().skip(1).collect(); + let code = match args.first().map(String::as_str) { + Some("emit") => emit(&args[1..]), + Some("fixtures") if args.len() == 2 => fixtures(&args[1]), + Some("check") if args.len() == 2 => check(&args[1]), + _ => { + eprintln!("usage: at0-oracle emit [--dephased] [-o out] | fixtures | check "); + 1 + } + }; + std::process::exit(code); +} + +#[cfg(test)] +mod tests { + use super::at0::case::{build_case, kernel_pairs, parse_case, Acceptance, Scaled}; + use super::at0::complex::{add_scaled, frobenius, trace}; + use super::at0::matrix_path::{self as mp, EPS}; + use super::at0::rational::Rat; + use super::at0::result::{self, compute, f64_token, parse_values, result_bytes, value_exact, PROVENANCE_KEYS}; + use super::at0::exact::Exact; + + const KAT_CASE_ID: &str = "3cf4ca4f882b5b9691ddcd905e65e15010855adcd2be200e19ebc3184655b44d"; + const KAT_ACC_ID: &str = "a13fb02dd674b8042ef8c0a197f03d58768709f782ba59cd26545eef6d41a228"; + const KAT_FILE: &str = "ed16c95c89bf312b0fbf95a4cd43bc352daa138954fabad78d8a170cd35b4e81"; + const TOL: f64 = 1e-12; + + fn r(n: i128, d: i128) -> Rat { + Rat::new(n, d) + } + fn plus() -> [(Rat, Rat); 2] { + [(r(1, 1), r(0, 1)), (r(1, 1), r(0, 1))] + } + fn clock(n: usize) -> Vec { + (0..n).map(|j| r(2 * j as i128 - (n as i128 - 1), 2)).collect() + } + fn zhalf() -> [Rat; 4] { + [r(0, 1), r(0, 1), r(0, 1), r(1, 2)] + } + fn labels(m: usize) -> Vec { + (0..m).map(|k| format!("t{}", k)).collect() + } + fn ideal(n: usize, pauli: Option<[Rat; 4]>, acc: &Acceptance) -> Vec { + let p = pauli.unwrap_or(if n % 2 == 0 { zhalf() } else { [r(0, 1), r(0, 1), r(0, 1), r(1, 1)] }); + let lb = labels(n); + let lbs: Vec<&str> = lb.iter().map(String::as_str).collect(); + build_case(&format!("ideal-n{}", n), &clock(n), p, "t0", plus(), r(1, n as i128), r(1, 1), &lbs, acc) + } + fn kat() -> Vec { + build_case("at0-kat-ideal-qubit-n4", &clock(4), zhalf(), "t0", plus(), r(1, 4), r(1, 1), &["t0", "t1", "t2", "t3"], &Acceptance::positive()) + } + fn close(a: f64, b: f64) -> bool { + (a - b).abs() <= TOL + } + fn replace(data: &[u8], from: &str, to: &str) -> Vec { + String::from_utf8(data.to_vec()).unwrap().replace(from, to).into_bytes() + } + fn refuses(data: &[u8], code: &str) { + match parse_case(data) { + Err(e) => assert_eq!(e.code, code, "{:?}", e), + Ok(_) => panic!("expected refusal {}", code), + } + } + /// Parses, computes, asserts PASS and three-way agreement of the paths. + fn all_paths_agree(data: &[u8]) -> (super::at0::case::Case, result::Computed) { + let c = parse_case(data).unwrap(); + let comp = compute(&c, false); + assert_eq!(comp.verdict.outcome, "PASS", "{} {:?}", c.name, comp.verdict.codes); + for k in 0..c.labels.len() { + let p = comp.matrix.pauli[k].unwrap(); + for ax in 0..3 { + for si in 0..2 { + assert!(close(p[ax][si], comp.reference[k].schrodinger[ax][si]), "{} k={} ax={} si={}", c.name, k, ax, si); + assert!(close(p[ax][si], comp.reference[k].bloch[ax][si]), "{} bloch k={} ax={}", c.name, k, ax); + } + } + } + (c, comp) + } + + #[test] + fn known_answer_digests_and_kernel() { + let c = parse_case(&kat()).unwrap(); + assert_eq!(c.file_sha256, KAT_FILE); + assert_eq!(c.case_id, KAT_CASE_ID); + assert_eq!(c.acceptance_id, KAT_ACC_ID); + assert_eq!(c.eigenvalues, [r(1, 2), r(-1, 2)]); + assert_eq!(kernel_pairs(&c), vec![(1, 0), (2, 1)]); + } + + #[test] + fn refusals_in_contract_order() { + refuses(&replace(&kat(), "OMEGA-AT0-CASE v1", "OMEGA-AT0-CASE v2"), "CASE_UNSUPPORTED_VERSION"); + refuses(&replace(&kat(), "domain omega.at0.case.v1", "domain omega.at0.case.v9"), "CASE_UNSUPPORTED_VERSION"); + let mut cut = kat(); + cut.pop(); + refuses(&cut, "CASE_PARSE_ERROR"); + refuses(&replace(&kat(), "povm_weight 1/1", "povm_weight 1/1"), "CASE_PARSE_ERROR"); + refuses(&replace(&kat(), "\n", "\r\n"), "CASE_PARSE_ERROR"); + refuses(&replace(&kat(), "povm_weight 1/1", "povm_weight 2/2"), "CASE_NONCANONICAL"); + refuses(&replace(&kat(), "povm_tau_turns 1/4", "povm_tau_turns 1/4\npovm_tau_turns 1/4"), "CASE_PARSE_ERROR"); + refuses(&replace(&kat(), "tol_probability 1@12", "tol_probability 10@13"), "CASE_NONCANONICAL"); + refuses(&replace(&kat(), "clock_energies -3/2", "clock_energies 3/2"), "CASE_INVALID_PARAMETER"); // duplicate energy: parameter rule precedes identity + let l4 = ["t0", "t1", "t2", "t3"]; + refuses(&build_case("z", &clock(4), zhalf(), "t0", [(r(0, 1), r(0, 1)), (r(0, 1), r(0, 1))], r(1, 4), r(1, 1), &l4, &Acceptance::positive()), "CASE_INVALID_PARAMETER"); + refuses(&build_case("w", &clock(4), zhalf(), "t0", plus(), r(1, 4), r(0, 1), &l4, &Acceptance::positive()), "CASE_INVALID_PARAMETER"); + refuses(&build_case("e", &[r(1, 2), r(-1, 2)], zhalf(), "t0", plus(), r(1, 2), r(1, 1), &["t0", "t1"], &Acceptance::positive()), "CASE_INVALID_PARAMETER"); + refuses(&build_case("r", &clock(4), zhalf(), "t9", plus(), r(1, 4), r(1, 1), &l4, &Acceptance::positive()), "CASE_INVALID_PARAMETER"); + refuses(&build_case("d", &clock(4), zhalf(), "t0", plus(), r(1, 4), r(1, 1), &["t0", "t0", "t2", "t3"], &Acceptance::positive()), "CASE_INVALID_PARAMETER"); + refuses(&build_case("irr", &clock(4), [r(0, 1), r(1, 1), r(0, 1), r(1, 1)], "t0", plus(), r(1, 4), r(1, 1), &l4, &Acceptance::positive()), "CASE_IRRATIONAL_SPECTRUM"); + refuses(&replace(&kat(), "case_id 3cf4", "case_id 0cf4"), "CASE_ID_MISMATCH"); + refuses(&replace(&kat(), "expected_failure_codes none", "expected_failure_codes NOT_A_CODE"), "CASE_ID_MISMATCH"); + refuses(&ideal(4, None, &Acceptance { expected_codes: vec!["TRIVIAL_PHYSICAL_STATE"], ..Acceptance::positive() }), "CASE_INVALID_PARAMETER"); + refuses(&ideal(4, None, &Acceptance::negative(&["NOT_A_CODE"])), "CASE_INVALID_PARAMETER"); + refuses(&ideal(4, None, &Acceptance::negative(&["TRIVIAL_PHYSICAL_STATE", "NONFINITE_VALUE"])), "CASE_INVALID_PARAMETER"); + let big = build_case("big", &(0..65).map(|j| r(j, 1)).collect::>(), zhalf(), "t0", plus(), r(1, 4), r(1, 1), &l4, &Acceptance::positive()); + refuses(&big, "CASE_INVALID_PARAMETER"); + } + + #[test] + fn case_name_outside_identity_and_tokens() { + let a = parse_case(&kat()).unwrap(); + let b = parse_case(&replace(&kat(), "case_name at0-kat-ideal-qubit-n4", "case_name renamed")).unwrap(); + assert_eq!(a.case_id, b.case_id); + assert_ne!(a.file_sha256, b.file_sha256); + for tok in ["0@0", "1@12", "1421086@20", "5@0", "123@3"] { + let s = super::at0::case::parse_scaled(tok).unwrap(); + assert_eq!(Scaled::canonical(s.n, s.k).text(), tok); + } + assert_eq!(f64_token(-0.0), "f64:0000000000000000"); + assert_eq!(f64_token(f64::INFINITY), "nonfinite"); + assert_eq!(value_exact(&f64_token(0.1)).unwrap().unwrap(), Exact::from_f64(0.1).unwrap()); + assert_eq!(result::bound_token(0.0), "0@0"); + assert!(super::at0::case::parse_scaled(&result::bound_token(1.4210854715202004e-14)).is_ok()); + } + + #[test] + fn reference_model_hand_table() { + let c = parse_case(&kat()).unwrap(); + let comp = compute(&c, false); + let m = &comp.matrix; + assert_eq!(m.kernel_dim, 2); + assert!(m.constraint_residual.unwrap() <= TOL); + assert!(close(super::at0::complex::vnorm2(&mp::physical_state(&c)), 0.5)); // ||psi_0||^2 / N + assert!(m.povm_residual <= TOL); + for p in &m.clock_probability { + assert!(close(*p, 0.25)); + } + assert!(close(m.clock_probability.iter().sum::(), 1.0)); + let table: [[f64; 3]; 4] = [[1.0, 0.5, 0.5], [0.5, 1.0, 0.5], [0.0, 0.5, 0.5], [0.5, 0.0, 0.5]]; + for (k, row) in table.iter().enumerate() { + let pk = m.pauli[k].unwrap(); + for ax in 0..3 { + assert!(close(pk[ax][0], row[ax]), "k={} ax={}", k, ax); + assert!(close(pk[ax][1], 1.0 - row[ax]), "k={} ax={}", k, ax); + assert!(close(comp.reference[k].schrodinger[ax][0], row[ax])); + assert!(close(comp.reference[k].bloch[ax][0], row[ax])); + } + } + assert_eq!(comp.verdict.outcome, "PASS"); + assert!(comp.verdict.codes.is_empty()); + assert!(comp.verdict.checks.iter().all(|(_, r)| *r == "PASS")); + assert!(comp.verdict_lines.contains(&"expectation_met YES".to_string())); + } + + #[test] + fn density_matrix_properties_and_routes() { + let c = parse_case(&kat()).unwrap(); + let comp = compute(&c, false); + let psi = mp::physical_state(&c); + let rr = mp::density_from_vector(&psi); + for k in 0..4 { + let rho = comp.matrix.rho[k].as_ref().unwrap(); + assert!(mp::hermiticity_defect(rho) <= TOL); + assert!(close(trace(rho).re, 1.0)); + let (lo, hi) = mp::eigenvalues_2x2_hermitian(rho); + assert!(lo >= -TOL && hi <= 1.0 + TOL); + for v in comp.matrix.pauli[k].unwrap().iter().flatten() { + assert!(*v >= -TOL && *v <= 1.0 + TOL); + } + let (p, rho2) = mp::conditional_from_density(&c, &rr, k); + assert!(close(p, comp.matrix.clock_probability[k])); + assert!(frobenius(&add_scaled(&rho2.unwrap(), rho, -1.0)) <= TOL); + } + } + + #[test] + fn multiple_n_offsets_phases_tilts() { + for n in [3usize, 4, 5, 6, 8, 12] { + let (_, comp) = all_paths_agree(&ideal(n, None, &Acceptance::positive())); + assert_eq!(comp.matrix.kernel_dim, 2); + assert!(comp.matrix.povm_residual <= TOL); + for p in &comp.matrix.clock_probability { + assert!(close(*p, 1.0 / n as f64)); + } + } + let l4 = ["t0", "t1", "t2", "t3"]; + let base = compute(&parse_case(&kat()).unwrap(), false); + for (shift, lb) in [(1usize, "t1"), (2, "t2"), (3, "t3")] { + let (_, comp) = all_paths_agree(&build_case("offset", &clock(4), zhalf(), lb, plus(), r(1, 4), r(1, 1), &l4, &Acceptance::positive())); + for k in 0..4 { + let (a, b) = (comp.matrix.pauli[k].unwrap(), base.matrix.pauli[(k + 4 - shift) % 4].unwrap()); + for ax in 0..3 { + assert!(close(a[ax][0], b[ax][0]), "offset {} k={} ax={}", lb, k, ax); + } + } + } + all_paths_agree(&build_case("tilted", &clock(4), [r(0, 1), r(3, 10), r(0, 1), r(2, 5)], "t0", plus(), r(1, 4), r(1, 1), &l4, &Acceptance::positive())); + all_paths_agree(&build_case("tilted-y", &clock(4), [r(0, 1), r(3, 10), r(2, 5), r(0, 1)], "t0", [(r(1, 1), r(0, 1)), (r(0, 1), r(1, 1))], r(1, 4), r(1, 1), &l4, &Acceptance::positive())); + let (c, comp) = all_paths_agree(&build_case("h0", &[r(-1, 1), r(0, 1), r(1, 1), r(2, 1)], [r(1, 2), r(3, 10), r(0, 1), r(2, 5)], "t0", plus(), r(1, 4), r(1, 1), &l4, &Acceptance::positive())); + assert_eq!(c.eigenvalues, [r(1, 1), r(0, 1)]); + assert_eq!(comp.matrix.kernel_dim, 2); + for st in [[(r(0, 1), r(1, 1)), (r(0, 1), r(1, 1))], [(r(-1, 1), r(0, 1)), (r(-1, 1), r(0, 1))], [(r(2, 1), r(0, 1)), (r(2, 1), r(0, 1))], [(r(0, 1), r(-3, 1)), (r(0, 1), r(-3, 1))]] { + let (_, comp) = all_paths_agree(&build_case("phase", &clock(4), zhalf(), "t0", st, r(1, 4), r(1, 1), &l4, &Acceptance::positive())); + for k in 0..4 { + assert!(close(comp.matrix.clock_probability[k], 0.25)); + for ax in 0..3 { + assert!(close(comp.matrix.pauli[k].unwrap()[ax][0], base.matrix.pauli[k].unwrap()[ax][0])); + } + } + } + } + + #[test] + fn negative_controls() { + let l4 = ["t0", "t1", "t2", "t3"]; + // dephased stationary mixture: clock correlations without interference + let c = parse_case(&kat()).unwrap(); + let d = compute(&c, true); + assert_eq!(d.verdict.outcome, "FAIL"); + assert_eq!(d.verdict.codes, vec!["SCHRODINGER_DEVIATION_EXCEEDED"]); + assert!(d.verdict.checks.contains(&("povm_normalization", "PASS"))); + assert!(d.verdict.checks.contains(&("conditional_defined", "PASS"))); + for k in 0..4 { + assert!(close(d.matrix.clock_probability[k], 0.25)); + let p = d.matrix.pauli[k].unwrap(); + assert!(close(p[0][0], 0.5) && close(p[1][0], 0.5) && close(p[2][0], 0.5)); + assert!(mp::hermiticity_defect(d.matrix.rho[k].as_ref().unwrap()) <= TOL); + } + assert!(!close(compute(&c, false).matrix.pauli[0].unwrap()[0][0], 0.5)); + // N1 uncovered + let n1 = compute(&parse_case(&build_case("n1", &[r(1, 1), r(2, 1), r(3, 1), r(4, 1)], zhalf(), "t0", plus(), r(1, 4), r(1, 1), &l4, &Acceptance::negative(&["TRIVIAL_PHYSICAL_STATE"]))).unwrap(), false); + assert_eq!(n1.verdict.codes, vec!["TRIVIAL_PHYSICAL_STATE"]); + assert!(n1.verdict.checks.contains(&("constraint_residual", "NOT_EVALUATED"))); + assert!(n1.verdict_lines.contains(&"expectation_met YES".to_string())); + assert!(n1.values.iter().filter(|l| l.contains(" undefined 0@0")).count() == 1 + 4 + 24); + // N2 half covered + let n2 = compute(&parse_case(&build_case("n2", &[r(1, 2), r(3, 2), r(5, 2), r(7, 2)], zhalf(), "t0", plus(), r(1, 4), r(1, 1), &l4, &Acceptance::negative(&["SCHRODINGER_DEVIATION_EXCEEDED"]))).unwrap(), false); + assert_eq!(n2.matrix.kernel_dim, 1); + assert_eq!(n2.verdict.codes, vec!["SCHRODINGER_DEVIATION_EXCEEDED"]); + for k in 0..4 { + assert!(close(n2.matrix.pauli[k].unwrap()[2][0], 0.0)); + } + // N4 wrong weight + let n4 = compute(&parse_case(&build_case("n4", &clock(4), zhalf(), "t0", plus(), r(1, 4), r(2, 1), &l4, &Acceptance::negative(&["POVM_NORMALIZATION_EXCEEDED", "PROBABILITY_SUM_EXCEEDED"]))).unwrap(), false); + assert_eq!(n4.verdict.codes, vec!["POVM_NORMALIZATION_EXCEEDED", "PROBABILITY_SUM_EXCEEDED"]); + assert!(n4.verdict_lines.contains(&"expectation_met YES".to_string())); + // N3 broken clock with the right weight: only the POVM check fails + let n3 = compute(&parse_case(&build_case("n3", &clock(4), zhalf(), "t0", plus(), r(1, 3), r(1, 1), &l4, &Acceptance::positive())).unwrap(), false); + assert_eq!(n3.verdict.codes, vec!["POVM_NORMALIZATION_EXCEEDED"]); + assert!(n3.verdict_lines.contains(&"expectation_met NO".to_string())); + // N5 precision demand + let mut rig = Acceptance::positive(); + rig.min_bound_kind = "RIGOROUS"; + let n5 = compute(&parse_case(&build_case("n5", &clock(4), zhalf(), "t0", plus(), r(1, 4), r(1, 1), &l4, &rig)).unwrap(), false); + assert_eq!(n5.verdict.codes, vec!["BOUND_KIND_INSUFFICIENT"]); + } + + /// AT0_SPEC draft (aien-architecture#176 at SPEC_DRAFT_COMMIT): two-level clock, + /// H_S = diag(0, 1): P(X+) = (1 + cos th)/2, P(Y+) = (1 - sin th)/2, P(Z+) = 1/2, p_k = 1/4. + #[test] + fn spec_draft_reference_model() { + let l4 = ["t0", "t1", "t2", "t3"]; + let spec = |state: [(Rat, Rat); 2], w: Rat, m: usize, acc: &Acceptance| build_case("spec", &[r(-1, 1), r(0, 1)], [r(1, 2), r(0, 1), r(0, 1), r(-1, 2)], "t0", state, r(1, 4), w, &l4[..m], acc); + let (c, comp) = all_paths_agree(&spec(plus(), r(1, 2), 4, &Acceptance::positive())); + assert_eq!(c.eigenvalues, [r(1, 1), r(0, 1)]); + assert!(comp.matrix.constraint_residual.unwrap() <= 4.0 * EPS); + assert!(comp.matrix.povm_residual <= 12.0 * EPS); + let want = [[1.0, 0.5], [0.5, 0.0], [0.0, 0.5], [0.5, 1.0]]; + for (k, w) in want.iter().enumerate() { + let p = comp.matrix.pauli[k].unwrap(); + assert!(close(p[0][0], w[0]) && close(p[1][0], w[1]) && close(p[2][0], 0.5), "k={}", k); + assert!(close(comp.matrix.clock_probability[k], 0.25)); + let purity: f64 = (0..3).map(|ax| (2.0 * p[ax][0] - 1.0).powi(2)).sum(); + assert!(close(purity, 1.0)); // spec invariant I8 + } + let (_, t4) = all_paths_agree(&spec([(r(1, 1), r(0, 1)), (r(0, 1), r(0, 1))], r(1, 2), 4, &Acceptance::positive())); + for k in 0..4 { + assert!(close(t4.matrix.pauli[k].unwrap()[2][0], 1.0) && close(t4.matrix.pauli[k].unwrap()[0][0], 0.5)); + } + let (_, t5) = all_paths_agree(&spec([(r(1, 1), r(0, 1)), (r(0, 1), r(1, 1))], r(1, 2), 4, &Acceptance::positive())); + for k in 0..4 { + for ax in 0..3 { + assert!(close(t5.matrix.pauli[k].unwrap()[ax][0], comp.matrix.pauli[(k + 3) % 4].unwrap()[ax][0]), "t5 k={}", k); // theta -> theta - pi/2 + } + } + let n3 = compute(&parse_case(&spec(plus(), r(1, 4), 4, &Acceptance::positive())).unwrap(), false); + assert!(close(n3.matrix.povm_residual, 0.5f64.sqrt())); + assert!(close(n3.matrix.clock_probability.iter().sum::(), 0.5)); + assert_eq!(n3.verdict.codes, vec!["POVM_NORMALIZATION_EXCEEDED", "PROBABILITY_SUM_EXCEEDED"]); + let n4 = compute(&parse_case(&spec(plus(), r(1, 2), 3, &Acceptance::positive())).unwrap(), false); + assert!(close(n4.matrix.povm_residual, 0.5)); + assert!(close(n4.matrix.clock_probability.iter().sum::(), 0.75)); + assert_eq!(n4.verdict.codes, vec!["POVM_NORMALIZATION_EXCEEDED", "PROBABILITY_SUM_EXCEEDED"]); + } + + fn provenance(stamp: &str) -> Vec<(&'static str, String)> { + let vals = ["aien-dev/omega", "0000000000000000000000000000000000000000", "NO", super::CONTRACT_COMMIT, &"1".repeat(64), "aien-dev/omega", "0000000000000000000000000000000000000000", &"1".repeat(64), "oracle rustc test", "std", "test", stamp, stamp]; + PROVENANCE_KEYS.iter().cloned().zip(vals.iter().map(|s| s.to_string())).collect() + } + + #[test] + fn record_shape_and_wall_clock_independence() { + let c = parse_case(&kat()).unwrap(); + let comp = compute(&c, false); + let a = result_bytes(&c, &comp, &provenance("2026-10-09T00:00:00Z")).unwrap(); + let b = result_bytes(&c, &comp, &provenance("2026-10-10T12:34:56Z")).unwrap(); + for data in [&a, &b] { + let text = String::from_utf8(data.clone()).unwrap(); + let lines: Vec<&str> = text.split('\n').collect(); + assert_eq!(lines[0], "OMEGA-AT0-RESULT v2"); + assert_eq!(lines[1], "domain omega.at0.result.v2"); + assert_eq!(lines[2], "contract AT0_RESULT_V2"); + assert_eq!(lines[lines.len() - 1], ""); + assert_eq!(lines[lines.len() - 2], "end"); + let ed = lines[lines.len() - 3].strip_prefix("evidence_digest ").unwrap(); + let above: Vec = lines[..lines.len() - 3].iter().map(|s| s.to_string()).collect(); + assert_eq!(result::evidence_digest(&above), ed); + assert!(lines.contains(&"threads 1")); + assert!(text.bytes().all(|b| b == b'\n' || (0x20..=0x7E).contains(&b))); + } + let pick = |d: &Vec, key: &str| String::from_utf8(d.clone()).unwrap().lines().find(|l| l.starts_with(key)).unwrap().to_string(); + // Agent 0 condition: records are marked as oracle output or not written at all + let mut p = provenance("2026-10-09T00:00:00Z"); + p[8].1 = "rustc test".to_string(); + assert!(result_bytes(&c, &comp, &p).is_err()); + let mut p = provenance("2026-10-09T00:00:00Z"); + p[7].1 = "2".repeat(64); + assert!(result_bytes(&c, &comp, &p).is_err()); + assert!(String::from_utf8(a.clone()).unwrap().contains("\nbuild_cc oracle ")); + assert_eq!(pick(&a, "verdict_id"), pick(&b, "verdict_id")); + assert_ne!(pick(&a, "evidence_digest"), pick(&b, "evidence_digest")); + assert_eq!(comp.verdict_id, result::verdict_id(&c, &comp.verdict_lines)); + let v = parse_values(&comp.values).unwrap(); + assert_eq!(v.kernel_dim, 2); + assert_eq!(v.pauli[0].3.clone().unwrap(), Exact::from_int(1)); + let mut s = Exact::zero(); + for (_, p, _) in &v.clock_probability { + s = s.add(p.as_ref().unwrap()); + } + assert_eq!(s, Exact::from_int(1)); + // V2 rule: undefined outside a trivial kernel is refused by the parser + let mut bad = comp.values.clone(); + bad[3] = "label 0 t0 UNDEFINED".to_string(); + let idx = bad.iter().position(|l| l.starts_with("pauli 0 X PLUS")).unwrap(); + bad[idx] = "pauli 0 X PLUS undefined 0@0".to_string(); + assert!(parse_values(&bad).is_err()); + } + + #[test] + fn fixtures_render_and_meet_expectations() { + let rendered = super::at0::fixtures::render(); + assert_eq!(rendered.files.len(), 21 * 2 + 1); + for f in super::at0::fixtures::catalogue() { + let c = parse_case(&f.case).unwrap(); + let comp = compute(&c, f.dephased); + assert!(comp.verdict_lines.contains(&"expectation_met YES".to_string()), "{}", f.name); + let (checked, worst) = super::at0::fixtures::calibrate(&f, &comp); + if f.expected.is_some() { + assert!(checked > 0 && worst <= 1e-15, "{} checked={} worst={:e}", f.name, checked, worst); + } + } + let kat_file = rendered.files.iter().find(|(n, _)| n == "at0-kat-ideal-qubit-n4.case").unwrap(); + assert_eq!(super::at0::sha256::sha256_hex(&kat_file.1), KAT_FILE); + } +}