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
163 changes: 163 additions & 0 deletions research/native-lazy-tensor-boundary/PROOF.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
# Uniform lazy tensor routing at the actual lender333 boundary

JoyboyBrian, with substantial OpenAI Codex assistance. Apache-2.0.

## Source contract and quantified statement

The frozen predecessor PROOF and BOUNDARY are inputs, not newly certified native
recipes. They identify PR3945 `warps[4]=(1081,333,G,U,E)`, the three consumers
B1081/1082/1083 with signs -,-,+, and the next lender333 transition at B1097.
Its signed affine monomial M has translation458 and global phase i^3. The next
native transition is L C0 R. The predecessor establishes these literal local
interfaces and absence of intervening observations of333. We retain that premise.

For every integer f>=1 let N=512^f, and tensor **each individual operator**.
On arbitrary independent complex arrays v,d1,d2,d3, the required boundary is

d_j -> d_j + sign_j M_f v;
v -> L_f (C0)^tensor f R_f M_f v.

Set F=RM. The lazy schedule computes the three destination updates directly at
M's permuted addresses, leaves v unmaterialized, then applies F_f, the unchanged
paid child and L_f. Functoriality `(RM)^tensor f=R_f M_f` proves equality at every
width. This is not tensorization of a sum. The translation is applied separately
to every column; phases add modulo4, so the global i^3 becomes i^(3f).

All four array outputs agree before the common suffix. Therefore an identical
deterministic rounded suffix would also agree, but this does not establish that
suffix's accuracy or cost. Earlier consumers of destination arrays see exactly
the same values. The source owner's no-intervening-observation premise is vital.

## Uniform address algorithm without an N-entry table

Decode each fixed base monomial into p(x),q(x) on512 symbols. Exact cycle census
gives orders d_M=12,d_R=24,d_F=28,d_L=252. A tensor permutation applies p separately
to the f base512 digits. Its order divides d for every f, even with mixed digit
cycle lengths. Phases do not alter the permutation order and are never discarded.

For a monomial of order d, retain d fixed tables

table_k[a] = (p^k(a), q(p^k(a))), 0<=k<d.

These contain512d pairs, independent of f. For a packed address x, maintain d
packed addresses p_f^k(x) and d phase sums sum_j q(p^k(x_j)) modulo4. Initialize
at x=0 in df digit steps. When digit j changes a->b, replace its contribution
using `(p^k(a) XOR p^k(b)) << 9j` and update the phase by subtracting the old and
adding the new table phase. Both shifts are explicit ABI operations. Every
address fits9f bits; table indices and shift counts fit an additional fixed
constant number of such words. No multiplication or unbounded array operation
is an instruction.

At x, scan all d addresses for their minimum. If x is that minimum, its orbit
appears exactly once. Find its length ell by the first return to x, then rotate
its source values in place: hold the old value at x, load the next old value
before overwrite, store the appropriately rotated held pair, and advance. The
phase attached to each original position is already in the maintained lane.
Fixed coordinates with nonzero phase must still execute. Fixed phase-zero
coordinates may be skipped only for a plain monomial, never when their consumers
need that value. This implementation uses two complex held values, destination
working pairs and sign selection; eight owned real scratch words suffice as in
the predecessor. No full clean array and no borrowed dirty array is assumed.

The lazy consumer scan uses one lane `(p(a),q(a))`, without a leader search.
Packed addresses/phase registers and the f-digit odometer are control workspace,
not productive data. They are initialized and cleared. At most252 packed address
and252 phase registers, f digit words and constant loop words suffice when the
common L pass is included. The fixed tables use at most252*512 pairs per pass,
plus retained base tables. These metadata are owned and retained for the word,
then cleared or retained under an explicitly persistent owner contract. They
are not free storage. A word needs9f+O(1) address bits and the independent scalar
precision width; ordinary bounded RAM permits both within a fixed number of
words when f and precision are O(log n). No fixed-tape translation is asserted.

## Complete bounded routing invoice and comparison

Let U_f=sum_{j=0}^{f-1} floor((N-1)/512^j). Exactly U_f odometer digits change in
one full scan; U_f<512N/511. Each lane-digit replacement uses two fixed-table
pair reads, one digit XOR, one shift, one packed XOR, two phase add/subtractions
and one mask. Initializing a lane uses f table/shift/phase steps. These are
specified bounded-word primitives, not a unit-cost whole-array permutation.

The strong materialized comparator combines M with its three consumers, sharing
source loads and prepared signs, then applies R. The lazy word scans consumers
using M and applies F. The common child and L suffix are identical and retain
all their actual costs; they are not removed from the complete invoice.

