diff --git a/.crumb b/.crumb index 1ecf072d4..4537af2c6 100644 --- a/.crumb +++ b/.crumb @@ -75,8 +75,8 @@ "purpose": "Directory polyglot. Purpose not yet described by a human." }, { - "digest": "ed5c8fdc724f43a6826bc619953f14a3b1d073793cb7452461bc45c4a39ad99b", - "last_commit": "9862488", + "digest": "37b02d8e67bd00d2dbf658cfe230ca167980fd9cbb378bf26d4014de0d7a153c", + "last_commit": "9027080", "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:a583e7ad628303c2dc0b9a546476cb840c2c0dbc3c2e05a44a9bfa2194ea1ca3", - "compiled_at": "2026-10-09T22:54:25Z", + "children_root": "sha256:4c6079f7143ef26541c7766fc23200002b2233ab084f9577f22d983a0250b4e7", + "compiled_at": "2026-10-09T23:11:27Z", "compiler": "crumb-compile/1", - "digest": "sha256:879bc98477488ff2ee501cc9bc5d71ddf908facac4568a0a7c7047236a05bcf5", + "digest": "sha256:428aa2b9a79a5a79e7c0107a60fb682a0ac72a4402a636a0d5382efe139a850d", "evidence_files": 4847, "evidence_root": "sha256:8a1e306ee977789a3394c51305afc3121a0ba0d5e1735b29b2cc16ffd12f668a", - "files": 6936, - "generated_at_commit": "98624882f542a3ad77b6edbd5e431af08fb4b625", - "source_tree": "sha256:b1e07573c03669d5af22a2ff8c727886f7347b1dd6c644d6dddf0025eaac94d8" + "files": 7019, + "generated_at_commit": "902708063784b32f77b61912e18fadd4c4389ab9", + "source_tree": "sha256:d38bb6bbbf351f18ec0ddb8f5faf5554a049ed11a8a8637f68c54de81d970b29" }, "owner_lane": "", "provenance": { diff --git a/research/.crumb b/research/.crumb index 56edcabbd..0efc4959e 100644 --- a/research/.crumb +++ b/research/.crumb @@ -21,8 +21,8 @@ "generated": { "children": [ { - "digest": "39bd5d405d08cb1c080b4b886b5e36fff9b609102394cc81234917e5e376d40d", - "last_commit": "9862488", + "digest": "c6880116658a0511d729c31aec6990bf37444865bbdd426e45b9df2ac8639b3a", + "last_commit": "9027080", "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:d8570da519d1d2825952f527c3eeba431ec80171fd037b46fdd25d45d7798b12", - "compiled_at": "2026-10-09T22:54:25Z", + "children_root": "sha256:0d994a57777a4664091f23e295a801846746d26b333ce907a561262858115a7b", + "compiled_at": "2026-10-09T23:11:27Z", "compiler": "crumb-compile/1", - "digest": "sha256:ed5c8fdc724f43a6826bc619953f14a3b1d073793cb7452461bc45c4a39ad99b", + "digest": "sha256:37b02d8e67bd00d2dbf658cfe230ca167980fd9cbb378bf26d4014de0d7a153c", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "files": 224, - "generated_at_commit": "98624882f542a3ad77b6edbd5e431af08fb4b625", - "source_tree": "sha256:52c28962ff5a9ee0b10ea71d8e5db6d2bf692787afff16e64cd30ce5876ea157" + "files": 307, + "generated_at_commit": "902708063784b32f77b61912e18fadd4c4389ab9", + "source_tree": "sha256:856d238ca5d9224d221df0236b4a14233fa7ffad23d5007e04f7835786e71498" }, "owner_lane": "", "provenance": { diff --git a/research/atemporal/.crumb b/research/atemporal/.crumb index 227f6dce5..a629fcc2f 100644 --- a/research/atemporal/.crumb +++ b/research/atemporal/.crumb @@ -3,21 +3,21 @@ "generated": { "children": [ { - "digest": "47989e5a75e0c57d727c4e30df41409c6f1b19d788b448cba9c78e08271eec5e", - "last_commit": "9862488", + "digest": "13d3241cfe12653f3f34e11c5c440c4034bd00c67b45cb97db307a20339597fb", + "last_commit": "9027080", "name": "at0", "purpose": "AT-0 V1: finite clock plus one qubit under the AT0_CASE_V1 / AT0_RESULT_V1 contracts" } ], - "children_root": "sha256:5e1db8ab35a7e3b9ea51606f3dc16453e2780216653078997dd74c614276c219", - "compiled_at": "2026-10-09T22:54:25Z", + "children_root": "sha256:eb4190cd9b13c8adfb640de40341428449b9bfd068f329a82c622900485ea203", + "compiled_at": "2026-10-09T23:11:27Z", "compiler": "crumb-compile/1", - "digest": "sha256:39bd5d405d08cb1c080b4b886b5e36fff9b609102394cc81234917e5e376d40d", + "digest": "sha256:c6880116658a0511d729c31aec6990bf37444865bbdd426e45b9df2ac8639b3a", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "files": 78, - "generated_at_commit": "98624882f542a3ad77b6edbd5e431af08fb4b625", - "source_tree": "sha256:a6bcb1bd91f996955e1c5fcc0d231c126a473b077fc8f93a032ff802ca419627" + "files": 161, + "generated_at_commit": "902708063784b32f77b61912e18fadd4c4389ab9", + "source_tree": "sha256:7bf8ace64c2d4f19bdcd1e64a5c7bc13dd7854a40f26f50c5825a627bf09ab10" } }, "name": "atemporal", diff --git a/research/atemporal/at0/.crumb b/research/atemporal/at0/.crumb index 62cf000d9..722a014c4 100644 --- a/research/atemporal/at0/.crumb +++ b/research/atemporal/at0/.crumb @@ -2,6 +2,12 @@ "extensions": { "generated": { "children": [ + { + "digest": "190980a2004ccf444ac557f03a736fa621e7aa238d4123b70244d9727da704ab", + "last_commit": "9027080", + "name": "evaluator", + "purpose": "Agent 4 independent adversarial evaluator for AT-0: independent AT0_CASE_V1 codec, exact-arithme" + }, { "digest": "470b8c119df44842fffddc8393b528c87f163bb6e0155341cbc6da0650e19483", "last_commit": "b3a9476", @@ -10,20 +16,20 @@ }, { "digest": "f210d0c620bca32c38a0a62c888bd82cdc020e8da40269b050199dcc34a886be", - "last_commit": "9862488", + "last_commit": "f08faa4", "name": "oracle", "purpose": "AT-0 reference oracle (Rust, standard library only, built by rustc directly; research cross-chec" } ], - "children_root": "sha256:8ecb59ef0065be19dbf08487115e9e0dfd3b6465ae287467fd5e520946482c42", - "compiled_at": "2026-10-09T22:54:25Z", + "children_root": "sha256:5d89794813236e7dddb2c249c5229c0442267263b1f04578560660e78984455f", + "compiled_at": "2026-10-09T23:11:27Z", "compiler": "crumb-compile/1", - "digest": "sha256:47989e5a75e0c57d727c4e30df41409c6f1b19d788b448cba9c78e08271eec5e", + "digest": "sha256:13d3241cfe12653f3f34e11c5c440c4034bd00c67b45cb97db307a20339597fb", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "files": 78, - "generated_at_commit": "98624882f542a3ad77b6edbd5e431af08fb4b625", - "source_tree": "sha256:a6bcb1bd91f996955e1c5fcc0d231c126a473b077fc8f93a032ff802ca419627" + "files": 161, + "generated_at_commit": "902708063784b32f77b61912e18fadd4c4389ab9", + "source_tree": "sha256:7bf8ace64c2d4f19bdcd1e64a5c7bc13dd7854a40f26f50c5825a627bf09ab10" } }, "name": "at0", diff --git a/research/atemporal/at0/evaluator/.crumb b/research/atemporal/at0/evaluator/.crumb new file mode 100644 index 000000000..cb651be38 --- /dev/null +++ b/research/atemporal/at0/evaluator/.crumb @@ -0,0 +1,19 @@ +{ + "extensions": { + "generated": { + "children": [], + "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "compiled_at": "2026-10-09T23:11:27Z", + "compiler": "crumb-compile/1", + "digest": "sha256:190980a2004ccf444ac557f03a736fa621e7aa238d4123b70244d9727da704ab", + "evidence_files": 0, + "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "files": 83, + "generated_at_commit": "902708063784b32f77b61912e18fadd4c4389ab9", + "source_tree": "sha256:d9d340264f32beaa09383052aaaf3821d0e198f17c87703bf8c8a9b2a5a20664" + } + }, + "name": "evaluator", + "purpose": "Agent 4 independent adversarial evaluator for AT-0: independent AT0_CASE_V1 codec, exact-arithmetic AT0_RESULT_V2 checker, long-double shadow oracle, 25 planted-defect mutants, 59-case public corpus, hidden-set commitment, isolation gate, qualification harness (run.sh) and machine-readable results", + "schema_version": "1.0.0" +} diff --git a/research/atemporal/at0/evaluator/FAILURE_TAXONOMY.md b/research/atemporal/at0/evaluator/FAILURE_TAXONOMY.md new file mode 100644 index 000000000..4ebd383dc --- /dev/null +++ b/research/atemporal/at0/evaluator/FAILURE_TAXONOMY.md @@ -0,0 +1,170 @@ +# AT-0 Agent 4 failure taxonomy + +Three layers of classification are used, and they are never mixed. + +1. **Case refusal codes** (AT0_CASE_V1 section 5, closed set): what the + independent codec says about a case file. `CASE_PARSE_ERROR`, + `CASE_NONCANONICAL`, `CASE_UNSUPPORTED_VERSION`, `CASE_INVALID_PARAMETER`, + `CASE_IRRATIONAL_SPECTRUM`, `CASE_ID_MISMATCH`, applied in that order. +2. **Physics failure codes** (AT0_RESULT V1/V2, closed set): what the ten + checks say about the physics of a run. `TRIVIAL_PHYSICAL_STATE`, + `POVM_NORMALIZATION_EXCEEDED`, `PROBABILITY_SUM_EXCEEDED`, + `PROBABILITY_OUT_OF_RANGE`, `SCHRODINGER_DEVIATION_EXCEEDED`, + `CONSTRAINT_RESIDUAL_EXCEEDED`, `BOUND_KIND_INSUFFICIENT`, + `PRECISION_INSUFFICIENT`, `CONDITIONAL_UNDEFINED`, `NONFINITE_VALUE`. The + evaluator re-derives this set itself and compares it with the reported set. +3. **Evaluator findings** (`E4-*`, this document): what the evaluator says + about a result file. A finding is a defect in the record or in the + implementation that produced it, never a statement about physics. + +A negative control that fails with exactly its expected physics codes is a +PASS for the evaluator (the implementation detected the defect). A physically +different model is one whose honest record carries different physics codes; +an incorrect implementation is one whose record carries `E4-*` findings. The +two are reported separately and never collapsed into one verdict. + +## Evaluator statuses + +| status | meaning | +|---|---| +| PASS | every recomputation and re-derivation agrees with the record; no finding | +| FAIL | at least one finding of FAIL severity: the record is wrong, forged, mismatched or physically contradicted | +| INCONCLUSIVE | only INCONCLUSIVE-severity findings: the record cannot be cited (dirty tree, unverified contract commit) or the evaluator could not form its own opinion (shadow unavailable) | +| NOT_RUN | the test exists but was not executed in this run | +| BLOCKED_NO_CANDIDATE | the test needs a candidate hook that was not supplied | + +UNISOLATED is a property of the whole qualification run (ISOLATION_REPORT.md), +not a test status, and it is printed in `results/qualification.json` as such. + +## Finding codes + +Severity: F = FAIL, I = INCONCLUSIVE. Any F finding makes the result FAIL. + +### Structure of the result file (E4-STRUCT-, F) + +| code | meaning | +|---|---| +| E4-STRUCT-UNREADABLE | result file cannot be read | +| E4-STRUCT-BYTES | a byte rule is violated (non-ASCII, CR, blank line, leading/trailing/double space, missing final LF) | +| E4-STRUCT-VERSION | header, domain or contract line is not an AT0_RESULT v1/v2 triple that agrees with itself | +| E4-STRUCT-ORDER | a line is out of the fixed order or a required line is missing | +| E4-STRUCT-TRUNCATED | file ends before the required lines | +| E4-STRUCT-TRAILING | bytes after the final `end` | +| E4-STRUCT-PARSE | a line does not parse in its required shape | +| E4-STRUCT-ENCODING | a value, bound or digest is not in canonical encoding (non-canonical hex, scaled decimal, NaN/inf, negative zero) | +| E4-STRUCT-CASE-SHAPE | the embedded case block is not shaped as AT0_CASE_V1 | +| E4-STRUCT-CASE-REFUSED | the embedded case is refused by the independent codec | +| E4-STRUCT-ERROR-CODE | the error code is not in the closed set or disagrees with the outcome | +| E4-STRUCT-UNDEFINED-TOKEN | `undefined` on constraint_residual, povm_residual, a clock_probability or a reference while the kernel is nontrivial (pauli `undefined` is governed by the label status rules below) | +| E4-STRUCT-TRIVIAL-KERNEL-SHAPE | the kernel is trivial but the values block is not in the trivial-kernel shape | +| E4-STRUCT-UNDEFINED-ON-DEFINED | `undefined` is used for a label that is physically defined | +| E4-STRUCT-VALUE-ON-UNDEFINED | a number is reported for a label that is undefined | +| E4-STRUCT-POVM-UNDEFINED | povm_residual is `undefined` (it is always real) | +| E4-STRUCT-REFERENCE-UNDEFINED | a reference probability is `undefined` (it is always real) | +| E4-STRUCT-RESIDUAL-ON-TRIVIAL | constraint_residual carries a value in the trivial-kernel shape | + +### Digests and identities (E4-ID-, F) + +| code | meaning | +|---|---| +| E4-ID-CASE | recomputed case_id or acceptance_id differs from the embedded one | +| E4-ID-VERDICT | recomputed verdict_id differs (verdict block altered after signing, or wrong tag) | +| E4-ID-EVIDENCE | recomputed evidence_digest differs (any line above it altered) | + +### Binding to the supplied case file (E4-BIND-, F) + +| code | meaning | +|---|---| +| E4-BIND-CASE-UNREADABLE | the `--case` file cannot be read | +| E4-BIND-CASE-REFUSED | the `--case` file is refused by the independent codec | +| E4-BIND-CASE-FILE | reported case_file_sha256 differs from the supplied file's digest | +| E4-BIND-CASE-ID | embedded case_id differs from the supplied case's | +| E4-BIND-ACCEPTANCE-ID | embedded acceptance_id differs from the supplied case's | +| E4-BIND-SEMANTIC-BLOCK | embedded semantic block differs from the supplied case's (same id claimed for different physics) | +| E4-BIND-ACCEPTANCE-BLOCK | embedded acceptance block differs (tolerances or expected codes altered) | +| E4-BIND-CASE-NAME | embedded case name differs | + +### Checks, outcome, codes (F) + +| code | meaning | +|---|---| +| E4-CHECK-MISMATCH | a check verdict differs from the exact re-derivation (named check, reported vs derived) | +| E4-OUTCOME-MISMATCH | outcome differs from the re-derived outcome | +| E4-CODES-MISMATCH | failure_codes differ from the re-derived set (missing, extra, unsorted, duplicate) | +| E4-EXPECTATION-MISMATCH | expectation_met differs from the comparison of derived codes with the case's expected codes | +| E4-LABEL-STATUS | a label status (DEFINED/UNDEFINED) disagrees with the exact kernel analysis | + +### Bounds (E4-BOUND-, F) + +| code | meaning | +|---|---| +| E4-BOUND-NONE-NONZERO | bound_kind NONE with a non-zero bound | +| E4-BOUND-CLAIM-FALSE | a reported value differs from the shadow by more than its stated bound plus the shadow's bound: the bound claim is false | + +### Shadow oracle disagreement (E4-SHADOW-, F except where noted) + +| code | meaning | +|---|---| +| E4-SHADOW-KERNEL-DIM | reported kernel_dim differs from the exact one | +| E4-SHADOW-POVM | povm_residual contradicts the shadow (exact identity expected but non-zero reported, or vice versa beyond bounds) | +| E4-SHADOW-CLOCK-PROB | a clock probability contradicts the shadow | +| E4-SHADOW-PAULI | a Pauli probability contradicts the shadow (named label and axis) | +| E4-SHADOW-REFERENCE | a reference probability contradicts the shadow | +| E4-SHADOW-UNAVAILABLE (I) | the shadow could not be computed for this case; the evaluator has no opinion on the values | + +### Provenance and placeholders + +| code | sev | meaning | +|---|---|---| +| E4-PLACEHOLDER-SHAPE | F | a run that did not complete has values where placeholders are required, or vice versa | +| E4-PROV-NONE-IN-COMPLETED-RUN | F | `none` provenance token in a completed run | +| E4-PROV-ORACLE-IS-ENGINE | F | oracle digest equals engine digest: the reference was produced by the thing under test | +| E4-TIME-ORDER | F | end time precedes start time, or times are not UTC in the required form | +| E4-PROV-CONTRACT-UNVERIFIED | I | contract_commit is not a commit verified to hold the frozen contract bytes; record not citable until verified | +| E4-PROV-DIRTY | I | source_tree_clean NO; record may not be cited for a gate | + +## Mutant to finding map (red before green) + +| planted defect | caught by | discriminating cases | +|---|---|---| +| axis_swap | E4-SHADOW-PAULI | KAT, P1e, P2 | +| y_sign_swap | E4-SHADOW-PAULI | KAT, P1e | +| conjugate_bug | E4-SHADOW-PAULI (Y) | KAT, P1e, P1g (blind: P1f) | +| reversed_reference | E4-SHADOW-REFERENCE (Y) | KAT, P1e, P1g (blind: P2) | +| dephased_state | E4-SHADOW-PAULI, E4-CHECK-MISMATCH | KAT | +| wrong_weight_hidden | E4-SHADOW-CLOCK-PROB, E4-CHECK-MISMATCH | N4, N4b (blind: KAT) | +| hardcoded_table | E4-SHADOW-* | P1b, P1c, P1d (blind: KAT, P2b) | +| kernel_dim_wrong | E4-SHADOW-KERNEL-DIM | KAT | +| residual_over_bound | E4-CHECK-MISMATCH | KAT | +| nonfinite_hidden | E4-STRUCT-ENCODING or E4-CHECK-MISMATCH | KAT | +| verdict_forged | E4-CHECK-/OUTCOME-/CODES-MISMATCH | N1, N2, N3, N6, N7 (blind: KAT) | +| evidence_corrupt | E4-ID-EVIDENCE | KAT | +| verdict_id_corrupt | E4-ID-VERDICT | KAT | +| case_id_altered | E4-ID-CASE, E4-BIND-CASE-ID | KAT | +| tolerance_altered | E4-BIND-ACCEPTANCE-BLOCK, E4-ID-CASE | KAT | +| binding_rebound | E4-BIND-* | KAT | +| contract_commit_wrong | E4-PROV-CONTRACT-UNVERIFIED (I) | KAT | +| dirty_tree | E4-PROV-DIRTY (I) | KAT | +| times_reversed | E4-TIME-ORDER | KAT | +| oracle_is_engine | E4-PROV-ORACLE-IS-ENGINE | KAT | +| bound_none_nonzero | E4-BOUND-NONE-NONZERO | KAT | +| label_status_wrong | E4-LABEL-STATUS | KAT (blind: N7, labels already UNDEFINED) | +| label_claimed_defined | E4-LABEL-STATUS | N7 (blind: KAT, labels already DEFINED) | +| placeholder_with_values | E4-PLACEHOLDER-SHAPE | KAT | +| crlf | E4-STRUCT-BYTES | KAT | +| trailing_space | E4-STRUCT-BYTES | KAT | + +Blind pairs are listed in `run.sh` and reported INCONCLUSIVE with the reason +"indistinguishable from truth on this case by construction" so that the +coverage gap is visible in the machine-readable results rather than hidden. + +## Additions after independent review (Opus 5.5, 2026-10-09) + +| code | sev | meaning | +|---|---|---| +| E4-UNBOUND-NO-CASE-FILE | I | `result` was run without `--case`; the embedded case is trusted, so the verification is not citable | + +Mutant grading rule: a planted defect counts as caught only when the evaluator +grades the mutant file FAIL. INCONCLUSIVE, a crash or an empty status is an +escape. The two mutants that are INCONCLUSIVE by design (dirty tree, unknown +contract commit) are tested separately for exactly that status. diff --git a/research/atemporal/at0/evaluator/HIDDEN_COMMITMENT.txt b/research/atemporal/at0/evaluator/HIDDEN_COMMITMENT.txt new file mode 100644 index 000000000..86b99940d --- /dev/null +++ b/research/atemporal/at0/evaluator/HIDDEN_COMMITMENT.txt @@ -0,0 +1,9 @@ +# Agent 4 hidden qualification set: SHA-256 of each private case file (contents withheld until candidate freeze). +# A digest proves identity of the file later revealed; it does not prove non-access (see ISOLATION_REPORT.md). +# Six AT0_CASE_V1 files (four POSITIVE, two NEGATIVE), stored outside the repository on the Spark under ~/at0-private/agent4/. +52aab0b3dc505fdc5da4ce77bb144ae48f59974cdf9a78fd2f98b73b2b5b9674 H1.case +27c4ae0f715eb4c3ffb05a3354850df113c04756fe502f37236581dd5d2f1558 H2.case +66b7fc211225c6f9e719875eb535edf585e89ac736d65b22abc2c411360d3f43 H3.case +acc27ec4c85246ba82b472e5fb016dd4a872c6d3c66c2912078bf305d032700d H4.case +ddc45740daa61ac42eb14e8496bab269439c4da3b0e195d4d1fd1285482a483d H5.case +94a96c71d1358921eded9948ff3ef7340f21306be2312c04786b9f6bc3e95dd8 H6.case diff --git a/research/atemporal/at0/evaluator/ISOLATION_REPORT.md b/research/atemporal/at0/evaluator/ISOLATION_REPORT.md new file mode 100644 index 000000000..08e23bc2e --- /dev/null +++ b/research/atemporal/at0/evaluator/ISOLATION_REPORT.md @@ -0,0 +1,90 @@ +# AT-0 Agent 4 isolation and reproducibility report + +## Isolation status: UNISOLATED + +The qualification run described by `results/qualification.json` is +**UNISOLATED**. No claim of independently blinded qualification is made. + +Facts: + +- Evaluator, candidate engine (omega `research/atemporal/at0/model`, + merged omega#360), reference oracle and runner are developed and executed on + the same host (the Spark, one Linux user account, one shared filesystem). +- The hidden qualification cases live outside the repository in + `~/at0-private/agent4/` on that host. Any process running as that account + can read them. The files are withheld from the public repository and from + the candidate developer's briefs, but their non-access by other agents on + this machine cannot be proven. +- `HIDDEN_COMMITMENT.txt` publishes the SHA-256 of each hidden file. This + commitment establishes **data identity** (the files judged later are the + files committed to now, and they were fixed before the candidate was run). + It does **not** establish non-access and is not presented as doing so. +- The isolation gate (`gates/isolation.sh`) is a symbol-level scan of compute + objects for clock, random, environment, file, network, process and thread + entry points, with a positive control (an object that calls `clock_gettime`, + which the gate must reject) and a negative control (a pure arithmetic object, + which the gate must accept). It is evidence about the compiled candidate, not + about the people and agents around it. Dynamic loading, inline syscalls and + data smuggled through the case file itself are outside what a symbol scan can + see; the wall-clock independence control (same case, different time zone, + a pause, an extra environment variable; values and verdict_id must be + identical, evidence digests must differ) covers part of that gap at run time. + +What true isolation would require, for a later run that wants to claim it: +a separate account or machine holding the hidden set; candidate binaries +transferred by digest only; the hidden cases revealed to the candidate only +after a freeze commit of the candidate is published; and the evaluator run by +someone other than the candidate's author. None of those were available for +this run. + +## Reproducibility + +Everything in this directory is deterministic. + +| item | value | +|---|---| +| language | C11 plus POSIX shell; no Python, no external libraries | +| compiler | gcc 13.3.0 (Ubuntu 13.3.0-6ubuntu2~24.04.1) | +| flags | `-std=c11 -Wall -Wextra -Werror -pedantic -O2 -D_POSIX_C_SOURCE=200809L` | +| sanitizer build | `-O1 -g -fsanitize=address,undefined -fno-sanitize-recover=all`, run over codec, refusals, synthesis and verification | +| platform | Linux 7.0.0-1019-nvidia, aarch64 | +| long double | 16 bytes, IEEE binary128 (113-bit mantissa); shadow oracle bound stated as ESTIMATED 1e-20 | +| decision arithmetic | 4096-bit integers over the common denominator 2^1100 x 10^80; exact, no rounding | +| threads | 1; no timing, randomness or environment dependence anywhere in the evaluator | +| external code linked | omega `src/sha256.c` only | +| frozen contract commit | aien-architecture `044c9d11256d8642f80eedd42cbae8763faf63f5` | +| charter commit | aien-architecture `00e9f2308666f74e58f524b177b2a31eccdc69ba` | +| spec draft | aien-architecture PR #176 head `0efd1a14cbdf117bc694b556bb61d031cf80c8f9` | + +To reproduce: `make && sh run.sh --self-only` from this directory on any POSIX +system with a C11 compiler. The known-answer digests, the hand table, the +62-case manifest, the 41 discriminating mutant pairs and the two isolation +controls are all checked without any candidate present. On a platform whose +`long double` is only 64 bits the shadow bound of 1e-20 would be false; the +shadow would then need its stated bound raised, and `run.sh` should be read +with that in mind. No such platform was used here. + +## Known limits of the isolation gate + +The symbol scan reads both the static and the dynamic symbol table, so a +stripped executable that imports a clock through the dynamic loader is still +caught, and `syscall` is on the forbidden list. It cannot see inline system +calls, raw counter reads (CNTVCT_EL0 on aarch64, rdtsc on x86-64) or symbols +resolved at run time without `dlsym`. Those are run-time behaviours, and the +wall-clock independence control is the only check that touches them. A +candidate that wants a stronger claim must be reviewed at source level. + +Portability: `run.sh` needs GNU coreutils (`sha256sum`), `nm` from binutils and +a C11 compiler named by `CC` (default `cc`). On a platform whose `long double` +has a 64-bit mantissa (x86-64) the shadow states a 1e-14 bound instead of +1e-20; the evaluator refuses to run the shadow below 64 bits. Every run, +including `--self-only`, rewrites `results/qualification.json`; that file is the +deliverable and is meant to be committed with the run it describes. + +## Scope of any PASS + +A PASS in `results/qualification.json` means the AT-0 implementation conformed +to the frozen AT0_CASE_V1 / AT0_RESULT_V2 contracts on the cases run, and that +its numbers agree with an independent recomputation within stated bounds. +It is software conformance. It is not a scientific discovery verdict and must +not be cited as evidence about the physics of time. diff --git a/research/atemporal/at0/evaluator/Makefile b/research/atemporal/at0/evaluator/Makefile new file mode 100644 index 000000000..456ee16d1 --- /dev/null +++ b/research/atemporal/at0/evaluator/Makefile @@ -0,0 +1,24 @@ +# AT-0 Agent 4 independent evaluator (research/atemporal/at0/evaluator). +# Standalone: not part of omega `all` or `test`; not mk/at0.mk (Agent 5 owns that). +# Links exactly one omega source: src/sha256.c (charter section 3). +OMEGA_ROOT ?= ../../../.. +OUT ?= build +CC ?= cc +CFLAGS ?= -std=c11 -Wall -Wextra -Werror -pedantic -O2 -D_POSIX_C_SOURCE=200809L +ASAN = -O1 -g -fsanitize=address,undefined -fno-sanitize-recover=all +SRCS = src/at0e_big.c src/at0e_text.c src/at0e_case.c src/at0e_shadow.c src/at0e_result.c src/at0e_synth.c src/at0e_main.c +INC = -Isrc -I$(OMEGA_ROOT)/src + +.PHONY: all asan clean selftest +all: $(OUT)/at0-eval +$(OUT)/at0-eval: $(SRCS) src/at0e.h $(OMEGA_ROOT)/src/sha256.c + @mkdir -p $(OUT) + $(CC) $(CFLAGS) $(INC) -o $@ $(SRCS) $(OMEGA_ROOT)/src/sha256.c -lm +asan: $(OUT)/at0-eval-asan +$(OUT)/at0-eval-asan: $(SRCS) src/at0e.h $(OMEGA_ROOT)/src/sha256.c + @mkdir -p $(OUT) + $(CC) -std=c11 -Wall -Wextra -Werror -pedantic $(ASAN) -D_POSIX_C_SOURCE=200809L $(INC) -o $@ $(SRCS) $(OMEGA_ROOT)/src/sha256.c -lm +selftest: all + sh run.sh --self-only +clean: + rm -rf $(OUT) diff --git a/research/atemporal/at0/evaluator/README.md b/research/atemporal/at0/evaluator/README.md new file mode 100644 index 000000000..db832aea1 --- /dev/null +++ b/research/atemporal/at0/evaluator/README.md @@ -0,0 +1,187 @@ +# AT-0 Agent 4: independent adversarial evaluator + +This directory is the independent evaluator for the AT-0 Clock-Free Universe +program (aien-architecture `docs/plans/atemporal/`). Its job is to try to +falsify the AT-0 implementation's claimed correctness, not to confirm it. It +trusts nothing a candidate reports: every number, every check verdict, every +digest and every provenance claim in a result file is recomputed or +re-derived here from the case file alone. + +Pinned references (frozen bytes, verified by digest): + +| document | commit | +|---|---| +| AT0_CASE_V1.md, AT0_RESULT_V1.md, AT0_FREEZE.md (frozen) | aien-architecture `044c9d11256d8642f80eedd42cbae8763faf63f5` | +| AT0_CHARTER.md (updated, contract bytes unchanged) | aien-architecture `00e9f2308666f74e58f524b177b2a31eccdc69ba` | +| AT0_SPEC.md draft (PR #176 head) | aien-architecture `0efd1a14cbdf117bc694b556bb61d031cf80c8f9` | +| AT0_RESULT_V2.md (frozen; digest bd0f9eb8cf3ef7226c3ea18c1c9fbd4db62e0c23a0481afa519830fc1f514b5e; AT0_CASE_V1.md unchanged, d90af74bf818598d28114a73e618f5073706797d7d92d472acc2df404cd663d9) | aien-architecture `c7a7181eda57e353dbff3b7d20cde33fb65faeb2` (#180) and `fe86e43aae63370b3084f78e971a33b81ce75a9d` (#181), both verified here by digest and allowlisted | + +The evaluator reads only complete `AT0_RESULT_V2` files (Agent 0 ruling, +omega#358): the engine and the reference oracle emit component outputs, Agent +5's runner assembles the full result with verdict block and digests, and this +evaluator judges that assembled file against the case file. It never consumes +component outputs, so its independence from both engine and oracle holds. + +No Python, no external libraries. C11 plus POSIX shell. The only file linked +from outside this directory is omega `src/sha256.c`. + +## Layout + +``` +Makefile build/at0-eval (and build/at0-eval-asan) +run.sh the qualification harness; writes results/qualification.json +src/ evaluator sources (see "Design") +cases/positive/ P* cases expected to PASS the physics +cases/negative/ N* negative controls expected to FAIL with named codes +cases/refuse/ R* malformed or invalid cases expected to be REFUSED with a named code +cases/MANIFEST.tsv path, class, exact expected response for all 62 public cases +cases/generate.sh regenerates every public case from `at0-eval gen` plus byte edits +gates/isolation.sh symbol-level isolation gate with positive and negative control objects +HIDDEN_COMMITMENT.txt SHA-256 of the six hidden cases (contents withheld until candidate freeze) +FAILURE_TAXONOMY.md every E4-* finding code, its severity and meaning +ISOLATION_REPORT.md isolation status (UNISOLATED), reproducibility, toolchain +results/ qualification.json (machine-readable) and candidate result copies +``` + +## Usage + +``` +make build +sh run.sh --self-only evaluator self-tests, corpus, mutants, gates, hidden commitment +sh run.sh the same plus the candidate section (BLOCKED_NO_CANDIDATE when unset) + +AT0_CANDIDATE_CASE_TOOL= AT0_CANDIDATE_RUN= AT0_CANDIDATE_OBJECTS="" sh run.sh +``` + +Candidate hooks: `AT0_CANDIDATE_CASE_TOOL ` must print `AT0_CASE_OK ` +(exit 0) or `AT0_CASE_REFUSED ` on stderr (exit 2) exactly as the +contract requires; `AT0_CANDIDATE_RUN ` must write a complete +`AT0_RESULT_V2` file to standard output; `AT0_CANDIDATE_OBJECTS` lists the +compute objects or binaries for the isolation gate. `AT0_HIDDEN_DIR` points at +the private case directory (default `~/at0-private/agent4`). Candidate results +for hidden cases are written into the private directory, never into the repo. + +Direct tool commands: + +``` +build/at0-eval case [--detail] independent AT0_CASE_V1 codec: AT0_CASE_OK / AT0_CASE_REFUSED +build/at0-eval result [--case ] [--no-shadow] [--json] + verify a result: AT0E_VERIFY PASS|FAIL|INCONCLUSIVE plus findings +build/at0-eval shadow shadow oracle table (kernel, POVM residual, p(k), Pauli, reference) +build/at0-eval synth [mutant] honest synthetic result, or one with a planted defect +build/at0-eval mutants list the 26 planted defects +build/at0-eval gen key=value ... emit a canonical case (name, E, h, ref, psi, tau, w, M, labels, control, expected, codes, minbk, tol*) +``` + +Exit codes: `case` 0 ok / 2 refused; `result` 0 PASS / 1 FAIL / 3 INCONCLUSIVE. + +## Design + +**Independent codec** (`at0e_text.c`, `at0e_case.c`). Byte rules, canonical +encodings, fixed line order and the six validity rules of AT0_CASE_V1 are +reimplemented from the contract text, not from any candidate code. The +known-answer example reproduces file digest, `case_id` and `acceptance_id` +exactly, and `gen` re-emits it byte for byte. + +**Exact decision arithmetic** (`at0e_big.c`). Every reported value +(`f64:`), every bound and every tolerance (scaled decimals) is lifted to a +4096-bit integer over the common denominator 2^1100 x 10^80. The ten checks and +their tri-state comparison forms are then decided with no rounding at all, so +the checker can never disagree with the contract by a floating-point hair. + +**Shadow oracle** (`at0e_shadow.c`). The physics is recomputed from the case: +exact kernel dimension and matched eigenvalues (rational arithmetic), exact +test for the POVM identity (w = N/M, and for every gap D: D tau not an integer, +D tau M an integer), then long double (113-bit mantissa on this machine) +evaluation of the POVM Frobenius residual, conditional states, clock +probabilities, Pauli probabilities and the Schroedinger reference, with exact +mod-1 angle reduction. The shadow's own bound is stated as ESTIMATED 1e-20, and +a reported value is contradicted only when it differs from the shadow by more +than the sum of both bounds. + +Hand derivations behind the shadow: the conditional state is the Schroedinger +evolution restricted to the matched eigencomponents, phi_k = (1/N) sum over +matched s of exp(-2 pi i e_s (k-r) tau) c_s |e_s>; its norm is independent of k, +so the clock probabilities are flat and sum to wM/N exactly. A wrong tau +therefore shows up only in `povm_residual`, never in `probability_sum`; a wrong +weight shows up in both. + +**Result verification** (`at0e_result.c`). Strict parse of the result file; +recomputation of `verdict_id` and `evidence_digest` with the version's tags; +binding of the embedded case to the supplied case file (file digest, both ids, +semantic and acceptance blocks, name); provenance rules (contract commit in +the verified allowlist, clean tree, oracle digest not equal to engine digest, +UTC time order, placeholder discipline); undefined-token discipline for the +trivial-kernel shape; independent re-derivation of all ten checks, outcome, +failure codes and `expectation_met`; shadow comparison of every value. + +**Mutants** (`at0e_synth.c`). Twenty-six planted defects covering wrong axis, +wrong Y sign, conjugation bug, reversed reference, dephased state, hidden +weight error, hardcoded table, wrong kernel dimension, residual over bound, +hidden non-finite, forged verdict, corrupted evidence, corrupted verdict id, +altered case id, altered tolerance, rebound case, wrong contract commit, dirty +tree, reversed times, oracle equal to engine, NONE bound with non-zero value, +wrong label status (both directions), placeholder with values, CRLF, trailing space. `run.sh` +demands that every defect is caught on a case where it bites (red before +green) and records the pairs where a defect is invisible by construction as +INCONCLUSIVE rather than silently skipping them. + +## Blind spots (by construction, documented, covered elsewhere) + +- A Y-axis rotation of |0> (P1f) keeps = 0, so a conjugation bug is + invisible there; it is caught on P1e, P1g and the KAT. +- A field whose rotation angles are multiples of pi at every sampled clock + reading (P2, |h| = 1/2, tau = 1/2) keeps = 0 and hides a reversed + reference; caught on P1e and P1g. +- Shifting h0 alone (P2b) leaves every probability unchanged, so a table + hardcoded for the unshifted case is indistinguishable there; caught on P1b, + P1c, P1d where tau, N and the reference reading differ. +- A forged verdict on a case whose honest verdict is PASS is a no-op; caught on + N1, N2, N3, N6. +- The spec (PR #176) shows that flipping Hamiltonian signs inside the engine + changes nothing observable: the engine depends only on Psi and the POVM. A + phase-sign defect must therefore be a conjugation bug or a reversed + reference, and only cases with != 0 can see it. Every case class used for + qualification includes at least one such case, publicly and in the hidden set. + +## Contract ambiguities found (recorded, not resolved here) + +- A1 (resolved by V2): the trivial-kernel shape in V1 made check 9 FAIL with + CONDITIONAL_UNDEFINED; V2 marks checks 4, 6, 7, 8, 9, 10 NOT_EVALUATED, keeps + check 5 evaluated, and fails check 3 with TRIVIAL_PHYSICAL_STATE. The evaluator + follows V2. +- A2: a rational beyond the +-1048576 limit is a parameter error + (CASE_INVALID_PARAMETER), not a shape error. The contract text orders the + rules that way; the evaluator implements that ordering and R26 exercises it. +- A3: `probability_range` is read as covering the reference probabilities as + well as the reported ones. +- A4: N5 (minimum bound kind RIGOROUS) fails only because the engine states + ESTIMATED bounds; an engine with rigorous interval arithmetic would pass it. +- A6: V2 says a check whose input contains `undefined` is NOT_EVALUATED "for that input". The evaluator reads this per input: with mixed label statuses, checks 7, 8 and 10 are evaluated on the DEFINED labels (and on the clock and reference probabilities, which are always real) and NOT_EVALUATED only when no input remains. N7 (all labels UNDEFINED with a nontrivial kernel, tol_zero_probability = 1) exercises the all-undefined shape; it fails with exactly CONDITIONAL_UNDEFINED. +- A5: the charter's N1 example spectrum (1/2, 1, 3/2, 2) is half-covered with a + broken clock, not uncovered; the corpus uses 1, 2, 3, 4. Agent 0 redefined N1 + the same way independently. + +## Statuses + +Every test in `results/qualification.json` carries exactly one of PASS, FAIL, +INCONCLUSIVE, NOT_RUN, BLOCKED_NO_CANDIDATE with a specific reason. UNISOLATED +is a property of the whole run (see ISOLATION_REPORT.md), never a test status. +A PASS here is software conformance to the frozen contracts. It is not, and +must not be cited as, a scientific result about time or quantum mechanics. + +## Independent review (2026-10-09) + +Before merge the sources were reviewed by Opus 5.5 in a separate session with +none of this session's context (Codex was out of usage). It confirmed the +physics derivations and the exact arithmetic and found two blocking bugs, both +fixed and both now covered by public cases: fractions with parts above 2^63 +were truncated before conversion to long double in the shadow oracle (P5, +large rationals, checks P(Z+) = 1/3 at the reference reading), and a 39-digit +integer overflowed the fraction parser so an out-of-range value could reach the +id check (R39, refused CASE_INVALID_PARAMETER). Its further points are applied: +a verification without `--case` is INCONCLUSIVE (E4-UNBOUND-NO-CASE-FILE), a +mutant counts as caught only on FAIL, gate control objects that fail to compile +record NOT_RUN instead of a false PASS, the isolation gate reads dynamic symbol +tables and forbids `syscall`, scaled-decimal bounds above 2^64 convert exactly, +and the shadow bound follows the long double width. diff --git a/research/atemporal/at0/evaluator/cases/MANIFEST.tsv b/research/atemporal/at0/evaluator/cases/MANIFEST.tsv new file mode 100644 index 000000000..468b7210e --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/MANIFEST.tsv @@ -0,0 +1,63 @@ +# path class expected tool response (my codec and the candidate's must both give it) +positive/P1-kat-ideal-qubit-n4.case P1 AT0_CASE_OK +positive/P1b-ideal-n4-tau8-m8.case P1 AT0_CASE_OK +positive/P1c-ideal-n6-m6.case P1 AT0_CASE_OK +positive/P1d-ref-offset-t2.case P1 AT0_CASE_OK +positive/P1e-x-axis-rotation.case P1 AT0_CASE_OK +positive/P1f-y-axis-rotation.case P1 AT0_CASE_OK +positive/P1g-complex-psi-yplus.case P1 AT0_CASE_OK +positive/P2-tilted-h0.case P2 AT0_CASE_OK +positive/P2b-h0-shift-control.case P2 AT0_CASE_OK +positive/P3-spec-reference-model.case P3 AT0_CASE_OK +positive/P4-degenerate-identity-h.case P4 AT0_CASE_OK +positive/P5-large-rationals.case P5 AT0_CASE_OK +negative/N1-uncovered-spectrum.case N1 AT0_CASE_OK +negative/N2-half-covered.case N2 AT0_CASE_OK +negative/N3-broken-clock-tau3.case N3 AT0_CASE_OK +negative/N4-wrong-weight-2.case N4 AT0_CASE_OK +negative/N4b-wrong-weight-5.case N4 AT0_CASE_OK +negative/N5-precision-demand.case N5 AT0_CASE_OK +negative/N6-zero-kernel-component.case N6 AT0_CASE_OK +negative/N7-unreachable-labels.case N7 AT0_CASE_OK +refuse/R01-noncanonical-rational.case R1 AT0_CASE_REFUSED CASE_NONCANONICAL +refuse/R02-header-v2.case R2 AT0_CASE_REFUSED CASE_UNSUPPORTED_VERSION +refuse/R03-clock-dim-1.case R3 AT0_CASE_REFUSED CASE_INVALID_PARAMETER +refuse/R04-irrational-spectrum.case R4 AT0_CASE_REFUSED CASE_IRRATIONAL_SPECTRUM +refuse/R05-wrong-case-id.case R5 AT0_CASE_REFUSED CASE_ID_MISMATCH +refuse/R06-codes-with-pass.case R6 AT0_CASE_REFUSED CASE_INVALID_PARAMETER +refuse/R06b-codes-unsorted.case R6 AT0_CASE_REFUSED CASE_INVALID_PARAMETER +refuse/R06c-codes-unknown.case R6 AT0_CASE_REFUSED CASE_INVALID_PARAMETER +refuse/R06d-fail-without-codes.case R6 AT0_CASE_REFUSED CASE_INVALID_PARAMETER +refuse/R07-crlf.case R1 AT0_CASE_REFUSED CASE_PARSE_ERROR +refuse/R08-tab.case R1 AT0_CASE_REFUSED CASE_PARSE_ERROR +refuse/R09-blank-line.case R1 AT0_CASE_REFUSED CASE_PARSE_ERROR +refuse/R10-trailing-space.case R1 AT0_CASE_REFUSED CASE_PARSE_ERROR +refuse/R11-double-space.case R1 AT0_CASE_REFUSED CASE_PARSE_ERROR +refuse/R12-missing-key.case R1 AT0_CASE_REFUSED CASE_PARSE_ERROR +refuse/R13-unknown-key.case R1 AT0_CASE_REFUSED CASE_PARSE_ERROR +refuse/R14-duplicate-key.case R1 AT0_CASE_REFUSED CASE_PARSE_ERROR +refuse/R15-out-of-order.case R1 AT0_CASE_REFUSED CASE_PARSE_ERROR +refuse/R16-float-text.case R1 AT0_CASE_REFUSED CASE_PARSE_ERROR +refuse/R17-noncanonical-integer.case R1 AT0_CASE_REFUSED CASE_NONCANONICAL +refuse/R18-noncanonical-scaled.case R1 AT0_CASE_REFUSED CASE_NONCANONICAL +refuse/R19-label-uppercase.case R1 AT0_CASE_REFUSED CASE_PARSE_ERROR +refuse/R20-energies-not-increasing.case R3 AT0_CASE_REFUSED CASE_INVALID_PARAMETER +refuse/R21-psi-zero.case R3 AT0_CASE_REFUSED CASE_INVALID_PARAMETER +refuse/R22-tau-zero.case R3 AT0_CASE_REFUSED CASE_INVALID_PARAMETER +refuse/R23-weight-negative.case R3 AT0_CASE_REFUSED CASE_INVALID_PARAMETER +refuse/R24-wrong-domain.case R2 AT0_CASE_REFUSED CASE_UNSUPPORTED_VERSION +refuse/R25-wrong-contract.case R2 AT0_CASE_REFUSED CASE_UNSUPPORTED_VERSION +refuse/R26-clock-dim-65.case R3 AT0_CASE_REFUSED CASE_INVALID_PARAMETER +refuse/R39-huge-digits-tau.case R39 AT0_CASE_REFUSED CASE_INVALID_PARAMETER +refuse/R27-rational-over-limit.case R3 AT0_CASE_REFUSED CASE_INVALID_PARAMETER +refuse/R28-duplicate-label.case R3 AT0_CASE_REFUSED CASE_INVALID_PARAMETER +refuse/R29-ref-label-missing.case R3 AT0_CASE_REFUSED CASE_INVALID_PARAMETER +refuse/R30-negative-zero.case R1 AT0_CASE_REFUSED CASE_NONCANONICAL +refuse/R31-control-kind-bad.case R3 AT0_CASE_REFUSED CASE_INVALID_PARAMETER +refuse/R32-case-name-two-tokens.case R1 AT0_CASE_REFUSED CASE_PARSE_ERROR +refuse/R33-missing-final-lf.case R1 AT0_CASE_REFUSED CASE_PARSE_ERROR +refuse/R34-empty.case R1 AT0_CASE_REFUSED CASE_PARSE_ERROR +refuse/R35-trailing-line.case R1 AT0_CASE_REFUSED CASE_PARSE_ERROR +refuse/R36-label-count-mismatch.case R3 AT0_CASE_REFUSED CASE_INVALID_PARAMETER +refuse/R37-model-family-bad.case R3 AT0_CASE_REFUSED CASE_INVALID_PARAMETER +refuse/R38-acceptance-id-wrong.case R5 AT0_CASE_REFUSED CASE_ID_MISMATCH diff --git a/research/atemporal/at0/evaluator/cases/generate.sh b/research/atemporal/at0/evaluator/cases/generate.sh new file mode 100644 index 000000000..22761d695 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/generate.sh @@ -0,0 +1,77 @@ +#!/bin/sh +# Regenerates the public AT-0 case corpus of the Agent 4 evaluator from the +# generator (positive and negative controls) and from byte-level edits of the +# contract example (refusal controls). Hand derivations: ../README.md section 4. +# Usage: sh cases/generate.sh (run from evaluator/) +set -eu +T=${1:-build/at0-eval} +P=cases/positive; N=cases/negative; R=cases/refuse +K=$P/P1-kat-ideal-qubit-n4.case # the contract's own example, kept verbatim +G() { out=$1; shift; "$T" gen "$@" > "$out"; } +# ---- positive controls (expected PASS) ---- +G $P/P1b-ideal-n4-tau8-m8.case name=at0-p1b-ideal-n4-tau8-m8 tau=1/8 w=1/2 M=8 +G $P/P1c-ideal-n6-m6.case name=at0-p1c-ideal-n6-m6 E=-5/2,-3/2,-1/2,1/2,3/2,5/2 tau=1/6 w=1/1 M=6 +G $P/P1d-ref-offset-t2.case name=at0-p1d-ref-offset-t2 ref=t2 +G $P/P1e-x-axis-rotation.case name=at0-p1e-x-axis-rotation h=0/1,1/2,0/1,0/1 'psi=(1/1;0/1),(0/1;0/1)' +G $P/P1f-y-axis-rotation.case name=at0-p1f-y-axis-rotation h=0/1,0/1,1/2,0/1 'psi=(1/1;0/1),(0/1;0/1)' +G $P/P1g-complex-psi-yplus.case name=at0-p1g-complex-psi-yplus 'psi=(1/1;0/1),(0/1;1/1)' +G $P/P2-tilted-h0.case name=at0-p2-tilted-h0 E=-3/4,-1/4,1/4,3/4 h=1/4,3/10,0/1,2/5 tau=1/2 w=1/1 M=4 +G $P/P2b-h0-shift-control.case name=at0-p2b-h0-shift-control h=1/1,0/1,0/1,1/2 +G $P/P3-spec-reference-model.case name=at0-p3-spec-reference-model E=-1/1,0/1 h=1/2,0/1,0/1,-1/2 tau=1/4 w=1/2 M=4 +G $P/P4-degenerate-identity-h.case name=at0-p4-degenerate-identity-h E=-1/2,1/2,3/2,5/2 h=1/2,0/1,0/1,0/1 tau=1/4 w=1/1 M=4 +G $P/P5-large-rationals.case name=at0-p5-large-rationals E=-7/1048573,7/1048573 h=0/1,2/1048573,3/1048573,6/1048573 'psi=(1/1048571;0/1),(1/1048569;1/1048567)' tau=1048573/28 w=1/1 M=2 +# ---- negative controls (expected FAIL with exactly these codes) ---- +G $N/N1-uncovered-spectrum.case name=at0-n1-uncovered-spectrum E=1/1,2/1,3/1,4/1 control=NEGATIVE expected=FAIL codes=TRIVIAL_PHYSICAL_STATE +G $N/N2-half-covered.case name=at0-n2-half-covered E=-3/2,1/2,3/2,7/2 control=NEGATIVE expected=FAIL codes=SCHRODINGER_DEVIATION_EXCEEDED +G $N/N3-broken-clock-tau3.case name=at0-n3-broken-clock-tau3 tau=1/3 control=NEGATIVE expected=FAIL codes=POVM_NORMALIZATION_EXCEEDED +G $N/N4-wrong-weight-2.case name=at0-n4-wrong-weight-2 w=2/1 control=NEGATIVE expected=FAIL codes=POVM_NORMALIZATION_EXCEEDED,PROBABILITY_SUM_EXCEEDED +G $N/N4b-wrong-weight-5.case name=at0-n4b-wrong-weight-5 w=5/1 control=NEGATIVE expected=FAIL codes=POVM_NORMALIZATION_EXCEEDED,PROBABILITY_OUT_OF_RANGE,PROBABILITY_SUM_EXCEEDED +G $N/N5-precision-demand.case name=at0-n5-precision-demand minbk=RIGOROUS control=NEGATIVE expected=FAIL codes=BOUND_KIND_INSUFFICIENT +G $N/N6-zero-kernel-component.case name=at0-n6-zero-kernel-component E=-3/2,1/2,3/2,7/2 'psi=(1/1;0/1),(0/1;0/1)' control=NEGATIVE expected=FAIL codes=TRIVIAL_PHYSICAL_STATE +G $N/N7-unreachable-labels.case name=at0-n7-unreachable-labels tolz=1@0 control=NEGATIVE expected=FAIL codes=CONDITIONAL_UNDEFINED +# ---- refusal controls: byte edits of the example; expected code in MANIFEST.tsv ---- +E() { out=$1; shift; sed "$@" "$K" > "$out"; } +E $R/R01-noncanonical-rational.case 's|^povm_weight 1/1$|povm_weight 2/2|' +E $R/R02-header-v2.case 's|^OMEGA-AT0-CASE v1$|OMEGA-AT0-CASE v2|' +"$T" gen name=at0-r03-clock-dim-1 E=-1/2 > $R/R03-clock-dim-1.case +"$T" gen name=at0-r04-irrational h=0/1,1/1,0/1,1/1 > $R/R04-irrational-spectrum.case +E $R/R05-wrong-case-id.case 's|^case_id 3cf4|case_id 4cf4|' +"$T" gen name=at0-r06-codes-with-pass expected=PASS codes=TRIVIAL_PHYSICAL_STATE > $R/R06-codes-with-pass.case +"$T" gen name=at0-r06b-codes-unsorted expected=FAIL control=NEGATIVE codes=PROBABILITY_SUM_EXCEEDED,POVM_NORMALIZATION_EXCEEDED > $R/R06b-codes-unsorted.case +"$T" gen name=at0-r06c-codes-unknown expected=FAIL control=NEGATIVE codes=FOO_BAR > $R/R06c-codes-unknown.case +"$T" gen name=at0-r06d-fail-without-codes expected=FAIL control=NEGATIVE codes=none > $R/R06d-fail-without-codes.case +sed 's|$|\r|' "$K" > $R/R07-crlf.case +E $R/R08-tab.case 's|^clock_dim 4$|clock_dim\t4|' +sed 's|^begin semantic$|begin semantic\n|' "$K" > $R/R09-blank-line.case +E $R/R10-trailing-space.case 's|^system_dim 2$|system_dim 2 |' +E $R/R11-double-space.case 's|^system_dim 2$|system_dim 2|' +E $R/R12-missing-key.case '/^interaction NONE$/d' +sed 's|^interaction NONE$|interaction NONE\nfoo bar|' "$K" > $R/R13-unknown-key.case +sed 's|^interaction NONE$|interaction NONE\ninteraction NONE|' "$K" > $R/R14-duplicate-key.case +awk '/^interaction NONE$/{h=$0; next} /^constraint SUM_HC_HS$/{print; print h; next} {print}' "$K" > $R/R15-out-of-order.case +E $R/R16-float-text.case 's|^povm_tau_turns 1/4$|povm_tau_turns 0.25|' +E $R/R17-noncanonical-integer.case 's|^clock_dim 4$|clock_dim 04|' +E $R/R18-noncanonical-scaled.case 's|^tol_probability 1@12$|tol_probability 10@13|' +E $R/R19-label-uppercase.case 's|^clock_label 0 t0$|clock_label 0 T0|; s|^reference_clock_label t0$|reference_clock_label T0|' +"$T" gen name=at0-r20-energies-not-increasing E=-1/2,-3/2,1/2,3/2 > $R/R20-energies-not-increasing.case +"$T" gen name=at0-r21-psi-zero 'psi=(0/1;0/1),(0/1;0/1)' > $R/R21-psi-zero.case +"$T" gen name=at0-r22-tau-zero tau=0/1 > $R/R22-tau-zero.case +"$T" gen name=at0-r23-weight-negative w=-1/1 > $R/R23-weight-negative.case +E $R/R24-wrong-domain.case 's|^domain omega.at0.case.v1$|domain omega.at0.case.v2|' +E $R/R25-wrong-contract.case 's|^contract AT0_CASE_V1$|contract AT0_CASE_V2|' +E65=$(i=0; s=""; while [ $i -lt 65 ]; do s="$s${s:+,}$i/1"; i=$((i+1)); done; printf "%s" "$s") +E $R/R26-clock-dim-65.case "s|^clock_dim 4$|clock_dim 65|; s|^clock_energies .*$|clock_energies $E65|" +E $R/R39-huge-digits-tau.case 's|^povm_tau_turns .*$|povm_tau_turns 340282366920938463463374607431768211457/4|' +"$T" gen name=at0-r27-rational-over-limit E=-1048577/1,-1/2,1/2,3/2 > $R/R27-rational-over-limit.case +"$T" gen name=at0-r28-duplicate-label labels=t0,t1,t1,t3 > $R/R28-duplicate-label.case +"$T" gen name=at0-r29-ref-label-missing ref=t9 > $R/R29-ref-label-missing.case +E $R/R30-negative-zero.case 's|^system_hamiltonian_pauli 0/1,0/1,0/1,1/2$|system_hamiltonian_pauli -0/1,0/1,0/1,1/2|' +E $R/R31-control-kind-bad.case 's|^control_kind POSITIVE$|control_kind MAYBE|' +E $R/R32-case-name-two-tokens.case 's|^case_name at0-kat-ideal-qubit-n4$|case_name at0 kat|' +head -c -1 "$K" > $R/R33-missing-final-lf.case +: > $R/R34-empty.case +sed 's|^end$|end\nextra|' "$K" > $R/R35-trailing-line.case +E $R/R36-label-count-mismatch.case 's|^clock_label_count 4$|clock_label_count 5|' +E $R/R37-model-family-bad.case 's|^model_family PAGE_WOOTTERS_FINITE_IDEAL$|model_family PAGE_WOOTTERS_INTERACTING|' +E $R/R38-acceptance-id-wrong.case 's|^acceptance_id a13f|acceptance_id b13f|' +echo "generated: $(ls $P $N $R | grep -c '\.case$') case files" diff --git a/research/atemporal/at0/evaluator/cases/negative/N1-uncovered-spectrum.case b/research/atemporal/at0/evaluator/cases/negative/N1-uncovered-spectrum.case new file mode 100644 index 000000000..8af3f8123 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/negative/N1-uncovered-spectrum.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name at0-n1-uncovered-spectrum +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/evaluator/cases/negative/N2-half-covered.case b/research/atemporal/at0/evaluator/cases/negative/N2-half-covered.case new file mode 100644 index 000000000..6bed38f95 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/negative/N2-half-covered.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name at0-n2-half-covered +begin semantic +model_family PAGE_WOOTTERS_FINITE_IDEAL +energy_unit DIMENSIONLESS_HBAR_1 +clock_dim 4 +clock_energies -3/2,1/2,3/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 124e0ddb8b43791da8851718a205e51c57cbdab9fa8da8fd8b39468c7fca950d +acceptance_id 756c1914e6fc0579bc038b958da0f00ef5dcab36b1abdce1f0d092b8183241dd +end diff --git a/research/atemporal/at0/evaluator/cases/negative/N3-broken-clock-tau3.case b/research/atemporal/at0/evaluator/cases/negative/N3-broken-clock-tau3.case new file mode 100644 index 000000000..08ee48bb7 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/negative/N3-broken-clock-tau3.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name at0-n3-broken-clock-tau3 +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/evaluator/cases/negative/N4-wrong-weight-2.case b/research/atemporal/at0/evaluator/cases/negative/N4-wrong-weight-2.case new file mode 100644 index 000000000..54a925ed2 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/negative/N4-wrong-weight-2.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name at0-n4-wrong-weight-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 (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/evaluator/cases/negative/N4b-wrong-weight-5.case b/research/atemporal/at0/evaluator/cases/negative/N4b-wrong-weight-5.case new file mode 100644 index 000000000..9161e00c0 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/negative/N4b-wrong-weight-5.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name at0-n4b-wrong-weight-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,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 5/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_OUT_OF_RANGE,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 5e00398d468a4fd896b248a790dab88e5a1bae318a47fec1441e97a4d3ad4b38 +acceptance_id 485f6eb53048a051f9b489a0e537e8823ecc5caf456aafe1c1f7abf9b0407cc6 +end diff --git a/research/atemporal/at0/evaluator/cases/negative/N5-precision-demand.case b/research/atemporal/at0/evaluator/cases/negative/N5-precision-demand.case new file mode 100644 index 000000000..e3b2b95f5 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/negative/N5-precision-demand.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name at0-n5-precision-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/evaluator/cases/negative/N6-zero-kernel-component.case b/research/atemporal/at0/evaluator/cases/negative/N6-zero-kernel-component.case new file mode 100644 index 000000000..e46a74fb9 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/negative/N6-zero-kernel-component.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name at0-n6-zero-kernel-component +begin semantic +model_family PAGE_WOOTTERS_FINITE_IDEAL +energy_unit DIMENSIONLESS_HBAR_1 +clock_dim 4 +clock_energies -3/2,1/2,3/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),(0/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 f5cea11fcc39d5afca6c01079b14cbd8edacd4ea2b22e20c85b65d17d8d678ca +acceptance_id b9cbcd95b3c4ae102a33cc055aaaf18f2c9bf67144e2b2c34c3d9a381cd1ac97 +end diff --git a/research/atemporal/at0/evaluator/cases/negative/N7-unreachable-labels.case b/research/atemporal/at0/evaluator/cases/negative/N7-unreachable-labels.case new file mode 100644 index 000000000..64ef0caf5 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/negative/N7-unreachable-labels.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name at0-n7-unreachable-labels +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 CONDITIONAL_UNDEFINED +min_bound_kind ESTIMATED +tol_constraint_residual 1@12 +tol_povm_residual 1@12 +tol_probability 1@12 +tol_zero_probability 1@0 +tol_schrodinger 1@12 +end acceptance +case_id 3cf4ca4f882b5b9691ddcd905e65e15010855adcd2be200e19ebc3184655b44d +acceptance_id d6fe62a1efc4ea33dc527d163999706101f8f4ff7eeeebf95517171fe99a5d57 +end diff --git a/research/atemporal/at0/evaluator/cases/positive/P1-kat-ideal-qubit-n4.case b/research/atemporal/at0/evaluator/cases/positive/P1-kat-ideal-qubit-n4.case new file mode 100644 index 000000000..3f4c2c03d --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/positive/P1-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/evaluator/cases/positive/P1b-ideal-n4-tau8-m8.case b/research/atemporal/at0/evaluator/cases/positive/P1b-ideal-n4-tau8-m8.case new file mode 100644 index 000000000..560db213e --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/positive/P1b-ideal-n4-tau8-m8.case @@ -0,0 +1,44 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name at0-p1b-ideal-n4-tau8-m8 +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/8 +povm_weight 1/2 +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 1b4398091d15f7502b765582c689e73fea615b6b12d33690cea5561587d18321 +acceptance_id a13fb02dd674b8042ef8c0a197f03d58768709f782ba59cd26545eef6d41a228 +end diff --git a/research/atemporal/at0/evaluator/cases/positive/P1c-ideal-n6-m6.case b/research/atemporal/at0/evaluator/cases/positive/P1c-ideal-n6-m6.case new file mode 100644 index 000000000..b735cdfcc --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/positive/P1c-ideal-n6-m6.case @@ -0,0 +1,42 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name at0-p1c-ideal-n6-m6 +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/evaluator/cases/positive/P1d-ref-offset-t2.case b/research/atemporal/at0/evaluator/cases/positive/P1d-ref-offset-t2.case new file mode 100644 index 000000000..0aa8e2226 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/positive/P1d-ref-offset-t2.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name at0-p1d-ref-offset-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/evaluator/cases/positive/P1e-x-axis-rotation.case b/research/atemporal/at0/evaluator/cases/positive/P1e-x-axis-rotation.case new file mode 100644 index 000000000..9ab9dcea5 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/positive/P1e-x-axis-rotation.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name at0-p1e-x-axis-rotation +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,1/2,0/1,0/1 +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/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 4772e87d65cf4f4353699d9992fa6b1d1fd40a1f28927ff2400b88a14cb37ca4 +acceptance_id a13fb02dd674b8042ef8c0a197f03d58768709f782ba59cd26545eef6d41a228 +end diff --git a/research/atemporal/at0/evaluator/cases/positive/P1f-y-axis-rotation.case b/research/atemporal/at0/evaluator/cases/positive/P1f-y-axis-rotation.case new file mode 100644 index 000000000..09ed23926 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/positive/P1f-y-axis-rotation.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name at0-p1f-y-axis-rotation +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,1/2,0/1 +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/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 2ff467ee1ed1e6cda2d872044e4c862362c1fe2643e34a3d46d6269d4f7f660f +acceptance_id a13fb02dd674b8042ef8c0a197f03d58768709f782ba59cd26545eef6d41a228 +end diff --git a/research/atemporal/at0/evaluator/cases/positive/P1g-complex-psi-yplus.case b/research/atemporal/at0/evaluator/cases/positive/P1g-complex-psi-yplus.case new file mode 100644 index 000000000..52e5e635e --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/positive/P1g-complex-psi-yplus.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name at0-p1g-complex-psi-yplus +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),(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 e0eb5af69f22cd46eae025337d0843a50679ac9cb3a0bfcb68c898a13ded34a9 +acceptance_id a13fb02dd674b8042ef8c0a197f03d58768709f782ba59cd26545eef6d41a228 +end diff --git a/research/atemporal/at0/evaluator/cases/positive/P2-tilted-h0.case b/research/atemporal/at0/evaluator/cases/positive/P2-tilted-h0.case new file mode 100644 index 000000000..9256b60b2 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/positive/P2-tilted-h0.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name at0-p2-tilted-h0 +begin semantic +model_family PAGE_WOOTTERS_FINITE_IDEAL +energy_unit DIMENSIONLESS_HBAR_1 +clock_dim 4 +clock_energies -3/4,-1/4,1/4,3/4 +system_dim 2 +system_hamiltonian_pauli 1/4,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/2 +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 2158d91b12696f238e782d6b3d2f4bda60e11513b4140b689632a8da780c0b6f +acceptance_id a13fb02dd674b8042ef8c0a197f03d58768709f782ba59cd26545eef6d41a228 +end diff --git a/research/atemporal/at0/evaluator/cases/positive/P2b-h0-shift-control.case b/research/atemporal/at0/evaluator/cases/positive/P2b-h0-shift-control.case new file mode 100644 index 000000000..a563c2a2f --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/positive/P2b-h0-shift-control.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name at0-p2b-h0-shift-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 1/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 57fbbc05fccd9056aa6b2fe1d06b4d1253d8692754263d75100a05ad0dc2d18f +acceptance_id a13fb02dd674b8042ef8c0a197f03d58768709f782ba59cd26545eef6d41a228 +end diff --git a/research/atemporal/at0/evaluator/cases/positive/P3-spec-reference-model.case b/research/atemporal/at0/evaluator/cases/positive/P3-spec-reference-model.case new file mode 100644 index 000000000..535cae513 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/positive/P3-spec-reference-model.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name at0-p3-spec-reference-model +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/evaluator/cases/positive/P4-degenerate-identity-h.case b/research/atemporal/at0/evaluator/cases/positive/P4-degenerate-identity-h.case new file mode 100644 index 000000000..bab40402d --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/positive/P4-degenerate-identity-h.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name at0-p4-degenerate-identity-h +begin semantic +model_family PAGE_WOOTTERS_FINITE_IDEAL +energy_unit DIMENSIONLESS_HBAR_1 +clock_dim 4 +clock_energies -1/2,1/2,3/2,5/2 +system_dim 2 +system_hamiltonian_pauli 1/2,0/1,0/1,0/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/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 3590d9f368bc36f71ab02f29eecfc7dc6219996f575975919253cf367e732aec +acceptance_id a13fb02dd674b8042ef8c0a197f03d58768709f782ba59cd26545eef6d41a228 +end diff --git a/research/atemporal/at0/evaluator/cases/positive/P5-large-rationals.case b/research/atemporal/at0/evaluator/cases/positive/P5-large-rationals.case new file mode 100644 index 000000000..77acaa6ca --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/positive/P5-large-rationals.case @@ -0,0 +1,38 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name at0-p5-large-rationals +begin semantic +model_family PAGE_WOOTTERS_FINITE_IDEAL +energy_unit DIMENSIONLESS_HBAR_1 +clock_dim 2 +clock_energies -7/1048573,7/1048573 +system_dim 2 +system_hamiltonian_pauli 0/1,2/1048573,3/1048573,6/1048573 +interaction NONE +constraint SUM_HC_HS +physical_state NULLSPACE_PROJECTION +reference_clock_label t0 +reference_system_state (1/1048571;0/1),(1/1048569;1/1048567) +clock_povm COVARIANT_DISCRETE +povm_tau_turns 1048573/28 +povm_weight 1/1 +clock_label_count 2 +clock_label 0 t0 +clock_label 1 t1 +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 46726a3921759525561c49c54697d4b4ef9e5712519eb65c49df2724120f5aec +acceptance_id a13fb02dd674b8042ef8c0a197f03d58768709f782ba59cd26545eef6d41a228 +end diff --git a/research/atemporal/at0/evaluator/cases/refuse/R01-noncanonical-rational.case b/research/atemporal/at0/evaluator/cases/refuse/R01-noncanonical-rational.case new file mode 100644 index 000000000..da4da36ad --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R01-noncanonical-rational.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 2/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 3cf4ca4f882b5b9691ddcd905e65e15010855adcd2be200e19ebc3184655b44d +acceptance_id a13fb02dd674b8042ef8c0a197f03d58768709f782ba59cd26545eef6d41a228 +end diff --git a/research/atemporal/at0/evaluator/cases/refuse/R02-header-v2.case b/research/atemporal/at0/evaluator/cases/refuse/R02-header-v2.case new file mode 100644 index 000000000..c5bf24bf4 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R02-header-v2.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v2 +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/evaluator/cases/refuse/R03-clock-dim-1.case b/research/atemporal/at0/evaluator/cases/refuse/R03-clock-dim-1.case new file mode 100644 index 000000000..2b0c46d9d --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R03-clock-dim-1.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name at0-r03-clock-dim-1 +begin semantic +model_family PAGE_WOOTTERS_FINITE_IDEAL +energy_unit DIMENSIONLESS_HBAR_1 +clock_dim 1 +clock_energies -1/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 627562c51861d7df22db0787f4053f89f9f682bf3d57402d8abfbcbc87f5c667 +acceptance_id a13fb02dd674b8042ef8c0a197f03d58768709f782ba59cd26545eef6d41a228 +end diff --git a/research/atemporal/at0/evaluator/cases/refuse/R04-irrational-spectrum.case b/research/atemporal/at0/evaluator/cases/refuse/R04-irrational-spectrum.case new file mode 100644 index 000000000..5ffbe7441 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R04-irrational-spectrum.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name at0-r04-irrational +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,1/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/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 60c251607aa95e088e525d5c328af17ca337c55731b76252fdd72d396295f33c +acceptance_id a13fb02dd674b8042ef8c0a197f03d58768709f782ba59cd26545eef6d41a228 +end diff --git a/research/atemporal/at0/evaluator/cases/refuse/R05-wrong-case-id.case b/research/atemporal/at0/evaluator/cases/refuse/R05-wrong-case-id.case new file mode 100644 index 000000000..ca1b4f68f --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R05-wrong-case-id.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 4cf4ca4f882b5b9691ddcd905e65e15010855adcd2be200e19ebc3184655b44d +acceptance_id a13fb02dd674b8042ef8c0a197f03d58768709f782ba59cd26545eef6d41a228 +end diff --git a/research/atemporal/at0/evaluator/cases/refuse/R06-codes-with-pass.case b/research/atemporal/at0/evaluator/cases/refuse/R06-codes-with-pass.case new file mode 100644 index 000000000..bd9fd86a0 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R06-codes-with-pass.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name at0-r06-codes-with-pass +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 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 3cf4ca4f882b5b9691ddcd905e65e15010855adcd2be200e19ebc3184655b44d +acceptance_id c07236679c7065eb612a40fa2bdf43c0c1c7ef0dea5fd64533c5dd7db3e5c289 +end diff --git a/research/atemporal/at0/evaluator/cases/refuse/R06b-codes-unsorted.case b/research/atemporal/at0/evaluator/cases/refuse/R06b-codes-unsorted.case new file mode 100644 index 000000000..0270cdda6 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R06b-codes-unsorted.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name at0-r06b-codes-unsorted +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 PROBABILITY_SUM_EXCEEDED,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 3cf4ca4f882b5b9691ddcd905e65e15010855adcd2be200e19ebc3184655b44d +acceptance_id 0f9d595f34edc7c5ee5f429a714012b79f100c4eb76f199f2f0446f45c585e3b +end diff --git a/research/atemporal/at0/evaluator/cases/refuse/R06c-codes-unknown.case b/research/atemporal/at0/evaluator/cases/refuse/R06c-codes-unknown.case new file mode 100644 index 000000000..043bd9bd1 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R06c-codes-unknown.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name at0-r06c-codes-unknown +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 FOO_BAR +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 9cc5abd47e37302da2bc295e803ada014304f393f85eb7644c540dcca6f4636a +end diff --git a/research/atemporal/at0/evaluator/cases/refuse/R06d-fail-without-codes.case b/research/atemporal/at0/evaluator/cases/refuse/R06d-fail-without-codes.case new file mode 100644 index 000000000..b1715f485 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R06d-fail-without-codes.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name at0-r06d-fail-without-codes +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 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 cf028d19d436ec030755483f3ddcda50d4ac6ee6ff59b80826e4ada56d6244d9 +end diff --git a/research/atemporal/at0/evaluator/cases/refuse/R07-crlf.case b/research/atemporal/at0/evaluator/cases/refuse/R07-crlf.case new file mode 100644 index 000000000..74b40809c --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R07-crlf.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/evaluator/cases/refuse/R08-tab.case b/research/atemporal/at0/evaluator/cases/refuse/R08-tab.case new file mode 100644 index 000000000..ca1fa3881 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R08-tab.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/evaluator/cases/refuse/R09-blank-line.case b/research/atemporal/at0/evaluator/cases/refuse/R09-blank-line.case new file mode 100644 index 000000000..44eaf2f54 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R09-blank-line.case @@ -0,0 +1,41 @@ +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/evaluator/cases/refuse/R10-trailing-space.case b/research/atemporal/at0/evaluator/cases/refuse/R10-trailing-space.case new file mode 100644 index 000000000..70fcdd5c1 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R10-trailing-space.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/evaluator/cases/refuse/R11-double-space.case b/research/atemporal/at0/evaluator/cases/refuse/R11-double-space.case new file mode 100644 index 000000000..e0f62b45a --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R11-double-space.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/evaluator/cases/refuse/R12-missing-key.case b/research/atemporal/at0/evaluator/cases/refuse/R12-missing-key.case new file mode 100644 index 000000000..6ca31e8e6 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R12-missing-key.case @@ -0,0 +1,39 @@ +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 +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/evaluator/cases/refuse/R13-unknown-key.case b/research/atemporal/at0/evaluator/cases/refuse/R13-unknown-key.case new file mode 100644 index 000000000..41b760f36 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R13-unknown-key.case @@ -0,0 +1,41 @@ +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 +foo bar +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/evaluator/cases/refuse/R14-duplicate-key.case b/research/atemporal/at0/evaluator/cases/refuse/R14-duplicate-key.case new file mode 100644 index 000000000..842bb0b59 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R14-duplicate-key.case @@ -0,0 +1,41 @@ +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 +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/evaluator/cases/refuse/R15-out-of-order.case b/research/atemporal/at0/evaluator/cases/refuse/R15-out-of-order.case new file mode 100644 index 000000000..153d64611 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R15-out-of-order.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 +constraint SUM_HC_HS +interaction NONE +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/evaluator/cases/refuse/R16-float-text.case b/research/atemporal/at0/evaluator/cases/refuse/R16-float-text.case new file mode 100644 index 000000000..1d6d416bb --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R16-float-text.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 0.25 +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/evaluator/cases/refuse/R17-noncanonical-integer.case b/research/atemporal/at0/evaluator/cases/refuse/R17-noncanonical-integer.case new file mode 100644 index 000000000..822257bee --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R17-noncanonical-integer.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 04 +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/evaluator/cases/refuse/R18-noncanonical-scaled.case b/research/atemporal/at0/evaluator/cases/refuse/R18-noncanonical-scaled.case new file mode 100644 index 000000000..ca7eca576 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R18-noncanonical-scaled.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 10@13 +tol_zero_probability 1@9 +tol_schrodinger 1@12 +end acceptance +case_id 3cf4ca4f882b5b9691ddcd905e65e15010855adcd2be200e19ebc3184655b44d +acceptance_id a13fb02dd674b8042ef8c0a197f03d58768709f782ba59cd26545eef6d41a228 +end diff --git a/research/atemporal/at0/evaluator/cases/refuse/R19-label-uppercase.case b/research/atemporal/at0/evaluator/cases/refuse/R19-label-uppercase.case new file mode 100644 index 000000000..8d683284b --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R19-label-uppercase.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/evaluator/cases/refuse/R20-energies-not-increasing.case b/research/atemporal/at0/evaluator/cases/refuse/R20-energies-not-increasing.case new file mode 100644 index 000000000..80fe9a168 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R20-energies-not-increasing.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name at0-r20-energies-not-increasing +begin semantic +model_family PAGE_WOOTTERS_FINITE_IDEAL +energy_unit DIMENSIONLESS_HBAR_1 +clock_dim 4 +clock_energies -1/2,-3/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 eff7154be6cda67a9ab57af68c3ad48a63616581df3d8589c89f5abf11805a25 +acceptance_id a13fb02dd674b8042ef8c0a197f03d58768709f782ba59cd26545eef6d41a228 +end diff --git a/research/atemporal/at0/evaluator/cases/refuse/R21-psi-zero.case b/research/atemporal/at0/evaluator/cases/refuse/R21-psi-zero.case new file mode 100644 index 000000000..d63855940 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R21-psi-zero.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name at0-r21-psi-zero +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;0/1),(0/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 9aac8c4c487e3fb4acccd223721abf3fcbbee87c05713d544fcbc7d5a85f7441 +acceptance_id a13fb02dd674b8042ef8c0a197f03d58768709f782ba59cd26545eef6d41a228 +end diff --git a/research/atemporal/at0/evaluator/cases/refuse/R22-tau-zero.case b/research/atemporal/at0/evaluator/cases/refuse/R22-tau-zero.case new file mode 100644 index 000000000..9776914c5 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R22-tau-zero.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name at0-r22-tau-zero +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 0/1 +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 ed67c0a81dd24f0d7eac66043989827b81dc3d6cf5c40ec687b01ed1c74288a1 +acceptance_id a13fb02dd674b8042ef8c0a197f03d58768709f782ba59cd26545eef6d41a228 +end diff --git a/research/atemporal/at0/evaluator/cases/refuse/R23-weight-negative.case b/research/atemporal/at0/evaluator/cases/refuse/R23-weight-negative.case new file mode 100644 index 000000000..cfcf31b58 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R23-weight-negative.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name at0-r23-weight-negative +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 de26c1666c4e2603a9ea7a322167390f6279c72dbd4f1cae422937e13a965c1d +acceptance_id a13fb02dd674b8042ef8c0a197f03d58768709f782ba59cd26545eef6d41a228 +end diff --git a/research/atemporal/at0/evaluator/cases/refuse/R24-wrong-domain.case b/research/atemporal/at0/evaluator/cases/refuse/R24-wrong-domain.case new file mode 100644 index 000000000..138409497 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R24-wrong-domain.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v2 +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/evaluator/cases/refuse/R25-wrong-contract.case b/research/atemporal/at0/evaluator/cases/refuse/R25-wrong-contract.case new file mode 100644 index 000000000..28b76d024 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R25-wrong-contract.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V2 +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/evaluator/cases/refuse/R26-clock-dim-65.case b/research/atemporal/at0/evaluator/cases/refuse/R26-clock-dim-65.case new file mode 100644 index 000000000..4572ba8d9 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R26-clock-dim-65.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 65 +clock_energies 0/1,1/1,2/1,3/1,4/1,5/1,6/1,7/1,8/1,9/1,10/1,11/1,12/1,13/1,14/1,15/1,16/1,17/1,18/1,19/1,20/1,21/1,22/1,23/1,24/1,25/1,26/1,27/1,28/1,29/1,30/1,31/1,32/1,33/1,34/1,35/1,36/1,37/1,38/1,39/1,40/1,41/1,42/1,43/1,44/1,45/1,46/1,47/1,48/1,49/1,50/1,51/1,52/1,53/1,54/1,55/1,56/1,57/1,58/1,59/1,60/1,61/1,62/1,63/1,64/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 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/evaluator/cases/refuse/R27-rational-over-limit.case b/research/atemporal/at0/evaluator/cases/refuse/R27-rational-over-limit.case new file mode 100644 index 000000000..674d31b8d --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R27-rational-over-limit.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name at0-r27-rational-over-limit +begin semantic +model_family PAGE_WOOTTERS_FINITE_IDEAL +energy_unit DIMENSIONLESS_HBAR_1 +clock_dim 4 +clock_energies -1048577/1,-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 f64585aba980f2887102e23fb2a91daa6f4867a9d3b1f0f737ad5654e1df1eb4 +acceptance_id a13fb02dd674b8042ef8c0a197f03d58768709f782ba59cd26545eef6d41a228 +end diff --git a/research/atemporal/at0/evaluator/cases/refuse/R28-duplicate-label.case b/research/atemporal/at0/evaluator/cases/refuse/R28-duplicate-label.case new file mode 100644 index 000000000..821cdad3c --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R28-duplicate-label.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name at0-r28-duplicate-label +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 t1 +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 dd7a47b9c678d2f929b84327be8f2f80a6e043127a6d8edbd4f7d2d4c32b1aea +acceptance_id a13fb02dd674b8042ef8c0a197f03d58768709f782ba59cd26545eef6d41a228 +end diff --git a/research/atemporal/at0/evaluator/cases/refuse/R29-ref-label-missing.case b/research/atemporal/at0/evaluator/cases/refuse/R29-ref-label-missing.case new file mode 100644 index 000000000..255831a49 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R29-ref-label-missing.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name at0-r29-ref-label-missing +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 t9 +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 86caaf29b6b154ade4676d4a515470152c708047738261e107743758108d5489 +acceptance_id a13fb02dd674b8042ef8c0a197f03d58768709f782ba59cd26545eef6d41a228 +end diff --git a/research/atemporal/at0/evaluator/cases/refuse/R30-negative-zero.case b/research/atemporal/at0/evaluator/cases/refuse/R30-negative-zero.case new file mode 100644 index 000000000..0727f3c02 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R30-negative-zero.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/evaluator/cases/refuse/R31-control-kind-bad.case b/research/atemporal/at0/evaluator/cases/refuse/R31-control-kind-bad.case new file mode 100644 index 000000000..ecd45aecb --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R31-control-kind-bad.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 MAYBE +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/evaluator/cases/refuse/R32-case-name-two-tokens.case b/research/atemporal/at0/evaluator/cases/refuse/R32-case-name-two-tokens.case new file mode 100644 index 000000000..3cbe01eb4 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R32-case-name-two-tokens.case @@ -0,0 +1,40 @@ +OMEGA-AT0-CASE v1 +domain omega.at0.case.v1 +contract AT0_CASE_V1 +case_name at0 kat +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/evaluator/cases/refuse/R33-missing-final-lf.case b/research/atemporal/at0/evaluator/cases/refuse/R33-missing-final-lf.case new file mode 100644 index 000000000..4703d55dc --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R33-missing-final-lf.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 \ No newline at end of file diff --git a/research/atemporal/at0/evaluator/cases/refuse/R34-empty.case b/research/atemporal/at0/evaluator/cases/refuse/R34-empty.case new file mode 100644 index 000000000..e69de29bb diff --git a/research/atemporal/at0/evaluator/cases/refuse/R35-trailing-line.case b/research/atemporal/at0/evaluator/cases/refuse/R35-trailing-line.case new file mode 100644 index 000000000..7c98e1d52 --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R35-trailing-line.case @@ -0,0 +1,41 @@ +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 +extra diff --git a/research/atemporal/at0/evaluator/cases/refuse/R36-label-count-mismatch.case b/research/atemporal/at0/evaluator/cases/refuse/R36-label-count-mismatch.case new file mode 100644 index 000000000..bfa6025cc --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R36-label-count-mismatch.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 5 +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/evaluator/cases/refuse/R37-model-family-bad.case b/research/atemporal/at0/evaluator/cases/refuse/R37-model-family-bad.case new file mode 100644 index 000000000..21f0259df --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R37-model-family-bad.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_INTERACTING +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/evaluator/cases/refuse/R38-acceptance-id-wrong.case b/research/atemporal/at0/evaluator/cases/refuse/R38-acceptance-id-wrong.case new file mode 100644 index 000000000..f006ce70c --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R38-acceptance-id-wrong.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 b13fb02dd674b8042ef8c0a197f03d58768709f782ba59cd26545eef6d41a228 +end diff --git a/research/atemporal/at0/evaluator/cases/refuse/R39-huge-digits-tau.case b/research/atemporal/at0/evaluator/cases/refuse/R39-huge-digits-tau.case new file mode 100644 index 000000000..965ad48fc --- /dev/null +++ b/research/atemporal/at0/evaluator/cases/refuse/R39-huge-digits-tau.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 340282366920938463463374607431768211457/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/evaluator/gates/clean_control.c b/research/atemporal/at0/evaluator/gates/clean_control.c new file mode 100644 index 000000000..ddb1f604f --- /dev/null +++ b/research/atemporal/at0/evaluator/gates/clean_control.c @@ -0,0 +1,4 @@ +/* Negative control for gates/isolation.sh: pure arithmetic, no forbidden + * symbol. The gate must PASS on this object. */ +#include +double at0_clean_phase(double x) { return cos(x) * cos(x) + sin(x) * sin(x); } diff --git a/research/atemporal/at0/evaluator/gates/hidden_clock_mutant.c b/research/atemporal/at0/evaluator/gates/hidden_clock_mutant.c new file mode 100644 index 000000000..f0907561f --- /dev/null +++ b/research/atemporal/at0/evaluator/gates/hidden_clock_mutant.c @@ -0,0 +1,9 @@ +/* Positive control for gates/isolation.sh: a compute-like object that secretly + * reads the wall clock. The gate must FAIL on this object. Never linked into + * anything else. */ +#include +double at0_mutant_phase(double x) { + struct timespec ts; + clock_gettime(CLOCK_REALTIME, &ts); + return x + (double)(ts.tv_nsec % 7) * 1e-18; +} diff --git a/research/atemporal/at0/evaluator/gates/isolation.sh b/research/atemporal/at0/evaluator/gates/isolation.sh new file mode 100644 index 000000000..2ed14da06 --- /dev/null +++ b/research/atemporal/at0/evaluator/gates/isolation.sh @@ -0,0 +1,29 @@ +#!/bin/sh +# AT-0 evaluator isolation gate (charter section 3, gate AT0-G2 method; adapted +# from omega tests/physics0/isolation.sh). Compute objects of the candidate +# (engine, oracle) must reference no clock, randomness, environment, file, +# process, socket or thread symbol. Works on .o files and on linked executables +# (C or Rust) via nm static and dynamic tables; undefined and defined references both count. +# Limits: inline syscalls, raw timer reads (CNTVCT_EL0 / rdtsc) and symbols resolved at run time +# through dlsym-free tricks are NOT visible to a symbol scan (see ISOLATION_REPORT.md). +# sh gates/isolation.sh ... +# Prints AT0_ISOLATION: PASS|FAIL and one line per hit. Exit 0 on PASS. +fail=0 +FORBIDDEN="clock_gettime clock_getres clock_nanosleep clock gettimeofday time timegm timelocal localtime localtime_r gmtime gmtime_r mktime strftime nanosleep sleep usleep rand rand_r srand random srandom drand48 lrand48 arc4random getrandom getentropy getenv secure_getenv setenv putenv fopen fopen64 freopen open open64 openat openat64 creat socket connect accept bind listen send recv sendto recvfrom getaddrinfo gethostbyname dlopen dlsym system popen fork vfork posix_spawn execv execve execvp execl pthread_create thrd_create clone syscall" +for o in "$@"; do + [ -f "$o" ] || { echo "missing $o"; fail=1; continue; } + # static (-p) and dynamic (-D) tables; a stripped executable keeps only its dynamic imports + if ! nm -p "$o" >"$o.nm" 2>/dev/null && ! nm -D "$o" >"$o.nm" 2>/dev/null; then echo "FAIL: $o: nm cannot read symbols (not an ELF object?)"; fail=1; rm -f "$o.nm"; continue; fi + { nm -p "$o" 2>/dev/null; nm -D "$o" 2>/dev/null; } > "$o.nm" + syms=$(awk 'NF>=2 {print $NF}' "$o.nm" | sed 's/@.*$//') + for bad in $FORBIDDEN; do + if echo "$syms" | grep -qx "_\{0,1\}${bad}" ; then echo "FAIL: $o references $bad"; fail=1; fi + done + # Rust std time/random/env/fs/net/process/thread paths in mangled names + if grep -qE 'std\.\.time|std\.\.env|std\.\.fs|std\.\.net|std\.\.process|std\.\.thread|rand\.\.|getrandom' "$o.nm"; then + echo "FAIL: $o references a Rust std time/env/fs/net/process/thread or rand path"; fail=1 + fi + rm -f "$o.nm" +done +if [ $fail = 0 ]; then echo "AT0_ISOLATION: PASS ($# objects clean)"; else echo "AT0_ISOLATION: FAIL"; fi +exit $fail diff --git a/research/atemporal/at0/evaluator/results/.gitignore b/research/atemporal/at0/evaluator/results/.gitignore new file mode 100644 index 000000000..9b6395373 --- /dev/null +++ b/research/atemporal/at0/evaluator/results/.gitignore @@ -0,0 +1 @@ +candidate-*.result diff --git a/research/atemporal/at0/evaluator/results/qualification.json b/research/atemporal/at0/evaluator/results/qualification.json new file mode 100644 index 000000000..c551658cc --- /dev/null +++ b/research/atemporal/at0/evaluator/results/qualification.json @@ -0,0 +1,43 @@ +{ + "program": "AT-0", + "agent": "Agent 4 independent adversarial evaluator", + "generated_utc": "2026-10-09T23:11:04Z", + "omega_commit": "3e4e1379a900759a212b7f002616e3fd333a43f3", + "omega_tree_clean": "NO", + "contract_commit": "044c9d11256d8642f80eedd42cbae8763faf63f5", + "charter_commit": "00e9f2308666f74e58f524b177b2a31eccdc69ba", + "spec_draft_commit": "0efd1a14cbdf117bc694b556bb61d031cf80c8f9", + "result_contract_version_expected": 2, + "isolation": "UNISOLATED", + "isolation_note": "single host, single user account, shared filesystem; hidden cases are withheld but their non-access cannot be proven (ISOLATION_REPORT.md)", + "verdict_scope": "software conformance of the AT-0 implementation to the frozen contracts; no scientific discovery verdict is awarded or implied", + "summary": {"pass": 14, "fail": 0, "inconclusive": 8, "blocked_no_candidate": 4, "not_run": 0, "self_test_overall": "PASS"}, + "tests": [ + {"id":"SELF-BUILD","class":"build","status":"PASS","reason":"cc -std=c11 -Wall -Wextra -Werror -pedantic"}, + {"id":"SELF-BUILD-ASAN","class":"build","status":"PASS","reason":"ASan/UBSan build"}, + {"id":"SELF-KAT-DIGESTS","class":"codec","status":"PASS","reason":"file, case_id and acceptance_id equal the published digests"}, + {"id":"SELF-GEN-ROUNDTRIP","class":"codec","status":"PASS","reason":"generator reproduces the example byte for byte"}, + {"id":"SELF-SHADOW-HAND-TABLE","class":"shadow","status":"PASS","reason":"shadow oracle reproduces the section 6 hand table"}, + {"id":"SELF-CORPUS-MANIFEST","class":"corpus","status":"PASS","reason":"62 cases give their expected response"}, + {"id":"SELF-DERIVATIONS","class":"derivation","status":"PASS","reason":"20 positive/negative cases: expected codes equal the derived codes"}, + {"id":"MUTANT-BLIND-P1-kat-ideal-qubit-n4-hardcoded_table","class":"mutant","status":"INCONCLUSIVE","reason":"defect indistinguishable from truth on this case by construction (status PASS); covered by another pair"}, + {"id":"MUTANT-BLIND-P1-kat-ideal-qubit-n4-wrong_weight_hidden","class":"mutant","status":"INCONCLUSIVE","reason":"defect indistinguishable from truth on this case by construction (status PASS); covered by another pair"}, + {"id":"MUTANT-BLIND-P1-kat-ideal-qubit-n4-verdict_forged","class":"mutant","status":"INCONCLUSIVE","reason":"defect indistinguishable from truth on this case by construction (status PASS); covered by another pair"}, + {"id":"MUTANT-BLIND-P1f-y-axis-rotation-conjugate_bug","class":"mutant","status":"INCONCLUSIVE","reason":"defect indistinguishable from truth on this case by construction (status PASS); covered by another pair"}, + {"id":"MUTANT-BLIND-P2b-h0-shift-control-hardcoded_table","class":"mutant","status":"INCONCLUSIVE","reason":"defect indistinguishable from truth on this case by construction (status PASS); covered by another pair"}, + {"id":"MUTANT-BLIND-P2-tilted-h0-reversed_reference","class":"mutant","status":"INCONCLUSIVE","reason":"defect indistinguishable from truth on this case by construction (status PASS); covered by another pair"}, + {"id":"MUTANT-BLIND-N7-unreachable-labels-label_status_wrong","class":"mutant","status":"INCONCLUSIVE","reason":"defect indistinguishable from truth on this case by construction (status PASS); covered by another pair"}, + {"id":"MUTANT-BLIND-P1-kat-ideal-qubit-n4-label_claimed_defined","class":"mutant","status":"INCONCLUSIVE","reason":"defect indistinguishable from truth on this case by construction (status PASS); covered by another pair"}, + {"id":"SELF-MUTANTS","class":"mutant","status":"PASS","reason":"41 discriminating case/mutant pairs all caught"}, + {"id":"MUTANT-dirty_tree","class":"mutant","status":"PASS","reason":"graded INCONCLUSIVE as designed (not citable)"}, + {"id":"MUTANT-contract_commit_wrong","class":"mutant","status":"PASS","reason":"graded INCONCLUSIVE as designed (not citable)"}, + {"id":"SELF-ASAN","class":"sanitizer","status":"PASS","reason":"codec, refusals, synth and verify clean under ASan/UBSan"}, + {"id":"GATE-ISOLATION-MUTANT-CAUGHT","class":"gate","status":"PASS","reason":"hidden-clock mutant rejected"}, + {"id":"GATE-ISOLATION-CLEAN-PASSES","class":"gate","status":"PASS","reason":"clean arithmetic object accepted"}, + {"id":"HIDDEN-COMMITMENT","class":"hidden","status":"PASS","reason":"private files match the committed digests (identity only, not non-access)"}, + {"id":"CAND-CODEC-CONFORMANCE","class":"candidate","status":"BLOCKED_NO_CANDIDATE","reason":"AT0_CANDIDATE_CASE_TOOL unset"}, + {"id":"CAND-VERIFY","class":"candidate","status":"BLOCKED_NO_CANDIDATE","reason":"AT0_CANDIDATE_RUN unset"}, + {"id":"CAND-WALLCLOCK-INDEPENDENCE","class":"control","status":"BLOCKED_NO_CANDIDATE","reason":"AT0_CANDIDATE_RUN unset"}, + {"id":"CAND-ISOLATION","class":"gate","status":"BLOCKED_NO_CANDIDATE","reason":"AT0_CANDIDATE_OBJECTS unset"} + ] +} diff --git a/research/atemporal/at0/evaluator/run.sh b/research/atemporal/at0/evaluator/run.sh new file mode 100755 index 000000000..7c7ad9862 --- /dev/null +++ b/research/atemporal/at0/evaluator/run.sh @@ -0,0 +1,183 @@ +#!/bin/sh +# AT-0 Agent 4 qualification runner. Builds the evaluator, runs its own +# red-before-green self-tests, the public corpus, the isolation-gate controls, +# and (when a candidate is supplied) the candidate conformance and verification +# tests. Writes results/qualification.json (machine-readable) and prints a table. +# +# sh run.sh [--self-only] +# Candidate hooks (environment; each unset hook leaves its tests BLOCKED_NO_CANDIDATE): +# AT0_CANDIDATE_CASE_TOOL command that takes a case path and prints AT0_CASE_OK +# (exit 0) or AT0_CASE_REFUSED on stderr (exit 2) +# AT0_CANDIDATE_RUN command that takes a case path and writes an +# AT0_RESULT file to standard output (engine + oracle run) +# AT0_CANDIDATE_OBJECTS space-separated compute objects/binaries for the isolation gate +# AT0_HIDDEN_DIR directory holding the hidden case files (default ~/at0-private/agent4) +# Statuses: PASS FAIL INCONCLUSIVE NOT_RUN BLOCKED_NO_CANDIDATE. UNISOLATED is a +# property of the whole run (ISOLATION_REPORT.md), never a test status. +set -u +cd "$(dirname "$0")" +T=build/at0-eval +OUT=results +TMP=${TMPDIR:-/tmp}/at0e-run-$$ +mkdir -p "$OUT" "$TMP" +trap 'rm -rf "$TMP"' EXIT +JSONL="$TMP/tests.jsonl"; : > "$JSONL" +npass=0; nfail=0; ninc=0; nblk=0; nnr=0 +esc() { printf '%s' "$1" | sed 's/\\/\\\\/g; s/"/\\"/g' | tr '\n\t' ' ' | cut -c1-400; } +rec() { # id class status reason + case "$3" in PASS) npass=$((npass+1));; FAIL) nfail=$((nfail+1));; INCONCLUSIVE) ninc=$((ninc+1));; BLOCKED_NO_CANDIDATE) nblk=$((nblk+1));; *) nnr=$((nnr+1));; esac + printf '{"id":"%s","class":"%s","status":"%s","reason":"%s"}\n' "$1" "$2" "$3" "$(esc "$4")" >> "$JSONL" + printf '%-44s %-8s %-20s %s\n' "$1" "$2" "$3" "$(printf '%s' "$4" | cut -c1-70)" +} +SELF_ONLY=0; [ "${1:-}" = "--self-only" ] && SELF_ONLY=1 + +# ---- build ---- +if make -s all >"$TMP/build.log" 2>&1; then rec SELF-BUILD build PASS "cc -std=c11 -Wall -Wextra -Werror -pedantic"; else rec SELF-BUILD build FAIL "$(tail -1 "$TMP/build.log")"; cat "$TMP/build.log"; exit 1; fi +if make -s asan >"$TMP/asan.log" 2>&1; then rec SELF-BUILD-ASAN build PASS "ASan/UBSan build"; else rec SELF-BUILD-ASAN build INCONCLUSIVE "$(tail -1 "$TMP/asan.log")"; fi + +# ---- known-answer test (AT0_CASE_V1 section 6, AT0_FREEZE.md) ---- +K=cases/positive/P1-kat-ideal-qubit-n4.case +fsha=$(sha256sum "$K" | cut -c1-64) +kat=$($T case "$K" --detail 2>&1 | tr '\n' ' ') +if [ "$fsha" = ed16c95c89bf312b0fbf95a4cd43bc352daa138954fabad78d8a170cd35b4e81 ] \ + && printf '%s' "$kat" | grep -q 'AT0_CASE_OK 3cf4ca4f882b5b9691ddcd905e65e15010855adcd2be200e19ebc3184655b44d' \ + && printf '%s' "$kat" | grep -q 'acceptance_id a13fb02dd674b8042ef8c0a197f03d58768709f782ba59cd26545eef6d41a228'; then + rec SELF-KAT-DIGESTS codec PASS "file, case_id and acceptance_id equal the published digests" +else rec SELF-KAT-DIGESTS codec FAIL "$kat"; fi +if $T gen name=at0-kat-ideal-qubit-n4 | cmp -s - "$K"; then rec SELF-GEN-ROUNDTRIP codec PASS "generator reproduces the example byte for byte"; else rec SELF-GEN-ROUNDTRIP codec FAIL "byte difference"; fi +sh_out=$($T shadow "$K") +if printf '%s\n' "$sh_out" | grep -q '^t0 *0.250000000 1.000000000 0.500000000 0.500000000' \ + && printf '%s\n' "$sh_out" | grep -q '^t1 *0.250000000 0.500000000 1.000000000 0.500000000' \ + && printf '%s\n' "$sh_out" | grep -q '^t2 *0.250000000 0.000000000 0.500000000 0.500000000' \ + && printf '%s\n' "$sh_out" | grep -q '^t3 *0.250000000 0.500000000 0.000000000 0.500000000' \ + && printf '%s\n' "$sh_out" | grep -q 'kernel_dim 2 .* povm_exact_identity 1'; then + rec SELF-SHADOW-HAND-TABLE shadow PASS "shadow oracle reproduces the section 6 hand table" +else rec SELF-SHADOW-HAND-TABLE shadow FAIL "table differs"; fi + +# ---- public corpus: every case gives its manifest response ---- +mm=0; mt=0 +while IFS="$(printf '\t')" read -r path cls want; do + case "$path" in '#'*|'') continue;; esac + mt=$((mt+1)) + got=$($T case "cases/$path" 2>&1 | head -1 | sed 's/ [0-9a-f]\{64\}$//') + [ "$got" = "$want" ] || { mm=$((mm+1)); rec "CORPUS-$(basename "$path" .case)" "$cls" FAIL "want [$want] got [$got]"; } +done < cases/MANIFEST.tsv +[ $mm = 0 ] && rec SELF-CORPUS-MANIFEST corpus PASS "$mt cases give their expected response" || rec SELF-CORPUS-MANIFEST corpus FAIL "$mm of $mt differ" + +# ---- hand derivations agree with shadow + exact checker (honest fixture -> expectation_met YES) ---- +bad=0; n=0 +for f in cases/positive/*.case cases/negative/*.case; do + n=$((n+1)); $T synth "$f" > "$TMP/h.result" 2>/dev/null || { bad=$((bad+1)); rec "DERIV-$(basename "$f" .case)" derivation FAIL "synth failed"; continue; } + em=$(grep '^expectation_met' "$TMP/h.result" | awk '{print $2}') + v=$($T result "$TMP/h.result" --case "$f" | head -1 | awk '{print $2}') + [ "$em" = YES ] && [ "$v" = PASS ] || { bad=$((bad+1)); rec "DERIV-$(basename "$f" .case)" derivation FAIL "expectation_met=$em verify=$v codes=$(grep '^failure_codes' "$TMP/h.result" | cut -d' ' -f2)"; } +done +[ $bad = 0 ] && rec SELF-DERIVATIONS derivation PASS "$n positive/negative cases: expected codes equal the derived codes" || rec SELF-DERIVATIONS derivation FAIL "$bad of $n disagree" + +# ---- red before green: every planted defect must be caught on a case where it bites ---- +# case:mutant pairs; see FAILURE_TAXONOMY.md section 3 for why each pair discriminates +MATRIX="P1-kat-ideal-qubit-n4:axis_swap P1-kat-ideal-qubit-n4:y_sign_swap P1-kat-ideal-qubit-n4:conjugate_bug P1-kat-ideal-qubit-n4:reversed_reference +P1-kat-ideal-qubit-n4:dephased_state P1-kat-ideal-qubit-n4:kernel_dim_wrong P1-kat-ideal-qubit-n4:residual_over_bound P1-kat-ideal-qubit-n4:nonfinite_hidden +P1-kat-ideal-qubit-n4:evidence_corrupt P1-kat-ideal-qubit-n4:verdict_id_corrupt P1-kat-ideal-qubit-n4:case_id_altered P1-kat-ideal-qubit-n4:tolerance_altered +P1-kat-ideal-qubit-n4:binding_rebound P1-kat-ideal-qubit-n4:times_reversed P1-kat-ideal-qubit-n4:oracle_is_engine P1-kat-ideal-qubit-n4:bound_none_nonzero +P1-kat-ideal-qubit-n4:label_status_wrong P1-kat-ideal-qubit-n4:placeholder_with_values P1-kat-ideal-qubit-n4:crlf P1-kat-ideal-qubit-n4:trailing_space +P1e-x-axis-rotation:conjugate_bug P1e-x-axis-rotation:y_sign_swap P1e-x-axis-rotation:axis_swap P1g-complex-psi-yplus:conjugate_bug P2-tilted-h0:axis_swap P5-large-rationals:conjugate_bug P5-large-rationals:axis_swap P5-large-rationals:hardcoded_table P1e-x-axis-rotation:reversed_reference P1g-complex-psi-yplus:reversed_reference +P1b-ideal-n4-tau8-m8:hardcoded_table P1d-ref-offset-t2:hardcoded_table P1c-ideal-n6-m6:hardcoded_table N4-wrong-weight-2:wrong_weight_hidden N4b-wrong-weight-5:wrong_weight_hidden +N2-half-covered:verdict_forged N3-broken-clock-tau3:verdict_forged N1-uncovered-spectrum:verdict_forged N6-zero-kernel-component:verdict_forged N7-unreachable-labels:verdict_forged N7-unreachable-labels:label_claimed_defined" +esc_n=0; tot=0 +for pair in $MATRIX; do + c=${pair%%:*}; m=${pair##*:}; f=$(ls cases/*/"$c".case); tot=$((tot+1)) + $T synth "$f" "$m" > "$TMP/m.result" 2>/dev/null || { esc_n=$((esc_n+1)); rec "MUTANT-$c-$m" mutant FAIL "synth failed"; continue; } + st=$($T result "$TMP/m.result" --case "$f" | head -1 | awk '{print $2}') + [ "$st" = FAIL ] || { esc_n=$((esc_n+1)); rec "MUTANT-$c-$m" mutant FAIL "defect not graded FAIL (status ${st:-none})"; } +done +# documented INCONCLUSIVE pairs (the defect is invisible on that case by construction) +for pair in P1-kat-ideal-qubit-n4:hardcoded_table P1-kat-ideal-qubit-n4:wrong_weight_hidden P1-kat-ideal-qubit-n4:verdict_forged P1f-y-axis-rotation:conjugate_bug P2b-h0-shift-control:hardcoded_table P2-tilted-h0:reversed_reference N7-unreachable-labels:label_status_wrong P1-kat-ideal-qubit-n4:label_claimed_defined; do + c=${pair%%:*}; m=${pair##*:}; f=$(ls cases/*/"$c".case) + $T synth "$f" "$m" > "$TMP/m.result" 2>/dev/null; st=$($T result "$TMP/m.result" --case "$f" | head -1 | awk '{print $2}') + rec "MUTANT-BLIND-$c-$m" mutant INCONCLUSIVE "defect indistinguishable from truth on this case by construction (status $st); covered by another pair" +done +[ $esc_n = 0 ] && rec SELF-MUTANTS mutant PASS "$tot discriminating case/mutant pairs all caught" || rec SELF-MUTANTS mutant FAIL "$esc_n of $tot escaped" +# dirty-tree and unknown contract commit are INCONCLUSIVE by design +for m in dirty_tree contract_commit_wrong; do + $T synth "$K" "$m" > "$TMP/m.result"; st=$($T result "$TMP/m.result" --case "$K" | head -1 | awk '{print $2}') + [ "$st" = INCONCLUSIVE ] && rec "MUTANT-$m" mutant PASS "graded INCONCLUSIVE as designed (not citable)" || rec "MUTANT-$m" mutant FAIL "graded $st, expected INCONCLUSIVE" +done +# sanitizer run of the same paths +if [ -x build/at0-eval-asan ]; then + ok=1 + build/at0-eval-asan case "$K" >/dev/null 2>"$TMP/a.err" || ok=0 + for m in evidence_corrupt crlf binding_rebound hardcoded_table; do build/at0-eval-asan synth "$K" "$m" > "$TMP/m.result" 2>>"$TMP/a.err" || ok=0; build/at0-eval-asan result "$TMP/m.result" --case "$K" >/dev/null 2>>"$TMP/a.err"; [ $? -gt 3 ] && ok=0; done + for f in cases/refuse/*.case; do build/at0-eval-asan case "$f" >/dev/null 2>>"$TMP/a.err"; [ $? -gt 2 ] && ok=0; done + grep -q 'ERROR: \(AddressSanitizer\|UndefinedBehaviorSanitizer\)\|runtime error' "$TMP/a.err" && ok=0 + [ $ok = 1 ] && rec SELF-ASAN sanitizer PASS "codec, refusals, synth and verify clean under ASan/UBSan" || rec SELF-ASAN sanitizer FAIL "$(grep -m1 'ERROR\|runtime error' "$TMP/a.err")" +else rec SELF-ASAN sanitizer NOT_RUN "no sanitizer binary"; fi + +# ---- isolation gate controls ---- +gate_build=1 +${CC:-cc} -std=c11 -Wall -Wextra -Werror -pedantic -O2 -D_POSIX_C_SOURCE=200809L -c gates/hidden_clock_mutant.c -o build/hidden_clock_mutant.o 2>"$TMP/g.err" || gate_build=0 +${CC:-cc} -std=c11 -Wall -Wextra -Werror -pedantic -O2 -c gates/clean_control.c -o build/clean_control.o 2>>"$TMP/g.err" || gate_build=0 +if [ $gate_build = 0 ]; then rec GATE-ISOLATION-MUTANT-CAUGHT gate NOT_RUN "control object failed to compile: $(head -1 "$TMP/g.err")"; rec GATE-ISOLATION-CLEAN-PASSES gate NOT_RUN "control object failed to compile"; else +if sh gates/isolation.sh build/hidden_clock_mutant.o >/dev/null 2>&1; then rec GATE-ISOLATION-MUTANT-CAUGHT gate FAIL "hidden clock_gettime mutant passed the gate"; else rec GATE-ISOLATION-MUTANT-CAUGHT gate PASS "hidden-clock mutant rejected"; fi +if sh gates/isolation.sh build/clean_control.o >/dev/null 2>&1; then rec GATE-ISOLATION-CLEAN-PASSES gate PASS "clean arithmetic object accepted"; else rec GATE-ISOLATION-CLEAN-PASSES gate FAIL "clean object rejected"; fi +fi + +# ---- hidden set commitment ---- +HD=${AT0_HIDDEN_DIR:-$HOME/at0-private/agent4} +if [ -d "$HD" ]; then + if (cd "$HD" && grep -v '^#' "$OLDPWD/HIDDEN_COMMITMENT.txt" | sha256sum -c --quiet - >/dev/null 2>&1); then rec HIDDEN-COMMITMENT hidden PASS "private files match the committed digests (identity only, not non-access)"; else rec HIDDEN-COMMITMENT hidden FAIL "digest mismatch or missing private file"; fi +else rec HIDDEN-COMMITMENT hidden INCONCLUSIVE "private set not present on this host"; fi + +# ---- candidate ---- +if [ $SELF_ONLY = 1 ]; then :; else +if [ -n "${AT0_CANDIDATE_CASE_TOOL:-}" ]; then + mm=0; mt=0 + while IFS="$(printf '\t')" read -r path cls want; do + case "$path" in '#'*|'') continue;; esac + mt=$((mt+1)); got=$($AT0_CANDIDATE_CASE_TOOL "cases/$path" 2>&1 | head -1 | sed 's/ [0-9a-f]\{64\}$//') + [ "$got" = "$want" ] || { mm=$((mm+1)); rec "CAND-CODEC-$(basename "$path" .case)" "$cls" FAIL "want [$want] got [$got]"; } + done < cases/MANIFEST.tsv + [ $mm = 0 ] && rec CAND-CODEC-CONFORMANCE candidate PASS "$mt public cases answered exactly as the contract requires" || rec CAND-CODEC-CONFORMANCE candidate FAIL "$mm of $mt differ" + if [ -d "$HD" ]; then hm=0; for f in "$HD"/H*.case; do got=$($AT0_CANDIDATE_CASE_TOOL "$f" 2>&1 | head -1 | cut -d' ' -f1); [ "$got" = AT0_CASE_OK ] || hm=$((hm+1)); done; [ $hm = 0 ] && rec CAND-CODEC-HIDDEN candidate PASS "hidden cases accepted" || rec CAND-CODEC-HIDDEN candidate FAIL "$hm hidden cases refused"; fi +else rec CAND-CODEC-CONFORMANCE candidate BLOCKED_NO_CANDIDATE "AT0_CANDIDATE_CASE_TOOL unset"; fi +if [ -n "${AT0_CANDIDATE_RUN:-}" ]; then + for f in cases/positive/*.case cases/negative/*.case $( [ -d "$HD" ] && ls "$HD"/H*.case ); do + id=$(basename "$f" .case) + $AT0_CANDIDATE_RUN "$f" > "$TMP/c.result" 2>"$TMP/c.err"; rc=$? + if [ $rc -ne 0 ]; then rec "CAND-RUN-$id" candidate FAIL "runner exit $rc : $(head -1 "$TMP/c.err")"; continue; fi + out=$($T result "$TMP/c.result" --case "$f" --json); st=$(printf '%s' "$out" | sed 's/.*"status":"\([A-Z]*\)".*/\1/') + em=$(grep '^expectation_met' "$TMP/c.result" | awk '{print $2}') + if [ "$st" = PASS ] && [ "$em" = YES ]; then rec "CAND-VERIFY-$id" candidate PASS "independent verification agrees; expectation met" + elif [ "$st" = PASS ]; then rec "CAND-VERIFY-$id" candidate FAIL "record is honest but expectation_met=$em: the physics did not do what the case expects" + else rec "CAND-VERIFY-$id" candidate "$st" "$(printf '%s' "$out" | sed 's/.*"findings":\[\(.*\)\]}/\1/' | cut -c1-200)"; fi + case "$id" in H*) mkdir -p "$HD/results" && cp "$TMP/c.result" "$HD/results/$id.result";; *) cp "$TMP/c.result" "$OUT/candidate-$id.result";; esac + done + # wall-clock / environment independence: same case twice, different TZ and a pause + f=$K; TZ=UTC $AT0_CANDIDATE_RUN "$f" > "$TMP/r1.result" 2>/dev/null; sleep 2; TZ=Asia/Tokyo AT0_EVALUATOR_NOISE=1 $AT0_CANDIDATE_RUN "$f" > "$TMP/r2.result" 2>/dev/null + v1=$(grep '^verdict_id' "$TMP/r1.result"); v2=$(grep '^verdict_id' "$TMP/r2.result"); e1=$(grep '^evidence_digest' "$TMP/r1.result"); e2=$(grep '^evidence_digest' "$TMP/r2.result") + b1=$(sed -n '/^begin values/,/^end values/p' "$TMP/r1.result" | sha256sum); b2=$(sed -n '/^begin values/,/^end values/p' "$TMP/r2.result" | sha256sum) + if [ -n "$v1" ] && [ "$v1" = "$v2" ] && [ "$b1" = "$b2" ] && [ "$e1" != "$e2" ]; then rec CAND-WALLCLOCK-INDEPENDENCE control PASS "verdict_id and values identical across time/TZ; evidence digests differ" + elif [ -n "$v1" ] && [ "$e1" = "$e2" ]; then rec CAND-WALLCLOCK-INDEPENDENCE control FAIL "evidence digests equal: run times not recorded or record reused" + else rec CAND-WALLCLOCK-INDEPENDENCE control FAIL "verdict or values changed with wall clock or environment"; fi +else rec CAND-VERIFY candidate BLOCKED_NO_CANDIDATE "AT0_CANDIDATE_RUN unset"; rec CAND-WALLCLOCK-INDEPENDENCE control BLOCKED_NO_CANDIDATE "AT0_CANDIDATE_RUN unset"; fi +if [ -n "${AT0_CANDIDATE_OBJECTS:-}" ]; then + if sh gates/isolation.sh $AT0_CANDIDATE_OBJECTS > "$TMP/iso.log" 2>&1; then rec CAND-ISOLATION gate PASS "no clock/random/env/file/net/process/thread symbol in candidate compute objects"; else rec CAND-ISOLATION gate FAIL "$(grep -m1 FAIL "$TMP/iso.log")"; fi +else rec CAND-ISOLATION gate BLOCKED_NO_CANDIDATE "AT0_CANDIDATE_OBJECTS unset"; fi +fi + +# ---- summary ---- +omega_commit=$(git -C ../../../.. rev-parse HEAD 2>/dev/null || echo unknown) +clean=$(git -C ../../../.. status --porcelain 2>/dev/null | grep -q . && echo NO || echo YES) +now=$(date -u +%Y-%m-%dT%H:%M:%SZ) +overall=PASS; [ $nfail -gt 0 ] && overall=FAIL +{ +printf '{\n "program": "AT-0",\n "agent": "Agent 4 independent adversarial evaluator",\n "generated_utc": "%s",\n' "$now" +printf ' "omega_commit": "%s",\n "omega_tree_clean": "%s",\n "contract_commit": "044c9d11256d8642f80eedd42cbae8763faf63f5",\n "charter_commit": "00e9f2308666f74e58f524b177b2a31eccdc69ba",\n "spec_draft_commit": "0efd1a14cbdf117bc694b556bb61d031cf80c8f9",\n' "$omega_commit" "$clean" +printf ' "result_contract_version_expected": 2,\n "isolation": "UNISOLATED",\n "isolation_note": "single host, single user account, shared filesystem; hidden cases are withheld but their non-access cannot be proven (ISOLATION_REPORT.md)",\n' +printf ' "verdict_scope": "software conformance of the AT-0 implementation to the frozen contracts; no scientific discovery verdict is awarded or implied",\n' +printf ' "summary": {"pass": %d, "fail": %d, "inconclusive": %d, "blocked_no_candidate": %d, "not_run": %d, "self_test_overall": "%s"},\n' $npass $nfail $ninc $nblk $nnr "$overall" +printf ' "tests": [\n'; sed '$!s/$/,/' "$JSONL" | sed 's/^/ /'; printf ' ]\n}\n' +} > "$OUT/qualification.json" +echo "---- summary: pass=$npass fail=$nfail inconclusive=$ninc blocked_no_candidate=$nblk not_run=$nnr (self-test overall $overall; isolation UNISOLATED)" +echo "written $OUT/qualification.json" +[ $nfail = 0 ] diff --git a/research/atemporal/at0/evaluator/src/at0e.h b/research/atemporal/at0/evaluator/src/at0e.h new file mode 100644 index 000000000..b6aff158b --- /dev/null +++ b/research/atemporal/at0/evaluator/src/at0e.h @@ -0,0 +1,242 @@ +/* AT-0 Agent 4 independent evaluator: shared declarations. + * + * Contracts: AT0_CASE_V1 and AT0_RESULT_V1, frozen at aien-architecture + * 044c9d11256d8642f80eedd42cbae8763faf63f5 (docs/plans/atemporal/). + * This code shares nothing with src/at0/ (engine, oracle, codec) and never will; + * the only omega source it links is src/sha256.c (charter section 3). + * + * Every decision is made in exact integer arithmetic. binary64 values read from a + * result are converted to exact dyadic rationals; scaled decimals are exact + * decimal rationals; both are brought over a common denominator 2^1100 * 10^80 + * and compared as fixed-width big integers (at0e_big). No float is ever compared. + */ +#ifndef AT0E_H +#define AT0E_H + +#include +#include + +#define AT0E_CONTRACT_COMMIT "044c9d11256d8642f80eedd42cbae8763faf63f5" +#define AT0E_CASE_DOMAIN "omega.at0.case.v1" +#define AT0E_ACC_DOMAIN "omega.at0.acceptance.v1" +#define AT0E_VERDICT_DOMAIN_V1 "omega.at0.verdict.v1" +#define AT0E_EVIDENCE_DOMAIN_V1 "omega.at0.evidence.v1" +#define AT0E_VERDICT_DOMAIN_V2 "omega.at0.verdict.v2" +#define AT0E_EVIDENCE_DOMAIN_V2 "omega.at0.evidence.v2" +/* Result contract version in force: V2 (Agent 0 ruling, omega#358 comment 6090404007). V1 results are still parsed and judged under their own tags. */ +#define AT0E_RESULT_VERSION_DEFAULT 2 + +#define AT0E_MAX_N 64 +#define AT0E_MAX_M 256 +#define AT0E_MAX_LINE 4096 +#define AT0E_RAT_LIMIT 1048576 + +__extension__ typedef __int128 i128; +__extension__ typedef unsigned __int128 u128; + +/* ---- exact rationals (int128, always reduced, d >= 1) ---- */ +typedef struct { i128 n, d; } rat; +rat rat_make(i128 n, i128 d); /* reduces; aborts on d == 0 */ +rat rat_add(rat a, rat b); +rat rat_sub(rat a, rat b); +rat rat_mul(rat a, rat b); +rat rat_neg(rat a); +int rat_cmp(rat a, rat b); +int rat_is_zero(rat a); +int rat_is_int(rat a); +rat rat_mod1(rat a); /* a - floor(a), in [0,1) */ +int rat_sqrt(rat a, rat *out); /* 1 if a is the square of a rational (a >= 0) */ +int rat_parse(const char *tok, rat *out, int *canonical); /* 1 on parse ok */ +void rat_format(rat a, char *buf, size_t cap); + +typedef struct { rat re, im; } crat; +int crat_parse(const char *tok, crat *out, int *canonical); +int crat_is_zero(crat z); + +/* ---- scaled decimal N@k ---- */ +typedef struct { u128 n; int k; } scaled; /* n < 10^38 fits u128 ; k 0..40 */ +int scaled_parse(const char *tok, scaled *out, int *canonical); + +/* ---- fixed-width big integers (4096 bits) ---- */ +#define BIG_LIMBS 128 +typedef struct { uint32_t l[BIG_LIMBS]; } big; +typedef struct { int neg; big m; } sbig; /* sign-magnitude; zero has neg = 0 */ +void big_zero(big *a); +void big_from_u128(big *a, u128 v); +int big_is_zero(const big *a); +int big_cmp(const big *a, const big *b); +void big_add(big *r, const big *a, const big *b); /* aborts on overflow */ +void big_sub(big *r, const big *a, const big *b); /* requires a >= b */ +void big_shl(big *a, unsigned bits); /* aborts on overflow */ +void big_mul_u32(big *a, uint32_t m); /* aborts on overflow */ +void big_mul_pow10(big *a, unsigned k); +void sbig_zero(sbig *a); +void sbig_add(sbig *r, const sbig *a, const sbig *b); +void sbig_neg(sbig *a); +void sbig_abs(sbig *a); +int sbig_cmp(const sbig *a, const sbig *b); +/* Common-denominator representation Q = value * 2^1100 * 10^80. */ +#define AT0E_DEN_P2 1100u +#define AT0E_DEN_P10 80u +void sbig_from_f64_bits(sbig *q, uint64_t bits); /* finite only */ +void sbig_from_scaled(sbig *q, scaled s); +void sbig_from_int(sbig *q, long v); + +/* ---- tri-state comparison of a quantity against a tolerance ---- */ +typedef enum { CMP_PASS = 0, CMP_FAIL = 1, CMP_INDET = 2 } tri; +/* absolute form: PASS if |v|+b <= tol, FAIL if |v|-b > tol, else INDET */ +tri tri_absolute(const sbig *v, const sbig *b, const sbig *tol); +/* signed form: PASS if v+b <= tol, FAIL if v-b > tol, else INDET */ +tri tri_signed(const sbig *v, const sbig *b, const sbig *tol); + +/* ---- text / files ---- */ +typedef struct { + char **lines; size_t n; /* each line without its LF */ + uint8_t *bytes; size_t len; /* whole file */ +} textfile; +/* Reads a file and enforces AT0_CASE_V1 section 1 byte rules. Returns 0 ok, + * else a nonzero reason code (see at0e_text.c) and *why names the rule. */ +int textfile_read(const char *path, textfile *tf, const char **why); +int textfile_from_bytes(const uint8_t *b, size_t len, textfile *tf, const char **why); +void textfile_free(textfile *tf); +int split_tokens(const char *line, char **tok, int max); /* single-space split; -1 if rule broken */ +int is_label(const char *s); +int is_name(const char *s); +int is_digest(const char *s); +int is_sha1hex(const char *s); +int is_text200(const char *s); +int parse_int_canonical(const char *s, long *out); /* canonical integer text */ +void sha256_hex(const uint8_t *data, size_t len, char out[65]); +void sha256_tagged_hex(const char *domain, const uint8_t *data, size_t len, char out[65]); +int hex_to_u64(const char *s16, uint64_t *out); + +/* ---- parsed case ---- */ +enum { BK_NONE = 0, BK_ESTIMATED = 1, BK_RIGOROUS = 2 }; +typedef struct { + char case_name[80]; + int N; + rat E[AT0E_MAX_N]; + rat h0, hx, hy, hz; + char ref_label[40]; + crat psi0[2]; + rat tau, w; + int M; + char label[AT0E_MAX_M][40]; + int control_positive; /* 1 POSITIVE, 0 NEGATIVE */ + int expected_pass; /* 1 PASS, 0 FAIL */ + char expected_codes[16][48]; int n_expected_codes; + int min_bound_kind; + scaled tol_constraint, tol_povm, tol_prob, tol_zero, tol_schro; + char case_id[65], acceptance_id[65]; + /* raw blocks, LF-terminated, for identity recomputation */ + char *sem_block; size_t sem_len; + char *acc_block; size_t acc_len; + char case_file_sha256[65]; + /* derived (exact) */ + rat radius; /* |h|, rational */ + int ref_index; /* k of reference label */ +} at0_case; + +/* Refusal codes (AT0_RESULT_V1 section 5), returned by case_parse_validate. */ +typedef enum { + REFUSE_NONE = 0, + REFUSE_PARSE_ERROR, REFUSE_NONCANONICAL, REFUSE_UNSUPPORTED_VERSION, + REFUSE_INVALID_PARAMETER, REFUSE_IRRATIONAL_SPECTRUM, REFUSE_ID_MISMATCH +} refusal; +const char *refusal_name(refusal r); +/* Parses the case lines (already byte-checked). On refusal, *detail names the + * offending line. The identities are recomputed and compared (rule 5). */ +refusal case_parse_validate(const textfile *tf, at0_case *c, const char **detail); +/* Same, on a sequence of lines starting at case_name (used inside results). */ +refusal case_parse_blocks(char **lines, size_t n, size_t *consumed, at0_case *c, const char **detail, int in_result); +void case_free(at0_case *c); +/* Writes the canonical case text for a filled-in semantic/acceptance struct, + * computing both identities. Returns bytes written or -1. */ +long case_emit(const at0_case *c, char *buf, size_t cap); +int failure_code_valid(const char *code); + +/* ---- shadow oracle (independent physics, long double) ---- */ +typedef struct { + int kernel_dim; /* exact */ + int matched[2]; /* e_+ (index 0) / e_- (index 1) matched by a clock energy */ + int psi_nonzero; /* exact: Psi != 0 */ + int povm_exact_identity; /* exact: sum F_k == I */ + long double povm_residual; /* numeric Frobenius norm */ + long double clock_p[AT0E_MAX_M]; + int clock_p_exact_zero[AT0E_MAX_M];/* exact: phi_k == 0 */ + long double pauli[AT0E_MAX_M][3][2]; /* [k][axis][sign] from the relational model */ + long double reference[AT0E_MAX_M][3][2];/* Schrodinger reference */ + long double bound; /* claimed absolute bound on every numeric above */ +} shadow; +int shadow_compute(const at0_case *c, shadow *s, const char **why); + +/* ---- parsed result ---- */ +typedef struct { int is_undefined, is_nonfinite; uint64_t bits; scaled bound; } rval; +enum { LS_DEFINED = 0, LS_UNDEFINED = 1, LS_INDETERMINATE = 2 }; +enum { CK_PASS = 0, CK_FAIL = 1, CK_INDET = 2, CK_NOTEVAL = 3 }; +enum { OUT_PASS = 0, OUT_FAIL = 1, OUT_ERROR = 2, OUT_NOT_RUN = 3 }; +#define AT0E_NCHECKS 10 +extern const char *const at0e_contract_commits[]; +extern const char *const at0e_check_names[AT0E_NCHECKS]; +extern const char *const at0e_check_codes[AT0E_NCHECKS]; +typedef struct { + at0_case c; + int version; /* 1 or 2, from the header */ + char case_file_sha256[65]; + int arithmetic; /* 0 BINARY64 1 INTERVAL 2 COMPENSATED 3 NONE */ + int bound_kind; + long kernel_dim; + rval constraint_residual, povm_residual; + int label_status[AT0E_MAX_M]; + rval clock_p[AT0E_MAX_M]; + rval pauli[AT0E_MAX_M][3][2]; + rval reference[AT0E_MAX_M][3][2]; + int check[AT0E_NCHECKS]; + int outcome; + char failure_codes[16][48]; int n_failure_codes; + char error_code[32]; + int expectation_met; /* 0 YES 1 NO 2 NOT_APPLICABLE */ + char verdict_id[65]; + char source_repo[80], source_commit[48], contract_commit[48], engine_sha256[65]; + char oracle_repo[80], oracle_commit[48], oracle_sha256[65]; + char build_cc[208], build_flags[208], host[208], run_started[32], run_finished[32]; + int source_tree_clean; /* 1 YES 0 NO */ + int n_artifacts; + char evidence_digest[65]; + /* raw */ + char *ver_block; size_t ver_len; + size_t evidence_line_index; /* index of evidence_digest line */ +} at0_result; + +/* Structural parse of a result (shape, encodings, embedded case). Returns 0 ok, + * else sets *finding to an evaluator finding code and *detail. */ +int result_parse(const textfile *tf, at0_result *r, const char **finding, const char **detail); +void result_free(at0_result *r); + +/* Independent re-derivation of the ten checks, outcome, codes, expectation. */ +typedef struct { + int check[AT0E_NCHECKS]; + int outcome; + char failure_codes[16][48]; int n_failure_codes; + int expectation_met; + int any_label_indeterminate; +} rederived; +void result_rederive(const at0_result *r, rederived *d); + +/* Evaluator findings: appended to a list and printed as JSON. */ +typedef struct { char code[48]; char detail[320]; } finding; +typedef struct { finding f[256]; int n; } findings; +void findings_add(findings *fs, const char *code, const char *fmt, ...); + +/* Full verification of one result file against an optional case file and the + * shadow oracle. Returns the evaluator status string: PASS, FAIL, INCONCLUSIVE. */ +const char *result_verify(const textfile *tf, const at0_result *r, const textfile *case_tf, + int use_shadow, findings *fs); + +/* Synthetic result writer (self-test fixtures only; never evidence). mutant may + * be NULL or one of the names listed by synth_mutant_names(). */ +long result_synth(const at0_case *c, const uint8_t *case_bytes, size_t case_len, + const char *mutant, char *buf, size_t cap, const char **why); +const char *const *synth_mutant_names(int *count); + +#endif /* AT0E_H */ diff --git a/research/atemporal/at0/evaluator/src/at0e_big.c b/research/atemporal/at0/evaluator/src/at0e_big.c new file mode 100644 index 000000000..f0de06a3c --- /dev/null +++ b/research/atemporal/at0/evaluator/src/at0e_big.c @@ -0,0 +1,255 @@ +/* Exact arithmetic for the AT-0 evaluator: int128 rationals, scaled decimals, + * 4096-bit integers, and the two tri-state comparison forms of AT0_RESULT_V1 + * section 4. Nothing here touches floating point except the bit-pattern + * decoder sbig_from_f64_bits, which only reads integer fields of the pattern. */ +#include "at0e.h" +#include +#include +#include + +static void die(const char *m) { fprintf(stderr, "at0e: internal: %s\n", m); abort(); } + +/* ---------------- rationals ---------------- */ +static i128 iabs(i128 a) { return a < 0 ? -a : a; } +static i128 igcd(i128 a, i128 b) { a = iabs(a); b = iabs(b); while (b) { i128 t = a % b; a = b; b = t; } return a; } + +rat rat_make(i128 n, i128 d) { + rat r; + if (d == 0) die("rational with zero denominator"); + if (d < 0) { n = -n; d = -d; } + i128 g = igcd(n, d); + if (g == 0) g = 1; + r.n = n / g; r.d = d / g; + return r; +} +rat rat_add(rat a, rat b) { return rat_make(a.n * b.d + b.n * a.d, a.d * b.d); } +rat rat_sub(rat a, rat b) { return rat_make(a.n * b.d - b.n * a.d, a.d * b.d); } +rat rat_mul(rat a, rat b) { return rat_make(a.n * b.n, a.d * b.d); } +rat rat_neg(rat a) { return rat_make(-a.n, a.d); } +int rat_cmp(rat a, rat b) { i128 l = a.n * b.d, r = b.n * a.d; return (l > r) - (l < r); } +int rat_is_zero(rat a) { return a.n == 0; } +int rat_is_int(rat a) { return a.d == 1; } +rat rat_mod1(rat a) { + i128 q = a.n / a.d; /* truncates toward zero */ + i128 rem = a.n - q * a.d; + if (rem < 0) rem += a.d; + return rat_make(rem, a.d); +} +static u128 isqrt_u128(u128 v) { + if (v < 2) return v; + u128 lo = 1, hi = (u128)1 << 64; /* v < 2^128 so sqrt < 2^64 */ + while (lo < hi) { + u128 mid = lo + (hi - lo + 1) / 2; + if (mid <= v / mid) lo = mid; else hi = mid - 1; + } + return lo; +} +int rat_sqrt(rat a, rat *out) { + if (a.n < 0) return 0; + u128 n = (u128)a.n, d = (u128)a.d; + u128 sn = isqrt_u128(n), sd = isqrt_u128(d); + if (sn * sn != n || sd * sd != d) return 0; + *out = rat_make((i128)sn, (i128)sd); + return 1; +} + +/* Canonical integer text: optional '-', no leading zeros, no '+', "-0" invalid. */ +static int parse_int_text(const char *s, size_t len, i128 *out, int *canonical) { + size_t i = 0; int neg = 0; + if (len == 0) return 0; + if (s[0] == '-') { neg = 1; i = 1; if (len == 1) return 0; } + if (s[i] == '+') return 0; + i128 v = 0; + for (size_t j = i; j < len; j++) { + if (s[j] < '0' || s[j] > '9') return 0; + if (j - i >= 20) { v = (i128)1 << 100; if (*canonical == 1) *canonical = -1; continue; } /* beyond any contract limit: saturate (no overflow) and flag; rat_parse refuses it as CASE_INVALID_PARAMETER */ + v = v * 10 + (s[j] - '0'); + } + if (len - i > 1 && s[i] == '0') *canonical = 0; /* leading zero */ + if (neg && v == 0) *canonical = 0; /* -0 */ + *out = neg ? -v : v; + return 1; +} +int parse_int_canonical(const char *s, long *out) { + i128 v; int canon = 1; + if (!parse_int_text(s, strlen(s), &v, &canon) || !canon) return 0; + if (v > 1000000000000L || v < -1000000000000L) return 0; + *out = (long)v; + return 1; +} +int rat_parse(const char *tok, rat *out, int *canonical) { + const char *slash = strchr(tok, '/'); + i128 n, d; int canon = 1; + if (!slash) return 0; + if (!parse_int_text(tok, (size_t)(slash - tok), &n, &canon)) return 0; + if (!parse_int_text(slash + 1, strlen(slash + 1), &d, &canon)) return 0; + if (d < 1) return 0; /* "d >= 1" is shape */ + int huge = canon == -1; /* a part saturated in parse_int_text: beyond any limit, reduction unknowable */ + if (!huge) { + if (igcd(n, d) != 1) canon = 0; + if (n == 0 && d != 1) canon = 0; + } + if (canon != 0 && (huge || iabs(n) > AT0E_RAT_LIMIT || d > AT0E_RAT_LIMIT)) canon = -1; /* beyond the section 2 limits: INVALID_PARAMETER (ambiguity A2); encoding errors still win */ + *canonical = canon; + *out = rat_make(n, d); + return 1; +} +void rat_format(rat a, char *buf, size_t cap) { + long long n = (long long)a.n, d = (long long)a.d; + snprintf(buf, cap, "%lld/%lld", n, d); +} +int crat_parse(const char *tok, crat *out, int *canonical) { + size_t len = strlen(tok); + if (len < 5 || tok[0] != '(' || tok[len - 1] != ')') return 0; + const char *semi = strchr(tok, ';'); + if (!semi) return 0; + char re[64], im[64]; + size_t rl = (size_t)(semi - tok - 1), il = len - 2 - rl - 1; + if (rl == 0 || rl >= sizeof re || il == 0 || il >= sizeof im) return 0; + memcpy(re, tok + 1, rl); re[rl] = 0; + memcpy(im, semi + 1, il); im[il] = 0; + int c1 = 1, c2 = 1; + if (!rat_parse(re, &out->re, &c1) || !rat_parse(im, &out->im, &c2)) return 0; + *canonical = (c1 < 0 || c2 < 0) ? -1 : (c1 && c2); + return 1; +} +int crat_is_zero(crat z) { return rat_is_zero(z.re) && rat_is_zero(z.im); } + +/* ---------------- scaled decimals ---------------- */ +int scaled_parse(const char *tok, scaled *out, int *canonical) { + const char *at = strchr(tok, '@'); + if (!at) return 0; + size_t nl = (size_t)(at - tok); + if (nl == 0 || nl > 38) return 0; + u128 n = 0; + for (size_t i = 0; i < nl; i++) { if (tok[i] < '0' || tok[i] > '9') return 0; n = n * 10 + (u128)(tok[i] - '0'); } + int canon = 1; + if (nl > 1 && tok[0] == '0') canon = 0; + const char *ks = at + 1; size_t kl = strlen(ks); + if (kl == 0 || kl > 2) return 0; + int k = 0; + for (size_t i = 0; i < kl; i++) { if (ks[i] < '0' || ks[i] > '9') return 0; k = k * 10 + (ks[i] - '0'); } + if (kl == 2 && ks[0] == '0') canon = 0; + if (k > 40) return 0; + if (n == 0 && k != 0) canon = 0; + if (n != 0 && k != 0 && n % 10 == 0) canon = 0; + *canonical = canon; + out->n = n; out->k = k; + return 1; +} + +/* ---------------- big integers ---------------- */ +void big_zero(big *a) { memset(a, 0, sizeof *a); } +void big_from_u128(big *a, u128 v) { big_zero(a); for (int i = 0; i < 4; i++) { a->l[i] = (uint32_t)v; v >>= 32; } } +int big_is_zero(const big *a) { for (int i = 0; i < BIG_LIMBS; i++) if (a->l[i]) return 0; return 1; } +int big_cmp(const big *a, const big *b) { + for (int i = BIG_LIMBS - 1; i >= 0; i--) { if (a->l[i] != b->l[i]) return a->l[i] > b->l[i] ? 1 : -1; } + return 0; +} +void big_add(big *r, const big *a, const big *b) { + uint64_t carry = 0; + for (int i = 0; i < BIG_LIMBS; i++) { uint64_t s = (uint64_t)a->l[i] + b->l[i] + carry; r->l[i] = (uint32_t)s; carry = s >> 32; } + if (carry) die("big_add overflow"); +} +void big_sub(big *r, const big *a, const big *b) { + int64_t borrow = 0; + for (int i = 0; i < BIG_LIMBS; i++) { + int64_t s = (int64_t)a->l[i] - b->l[i] - borrow; + if (s < 0) { s += (int64_t)1 << 32; borrow = 1; } else borrow = 0; + r->l[i] = (uint32_t)s; + } + if (borrow) die("big_sub underflow"); +} +void big_shl(big *a, unsigned bits) { + unsigned limbs = bits / 32, rem = bits % 32; + if (limbs >= BIG_LIMBS) { if (!big_is_zero(a)) die("big_shl overflow"); return; } + for (unsigned i = BIG_LIMBS - limbs; i < BIG_LIMBS; i++) if (a->l[i]) die("big_shl overflow"); + if (limbs) { + for (int i = BIG_LIMBS - 1; i >= (int)limbs; i--) a->l[i] = a->l[i - limbs]; + for (unsigned i = 0; i < limbs; i++) a->l[i] = 0; + } + if (rem) { + uint32_t carry = 0; + for (int i = 0; i < BIG_LIMBS; i++) { uint64_t v = ((uint64_t)a->l[i] << rem) | carry; a->l[i] = (uint32_t)v; carry = (uint32_t)(v >> 32); } + if (carry) die("big_shl overflow"); + } +} +void big_mul_u32(big *a, uint32_t m) { + uint64_t carry = 0; + for (int i = 0; i < BIG_LIMBS; i++) { uint64_t v = (uint64_t)a->l[i] * m + carry; a->l[i] = (uint32_t)v; carry = v >> 32; } + if (carry) die("big_mul overflow"); +} +void big_mul_pow10(big *a, unsigned k) { while (k >= 9) { big_mul_u32(a, 1000000000u); k -= 9; } while (k--) big_mul_u32(a, 10u); } + +void sbig_zero(sbig *a) { a->neg = 0; big_zero(&a->m); } +void sbig_neg(sbig *a) { if (!big_is_zero(&a->m)) a->neg = !a->neg; } +void sbig_abs(sbig *a) { a->neg = 0; } +void sbig_add(sbig *r, const sbig *a, const sbig *b) { + sbig t; + if (a->neg == b->neg) { big_add(&t.m, &a->m, &b->m); t.neg = a->neg; } + else { + int c = big_cmp(&a->m, &b->m); + if (c == 0) { sbig_zero(&t); } + else if (c > 0) { big_sub(&t.m, &a->m, &b->m); t.neg = a->neg; } + else { big_sub(&t.m, &b->m, &a->m); t.neg = b->neg; } + } + if (big_is_zero(&t.m)) t.neg = 0; + *r = t; +} +int sbig_cmp(const sbig *a, const sbig *b) { + if (a->neg != b->neg) return a->neg ? -1 : 1; + int c = big_cmp(&a->m, &b->m); + return a->neg ? -c : c; +} + +/* Q = v * 2^1100 * 10^80 for a finite binary64 v = (-1)^s * m * 2^e. */ +void sbig_from_f64_bits(sbig *q, uint64_t bits) { + int sign = (int)(bits >> 63); + int expo = (int)((bits >> 52) & 0x7ff); + uint64_t frac = bits & 0xfffffffffffffULL; + uint64_t m; int e; + if (expo == 0x7ff) die("nonfinite bit pattern reached exact arithmetic"); + if (expo == 0) { m = frac; e = -1074; } + else { m = frac | (1ULL << 52); e = expo - 1075; } + sbig_zero(q); + if (m == 0) return; + big_from_u128(&q->m, m); + big_shl(&q->m, (unsigned)(e + (int)AT0E_DEN_P2)); + big_mul_pow10(&q->m, AT0E_DEN_P10); + q->neg = sign; +} +void sbig_from_scaled(sbig *q, scaled s) { + sbig_zero(q); + if (s.n == 0) return; + big_from_u128(&q->m, s.n); + big_mul_pow10(&q->m, AT0E_DEN_P10 - (unsigned)s.k); + big_shl(&q->m, AT0E_DEN_P2); +} +void sbig_from_int(sbig *q, long v) { + sbig_zero(q); + if (v == 0) return; + big_from_u128(&q->m, (u128)(v < 0 ? -v : v)); + big_mul_pow10(&q->m, AT0E_DEN_P10); + big_shl(&q->m, AT0E_DEN_P2); + q->neg = v < 0; +} + +tri tri_absolute(const sbig *v, const sbig *b, const sbig *tol) { + sbig av = *v, hi, lo, nb = *b; + sbig_abs(&av); + sbig_add(&hi, &av, b); + if (sbig_cmp(&hi, tol) <= 0) return CMP_PASS; + sbig_neg(&nb); + sbig_add(&lo, &av, &nb); + if (sbig_cmp(&lo, tol) > 0) return CMP_FAIL; + return CMP_INDET; +} +tri tri_signed(const sbig *v, const sbig *b, const sbig *tol) { + sbig hi, lo, nb = *b; + sbig_add(&hi, v, b); + if (sbig_cmp(&hi, tol) <= 0) return CMP_PASS; + sbig_neg(&nb); + sbig_add(&lo, v, &nb); + if (sbig_cmp(&lo, tol) > 0) return CMP_FAIL; + return CMP_INDET; +} diff --git a/research/atemporal/at0/evaluator/src/at0e_case.c b/research/atemporal/at0/evaluator/src/at0e_case.c new file mode 100644 index 000000000..c498e3d39 --- /dev/null +++ b/research/atemporal/at0/evaluator/src/at0e_case.c @@ -0,0 +1,373 @@ +/* Independent AT0_CASE_V1 codec: parse, validate (section 4 order), identities + * (section 5), canonical emission. Written from the contract text only. */ +#include "at0e.h" +#include +#include +#include + +static const char *const failure_codes_v1[] = { + "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", NULL }; +int failure_code_valid(const char *code) { for (int i = 0; failure_codes_v1[i]; i++) if (!strcmp(code, failure_codes_v1[i])) return 1; return 0; } + +const char *refusal_name(refusal r) { + switch (r) { + case REFUSE_NONE: return "NONE"; + case REFUSE_PARSE_ERROR: return "CASE_PARSE_ERROR"; + case REFUSE_NONCANONICAL: return "CASE_NONCANONICAL"; + case REFUSE_UNSUPPORTED_VERSION: return "CASE_UNSUPPORTED_VERSION"; + case REFUSE_INVALID_PARAMETER: return "CASE_INVALID_PARAMETER"; + case REFUSE_IRRATIONAL_SPECTRUM: return "CASE_IRRATIONAL_SPECTRUM"; + case REFUSE_ID_MISMATCH: return "CASE_ID_MISMATCH"; + } + return "?"; +} + +/* Parsing state. Shape problems are fatal at once (rule 1 comes first); value + * problems are recorded in order of the rules and reported after the shape pass. */ +typedef struct { + char **lines; size_t n, i; + const char *detail; + int noncanonical; const char *noncanon_detail; + int bad_version; const char *version_detail; + int bad_param; const char *param_detail; +} ps; + +static int expect_key(ps *p, const char *key, char **val) { + char *tok[8]; + if (p->i >= p->n) { p->detail = "unexpected end of file"; return 0; } + const char *line = p->lines[p->i]; + int n = split_tokens(line, tok, 8); + if (n != 2 || strcmp(tok[0], key) != 0) { p->detail = line; return 0; } + *val = tok[1]; + p->i++; + return 1; +} +static int expect_exact(ps *p, const char *line) { + if (p->i >= p->n) { p->detail = "unexpected end of file"; return 0; } + if (strcmp(p->lines[p->i], line) != 0) { p->detail = p->lines[p->i]; return 0; } + p->i++; + return 1; +} +static void mark_nc(ps *p, const char *d) { if (!p->noncanonical) { p->noncanonical = 1; p->noncanon_detail = d; } } +static void mark_param(ps *p, const char *d) { if (!p->bad_param) { p->bad_param = 1; p->param_detail = d; } } + +/* fixed-value key: a mismatch is INVALID_PARAMETER (rule 3), not a parse error */ +static int fixed_value(ps *p, const char *key, const char *want) { + char *v; + if (!expect_key(p, key, &v)) return 0; + if (strcmp(v, want) != 0) mark_param(p, p->lines[p->i - 1]); + return 1; +} +static int parse_rat_list(ps *p, const char *val, rat *out, int max, int *count) { + char buf[AT0E_MAX_LINE]; snprintf(buf, sizeof buf, "%s", val); + size_t l = strlen(buf); + if (l == 0 || buf[0] == ',' || buf[l - 1] == ',' || strstr(buf, ",,")) return 0; + int n = 0; char *s = buf; + while (s) { + char *c = strchr(s, ','); if (c) *c = 0; + int canon = 1; rat tmp; + if (!rat_parse(s, &tmp, &canon)) return 0; + if (n >= 4096) return 0; + if (n < max) out[n] = tmp; else mark_param(p, p->lines[p->i - 1]); + if (canon < 0) mark_param(p, p->lines[p->i - 1]); else if (!canon) mark_nc(p, p->lines[p->i - 1]); + n++; + s = c ? c + 1 : NULL; + } + *count = n < max ? n : max; + return 1; +} +static int parse_code_list(const char *val, char codes[16][48], int *count) { + *count = 0; + if (!strcmp(val, "none")) return 1; + char buf[AT0E_MAX_LINE]; snprintf(buf, sizeof buf, "%s", val); + size_t l = strlen(buf); + if (l == 0 || buf[0] == ',' || buf[l - 1] == ',' || strstr(buf, ",,")) return 0; + char *s = buf; + while (s) { + char *c = strchr(s, ','); if (c) *c = 0; + if (*count >= 16 || strlen(s) >= 48 || strlen(s) == 0) return 0; + for (const char *q = s; *q; q++) if (!((*q >= 'A' && *q <= 'Z') || *q == '_')) return 0; + memcpy(codes[(*count)++], s, strlen(s) + 1); + s = c ? c + 1 : NULL; + } + return 1; +} +static int parse_scaled_field(ps *p, const char *key, scaled *out) { + char *v; int canon = 1; + if (!expect_key(p, key, &v)) return 0; + if (!scaled_parse(v, out, &canon)) { p->detail = p->lines[p->i - 1]; return 0; } + if (!canon) mark_nc(p, p->lines[p->i - 1]); + return 1; +} +static int parse_rat_field(ps *p, const char *key, rat *out) { + char *v; int canon = 1; + if (!expect_key(p, key, &v)) return 0; + if (!rat_parse(v, out, &canon)) { p->detail = p->lines[p->i - 1]; return 0; } + if (canon < 0) mark_param(p, p->lines[p->i - 1]); else if (!canon) mark_nc(p, p->lines[p->i - 1]); + return 1; +} +static int parse_int_field(ps *p, const char *key, long *out) { + char *v; + if (!expect_key(p, key, &v)) return 0; + /* canonical integer: shape-level parse, canonicity as NONCANONICAL */ + size_t l = strlen(v); int neg = v[0] == '-'; size_t s = neg ? 1 : 0; + if (l == s) { p->detail = p->lines[p->i - 1]; return 0; } + if (l - s > 12) { p->detail = p->lines[p->i - 1]; return 0; } + long val = 0; + for (size_t i = s; i < l; i++) { if (v[i] < '0' || v[i] > '9') { p->detail = p->lines[p->i - 1]; return 0; } val = val * 10 + (v[i] - '0'); } + if ((l - s > 1 && v[s] == '0') || (neg && val == 0)) mark_nc(p, p->lines[p->i - 1]); + *out = neg ? -val : val; + return 1; +} + +static char *join_lines(char **lines, size_t from, size_t to, size_t *len) { + size_t total = 0; + for (size_t i = from; i < to; i++) total += strlen(lines[i]) + 1; + char *b = malloc(total + 1); size_t o = 0; + for (size_t i = from; i < to; i++) { size_t l = strlen(lines[i]); memcpy(b + o, lines[i], l); o += l; b[o++] = '\n'; } + b[o] = 0; *len = o; + return b; +} + +refusal case_parse_blocks(char **lines, size_t n, size_t *consumed, at0_case *c, const char **detail, int in_result) { + ps p; memset(&p, 0, sizeof p); p.lines = lines; p.n = n; + memset(c, 0, sizeof *c); + char *v; long lv; + *detail = ""; + (void)in_result; + + if (!expect_key(&p, "case_name", &v)) goto parse_err; + if (!is_name(v)) goto parse_err_cur; + snprintf(c->case_name, sizeof c->case_name, "%s", v); + + size_t sem_start = p.i; + if (!expect_exact(&p, "begin semantic")) goto parse_err; + if (!fixed_value(&p, "model_family", "PAGE_WOOTTERS_FINITE_IDEAL")) goto parse_err; + if (!fixed_value(&p, "energy_unit", "DIMENSIONLESS_HBAR_1")) goto parse_err; + if (!parse_int_field(&p, "clock_dim", &lv)) goto parse_err; + if (lv < 2 || lv > AT0E_MAX_N) { mark_param(&p, p.lines[p.i - 1]); lv = lv < 2 ? 2 : AT0E_MAX_N; } + c->N = (int)lv; + { + int cnt = 0; + if (!expect_key(&p, "clock_energies", &v)) goto parse_err; + if (!parse_rat_list(&p, v, c->E, AT0E_MAX_N, &cnt)) goto parse_err_cur; + if (cnt != c->N) mark_param(&p, p.lines[p.i - 1]); + for (int i = 1; i < cnt; i++) if (rat_cmp(c->E[i - 1], c->E[i]) >= 0) { mark_param(&p, p.lines[p.i - 1]); break; } + if (cnt < c->N) c->N = cnt; + } + if (!fixed_value(&p, "system_dim", "2")) goto parse_err; + { + rat hs[4]; int cnt = 0; + if (!expect_key(&p, "system_hamiltonian_pauli", &v)) goto parse_err; + if (!parse_rat_list(&p, v, hs, 4, &cnt)) goto parse_err_cur; + if (cnt != 4) goto parse_err_cur; + c->h0 = hs[0]; c->hx = hs[1]; c->hy = hs[2]; c->hz = hs[3]; + } + if (!fixed_value(&p, "interaction", "NONE")) goto parse_err; + if (!fixed_value(&p, "constraint", "SUM_HC_HS")) goto parse_err; + if (!fixed_value(&p, "physical_state", "NULLSPACE_PROJECTION")) goto parse_err; + if (!expect_key(&p, "reference_clock_label", &v)) goto parse_err; + if (!is_label(v)) goto parse_err_cur; + snprintf(c->ref_label, sizeof c->ref_label, "%s", v); + { + if (!expect_key(&p, "reference_system_state", &v)) goto parse_err; + char buf[AT0E_MAX_LINE]; snprintf(buf, sizeof buf, "%s", v); + char *comma = strchr(buf, ','); + if (!comma || strchr(comma + 1, ',')) goto parse_err_cur; + *comma = 0; + int c1 = 1, c2 = 1; + if (!crat_parse(buf, &c->psi0[0], &c1) || !crat_parse(comma + 1, &c->psi0[1], &c2)) goto parse_err_cur; + if (c1 < 0 || c2 < 0) mark_param(&p, p.lines[p.i - 1]); else if (!c1 || !c2) mark_nc(&p, p.lines[p.i - 1]); + } + if (!fixed_value(&p, "clock_povm", "COVARIANT_DISCRETE")) goto parse_err; + if (!parse_rat_field(&p, "povm_tau_turns", &c->tau)) goto parse_err; + if (!parse_rat_field(&p, "povm_weight", &c->w)) goto parse_err; + if (!parse_int_field(&p, "clock_label_count", &lv)) goto parse_err; + if (lv < 1 || lv > AT0E_MAX_M) { mark_param(&p, p.lines[p.i - 1]); lv = lv < 1 ? 1 : AT0E_MAX_M; } + c->M = (int)lv; + for (int k = 0; k < c->M; k++) { + char *tok[8]; + if (p.i >= p.n) goto parse_err_eof; + int nt = split_tokens(p.lines[p.i], tok, 8); + if (nt != 3 || strcmp(tok[0], "clock_label") != 0) { + if (nt == 2 && strcmp(tok[0], "observables") == 0) { mark_param(&p, "clock_label_count larger than label lines"); c->M = k; break; } + p.detail = p.lines[p.i]; goto parse_err; + } + long kk; + if (!parse_int_canonical(tok[1], &kk)) { p.detail = p.lines[p.i]; goto parse_err; } + if (kk != k) { p.detail = p.lines[p.i]; goto parse_err; } + if (!is_label(tok[2])) { p.detail = p.lines[p.i]; goto parse_err; } + snprintf(c->label[k], sizeof c->label[k], "%s", tok[2]); + p.i++; + } + if (!fixed_value(&p, "observables", "PAULI_X,PAULI_Y,PAULI_Z")) goto parse_err; + if (!expect_exact(&p, "end semantic")) goto parse_err; + size_t sem_end = p.i; + + size_t acc_start = p.i; + if (!expect_exact(&p, "begin acceptance")) goto parse_err; + if (!expect_key(&p, "control_kind", &v)) goto parse_err; + if (!strcmp(v, "POSITIVE")) c->control_positive = 1; else if (!strcmp(v, "NEGATIVE")) c->control_positive = 0; else mark_param(&p, p.lines[p.i - 1]); + if (!expect_key(&p, "expected_outcome", &v)) goto parse_err; + if (!strcmp(v, "PASS")) c->expected_pass = 1; else if (!strcmp(v, "FAIL")) c->expected_pass = 0; else mark_param(&p, p.lines[p.i - 1]); + if (!expect_key(&p, "expected_failure_codes", &v)) goto parse_err; + if (!parse_code_list(v, c->expected_codes, &c->n_expected_codes)) goto parse_err_cur; + const char *codes_line = p.lines[p.i - 1]; + if (!expect_key(&p, "min_bound_kind", &v)) goto parse_err; + if (!strcmp(v, "RIGOROUS")) c->min_bound_kind = BK_RIGOROUS; else if (!strcmp(v, "ESTIMATED")) c->min_bound_kind = BK_ESTIMATED; else if (!strcmp(v, "NONE")) c->min_bound_kind = BK_NONE; else mark_param(&p, p.lines[p.i - 1]); + if (!parse_scaled_field(&p, "tol_constraint_residual", &c->tol_constraint)) goto parse_err; + if (!parse_scaled_field(&p, "tol_povm_residual", &c->tol_povm)) goto parse_err; + if (!parse_scaled_field(&p, "tol_probability", &c->tol_prob)) goto parse_err; + if (!parse_scaled_field(&p, "tol_zero_probability", &c->tol_zero)) goto parse_err; + if (!parse_scaled_field(&p, "tol_schrodinger", &c->tol_schro)) goto parse_err; + if (!expect_exact(&p, "end acceptance")) goto parse_err; + size_t acc_end = p.i; + + if (!expect_key(&p, "case_id", &v)) goto parse_err; + if (!is_digest(v)) goto parse_err_cur; + snprintf(c->case_id, sizeof c->case_id, "%s", v); + if (!expect_key(&p, "acceptance_id", &v)) goto parse_err; + if (!is_digest(v)) goto parse_err_cur; + snprintf(c->acceptance_id, sizeof c->acceptance_id, "%s", v); + *consumed = p.i; + + c->sem_block = join_lines(lines, sem_start, sem_end, &c->sem_len); + c->acc_block = join_lines(lines, acc_start, acc_end, &c->acc_len); + + /* rule 1 (value-level canonicity) */ + if (p.noncanonical) { *detail = p.noncanon_detail; return REFUSE_NONCANONICAL; } + /* rule 2 is checked by the caller for standalone files (header lines) */ + /* rule 3 */ + if (p.bad_param) { *detail = p.param_detail; return REFUSE_INVALID_PARAMETER; } + if (crat_is_zero(c->psi0[0]) && crat_is_zero(c->psi0[1])) { *detail = "reference_system_state is zero"; return REFUSE_INVALID_PARAMETER; } + if (rat_cmp(c->w, rat_make(0, 1)) <= 0) { *detail = "povm_weight <= 0"; return REFUSE_INVALID_PARAMETER; } + if (rat_cmp(c->tau, rat_make(0, 1)) <= 0) { *detail = "povm_tau_turns <= 0"; return REFUSE_INVALID_PARAMETER; } + c->ref_index = -1; + for (int k = 0; k < c->M; k++) { + for (int j = 0; j < k; j++) if (!strcmp(c->label[j], c->label[k])) { *detail = "duplicate clock label"; return REFUSE_INVALID_PARAMETER; } + if (!strcmp(c->label[k], c->ref_label)) c->ref_index = k; + } + if (c->ref_index < 0) { *detail = "reference_clock_label not among clock labels"; return REFUSE_INVALID_PARAMETER; } + /* rule 4 */ + { + rat sq = rat_add(rat_add(rat_mul(c->hx, c->hx), rat_mul(c->hy, c->hy)), rat_mul(c->hz, c->hz)); + if (!rat_sqrt(sq, &c->radius)) { *detail = "hx^2+hy^2+hz^2 is not a rational square"; return REFUSE_IRRATIONAL_SPECTRUM; } + } + /* rule 5 */ + { + char id[65]; + sha256_tagged_hex(AT0E_CASE_DOMAIN, (const uint8_t *)c->sem_block, c->sem_len, id); + if (strcmp(id, c->case_id) != 0) { *detail = "case_id does not match the semantic block"; return REFUSE_ID_MISMATCH; } + sha256_tagged_hex(AT0E_ACC_DOMAIN, (const uint8_t *)c->acc_block, c->acc_len, id); + if (strcmp(id, c->acceptance_id) != 0) { *detail = "acceptance_id does not match the acceptance block"; return REFUSE_ID_MISMATCH; } + } + /* rule 6 */ + if (c->expected_pass) { + if (c->n_expected_codes != 0) { *detail = codes_line; return REFUSE_INVALID_PARAMETER; } + } else { + if (c->n_expected_codes == 0) { *detail = codes_line; return REFUSE_INVALID_PARAMETER; } + for (int i = 0; i < c->n_expected_codes; i++) { + if (!failure_code_valid(c->expected_codes[i])) { *detail = codes_line; return REFUSE_INVALID_PARAMETER; } + if (i > 0 && strcmp(c->expected_codes[i - 1], c->expected_codes[i]) >= 0) { *detail = codes_line; return REFUSE_INVALID_PARAMETER; } + } + } + return REFUSE_NONE; + +parse_err_cur: + p.detail = p.lines[p.i - 1]; + goto parse_err; +parse_err_eof: + p.detail = "unexpected end of file"; +parse_err: + *detail = p.detail ? p.detail : "shape"; + *consumed = p.i; + return REFUSE_PARSE_ERROR; +} + +refusal case_parse_validate(const textfile *tf, at0_case *c, const char **detail) { + memset(c, 0, sizeof *c); + *detail = ""; + if (tf->n < 4) { *detail = "too few lines"; return REFUSE_PARSE_ERROR; } + char *tok[8]; + /* lines 0..2: shape now, content after the shape pass (rule 2 after rule 1) */ + int bad_version = 0; + if (split_tokens(tf->lines[0], tok, 8) != 2) { *detail = tf->lines[0]; return REFUSE_PARSE_ERROR; } + if (strcmp(tf->lines[0], "OMEGA-AT0-CASE v1") != 0) bad_version = 1; + if (split_tokens(tf->lines[1], tok, 8) != 2 || strcmp(tok[0], "domain") != 0) { *detail = tf->lines[1]; return REFUSE_PARSE_ERROR; } + if (strcmp(tok[1], AT0E_CASE_DOMAIN) != 0) bad_version = 1; + if (split_tokens(tf->lines[2], tok, 8) != 2 || strcmp(tok[0], "contract") != 0) { *detail = tf->lines[2]; return REFUSE_PARSE_ERROR; } + if (strcmp(tok[1], "AT0_CASE_V1") != 0) bad_version = 1; + + size_t consumed = 0; + refusal r = case_parse_blocks(tf->lines + 3, tf->n - 3, &consumed, c, detail, 0); + if (r == REFUSE_PARSE_ERROR) return r; + /* the trailing `end` line and nothing after it are shape */ + size_t idx = 3 + consumed; + if (idx >= tf->n || strcmp(tf->lines[idx], "end") != 0) { *detail = idx < tf->n ? tf->lines[idx] : "missing end"; return REFUSE_PARSE_ERROR; } + if (idx + 1 != tf->n) { *detail = tf->lines[idx + 1]; return REFUSE_PARSE_ERROR; } + if (r == REFUSE_NONCANONICAL) return r; + if (bad_version) { *detail = "header, domain or contract line"; return REFUSE_UNSUPPORTED_VERSION; } + if (r == REFUSE_NONE) sha256_hex(tf->bytes, tf->len, c->case_file_sha256); + return r; +} + +void case_free(at0_case *c) { free(c->sem_block); free(c->acc_block); c->sem_block = c->acc_block = NULL; } + +/* ---------------- emission ---------------- */ +static void scaled_format(scaled s, char *buf, size_t cap) { + char digits[64]; int n = 0; u128 v = s.n; + if (v == 0) { snprintf(buf, cap, "0@0"); return; } + while (v) { digits[n++] = (char)('0' + (int)(v % 10)); v /= 10; } + char num[64]; for (int i = 0; i < n; i++) num[i] = digits[n - 1 - i]; num[n] = 0; + snprintf(buf, cap, "%s@%d", num, s.k); +} +static void crat_format(crat z, char *buf, size_t cap) { + char a[64], b[64]; rat_format(z.re, a, sizeof a); rat_format(z.im, b, sizeof b); + size_t o = 0; + if (o + 1 < cap) buf[o++] = (char)40; + for (char *p = a; *p && o + 1 < cap; p++) buf[o++] = *p; + if (o + 1 < cap) buf[o++] = (char)59; + for (char *p = b; *p && o + 1 < cap; p++) buf[o++] = *p; + if (o + 1 < cap) buf[o++] = (char)41; + buf[o] = 0; +} +#define EMIT(...) do { int w_ = snprintf(buf + o, cap > o ? cap - o : 0, __VA_ARGS__); if (w_ < 0) return -1; o += (size_t)w_; } while (0) +long case_emit(const at0_case *c, char *buf, size_t cap) { + size_t o = 0; char t[8][80]; + EMIT("OMEGA-AT0-CASE v1\ndomain %s\ncontract AT0_CASE_V1\ncase_name %s\n", AT0E_CASE_DOMAIN, c->case_name); + size_t sem_start = o; + EMIT("begin semantic\nmodel_family PAGE_WOOTTERS_FINITE_IDEAL\nenergy_unit DIMENSIONLESS_HBAR_1\nclock_dim %d\nclock_energies ", c->N); + for (int i = 0; i < c->N; i++) { rat_format(c->E[i], t[0], sizeof t[0]); EMIT("%s%s", i ? "," : "", t[0]); } + rat_format(c->h0, t[0], 80); rat_format(c->hx, t[1], 80); rat_format(c->hy, t[2], 80); rat_format(c->hz, t[3], 80); + EMIT("\nsystem_dim 2\nsystem_hamiltonian_pauli %s,%s,%s,%s\ninteraction NONE\nconstraint SUM_HC_HS\nphysical_state NULLSPACE_PROJECTION\n", t[0], t[1], t[2], t[3]); + crat_format(c->psi0[0], t[0], 80); crat_format(c->psi0[1], t[1], 80); + EMIT("reference_clock_label %s\nreference_system_state %s,%s\nclock_povm COVARIANT_DISCRETE\n", c->ref_label, t[0], t[1]); + rat_format(c->tau, t[0], 80); rat_format(c->w, t[1], 80); + EMIT("povm_tau_turns %s\npovm_weight %s\nclock_label_count %d\n", t[0], t[1], c->M); + for (int k = 0; k < c->M; k++) EMIT("clock_label %d %s\n", k, c->label[k]); + EMIT("observables PAULI_X,PAULI_Y,PAULI_Z\nend semantic\n"); + size_t sem_end = o; + size_t acc_start = o; + EMIT("begin acceptance\ncontrol_kind %s\nexpected_outcome %s\nexpected_failure_codes ", c->control_positive ? "POSITIVE" : "NEGATIVE", c->expected_pass ? "PASS" : "FAIL"); + if (c->n_expected_codes == 0) EMIT("none"); + for (int i = 0; i < c->n_expected_codes; i++) EMIT("%s%s", i ? "," : "", c->expected_codes[i]); + EMIT("\nmin_bound_kind %s\n", c->min_bound_kind == BK_RIGOROUS ? "RIGOROUS" : c->min_bound_kind == BK_ESTIMATED ? "ESTIMATED" : "NONE"); + scaled_format(c->tol_constraint, t[0], 80); EMIT("tol_constraint_residual %s\n", t[0]); + scaled_format(c->tol_povm, t[0], 80); EMIT("tol_povm_residual %s\n", t[0]); + scaled_format(c->tol_prob, t[0], 80); EMIT("tol_probability %s\n", t[0]); + scaled_format(c->tol_zero, t[0], 80); EMIT("tol_zero_probability %s\n", t[0]); + scaled_format(c->tol_schro, t[0], 80); EMIT("tol_schrodinger %s\n", t[0]); + EMIT("end acceptance\n"); + size_t acc_end = o; + if (o >= cap) return -1; + char id[65]; + sha256_tagged_hex(AT0E_CASE_DOMAIN, (const uint8_t *)buf + sem_start, sem_end - sem_start, id); + EMIT("case_id %s\n", id); + sha256_tagged_hex(AT0E_ACC_DOMAIN, (const uint8_t *)buf + acc_start, acc_end - acc_start, id); + EMIT("acceptance_id %s\nend\n", id); + if (o >= cap) return -1; + return (long)o; +} diff --git a/research/atemporal/at0/evaluator/src/at0e_main.c b/research/atemporal/at0/evaluator/src/at0e_main.c new file mode 100644 index 000000000..0eec75432 --- /dev/null +++ b/research/atemporal/at0/evaluator/src/at0e_main.c @@ -0,0 +1,177 @@ +/* at0-eval: command-line front end of the AT-0 Agent 4 evaluator. + * + * at0-eval case [--detail] + * validates a case; prints AT0_CASE_OK (exit 0) or, to stderr, + * AT0_CASE_REFUSED (exit 2), the same protocol the contract fixes + * for the candidate tool, so both can be compared line for line. + * at0-eval result [--case ] [--no-shadow] [--json] + * verifies a result independently; prints AT0E_VERIFY + * and one line per finding (exit 0 PASS, 1 FAIL, 3 INCONCLUSIVE, 2 unreadable). + * at0-eval shadow + * prints the shadow oracle's table (hand-derivation aid). + * at0-eval synth [mutant] synthetic result to stdout (self-test only) + * at0-eval mutants lists mutant names + * at0-eval gen key=value ... emits a canonical case file to stdout + */ +#include "at0e.h" +#include +#include +#include + +static int cmd_case(int argc, char **argv) { + if (argc < 1) { fprintf(stderr, "usage: at0-eval case [--detail]\n"); return 64; } + int detail = argc > 1 && !strcmp(argv[1], "--detail"); + textfile tf; const char *why; + int rc = textfile_read(argv[0], &tf, &why); + if (rc >= 100) { fprintf(stderr, "at0-eval: %s: %s\n", argv[0], why); return 2; } + if (rc) { fprintf(stderr, "AT0_CASE_REFUSED CASE_PARSE_ERROR\n"); if (detail) fprintf(stderr, " byte rule: %s\n", why); textfile_free(&tf); return 2; } + at0_case c; const char *d; + refusal r = case_parse_validate(&tf, &c, &d); + if (r != REFUSE_NONE) { fprintf(stderr, "AT0_CASE_REFUSED %s\n", refusal_name(r)); if (detail) fprintf(stderr, " at: %s\n", d); case_free(&c); textfile_free(&tf); return 2; } + printf("AT0_CASE_OK %s\n", c.case_id); + if (detail) printf(" acceptance_id %s\n case_file_sha256 %s\n", c.acceptance_id, c.case_file_sha256); + case_free(&c); textfile_free(&tf); + return 0; +} + +static void json_escape(const char *s, FILE *f) { + fputc('"', f); + for (; *s; s++) { if (*s == '"' || *s == '\\') fputc('\\', f); if ((unsigned char)*s < 0x20) fputc(' ', f); else fputc(*s, f); } + fputc('"', f); +} +static int cmd_result(int argc, char **argv) { + if (argc < 1) { fprintf(stderr, "usage: at0-eval result [--case ] [--no-shadow] [--json]\n"); return 64; } + const char *case_path = NULL; int shadow_on = 1, json = 0; + for (int i = 1; i < argc; i++) { + if (!strcmp(argv[i], "--case") && i + 1 < argc) case_path = argv[++i]; + else if (!strcmp(argv[i], "--no-shadow")) shadow_on = 0; + else if (!strcmp(argv[i], "--json")) json = 1; + else { fprintf(stderr, "unknown option %s\n", argv[i]); return 64; } + } + findings fs; fs.n = 0; + textfile tf, ctf; const char *why; const char *status; + int have_case = 0; + if (case_path) { + int rc = textfile_read(case_path, &ctf, &why); + if (rc) { findings_add(&fs, "E4-BIND-CASE-UNREADABLE", "case file %s: %s", case_path, why); } else have_case = 1; + } + int rc = textfile_read(argv[0], &tf, &why); + at0_result r; memset(&r, 0, sizeof r); + int parsed = 0; + if (rc >= 100) { findings_add(&fs, "E4-STRUCT-UNREADABLE", "%s", why); status = "FAIL"; } + else if (rc) { findings_add(&fs, "E4-STRUCT-BYTES", "byte rule violated: %s", why); status = "FAIL"; } + else { + const char *fcode, *fdetail; + if (result_parse(&tf, &r, &fcode, &fdetail)) { findings_add(&fs, fcode, "%s", fdetail); status = "FAIL"; } + else { parsed = 1; status = result_verify(&tf, &r, have_case ? &ctf : NULL, shadow_on, &fs); } + } + if (json) { + printf("{\"status\":\"%s\",\"result_file\":", status); json_escape(argv[0], stdout); + printf(",\"case_file\":"); if (case_path) json_escape(case_path, stdout); else printf("null"); + printf(",\"shadow\":%s,\"outcome_reported\":", shadow_on ? "true" : "false"); + if (parsed) { static const char *const o[4] = { "PASS", "FAIL", "ERROR", "NOT_RUN" }; printf("\"%s\"", o[r.outcome]); } else printf("null"); + printf(",\"findings\":["); + for (int i = 0; i < fs.n; i++) { printf("%s{\"code\":\"%s\",\"detail\":", i ? "," : "", fs.f[i].code); json_escape(fs.f[i].detail, stdout); printf("}"); } + printf("]}\n"); + } else { + printf("AT0E_VERIFY %s\n", status); + for (int i = 0; i < fs.n; i++) printf(" %s: %s\n", fs.f[i].code, fs.f[i].detail); + } + if (parsed) result_free(&r); + if (rc < 100) textfile_free(&tf); + if (have_case) textfile_free(&ctf); + return !strcmp(status, "PASS") ? 0 : !strcmp(status, "FAIL") ? 1 : 3; +} + +static int load_case(const char *path, textfile *tf, at0_case *c) { + const char *why, *d; + int rc = textfile_read(path, tf, &why); + if (rc) { fprintf(stderr, "at0-eval: %s: %s\n", path, why); return 0; } + refusal r = case_parse_validate(tf, c, &d); + if (r != REFUSE_NONE) { fprintf(stderr, "AT0_CASE_REFUSED %s (%s)\n", refusal_name(r), d); return 0; } + return 1; +} +static int cmd_shadow(int argc, char **argv) { + if (argc < 1) { fprintf(stderr, "usage: at0-eval shadow \n"); return 64; } + textfile tf; at0_case c; shadow s; const char *why; + if (!load_case(argv[0], &tf, &c)) return 2; + if (!shadow_compute(&c, &s, &why)) { fprintf(stderr, "shadow: %s\n", why); return 2; } + char rb[64]; rat_format(c.radius, rb, sizeof rb); + printf("case %s\n|h| %s kernel_dim %d matched(e+,e-) %d %d psi_nonzero %d povm_exact_identity %d povm_residual %.6Le\n", + c.case_name, rb, s.kernel_dim, s.matched[0], s.matched[1], s.psi_nonzero, s.povm_exact_identity, s.povm_residual); + printf("label p(k) P(X+) P(Y+) P(Z+) | ref X+ ref Y+ ref Z+\n"); + for (int k = 0; k < c.M; k++) + printf("%-6s %.9Lf %.9Lf %.9Lf %.9Lf | %.9Lf %.9Lf %.9Lf\n", c.label[k], s.psi_nonzero ? s.clock_p[k] : 0.0L, + s.psi_nonzero ? s.pauli[k][0][0] : 0.0L, s.psi_nonzero ? s.pauli[k][1][0] : 0.0L, s.psi_nonzero ? s.pauli[k][2][0] : 0.0L, + s.reference[k][0][0], s.reference[k][1][0], s.reference[k][2][0]); + case_free(&c); textfile_free(&tf); + return 0; +} +static int cmd_synth(int argc, char **argv) { + if (argc < 1) { fprintf(stderr, "usage: at0-eval synth [mutant]\n"); return 64; } + textfile tf; at0_case c; const char *why; + if (!load_case(argv[0], &tf, &c)) return 2; + size_t cap = 1u << 22; char *buf = malloc(cap); + long n = result_synth(&c, tf.bytes, tf.len, argc > 1 ? argv[1] : NULL, buf, cap, &why); + if (n < 0) { fprintf(stderr, "synth: %s\n", why); return 2; } + fwrite(buf, 1, (size_t)n, stdout); + free(buf); case_free(&c); textfile_free(&tf); + return 0; +} +static int cmd_mutants(void) { int n; const char *const *m = synth_mutant_names(&n); for (int i = 0; i < n; i++) printf("%s\n", m[i]); return 0; } + +static const char *kv(int argc, char **argv, const char *key, const char *dflt) { + size_t kl = strlen(key); + for (int i = 0; i < argc; i++) if (!strncmp(argv[i], key, kl) && argv[i][kl] == '=') return argv[i] + kl + 1; + return dflt; +} +static int gen_rat(const char *s, rat *out) { int canon; if (!rat_parse(s, out, &canon)) { fprintf(stderr, "gen: bad rational %s\n", s); return 0; } return 1; } +static int gen_scaled(const char *s, scaled *out) { int canon; if (!scaled_parse(s, out, &canon) || !canon) { fprintf(stderr, "gen: bad scaled %s\n", s); return 0; } return 1; } +static int cmd_gen(int argc, char **argv) { + at0_case c; memset(&c, 0, sizeof c); + snprintf(c.case_name, sizeof c.case_name, "%s", kv(argc, argv, "name", "at0-gen")); + char buf[AT0E_MAX_LINE]; + /* clock energies */ + snprintf(buf, sizeof buf, "%s", kv(argc, argv, "E", "-3/2,-1/2,1/2,3/2")); + c.N = 0; for (char *s = strtok(buf, ","); s; s = strtok(NULL, ",")) { if (c.N >= AT0E_MAX_N || !gen_rat(s, &c.E[c.N])) return 64; c.N++; } + snprintf(buf, sizeof buf, "%s", kv(argc, argv, "h", "0/1,0/1,0/1,1/2")); + { rat *hs[4] = { &c.h0, &c.hx, &c.hy, &c.hz }; int i = 0; for (char *s = strtok(buf, ","); s && i < 4; s = strtok(NULL, ","), i++) if (!gen_rat(s, hs[i])) return 64; if (i != 4) { fprintf(stderr, "gen: h needs 4 rationals\n"); return 64; } } + snprintf(c.ref_label, sizeof c.ref_label, "%s", kv(argc, argv, "ref", "t0")); + snprintf(buf, sizeof buf, "%s", kv(argc, argv, "psi", "(1/1;0/1),(1/1;0/1)")); + { char *comma = strchr(buf, ','); int canon; if (!comma) { fprintf(stderr, "gen: psi\n"); return 64; } *comma = 0; + if (!crat_parse(buf, &c.psi0[0], &canon) || !crat_parse(comma + 1, &c.psi0[1], &canon)) { fprintf(stderr, "gen: psi\n"); return 64; } } + if (!gen_rat(kv(argc, argv, "tau", "1/4"), &c.tau) || !gen_rat(kv(argc, argv, "w", "1/1"), &c.w)) return 64; + c.M = atoi(kv(argc, argv, "M", "4")); + if (c.M < 1 || c.M > AT0E_MAX_M) { fprintf(stderr, "gen: M out of range\n"); return 64; } + const char *labels = kv(argc, argv, "labels", NULL); + if (labels) { snprintf(buf, sizeof buf, "%s", labels); int k = 0; for (char *s = strtok(buf, ","); s && k < c.M; s = strtok(NULL, ","), k++) snprintf(c.label[k], sizeof c.label[k], "%s", s); if (k != c.M) { fprintf(stderr, "gen: labels count\n"); return 64; } } + else for (int k = 0; k < c.M; k++) snprintf(c.label[k], sizeof c.label[k], "%s%d", kv(argc, argv, "prefix", "t"), k); + c.control_positive = strcmp(kv(argc, argv, "control", "POSITIVE"), "NEGATIVE") != 0; + c.expected_pass = strcmp(kv(argc, argv, "expected", "PASS"), "FAIL") != 0; + snprintf(buf, sizeof buf, "%s", kv(argc, argv, "codes", "none")); + c.n_expected_codes = 0; + if (strcmp(buf, "none")) for (char *s = strtok(buf, ","); s; s = strtok(NULL, ",")) { if (c.n_expected_codes >= 16) return 64; snprintf(c.expected_codes[c.n_expected_codes++], 48, "%s", s); } + const char *bk = kv(argc, argv, "minbk", "ESTIMATED"); + c.min_bound_kind = !strcmp(bk, "RIGOROUS") ? BK_RIGOROUS : !strcmp(bk, "NONE") ? BK_NONE : BK_ESTIMATED; + if (!gen_scaled(kv(argc, argv, "tolc", "1@12"), &c.tol_constraint) || !gen_scaled(kv(argc, argv, "tolp", "1@12"), &c.tol_povm) || + !gen_scaled(kv(argc, argv, "tolprob", "1@12"), &c.tol_prob) || !gen_scaled(kv(argc, argv, "tolz", "1@9"), &c.tol_zero) || + !gen_scaled(kv(argc, argv, "tols", "1@12"), &c.tol_schro)) return 64; + size_t cap = 1u << 20; char *out = malloc(cap); + long n = case_emit(&c, out, cap); + if (n < 0) { fprintf(stderr, "gen: emit failed\n"); return 2; } + fwrite(out, 1, (size_t)n, stdout); + free(out); + return 0; +} + +int main(int argc, char **argv) { + if (argc < 2) { fprintf(stderr, "usage: at0-eval ...\n"); return 64; } + if (!strcmp(argv[1], "case")) return cmd_case(argc - 2, argv + 2); + if (!strcmp(argv[1], "result")) return cmd_result(argc - 2, argv + 2); + if (!strcmp(argv[1], "shadow")) return cmd_shadow(argc - 2, argv + 2); + if (!strcmp(argv[1], "synth")) return cmd_synth(argc - 2, argv + 2); + if (!strcmp(argv[1], "mutants")) return cmd_mutants(); + if (!strcmp(argv[1], "gen")) return cmd_gen(argc - 2, argv + 2); + fprintf(stderr, "unknown command %s\n", argv[1]); + return 64; +} diff --git a/research/atemporal/at0/evaluator/src/at0e_result.c b/research/atemporal/at0/evaluator/src/at0e_result.c new file mode 100644 index 000000000..263a1ba08 --- /dev/null +++ b/research/atemporal/at0/evaluator/src/at0e_result.c @@ -0,0 +1,513 @@ +/* Independent AT0_RESULT_V1 parser, exact re-derivation of the ten checks, and + * the evaluator's verification pass (identities, bindings, provenance, shadow). */ +#include "at0e.h" +#include +#include +#include +#include + +/* aien-architecture commits verified (sha256sum) to hold AT0_CASE_V1.md d90af74b... and AT0_RESULT_V1.md dc52c573... unchanged */ +/* commits verified by Agent 4 to hold the frozen contract bytes (AT0_CASE_V1.md d90af74b..., AT0_RESULT_V2.md bd0f9eb8... at the last two) */ +const char *const at0e_contract_commits[] = { AT0E_CONTRACT_COMMIT, "00e9f2308666f74e58f524b177b2a31eccdc69ba", + "c7a7181eda57e353dbff3b7d20cde33fb65faeb2", "fe86e43aae63370b3084f78e971a33b81ce75a9d", NULL }; +const char *const at0e_check_names[AT0E_NCHECKS] = { + "bound_kind_sufficient", "values_finite", "physical_state_nontrivial", "constraint_residual", + "povm_normalization", "clock_probability_sum", "probability_range", "pauli_pair_sum", + "conditional_defined", "schrodinger_agreement" }; +const char *const at0e_check_codes[AT0E_NCHECKS] = { + "BOUND_KIND_INSUFFICIENT", "NONFINITE_VALUE", "TRIVIAL_PHYSICAL_STATE", "CONSTRAINT_RESIDUAL_EXCEEDED", + "POVM_NORMALIZATION_EXCEEDED", "PROBABILITY_SUM_EXCEEDED", "PROBABILITY_OUT_OF_RANGE", "PROBABILITY_SUM_EXCEEDED", + "CONDITIONAL_UNDEFINED", "SCHRODINGER_DEVIATION_EXCEEDED" }; +static const char *const axis_names[3] = { "X", "Y", "Z" }; +static const char *const sign_names[2] = { "PLUS", "MINUS" }; + +/* ---------------- parse ---------------- */ +typedef struct { char **lines; size_t n, i; const char *finding, *detail; } rp; +#define FAIL_WITH(code, det) do { p->finding = code; p->detail = det; return 0; } while (0) +static int rp_exact(rp *p, const char *line) { + if (p->i >= p->n) FAIL_WITH("E4-STRUCT-TRUNCATED", "unexpected end of file"); + if (strcmp(p->lines[p->i], line) != 0) FAIL_WITH("E4-STRUCT-ORDER", p->lines[p->i]); + p->i++; return 1; +} +static int rp_key(rp *p, const char *key, char **val) { + char *tok[8]; + if (p->i >= p->n) FAIL_WITH("E4-STRUCT-TRUNCATED", "unexpected end of file"); + int n = split_tokens(p->lines[p->i], tok, 8); + if (n != 2 || strcmp(tok[0], key) != 0) FAIL_WITH("E4-STRUCT-ORDER", p->lines[p->i]); + *val = tok[1]; p->i++; return 1; +} +static int rp_text_key(rp *p, const char *key, char *dst, size_t cap, int allow_none) { + if (p->i >= p->n) FAIL_WITH("E4-STRUCT-TRUNCATED", "unexpected end of file"); + const char *line = p->lines[p->i]; size_t kl = strlen(key); + if (strncmp(line, key, kl) != 0 || line[kl] != ' ') FAIL_WITH("E4-STRUCT-ORDER", line); + const char *v = line + kl + 1; + if (!is_text200(v)) FAIL_WITH("E4-STRUCT-ENCODING", line); + (void)allow_none; + snprintf(dst, cap, "%s", v); p->i++; return 1; +} +static int parse_rval(rp *p, const char *vtok, const char *btok, rval *out) { + memset(out, 0, sizeof *out); + int canon = 1; + if (!scaled_parse(btok, &out->bound, &canon) || !canon) FAIL_WITH("E4-STRUCT-ENCODING", p->lines[p->i]); + if (!strcmp(vtok, "undefined")) { out->is_undefined = 1; if (out->bound.n != 0) FAIL_WITH("E4-STRUCT-ENCODING", p->lines[p->i]); return 1; } + if (!strcmp(vtok, "nonfinite")) { out->is_nonfinite = 1; return 1; } + if (strncmp(vtok, "f64:", 4) != 0 || !hex_to_u64(vtok + 4, &out->bits)) FAIL_WITH("E4-STRUCT-ENCODING", p->lines[p->i]); + if (((out->bits >> 52) & 0x7ff) == 0x7ff) FAIL_WITH("E4-STRUCT-ENCODING", "nonfinite bit pattern written as f64:"); + if (out->bits == 0x8000000000000000ULL) FAIL_WITH("E4-STRUCT-ENCODING", "-0.0 must be written as +0.0"); + return 1; +} +static int rp_value_line(rp *p, const char *key, rval *out) { + char *tok[8]; + if (p->i >= p->n) FAIL_WITH("E4-STRUCT-TRUNCATED", "unexpected end of file"); + int n = split_tokens(p->lines[p->i], tok, 8); + if (n != 3 || strcmp(tok[0], key) != 0) FAIL_WITH("E4-STRUCT-ORDER", p->lines[p->i]); + if (!parse_rval(p, tok[1], tok[2], out)) return 0; + p->i++; return 1; +} +static int rp_indexed_value(rp *p, const char *key, int k, int axis, int sign, rval *out) { + char *tok[8]; long kk; + if (p->i >= p->n) FAIL_WITH("E4-STRUCT-TRUNCATED", "unexpected end of file"); + int n = split_tokens(p->lines[p->i], tok, 8); + int want = axis < 0 ? 4 : 6; + if (n != want || strcmp(tok[0], key) != 0) FAIL_WITH("E4-STRUCT-ORDER", p->lines[p->i]); + if (!parse_int_canonical(tok[1], &kk) || kk != k) FAIL_WITH("E4-STRUCT-ORDER", p->lines[p->i]); + if (axis >= 0) { + if (strcmp(tok[2], axis_names[axis]) != 0 || strcmp(tok[3], sign_names[sign]) != 0) FAIL_WITH("E4-STRUCT-ORDER", p->lines[p->i]); + } + if (!parse_rval(p, tok[want - 2], tok[want - 1], out)) return 0; + p->i++; return 1; +} +static int parse_codes(const char *val, char codes[16][48], int *count) { + *count = 0; + if (!strcmp(val, "none")) return 1; + char buf[AT0E_MAX_LINE]; snprintf(buf, sizeof buf, "%s", val); + size_t l = strlen(buf); + if (l == 0 || buf[0] == ',' || buf[l - 1] == ',' || strstr(buf, ",,")) return 0; + char *s = buf; + while (s) { + char *c = strchr(s, ','); if (c) *c = 0; + if (*count >= 16 || strlen(s) >= 48 || !failure_code_valid(s)) return 0; + if (*count > 0 && strcmp(codes[*count - 1], s) >= 0) return 0; /* sorted, unique */ + memcpy(codes[(*count)++], s, strlen(s) + 1); + s = c ? c + 1 : NULL; + } + return 1; +} + +int result_parse(const textfile *tf, at0_result *r, const char **finding, const char **detail) { + rp pp = { tf->lines, tf->n, 0, NULL, NULL }, *p = &pp; + memset(r, 0, sizeof *r); + char *v; + *finding = NULL; *detail = ""; + if (p->i < p->n && !strcmp(p->lines[0], "OMEGA-AT0-RESULT v2")) r->version = 2; + else if (p->i < p->n && !strcmp(p->lines[0], "OMEGA-AT0-RESULT v1")) r->version = 1; + else { p->finding = "E4-STRUCT-VERSION"; p->detail = tf->n ? tf->lines[0] : "empty"; goto out; } + p->i = 1; + if (!rp_exact(p, r->version == 2 ? "domain omega.at0.result.v2" : "domain omega.at0.result.v1")) goto out; + if (!rp_exact(p, r->version == 2 ? "contract AT0_RESULT_V2" : "contract AT0_RESULT_V1")) goto out; + if (!rp_exact(p, "case_contract AT0_CASE_V1")) goto out; + { + size_t consumed = 0; const char *d = ""; + refusal rf = case_parse_blocks(tf->lines + p->i, tf->n - p->i, &consumed, &r->c, &d, 1); + if (rf == REFUSE_PARSE_ERROR) { p->finding = "E4-STRUCT-CASE-SHAPE"; p->detail = d; goto out; } + if (rf == REFUSE_ID_MISMATCH) { p->finding = "E4-ID-CASE"; p->detail = d; goto out; } + if (rf != REFUSE_NONE) { p->finding = "E4-STRUCT-CASE-REFUSED"; p->detail = d; goto out; } + p->i += consumed; + } + if (!rp_key(p, "case_file_sha256", &v)) goto out; + if (!is_digest(v)) goto enc_err; + snprintf(r->case_file_sha256, 65, "%s", v); + if (!rp_exact(p, "begin numerics")) goto out; + if (!rp_key(p, "arithmetic", &v)) goto out; + if (!strcmp(v, "BINARY64")) r->arithmetic = 0; else if (!strcmp(v, "BINARY64_INTERVAL")) r->arithmetic = 1; + else if (!strcmp(v, "BINARY64_COMPENSATED")) r->arithmetic = 2; else if (!strcmp(v, "NONE")) r->arithmetic = 3; + else goto enc_err; + if (!rp_key(p, "bound_kind", &v)) goto out; + if (!strcmp(v, "RIGOROUS")) r->bound_kind = BK_RIGOROUS; else if (!strcmp(v, "ESTIMATED")) r->bound_kind = BK_ESTIMATED; + else if (!strcmp(v, "NONE")) r->bound_kind = BK_NONE; else goto enc_err; + if (!rp_exact(p, "threads 1")) goto out; + if (!rp_exact(p, "end numerics")) goto out; + if (!rp_exact(p, "begin values")) goto out; + if (!rp_key(p, "physical_state_kernel_dim", &v)) goto out; + if (!parse_int_canonical(v, &r->kernel_dim) || r->kernel_dim < 0) goto enc_err; + if (!rp_value_line(p, "constraint_residual", &r->constraint_residual)) goto out; + if (!rp_value_line(p, "povm_residual", &r->povm_residual)) goto out; + for (int k = 0; k < r->c.M; k++) { + char *tok[8]; long kk; + if (p->i >= p->n) { p->finding = "E4-STRUCT-TRUNCATED"; p->detail = "values"; goto out; } + int n = split_tokens(p->lines[p->i], tok, 8); + if (n != 4 || strcmp(tok[0], "label") || !parse_int_canonical(tok[1], &kk) || kk != k || strcmp(tok[2], r->c.label[k]) != 0) { p->finding = "E4-STRUCT-ORDER"; p->detail = p->lines[p->i]; goto out; } + if (!strcmp(tok[3], "DEFINED")) r->label_status[k] = LS_DEFINED; else if (!strcmp(tok[3], "UNDEFINED")) r->label_status[k] = LS_UNDEFINED; + else if (!strcmp(tok[3], "INDETERMINATE")) r->label_status[k] = LS_INDETERMINATE; else { p->finding = "E4-STRUCT-ENCODING"; p->detail = p->lines[p->i]; goto out; } + p->i++; + } + for (int k = 0; k < r->c.M; k++) if (!rp_indexed_value(p, "clock_probability", k, -1, 0, &r->clock_p[k])) goto out; + for (int k = 0; k < r->c.M; k++) for (int a = 0; a < 3; a++) for (int s = 0; s < 2; s++) if (!rp_indexed_value(p, "pauli", k, a, s, &r->pauli[k][a][s])) goto out; + for (int k = 0; k < r->c.M; k++) for (int a = 0; a < 3; a++) for (int s = 0; s < 2; s++) if (!rp_indexed_value(p, "reference", k, a, s, &r->reference[k][a][s])) goto out; + if (!rp_exact(p, "end values")) goto out; + size_t ver_start = p->i; + if (!rp_exact(p, "begin verdict")) goto out; + for (int i = 0; i < AT0E_NCHECKS; i++) { + char *tok[8]; + if (p->i >= p->n) { p->finding = "E4-STRUCT-TRUNCATED"; p->detail = "verdict"; goto out; } + int n = split_tokens(p->lines[p->i], tok, 8); + if (n != 3 || strcmp(tok[0], "check") || strcmp(tok[1], at0e_check_names[i])) { p->finding = "E4-STRUCT-ORDER"; p->detail = p->lines[p->i]; goto out; } + if (!strcmp(tok[2], "PASS")) r->check[i] = CK_PASS; else if (!strcmp(tok[2], "FAIL")) r->check[i] = CK_FAIL; + else if (!strcmp(tok[2], "INDETERMINATE")) r->check[i] = CK_INDET; else if (!strcmp(tok[2], "NOT_EVALUATED")) r->check[i] = CK_NOTEVAL; + else { p->finding = "E4-STRUCT-ENCODING"; p->detail = p->lines[p->i]; goto out; } + p->i++; + } + if (!rp_key(p, "outcome", &v)) goto out; + if (!strcmp(v, "PASS")) r->outcome = OUT_PASS; else if (!strcmp(v, "FAIL")) r->outcome = OUT_FAIL; else if (!strcmp(v, "ERROR")) r->outcome = OUT_ERROR; + else if (!strcmp(v, "NOT_RUN")) r->outcome = OUT_NOT_RUN; else goto enc_err; + if (!rp_key(p, "failure_codes", &v)) goto out; + if (!parse_codes(v, r->failure_codes, &r->n_failure_codes)) goto enc_err; + if (!rp_key(p, "error_code", &v)) goto out; + if (strcmp(v, "none") && strcmp(v, "ORACLE_UNAVAILABLE") && strcmp(v, "RESOURCE_LIMIT") && strcmp(v, "INTERNAL_ERROR")) goto enc_err; + snprintf(r->error_code, sizeof r->error_code, "%s", v); + if (!rp_key(p, "expectation_met", &v)) goto out; + if (!strcmp(v, "YES")) r->expectation_met = 0; else if (!strcmp(v, "NO")) r->expectation_met = 1; else if (!strcmp(v, "NOT_APPLICABLE")) r->expectation_met = 2; else goto enc_err; + if (!rp_exact(p, "end verdict")) goto out; + { + size_t total = 0; + for (size_t i = ver_start; i < p->i; i++) total += strlen(tf->lines[i]) + 1; + r->ver_block = malloc(total + 1); size_t o = 0; + for (size_t i = ver_start; i < p->i; i++) { size_t l = strlen(tf->lines[i]); memcpy(r->ver_block + o, tf->lines[i], l); o += l; r->ver_block[o++] = '\n'; } + r->ver_block[o] = 0; r->ver_len = o; + } + if (!rp_key(p, "verdict_id", &v)) goto out; + if (!is_digest(v)) goto enc_err; + snprintf(r->verdict_id, 65, "%s", v); + if (!rp_exact(p, "begin provenance")) goto out; + if (!rp_key(p, "source_repo", &v)) goto out; + if (!strchr(v, '/') || strlen(v) > 79) goto enc_err; + snprintf(r->source_repo, sizeof r->source_repo, "%s", v); + if (!rp_key(p, "source_commit", &v)) goto out; + if (!is_sha1hex(v)) goto enc_err; + snprintf(r->source_commit, sizeof r->source_commit, "%s", v); + if (!rp_key(p, "source_tree_clean", &v)) goto out; + if (!strcmp(v, "YES")) r->source_tree_clean = 1; else if (!strcmp(v, "NO")) r->source_tree_clean = 0; else goto enc_err; + if (!rp_key(p, "contract_commit", &v)) goto out; + if (!is_sha1hex(v)) goto enc_err; + snprintf(r->contract_commit, sizeof r->contract_commit, "%s", v); + int placeholder = r->outcome == OUT_ERROR || r->outcome == OUT_NOT_RUN; + if (!rp_key(p, "engine_sha256", &v)) goto out; + if (!(is_digest(v) || (placeholder && !strcmp(v, "none")))) goto enc_err; + snprintf(r->engine_sha256, 65, "%s", v); + if (!rp_key(p, "oracle_repo", &v)) goto out; + if (!((strchr(v, '/') && strlen(v) < 80) || (placeholder && !strcmp(v, "none")))) goto enc_err; + snprintf(r->oracle_repo, sizeof r->oracle_repo, "%s", v); + if (!rp_key(p, "oracle_commit", &v)) goto out; + if (!(is_sha1hex(v) || (placeholder && !strcmp(v, "none")))) goto enc_err; + snprintf(r->oracle_commit, sizeof r->oracle_commit, "%s", v); + if (!rp_key(p, "oracle_sha256", &v)) goto out; + if (!(is_digest(v) || (placeholder && !strcmp(v, "none")))) goto enc_err; + snprintf(r->oracle_sha256, 65, "%s", v); + if (!rp_text_key(p, "build_cc", r->build_cc, sizeof r->build_cc, placeholder)) goto out; + if (!rp_text_key(p, "build_flags", r->build_flags, sizeof r->build_flags, placeholder)) goto out; + if (!rp_text_key(p, "host", r->host, sizeof r->host, placeholder)) goto out; + for (int t = 0; t < 2; t++) { + char *dst = t ? r->run_finished : r->run_started; + if (!rp_key(p, t ? "run_finished_utc" : "run_started_utc", &v)) goto out; + if (!(placeholder && !strcmp(v, "none"))) { + if (strlen(v) != 20 || v[4] != '-' || v[7] != '-' || v[10] != 'T' || v[13] != ':' || v[16] != ':' || v[19] != 'Z') goto enc_err; + for (int i = 0; i < 19; i++) if (i != 4 && i != 7 && i != 10 && i != 13 && i != 16 && (v[i] < '0' || v[i] > '9')) goto enc_err; + } + snprintf(dst, 32, "%s", v); + } + { + char prev[AT0E_MAX_LINE] = ""; + while (p->i < p->n && strncmp(tf->lines[p->i], "artifact ", 9) == 0) { + char *tok[8]; + int n = split_tokens(tf->lines[p->i], tok, 8); + if (n != 3 || !is_digest(tok[2]) || strlen(tok[1]) == 0) { p->finding = "E4-STRUCT-ENCODING"; p->detail = tf->lines[p->i]; goto out; } + if (prev[0] && strcmp(prev, tok[1]) >= 0) { p->finding = "E4-STRUCT-ORDER"; p->detail = tf->lines[p->i]; goto out; } + snprintf(prev, sizeof prev, "%s", tok[1]); + r->n_artifacts++; p->i++; + } + } + if (!rp_exact(p, "end provenance")) goto out; + r->evidence_line_index = p->i; + if (!rp_key(p, "evidence_digest", &v)) goto out; + if (!is_digest(v)) goto enc_err; + snprintf(r->evidence_digest, 65, "%s", v); + if (!rp_exact(p, "end")) goto out; + if (p->i != tf->n) { p->finding = "E4-STRUCT-TRAILING"; p->detail = tf->lines[p->i]; goto out; } + return 0; +enc_err: + p->finding = "E4-STRUCT-ENCODING"; p->detail = p->lines[p->i - 1]; goto out; +out: + *finding = p->finding ? p->finding : "E4-STRUCT-PARSE"; + *detail = p->detail ? p->detail : ""; + return 1; +} +void result_free(at0_result *r) { case_free(&r->c); free(r->ver_block); r->ver_block = NULL; } + +/* ---------------- exact re-derivation ---------------- */ +static int worst(int a, int b) { /* FAIL > INDET > PASS ; NOT_EVALUATED is neutral */ + if (a == CK_NOTEVAL) return b; + if (b == CK_NOTEVAL) return a; + return a > b ? a : b; +} +static int tri_to_ck(tri t) { return t == CMP_PASS ? CK_PASS : t == CMP_FAIL ? CK_FAIL : CK_INDET; } +static int label_status_derive(const rval *p, scaled tol_zero) { + if (p->is_undefined || p->is_nonfinite) return LS_UNDEFINED; + sbig v, b, t, hi, lo, nb; + sbig_from_f64_bits(&v, p->bits); sbig_from_scaled(&b, p->bound); sbig_from_scaled(&t, tol_zero); + sbig_add(&hi, &v, &b); + if (sbig_cmp(&hi, &t) <= 0) return LS_UNDEFINED; + nb = b; sbig_neg(&nb); sbig_add(&lo, &v, &nb); + if (sbig_cmp(&lo, &t) > 0) return LS_DEFINED; + return LS_INDETERMINATE; +} +static void add_code(rederived *d, const char *code) { + for (int i = 0; i < d->n_failure_codes; i++) if (!strcmp(d->failure_codes[i], code)) return; + if (d->n_failure_codes >= 16) return; + snprintf(d->failure_codes[d->n_failure_codes++], 48, "%s", code); + for (int i = d->n_failure_codes - 1; i > 0 && strcmp(d->failure_codes[i - 1], d->failure_codes[i]) > 0; i--) { + char t[48]; memcpy(t, d->failure_codes[i], 48); memcpy(d->failure_codes[i], d->failure_codes[i - 1], 48); memcpy(d->failure_codes[i - 1], t, 48); + } +} +void result_rederive(const at0_result *r, rederived *d) { + memset(d, 0, sizeof *d); + const at0_case *c = &r->c; + sbig tol_prob, tol_schro, tol_c, tol_p, one; + sbig_from_scaled(&tol_prob, c->tol_prob); sbig_from_scaled(&tol_schro, c->tol_schro); + sbig_from_scaled(&tol_c, c->tol_constraint); sbig_from_scaled(&tol_p, c->tol_povm); sbig_from_int(&one, 1); + for (int i = 0; i < AT0E_NCHECKS; i++) d->check[i] = CK_NOTEVAL; + + /* 1 */ d->check[0] = r->bound_kind >= c->min_bound_kind ? CK_PASS : CK_FAIL; + /* 2 */ { + int nf = r->constraint_residual.is_nonfinite || r->povm_residual.is_nonfinite; + for (int k = 0; k < c->M; k++) { nf |= r->clock_p[k].is_nonfinite; for (int a = 0; a < 3; a++) for (int s = 0; s < 2; s++) nf |= r->pauli[k][a][s].is_nonfinite | r->reference[k][a][s].is_nonfinite; } + d->check[1] = nf ? CK_FAIL : CK_PASS; + } + /* 3: exact, from the case */ shadow sh; const char *why; int have_sh = shadow_compute(c, &sh, &why); + int nontrivial = have_sh ? (sh.kernel_dim >= 1 && sh.psi_nonzero) : (r->kernel_dim >= 1); + d->check[2] = nontrivial ? CK_PASS : CK_FAIL; + /* trivial kernel: checks 4..10 lose their input (charter N1, spec 9.2 N1); ambiguity A1 in README */ + if (nontrivial) { + /* 4 */ if (!r->constraint_residual.is_undefined && !r->constraint_residual.is_nonfinite) { + sbig v, b; sbig_from_f64_bits(&v, r->constraint_residual.bits); sbig_from_scaled(&b, r->constraint_residual.bound); + d->check[3] = tri_to_ck(tri_absolute(&v, &b, &tol_c)); + } + } + /* 5 */ if (!r->povm_residual.is_undefined && !r->povm_residual.is_nonfinite) { + sbig v, b; sbig_from_f64_bits(&v, r->povm_residual.bits); sbig_from_scaled(&b, r->povm_residual.bound); + d->check[4] = tri_to_ck(tri_absolute(&v, &b, &tol_p)); + } + if (nontrivial) { + /* 6 */ { + int ok = 1; sbig sum, bsum; sbig_zero(&sum); sbig_zero(&bsum); + for (int k = 0; k < c->M && ok; k++) { + if (r->clock_p[k].is_undefined || r->clock_p[k].is_nonfinite) { ok = 0; break; } + sbig v, b; sbig_from_f64_bits(&v, r->clock_p[k].bits); sbig_from_scaled(&b, r->clock_p[k].bound); + sbig_add(&sum, &sum, &v); sbig_add(&bsum, &bsum, &b); + } + if (ok) { sbig m1 = one; sbig_neg(&m1); sbig_add(&sum, &sum, &m1); d->check[5] = tri_to_ck(tri_absolute(&sum, &bsum, &tol_prob)); } + } + /* 7 */ { + int st = CK_NOTEVAL; + const rval *all[1 + AT0E_MAX_M * 13]; int n = 0; + for (int k = 0; k < c->M; k++) { all[n++] = &r->clock_p[k]; for (int a = 0; a < 3; a++) for (int s = 0; s < 2; s++) { all[n++] = &r->pauli[k][a][s]; all[n++] = &r->reference[k][a][s]; } } + for (int i = 0; i < n; i++) { + if (all[i]->is_undefined || all[i]->is_nonfinite) continue; + sbig v, b, nv, vm1, m1 = one; sbig_from_f64_bits(&v, all[i]->bits); sbig_from_scaled(&b, all[i]->bound); + nv = v; sbig_neg(&nv); st = worst(st, tri_to_ck(tri_signed(&nv, &b, &tol_prob))); + sbig_neg(&m1); sbig_add(&vm1, &v, &m1); st = worst(st, tri_to_ck(tri_signed(&vm1, &b, &tol_prob))); + } + d->check[6] = st; + } + /* 8 */ { + int st = CK_NOTEVAL; + for (int k = 0; k < c->M; k++) { + if (r->label_status[k] != LS_DEFINED) continue; + for (int a = 0; a < 3; a++) { + const rval *pp = &r->pauli[k][a][0], *pm = &r->pauli[k][a][1]; + if (pp->is_undefined || pp->is_nonfinite || pm->is_undefined || pm->is_nonfinite) continue; + sbig v1, v2, b1, b2, s, bs, m1 = one; + sbig_from_f64_bits(&v1, pp->bits); sbig_from_f64_bits(&v2, pm->bits); sbig_from_scaled(&b1, pp->bound); sbig_from_scaled(&b2, pm->bound); + sbig_add(&s, &v1, &v2); sbig_neg(&m1); sbig_add(&s, &s, &m1); sbig_add(&bs, &b1, &b2); + st = worst(st, tri_to_ck(tri_absolute(&s, &bs, &tol_prob))); + } + } + d->check[7] = st; + } + /* 9 */ { + int any_undef = 0; + for (int k = 0; k < c->M; k++) { if (r->label_status[k] == LS_UNDEFINED) any_undef = 1; if (r->label_status[k] == LS_INDETERMINATE) d->any_label_indeterminate = 1; } + d->check[8] = any_undef ? CK_FAIL : CK_PASS; + } + /* 10 */ { + int st = CK_NOTEVAL; + for (int k = 0; k < c->M; k++) { + if (r->label_status[k] != LS_DEFINED) continue; + for (int a = 0; a < 3; a++) for (int s = 0; s < 2; s++) { + const rval *pv = &r->pauli[k][a][s], *rv = &r->reference[k][a][s]; + if (pv->is_undefined || pv->is_nonfinite || rv->is_undefined || rv->is_nonfinite) continue; + sbig v1, v2, b1, b2, dlt, bs; + sbig_from_f64_bits(&v1, pv->bits); sbig_from_f64_bits(&v2, rv->bits); sbig_from_scaled(&b1, pv->bound); sbig_from_scaled(&b2, rv->bound); + sbig_neg(&v2); sbig_add(&dlt, &v1, &v2); sbig_add(&bs, &b1, &b2); + st = worst(st, tri_to_ck(tri_absolute(&dlt, &bs, &tol_schro))); + } + } + d->check[9] = st; + } + } /* nontrivial */ + /* codes and outcome */ + int any_bad = 0; + for (int i = 0; i < AT0E_NCHECKS; i++) { + if (d->check[i] == CK_FAIL) { add_code(d, at0e_check_codes[i]); any_bad = 1; } + if (d->check[i] == CK_INDET) { add_code(d, "PRECISION_INSUFFICIENT"); any_bad = 1; } + } + if (d->any_label_indeterminate) { add_code(d, "PRECISION_INSUFFICIENT"); any_bad = 1; } + d->outcome = any_bad ? OUT_FAIL : OUT_PASS; + int same = (d->outcome == OUT_PASS) == (c->expected_pass != 0) && d->n_failure_codes == c->n_expected_codes; + for (int i = 0; same && i < d->n_failure_codes; i++) if (strcmp(d->failure_codes[i], c->expected_codes[i])) same = 0; + d->expectation_met = same ? 0 : 1; +} + +/* ---------------- verification ---------------- */ +static long double f64_ld(uint64_t bits) { double x; memcpy(&x, &bits, 8); return (long double)x; } +static long double scaled_ld(scaled s) { long double v = (long double)(unsigned long long)(s.n >> 64) * 18446744073709551616.0L + (long double)(unsigned long long)s.n; for (int i = 0; i < s.k; i++) v /= 10.0L; return v; } +static const char *const fail_codes_sev[] = { + "E4-STRUCT-", "E4-ID-", "E4-BIND-", "E4-CHECK-", "E4-OUTCOME-", "E4-CODES-", "E4-EXPECTATION-", "E4-LABEL-", + "E4-SHADOW-", "E4-BOUND-", "E4-PLACEHOLDER-", "E4-TIME-", "E4-PROV-ORACLE-IS-ENGINE", "E4-PROV-NONE-", NULL }; +static int is_fail_code(const char *code) { if (!strcmp(code, "E4-SHADOW-UNAVAILABLE")) return 0; for (int i = 0; fail_codes_sev[i]; i++) if (!strncmp(code, fail_codes_sev[i], strlen(fail_codes_sev[i]))) return 1; return 0; } + +const char *result_verify(const textfile *tf, const at0_result *r, const textfile *case_tf, int use_shadow, findings *fs) { + const at0_case *c = &r->c; + char id[65]; + int inconclusive = 0; + /* identities */ + { + char pre[200]; int pl = snprintf(pre, sizeof pre, "case_id %s\nacceptance_id %s\n", c->case_id, c->acceptance_id); + uint8_t *buf = malloc((size_t)pl + r->ver_len); if (!buf) { findings_add(fs, "E4-STRUCT-UNREADABLE", "out of memory"); return "FAIL"; } memcpy(buf, pre, (size_t)pl); memcpy(buf + pl, r->ver_block, r->ver_len); + sha256_tagged_hex(r->version == 2 ? AT0E_VERDICT_DOMAIN_V2 : AT0E_VERDICT_DOMAIN_V1, buf, (size_t)pl + r->ver_len, id); free(buf); + if (strcmp(id, r->verdict_id)) findings_add(fs, "E4-ID-VERDICT", "verdict_id %s does not recompute (expected %s)", r->verdict_id, id); + size_t upto = 0; + for (size_t i = 0; i < r->evidence_line_index; i++) upto += strlen(tf->lines[i]) + 1; + sha256_tagged_hex(r->version == 2 ? AT0E_EVIDENCE_DOMAIN_V2 : AT0E_EVIDENCE_DOMAIN_V1, tf->bytes, upto, id); + if (strcmp(id, r->evidence_digest)) findings_add(fs, "E4-ID-EVIDENCE", "evidence_digest does not recompute: record altered or digest forged (expected %s)", id); + } + /* binding to the supplied case file */ + if (!case_tf) { findings_add(fs, "E4-UNBOUND-NO-CASE-FILE", "no case file supplied: the embedded case is trusted, so this verification is not citable (run with --case)"); inconclusive = 1; } + if (case_tf) { + at0_case cc; const char *d; + refusal rf = case_parse_validate(case_tf, &cc, &d); + if (rf != REFUSE_NONE) findings_add(fs, "E4-BIND-CASE-REFUSED", "supplied case file is refused: %s (%s)", refusal_name(rf), d); + else { + if (strcmp(cc.case_file_sha256, r->case_file_sha256)) findings_add(fs, "E4-BIND-CASE-FILE", "case_file_sha256 %s differs from the supplied case file %s", r->case_file_sha256, cc.case_file_sha256); + if (strcmp(cc.case_id, c->case_id)) findings_add(fs, "E4-BIND-CASE-ID", "embedded case_id differs from the supplied case file"); + if (strcmp(cc.acceptance_id, c->acceptance_id)) findings_add(fs, "E4-BIND-ACCEPTANCE-ID", "embedded acceptance_id differs from the supplied case file"); + if (cc.sem_len != c->sem_len || memcmp(cc.sem_block, c->sem_block, c->sem_len)) findings_add(fs, "E4-BIND-SEMANTIC-BLOCK", "embedded semantic block is not byte-identical to the supplied case"); + if (cc.acc_len != c->acc_len || memcmp(cc.acc_block, c->acc_block, c->acc_len)) findings_add(fs, "E4-BIND-ACCEPTANCE-BLOCK", "embedded acceptance block is not byte-identical to the supplied case"); + if (strcmp(cc.case_name, c->case_name)) findings_add(fs, "E4-BIND-CASE-NAME", "case_name differs from the supplied case file"); + } + case_free(&cc); + } + /* provenance */ + { int known = 0; for (int i = 0; at0e_contract_commits[i]; i++) if (!strcmp(r->contract_commit, at0e_contract_commits[i])) known = 1; + if (!known) { findings_add(fs, "E4-PROV-CONTRACT-UNVERIFIED", "contract_commit %s is not in the verified allowlist at0e_contract_commits (src/at0e_result.c); verify its contract-file digests and add it, or treat this record as not citable", r->contract_commit); inconclusive = 1; } } + if (!r->source_tree_clean) { findings_add(fs, "E4-PROV-DIRTY", "source_tree_clean NO: result may not be cited for a gate (AT0_RESULT_V1 section 7)"); inconclusive = 1; } + int placeholder = r->outcome == OUT_ERROR || r->outcome == OUT_NOT_RUN; + if (!placeholder) { + if (!strcmp(r->engine_sha256, "none") || !strcmp(r->oracle_sha256, "none") || !strcmp(r->run_started, "none") || !strcmp(r->run_finished, "none")) + findings_add(fs, "E4-PROV-NONE-IN-COMPLETED-RUN", "a completed run carries a `none` provenance token"); + if (strcmp(r->run_started, "none") && strcmp(r->run_finished, "none") && strcmp(r->run_finished, r->run_started) < 0) + findings_add(fs, "E4-TIME-ORDER", "run_finished_utc %s precedes run_started_utc %s", r->run_finished, r->run_started); + if (!strcmp(r->engine_sha256, r->oracle_sha256) && strcmp(r->engine_sha256, "none")) findings_add(fs, "E4-PROV-ORACLE-IS-ENGINE", "engine_sha256 equals oracle_sha256: reference values did not come from a separate executable"); + } else { + int bad = r->kernel_dim != 0 || r->n_failure_codes != 0 || r->expectation_met != 2; + for (int i = 0; i < AT0E_NCHECKS; i++) if (r->check[i] != CK_NOTEVAL) bad = 1; + if (!r->constraint_residual.is_undefined || !r->povm_residual.is_undefined) bad = 1; + for (int k = 0; k < c->M; k++) { if (!r->clock_p[k].is_undefined) bad = 1; for (int a = 0; a < 3; a++) for (int s = 0; s < 2; s++) if (!r->pauli[k][a][s].is_undefined || !r->reference[k][a][s].is_undefined) bad = 1; } + if (r->outcome == OUT_ERROR && !strcmp(r->error_code, "none")) bad = 1; + if (r->outcome == OUT_NOT_RUN && strcmp(r->error_code, "none")) bad = 1; + if (bad) findings_add(fs, "E4-PLACEHOLDER-SHAPE", "ERROR/NOT_RUN result violates the placeholder shape of AT0_RESULT_V1 section 5"); + return fs->n ? (is_fail_code(fs->f[0].code) ? "FAIL" : "INCONCLUSIVE") : "PASS"; + } + if (strcmp(r->error_code, "none")) findings_add(fs, "E4-STRUCT-ERROR-CODE", "completed run carries error_code %s", r->error_code); + /* label status and token discipline */ + { + shadow sx; const char *wx; int triv = shadow_compute(c, &sx, &wx) ? !(sx.kernel_dim >= 1 && sx.psi_nonzero) : 0; + if (!triv) { + int u = r->constraint_residual.is_undefined || r->povm_residual.is_undefined; + for (int k = 0; k < c->M; k++) { u |= r->clock_p[k].is_undefined; for (int a = 0; a < 3; a++) for (int s = 0; s < 2; s++) u |= r->reference[k][a][s].is_undefined; } /* pauli undefined is governed by label status (V2 section 1) */ + if (u) findings_add(fs, "E4-STRUCT-UNDEFINED-TOKEN", "undefined token on constraint_residual, povm_residual, clock_probability or reference in a result whose kernel is nontrivial (refusal under AT0_RESULT_V2 section 2)"); + } else { + int bad = !r->constraint_residual.is_undefined || r->povm_residual.is_undefined; + for (int k = 0; k < c->M; k++) { bad |= !r->clock_p[k].is_undefined || r->label_status[k] != LS_UNDEFINED; for (int a = 0; a < 3; a++) for (int s = 0; s < 2; s++) bad |= !r->pauli[k][a][s].is_undefined || r->reference[k][a][s].is_undefined; } + if (bad) findings_add(fs, "E4-STRUCT-TRIVIAL-KERNEL-SHAPE", "trivial kernel: constraint_residual, clock probabilities and pauli values must be undefined, labels UNDEFINED, povm_residual and references real"); + } + } + for (int k = 0; k < c->M; k++) { + int want = label_status_derive(&r->clock_p[k], c->tol_zero); + if (want != r->label_status[k]) findings_add(fs, "E4-LABEL-STATUS", "label %d status does not follow from clock_probability and tol_zero_probability", k); + for (int a = 0; a < 3; a++) for (int s = 0; s < 2; s++) { + int u = r->pauli[k][a][s].is_undefined; + if (r->label_status[k] == LS_DEFINED && u) findings_add(fs, "E4-STRUCT-UNDEFINED-ON-DEFINED", "label %d is DEFINED but pauli %s %s is undefined", k, axis_names[a], sign_names[s]); + if (r->label_status[k] != LS_DEFINED && !u) findings_add(fs, "E4-STRUCT-VALUE-ON-UNDEFINED", "label %d is not DEFINED but pauli %s %s carries a value", k, axis_names[a], sign_names[s]); + if (r->reference[k][a][s].is_undefined) findings_add(fs, "E4-STRUCT-REFERENCE-UNDEFINED", "reference %d %s %s is undefined; references are always written", k, axis_names[a], sign_names[s]); + } + } + if (r->bound_kind == BK_NONE) { + int nz = r->constraint_residual.bound.n || r->povm_residual.bound.n; + for (int k = 0; k < c->M; k++) { nz |= r->clock_p[k].bound.n != 0; for (int a = 0; a < 3; a++) for (int s = 0; s < 2; s++) nz |= (r->pauli[k][a][s].bound.n != 0) | (r->reference[k][a][s].bound.n != 0); } + if (nz) findings_add(fs, "E4-BOUND-NONE-NONZERO", "bound_kind NONE but a nonzero bound is written"); + } + /* re-derivation */ + rederived d; result_rederive(r, &d); + for (int i = 0; i < AT0E_NCHECKS; i++) if (d.check[i] != r->check[i]) { + static const char *const nm[] = { "PASS", "FAIL", "INDETERMINATE", "NOT_EVALUATED" }; + findings_add(fs, "E4-CHECK-MISMATCH", "check %s reported %s, re-derived %s", at0e_check_names[i], nm[r->check[i]], nm[d.check[i]]); + } + if (d.outcome != r->outcome) findings_add(fs, "E4-OUTCOME-MISMATCH", "outcome reported %s, re-derived %s", r->outcome == OUT_PASS ? "PASS" : "FAIL", d.outcome == OUT_PASS ? "PASS" : "FAIL"); + { + int same = d.n_failure_codes == r->n_failure_codes; + for (int i = 0; same && i < d.n_failure_codes; i++) if (strcmp(d.failure_codes[i], r->failure_codes[i])) same = 0; + if (!same) findings_add(fs, "E4-CODES-MISMATCH", "failure_codes differ from the re-derived set (%d reported, %d re-derived)", r->n_failure_codes, d.n_failure_codes); + } + if (d.expectation_met != r->expectation_met) findings_add(fs, "E4-EXPECTATION-MISMATCH", "expectation_met reported %s, re-derived %s", r->expectation_met == 0 ? "YES" : r->expectation_met == 1 ? "NO" : "NOT_APPLICABLE", d.expectation_met ? "NO" : "YES"); + /* shadow */ + if (use_shadow) { + shadow sh; const char *why; + if (!shadow_compute(c, &sh, &why)) { findings_add(fs, "E4-SHADOW-UNAVAILABLE", "%s", why); inconclusive = 1; } + else { + if (sh.kernel_dim != r->kernel_dim) findings_add(fs, "E4-SHADOW-KERNEL-DIM", "physical_state_kernel_dim %ld, exact value %d", r->kernel_dim, sh.kernel_dim); + int nontrivial = sh.kernel_dim >= 1 && sh.psi_nonzero; + if (nontrivial && !r->constraint_residual.is_undefined && !r->constraint_residual.is_nonfinite) { + long double v = fabsl(f64_ld(r->constraint_residual.bits)), b = scaled_ld(r->constraint_residual.bound); + if (v > b) findings_add(fs, "E4-BOUND-CLAIM-FALSE", "constraint_residual %.3Le exceeds its own bound %.3Le although the exact residual of a kernel projection is 0", v, b); + } + if (!nontrivial && !r->constraint_residual.is_undefined) findings_add(fs, "E4-STRUCT-RESIDUAL-ON-TRIVIAL", "constraint_residual written although the kernel is trivial"); + if (!r->povm_residual.is_undefined && !r->povm_residual.is_nonfinite) { + long double v = fabsl(f64_ld(r->povm_residual.bits)), b = scaled_ld(r->povm_residual.bound); + if (sh.povm_exact_identity) { if (v > b) findings_add(fs, "E4-BOUND-CLAIM-FALSE", "povm_residual %.3Le exceeds its bound %.3Le although sum F_k = I exactly", v, b); } + if (fabsl(v - sh.povm_residual) > b + sh.bound) findings_add(fs, "E4-SHADOW-POVM", "povm_residual %.6Le vs shadow %.6Le beyond bound %.1Le", v, sh.povm_residual, b); + } else if (!r->povm_residual.is_nonfinite) findings_add(fs, "E4-STRUCT-POVM-UNDEFINED", "povm_residual is undefined; it is always computable"); + int n_clock = 0, n_pauli = 0, n_ref = 0; + for (int k = 0; k < c->M; k++) { + if (nontrivial && !r->clock_p[k].is_undefined && !r->clock_p[k].is_nonfinite) { + long double v = f64_ld(r->clock_p[k].bits), b = scaled_ld(r->clock_p[k].bound); + if (fabsl(v - sh.clock_p[k]) > b + sh.bound) { if (n_clock++ < 3) findings_add(fs, "E4-SHADOW-CLOCK-PROB", "clock_probability %d %.9Le vs shadow %.9Le beyond bound %.1Le", k, v, sh.clock_p[k], b); } + } + for (int a = 0; a < 3; a++) for (int s = 0; s < 2; s++) { + if (r->label_status[k] == LS_DEFINED && nontrivial && !r->pauli[k][a][s].is_undefined && !r->pauli[k][a][s].is_nonfinite) { + long double v = f64_ld(r->pauli[k][a][s].bits), b = scaled_ld(r->pauli[k][a][s].bound); + if (fabsl(v - sh.pauli[k][a][s]) > b + sh.bound) { if (n_pauli++ < 6) findings_add(fs, "E4-SHADOW-PAULI", "pauli %d %s %s %.9Le vs shadow %.9Le beyond bound %.1Le", k, axis_names[a], sign_names[s], v, sh.pauli[k][a][s], b); } + } + if (!r->reference[k][a][s].is_undefined && !r->reference[k][a][s].is_nonfinite) { + long double v = f64_ld(r->reference[k][a][s].bits), b = scaled_ld(r->reference[k][a][s].bound); + if (fabsl(v - sh.reference[k][a][s]) > b + sh.bound) { if (n_ref++ < 6) findings_add(fs, "E4-SHADOW-REFERENCE", "reference %d %s %s %.9Le vs shadow %.9Le beyond bound %.1Le", k, axis_names[a], sign_names[s], v, sh.reference[k][a][s], b); } + } + } + } + if (n_clock > 3) findings_add(fs, "E4-SHADOW-CLOCK-PROB", "... %d clock probabilities disagree in total", n_clock); + if (n_pauli > 6) findings_add(fs, "E4-SHADOW-PAULI", "... %d pauli values disagree in total", n_pauli); + if (n_ref > 6) findings_add(fs, "E4-SHADOW-REFERENCE", "... %d reference values disagree in total", n_ref); + } + } else inconclusive = 1; + for (int i = 0; i < fs->n; i++) if (is_fail_code(fs->f[i].code)) return "FAIL"; + return inconclusive ? "INCONCLUSIVE" : "PASS"; +} diff --git a/research/atemporal/at0/evaluator/src/at0e_shadow.c b/research/atemporal/at0/evaluator/src/at0e_shadow.c new file mode 100644 index 000000000..ec7064c68 --- /dev/null +++ b/research/atemporal/at0/evaluator/src/at0e_shadow.c @@ -0,0 +1,162 @@ +/* Shadow oracle: an independent derivation of every AT-0 quantity from the case + * alone (AT0_CASE_V1 section 3), used to falsify engine and reference values. + * + * Exact part (int128 rationals): eigenvalues e_s = h0 +/- |h|, eigenvectors with + * complex-rational components, kernel pairs, Psi != 0, exact POVM identity test. + * Numeric part (long double, 113-bit mantissa on this host): the conditional + * state phi_k, clock probabilities, Pauli probabilities, Schrodinger reference, + * POVM residual. Angles are reduced modulo one turn exactly in rationals before + * any transcendental call. The stated bound is ESTIMATED, not proven. + * + * Derivation used (hand, from the contract): + * |t_k> = N^-1/2 sum_j exp(-2 pi i E_j k tau) |E_j> + * Psi = P0 (|t_r> (x) |psi0>) = sum_{(j,s): E_j + e_s = 0} |E_j>|e_s> + * phi_k = ( |e_s> + * which equals Schrodinger evolution of psi0 over t_k - t_r restricted to the + * matched eigencomponents. The reference uses all eigencomponents. + */ +#include "at0e.h" +#include +#include +#include + +typedef struct { long double re, im; } cld; +static cld cmk(long double re, long double im) { cld z = { re, im }; return z; } +static cld cadd(cld a, cld b) { return cmk(a.re + b.re, a.im + b.im); } +static cld cmul(cld a, cld b) { return cmk(a.re * b.re - a.im * b.im, a.re * b.im + a.im * b.re); } +static cld cconj(cld a) { return cmk(a.re, -a.im); } +static long double cabs2(cld a) { return a.re * a.re + a.im * a.im; } +static cld cscale(cld a, long double s) { return cmk(a.re * s, a.im * s); } +static long double i128_ld(i128 v) { int neg = v < 0; u128 u = neg ? (u128)0 - (u128)v : (u128)v; long double r = (long double)(unsigned long long)(u >> 64) * 18446744073709551616.0L + (long double)(unsigned long long)u; return neg ? -r : r; } +static long double rat_ld(rat a) { return i128_ld(a.n) / i128_ld(a.d); } +static cld crat_ld(crat z) { return cmk(rat_ld(z.re), rat_ld(z.im)); } +/* exp(-2 pi i theta) with theta a rational, reduced mod 1 exactly first */ +static cld expm2pi(rat theta) { + rat t = rat_mod1(theta); + if (rat_is_zero(t)) return cmk(1.0L, 0.0L); + /* exact quarter turns avoid rounding on the common ideal-clock grid */ + if (t.d == 4) { if (t.n == 1) return cmk(0.0L, -1.0L); if (t.n == 3) return cmk(0.0L, 1.0L); } + if (t.d == 2) return cmk(-1.0L, 0.0L); + long double a = 2.0L * 3.14159265358979323846264338327950288L * rat_ld(t); + return cmk(cosl(a), -sinl(a)); +} + +/* eigenvectors (unnormalized complex rational); index 0 = e_+ = h0 + r, 1 = e_- = h0 - r */ +static void eigvecs(const at0_case *c, crat v[2][2], rat e[2]) { + rat r = c->radius; + e[0] = rat_add(c->h0, r); e[1] = rat_sub(c->h0, r); + if (rat_is_zero(r)) { + v[0][0].re = rat_make(1, 1); v[0][0].im = rat_make(0, 1); v[0][1].re = rat_make(0, 1); v[0][1].im = rat_make(0, 1); + v[1][0].re = rat_make(0, 1); v[1][0].im = rat_make(0, 1); v[1][1].re = rat_make(1, 1); v[1][1].im = rat_make(0, 1); + return; + } + /* v_+ = (hz + r, hx + i hy); if zero, (hx - i hy, r - hz) */ + rat a = rat_add(c->hz, r); + if (rat_is_zero(a) && rat_is_zero(c->hx) && rat_is_zero(c->hy)) { + v[0][0].re = c->hx; v[0][0].im = rat_neg(c->hy); v[0][1].re = rat_sub(r, c->hz); v[0][1].im = rat_make(0, 1); + } else { + v[0][0].re = a; v[0][0].im = rat_make(0, 1); v[0][1].re = c->hx; v[0][1].im = c->hy; + } + /* v_- = (hz - r, hx + i hy); if zero, (hx - i hy, -r - hz) */ + rat b = rat_sub(c->hz, r); + if (rat_is_zero(b) && rat_is_zero(c->hx) && rat_is_zero(c->hy)) { + v[1][0].re = c->hx; v[1][0].im = rat_neg(c->hy); v[1][1].re = rat_sub(rat_neg(r), c->hz); v[1][1].im = rat_make(0, 1); + } else { + v[1][0].re = b; v[1][0].im = rat_make(0, 1); v[1][1].re = c->hx; v[1][1].im = c->hy; + } +} +/* exactly: conj(v0) psi0_0 + conj(v1) psi0_1 */ +static crat inner_exact(const crat v[2], const crat psi[2]) { + crat acc = { rat_make(0, 1), rat_make(0, 1) }; + for (int i = 0; i < 2; i++) { + rat re = rat_add(rat_mul(v[i].re, psi[i].re), rat_mul(v[i].im, psi[i].im)); + rat im = rat_sub(rat_mul(v[i].re, psi[i].im), rat_mul(v[i].im, psi[i].re)); + acc.re = rat_add(acc.re, re); acc.im = rat_add(acc.im, im); + } + return acc; +} +static void pauli_probs(cld a, cld b, long double out[3][2]) { + long double n2 = cabs2(a) + cabs2(b); + cld ab = cmul(cconj(a), b); + long double x = 2.0L * ab.re, y = 2.0L * ab.im, z = cabs2(a) - cabs2(b); + out[0][0] = (n2 + x) / (2.0L * n2); out[0][1] = (n2 - x) / (2.0L * n2); + out[1][0] = (n2 + y) / (2.0L * n2); out[1][1] = (n2 - y) / (2.0L * n2); + out[2][0] = (n2 + z) / (2.0L * n2); out[2][1] = (n2 - z) / (2.0L * n2); +} + +int shadow_compute(const at0_case *c, shadow *s, const char **why) { + memset(s, 0, sizeof *s); + *why = NULL; + if (LDBL_MANT_DIG < 64) { *why = "long double narrower than 64 bits; shadow refuses"; return 0; } + /* stated ESTIMATED bound: 1e-20 needs the 113-bit binary128 long double (aarch64); a 64-bit mantissa (x86-64) gets 1e-14 */ + s->bound = LDBL_MANT_DIG >= 113 ? 1e-20L : 1e-14L; + + crat v[2][2]; rat e[2]; + eigvecs(c, v, e); + for (int si = 0; si < 2; si++) { + rat neg = rat_neg(e[si]); + s->matched[si] = 0; + for (int j = 0; j < c->N; j++) if (rat_cmp(c->E[j], neg) == 0) { s->matched[si] = 1; break; } + } + s->kernel_dim = s->matched[0] + s->matched[1]; + crat cs[2]; int cs_zero[2]; + for (int si = 0; si < 2; si++) { cs[si] = inner_exact(v[si], c->psi0); cs_zero[si] = crat_is_zero(cs[si]); } + s->psi_nonzero = (s->matched[0] && !cs_zero[0]) || (s->matched[1] && !cs_zero[1]); + + /* exact POVM identity test */ + s->povm_exact_identity = rat_cmp(c->w, rat_make(c->N, c->M)) == 0; + for (int j = 0; j < c->N && s->povm_exact_identity; j++) + for (int jj = j + 1; jj < c->N; jj++) { + rat D = rat_sub(c->E[jj], c->E[j]); + rat dt = rat_mul(D, c->tau); + rat dtm = rat_mul(dt, rat_make(c->M, 1)); + if (rat_is_int(dt) || !rat_is_int(dtm)) { s->povm_exact_identity = 0; break; } + } + /* numeric POVM residual: Frobenius norm of w sum_k |t_k>w) / (long double)c->N; + for (int j = 0; j < c->N; j++) + for (int jj = 0; jj < c->N; jj++) { + rat D = rat_sub(c->E[j], c->E[jj]); + cld sum = cmk(0.0L, 0.0L); + for (int k = 0; k < c->M; k++) sum = cadd(sum, expm2pi(rat_mul(rat_mul(D, rat_make(k, 1)), c->tau))); + cld m = cscale(sum, wn); + if (j == jj) m.re -= 1.0L; + fro += cabs2(m); + } + s->povm_residual = sqrtl(fro); + } + /* norms and states */ + long double vn2[2]; cld vl[2][2], csl[2]; + for (int si = 0; si < 2; si++) { + vl[si][0] = crat_ld(v[si][0]); vl[si][1] = crat_ld(v[si][1]); + vn2[si] = cabs2(vl[si][0]) + cabs2(vl[si][1]); + csl[si] = crat_ld(cs[si]); + } + long double psi_norm2 = 0.0L; + for (int si = 0; si < 2; si++) if (s->matched[si]) psi_norm2 += cabs2(csl[si]) / vn2[si]; + psi_norm2 /= (long double)c->N; + long double psi0_n2 = cabs2(crat_ld(c->psi0[0])) + cabs2(crat_ld(c->psi0[1])); + (void)psi0_n2; + + for (int k = 0; k < c->M; k++) { + cld phi[2] = { cmk(0, 0), cmk(0, 0) }, ref[2] = { cmk(0, 0), cmk(0, 0) }; + rat dk = rat_make(k - c->ref_index, 1); + for (int si = 0; si < 2; si++) { + cld ph = expm2pi(rat_mul(rat_mul(e[si], dk), c->tau)); + cld coef = cscale(cmul(ph, csl[si]), 1.0L / vn2[si]); + for (int i = 0; i < 2; i++) { + cld term = cmul(coef, vl[si][i]); + ref[i] = cadd(ref[i], term); + if (s->matched[si]) phi[i] = cadd(phi[i], cscale(term, 1.0L / (long double)c->N)); + } + } + s->clock_p_exact_zero[k] = !s->psi_nonzero; + if (s->psi_nonzero) { + s->clock_p[k] = rat_ld(c->w) * (cabs2(phi[0]) + cabs2(phi[1])) / psi_norm2; + pauli_probs(phi[0], phi[1], s->pauli[k]); + } + pauli_probs(ref[0], ref[1], s->reference[k]); + } + return 1; +} diff --git a/research/atemporal/at0/evaluator/src/at0e_synth.c b/research/atemporal/at0/evaluator/src/at0e_synth.c new file mode 100644 index 000000000..6332e5947 --- /dev/null +++ b/research/atemporal/at0/evaluator/src/at0e_synth.c @@ -0,0 +1,221 @@ +/* Synthetic result writer for evaluator self-tests. The honest fixture takes its + * numbers from the shadow oracle (rounded to binary64, bound 1@15, ESTIMATED). + * Every mutant below is a deliberate defect the evaluator must catch. Nothing + * written here is AT-0 evidence: provenance fields are marked SYNTHETIC. */ +#include "at0e.h" +#include +#include +#include + +static const char *const mutant_names[] = { + /* physics-level (engine or oracle defects) */ + "axis_swap", /* engine exchanges X and Y results */ + "y_sign_swap", /* engine exchanges Y PLUS and MINUS */ + "conjugate_bug", /* engine conditions on -theta (missing complex conjugate) */ + "reversed_reference", /* oracle evolves with exp(+iHt) */ + "dephased_state", /* engine reports the dephased (mixed) conditional state */ + "wrong_weight_hidden", /* engine ignores povm_weight and claims povm_residual 0 */ + "hardcoded_table", /* engine returns the KAT table whatever the case asks */ + "kernel_dim_wrong", /* physical_state_kernel_dim off by one */ + "residual_over_bound", /* constraint_residual within tolerance but above its own bound */ + "nonfinite_hidden", /* a nonfinite value with check values_finite still PASS */ + /* receipt-level (forged or altered records) */ + "verdict_forged", /* checks/outcome claim PASS regardless of values; ids recomputed honestly */ + "evidence_corrupt", /* one hex digit of evidence_digest flipped */ + "verdict_id_corrupt", /* one hex digit of verdict_id flipped */ + "case_id_altered", /* embedded case_id altered */ + "tolerance_altered", /* acceptance block edited after the fact, acceptance_id stale */ + "binding_rebound", /* acceptance block edited and acceptance_id recomputed: ids self-consistent, binding to the case file broken */ + "contract_commit_wrong", + "dirty_tree", + "times_reversed", + "oracle_is_engine", /* oracle_sha256 == engine_sha256 */ + "bound_none_nonzero", /* bound_kind NONE with nonzero bounds */ + "label_status_wrong", /* a DEFINED label marked UNDEFINED with values dropped */ + "placeholder_with_values", /* NOT_RUN result carrying values */ + "crlf", /* CRLF line endings */ + "trailing_space", + "label_claimed_defined", /* an UNDEFINED label marked DEFINED with fabricated (correct-looking) pauli values */ + NULL }; +const char *const *synth_mutant_names(int *count) { int n = 0; while (mutant_names[n]) n++; *count = n; return mutant_names; } + +static uint64_t f64_bits(double x) { uint64_t b; if (x == 0.0) x = 0.0; memcpy(&b, &x, 8); return b; } +static const char *const axis_names[3] = { "X", "Y", "Z" }; +static const char *const sign_names[2] = { "PLUS", "MINUS" }; +static const char *const ck_names[4] = { "PASS", "FAIL", "INDETERMINATE", "NOT_EVALUATED" }; + +#define EMIT(...) do { int w_ = snprintf(buf + o, cap > o ? cap - o : 0, __VA_ARGS__); if (w_ < 0) return -1; o += (size_t)w_; } while (0) +static void fmt_rval(const rval *v, char *out, size_t cap) { /* out is >= 96 bytes at every call */ + char b[48]; + { /* scaled format */ + if (v->bound.n == 0) snprintf(b, sizeof b, "0@0"); + else { char d[40]; int n = 0; u128 x = v->bound.n; while (x && n < 39) { d[n++] = (char)('0' + (int)(x % 10)); x /= 10; } char num[40]; for (int i = 0; i < n; i++) num[i] = d[n - 1 - i]; num[n] = 0; snprintf(b, sizeof b, "%s@%d", num, v->bound.k); } + } + if (v->is_undefined) snprintf(out, cap, "undefined %s", b); + else if (v->is_nonfinite) snprintf(out, cap, "nonfinite %s", b); + else snprintf(out, cap, "f64:%016llx %s", (unsigned long long)v->bits, b); +} +static long result_emit(const at0_result *r, char *buf, size_t cap) { + size_t o = 0; char t[96]; + const at0_case *c = &r->c; + EMIT("OMEGA-AT0-RESULT v%d\ndomain omega.at0.result.v%d\ncontract AT0_RESULT_V%d\ncase_contract AT0_CASE_V1\ncase_name %s\n", r->version, r->version, r->version, c->case_name); + EMIT("%.*s%.*s", (int)c->sem_len, c->sem_block, (int)c->acc_len, c->acc_block); + EMIT("case_id %s\nacceptance_id %s\ncase_file_sha256 %s\n", c->case_id, c->acceptance_id, r->case_file_sha256); + static const char *const arith[4] = { "BINARY64", "BINARY64_INTERVAL", "BINARY64_COMPENSATED", "NONE" }; + EMIT("begin numerics\narithmetic %s\nbound_kind %s\nthreads 1\nend numerics\n", arith[r->arithmetic], r->bound_kind == BK_RIGOROUS ? "RIGOROUS" : r->bound_kind == BK_ESTIMATED ? "ESTIMATED" : "NONE"); + EMIT("begin values\nphysical_state_kernel_dim %ld\n", r->kernel_dim); + fmt_rval(&r->constraint_residual, t, sizeof t); EMIT("constraint_residual %s\n", t); + fmt_rval(&r->povm_residual, t, sizeof t); EMIT("povm_residual %s\n", t); + for (int k = 0; k < c->M; k++) EMIT("label %d %s %s\n", k, c->label[k], r->label_status[k] == LS_DEFINED ? "DEFINED" : r->label_status[k] == LS_UNDEFINED ? "UNDEFINED" : "INDETERMINATE"); + for (int k = 0; k < c->M; k++) { fmt_rval(&r->clock_p[k], t, sizeof t); EMIT("clock_probability %d %s\n", k, t); } + for (int k = 0; k < c->M; k++) for (int a = 0; a < 3; a++) for (int s = 0; s < 2; s++) { fmt_rval(&r->pauli[k][a][s], t, sizeof t); EMIT("pauli %d %s %s %s\n", k, axis_names[a], sign_names[s], t); } + for (int k = 0; k < c->M; k++) for (int a = 0; a < 3; a++) for (int s = 0; s < 2; s++) { fmt_rval(&r->reference[k][a][s], t, sizeof t); EMIT("reference %d %s %s %s\n", k, axis_names[a], sign_names[s], t); } + EMIT("end values\n"); + size_t ver_start = o; + EMIT("begin verdict\n"); + for (int i = 0; i < AT0E_NCHECKS; i++) EMIT("check %s %s\n", at0e_check_names[i], ck_names[r->check[i]]); + static const char *const outn[4] = { "PASS", "FAIL", "ERROR", "NOT_RUN" }; + EMIT("outcome %s\nfailure_codes ", outn[r->outcome]); + if (r->n_failure_codes == 0) EMIT("none"); + for (int i = 0; i < r->n_failure_codes; i++) EMIT("%s%s", i ? "," : "", r->failure_codes[i]); + EMIT("\nerror_code %s\nexpectation_met %s\nend verdict\n", r->error_code, r->expectation_met == 0 ? "YES" : r->expectation_met == 1 ? "NO" : "NOT_APPLICABLE"); + size_t ver_end = o; + if (o >= cap) return -1; + { + char pre[200]; int pl = snprintf(pre, sizeof pre, "case_id %s\nacceptance_id %s\n", c->case_id, c->acceptance_id); + uint8_t *tmp = malloc((size_t)pl + (ver_end - ver_start)); memcpy(tmp, pre, (size_t)pl); memcpy(tmp + pl, buf + ver_start, ver_end - ver_start); + char id[65]; sha256_tagged_hex(r->version == 2 ? AT0E_VERDICT_DOMAIN_V2 : AT0E_VERDICT_DOMAIN_V1, tmp, (size_t)pl + (ver_end - ver_start), id); free(tmp); + EMIT("verdict_id %s\n", id); + } + EMIT("begin provenance\nsource_repo %s\nsource_commit %s\nsource_tree_clean %s\ncontract_commit %s\nengine_sha256 %s\noracle_repo %s\noracle_commit %s\noracle_sha256 %s\nbuild_cc %s\nbuild_flags %s\nhost %s\nrun_started_utc %s\nrun_finished_utc %s\nend provenance\n", + r->source_repo, r->source_commit, r->source_tree_clean ? "YES" : "NO", r->contract_commit, r->engine_sha256, r->oracle_repo, r->oracle_commit, r->oracle_sha256, r->build_cc, r->build_flags, r->host, r->run_started, r->run_finished); + if (o >= cap) return -1; + { char id[65]; sha256_tagged_hex(r->version == 2 ? AT0E_EVIDENCE_DOMAIN_V2 : AT0E_EVIDENCE_DOMAIN_V1, (const uint8_t *)buf, o, id); EMIT("evidence_digest %s\nend\n", id); } + if (o >= cap) return -1; + return (long)o; +} + +static void set_val(rval *v, long double x, int bound_exp) { memset(v, 0, sizeof *v); v->bits = f64_bits((double)x); v->bound.n = 1; v->bound.k = bound_exp; } +static void set_undef(rval *v) { memset(v, 0, sizeof *v); v->is_undefined = 1; } + +long result_synth(const at0_case *c, const uint8_t *case_bytes, size_t case_len, const char *mutant, char *buf, size_t cap, const char **why) { + at0_result r; memset(&r, 0, sizeof r); + shadow sh; + *why = NULL; + if (!shadow_compute(c, &sh, why)) return -1; + const char *m = mutant ? mutant : ""; + int found = !mutant; + for (int i = 0; mutant_names[i]; i++) if (!strcmp(m, mutant_names[i])) found = 1; + if (!found) { *why = "unknown mutant"; return -1; } + + /* copy case (shallow blocks are fine: not freed here) */ + r.c = *c; r.version = AT0E_RESULT_VERSION_DEFAULT; + sha256_hex(case_bytes, case_len, r.case_file_sha256); + r.arithmetic = 0; r.bound_kind = BK_ESTIMATED; + r.kernel_dim = sh.kernel_dim; + int nontrivial = sh.kernel_dim >= 1 && sh.psi_nonzero; + if (nontrivial) set_val(&r.constraint_residual, 0.0L, 15); else set_undef(&r.constraint_residual); + set_val(&r.povm_residual, sh.povm_exact_identity ? 0.0L : sh.povm_residual, 15); + if (!strcmp(m, "wrong_weight_hidden")) set_val(&r.povm_residual, 0.0L, 15); /* lie: claims exact normalization */ + for (int k = 0; k < c->M; k++) { + if (nontrivial) { + long double pk = sh.clock_p[k]; + if (!strcmp(m, "wrong_weight_hidden")) pk = sh.clock_p[k] * ((long double)c->N / (long double)c->M) / ((long double)(long long)c->w.n / (long double)(long long)c->w.d); + set_val(&r.clock_p[k], pk, 15); + } else set_undef(&r.clock_p[k]); + /* label status from the written value, per contract */ + if (!nontrivial) r.label_status[k] = LS_UNDEFINED; + else { + long double tz = (long double)(unsigned long long)c->tol_zero.n; for (int i = 0; i < c->tol_zero.k; i++) tz /= 10.0L; + r.label_status[k] = sh.clock_p[k] - 1e-15L > tz ? LS_DEFINED : sh.clock_p[k] + 1e-15L <= tz ? LS_UNDEFINED : LS_INDETERMINATE; + } + long double pv[3][2], rv[3][2]; + memcpy(pv, sh.pauli[k], sizeof pv); memcpy(rv, sh.reference[k], sizeof rv); + if (!strcmp(m, "axis_swap")) { for (int s = 0; s < 2; s++) { long double t = pv[0][s]; pv[0][s] = pv[1][s]; pv[1][s] = t; } } + if (!strcmp(m, "y_sign_swap")) { long double t = pv[1][0]; pv[1][0] = pv[1][1]; pv[1][1] = t; } + if (!strcmp(m, "conjugate_bug")) { pv[1][0] = 1.0L - pv[1][0]; pv[1][1] = 1.0L - pv[1][1]; } /* -> -; X, Z unchanged */ + if (!strcmp(m, "reversed_reference")) { rv[1][0] = 1.0L - rv[1][0]; rv[1][1] = 1.0L - rv[1][1]; } + if (!strcmp(m, "dephased_state")) { pv[0][0] = pv[0][1] = pv[1][0] = pv[1][1] = 0.5L; } + if (!strcmp(m, "hardcoded_table")) { + static const long double kat[4][3] = { { 1, 0.5L, 0.5L }, { 0.5L, 1, 0.5L }, { 0, 0.5L, 0.5L }, { 0.5L, 0, 0.5L } }; + for (int a = 0; a < 3; a++) { pv[a][0] = kat[k % 4][a]; pv[a][1] = 1.0L - kat[k % 4][a]; } + set_val(&r.clock_p[k], 0.25L, 15); + } + for (int a = 0; a < 3; a++) for (int s = 0; s < 2; s++) { + if (r.label_status[k] == LS_DEFINED) set_val(&r.pauli[k][a][s], pv[a][s], 15); else set_undef(&r.pauli[k][a][s]); + set_val(&r.reference[k][a][s], rv[a][s], 15); + } + } + if (!strcmp(m, "kernel_dim_wrong")) r.kernel_dim += 1; + if (!strcmp(m, "residual_over_bound") && nontrivial) { set_val(&r.constraint_residual, 5e-13L, 15); } + if (!strcmp(m, "nonfinite_hidden") && c->M > 0) { memset(&r.reference[0][2][0], 0, sizeof(rval)); r.reference[0][2][0].is_nonfinite = 1; } + if (!strcmp(m, "label_status_wrong") && c->M > 0 && nontrivial) { r.label_status[0] = LS_UNDEFINED; for (int a = 0; a < 3; a++) for (int s = 0; s < 2; s++) set_undef(&r.pauli[0][a][s]); } + if (!strcmp(m, "label_claimed_defined") && c->M > 0 && nontrivial) { r.label_status[0] = LS_DEFINED; for (int a = 0; a < 3; a++) for (int s = 0; s < 2; s++) set_val(&r.pauli[0][a][s], sh.pauli[0][a][s], 15); } + if (!strcmp(m, "bound_none_nonzero")) r.bound_kind = BK_NONE; + + /* honest verdict from the exact checker on these values */ + rederived d; result_rederive(&r, &d); + memcpy(r.check, d.check, sizeof r.check); + r.outcome = d.outcome; r.n_failure_codes = d.n_failure_codes; memcpy(r.failure_codes, d.failure_codes, sizeof r.failure_codes); + r.expectation_met = d.expectation_met; + snprintf(r.error_code, sizeof r.error_code, "none"); + if (!strcmp(m, "nonfinite_hidden")) { r.check[1] = CK_PASS; r.outcome = OUT_PASS; r.n_failure_codes = 0; r.expectation_met = c->expected_pass ? 0 : 1; } + if (!strcmp(m, "verdict_forged")) { for (int i = 0; i < AT0E_NCHECKS; i++) r.check[i] = CK_PASS; r.outcome = OUT_PASS; r.n_failure_codes = 0; r.expectation_met = c->expected_pass ? 0 : 1; } + if (!strcmp(m, "placeholder_with_values")) { r.outcome = OUT_NOT_RUN; r.expectation_met = 2; r.n_failure_codes = 0; for (int i = 0; i < AT0E_NCHECKS; i++) r.check[i] = CK_NOTEVAL; } + + snprintf(r.source_repo, sizeof r.source_repo, "aien-dev/omega"); + snprintf(r.source_commit, sizeof r.source_commit, "%040d", 0); + r.source_tree_clean = strcmp(m, "dirty_tree") != 0; + snprintf(r.contract_commit, sizeof r.contract_commit, "%s", !strcmp(m, "contract_commit_wrong") ? "27f3b71000000000000000000000000000000000" : AT0E_CONTRACT_COMMIT); + snprintf(r.engine_sha256, 65, "%064d", 1); + snprintf(r.oracle_repo, sizeof r.oracle_repo, "aien-dev/omega"); + snprintf(r.oracle_commit, sizeof r.oracle_commit, "%040d", 0); + snprintf(r.oracle_sha256, 65, "%064d", !strcmp(m, "oracle_is_engine") ? 1 : 2); + snprintf(r.build_cc, sizeof r.build_cc, "SYNTHETIC evaluator self-test fixture, not an engine run"); + snprintf(r.build_flags, sizeof r.build_flags, "none"); + snprintf(r.host, sizeof r.host, "synthetic"); + snprintf(r.run_started, 32, !strcmp(m, "times_reversed") ? "2026-10-09T23:00:01Z" : "2026-10-09T23:00:00Z"); + snprintf(r.run_finished, 32, "2026-10-09T23:00:00Z"); + + long n = result_emit(&r, buf, cap); + if (n < 0) { *why = "buffer"; return -1; } + /* text-level mutations after an honest emission */ + if (!strcmp(m, "evidence_corrupt") || !strcmp(m, "verdict_id_corrupt") || !strcmp(m, "case_id_altered")) { + const char *key = !strcmp(m, "evidence_corrupt") ? "\nevidence_digest " : !strcmp(m, "verdict_id_corrupt") ? "\nverdict_id " : "\ncase_id "; + char *p = strstr(buf, key); if (!p) { *why = "mutation anchor"; return -1; } + p += strlen(key); *p = (*p == '0') ? '1' : '0'; + } + if (!strcmp(m, "tolerance_altered") || !strcmp(m, "binding_rebound")) { + char *p = strstr(buf, "\ntol_schrodinger "); if (!p) { *why = "mutation anchor"; return -1; } + p += strlen("\ntol_schrodinger "); + /* widen the tolerance: replace the first digit with 9 (keeps canonical form) */ + *p = '9'; + if (!strcmp(m, "binding_rebound")) { + /* recompute acceptance_id over the edited block, verdict_id and evidence_digest; leave case_file_sha256 */ + char *bs = strstr(buf, "\nbegin acceptance\n") + 1, *be = strstr(buf, "\nend acceptance\n") + strlen("\nend acceptance\n"); + char id[65]; sha256_tagged_hex(AT0E_ACC_DOMAIN, (const uint8_t *)bs, (size_t)(be - bs), id); + char *ap = strstr(buf, "\nacceptance_id ") + strlen("\nacceptance_id "); memcpy(ap, id, 64); + char *vs = strstr(buf, "\nbegin verdict\n") + 1, *ve = strstr(buf, "\nend verdict\n") + strlen("\nend verdict\n"); + char pre[200]; int pl = snprintf(pre, sizeof pre, "case_id %s\nacceptance_id %s\n", c->case_id, id); + uint8_t *tmp = malloc((size_t)pl + (size_t)(ve - vs)); memcpy(tmp, pre, (size_t)pl); memcpy(tmp + pl, vs, (size_t)(ve - vs)); + sha256_tagged_hex(r.version == 2 ? AT0E_VERDICT_DOMAIN_V2 : AT0E_VERDICT_DOMAIN_V1, tmp, (size_t)pl + (size_t)(ve - vs), id); free(tmp); + char *vp = strstr(buf, "\nverdict_id ") + strlen("\nverdict_id "); memcpy(vp, id, 64); + } + /* evidence digest re-sealed in both variants (the forger re-signs the record) */ + char *ep = strstr(buf, "\nevidence_digest ") + 1; + char id[65]; sha256_tagged_hex(r.version == 2 ? AT0E_EVIDENCE_DOMAIN_V2 : AT0E_EVIDENCE_DOMAIN_V1, (const uint8_t *)buf, (size_t)(ep - buf), id); + memcpy(ep + strlen("evidence_digest "), id, 64); + } + if (!strcmp(m, "crlf")) { + if ((size_t)n * 2 + 1 > cap) { *why = "buffer"; return -1; } + char *tmp = malloc((size_t)n * 2 + 1); size_t o = 0; + for (long i = 0; i < n; i++) { if (buf[i] == '\n') tmp[o++] = '\r'; tmp[o++] = buf[i]; } + memcpy(buf, tmp, o); buf[o] = 0; free(tmp); n = (long)o; + } + if (!strcmp(m, "trailing_space")) { + char *p = strstr(buf, "\nthreads 1\n"); if (!p) { *why = "mutation anchor"; return -1; } + size_t at = (size_t)(p + strlen("\nthreads 1") - buf); + memmove(buf + at + 1, buf + at, (size_t)n - at + 1); buf[at] = ' '; n++; + } + return n; +} diff --git a/research/atemporal/at0/evaluator/src/at0e_text.c b/research/atemporal/at0/evaluator/src/at0e_text.c new file mode 100644 index 000000000..a12fd4781 --- /dev/null +++ b/research/atemporal/at0/evaluator/src/at0e_text.c @@ -0,0 +1,141 @@ +/* Byte rules, tokens and digests for the AT-0 evaluator (AT0_CASE_V1 sections 1, 2, 5). */ +#include "at0e.h" +#include "sha256.h" +#include +#include +#include +#include + +int textfile_from_bytes(const uint8_t *b, size_t len, textfile *tf, const char **why) { + memset(tf, 0, sizeof *tf); + *why = NULL; + if (len == 0) { *why = "empty file"; return 1; } + if (b[len - 1] != '\n') { *why = "last line not LF-terminated"; return 2; } + size_t nl = 0; + for (size_t i = 0; i < len; i++) { + uint8_t c = b[i]; + if (c == '\n') { nl++; continue; } + if (c < 0x20 || c > 0x7e) { *why = c == '\r' ? "CR byte" : c == '\t' ? "tab byte" : "byte outside 0x20..0x7E"; return 3; } + } + tf->bytes = malloc(len); memcpy(tf->bytes, b, len); tf->len = len; + tf->lines = calloc(nl, sizeof(char *)); tf->n = nl; + size_t start = 0, li = 0; + for (size_t i = 0; i < len; i++) { + if (b[i] != '\n') continue; + size_t l = i - start; + if (l == 0) { *why = "blank line"; return 4; } + if (b[start] == ' ' || b[i - 1] == ' ') { *why = "leading or trailing space"; return 5; } + for (size_t j = start + 1; j < i; j++) if (b[j] == ' ' && b[j - 1] == ' ') { *why = "double space"; return 6; } + if (l >= AT0E_MAX_LINE) { *why = "line too long"; return 7; } + tf->lines[li] = malloc(l + 1); memcpy(tf->lines[li], b + start, l); tf->lines[li][l] = 0; + li++; start = i + 1; + } + return 0; +} +int textfile_read(const char *path, textfile *tf, const char **why) { + memset(tf, 0, sizeof *tf); + FILE *f = fopen(path, "rb"); + if (!f) { *why = "cannot open"; return 100; } + uint8_t *buf = NULL; size_t cap = 0, len = 0; + for (;;) { + if (len == cap) { cap = cap ? cap * 2 : 65536; buf = realloc(buf, cap); } + size_t got = fread(buf + len, 1, cap - len, f); + if (got == 0) break; + len += got; + if (len > (1u << 26)) { fclose(f); free(buf); *why = "file too large"; return 101; } + } + fclose(f); + int rc = textfile_from_bytes(buf, len, tf, why); + free(buf); + return rc; +} +void textfile_free(textfile *tf) { + if (tf->lines) { for (size_t i = 0; i < tf->n; i++) free(tf->lines[i]); free(tf->lines); } + free(tf->bytes); + memset(tf, 0, sizeof *tf); +} + +/* Split on single spaces. The byte rules already forbid double/leading/trailing spaces. */ +int split_tokens(const char *line, char **tok, int max) { + static char buf[AT0E_MAX_LINE]; + size_t l = strlen(line); + if (l >= sizeof buf) return -1; + memcpy(buf, line, l + 1); + int n = 0; char *p = buf; + while (*p) { + if (n >= max) return -1; + tok[n++] = p; + char *sp = strchr(p, ' '); + if (!sp) break; + *sp = 0; p = sp + 1; + if (*p == 0) return -1; + } + return n; +} + +static int in(char c, const char *set) { return strchr(set, c) != NULL && c != 0; } +int is_label(const char *s) { + size_t l = strlen(s); + if (l < 1 || l > 32) return 0; + if (!(s[0] >= 'a' && s[0] <= 'z')) return 0; + for (size_t i = 1; i < l; i++) if (!((s[i] >= 'a' && s[i] <= 'z') || (s[i] >= '0' && s[i] <= '9') || s[i] == '_')) return 0; + return 1; +} +int is_name(const char *s) { + size_t l = strlen(s); + if (l < 1 || l > 64) return 0; + if (!((s[0] >= 'A' && s[0] <= 'Z') || (s[0] >= 'a' && s[0] <= 'z') || (s[0] >= '0' && s[0] <= '9'))) return 0; + for (size_t i = 1; i < l; i++) { + char c = s[i]; + if (!((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || in(c, "_.-"))) return 0; + } + return 1; +} +static int is_lhex(const char *s, size_t want) { + if (strlen(s) != want) return 0; + for (size_t i = 0; i < want; i++) if (!((s[i] >= '0' && s[i] <= '9') || (s[i] >= 'a' && s[i] <= 'f'))) return 0; + return 1; +} +int is_digest(const char *s) { return is_lhex(s, 64); } +int is_sha1hex(const char *s) { return is_lhex(s, 40); } +int is_text200(const char *s) { + size_t l = strlen(s); + if (l < 1 || l > 200) return 0; + if (s[0] == ' ' || s[l - 1] == ' ') return 0; + for (size_t i = 0; i < l; i++) if (s[i] < 0x20 || s[i] > 0x7e) return 0; + return 1; +} +int hex_to_u64(const char *s16, uint64_t *out) { + if (!is_lhex(s16, 16)) return 0; + uint64_t v = 0; + for (int i = 0; i < 16; i++) { char c = s16[i]; v = (v << 4) | (uint64_t)(c <= '9' ? c - '0' : c - 'a' + 10); } + *out = v; + return 1; +} + +static void to_hex(const uint8_t d[32], char out[65]) { + static const char *h = "0123456789abcdef"; + for (int i = 0; i < 32; i++) { out[2 * i] = h[d[i] >> 4]; out[2 * i + 1] = h[d[i] & 15]; } + out[64] = 0; +} +void sha256_hex(const uint8_t *data, size_t len, char out[65]) { + uint8_t d[32]; sha256_hash(data, len, d); to_hex(d, out); +} +void sha256_tagged_hex(const char *domain, const uint8_t *data, size_t len, char out[65]) { + sha256_ctx c; uint8_t d[32]; uint8_t z = 0; + sha256_init(&c); + sha256_update(&c, (const uint8_t *)domain, strlen(domain)); + sha256_update(&c, &z, 1); + sha256_update(&c, data, len); + sha256_final(&c, d); + to_hex(d, out); +} + +void findings_add(findings *fs, const char *code, const char *fmt, ...) { + if (fs->n >= 256) return; + finding *f = &fs->f[fs->n++]; + snprintf(f->code, sizeof f->code, "%s", code); + va_list ap; va_start(ap, fmt); + vsnprintf(f->detail, sizeof f->detail, fmt, ap); + va_end(ap); +}