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
182 changes: 182 additions & 0 deletions research/shared-denominator-window-cache/PROOF.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
# Shared-denominator principal-window cache

This is a scoped written construction, produced by Nick Petalas. Finite tests
corroborate the implementation. Independent human and formal proof-kernel review
are unclaimed. No multiplication theorem or new kappa follows.

## Boundary and theorem

Let H be one fixed rational N by N source. For every row i, choose a positive
integer q_i clearing every denominator in that row, and put Z=diag(q) H. These
scales and the integer source Z are prepared once and retained separately. A
window J is an ordered list of m distinct source labels. An update removes its
first label and appends a label not in the retained list. The appended label may
equal the removed one.

Assume the old principal window Z[J,J], the retained principal window B, and
the incoming principal window are nonsingular. The empty retained matrix at m=1
has determinant one. The predecessor's weighted strict diagonal dominance is
one sufficient all-window premise. We cite that premise without replaying its
scientific checks; this construction also applies outside that class whenever
these exact nonsingularity conditions hold.

After one exact initialization, the cache stores

d = det Z[J,J], A = adj Z[J,J].

Its inverse output is represented exactly by

H[J,J]^-1 = A diag(q_J) / d. (1)

A slide updates d,A with integer additions, multiplications and exactly
2(m-1)^2 exact integer divisions. It uses O(m^2) arithmetic operations and
O(m^2) live integer fields. The inverse coefficient state contains m^2 integer
cofactors and one signed common determinant. It therefore removes m^2-1
per-entry denominator fields compared with m^2 individually stored rationals.
This count excludes labels, source storage, row scales, initialization scratch
and materialized outputs. It counts representation fields, not distinct heap
objects. Common cofactors can be larger than individually reduced numerators;
no total-bit-space or runtime improvement is asserted.

Equation (1) follows from Z_J=diag(q_J) H_J. The row scales occur on the RIGHT
of the inverse, so they multiply columns of A. A left multiplication here would
be wrong for a nonsymmetric source.

## Delete the outgoing coordinate

Simultaneously permute rows and columns to move the outgoing coordinate last.
This does not change the determinant. Write the correspondingly permuted cache
and source as

adj M = [ E f ; g b ], M = [ B u0 ; v0 a0 ],
d = det M, b = det B.

The last equality is the bottom-right cofactor identity. Since M and B are
nonsingular, the Schur inverse identity yields

B^-1 = E/d - (f/d)(d/b)(g/d).

Multiplication by b gives the deletion formula

C = adj B = (b E - f g) / d. (2)

All quotients in (2) are integers because the left side is an adjugate of an
integer matrix. The implementation uses divmod and rejects a nonzero remainder,
rather than truncating. It performs (m-1)^2 such divisions. Negative d is legal.
For m=1, A=[1], b=1 and C is empty, so (2) needs no division.

## Border the retained matrix

Read the incoming column u, row v and diagonal a from the SAME integer source.
Let

p = C u, r = v C, e = a b - v p.

The determinant formula for a bordered matrix gives

e = det [ B u ; v a ].

The Schur inverse formula, multiplied by e, gives its adjugate

A_new = [ (e C + p r)/b -p ;
-r b ], d_new=e. (3)

In detail, B^-1=C/b and the Schur complement is e/b. The inverse top-left
block is C/b + p r/(b e); the other blocks are -p/e, -r/e and b/e. Thus (3)
holds entry by entry over the rationals. Its top-left block is integral because
it is part of an integer adjugate. There are another (m-1)^2 exact divisions.
For m=1, e=a and A_new=[1], including negative nonzero a.

Equations (2) and (3) prove the state invariant by induction over every finite
sequence of legal slides. The induction does not retain an expanding product
of historic denominators. Both row and column order are part of the invariant.
Incoming singularity or a zero deletion pivot is rejected before publication
of a new state. The old immutable cache remains available after every failure.

These are classical Schur and determinantal-condensation identities. The new
contribution is their composition as a shared-denominator sliding cache with
an explicit persistent state, rational-source orientation and bounded integer
implementation. It does not claim invention of the underlying identities.

## Heights do not grow with the number of slides

Put C0=max(1,max_ij |Z_ij|), Q=max_i q_i, k=m-1, and

L = m! C0^m.

Leibniz expansion bounds every stored determinant by L and every stored
cofactor by (m-1)! C0^(m-1), hence also by L. Retained determinants and cofactors
satisfy the same common bound. These estimates depend on the fixed source and
window width, not on the number of preceding slides.

