interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / research / atemporal / at1 / oracle / NUMERICAL_ERROR.md

107 lines · 8860 bytes Raw Blame History Rendered
1# Numerical error documentation for the AT-1 reference oracle
2
3Every record this oracle writes says `arithmetic BINARY64`, `bound_kind ESTIMATED`,
4`threads 1`. ESTIMATED means the bounds below are first-order estimates backed by the
5accounting and the measurements here. They are not proven enclosures. A RIGOROUS claim would
6need directed-rounding interval arithmetic with enclosed `cos` and `sin` (AT1_SPEC section
78.4 item 6). Rust's standard library does not provide that and this oracle pulls in nothing
8else, so it never claims it. A case that demands `min_bound_kind RIGOROUS` therefore fails
9`bound_kind_sufficient` here by design (fixture `at1-n5-rigorous-demand`).
10
11`U` below is `2^-53`, the unit roundoff of binary64 (half an ulp at 1).
12
13## What is exact
14
15- Every validity decision, both identities, the per-level spectrum test `|h + v_j|^2` a
16 rational square, the kernel pairs `E_j + h0 + s R_j = 0`, the degenerate-matched level,
17 the kernel dimension, the level eigenvectors `f`, the projected components
18 `u_j = f (f^dagger psi_0) / ||f||^2` and `S = sum_j ||u_j||^2`: arbitrary-precision
19 rationals and Gaussian rationals (`src/at1/big.rs`), no float involved.
20- Every phase: the turn count `E_j (k - r) tau` (and `2 |h| (k - r) tau` when `|h|` is
21 rational) is reduced modulo 1 exactly, split into the nearest eighth turn and a remainder
22 in `[-1/16, 1/16]`; quarter turns are exact (AT1_SPEC section 8.4 item 1).
23- Every acceptance check: decided on the written `f64:` tokens converted exactly to
24 rationals, against the exact scaled-decimal tolerances and bounds. The judge never compares
25 floats.
26- Input conversion: every exact rational is converted to binary64 once, correctly rounded
27 (round half to even on the exact quotient), so each input carries at most `U` relative
28 error. A unit test checks the rounding against values with known bit patterns.
29
30## Per-operation accounting (standard rounding model, first order)
31
32| Ingredient | Error | Where |
33|---|---|---|
34| one phase value `cis_turns` (modulus 1) | `CIS_ERR = 8 U` absolute: remainder conversion and `2 pi r` (3 U relative on an angle of at most `pi/8`), `cos` and `sin` at most one ulp each, the binary64 `sqrt(1/2)` of odd eighths, one complex product (`sqrt(5) U`); about 7 U | `src/at1/model.rs` |
35| clock state entry `t_j = cis / sqrt(N)` | `(CIS_ERR + 3) U` relative | matrix route |
36| `x_j = t_j psi_0` | `(CIS_ERR + 7) U \|\|x_j\|\|` | matrix route |
37| kernel block of `P_0` | `b b^dagger` with `b` a converted, normalized eigenvector: about `13.3 U` per entry, Frobenius norm 1; a degenerate-matched block is the exact identity | matrix route |
38| `Psi_j = P_0 x` on one block | `\|\|dPsi_j\|\| <= (CIS_ERR + 28) U \|\|x_j\|\|`, `\|\|x_j\|\| = \|\|psi_0\|\| / sqrt(N)`; blocks outside the kernel are exact zeros | matrix route |
39| `H_total` block entries | each 2 x 2 diagonal block `(E_j + h0) I + n_j . sigma`, `n_j = h + v_j`, is formed in exact rationals and converted once: `U` relative per entry, so a large `h` cancelling a large `v_j` costs nothing | matrix route |
40| `phi_k = sum_j conj(t_j) Psi_j` | compensated (Neumaier) sum: `\|\|dphi\|\| <= sum_j \|\|dPsi_j\|\| / sqrt(N) + (CIS_ERR + 8) U sum_j \|\|Psi_j\|\| / sqrt(N)` (triangle inequality on `(\|Psi_j0\|, \|Psi_j1\|)`; the sum error no longer grows with `N`) | matrix route |
41| POVM entry `(a, b)` | `sum_k (w / N) cis(-(E_a - E_b) k tau)`, one exact turn count per term, compensated over the `M` terms: `(CIS_ERR + 4) U w M / N` | matrix route |
42| `chi_k = sum_j cis(E_j (k - r) tau) u_j` | compensated sum: `\|\|dchi\|\| <= (CIS_ERR + 6) U sum_j \|\|u_j\|\|` (conversion `U`, phase, product `sqrt(5) U`, compensation `2 U`) | closed form |
43
44## Stated bounds
45
46`SAFETY = 2` multiplies every estimate. The operation counts above are worst-case sums of
47absolute values, so the factor only covers second-order terms and a platform `cos`/`sin`
48that misses its ulp.
49
50| Quantity | Route | Stated absolute bound |
51|---|---|---|
52| `constraint_residual` | matrix | `SAFETY gmax (dPsi / \|\|Psi\|\| + 8 U)`, `dPsi = (CIS_ERR + 28) U K \|\|psi_0\|\| / sqrt(N)` over the `K` kernel levels, `gmax = max 2 R_j` over the levels that carry a kernel pair (the norm of `H_total` on the blocks where `Psi` lives; a degenerate-matched block is an exact zero): the exact `Psi` has `H_total Psi = 0` |
53| `povm_residual` | matrix | `SAFETY ((CIS_ERR + 4) U w M + 8 U value)` |
54| `clock_probability k` | matrix | `SAFETY (w (2 \|\|phi_k\|\| dphi + dphi^2) / \|\|Psi\|\|^2 + p (2 dPsi / \|\|Psi\|\| + (4N + 12) U))` |
55| `reference_clock_probability k` | closed form | `SAFETY (w (2 \|\|chi_k\|\| dchi + dchi^2) / (N S) + 16 U p)` |
56| each `pauli` and `reference_interacting` value | matrix / closed form | with `a = asin(rel)`, `rel = dphi / \|\|phi_k\|\|` (or `dchi / \|\|chi_k\|\|`): `SAFETY (2 sqrt(P (1 - P)) a + 3 a^2 + 16 U)` |
57| each `reference_ideal` value | Bloch rotation | `SAFETY (64 U + angle error)`; the angle error is 0 when `|h|` is rational (exact turn reduction) and `2 pi 8 U |2 |h| (k - r) tau|` otherwise |
58
59The Pauli bound is per value. The ray of `phi + dphi` lies within the angle `a = asin(rel)`
60of the ray of `phi`. `P = cos^2(beta)` has `|dP / dbeta| = 2 sqrt(P (1 - P))` and
61`|d^2P / dbeta^2| <= 2`, so `|dP| <= 2 sqrt(P (1 - P)) a + a^2`. Evaluating `sqrt(P (1 - P))`
62at the computed `P` moves it by at most `a`, which gives `2 s a + 3 a^2`. This is the
63Cauchy-Schwarz sharpening of AT1_SPEC section 8.4 item 4 (`2 ||Delta chi|| / ||chi||`); it
64gives exact zeros and ones (a state orthogonal to an eigenvector) the second-order bound
65they actually have.
66
67Bounds are written as scaled decimals at the twentieth decimal place, rounded up and then
68increased by one further unit (`bound_token`), so the written bound is never smaller than
69the float estimate. The rounding is exact big-integer arithmetic on the exact binary value of the
70estimate, with no upper clip; a non-finite estimate is written as the largest binary64. A unit test checks this on exact rationals.
71
72## Measured (fixtures, rustc 1.98.1 and 1.97.1, aarch64-unknown-linux-gnu, glibc libm)
73
74| Measurement | Value | Where |
75|---|---|---|
76| Values compared with the exact AT1_SPEC section 13 tables, 21 cases | 1577 | `fixtures/CALIBRATION.md` |
77| Largest deviation, matrix route (the record's own values) | `6.7e-16` (P3b, N1c) | same |
78| Largest deviation, closed form (`reference_clock_probability`, `reference_interacting`) | `2.2e-16` | same |
79| Largest deviation, Bloch rotation (`reference_ideal`) | `2.2e-16` (N4b, phases not quarter turns) | same |
80| Values whose actual error exceeds the written bound | 0 | same |
81| Largest written bound on any compared value | `1.1e-13` (P3b, label `p(2) = 1/80`) | same |
82| `constraint_residual`, nontrivial kernels | `0` (P1, P1c, N3) to `9.5e-17`, P6 included (`delta_min = 2^-20`) | `*.values` |
83| `povm_residual`, complete clocks | `0` on every one | `*.values` |
84| `povm_residual`, N4a and N4b | `1` and `1.620185174601965` (`sqrt(42) / 4`) | `*.values` |
85| Fixture bytes, rustc 1.97.1 build versus rustc 1.98.1 build | identical (`diff -r`) | both builds |
86| Review case: `h_z = 1048573/15` cancelling `v_z = -1048567/15` (before the exact blocks the residual was `8.7e-12` against a bound of `2.6e-14`, reviewer measurement) | residual `6.8e-17`, bound `1.8e-14` | test `review_finding_1_...` |
87| Review cases: `N = M = 64` and `N = 64, M = 256, w = 1/4` (before, `N = M = 64` turned INDETERMINATE, reviewer measurement) | constraint and POVM residuals `0`, POVM bound `1.7e-13`, constraint bound `1.8e-14`, PASS | test `review_finding_2_large_clocks` |
88
89Observed errors sit two to three orders of magnitude below the stated bounds, and the
90largest bound sits an order of magnitude below the tolerances `1e-12` of AT1_SPEC section
918.3.
92
93## Limits
94
95- Bounds grow like `1 / sqrt(p(k))` (AT1_SPEC section 8.4 item 4) and like
96 `||psi_0|| / ||Psi||` on the matrix route. AT1_SPEC section 8.3 rule (b) keeps
97 `p(k) >= 10^-3`; at that floor, on a case where the projection keeps only a small part of
98 `psi_0`, the oracle's own verdict can turn INDETERMINATE (`PRECISION_INSUFFICIENT`) where
99 a tighter engine would PASS. No section 13 case comes near this.
100- The irrational-`|h|` angle error of `reference_ideal` is an estimate (AT1_SPEC section 8.4
101 item 2 states it as a hypothesis); no section 13 case has an irrational `|h|`.
102- Largest sizes the contract allows (`N = 64`, `M = 256`) are covered by the review cases
103 above; the POVM bound grows like `w M` (`N` on a complete clock), still `1.7e-13` there.
104- The Neumaier sums carry a second-order term of order `n U^2` for `n` terms, negligible for
105 `n <= 256`, the largest sum here.
106- `cos` and `sin` come from the platform libm; the accounting assumes at most one ulp each.
107 Nothing here was measured on macOS.