Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
167 changes: 167 additions & 0 deletions research/euclidean-orthogonal-detector/PROOF.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
# A Euclidean guard for complete orthogonal register programs

This contribution was produced by Nick Petalas. Apache-2.0.

This is a scoped written proof. The finite checker corroborates its identities
and implementation; it is not a formal proof-kernel certificate.

## Exact boundary

There are finitely many independent real registers, each in R^d. All registers
are returned. Instructions are:

- `apply`: replace a register by O or O^T applied to its old value;
- `query`: add c O or c O^T applied to an old source to an old destination;
- `linear`: replace a register by a finite rational linear combination of old
registers, including repeated occurrences and its own old value.

Each named O is exactly orthogonal. Queries may alias source and destination.
The two program sides receive the same exact initial bank, whose register
Euclidean norms are at most R>=1. Initial coordinates belong to the working
grid h Z, h=2^-p. The special basis input of PR5339 satisfies this condition
for every p. Arbitrary nongrid inputs need their own input-error term.

Truncate every forward matrix entry toward zero to h Z. The stored inverse
is the transpose of this table. At each instruction form the complete new
destination using old register values and exact rational scalar arithmetic,
then truncate each of its coordinates toward zero once to h Z. Other
registers retain their values. These are the numerical semantics of Ali
Romman's [PR5339](https://github.com/CrocSwap/integer-mult-bounds/pull/5339),
now bounded with a different bank norm. Rounded matrices need not be
orthogonal; the proof explicitly charges their perturbation.

## Per-instruction constants

Use the bank norm ||x||=max_j ||x_j||_2. Let s=ceil(sqrt(d)). Set

| Instruction | beta | gamma |
| --- | --- | --- |
| linear with coefficients c_j | max(1, sum_j abs(c_j)) | 0 |
| apply | 1 | d |
| query with coefficient c | 1+abs(c) | d abs(c) |

The exact bank operator has norm at most beta. Each entry error is less
than h, so the matrix perturbation has Frobenius, and hence operator, norm
at most d h. Transposition preserves this bound. The rounded bank operator
therefore has norm at most beta+gamma h and differs from the exact one by
at most gamma h. These inequalities hold on alias because both summands
use the same old source. A linear assignment sums repeated old values.
Unchanged registers explain the harmless maximum with one.

The final coordinate truncations produce a bank residual of norm at most
sqrt(d) h <= s h. This residual is charged for every instruction, even
when the actual arithmetic is exact on the grid.

## Whole-side error bound

For one side of length m, define

G_i = product_(j<=i) beta_j, G=G_m,
A = sum_i gamma_i/beta_i,
K = G (R A + s m).

Empty products are one and empty sums are zero. Exact prefix magnitudes are
at most R G_i. If E_i is the bank error after instruction i, then

E_i <= (beta_i+gamma_i h) E_(i-1)
+ gamma_i h R G_(i-1) + s h. (1)

This compares the two maps on the exact input and applies the rounded map
to the previous error. It does not assume the approximate bank stays below
the exact bank's magnitude envelope.

For nonnegative a_i=gamma_i/beta_i and h A<1,

product_i (1+h a_i) <= 1/(1-h A). (2)

Indeed the coefficient of h^k in the finite product is at most A^k, so the
product is bounded by the geometric series. The same bound applies to
every suffix. Unrolling (1) and dividing a suffix product by G_i gives

E_m <= h G/(1-h A)
[R sum_i gamma_i/beta_i + s sum_i 1/G_i]
<= h K/(1-h A). (3)

The last inequality uses beta_i>=1, hence G_i>=1. Equation (3) is zero
for an empty side. If h A<=1/2, it gives E_m<=2h K. It also bounds every
prefix using that prefix's own G,A,K.

For the two sides let A_max=max(A_left,A_right) and K_total=K_left+K_right.
Every coordinate of their returned difference has error at most

2 K_total h,

provided h A_max<=1/2. Both sides' errors and every returned role are
included. No factor of the number of registers occurs in this bank norm.

## A funded exact endpoint decision

Assume a positive rational eta such that a selected exact endpoint f either
vanishes or has abs(f)>=eta. It suffices to choose integer p>=0 with

2^p >= max(1, 2 A_max, 8 K_total/eta). (4)

