diff --git a/research/lockstep-source-row-index/COST-MODEL-REVIEW.md b/research/lockstep-source-row-index/COST-MODEL-REVIEW.md new file mode 100644 index 0000000000..e352ed2bea --- /dev/null +++ b/research/lockstep-source-row-index/COST-MODEL-REVIEW.md @@ -0,0 +1,141 @@ +# Independent computational-model review of the source index + +Reviewer: `/root/tape_dispatch`, with OpenAI assistance for @CubeJerry's +research run. Date: 2026-11-11. Scientific base: +`e54523517d0f03e58352e647c403a5af3e525a57`. + +## Scope and snapshot + +This is a source-reading and mathematical cost review of section 5, not a +runtime replay or a replacement for checking the indexing identities. The +author's files were not modified. Reviewed SHA256 pins, relative to +`work/compiler_source_index/package/`: + +| File | SHA256 | +| --- | --- | +| `PROOF.md` | `5571b0e6329f620c4bf58e90fb03ce4dfefae95708435739f8fac5e78aa52c9b` | +| `source_index.py` | `b45f671eeac3d5dead19285cf5f455b705596e9f3679a2eddbdd225e4fbf3718` | +| `inputs/pascal_codec.py` | `cec2c8b5e153a264127e8301ed59591fe97c9a46078ff2343b3784d177c6984d` | + +**Outcome: a repairable computational-model gap.** The current Python already +replaces growing state dictionaries/sets with `sorted_unique` and +`SortedStateTable`. That resolves the earlier hash-table objection for these +tables. Binary-search accesses and indexed value writes nevertheless have not +been lowered to a tape algorithm with paid seeks and returns. Calling the +displayed time formula bit work, or saying it is not unit-cost RAM, does not +alone establish those costs. + +This does not refute the state aggregation or rank/unrank theorem. It also +does not show that no other implementation attains the sharper formula. A +specific memory-access argument is missing; the following conservative one +preserves the claimed polynomiality. + +## Deterministic sequential alternative + +Keep the author's definitions + +\[ +R=1+q\binom{G+q-1}{q},\quad M=\binom{G+d}{d}, +\] + +\[ +B=S+\ell(N)+(G+1)\ell(A+W+P+G+2)+1, +\quad \ell(x)=\lceil\log_2(x+1)\rceil, +\quad L=(S+R+dM)B. +\] + +Serialize input, profiles, state keys and local/total counts as delimited +binary records on a constant number of tapes. Scalar fields need O(B) bits; +a profile needs O(dB) bits. Padded count fields avoid variable-size shifts. +Group state records by depth and profiles in their specified lexicographic +order. The query path/output also fits O(L), since M is at least G+1 when +d is positive and individual indices fit O(B). + +Generate one candidate next state from one current state and one distinct +paid rank. Scan the next-depth records to test membership; append only if +absent. There are at most qR candidate operations, and candidates are never +materialized simultaneously. Profile generation uses explicit bounded +counters/stack, with O(dB) work storage. Bottom-up recurrence evaluation and +rank/unrank find every count by a complete table scan. Role and paid-position +lookup uses the same convention. Return every work head to a marked origin +after each operation, or store and restore an explicit binary cursor. Charge +both choices. + +A conservative O(L^2) moves per record/arithmetic operation suffices: there +are O(L) stored symbols and at most O(L) key comparisons per scan; charging +O(L) for each comparison and all candidate-key rewinds is already quadratic. +Origin returns, insertion, updates, explicit copies and output emission fit +that bound as well. Schoolbook O(B^2) scalar arithmetic is bounded by O(L^2). +The representation and a fixed number of scratch records occupy O(L) cells, +including historical blank backing. No paid-path tree or source list is +materialized. + +Let the scalar/record-operation envelopes be + +\[ +K_{\rm setup}=(S+1)^2 +[M(G+d+1)+R(M(d+1)+q+1)], +\] + +\[ +K_{\rm query}=(S+1)^2 +[M(d+1)+GP+G+d+1]. +\] + +The profile loops, qR streamed candidate operations, state/profile recurrence +loops and chronological query loops fit these envelopes. Consequently an +explicit deterministic sequential alternative satisfies + +\[ +T_{\rm setup}=O(K_{\rm setup}L^2),\qquad +T_{\rm query}=O(K_{\rm query}L^2),\qquad +S_{\rm work}=O(L). +\] + +This is an existence proof for the described sequential realization, not a +transition-count certification of the Python runtime. It is polynomial in +G and log N for each fixed native rule because q and d are fixed. A tighter +scan protocol could improve the deliberately loose exponent; no such claim +is necessary for this logical indexing advance. + +## Suggested author change and retained limitations + +Either use the conservative deterministic bounds above, labelling Python as +the reference mathematical implementation, or specify another deterministic +bit model and prove access, deduplication and cursor costs before retaining +the sharper formula. If both are shown, name their different models. + +No native row lookup, gather, copy, erase, owner transfer, or payload +permutation follows. The actual selected role/owner manifest and native +routing tariffs remain obligations. The five selected assumptions remain. +**No new kappa; no unconditional multiplication theorem.** + +## Resolution after the author's revision + + +The author revised section 5 and the table implementation while this review +was in progress. The reviewed repair snapshot is: + +| File | SHA256 | +| --- | --- | +| `PROOF.md` | `1631e28072e1ad39c3833ec83ff7d59e35c4d8fd1ad45ebce6b777aed4125bdb` | +| `source_index.py` | `e978025591b06770026b9879f1e5b10827424f410794fb2b1e1f10a720f49176` | + +The final proof pin adds a numeric-hash source reference and CPython wording +to the initially reviewed repair; the serialized-table argument was re-read +and is unchanged. The revised proof explicitly separates indexed metadata arithmetic/comparison +work from a deterministic serialized-table realization. It uses +L=(S+R+dM+1)B and the conservative O(K_setup L^2), O(K_query L^2), O(L) +time/space bounds, with candidate insertion, key access, copying, cursor +return, arithmetic and retirement charged. Its O(L) extra spare representation +keeps workspace within O(L). Streaming at most qR candidates prevents storing +qR states simultaneously. Valid query lengths and oversized malformed queries +are distinguished. + +The revised code deduplicates current dilations before generating children; +at fixed paid rank the next-state map is injective. This also makes the total +sorted candidate count at most R, supporting the stated O(R log(R+1)) key +comparison tally. This reviewer accepts the computational-model repair for +this snapshot. The earlier finding is retained above as review history. The +separate collision-family audit and its asymptotic lower bound are outside +this review's assigned scope and were not independently verified here. diff --git a/research/lockstep-source-row-index/INDEPENDENT-RESULT.json b/research/lockstep-source-row-index/INDEPENDENT-RESULT.json new file mode 100644 index 0000000000..eaac37926d --- /dev/null +++ b/research/lockstep-source-row-index/INDEPENDENT-RESULT.json @@ -0,0 +1,168 @@ +{ + "bounded_cases": [ + { + "height": 0, + "paid_alphabet": 4, + "replicas": 5, + "sources": 3, + "states": 1, + "target_alphabet": 2 + }, + { + "height": 0, + "paid_alphabet": 4, + "replicas": 5, + "sources": 3, + "states": 1, + "target_alphabet": 2 + }, + { + "height": 1, + "paid_alphabet": 4, + "replicas": 5, + "sources": 10, + "states": 5, + "target_alphabet": 2 + }, + { + "height": 1, + "paid_alphabet": 4, + "replicas": 5, + "sources": 10, + "states": 5, + "target_alphabet": 2 + }, + { + "height": 2, + "paid_alphabet": 4, + "replicas": 5, + "sources": 33, + "states": 21, + "target_alphabet": 2 + }, + { + "height": 2, + "paid_alphabet": 4, + "replicas": 5, + "sources": 33, + "states": 21, + "target_alphabet": 2 + }, + { + "height": 3, + "paid_alphabet": 4, + "replicas": 5, + "sources": 107, + "states": 57, + "target_alphabet": 2 + }, + { + "height": 3, + "paid_alphabet": 4, + "replicas": 5, + "sources": 107, + "states": 57, + "target_alphabet": 2 + }, + { + "height": 0, + "paid_alphabet": 3, + "replicas": 5, + "sources": 1, + "states": 1, + "target_alphabet": 1 + }, + { + "height": 0, + "paid_alphabet": 3, + "replicas": 5, + "sources": 1, + "states": 1, + "target_alphabet": 1 + }, + { + "height": 1, + "paid_alphabet": 3, + "replicas": 5, + "sources": 1, + "states": 4, + "target_alphabet": 1 + }, + { + "height": 1, + "paid_alphabet": 3, + "replicas": 5, + "sources": 1, + "states": 4, + "target_alphabet": 1 + }, + { + "height": 2, + "paid_alphabet": 3, + "replicas": 5, + "sources": 1, + "states": 13, + "target_alphabet": 1 + }, + { + "height": 2, + "paid_alphabet": 3, + "replicas": 5, + "sources": 1, + "states": 13, + "target_alphabet": 1 + }, + { + "height": 3, + "paid_alphabet": 3, + "replicas": 5, + "sources": 1, + "states": 28, + "target_alphabet": 1 + }, + { + "height": 3, + "paid_alphabet": 3, + "replicas": 5, + "sources": 1, + "states": 28, + "target_alphabet": 1 + } + ], + "collision_witness": { + "cases": [ + { + "distinct_hashes": 1, + "height": 1, + "layer_states": 5, + "sources": 1 + }, + { + "distinct_hashes": 1, + "height": 2, + "layer_states": 25, + "sources": 1 + }, + { + "distinct_hashes": 1, + "height": 3, + "layer_states": 75, + "sources": 1 + }, + { + "distinct_hashes": 1, + "height": 4, + "layer_states": 175, + "sources": 1 + } + ], + "integer_hash_modulus": 2305843009213693951 + }, + "package_hashes": { + "PROOF.md": "1631e28072e1ad39c3833ec83ff7d59e35c4d8fd1ad45ebce6b777aed4125bdb", + "source_index.py": "e978025591b06770026b9879f1e5b10827424f410794fb2b1e1f10a720f49176", + "verify.py": "fb89cad83c3ed69bffaf2a95347b21d26dde4da1dc9c52b4304e7d94d836f623" + }, + "sources_checked": 314, + "status": "PASS_SOURCE_INDEX_PEER_FUNCTIONAL_CHECKS" +} diff --git a/research/lockstep-source-row-index/INITIAL-REVIEW-RESULT.json b/research/lockstep-source-row-index/INITIAL-REVIEW-RESULT.json new file mode 100644 index 0000000000..4921b25dc8 --- /dev/null +++ b/research/lockstep-source-row-index/INITIAL-REVIEW-RESULT.json @@ -0,0 +1,168 @@ +{ + "bounded_cases": [ + { + "height": 0, + "paid_alphabet": 4, + "replicas": 5, + "sources": 3, + "states": 1, + "target_alphabet": 2 + }, + { + "height": 0, + "paid_alphabet": 4, + "replicas": 5, + "sources": 3, + "states": 1, + "target_alphabet": 2 + }, + { + "height": 1, + "paid_alphabet": 4, + "replicas": 5, + "sources": 10, + "states": 5, + "target_alphabet": 2 + }, + { + "height": 1, + "paid_alphabet": 4, + "replicas": 5, + "sources": 10, + "states": 5, + "target_alphabet": 2 + }, + { + "height": 2, + "paid_alphabet": 4, + "replicas": 5, + "sources": 33, + "states": 21, + "target_alphabet": 2 + }, + { + "height": 2, + "paid_alphabet": 4, + "replicas": 5, + "sources": 33, + "states": 21, + "target_alphabet": 2 + }, + { + "height": 3, + "paid_alphabet": 4, + "replicas": 5, + "sources": 107, + "states": 57, + "target_alphabet": 2 + }, + { + "height": 3, + "paid_alphabet": 4, + "replicas": 5, + "sources": 107, + "states": 57, + "target_alphabet": 2 + }, + { + "height": 0, + "paid_alphabet": 3, + "replicas": 5, + "sources": 1, + "states": 1, + "target_alphabet": 1 + }, + { + "height": 0, + "paid_alphabet": 3, + "replicas": 5, + "sources": 1, + "states": 1, + "target_alphabet": 1 + }, + { + "height": 1, + "paid_alphabet": 3, + "replicas": 5, + "sources": 1, + "states": 4, + "target_alphabet": 1 + }, + { + "height": 1, + "paid_alphabet": 3, + "replicas": 5, + "sources": 1, + "states": 4, + "target_alphabet": 1 + }, + { + "height": 2, + "paid_alphabet": 3, + "replicas": 5, + "sources": 1, + "states": 13, + "target_alphabet": 1 + }, + { + "height": 2, + "paid_alphabet": 3, + "replicas": 5, + "sources": 1, + "states": 13, + "target_alphabet": 1 + }, + { + "height": 3, + "paid_alphabet": 3, + "replicas": 5, + "sources": 1, + "states": 28, + "target_alphabet": 1 + }, + { + "height": 3, + "paid_alphabet": 3, + "replicas": 5, + "sources": 1, + "states": 28, + "target_alphabet": 1 + } + ], + "collision_witness": { + "cases": [ + { + "distinct_hashes": 1, + "height": 1, + "layer_states": 5, + "sources": 1 + }, + { + "distinct_hashes": 1, + "height": 2, + "layer_states": 25, + "sources": 1 + }, + { + "distinct_hashes": 1, + "height": 3, + "layer_states": 75, + "sources": 1 + }, + { + "distinct_hashes": 1, + "height": 4, + "layer_states": 175, + "sources": 1 + } + ], + "integer_hash_modulus": 2305843009213693951 + }, + "package_hashes": { + "PROOF.md": "5571b0e6329f620c4bf58e90fb03ce4dfefae95708435739f8fac5e78aa52c9b", + "source_index.py": "589876e684b98bc8441e88079263b64724d64e17f734955362e54d55bfba6e64", + "verify.py": "b753fa3954085ba9eac1837b2e2f1ac64b623c403160ae6fb221ad2dbcf9dbac" + }, + "sources_checked": 314, + "status": "PASS_SOURCE_INDEX_PEER_FUNCTIONAL_CHECKS" +} diff --git a/research/lockstep-source-row-index/NOTICE.md b/research/lockstep-source-row-index/NOTICE.md new file mode 100644 index 0000000000..e31ef217a0 --- /dev/null +++ b/research/lockstep-source-row-index/NOTICE.md @@ -0,0 +1,24 @@ +# Notice + +New source-subtree counting, contiguous indexing, proof and checks: prepared +for Jerry Chen (@CubeJerry), 2026, with substantial OpenAI assistance. +Apache-2.0. + +`inputs/pascal_codec.py` is unchanged from CubeJerry/integer-mult-bounds +commit `91246e5131152ccb1f64a969c36706360861f821`, path +`research/pascal-occurrence-codec/codec.py`. Its header and attribution remain. + +`inputs/finite_dag_audit.py` is unchanged from CrocSwap/integer-mult-bounds +commit `e54523517d0f03e58352e647c403a5af3e525a57`, path +`research/kappa-rebuild/transfer-audit/finite_dag_audit.py`. Its Apache-2.0 +and substantial OpenAI-assistance header remains. Credit zxv and the source's +retained predecessors, especially Jacob Alan Sussman's Theorem 1G flow. + +Mark / Matarener's #4691 live-role work and the #6878 occurrence-layout work +are cited predecessor contracts. This contribution does not claim their +Pascal flow, native semantics or physical tariffs as new results. + +Independent AI peer review identified the initial data-dependent hash-table +complexity defect and the need to price metadata access separately. The +repaired sorted-table implementation, adversarial collision family and +serialized-table bound retain that audit's substance in PROOF.md. diff --git a/research/lockstep-source-row-index/PR.md b/research/lockstep-source-row-index/PR.md new file mode 100644 index 0000000000..e8834ab8f1 --- /dev/null +++ b/research/lockstep-source-row-index/PR.md @@ -0,0 +1,79 @@ +## Change and mathematical scope + +The published [Pascal occurrence codec](https://github.com/CubeJerry/integer-mult-bounds/tree/91246e5131152ccb1f64a969c36706360861f821/research/pascal-occurrence-codec) +left contiguous source indexing open. This adds exact rank/unrank between +fresh source occurrences and every integer in `[0,S_N)`, extending to all +replicated productive rows `[0,a*S_N)`. Owned banks receive no productive +source credit. + +The subtree count depends only on depth, paid-rank product and last paid +rank. With q distinct paid ranks and d target ranks, at most +`1+q*binom(G+q-1,q)` states and `binom(G+d,d)` target multiindices suffice. +This avoids enumerating the chronological class tree or each multinomial +occurrence. The proof includes exact ordering, state/count bit sizes and +separately charged deterministic setup/query work. Sorted level lists and +binary-search count tables remove hash-dispersion assumptions. A separate +serialized-table construction charges metadata access on fixed tapes. + +**No new kappa and no complete assumption discharge.** The selected +conditional value remains 0.00363005817. + +## Why it matters and what is new + +This supplies actual integer row names for the preceding symbolic owner +codec, resolving its first open question and advancing #6878's occurrence +emitter obligation. The inherited Pascal flow, live-role correctness and +rank descent are not new claims. Distinct paid positions retain separate +physical intervals even when their subtree statistics are identical. + +## Verification + +```sh +python3 -I -W error -B research/lockstep-source-row-index/verify.py +python3 -I -W error -O -B research/lockstep-source-row-index/verify.py +``` + +Both modes agree on 102 complete literal small flows and all 1,431 fresh +source ranks/inverses, including replicated row intervals, plus fourteen +rejecting controls. A height-64 fixture needs 4,161 states despite a class +tree exceeding 5*10^30 nodes. A different ordered-word-product counter +corroborates all 4,161 state totals using incoming-unit subtraction. +The exact source-count and interval samples are recorded in VALIDATION.json. + +Independent review found and corrected a worst-case complexity defect in +the initial hash-table implementation. A fixed five-paid-rank rule makes +every same-depth state hash identically; the repaired checker verifies its +3,961 states at height 8. PROOF.md preserves the obstruction and explicitly +separates indexed arithmetic/comparison work from paid serialized scans. + +The unchanged predecessor codec and literal oracle are source-hashed. +The ambient-property test adapter and source-aware comparison are disclosed. +Canonical base: `e54523517d0f03e58352e647c403a5af3e525a57`. +Codec dependency: `91246e5131152ccb1f64a969c36706360861f821`. + +Separate functional and cost-model reviewers passed the repaired snapshot. +The independent checker uses literal ordered role words instead of the +author's source-count recurrence and covers 16 cases, 314 sources and all +1,570 replicated rows; four exact collision families also pass. From this +package directory run `python3 -I -W error -B independent_check.py .`. +REVIEW.md and COST-MODEL-REVIEW.md preserve both the original objection and +the accepted correction; INDEPENDENT-RESULT.json pins the executed snapshot. + +## Limitations and next obligations + +The selected finite product's complete role/paid-owner manifest remains +required. This does not execute source-complement grouping, smaller-rank +substitution, owned allocation, payload access or the physical tape caller. +Its canonical row numbering need not equal incidental numeric IDs in an +older interpreter. Any layout conversion retains its actual movement bill. +All selected native, compiler, precision/tape and analytic conditions remain. +No practical winning-rank materialization, supplier admission, human proof +or formal-kernel acceptance is asserted. + +## Credit + +Prepared for Jerry Chen / **@CubeJerry** with substantial OpenAI assistance. +Credit the preceding occurrence-codec publication and separate root AI review, +Jacob Alan Sussman's lockstep/Pascal construction, zxv's compiler and literal +audit, Mark / Matarener's #4691 executor, and the #6878 geometry lineage. +Original dependency files and notices are unchanged. Apache-2.0. diff --git a/research/lockstep-source-row-index/PROOF.md b/research/lockstep-source-row-index/PROOF.md new file mode 100644 index 0000000000..0016c418cb --- /dev/null +++ b/research/lockstep-source-row-index/PROOF.md @@ -0,0 +1,306 @@ +# Contiguous source indices from aggregated chronological subtrees + +## 1. Domain and declared order + +Use the separated finite rule and the exact occurrence/owner codec at +CubeJerry commit `91246e5131152ccb1f64a969c36706360861f821`, +`research/pascal-occurrence-codec/`. Its fixed role list has W productive +roles of ranks `k_i>=2`, with d distinct target ranks and multiplicities W_i. +There are P ordered paid occurrences with positive ranks strictly below +`k_min`; their q distinct ranks have multiplicities P_r. The actual ambient +cap A satisfies `A>=k_max`. For integer N>=A set + +`G=max{g:A*k_min^g<=N}`. + +A unit `(p,alpha,v)` has `|p|+|alpha|=G`, column +`rho(p)c(alpha)`, fit `A rho(p)c(alpha)<=N`, and +`0<=v0, let r be +the rank of its last paid occurrence. At the root use state `(0,1,0)`. +The state for counting is therefore `(h,rho,r)`; it is not a physical owner ID. + +For any fitting multiindex alpha of degree G-h define the number of fresh +roles per unit by + +`F(h,rho,r;alpha) + = sum_i W_i * 1[h=0 or A*(rho/r)*c(alpha)*k_i>N]`. + +At h=0 the predicate is defined to be true without dividing by zero. The +local source count is + +`C(h,rho,r) + = sum_(|alpha|=G-h, A*rho*c(alpha)<=N) u(alpha)*F(h,rho,r;alpha)`. + +This is the predecessor's exact absence-of-parent test. For a present +parent the complete Pascal interval is available, because `r0. + +Every parent unit supplies exactly one target slot at that paid position; +the inherited bijection supplies all of them. This identity provides an +alternative way to verify the local source counts. It does not merge the +physical fields of distinct classes. + +## 3. Subtree aggregation and polynomial state count + +Let T(h,rho,r) be the total fresh sources in the complete subtree beginning +at that class. At h=G, put T=C. For h0`. To rank a fresh source with path p, start at the root +with offset zero. For every selected paid position j on its path, add the +current class's C and the T values of all preceding paid positions; then +descend to j. This gives the number of sources before the destination class. + +Within that class, for every fitting multiindex beta preceding alpha add +`u(beta)*F(beta)`. For alpha add + +`v*F(alpha) + #{fresh native roles preceding the given role}`. + +Reject a role whose parent is present. This yields an integer in `[0,S_N)`. + +To unrank `x in [0,S_N)`, compare x to the current class's local C. If x=C, subtract C and skip complete child intervals in actual +paid-position order until reaching the one containing x; descend and repeat. +At each descent h increases, so there are at most G descents. Zero-size +intervals are simply skipped. The half-open intervals partition the current +state's total, so a valid x cannot fall outside them. + +Induction over this finite interval decomposition proves both inverse +identities. Consequently fresh source occurrences are in bijection with +every integer in `[0,S_N)`, not merely with a sparse set of large labels. +The distinction between source roles at the same target rank and between +equal-rank paid occurrences is preserved. + +For a positive integer replica count a, the full finite compiler has the +source width `B_N=a*S_N`. Encode a source in replica b as + +`row = b*S_N + rank(source)`, for `0<=b