| Noncommon category | Materialized | Lazy |
|---|---:|---:|
| orbit/consumer lanes |12+24=36|1+28=29|
| initial lane-digit steps |36f|29f|
| lane-digit replacements |36U_f|29U_f|
| leader comparisons |(11+23)N=34N|27N|
| source real reads |4N|4N|
| source real writes |4N|2N|
| consumer real reads and writes |6N each|6N each|
| consumer ADD and prepared NEG |6N and2N|6N and2N|
| second pass phase NEG |N|N|

M,R,F have no base fixed coordinates, hence none at any positive tensor width.
R and F each have128 entries of every phase. Convolution of their phase counts
is uniform at every width; quarter-turns need0,1,2,1 real negations, whose mean
is1. Thus their second-pass NEG counts both equal N. Consumer signs are prepared
once and shared with M's materialization in the strong comparator. The comparison
does not claim avoidable read or negation savings.

Loop and orbit discovery are also charged. Both schedules have two full scans,
2U_f digit carries,2N iterations, and2N visited source/consumer positions. Their
per-cycle length searches cost at most N comparisons per monomial; the exact
count is N minus the number of full-order cycles. The baseline's two searches
cost at least(2-1/12-1/24)N, while the lazy search costs at most N. Thus no unpaid
extra length-search penalty hides in the lazy bound. Cycle-start/exit work is
bounded by a fixed number of instructions per processed coordinate. No data-
dependent branching or lookup on caller values is used. Resetting owned control
registers is linear in lane count plus f and does not reverse the inequality
when both comparators reserve the same maximum-sized workspace.

Preparation is not zero: all base recipe decoding, cycle census, orbit tables,
F composition, allocation, initialization and final clearing must be paid. F
composition takes1024 base table reads,512 writes and512 mod4 additions. The
noncommon expanded table totals are36*512 versus29*512 pairs. We do **not** infer
net machine time from these categories. A conservative complete ordinary-RAM
invoice is

setup K + c_route U_f + c_leader N + c_data N
+ identical_paid_child(f,precision) + identical_L(f,precision),

with the displayed exact route/data coefficients and all register/loop costs
included by their stated per-coordinate bounds. K is a fixed constructively
finite setup bill for the chosen literal implementation and tariff, independent
of f. A crossover may be stated only after this actual K and primitive tariffs
are fixed. This paper proves a uniform traffic saving2N and reduced principal
routing work, not a measured total-time speedup, optimal tariff, or native-cost
admission. The O(N) address theorem closes the predecessor's exponential-table
risk without silently giving preparation or control a zero price.

## Scalar magnitude and remaining interface

Before the common child, all monomials preserve complex coordinate magnitude;
if incoming magnitudes are <=B, destinations are <=2B. Sign selection and ADD
require the corresponding guard capacity. The unchanged tensor child has exact
infinity norm2^(f/2); after it the source is at most2^(f/2)B. Its internal rounding,
word growth and accelerated recursive execution are separate contracts. Our
algorithm touches neither recursive rank nor owner width. Native allocation,
whole supplier compilation, fixed tapes, precision recovery and the selected
frontier are not established by this RAM construction.

## Verification and scope

The proof above supplies the all-f quantifier. The independent out-of-place
oracle checks all four dense actual arrays at f=1 and distinguishes wrong global
phase, translation and reversed composition. Small permutations with mixed cycle
lengths/fixed phases exhaust addresses through four tensor factors; exact lane
counts are checked against the formula. Eight actual f=2 columns cross digit
carries and verify source composition. Full actual f=2 arrays, common native
child/supplier replays, formal kernels and machine timing are not claimed.

## Executable-reference versus RAM tariff

Python is a semantic and route-counter reference, not an instruction-for-instruction
implementation of the scalar tariff. In particular `rotate` eagerly constructs
phase alternatives in Python, while the stated RAM schedule selects/reuses the
required signed operands. The exact NEG categories are for that declared schedule,
not measured Python unary operations or CPU instructions. Only explicitly
instrumented route/store counts are reported as executable counters.
49 changes: 49 additions & 0 deletions research/native-lazy-tensor-boundary/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Uniform lazy signed-affine routing for lender333

The actual finite boundary in `staged544-paid-native-fusion` has a uniform
all-width realization with O(N) bounded-word address work and no N-entry routing
table, where N=512^f. It preserves all four arbitrary caller arrays and saves
exactly2N real writes against the strong materialized comparator. Its principal
routing counts also fall from36 to29 odometer lanes and34N to27N leader
comparisons. No recursive child, owner-width or κ improvement is claimed.