Then the returned difference f_hat has abs(f_hat-f)<=eta/4. Consequently
abs(f_hat)>eta/2 decides f!=0. A zero at one tuple is not a universal
program-identity certificate.

For the rational Cayley path parameter t=A0/B in lowest terms, 0<t<=1/4,
dimension d, and q named calls across both sides, PR5339 supplies the cited
separator

eta = 1/[C (3B)^(dq)],

where C is the product of every scalar coefficient denominator occurrence.
This separator and its source proof are premises here; their mathematical
verification is not this contribution. No refined matrix-denominator or
program-cancellation result is used.

The allocator uses this coarse separator for the source basis input or an
integer initial bank. Integer linear combinations of the same input columns
retain its common denominator. A noninteger grid input requires its input
denominator in the separator as well; the allocator supplies no such
extension. The error theorem (1)-(4), with a separately justified eta,
still applies to exact grid inputs under its stated radius contract.

For apply-only programs, G=1, A=d m, and K=m(Rd+s). At R=1 the new rounding
factor is linear in m and d. The older guard uses the product d^q as a
coordinate-norm gain, although its operators are exactly orthogonal.
For one side with d=4, q=m=12, B=4 and no scalar coefficients, the same
coarse eta gives 182 bits by (4), versus 228 by the old sufficient guard.
These are sufficient bounds, not minimum precisions. No universal strict
improvement over the old guard is asserted for arbitrary scalar programs.

## Arithmetic work and limitations

The new allocator uses rational products and sums over the explicit program.
Its coefficients and precision requirement have polynomial binary size in
the program, scalar, parameter and dimension input sizes. After the path
and rational matrices are supplied, the literal integer-grid replay still
uses q d^2 matrix-entry products and m d coordinate truncations, plus all
scalar linear combinations, parsing, preparation and returned-bank work.
This result reduces a sufficient data precision. It supplies no wall-clock
speedup, cheaper native invocation or full tape invoice.

Orthogonality is an essential premise. General approximately unitary or
nonorthogonal generators need their own exact gains. Nongrid inputs, complex
coordinate rounding, floating hardware, and repeated use of a stored inverse
as an exact undo are outside this stated implementation. Dirty values are
covered within the radius and grid contract; the detector does not erase or
restore them by fiat. Native compatibility, physical allocation, compiler,
stock, selected precision/tape policy and analytic recovery remain separate.

## Credit and relation to prior work

Ali Romman / PR5339 supplies the complete numerical detector, coarse
separator and open optimization question. His PR5315 supplies the rational
orthogonal witness. Krzysztof Wojt / PR5262 supplies the complete inverse
grammar and shortest-word compiler; zxv / PR5235 and the retained
dirty-echo/tensor/phase lineage keep their credit. Nick Petalas / PR5941
changes the separation lattice through exact matrix denominators. This
proof holds that lattice bound fixed and changes error amplification. It
does not pursue PR5941's cancellation or native-binding questions.

Euclidean orthogonal invariance, Frobenius domination and forward-error
propagation are classical. The new result is the explicit complete-grammar
guard (3)-(4), its allocator, and the strictly smaller sufficient grid for
the specified literal consumer. No general literature priority is claimed.
155 changes: 155 additions & 0 deletions research/euclidean-orthogonal-detector/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
# A smaller Euclidean guard for complete orthogonal-witness detection

This contribution was produced by Nick Petalas. Apache-2.0.

Scoped written proof with exact finite corroboration; no new kappa. A new
whole-bank Euclidean error bound reduces the sufficient fractional grid of
one literal four-dimensional, twelve-call detector from **228 to 182 bits**.
The same coarse endpoint separator is used in both bounds. The new result
changes accumulated rounding amplification, without using a refined matrix
or program denominator.

For a side of m instructions, define its exact norm gains beta_i, entry
perturbation constants gamma_i, input radius R>=1, and

```text
s = ceil(sqrt(d))
G = product beta_i
A = sum gamma_i/beta_i
K = G (R A + s m)
```

Each exact orthogonal apply has beta=1. Aliased queries and arbitrary rational
scalar assignments have the fully charged bounds in [PROOF.md](PROOF.md).
At grid h=2^-p with hA<1, the complete side's register error is at most
`h K/(1-h A)`. For two sides it suffices to choose