A deletion numerator has magnitude at most 2 L^2. Each component of p or r
has magnitude at most k L C0. During evaluation of e, the absolute sum is at
most L C0 + k^2 L C0^2. Once e is formed it is a determinant and has magnitude
at most L. A bordering numerator is at most

L^2 (1 + k^2 C0^2).

These bounds also cover partial sums by the triangle inequality. The integer
numerators in (1) have magnitude at most L Q. Thus stored and temporary bit
heights are polynomial in m, log C0 and log Q, uniformly over the slide count.
The quotient and remainder do not require an unbounded denominator chain.

If every input numerator and denominator has magnitude less than 2^B, row-wise
least-common-multiple clearing gives q_i <= 2^(NB) and
C0 <= 2^((N+1)B). Initial clearing is global-source work, not free per-window
normalization. Row scaling can substantially enlarge integers. Bit arithmetic,
source access, output formation and exact initialization must all be charged.

## Implementation and finite evidence

`initialize` validates the bounded rational source and distinct ordered labels.
It uses classical pivoted Bareiss determinant elimination and one dense rational
inverse to obtain the integer adjugate. No Fraction survives in the cache. This
adds a separately paid determinant computation to dense initialization. The
constructor also clears N^2 source entries, using row-wise denominator lcms;
the subsequent dense initialization is O(m^3) rational/integer arithmetic.
No faster setup is claimed.
The mathematical update accepts any exact initial adjugate/determinant pair.

`slide`, `delete_first` and `border` contain only integer arithmetic. They build
a new immutable cache and share the original source and row scales. The explicit
`materialize` adapter creates reduced Fractions only when requested; it is not
called by a slide. Storing its output reinstates per-entry denominators and its
additional output storage is payable. The integer numerator adapter costs
m^2 multiplications and leaves the shared determinant intact.

The implementation supports 1<=N<=32, 1<=m<=min(N,16), and at most 256 bits
per reduced input numerator/denominator. The written formulas hold for arbitrary
finite dimensions. New evidence enumerates its own sources and slides rather
than rerunning PR3872's scientific suite. A separate Leibniz/cofactor oracle
imports neither initialization nor slide arithmetic. It checks complete ordered
windows, signed nonsymmetric rational streams, both division pivots and the
source-row orientation. The verifier emits the enumerated counts and SHA256
bindings; no receipt is handwritten.

Power-of-Ten inspection: all loops are bounded by the validated dimensions,
fixed census domains or explicit 48/64-step streams, and no function recurses.
Every function is below 60 lines. Invalid source/label/pivot/quotient checks use
ValueError and remain active under -O. Frozen cache values confine mutation to
local construction. Returned quotient/remainder and pivot searches are checked.
There is no dynamic code execution or callback registration. Standard dataclass
construction is the only generated method mechanism.

Managed-runtime deviation to rule 3: CPython integers, Fractions during
initialization/materialization, tuples and temporary lists allocate dynamically.
The bounded dimensions and the height bounds above bound live arithmetic state;
a slide retains only a constant number of O(m^2) arrays. The caller must account
for any old cache states or materialized outputs it retains. Follow-up physical
integration must provide its own fixed storage allocator and include conversion,
allocation, erasure and routing costs. No such program is supplied here.
Warning-strict normal and optimized runs are registered; external static type
or lint tooling is not required by the repository replay contract.

## Remaining obligations

This is an arithmetic preparation component. It does not implement the actual
protected factor pages, a rounded Gaussian producer, a fixed-tape integer
arithmetic routine, dirty-helper operations, supplier admission or any of the
five retained framework assumptions. Production nonsingularity, initialization,
source row clearing, bit costs, page emission, input/output ownership, storage,
precision, movement and cleanup must be bound to an actual caller separately.
97 changes: 97 additions & 0 deletions research/shared-denominator-window-cache/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Shared-denominator sliding principal inverses

A new exact cache stores each principal-window inverse using one signed
determinant and an integer adjugate. Every one-index slide uses integer
arithmetic with exact divisions. The inverse coefficient state removes m^2-1
per-entry denominator fields at width m. Stored and temporary bit heights are
bounded independently of the number of slides.

This contribution was produced by Nick Petalas. Claim type: scoped written
construction with finite exact corroboration. No new kappa or selected-frontier
change. The representation count is not a total-bit-space or runtime guarantee;
common cofactors can exceed individually reduced numerators.

[PROOF.md](PROOF.md) states the arbitrary finite-dimension theorem, full
rational-source contract, both update identities, height bounds and limitations.
`cache.py` implements a bounded reusable constructor and slide API. `verify.py`
uses independent literal determinants and cofactors, including signed nonsymmetric
sources and rational row scaling. It produces a hash-bound JSON receipt on stdout
and writes no files.

