# Independent residual audit — Reality Bit Engine 0.10.0

## Outcome

The D0 representation now has an independent verification companion. The
important advance is not a novel physical law: it is a stronger distinction
between certified constraint satisfaction, numerical approximation, injected
faults, and constraints that have no solution.

| Laboratory | New check | Result in the frozen run |
|---|---|---|
| Riemann | Outward-rounded integer bounds, including infinite-series tails | 4,101 listed integers certified: every n from 1 to 4,096 plus five larger cases |
| SAT | Separate Python enumeration compared with the C++ histogram | All 4,096 assignments agree; minimum cost 1, 60 minimizers |
| Navier–Stokes | Finite differences of C++ field exports, coefficient faults, untouched holdouts | Injected faults detected and corrected within the declared two-parameter family |

The full C++ regression run passed **1,745,812 assertions** across eleven
suites. The changed prize module passed **6,070 assertions** with
AddressSanitizer and UndefinedBehaviorSanitizer. Twelve Python test methods
passed; their checks include independent high-precision Decimal cross-checks,
rounding, ambiguity, inconsistent constraints, and ill-conditioning.
Windows build instructions remain supplied, but this release was executed on
Linux, not validated on a Windows compiler.

All three Millennium problems remain unsolved. See the
[Clay problem list](https://www.claymath.org/millennium-problems/).
The finite RH calculation uses
[Lagarias's equivalent criterion](https://arxiv.org/abs/math/0008177).

## D0 is constraint satisfaction, not compulsory equality

For an equality F(x)=0, use defect |F(x)|. For an inequality a<=b, use
defect max(0,a-b). Their zero sets are the respective solution sets:

$$
V_{\mathrm{eq}}(x)=|F(x)|,\qquad
V_{\mathrm{ineq}}(a,b)=\max(0,a-b).
$$

The signed coordinate (a-b)/(a+b) can be negative while the inequality is
perfectly satisfied. Forcing that coordinate to zero would replace the
inequality with a different problem.

The normalized coordinate also discards common scale:

$$
\frac{1-2}{1+2}=\frac{1000-2000}{1000+2000}.
$$

It is an oriented comparison, not a universal metric measuring distance to
the unknown solution.

Four outcomes must remain distinct:

1. Certified satisfaction: exact arithmetic or a proved interval contains only
   permitted values.
2. Certified violation: the complete proved interval lies outside the
   permitted region.
3. Unresolved precision: the interval crosses the decision boundary.
4. Inconsistent constraints or model mismatch: candidates cannot meet the
   declared conditions; this does not establish an arithmetic bug.

For example, x=0 and x=1 cannot hold simultaneously. The SAT contradiction in
this release is a less trivial instance of the same distinction.

## 1. Rigorous finite Riemann checks

This companion uses Python arbitrary-width integers, with default scale
S=2^128. A pair [L,U] represents a proved enclosure [L/S,U/S].
Addition and multiplication round outward, never to the nearest endpoint.

For the harmonic numbers,

$$
\sum_{j=1}^{n}\lfloor S/j\rfloor
\le SH_n\le
\sum_{j=1}^{n}\lceil S/j\rceil.
$$

For x>=0, the exponential uses m=96 terms beyond its constant term. The
first omitted term t_(m+1), with later ratios bounded by x/(m+2), gives

$$
\sum_{j=0}^{m}\frac{x^j}{j!}
\le e^x\le
\sum_{j=0}^{m}\frac{x^j}{j!}
+\frac{x^{m+1}}{(m+1)!}\frac1{1-x/(m+2)}
$$

when x<m+2. The implementation also bounds every arithmetic rounding step.

For x>=1, put z=(x-1)/(x+1). Then

$$
L_m=2\sum_{j=0}^{m-1}\frac{z^{2j+1}}{2j+1},
\qquad
L_m\le\log x\le
L_m+\frac{2z^{2m+1}}{(2m+1)(1-z^2)}.
$$

All terms and remainders are nonnegative. Monotonicity therefore permits
the lower harmonic endpoint for lower bounds and the upper endpoint for
upper bounds. Nonnegative interval multiplication bounds
H_n+exp(H_n)log(H_n). Divisor sums are calculated independently by divisor
pairs through floor(sqrt(n)).

Certified domain:

- the complete prefix 1 <= n <= 4,096;
- n in {5,040, 55,440, 720,720, 4,324,320, 5,000,000}.

This is **4,101 finite interval certificates, not five million certificates**.
The old five-million-case scan is still a floating calculation. Neither
computation supplies a theorem for all integers.

An injected corruption changes sigma(12) from 28 to 29. The interval checker
certifies that this corrupted inequality is violated. A deliberately
under-resolved two-term calculation returns UNRESOLVED_PRECISION, not success.

The JSON stores all wide integer ticks as decimal strings, to prevent
binary64-only JSON readers from silently rounding them. The certificate rests
on the interval derivation and exact arithmetic, not on its checksum. It has
not been checked by a separate formal proof assistant.

## 2. Independent SAT check

The Python companion builds and enumerates the 12-variable pigeonhole formula
independently of the C++ implementation, then compares every occupied
histogram bucket.

The earliest nearest assignment is integer 84 (variable 1 is the least
significant bit). Its violated clause is [10,11,12]: the fourth pigeon has
no hole. All 4,096 assignments have at least one violation. An injected
"distance <= 1 means SAT" rule is therefore rejected.

The three-pigeons/three-holes satisfiable control succeeds. This guards
against a checker that simply declares every formula inconsistent.

This is still finite enumeration, with exponential scaling. Rewriting clause
violations as coordinates has not established a polynomial algorithm or a
lower bound on every algorithm.

## 3. Independent 3D residual and fault diagnosis

The C++ abc-probe command exports only u,v,w,p. The companion never reads
the engine's analytic derivative or residual values.

At 64 seeded spacetime points, centered differences approximate derivatives:

$$
D_hf(x)=\frac{f(x+h)-f(x-h)}{2h},\quad
\Delta_hf=\sum_i\frac{f(x+he_i)-2f(x)+f(x-he_i)}{h^2}.
$$

The initial 24 points fit parameters; the remaining 40 are held out.
The seed, split, step sizes (0.02,0.01,0.005), mutations, and thresholds are
fixed in source before outputs are observed.

Synthetic ground truth: nu=0.01, A=1, B=1.3, C=-0.7, k=2.
The audit uses nondimensional coordinates and fields; using the same numeric
h for space and time is a convention in these scaled coordinates.
The faults multiply pressure by 1.125 and use an assumed viscosity of 0.008.
Training-only QR least squares fits alpha and nu in

$$
\partial_tu+(u\cdot\nabla)u+\alpha\nabla p_{\mathrm{bad}}
-\nu\Delta u=0.
$$

At h=0.005:

| Quantity | Measured value |
|---|---:|
| Clean held-out momentum RMS | 5.461763620235808e-7 |
| Faulty held-out momentum RMS | 0.2851021506648123 |
| Repaired held-out momentum RMS | 1.5527374248896825e-13 |
| Fitted pressure correction | 0.8888888888888892 |
| Fitted viscosity | 0.01000008340041921 |

These RMS values combine only the nondimensional momentum components;
divergence is retained separately. They are not global physical
error bounds.

**The near-zero repaired residual does not mean exact parameter recovery.**
The viscosity is biased by 8.340041921e-8. Both the clean residual and that
bias shrink by approximately four when h is halved.

For this particular eigenflow, the discretized decay and Laplacian even
explain the fitted effective viscosity:

$$
\nu_h=\frac{h\sinh(\nu k^2h)}{4\sin^2(kh/2)}
=\nu+O(h^2).
$$

Consequently, a solver can nearly eliminate its discrete residual by absorbing
discretization error into a parameter. Step refinement is essential.
This is an analysis of a known eigenflow, not a new regularity theorem.

Negative controls:

- Corrupting all held-out transport values by +100 leaves fitted parameters
  unchanged and raises the holdout RMS to approximately 173.205.
- Adding a divergence-free extra component 0.05 sin(3x) to the exported w
  field, without consistent pressure/evolution, leaves a held-out residual
  about 0.113499 after fitting. The two-parameter model is insufficient.
- A rank-deficient parameter fit is rejected rather than assigned a unique
  cause.

For stable first-order identification in a nonlinear residual map R(theta),
the linearized fit requires enough independent measurements for its Jacobian to have full
column rank, as well as adequate conditioning. A scalar norm alone cannot
identify the cause: (1,0) and (0,1) have the same norm.

More fundamentally, a small residual need not imply a nearby solution:

$$
F(x)=10^{-12}x,\quad x=10^6
\quad\Rightarrow\quad |F(x)|=10^{-6},
\quad \mathrm{dist}(x,\{0\})=10^6.
$$

A residual-to-solution conclusion requires a separately justified stability
estimate, for example dist(x,S)<=C||R(x)|| with controlled C.

## 4. Implementation repairs

- Reject nonfinite ABC energy inputs.
- Reject unsupported decay/energy underflow and overflow instead of treating
  numerical zeros as exact satisfaction.
- Freeze the first actual sample even for an identically zero flow.
- Include all ABC family parameters and signed residual components in the
  fingerprint; it remains a fingerprint, not a proof.
- Export field-only probe rows for independent differentiation and reject
  malformed input.
- Compile shared C++ modules once in build.sh, reducing shared-source
  compilations per full build from 132 to 11. The Windows script is unchanged.

## Reproduce and freeze

Linux/macOS:

    sh build.sh
    python3 -m unittest discover -s tests -p 'test_residual_audit.py'
    python3 tools/residual_audit.py --engine build/reality-bit-engine --output results/my-audit.json

Windows, after build.bat in a configured compiler prompt:

    py -3 -m unittest discover -s tests -p "test_residual_audit.py"
    py -3 tools\residual_audit.py --engine build\reality-bit-engine.exe --output results\my-audit.json

The optional audit companion requires Python 3.10+ with only the standard
library. Core engine compilation remains C++17-only.

The shipped results/residual-audit-v010.json freezes all exact RH interval
endpoints, SAT witness/histogram, individual fluid residual coordinates at
each step size, model-mismatch controls, executable/source SHA-256 identities,
and runtime information. It uses synthetic fluid data; it does not contain
new physical measurements or a Millennium solution.