```text
2^p >= max(1, 2 max(A_left,A_right), 8 (K_left+K_right)/eta)
```

to obtain endpoint error at most eta/4 and an exact zero/nonzero decision
under the credited separation premise. For apply-only words, K is linear
in the number of calls and dimension. No minimum-precision claim or strict
improvement for every scalar program is made.

## Evidence and reproduction

From the repository root with the CPython 3.12 standard library:

```sh
/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -I -W error -B research/euclidean-orthogonal-detector/verify.py
/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -I -O -W error -B research/euclidean-orthogonal-detector/verify.py
/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -B scripts/research_package.py --package research/euclidean-orthogonal-detector
/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -B scripts/check_research_commit.py --package research/euclidean-orthogonal-detector --check-source-history
```

Another CPython 3.12 executable can replace the displayed local path. The
standalone marker is `PASS_EUCLIDEAN_ORTHOGONAL_DETECTOR`; the registered
launcher also prints `PASS_REGISTERED_RESEARCH_PACKAGE`. Normal and optimized
warning-strict commands are registered with 120-second caps. The direct
verifier writes nothing and emits a generated JSON receipt binding all eight
package files. Redirect it outside the checkout to retain the receipt.

The exact finite evidence includes:

- 1,218 complete program/input cases over dimensions two through seven and
Cayley parameters 1/4 and 1/7. Seven program-pair patterns include
noncommuting order changes, restored inverse words, aliased queries,
repeated scalar sources, zero coefficients, empty sides and scalar gains
and denominators as large as 2^40. There are 84 mixed dirty input cases;
the other cases enumerate every independent input column.
- 9,048 intermediate returned banks, comprising 138,528 scalar coordinates,
checked against their own prefix Euclidean envelopes. Every final
coordinate also has its difference error and selected threshold decision
checked against a separate rational interpreter.
- A nonzero four-dimensional, twelve-call fixture executed at both 228 and
182 bits, with the same eta=12^-48. Its exact selected endpoint is
`33658561053084102656/87507831740087890625`. The new bound fails its
sufficient inequality at 181 bits; this does not prove 182 is necessary.
- 240 finite product inequalities, 256 precision-rounding cases, fourteen
invalid-input controls and four semantic controls. The latter detect
omitted coefficient quantization, a wrong inverse table, use of updated
values in an aliased query, and one fewer bit in the stated sufficient
guard.

The universal statement rests on the written proof. These finite executions
corroborate it and the new implementation. No predecessor scientific program,
receipt or census is imported or replayed.

## Source, scope and credit