## Reproduce

From the repository root, using CPython 3.12 and its standard library:

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

Any CPython 3.12 interpreter may replace that local path. The direct status is
`PASS_SHARED_DENOMINATOR_WINDOW_CACHE`; the registered hook reports
`PASS_REGISTERED_RESEARCH_PACKAGE`.

## New step and predecessor credit

David Ganz / Dugongue's [PR3872](https://github.com/CrocSwap/integer-mult-bounds/pull/3872)
supplies the fixed-global-source, ordered principal-window preparation interface
and rational Schur cache. Its page-integration question motivates the smaller
cache-representation subproblem here. Its scientific results and counts are
cited, not audited or replayed. The new code imports no predecessor code.

Credit Jose Manuel / jmbarrancoml's PR3851 for the exact old-H preparation
boundary, Chafik Boukhalfa, RaD and the retained Gaussian/FFT lineage. Adjugates,
Schur complements, Bareiss elimination and determinantal condensation are
classical. This package claims the concrete shared-denominator sliding
construction and contract, without a global literature-priority claim.
Apache-2.0. Every predecessor source and credit line remains unchanged.

The earlier PR5119 comparison barrier concerns residual error bounds on the same
preparation family. It does not supply this integer cache representation and is
not a mathematical dependency here.

## Scope and costs

The cache first clears each GLOBAL source row once. Thereafter it retains the
integer source, the row scales, ordered labels, m^2 cofactors and one determinant.
It supports N<=32, m<=16 and 256-bit reduced input coefficients. Its mathematical
identities hold in all finite dimensions with the stated nonsingular principal
blocks. Returning the outgoing index is permitted. A zero retained or incoming
determinant fails without changing the previous state.

Dense initialization, global source storage/scaling, integer bit arithmetic,
optional inverse materialization and retained output storage remain payable.
Materialization creates ordinary Fractions and reinstates their per-entry
denominators. Physical protected-page production, precision/tapes/stock,
ownership/restoration, native implementation, complete invoices and all five
framework assumptions remain open. Independent human and formal proof-kernel
review are unclaimed.

## Overlap and scope change

The supplier-boundary-audit card is retained verbatim in TASK.json. Its scope
changes from admission auditing to this constructive arithmetic preparation
subproblem. The selected binding-only first example passed. Main and merged PR
searches covered sliding inverses, adjugate caches, shared denominators and the
general fraction-free form. Live handoffs, active Discussions, open PRs, recent
account submissions and local reservations were checked before the advance
[CLAIM](https://github.com/CrocSwap/integer-mult-bounds/discussions/1166#discussioncomment-19376727).
PR3872 is the question source and main predecessor. This is not a claim of
exhaustive novelty; sparse notes, arbitrary historical diffs and unpublished work
remain coverage limits. The broad cached report covered 598 open PRs and 6,677
Discussion records with complete remote pagination. The local corpus searched
136 of 8,917 HEAD notes. Exact freshness and coverage limits are in TASK.json.

## Open next questions

1. Can one actual protected factor-page consumer use the integer numerator/common
denominator stream without materializing every rational inverse entry?
Freeze its matrix, page format and access sequence, then price normalization,
coefficient creation, output ownership and cleanup. No physical adapter is
supplied by this arithmetic cache.
2. When does row-cleared adjugate storage use fewer total bits than separately
reduced entries for a production source family? Begin with one authenticated
source and charge initialization plus every output conversion. The field-count
improvement alone does not answer that question.
36 changes: 36 additions & 0 deletions research/shared-denominator-window-cache/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/sliding-window-inverse/PROOF.md",
"usage": "input",
"git_blob": "c95bef030bf13ee7ee836a9f81e38e26f720907d",
"sha256": "e087c64dee82b541cf563245a5c59dc5bd5236072fc96b094ead15ee848bfb3e"
},
{
"path": "research/sliding-window-inverse/README.md",
"usage": "input",
"git_blob": "cca049dfc1981fd92f53715a067d52ee6345eb18",
"sha256": "846561df84d5dd049fa174d6b25fde8964216cdac5fb9cf6988b02e3c9c2e375"
},
{
"path": "research/sliding-window-inverse/cache.py",
"usage": "input",
"git_blob": "db4c97557e72540be912ca1b8a4b7643afb03e5e",
"sha256": "678830c2a0d26294489fd23ddb839123b528c2c725cce8cc7ca6ac8d5b9b469a"
}
]
}
Loading