Skip to content
Merged
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
77 changes: 77 additions & 0 deletions research/h4-projective-normal-cache/PROOF.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Exact projective-normal reuse

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

The input is Jose Manuel / jmbarrancoml's unchanged H4 verifier from
[PR1867](https://github.com/CrocSwap/integer-mult-bounds/pull/1867).
Its mathematical results and complete check domain remain predecessor work.
The claim here is equivalence of one implementation change.

Write phi for a root of phi^2=phi+1. The field Q(phi) has conjugation
phi'=1-phi. A normal n has four entries a_i+b_i phi in Z[phi].
Let p=c+d phi be its first nonzero entry. Its field norm is

D = p conjugate(p) = c^2+cd-d^2 != 0.

Multiplication of n by conjugate(p) gives the eight integer coefficients

u_(2i) = a_i(c+d)-b_i d,
u_(2i+1) = b_i c-a_i d.

The first nonzero field entry of u is the integer D. Divide all eight
coefficients by their positive integer gcd, then negate them if D<0.
Call the resulting primitive integer tuple k(n).

## The key is exact

The tuple u/D is exactly the coefficient representation of n/p. Therefore
two normals are proportional over Q(phi) if and only if their tuples u are
proportional over Q. Primitive integer normalization with the same positive
pivot gives

k(n)=k(m) if and only if Q(phi)n = Q(phi)m.

This covers arbitrary nonzero field scalars, including nonunits of Z[phi].
Normalization by the gcd of the original eight coefficients alone would
only remove rational scalars and would miss some reusable normals.

Nonzero proportional normals have the same annihilated roots. Thus every
cache hit replaces a repeated root scan by the already established fact
that the same projective normal defines the same flat. No approximate key,
modular comparison, hash collision assumption or rounded division is used.

## First occurrences and complete output

Both versions enumerate the same 34,220 root triples in the same order.
Both compute each cofactor normal, skip precisely the zero normals and
check cofactor annihilation against all three generating roots. On the
first occurrence of a projective class, the accelerator performs the same
sixty root products and inserts the same flat mask and original normal
with the same `setdefault` operation.

On later occurrences the original code computes that same flat and leaves
its first normal unchanged. The accelerator leaves it unchanged directly.
Induction over the triple order proves equality of the flat dictionaries,
their insertion order and the exact retained normal coefficients.

The complete remaining source `main` is unchanged. It receives the same
dictionary, so reflection orbits, chosen witnesses and their order,
support-receipt digest, budget predicates and all eight rejection controls
remain identical. No mathematical theorem is newly certified by the timing
comparison. The complete historical source runs in both conformance sides;
only its `hyperplanes` function is replaced on the accelerated side.

## Scope and bounds

The cache belongs to one `hyperplanes` invocation. It contains 1,320 keys
on this fixed sixty-line domain and holds no persisted result or source
state. The normal integer input contract is four pairs with absolute
coefficients at most 2^32. The key is mathematically valid beyond that
bound, but the implementation deliberately rejects larger inputs.

The universal equivalence argument is written mathematics. The finite
checks compare a separate rational-division key with the integer key,
exercise golden-field scalings, and compare complete flat dictionaries
under four root order/sign variants. Complete original and accelerated
stdout are compared byte for byte. Independent human and formal
proof-kernel review are unclaimed.
162 changes: 162 additions & 0 deletions research/h4-projective-normal-cache/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
# Complete H4 replay takes 45.2% less wall time

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

Exact projective-normal reuse reduces the complete H4 certificate replay's
local median wall time from **2.462 s to 1.350 s**, a **45.2% reduction**.
Five alternating fresh-process pairs emit identical complete stdout, with
zero errors. This is a measured verifier improvement with a scoped
implementation-equivalence proof and finite conformance evidence.
No new mathematical bound or kappa is claimed.

Jose Manuel / jmbarrancoml's [PR1867](https://github.com/CrocSwap/integer-mult-bounds/pull/1867)
retains the H4 theorem, geometry, witness construction and complete
scientific checks. Its source remains unchanged. This package supplies an
opt-in accelerated command. It does not replace the predecessor's default
replay or provide a new scientific review of its theorem.

## Change and evidence

The complete-command profile puts 4.805 of 6.493 profiled seconds in
hyperplane construction. Different spanning triples repeatedly produce
normals for the same hyperplane. The accelerator computes an exact
primitive integer key for each normal's Q(sqrt(5)) projective class.
It scans the sixty roots only on the first occurrence of a class.

All 34,220 triples still undergo cofactor construction. The 33,300
nonzero normals still undergo the original annihilation checks against
their three generating roots. There are 1,320 distinct projective classes,
so the change avoids 31,980 repeated root scans. It retains the first
original normal, every flat mask and dictionary insertion order.
[PROOF.md](PROOF.md) proves exactness of the key and complete output.

Conformance checks cover:

- 624 nonzero test vectors, 272 projective classes and 6,864 nonzero
golden-field scalings against a separate exact rational-division key.
- Four complete original/accelerated flat dictionaries, using the original
order, reverse order, a cyclic order and alternating root signs. Every
mask, first normal and insertion position agrees.
- Byte-identical complete historical replay, including its 5,280 checked
representative support witnesses, reflection orbits, budget checks and
eight inherited corruption rejections.
- Eight new rejections for malformed normals, capacity overflow, a
deliberately colliding key and changed source bytes. The exact capacity
boundary is also accepted.

The preserved support-witness digest is
`8b0a00c1e8bc012e7f9b620e0ed2c23384f08ea51f7a023f03279e34e9704ab6`.
The complete stdout digest is
`54a65418396d5d8e4989ae02c13e0abe0b34760e6cc43ee3d0e7382ef4482853`.
These are inherited output identities, not new theorem certificates.
The new verifier generates its own source-hash-bound receipt on stdout.

## Measurement

CPython 3.12.15, macOS 27.0.1 arm64, eighteen logical CPUs. The opening
load averages were 2.55, 2.73 and 2.60. Other research processes may share
the host. Timed commands run serially, with pair order alternating to
limit drift. Profiling runs are excluded. A preliminary timing run that
overlapped conformance was discarded.

Each sample includes interpreter startup and the complete replay.
Both sides use `-I -W error -B`, the same interpreter and the same source
domain. The accelerated side also pays for source authentication and
loading. Each subprocess must exit zero, emit no stderr and produce the
same complete stdout. The cache starts empty in each process.

| Pair | Order | Baseline seconds | Accelerated seconds |
| --- | --- | ---: | ---: |
| 1 | baseline, accelerated | 2.444386166 | 1.366814083 |
| 2 | accelerated, baseline | 2.438297166 | 1.409753166 |
| 3 | baseline, accelerated | 2.462136750 | 1.349535167 |
| 4 | accelerated, baseline | 2.559169750 | 1.342320875 |
| 5 | baseline, accelerated | 2.469625000 | 1.329154208 |

Baseline range is 2.438 to 2.559 seconds; accelerated range is 1.329 to
1.410 seconds. All five pairs improve. The measured reduction is below
the share spent in the changed component. This is a single-host result,
not a portable performance guarantee. No timing threshold runs in CI.

## Reproduce

From the repository root:

```sh
/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -I -W error -B research/h4-projective-normal-cache/replay.py
/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -I -W error -B research/h4-projective-normal-cache/verify.py
/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -I -O -W error -B research/h4-projective-normal-cache/verify.py
/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -B scripts/research_package.py --package research/h4-projective-normal-cache
/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -B scripts/check_research_commit.py --package research/h4-projective-normal-cache --check-source-history
/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -I -W error -B research/h4-projective-normal-cache/benchmark.py --pairs 5
```

Another CPython 3.12 installation may replace the displayed interpreter.
The registered normal and optimized conformance commands each have a
120-second limit. Direct replay and verification write only stdout.
The benchmark also emits its generated timing receipt only to stdout.
The committed-byte check requires a committed package and full Git history.

## Scope, provenance and constraints

Base is canonical main `a5bff3bf133e482541c09eba4e773884bdb2b1b7`, priority
revision 8. The source-binding orientation passed. Selected kappa remains
`0.003125804`. The [advance CLAIM](https://github.com/CrocSwap/integer-mult-bounds/discussions/1166#discussioncomment-19272415)
and [TASK.json](TASK.json) record this original replay-runtime question.
Live handoffs, open and merged PRs, recent account work, reservations and
distinctive main README searches were checked. Sparse local-note coverage,
unpublished work and arbitrary historical diffs remain limitations.

[SOURCES.json](SOURCES.json) authenticates the one executed predecessor
file by SHA256 and Git blob. The loader reads those exact bytes and
compiles them with optimization disabled, including when this driver uses
`-O`. The cache is invocation-local and cannot outlive its source instance.
Source changes reject before execution. It does not infer dependencies of
a changed future predecessor.

New functions are at most 42 physical lines. The fixed sixty-line domain
bounds triple loops by 34,220 iterations and the production cache by 1,320
classes. Integer input coefficients are bounded by 2^32. The standalone
key tests have 624 vectors and eleven scalars. Benchmarking permits five
through fifteen pairs, with a sixty-second timeout for each subprocess.

Power of Ten deviations are explicit. CPython and its libraries allocate
dynamically; finite input and collection bounds replace a fixed-allocation
guarantee. The authenticated predecessor retains its existing recursive
clique search, bounded here by clique size thirteen. Source execution and
the one function replacement use dynamic dispatch over exact, pinned
source; the conformance and source-corruption controls exercise that
boundary. These exceptions do not expand the inherited search domain.
Warning-strict normal and optimized runs, syntax/function-size inspection
and the repository package checks supply the diagnostics used here.

Native implementation, ownership, physical caller, precision, compiler,
outer admission and a complete multiplication theorem are outside this
tooling change. The selected cold replay, Lean and Docker were not run.
Independent human and formal proof-kernel review are unclaimed.

## Related open work

No open PR found at the pre-claim checkpoint studies H4 projective-normal
reuse or this complete H4 replay. Other replay-engineering work uses
different sources and bottlenecks. This statement is refreshed in the PR
body before publication.

## Open next questions

Can exact cofactor construction be shortened after scan reuse? First
profile the complete accelerated command, then compare an exact algebraic
replacement while retaining all normal and witness outputs. No replacement
or performance result is supplied here. This is a separate future task;
the present contribution stops after its first measured improvement.

## Credit

Jose Manuel / jmbarrancoml retains PR1867's mathematical results,
coordinates, complete support checks, witness search and implementation.
Its credited Denney, Bao, Thiago Goulart / Tuafo, Joel Pulikkan,
DreamingOfClouds and retained decoder/accounting predecessors keep their
attribution. Primitive integer normalization, quadratic-field conjugation
and projective equality are classical. The new contribution is this exact
reuse implementation, its equivalence proof, conformance checks and
complete-command measurements. No predecessor credit line was edited.
24 changes: 24 additions & 0 deletions research/h4-projective-normal-cache/SOURCES.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"schema_version": 1,
"base_commit": "a5bff3bf133e482541c09eba4e773884bdb2b1b7",
"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/h4-root-linear-copy-floor/verify.py",
"usage": "input",
"git_blob": "7a40c1cc10b54e79313957da61c740c0a3ef2d5b",
"sha256": "431fd177a9a2cef705442e730335e2e457c84440b21a024fce7d6c139ce0d031"
}
]
}
67 changes: 67 additions & 0 deletions research/h4-projective-normal-cache/TASK.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"schema_version": 1,
"task_id": "replay-runtime",
"priority_revision": 8,
"base_commit": "a5bff3bf133e482541c09eba4e773884bdb2b1b7",
"original_card": {
"id": "replay-runtime",
"question": "Can one measured replay bottleneck be sped up without dropping coverage?",
"starting_points": [
"scripts/run_isolated_tests.py",
"scripts/verify_replay_coverage.py",
"certificates/selected-result.json"
],
"methods": [
"Profile one isolated replay and optimize the measured bottleneck.",
"Design source-bound reuse with explicit dependency invalidation and negative controls."
],
"acceptance_gate": "Report before/after wall time on the same fixture, retained checks and invalidation behavior.",
"first_step": {
"command": [
"python3",
"-B",
"scripts/research_selected_baseline.py"
],
"expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY",
"inspect": "Resolve the current selected review, separate complex/ordinary BIT/admitted BIT/outer budgets, and compare the card against live handoffs before starting. Historical ceilings require exact source/model equivalence.",
"scope": "Source-binding orientation only; not a scientific replay or all-size proof. Materialize selected inputs if this checkout is sparse."
},
"first_experiment": "Measure one unchanged fixture, preserve check coverage, and test one optimization with invalidation controls.",
"bottleneck_link": "Faster trustworthy replays increase review throughput and let mechanism candidates be checked sooner.",
"allowed_variations": [
"Profile one stage or design one source-bound cache boundary."
],
"scope_change_triggers": [
"Skipping coverage or comparing different fixtures to claim speedup."
],
"overlap_terms": [
"replay runtime",
"cache invalidation",
"isolated tests"
]
},
"scope_status": "refined",
"actual_scope": "Invocation-local exact projective-normal reuse in the complete PR1867 H4 support-certificate replay, with unchanged complete stdout and every inherited check.",
"scope_change_reason": "A measured hyperplane-construction bottleneck gives one independent implementation question; no predecessor mathematical audit or altered domain is the deliverable.",
"bottleneck_link": "Reducing complete certificate replay time preserves coverage while shortening the wait for source-bound research evidence.",
"budget_minutes": 60,
"stop_rule": "Ship the first source-bound measurable complete-command improvement after conformance and publication checks; do not extend the mechanism.",
"outcome": "completed",
"evidence": "Integer projective-normal key proof, exact rational-key and field-scaling controls, four complete flat-dictionary comparisons and byte-identical complete historical output. Alternating complete-command timing is recorded in README.md.",
"author": "Nick Petalas",
"ai_assistance": "Independent human and formal proof-kernel review are unclaimed.",
"open_questions": [
{
"question": "Can a complete H4 replay use a shorter exact cofactor computation after projective scan reuse?",
"why_it_matters": "Cofactor construction remains paid for every spanning triple; this is a separate possible replay cost.",
"first_step": "Profile the complete accelerated command and compare its cofactor routine with an exact algebraic replacement, preserving all normal and witness outputs.",
"blocked_by": "No replacement or performance result is provided; the present stop rule ends after one mechanism."
}
],
"coordination": "https://github.com/CrocSwap/integer-mult-bounds/discussions/1166#discussioncomment-19272415",
"upstream_checkpoint": {
"commit": "a5bff3bf133e482541c09eba4e773884bdb2b1b7",
"priority_revision": 8,
"checked_at_utc": "2026-10-29T16:14:25Z"
}
}
36 changes: 36 additions & 0 deletions research/h4-projective-normal-cache/VERIFY.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"schema_version": 1,
"status": "ready",
"python": "3.12",
"requirements": [],
"inputs": [
"research/h4-root-linear-copy-floor/verify.py"
],
"commands": [
{
"argv": [
"{python}",
"-I",
"-W",
"error",
"-B",
"{package}/verify.py"
],
"timeout_seconds": 120,
"checks": "Exact projective keys, golden-field scaling, four complete original/accelerated hyperplane dictionaries including first normals and order, byte-identical complete historical replay, all eight inherited controls and eight new rejection controls."
},
{
"argv": [
"{python}",
"-I",
"-O",
"-W",
"error",
"-B",
"{package}/verify.py"
],
"timeout_seconds": 120,
"checks": "The same complete conformance and rejection domains with the driver optimized; retained source is compiled with optimize=0."
}
]
}
Loading