Canonical base is `7c49fe32c55de02c2c873655c804b16e4c3fef0a`, priority revision
8, selected PR6030. The selected binding-only baseline passed. [TASK.json](TASK.json)
records the explicit change from `formal-interface-lemma` to a quantitative
written precision-interface proof. [SOURCES.json](SOURCES.json) pins historical
provenance; there are no external runtime inputs or pending Git dependencies.
The [advance CLAIM](https://github.com/CrocSwap/integer-mult-bounds/discussions/1166#discussioncomment-19363345)
reserves this accumulated-error question. Discovery stopped at the first
verified strict grid improvement.

Credit Ali Romman / [PR5339](https://github.com/CrocSwap/integer-mult-bounds/pull/5339)
for the complete detector, coarse separator and open optimization question,
and [PR5315](https://github.com/CrocSwap/integer-mult-bounds/pull/5315) for the
orthogonal realization. Krzysztof Wojt / PR5262 supplies the inverse grammar
and witness compiler; zxv / PR5235 and the retained dirty-echo/tensor/phase
lineage keep their credit. Nick Petalas / PR5941 concerns exact matrix
separation denominators, a different step held fixed here. Euclidean
orthogonal invariance, Frobenius domination and forward-error propagation
are classical. No global literature priority is claimed.

Live open/account PRs, active Discussions, recent handoffs, main README
searches, merged general-form searches and local reservations were checked.
Cached overlap scanning has sparse historical-note coverage; unpublished work
and arbitrary historical diffs remain limits. These are bounded overlap
checks, not a guarantee of novelty.

## Limits and implementation bounds

The error theorem assumes exact real orthogonality, old-value instructions,
exact rational scalar arithmetic and once-per-output coordinate truncation.
Initial data must be exactly on the working grid and have the stated norm
radius. The allocator's coarse separation bound is for integer initial banks
and matching Cayley matrices. Nongrid input errors and noninteger-input
separation need separate treatment. Orthogonality and these caller premises
are essential; stored rounded matrices need not be orthogonal.

A zero at one selected endpoint is not a universal identity certificate.
The 46-bit reduction is a sufficient precision improvement, not a runtime,
optimality, native-call or exponent improvement. Matrix preparation, scalar
arithmetic, movement, ownership/restoration, stock, compiler, actual selected
precision/tape use and analytic recovery remain separate obligations. No
selected scientific replay, native suite, Lean or Docker build was run.
Independent human and formal proof-kernel review are unclaimed. The five
selected framework assumptions and selected frontier retain their status.

Build the Lever led to the explicit rational allocator and standalone replay.
Prove It Works led to complete intermediate-bank checks and literal execution
at the smaller grid. Power of Ten inspection found no recursion, subprocess,
network, dynamic evaluation or background work. Functions fit within 60 lines.
Allocation validates at most sixteen dimensions, four roles, three operators,
64 instructions per side, eight terms per scalar row, and 128-bit scalar
numerators and denominators. The fixed verifier uses dimensions at most seven,
three roles and at most 24 instructions on a side. Source-hash reads are
capped at 256 KiB per file. Exact exceptions survive optimized Python.

Power of Ten rule 3 deviation: CPython allocates managed rational and integer
objects during the bounded offline calculation. Fixed domains, explicit API
capacities and 8-by-256-KiB source capacity bound live state; runtime allocation
itself is not instrumented. A fixed-storage runtime would be required before
claiming that property. Rule 9 deviation: local `map` calls have only the
visible built-in or rational constructor targets and finite collections.
Rule 10 diagnostics are warning-strict normal/optimized execution and in-memory
AST compilation. No separate static analyzer or proof assistant is claimed.
Widening the stated capacities requires a new resource assessment.

## Open next questions

- Can one native-compatible orthogonal witness use this guard with a fully
charged caller? Pin its actual operators, input grid and radius, then count
preparation, arithmetic, movement and restoration. Native source binding
and a complete physical bill are missing.
- Can exact instruction norms reduce a scalar-heavy guard further? Start
with one fixed linear or aliased-query instruction and retain matrix
quantization and data truncation. No optimal-norm or least-precision theorem
is supplied. Structured relevance and blockers are in TASK.json.
36 changes: 36 additions & 0 deletions research/euclidean-orthogonal-detector/SOURCES.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"schema_version": 1,
"base_commit": "7c49fe32c55de02c2c873655c804b16e4c3fef0a",
"files": [
{
"path": "certificates/selected-result.json",
"usage": "provenance",
"git_blob": "d59b5035e7b4cbaa9d688a1d32dd0d6eb79c466a",
"sha256": "9b8d0eea95b3bf0dfcb7938a732a6439b87a2685dec2a5ab9e525b3b34debbfa"
},
{
"path": "docs/research/agent-task-catalog.json",
"usage": "provenance",
"git_blob": "3404fbdd5e7529a0674eef26114b5071e4586cec",
"sha256": "ead6cdc9d0af6d58e8a49744d8ec8c7c15e13d2ba93c276c434bcf9b51b93a81"
},
{
"path": "research/orthogonal-witness-precision/PROOF.md",
"usage": "provenance",
"git_blob": "36d4c06875c7346e437227a4206f0eb474c53e76",
"sha256": "762ef04f95edc3a55347d5f58a166cde77a100e9331326e180cffa9eef88eaaa"
},
{
"path": "research/orthogonal-witness-precision/README.md",
"usage": "provenance",
"git_blob": "0bd504969b70f7eb97f74b7bd84754adb2b18e08",
"sha256": "e41efda1fc15fcaf188359578c60fb24ce57068c56f08fc510cc44695d7534b4"
},
{
"path": "research/orthogonal-witness-precision/detector.py",
"usage": "provenance",
"git_blob": "1c7d7d8f7212dacc771f60263fca3120fe3fa8f6",
"sha256": "986637ef31cdf46976d466e25b58b2cc2de7fb60939bda1b4693e72541b3c7af"
}
]
}
Loading