[PROOF.md](PROOF.md) gives the quantified algorithm, exact traffic/route categories,
owned metadata, setup and clearing obligations, and remaining tariff boundary.
Setup is fixed but nonzero; no total-time crossover is asserted without fixing
its actual primitive tariffs. The common native child and L suffix remain paid.

```
python3 -I -W error -B research/native-lazy-tensor-boundary/verify.py
python3 -I -W error -O -B research/native-lazy-tensor-boundary/verify.py
python3 -B scripts/research_package.py --package research/native-lazy-tensor-boundary
```

The verifier authenticates the retained exact source boundary/proof, reconstructs
all512 base mappings, checks the actual dirty four-array boundary, uses a separate
out-of-place oracle, exercises tensor cycles and phases on small exhaustive
fixtures, and rejects altered phases/translation/composition. RESULT is regenerated
and compared. Finite probes support the uniform proof; they do not prove it by
extrapolation. Runtime code uses standard-library Python as executable evidence,
not cycle-accurate RAM timing. The source f=1 native certificate is a retained
premise rather than freshly repeated here.

Source base32890bc5de034ab8fc93ac88ead7279a6a416d04, priority7; selected5413 remains
unchanged. [Discussion5474](https://github.com/CrocSwap/integer-mult-bounds/discussions/5474)
is the canonical investigation. Full open-PR and Discussion overlap was coordinated
by root before assignment; this is the explicit all-f handoff of the predecessor,
not a new phase-tag normalization or native recipe census.

## Open next questions

- Fix the ordinary RAM primitive tariff and execute the complete setup/runtime
instruction trace to determine its crossover against a stronger downstream
fused comparator. The categories here do not determine actual machine time.
- Bind the lazy ownership representation into one current complete native caller,
with its precision, fixed-tape and clearing obligations. The historical PR3945
cut alone does not imply admission into selected5413.

Prepared by JoyboyBrian with substantial OpenAI Codex assistance; Apache-2.0.
Credit Chris R/Clear1nsight for the actual paid-native-fusion boundary and fair
comparator, ToikY PR4002 for phase tags, Chris R PR3987 for signed recipes,
Dugongue PR3945 for native words, and all source-native/compiler lineage retained
in source/PROOF.md. New uniform routing proof and controls are this contribution.
123 changes: 123 additions & 0 deletions research/native-lazy-tensor-boundary/RESULT.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
{
"status": "PASS_NATIVE_LAZY_TENSOR_BOUNDARY",
"orders": [
12,
24,
28,
252
],
"small_tensor_columns": 710,
"controls": 6,
"actual_dense_width": 1,
"actual_width2_columns": 8,
"invoice": [
{
"width": 1,
"N": 512,
"digit_increments_per_scan": 511,
"materialized_route_lanes": 36,
"lazy_route_lanes": 29,
"materialized_initial_lane_digits": 36,
"lazy_initial_lane_digits": 29,
"materialized_lane_digit_updates": 18396,
"lazy_lane_digit_updates": 14819,
"materialized_leader_comparisons": 17408,
"lazy_leader_comparisons": 13824,
"materialized_source_real_reads": 2048,
"lazy_source_real_reads": 2048,
"materialized_source_real_writes": 2048,
"lazy_source_real_writes": 1024,
"common_consumer_real_reads": 3072,
"common_consumer_real_writes": 3072,
"common_consumer_adds": 3072,
"common_consumer_negations": 1024,
"common_second_pass_negations": 512,
"setup_orbit_table_entries_materialized": 18432,
"setup_orbit_table_entries_lazy": 14848,
"extra_composition_table_reads": 1024,
"extra_composition_table_writes": 512,
"extra_composition_phase_adds": 512
},
{
"width": 2,
"N": 262144,
"digit_increments_per_scan": 262654,
"materialized_route_lanes": 36,
"lazy_route_lanes": 29,
"materialized_initial_lane_digits": 72,
"lazy_initial_lane_digits": 58,
"materialized_lane_digit_updates": 9455544,
"lazy_lane_digit_updates": 7616966,
"materialized_leader_comparisons": 8912896,
"lazy_leader_comparisons": 7077888,
"materialized_source_real_reads": 1048576,
"lazy_source_real_reads": 1048576,
"materialized_source_real_writes": 1048576,
"lazy_source_real_writes": 524288,
"common_consumer_real_reads": 1572864,
"common_consumer_real_writes": 1572864,
"common_consumer_adds": 1572864,
"common_consumer_negations": 524288,
"common_second_pass_negations": 262144,
"setup_orbit_table_entries_materialized": 18432,
"setup_orbit_table_entries_lazy": 14848,
"extra_composition_table_reads": 1024,
"extra_composition_table_writes": 512,
"extra_composition_phase_adds": 512
},
{
"width": 3,
"N": 134217728,
"digit_increments_per_scan": 134480381,
"materialized_route_lanes": 36,
"lazy_route_lanes": 29,
"materialized_initial_lane_digits": 108,
"lazy_initial_lane_digits": 87,
"materialized_lane_digit_updates": 4841293716,
"lazy_lane_digit_updates": 3899931049,
"materialized_leader_comparisons": 4563402752,
"lazy_leader_comparisons": 3623878656,
"materialized_source_real_reads": 536870912,
"lazy_source_real_reads": 536870912,
"materialized_source_real_writes": 536870912,
"lazy_source_real_writes": 268435456,
"common_consumer_real_reads": 805306368,
"common_consumer_real_writes": 805306368,
"common_consumer_adds": 805306368,
"common_consumer_negations": 268435456,
"common_second_pass_negations": 134217728,
"setup_orbit_table_entries_materialized": 18432,
"setup_orbit_table_entries_lazy": 14848,
"extra_composition_table_reads": 1024,
"extra_composition_table_writes": 512,
"extra_composition_phase_adds": 512
},
{
"width": 16,
"N": 22300745198530623141535718272648361505980416,
"digit_increments_per_scan": 22344386578566886591910543553025364170375664,
"materialized_route_lanes": 36,
"lazy_route_lanes": 29,
"materialized_initial_lane_digits": 576,
"lazy_initial_lane_digits": 464,
"materialized_lane_digit_updates": 804397916828407917308779567908913110133523904,
"lazy_lane_digit_updates": 647987210778439711165405763037735560940894256,
"materialized_leader_comparisons": 758225336750041186812214421270044291203334144,
"lazy_leader_comparisons": 602120120360326824821464393361505760661471232,
"materialized_source_real_reads": 89202980794122492566142873090593446023921664,
"lazy_source_real_reads": 89202980794122492566142873090593446023921664,
"materialized_source_real_writes": 89202980794122492566142873090593446023921664,
"lazy_source_real_writes": 44601490397061246283071436545296723011960832,
"common_consumer_real_reads": 133804471191183738849214309635890169035882496,
"common_consumer_real_writes": 133804471191183738849214309635890169035882496,
"common_consumer_adds": 133804471191183738849214309635890169035882496,
"common_consumer_negations": 44601490397061246283071436545296723011960832,
"common_second_pass_negations": 22300745198530623141535718272648361505980416,
"setup_orbit_table_entries_materialized": 18432,
"setup_orbit_table_entries_lazy": 14848,
"extra_composition_table_reads": 1024,
"extra_composition_table_writes": 512,
"extra_composition_phase_adds": 512
}
]
}
30 changes: 30 additions & 0 deletions research/native-lazy-tensor-boundary/SOURCES.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"schema_version": 1,
"base_commit": "32890bc5de034ab8fc93ac88ead7279a6a416d04",
"files": [
{
"path": "certificates/selected-result.json",
"usage": "provenance",
"git_blob": "fc3d4ba105e1f097d0d7d051a308281e86ab1446",
"sha256": "66974efdced4083c00025f97d95d83909a226cdf801edb9301c195c6641f6903"
},
{
"path": "docs/research/agent-task-catalog.json",
"usage": "provenance",
"git_blob": "f126dd2e2dad2b669e75d1d0d0bd05c600725602",
"sha256": "f7a48bfa2659b88378282a8eee7d9fe52cdf505594124c4d1686b58510fffd72"
},
{
"path": "research/staged544-paid-native-fusion/BOUNDARY.json",
"usage": "provenance",
"git_blob": "f7d80157073847c7b57cb33f1f0cc2454173cc4f",
"sha256": "e46236d640768950d24cf26dc5a5650fa79052b19f66245e51a23f0daf0dc5c3"
},
{
"path": "research/staged544-paid-native-fusion/PROOF.md",
"usage": "provenance",
"git_blob": "e5007f51f5798a13a0873aa8b2ca41fbc42c1d0d",
"sha256": "6c3cbb6d49a91c53d3fb3bdeea26967b5439e2dd9cbb662d12b4811bf3730820"
}
]
}
Loading