From cc35ecedce6f208d5056fab6d17c58555affc73c Mon Sep 17 00:00:00 2001 From: Jerry Jiaheng Chen <80299683+CubeJerry@users.noreply.github.com> Date: Wed, 11 Nov 2026 01:04:12 +0800 Subject: [PATCH] Derive balanced CRT node entry from encoded source geometry with fixed owned roles --- .../encoded-balanced-crt-entry/CHECKPOINT.md | 51 + research/encoded-balanced-crt-entry/NOTICE.md | 11 + .../encoded-balanced-crt-entry/OVERLAP.md | 38 + .../PR-DESCRIPTION.md | 39 + .../encoded-balanced-crt-entry/PR-TITLE.txt | 1 + research/encoded-balanced-crt-entry/PROOF.md | 341 ++++ research/encoded-balanced-crt-entry/README.md | 132 ++ .../encoded-balanced-crt-entry/RESULT.json | 1492 +++++++++++++++++ .../encoded-balanced-crt-entry/SOURCES.json | 104 ++ research/encoded-balanced-crt-entry/TASK.json | 95 ++ .../encoded-balanced-crt-entry/VALIDATION.md | 83 + .../encoded-balanced-crt-entry/VERIFY.json | 64 + .../encoded-balanced-crt-entry/frontend.py | 277 +++ .../independent-review/RESULT.json | 581 +++++++ .../independent-review/REVIEW.md | 161 ++ .../independent-review/independent.py | 264 +++ research/encoded-balanced-crt-entry/verify.py | 295 ++++ 17 files changed, 4029 insertions(+) create mode 100644 research/encoded-balanced-crt-entry/CHECKPOINT.md create mode 100644 research/encoded-balanced-crt-entry/NOTICE.md create mode 100644 research/encoded-balanced-crt-entry/OVERLAP.md create mode 100644 research/encoded-balanced-crt-entry/PR-DESCRIPTION.md create mode 100644 research/encoded-balanced-crt-entry/PR-TITLE.txt create mode 100644 research/encoded-balanced-crt-entry/PROOF.md create mode 100644 research/encoded-balanced-crt-entry/README.md create mode 100644 research/encoded-balanced-crt-entry/RESULT.json create mode 100644 research/encoded-balanced-crt-entry/SOURCES.json create mode 100644 research/encoded-balanced-crt-entry/TASK.json create mode 100644 research/encoded-balanced-crt-entry/VALIDATION.md create mode 100644 research/encoded-balanced-crt-entry/VERIFY.json create mode 100644 research/encoded-balanced-crt-entry/frontend.py create mode 100644 research/encoded-balanced-crt-entry/independent-review/RESULT.json create mode 100644 research/encoded-balanced-crt-entry/independent-review/REVIEW.md create mode 100644 research/encoded-balanced-crt-entry/independent-review/independent.py create mode 100644 research/encoded-balanced-crt-entry/verify.py diff --git a/research/encoded-balanced-crt-entry/CHECKPOINT.md b/research/encoded-balanced-crt-entry/CHECKPOINT.md new file mode 100644 index 0000000000..5e35c8322f --- /dev/null +++ b/research/encoded-balanced-crt-entry/CHECKPOINT.md @@ -0,0 +1,51 @@ +# Author-frozen checkpoint; independent review pending + +Base: `e54523517d0f03e58352e647c403a5af3e525a57`. +Branch: `research/continuous-20261110-crt-control`. +Package: `research/encoded-balanced-crt-entry/`. +Recorded on2026-11-10 at author freeze. The universal source-relative argument and +author replay are complete; separate review is still a publication gate. +This checkpoint is not independent acceptance or publication approval. + +## Executed + +Initial registered normal/optimized replay completed in3.813 seconds combined. +After the scoped review corrections, the relabelled receipt was regenerated, +metadata/source-pin checks passed, and both registered modes passed again, +each with `PASS_ENCODED_BALANCED_CRT_ENTRY nodes=14 owned_roles=78 controls=8`. +Four actual-source fixtures cover d=2,4,8; nonzero node starts; changing +half-size; changing numerical precision; invalid left coordinates and +padded right coordinates. Runtime geometry/decode functions in the new +frontend are poisoned, and Port/Word/Arena constructors and Word.inspect +are sealed after the fixed initial inventory is acquired. The unchanged +Entry and numeric producer actually run. All source bytes/head restore, +and all78 owned histories retire blank after complete traversal. + +The oracle independently solves the small CRT congruences by enumeration. +Its decoded values are observer-only and never enter runtime control. +The receipt is frozen and type-sensitive. Twelve scientific source inputs +are authenticated; catalogue/selected provenance is historically pinned. +The eight-axis fixture retains97 extra source-tail cells explicitly. + +## Remaining gates + +The independent source/mathematical review is in progress. Review required +explicit linear-use/current-lease scope and removal of an unsupported +numerical finite-control expansion constant. Those statements are now +corrected: the raw Port-action envelope remains `2^16(M+2)^2`, while the +complete frontend bill is `C_front(M+2)^2` for a fixed unspecified constant. +The written proof covers the cursor invariant, that uniform bill, complete +retained envelope, source input compatibility, and failure boundaries. +Shape-rejection cleanup, early close, fault controls, source pins, metadata +and optimized replay all passed. Committed-tree integrity is the next gate. +No complete CRT row/ROM/payload permutation, binary admission, complete +assumption discharge or kappa improvement is claimed. + +## Next + +Resolve independent review findings if any, preserve its exact receipt, +then perform publication checks. The immediate existing replay: + +```sh +python -B scripts/research_package.py --package research/encoded-balanced-crt-entry +``` diff --git a/research/encoded-balanced-crt-entry/NOTICE.md b/research/encoded-balanced-crt-entry/NOTICE.md new file mode 100644 index 0000000000..da8649d024 --- /dev/null +++ b/research/encoded-balanced-crt-entry/NOTICE.md @@ -0,0 +1,11 @@ +# Attribution + +New tape-driven balanced-node frontend, quantified composition proof and +verification prepared for Jerry Chen / CubeJerry with substantial OpenAI +assistance,2026. Apache-2.0. + +The numerical Entry, producer, physical bank, canonical-word routine and +Word/record semantics are imported unchanged from their authenticated +predecessors. Preserve Ali Romman, JoyboyBrian and all predecessor credits +listed in README.md and in the original source notices. The balanced CRT +identity and general historical-capacity principle are not claimed anew. diff --git a/research/encoded-balanced-crt-entry/OVERLAP.md b/research/encoded-balanced-crt-entry/OVERLAP.md new file mode 100644 index 0000000000..97add055f3 --- /dev/null +++ b/research/encoded-balanced-crt-entry/OVERLAP.md @@ -0,0 +1,38 @@ +# Scope and bounded overlap checkpoint + +Base e54523517d0f03e58352e647c403a5af3e525a57, priority revision 8. +The selected #7000/#7001 record retains all five assumptions at kappa +.00363005817. The task catalogue has older contextual selected references; +the actual selected record governs scientific status. + +The assigned Wave 2 question follows the actual numerical-entry boundary, +after the preceding whole-tree source-state composition retained compiled +topology. The parent approved this explicit narrower scope before code. +The new program derives its axis count, depth, node cursor, half-size and +precision from physical tapes and invokes the actual numerical provider. +It does not merely price a host-generated schedule. + +Relevant predecessors: + +| Work | Retained result | Difference here | +|---|---|---| +| #5053 | Current-coordinate numerical arithmetic | Same exact producer | +| #5219 | Guide-driven Entry and lifecycle | Guide and exact protected words now come from actual selection | +| #5353 | Canonical records from a compiled node | Node selection and widths are tape-driven here | +| #5505 |63-role varying-precision bank | Same exact owner; no new allocator claim | +| #5496/#5625/#6100 | Compiled row query/update/reuse | Row/ROM/source-update topology stays open | +| #5486 | Binary refinement of one fixed u2/t2/y8 repair | No variable geometry or numerical frontend supplied there | +| #6629 | Compact generic routing ROM | Different source and consumer interface | +| Wave 1 whole-tree state | Actual state traversal with compiled topology | No runtime dependency; this package treats numerical node entry only | + +On2026-11-10 the bounded live PR searches covered CRT in titles, encoded CRT, +CRT topology, encoded CRT descriptors and three-epoch text. They returned +the above actual-entry chain and the retained fixed-geometry repair/key +chain; no encoded balanced-node numerical iterator successor was identified +in those returned results. The canonical research-root metadata and exact +relevant README/proof/code sections were also inspected. These searches do +not certify absence of unpublished work or all arbitrary closed-PR diffs. + +No upstream PR or placeholder claim issue is created. The run's local +allocation/checkpoint manifest is maintained by the orchestrator. Source +bytes are read from one shared sparse clone through isolated worktrees. diff --git a/research/encoded-balanced-crt-entry/PR-DESCRIPTION.md b/research/encoded-balanced-crt-entry/PR-DESCRIPTION.md new file mode 100644 index 0000000000..950441623b --- /dev/null +++ b/research/encoded-balanced-crt-entry/PR-DESCRIPTION.md @@ -0,0 +1,39 @@ +## Change and mathematical scope + +Replace the compiled node-selection and precision boundary of the actual CRT numerical entry with a **tape-driven balanced-node frontend**. The controller receives the tagged physical axis stream, counts and halves its records on tapes, maintains node and half-size cursors, constructs canonical current-coordinate inputs and the exact precision guide, and invokes the unchanged #5219 Entry and #5053 numerical producer. Runtime receives no width list, ell, start, level or precision integer. **No new kappa.** + +The new construction uses the unchanged #5505 bank and all its real acquisition/release checks. Eight protected zero words are physically made from the current guide. One actual numerical result remains live until its lease closes; the encoded cursor advances only after retirement. The physical interface is linear-use: consume the current lease once and relinquish its borrowed aliases. Historical Python-handle identity guards are outside that interface. All source bytes/head return, and all historical backing is counted across the complete tree. There are **78 owned roles plus the supplied source**. + +The source-relative theorem covers every admitted dyadic, mixed-width axis source. It pays root count manufacture, each source seek and rewind, all cursor/level transitions, current guard preparation, actual numerical work, output lifetime and cleanup. Additional frontend work is at most `C_front(M+2)^2` for a fixed input-independent constant, plus the sum of the inherited numerical Entry and bank tariffs over the d−1 nodes. Its raw local Port actions satisfy the explicit `2^16(M+2)^2` envelope; no numerical finite-control expansion constant or explicit complete-control majorant is certified. The complete numerical-node traversal is `O(p^4)` for total address width at most p; owned retained storage is `O(p^2)` plus the entire supplied source backing, including older inaccessible tails. + +## Sources and verification + +Base: `e54523517d0f03e58352e647c403a5af3e525a57`. `SOURCES.json` pins 12 scientific inputs and historically pins catalogue/selected provenance separately. #5353 already supplies the canonical projection for a compiled node; #5219 already supplies guide-driven numerical entry; #5505 already supplies varying-precision bank reuse. The new step manufactures node selection and the guide from actual source tapes and binds them to that exact consumer. No predecessor bytes are modified. + +```sh +python3.12 -B scripts/research_package.py --package research/encoded-balanced-crt-entry +``` + +Expected marker: `PASS_ENCODED_BALANCED_CRT_ENTRY nodes=14 owned_roles=78 controls=8`. + +Four complete physical fixtures execute 14 actual numerical nodes, including all seven nodes of an eight-axis tree, nonzero node starts, changing half-size and precision, invalid-left disabling and padded targets. A separate exhaustive congruence oracle checks the actual lower/product words and output records. Runtime geometry/decode names are poisoned and constructors are sealed after initial fixed acquisition. Source snapshots, current guard widths, fixed backing identities and all retired historical tails are checked. The eight-axis fixture retains 3,807 cells including 97 older source-tail cells. + +Eight controls cover supplied host geometry, live reentry/close, a duplicate close before a later entry, stale history, rejected nondyadic shape with actual cleanup, omitted half doubling and a Boolean/integer receipt substitution. The receipt compares a raw-action envelope, not a complete-control numeric constant. Registered normal/optimized runs and the precise review status are recorded in `VALIDATION.md`; finite execution corroborates the written proof. + +## Limits and credit + +This is a **numerical-node iterator**, not the complete CRT state or payload permutation. #5496's row/target selection and h/layer ROM headers, #5625's source-update selection, three-epoch reservoir transport, canonical source production and complete binary numerical lowering remain open. The source-operation count is not a binary-TM tariff. A new constructor does not free an old bank; same-bank whole-iterator restart is not supplied by this API. The selected conditional kappa `.00363005817` and all five assumptions remain unchanged. + +Prepared for **@CubeJerry (Jerry Chen)** with substantial **OpenAI assistance**. Credit Ali Romman's #5353 projection, JoyboyBrian's #5219/#5053/#5505 entry/arithmetic/owner, the #4195 mixed caller, Cinna Davis's #4100 construction, Hiroki KUMAZAKI, ToikY, Tekalign, Jose Manuel, Ross Richardson, Douglas Colkitt, John-Michael Smith and all retained notices. The existing allocator, numerical CRT identity and general historical-capacity principle are not claimed anew. No human or proof-kernel acceptance is represented. + +## Separate review + +An independent worker reviewed the corrected source and proof, deriving the +cursor invariant, canonical-input substitution, exact14P+29 guard lifecycle, +record scan bounds and complete historical storage. A different CRT-sum +oracle checks six actual numerical nodes. Separately,57 topology/input nodes +use actual Entry/Bank with explicitly dummy arithmetic. Normal and optimized +checks pass all78 role histories,16 record calibrations and three controls. +The review required the linear-use lease scope and separation of the exact +raw action envelope from C_front. Its proof, source pins and portable checker +are under independent-review; no human or kernel acceptance is claimed. diff --git a/research/encoded-balanced-crt-entry/PR-TITLE.txt b/research/encoded-balanced-crt-entry/PR-TITLE.txt new file mode 100644 index 0000000000..dece9babf6 --- /dev/null +++ b/research/encoded-balanced-crt-entry/PR-TITLE.txt @@ -0,0 +1 @@ +Derive balanced CRT node selection and precision from the physical source before invoking the numerical producer (no new kappa) diff --git a/research/encoded-balanced-crt-entry/PROOF.md b/research/encoded-balanced-crt-entry/PROOF.md new file mode 100644 index 0000000000..aa22ecfe1e --- /dev/null +++ b/research/encoded-balanced-crt-entry/PROOF.md @@ -0,0 +1,341 @@ +# Tape-driven balanced-node entry into the actual CRT numerical producer + +Prepared for Jerry Chen / @CubeJerry with substantial OpenAI assistance. +Canonical base: `e54523517d0f03e58352e647c403a5af3e525a57`. +All inherited source bytes and proofs are pinned in SOURCES.json. + +## 1. Exact statement and source boundary + +Let d>=2 be a power of two and ell>=2. Declared widths satisfy +h_i in {ell-1,ell}. Supply one physical #5353 axis stream, at head one, +containing ROOT, the positive unary width h_i, WORD_END, its h_i padded +modulus bits, WORD_END, its h_i padded current-coordinate bits, RECORD_END, +for each axis, between LEFT and RIGHT. Moduli satisfy 2<=s_i<2^h_i and +are pairwise coprime; coordinates satisfy 0<=x_i<2^h_i. Thus each h_i>=2 +on the admitted domain. Put + + A=sum_i h_i, M=2+3A+4d, P_G=1+sum_(i in G) h_i. + +M is the framed logical length. Let K_source be the complete supplied +source backing capacity, including any older inaccessible tail after RIGHT. +K_source>=M and no such tail is omitted from storage accounting. + +**Theorem.** The fixed finite-symbol controller `frontend.Iterator`, given +only that stream and its fixed provider modules, enumerates the aligned +balanced nodes in increasing level and increasing start order. At each node +it constructs the exact canonical left/right records and unary guide of +#5353, physically prepares eight exact-P_G protected zero words, and invokes +the unchanged #5219 Entry and #5053 numerical producer using the unchanged +#5505 63-role owner. The result is the actual numerical result for the +current coordinates in that source. The source bytes and head are restored +at every result handoff and close. The consumer follows the linear-use +current-lease protocol in Section 4: one live result at a time, consumed once. + +There are exactly 78 owned physical roles:63 numerical/descriptor roles, +eight protected words and seven topology/width roles. The supplied source +is additional. The program decodes no variable axis count, start, level, +width or precision into a host integer. On full completion or an early +close at a retired boundary, all 78 histories are blank at head one. + +There is a fixed input-independent constant C_front such that the complete +one-lifecycle source-operation bill is at most + + C_front(M+2)^2 + 4096 + + sum_G [2^20(P_G+2)^4 + 2^16(P_G+2)^2 + 4096]. (1) + +The sum has exactly d-1 nodes. It includes each actual numerical invocation +and retirement; reuse does not remove time occurrences. For A<=p the bill +is O(p^4) under the declared near-equal widths. Owned retained storage is O(p^2), +with the explicit rolewise bound in Section 6. +The new frontend alone has the explicit raw local Port-action envelope +2^16(M+2)^2. A numerical finite-control refinement constant is not certified; +C_front includes that remaining fixed factor. Equation (1) is therefore a +uniform asymptotic source bound, not an explicit complete-control constant. + +This is a **numerical-node iterator**, not a CRT permutation of the source +or payload. It does not supply encoded synchronized row/target selection, +ROM-header preparation, three-epoch reservoir transport, source production +or binary lowering of the complete pipeline. Those remain named interfaces. +No complete `analytic_recovery` discharge or new kappa is claimed. + +## 2. Manufacture and maintain the topology on tapes + +The seven roles are `axis`, `depth`, `halve_a`, `halve_b`, `half`, `double` +and `width`. They use the existing fixed record alphabet. In `axis`, ONE +means an ordinary axis, STEP the current node start and VALUE the pending +next node start. None of these symbols contains an unbounded index. + +Construction scans the actual source once. For each validated record it +appends one token both to `axis` and to `halve_a`. The width role is built +from the source's unary header and used to check both padded field extents; +it is cleared before the next record. No source-width array is supplied. + +Repeated pairwise halving of the count tape writes one token to `depth` +per successful halving. A finite parity bit detects an odd count greater +than one. The source count is admitted exactly when it is a power of two +at least two; `depth` then has k=log2(d) tokens. The halving roles are +cleared and reused at each step. `half` starts with one token, and the +first `axis` token becomes STEP. Source and count heads return locally. + +At the beginning of level j, the invariant is: + +- `half` has H=2^(j-1) tokens; +- the depth head is on its jth token; +- STEP occurs at start a, where a is an unprocessed multiple of2H; +- no VALUE marker is live before entry; all other axis cells are ONE; +- source, axis and half heads are at their prescribed entry positions. + +Entry scans the source and axis tape together until STEP. The remaining +source cursor is therefore exactly the first record of that node. It +consumes H records into the left canonical stream and then H into the right +stream, using the half tape as a physical unary counter and rewinding it +between the two groups. It never passes RIGHT prematurely: a is aligned +and 2H divides d. If another node follows, the next axis cell becomes VALUE. +Otherwise the axis cursor is RIGHT and the finite `last` flag is true. +STEP is retained until the numerical result is closed. + +Closing first retires the numerical result and its guards. Only then does +the controller erase STEP and promote VALUE to STEP. At a last node, it +consumes one depth token. If another level exists, it doubles the half tape +through the separate `double` role and marks the first axis. If depth ends, +it retires all seven roles. Thus the invariant advances to the next node or +level, including the last/rightmost node. Induction proves the exact order +and count sum_(j=1)^k d/2^j=d-1. No callback or observer supplies the next +start, level or half size. + +This uniform controller is new. The balanced node order itself is inherited +from the CRT construction and mixed-width caller. The Wave 1 whole-tree +state package still uses compiled topology; this package has no runtime +dependency on that pending contribution. + +## 3. Actual input contract, not an abstract schedule + +For every selected record, `_record` reads the declared unary width and +the actual padded bits. It appends that many guide tokens and copies the +two words to the selected canonical stream. The unchanged #5353 +`canonical_end` removes only high zero padding and retains one bit for zero. +After both groups, the controller appends one extra guide token. Hence +the guide contains exactly P_G tokens and the two streams are bytewise +the same canonical records as an admitted #5353 RowEntry at that node +and synchronized row zero. Row zero activates every selected axis on the +declared width family. No row-zero numerical identity is used: the numerical +result depends on the source values and the selected node, not that row. + +The source scanner restores its physical head to one. It writes no source +cell, including during canonical trimming. It has validated the whole +source's framing at construction, so stopping a later projection after +the selected node does not lose an unexamined shape premise. + +The eight protected words are owned auxiliary roles. Before each entry, +`_prepare_guards` scans the live guide, writes exactly one zero per token +on each role, writes RIGHT, and restores both heads. The eight words are +disjoint from the source and numerical bank. They satisfy the unchanged +dirty-word contract using its admitted all-zero case; a historical old +width is never passed as a new exact-width word. The numerical entry and +producer preserve them. After numerical retirement, local scans erase their +data and markers before any new guide is constructed. + +The complete node modulus product is <2^(P_G-1); P_G>=5 and the selected +groups are nonempty. These are exactly the guide/numerical capacity premises +of #5219/#5053. The old Entry constructs its templates and padded records +from the actual guide, with its existing `Extent` rather than a decoded P. +Its numerical producer is unchanged and actually invoked. + +The #5505 Bank is unchanged. It still acquires the three canonical/guide +roles first, then56 private numerical words, a template, and three padded +input/output streams:63 roles. Its public `open` call has a fixed legacy +signature; the new controller passes `None` in every compiled-geometry +position and supplies the actual new scanner through its bridge argument. +The scanner rejects any non-None geometry argument. Its `active` is the +fixed successful-node case. All source/protected alias, acquisition-count, +marker, head and release checks remain the actual predecessor checks. + +This substitution is justified by the identical canonical inputs and +guide, identical acquisition sequence, and source restoration just proved. +It does not infer compatibility merely from similarly named interfaces. +The existing producer's left-invalid disabling and padded-right semantics +are inherited. It computes current-coordinate CRT reconstruction, not a +host reconstruction from purported original digits. + +## 4. Handoff, retirement and failure boundary + +The physical interface has three finite phases: retired, current-result-live +and complete. Calling next in the retired phase acquires the single current +result; its one close consumes that result and returns to retired or complete. +The consumer may inspect or use the current output according to the inherited +port contract, then must relinquish the lease and its borrowed output aliases. +It may not retain a consumed lease as a token to submit after a later next. +These are linear-use preconditions, not a runtime generation-validation API. + +The numerical lower/product words and output stream remain live in their +actual bank until the returned lease closes. Their production, framing, +head returns, pending capacity and subsequent disposal enter the numerical +bill. The iterator hands off these owned roles; it does not claim a free +copy to an external consumer. Any consumer's additional copy or routing +must be paid by that consumer. The observer in verify.py is outside runtime +and never supplies a value or branch to it. + +Closing consumes the numerical result, closes Entry, retires the three +canonical/guide roles and eight protected words, and releases the bank +before advancing the encoded cursor. Every numerical role follows #5505's +delimiter-driven varying-precision reentry. A shorter new use cannot expose +old numerical data, since the historical suffix was blank before entry. +Longer use grows only by local writes. The topology roles obey the same +append/clear discipline. No list backing is replaced or shortened. + +An early iterator close is allowed only at a retired node boundary and +clears all remaining topology roles. Current-phase errors, such as next or +iterator close while a current result is live, or a second close before any +later next, require no tape traffic and can be rejected by the finite phase +state. Charge a fixed input-independent C_reject for each such external +attempt. An arbitrary count of rejected or post-completion calls is not +hidden inside a single-lifecycle bound. One terminal next() returning None +is included in(1). + +The Python interpreter additionally checks each NodeLease object's closed +flag, even if an external client retains that old object through later +entries. This convenience guard is outside the physical error interface: +no constant-space validation of an unbounded history of stale host identities +is claimed. Under the linear-use protocol, the fixed current continuation +fields can be reused at each node. The interpreter's fresh wrapper objects +and an observer's retained trace are not extra physical tape roles. The +duplicate-close control in verify.py runs before a later next, so its physical +analogue is exactly the retired-phase error just specified. + +During initial shape preparation, a framing or nondyadic-count ValueError +restores the source head and retires all seven preparation roles. Numerical +entry has not begun, and the 63 bank and eight guard roles are still blank. +For a well-framed finite source whose count is rejected, this cleanup has +the same quadratic frontend allowance. The domain does not claim rollback +after a later violated arithmetic/coprimality premise, arbitrary external +port corruption, interruption, or malicious consumer mutation. + +## 5. Complete source-operation time + +The cost unit is the retained fixed-alphabet source operation: local symbol +reads/writes, unit head movement and bounded finite control. It is not a +literal binary-TM transition or a count of Python heap operations. + +Here is a conservative audit of the new frontend. For a record with width h, +all width manufacture/rewinds, two field scans, optional guide/canonical +copies, canonical trimming and width retirement use fewer than 64(3h+4) +raw Port actions. This follows by charging each width/field bit for its +read, copy, unit moves and both return scans; canonical trimming visits at +most h cells per word. Record and endpoint constants are covered by the +four tags in3h+4. Thus a prefix-plus-node source scan costs at most64M. +It includes a rightmost node, which may require the entire source. + +For one protected word, direct expansion of the unchanged Port methods gives +9P+14 raw preparation actions and 5P+15 retirement actions. The total is +14P+29, so all eight words use at most128(P+2)<=128M actions. This count +includes the guide scan and its repeated rewinds; it is not the compiled +constant-width preparation count from the earlier whole-tree package. + +Source/axis rewinds, half-counter passes, pending-cursor installation, +canonical/guide endpoint formation and retirement, and cursor advancement +bring the new per-node raw-action allowance below 512(M+2). Reentry/release +of the 63 numerical roles is separately paid by the inherited4096 allowance. +Root shape manufacture plus rejected-shape or final cleanup is below +512(M+2). Pairwise count reduction processes fewer than 2d tokens in total. +Half doubling across completed levels processes fewer than d tokens in +total and adds less than 128(d+2) actions. These charges count every reset, +not only the initial source scan. + +There are d-1 nodes. Including the initial/final allowance, the preceding +raw counts are bounded by 512d(M+2)+128(d+2), which is below +2^16(M+2)^2 for d<=M and M>=22. This is an explicit envelope for the new +local reads, writes and unit moves; it does not count a particular expansion +into primitive finite-control instructions. The verifier's numerical +comparison uses this raw-action envelope only. + +For the complete source bound, all additional control is a fixed finite +refinement. The seven dictionary keys and all role selections are fixed; +the role loops have lengths two, three, seven or eight. The remaining variable +loops read a local tape symbol on each iteration. Their predicates inspect +fixed-alphabet symbols, finite flags, or identities among the fixed role +slots. There is no recursive call or input-sized host-container traversal; +the call depth is fixed. Under the linear-use interface, the current entry, +lease and provider references are a fixed set of reusable continuation +fields. Expanding these finite blocks gives some fixed multiplier for +each local action and a fixed allowance per entry/exit. Their exact +primitive-instruction counts have not been enumerated here, so no numerical +multiplier such as32 is asserted. Since the numbers of nodes and levels +are at most d, a fixed input-independent C_front bounds all this control +and the raw actions by C_front(M+2)^2. This proves the first term of(1) +without inferring a universal constant from the finite measurements. +The predecessor arithmetic remains in its own source tariff. + +The unchanged Entry/numerical theorem contributes +2^20(P_G+2)^4+2^16(P_G+2)^2 per node. The unchanged bank contributes4096 +initially and 4096 per node. These and the frontend give(1). There is no +unfunded setup, cleanup, source seek, final-node or output-lifetime term. + +For completeness, near-equal widths imply d(ell-1)<=A<=p. Summing by node +size n=2^j, with d/n nodes per level, gives + + sum_G(P_G+2)^4 < (8/7)(ell+3)^4 d^4 <=715p^4, + sum_G(P_G+2)^2 < 2(ell+2)^2 d^2 <=32p^2. + +The second geometric series has ratio2. The proof does not reuse the false +4/3 coefficient corrected in Wave 1 review. Also M<=8p and d<=p. Hence(1) +is O(p^4), with a constant depending on the fixed frontend refinement. +No explicit complete-control numerical majorant is asserted. This is a +numerical-node statement. It is not a full E(p,ell) bit-step theorem +or a complete multiplier bound. + +## 6. All historical storage + +Write P*=A+1. #5505's rolewise bounds apply because the new canonical inputs +and guide have the same formats and acquisition order. A safe envelope for +all 63 roles is + + (P*+1) + 2(2A+2d+2) +57(P*+2) +3[d(P*+2)+2]. (2) + +This includes transient canonical padding before high-zero trimming. +The guide, canonical left/right streams,57 word/template roles and three +padded streams are all separate physical backings. It bounds the maximum +of each role's entire history, then sums; it does not take the maximum of +standalone aggregate node storage. + +The eight protected roles add8(P*+2). Each of axis, depth, the two halving +roles, half and double has capacity at most d+2; width has capacity at most +A+2. Both endpoints and every retained blank tail are counted. Including +the supplied source, the complete envelope is + + K_source + (2) + 8(P*+2) +6(d+2)+(A+2). (3) + +There are78 owned roles plus source. For A<=p, (3) is K_source+O(p^2). +It becomes O(p^2) including source when K_source=O(p^2), in particular for +the exact framed input. The source +production workspace and any external result consumer are separate, +explicit boundaries. The bound counts retained tape cells, not Python +allocator capacity. No erased cell is treated as physically deallocated. +The theorem covers one iterator lifecycle; constructing another fresh +iterator does not entitle an enclosing caller to discard the previous +78-role backing. Same-bank whole-iterator restart is not an implemented API +here and would require its own entry/marker argument. + +## 7. Evidence and next obligation + +The verifier executes14 actual numerical nodes in four complete trees, +including nonzero starts, changing half-size and precision, invalid-left +disabling and padded right coordinates. One fixture traverses all seven +nodes of an eight-axis tree. It independently solves the small congruences +by exhaustive integer search and compares the actual lower/product words +and complete numerical output records. The oracle is observation only. + +Runtime geometry/decoding names in the new module are poisoned; physical +constructors and Word.inspect are sealed after initial fixed acquisition. +Every source snapshot, bank identity, protected current extent and complete +retired historical tail is checked. Controls detect live reentry/close, +double close, a supplied host geometry, stale history, malformed dyadic +count with actual cleanup, omitted half doubling, and a Boolean/integer +receipt substitution. Finite execution corroborates the written proof. + +The next consumer seam is the actual #5496 row query: it still takes a +compiled row/target selection and manufactures h/layer ROM headers from +host constants. This iterator supplies its numerical input objects, but +does not yet replace those remaining arguments or update source coordinates +between synchronized rows. Encoded row selection and retirement-before-write +binding must be proved before claiming a uniform whole-tree CRT transform. +All five selected assumptions and kappa .00363005817 retain their status. diff --git a/research/encoded-balanced-crt-entry/README.md b/research/encoded-balanced-crt-entry/README.md new file mode 100644 index 0000000000..702212a042 --- /dev/null +++ b/research/encoded-balanced-crt-entry/README.md @@ -0,0 +1,132 @@ +# Derive balanced CRT node entry from the physical axis stream + +This package removes the host node-selection and precision arguments from +the numerical-entry part of the CRT pipeline. One fixed finite-symbol +controller counts the actual axis records, manufactures a depth counter, +maintains half-size and node cursors on tapes, projects the current records, +and invokes the unchanged numerical Entry and CRT producer. The program +receives no width list, ell, start, level or numerical precision. + +**No new kappa.** This is a source-relative numerical-node iterator and +quantified interface proof, not the complete CRT permutation or a full +foundational-assumption discharge. + +## Actual result + +For every admitted dyadic axis source of #5353, the iterator visits all +aligned nodes in level/start order. The actual source scans generate the +canonical left/right records and exact precision guide consumed by #5219 +and #5053. Eight protected zero words are physically prepared from that +guide. The unchanged #5505 bank supplies the same 63 numerical backings as +node size, source position and precision change. All legacy geometry +arguments to its fixed call signature are None; the new bridge rejects +any supplied host geometry. + +One live numerical result is handed off at a time. Closing it retires the +result before the encoded cursor advances. This is a linear-use current-lease +interface: consume the current result once and relinquish its borrowed +aliases. Retaining old Python lease objects does not provide a physical +stale-handle validation service. The source bytes and head are +restored at every boundary, and every older retained tail remains counted. +There are **78 owned roles plus the supplied source**:63 numerical, eight +protected, and seven topology/width roles. + +[PROOF.md](PROOF.md) proves the encoded cursor/half-size invariant, exact +provider-input compatibility, lifecycle, complete per-tape historical +storage, and source-operation budget. If A is the sum of declared widths, +M=2+3A+4d and P_G is the current node precision, the full bill is + +```text +C_front(M+2)^2 +4096 + +sum_nodes [2^20(P_G+2)^4 +2^16(P_G+2)^2 +4096]. +``` + +C_front is fixed and input-independent. The new frontend's raw local Port +actions have the explicit envelope `2^16(M+2)^2`; the numerical expansion +constant for its finite control has not been certified. The complete bill +above retains that constant explicitly, and no explicit complete-control +numeric majorant is claimed. + +This pays root count manufacture, source seeks and rewinds, each cursor and +level change, current guard preparation, the actual numerical operations, +pending output and all retirement. It includes the last/rightmost node. +For A<=p in the near-equal-width family it is O(p^4), with O(p^2) owned +retained tape cells plus the entire supplied source backing, including old +tails after its framed RIGHT. The source must still be supplied and its production paid by +the enclosing caller; source operations are not silently identified with +binary TM steps. + +## Evidence + +[RESULT.json](RESULT.json) records14 actual numerical nodes in four full +trees with 2,4 and 8 axes. The first four-axis case has a nonzero node start +and precisions7,5,11 on the same 78 roles. It performs370,212 measured Port +and numerical actions and retains1,135 cells including the source. The +eight-axis case executes all seven nodes, with 6,897,342 measured actions +and 3,807 retained cells, including 97 pre-existing source-tail cells. These counts corroborate the conservative proof; +they are not asymptotic extrapolations or literal binary instruction counts. + +An independent exhaustive congruence oracle checks actual lower/product +words and complete output records. Observer decoding never supplies a +runtime value. Runtime geometry/decode names are poisoned in the new +module, and physical constructors plus Word.inspect are sealed after fixed +initial acquisition. Source snapshots, stable backing identity, exact +current guards and complete blank histories are checked at every node. + +Eight controls detect a supplied host geometry, live reentry/close, a duplicate +close before a later entry, stale retained data, nondyadic source count with actual cleanup, +omitted half doubling and a Boolean/integer receipt substitution. The +nondyadic preparation uses 1,454 measured actions and restores its source +and all 78 owned histories. The proof separately retains the cost of each +rejected external call; arbitrarily many requests do not become free. +The receipt's `raw_action_bound` compares measured tape actions only; +it does not numerically certify C_front. + +## Reproduce + +Python 3.12, standard library only, from repository root: + +```sh +python3.12 -B scripts/research_package.py --package research/encoded-balanced-crt-entry --check-only +python3.12 -B scripts/research_package.py --package research/encoded-balanced-crt-entry +``` + +Both registered modes authenticate12 scientific source inputs and compare +the same type-sensitive frozen receipt. Expected marker: +`PASS_ENCODED_BALANCED_CRT_ENTRY nodes=14 owned_roles=78 controls=8`. +The exact executed checks and independent review status are recorded in +[VALIDATION.md](VALIDATION.md). + +## Scope and sources + +The canonical base is`e54523517d0f03e58352e647c403a5af3e525a57`. The current +selected kappa`.00363005817` and all five assumptions remain unchanged. +[OVERLAP.md](OVERLAP.md) records the bounded successor search and the +distinction from compiled whole-tree control and fixed small repair programs. +No predecessor or selected file is changed. + +## Open next questions + +The next actual consumer is #5496's row query. Its active-target selection, +local row, h/layer ROM headers and coordinate flip still use compiled +geometry. The #5625 source-update consumer also retains compiled selection. +Replacing those arguments and preserving the numerical lease across the +correct lifetime is required before a uniform whole-tree state transform +can be claimed. Three-epoch reservoir transport, payload routing, complete +binary numerical lowering and canonical source production also remain open. +This API covers one full iterator lifecycle; whole-iterator restart on the +same 78 roles is a further caller obligation, not free fresh allocation. + +An all-size fixed-source controller is the new result. No full production +payload replay, selected cold replay, human review or proof-kernel acceptance +is claimed. The inherited numerical/source-operation contracts stay explicit. + +## Credit + +Prepared for **Jerry Chen / @CubeJerry** with substantial **OpenAI assistance**. +Apache-2.0. Credit Ali Romman's #5353 canonical projection; JoyboyBrian's +#5219 Entry, #5053 numerical producer and #5505 persistent bank; the retained +#4195 mixed-width caller and #4100 balanced CRT construction; Hiroki KUMAZAKI, +Cinna Davis, ToikY, Tekalign, Jose Manuel, Ross Richardson, Douglas Colkitt, +John-Michael Smith and the inherited source notices. The allocator and +historical-maximum principle are retained predecessors, not new claims. diff --git a/research/encoded-balanced-crt-entry/RESULT.json b/research/encoded-balanced-crt-entry/RESULT.json new file mode 100644 index 0000000000..3cf59b6c95 --- /dev/null +++ b/research/encoded-balanced-crt-entry/RESULT.json @@ -0,0 +1,1492 @@ +{ + "status": "PASS_ENCODED_BALANCED_CRT_ENTRY", + "cases": [ + { + "name": "changing_half_and_nonzero_start", + "moduli": [ + 5, + 7, + 3, + 2 + ], + "widths": [ + 3, + 3, + 2, + 2 + ], + "values": [ + 3, + 2, + 1, + 1 + ], + "source_length": 48, + "source_backing": 48, + "trace": [ + { + "level": 1, + "start": 0, + "half": 1, + "precision": 7, + "lower": 3, + "product": 5, + "output": [ + [ + 2, + 4 + ] + ], + "retained": [ + 8, + 11, + 11, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 20, + 20, + 20, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 6, + 4, + 6, + 4, + 3, + 1, + 5 + ] + }, + { + "level": 1, + "start": 2, + "half": 1, + "precision": 5, + "lower": 1, + "product": 3, + "output": [ + [ + 1, + 0 + ] + ], + "retained": [ + 8, + 11, + 11, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 20, + 20, + 20, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 6, + 4, + 6, + 4, + 4, + 3, + 5 + ] + }, + { + "level": 2, + "start": 0, + "half": 2, + "precision": 11, + "lower": 3, + "product": 35, + "output": [ + [ + 0, + 1 + ], + [ + 1, + 0 + ] + ], + "retained": [ + 12, + 20, + 16, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 54, + 54, + 54, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 6, + 4, + 6, + 4, + 4, + 3, + 5 + ] + } + ], + "actions": 370212, + "raw_action_bound": 39529168896, + "retained_total": 1135, + "owned_roles": 78 + }, + { + "name": "invalid_left_and_padded_right", + "moduli": [ + 7, + 3 + ], + "widths": [ + 3, + 2 + ], + "values": [ + 7, + 3 + ], + "source_length": 25, + "source_backing": 25, + "trace": [ + { + "level": 1, + "start": 0, + "half": 1, + "precision": 6, + "lower": 0, + "product": 7, + "output": [ + [ + 0, + 3 + ] + ], + "retained": [ + 7, + 12, + 10, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 18, + 18, + 18, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 4, + 3, + 4, + 3, + 3, + 1, + 5 + ] + } + ], + "actions": 45062, + "raw_action_bound": 4346945536, + "retained_total": 651, + "owned_roles": 78 + }, + { + "name": "wide_declared_axes", + "moduli": [ + 7, + 5, + 3, + 2 + ], + "widths": [ + 4, + 4, + 3, + 3 + ], + "values": [ + 6, + 4, + 2, + 1 + ], + "source_length": 60, + "source_backing": 60, + "trace": [ + { + "level": 1, + "start": 0, + "half": 1, + "precision": 9, + "lower": 6, + "product": 7, + "output": [ + [ + 3, + 2 + ] + ], + "retained": [ + 10, + 12, + 12, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 24, + 24, + 24, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 6, + 4, + 6, + 4, + 3, + 1, + 6 + ] + }, + { + "level": 1, + "start": 2, + "half": 1, + "precision": 7, + "lower": 2, + "product": 3, + "output": [ + [ + 0, + 1 + ] + ], + "retained": [ + 10, + 12, + 12, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 24, + 24, + 24, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 6, + 4, + 6, + 4, + 4, + 3, + 6 + ] + }, + { + "level": 2, + "start": 0, + "half": 2, + "precision": 15, + "lower": 13, + "product": 35, + "output": [ + [ + 2, + 1 + ], + [ + 1, + 0 + ] + ], + "retained": [ + 16, + 22, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 70, + 70, + 70, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 6, + 4, + 6, + 4, + 4, + 3, + 6 + ] + } + ], + "actions": 553706, + "raw_action_bound": 110094139392, + "retained_total": 1463, + "owned_roles": 78 + }, + { + "name": "eight_axis_tree", + "moduli": [ + 3, + 5, + 7, + 11, + 13, + 17, + 19, + 23 + ], + "widths": [ + 4, + 4, + 4, + 4, + 4, + 5, + 5, + 5 + ], + "values": [ + 2, + 4, + 6, + 10, + 12, + 16, + 18, + 22 + ], + "source_length": 139, + "source_backing": 236, + "trace": [ + { + "level": 1, + "start": 0, + "half": 1, + "precision": 9, + "lower": 2, + "product": 3, + "output": [ + [ + 4, + 3 + ] + ], + "retained": [ + 10, + 10, + 12, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 24, + 24, + 24, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 10, + 5, + 10, + 6, + 3, + 1, + 7 + ] + }, + { + "level": 1, + "start": 2, + "half": 1, + "precision": 9, + "lower": 6, + "product": 7, + "output": [ + [ + 4, + 3 + ] + ], + "retained": [ + 10, + 12, + 14, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 24, + 24, + 24, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 10, + 5, + 10, + 6, + 3, + 1, + 7 + ] + }, + { + "level": 1, + "start": 4, + "half": 1, + "precision": 10, + "lower": 12, + "product": 13, + "output": [ + [ + 14, + 13 + ] + ], + "retained": [ + 11, + 14, + 16, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 26, + 26, + 26, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 10, + 5, + 10, + 6, + 3, + 1, + 7 + ] + }, + { + "level": 1, + "start": 6, + "half": 1, + "precision": 11, + "lower": 18, + "product": 19, + "output": [ + [ + 7, + 6 + ] + ], + "retained": [ + 12, + 16, + 16, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 28, + 28, + 28, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 10, + 5, + 10, + 6, + 4, + 3, + 7 + ] + }, + { + "level": 2, + "start": 0, + "half": 2, + "precision": 17, + "lower": 2, + "product": 15, + "output": [ + [ + 2, + 1 + ], + [ + 4, + 3 + ] + ], + "retained": [ + 18, + 20, + 24, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 78, + 78, + 78, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 10, + 5, + 10, + 6, + 4, + 3, + 7 + ] + }, + { + "level": 2, + "start": 4, + "half": 2, + "precision": 20, + "lower": 38, + "product": 221, + "output": [ + [ + 0, + 18 + ], + [ + 10, + 9 + ] + ], + "retained": [ + 21, + 28, + 30, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 90, + 90, + 90, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 10, + 5, + 10, + 6, + 6, + 4, + 7 + ] + }, + { + "level": 3, + "start": 0, + "half": 4, + "precision": 36, + "lower": 797, + "product": 1155, + "output": [ + [ + 11, + 10 + ], + [ + 8, + 7 + ], + [ + 2, + 1 + ], + [ + 2, + 1 + ] + ], + "retained": [ + 37, + 42, + 56, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 306, + 306, + 306, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 38, + 10, + 5, + 10, + 6, + 6, + 4, + 7 + ] + } + ], + "actions": 6897342, + "raw_action_bound": 2652595650560, + "retained_total": 3807, + "owned_roles": 78 + } + ], + "host_geometry_poisoned": true, + "runtime_constructors_sealed": true, + "cost_scope": "raw_action_envelope; complete_source_constant_unspecified", + "lease_scope": "linear_use_current_lease; historical_host_handles_excluded", + "full_crt_permutation": false, + "new_kappa": null, + "source_count": 12, + "controls": { + "rejections": [ + "host_geometry_argument", + "live_next", + "live_iterator_close", + "double_lease_close", + "stale_retired_history", + "nondyadic_shape_with_cleanup", + "omitted_half_size_doubling", + "typed_receipt_boolean_integer" + ], + "rejected_shape_actions": 1454, + "early_close_restores": true + } +} diff --git a/research/encoded-balanced-crt-entry/SOURCES.json b/research/encoded-balanced-crt-entry/SOURCES.json new file mode 100644 index 0000000000..8748c790cd --- /dev/null +++ b/research/encoded-balanced-crt-entry/SOURCES.json @@ -0,0 +1,104 @@ +{ + "schema_version": 1, + "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "files": [ + { + "path": "research/r437-preparation-composition/predecessor4025/source/words.py", + "usage": "input", + "git_blob": "8d4ba37e2778acb35b34e0719df2caf138fbeb50", + "sha256": "5c37f57708ba3131bdcb03139f9dbc29886bee44569c09cbba51b68f75acd7f9", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57" + }, + { + "path": "research/r437-preparation-composition/predecessor4025/source/records.py", + "usage": "input", + "git_blob": "4f00467a0ff580954ad2fd0c7380240c753ddef3", + "sha256": "0c9c4b23e998597fb877bb1a29da69ac869b68262abe635b162b4dba9c69b372", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57" + }, + { + "path": "research/encoded-crt-entry-lifecycle/entry.py", + "usage": "input", + "git_blob": "1fa2b0cb88320d4f5b623554bb0fc6de332b773c", + "sha256": "0537ec98f306270c8ff6a424841886cf53f675d9947029347090c7dc779616d7", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57" + }, + { + "path": "research/encoded-crt-entry-lifecycle/PROOF.md", + "usage": "input", + "git_blob": "8c9d971a3d3e5a75637e3279ed8f7f89b0c6a566", + "sha256": "a619be48c8c85749ea5411929aa6ff3986443b467133d32d19d543250b0054b0", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57" + }, + { + "path": "research/encoded-current-crt/producer.py", + "usage": "input", + "git_blob": "a327b0161eca57a1cc44ec2aa8e3defed2167ddc", + "sha256": "88dab4ca02a92164a67826db361214fa1405e4b4a588f8c4279a21bcee95ab76", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57" + }, + { + "path": "research/encoded-current-crt/PROOF.md", + "usage": "input", + "git_blob": "286ab05ba7ab500e5b86268384545dcec8862d1c", + "sha256": "7da614e737414a373c8716158f2c02a52666620ea1f114fac7ca09b3b38489bc", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57" + }, + { + "path": "research/crt-persistent-numerical-owner/owner.py", + "usage": "input", + "git_blob": "20ef3519b6fef691ec92b7315e320b5e8ce9bf18", + "sha256": "1d73f432f8de9c791260c43335eb207d82bbb3f5b190cc76d0d914a4db076f41", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57" + }, + { + "path": "research/crt-persistent-numerical-owner/PROOF.md", + "usage": "input", + "git_blob": "564493e426b6ab60a5a8890811f66ca3ce8ea78a", + "sha256": "9a76f73d1fd582cb66cd490de3a71bb1255049e920a00af72e762243909dc08e", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57" + }, + { + "path": "research/crt-persistent-numerical-owner/README.md", + "usage": "input", + "git_blob": "d5533824e7ae2b9933b081a7f50f2ade60bd2d51", + "sha256": "c605a3b0c38f29c91c3c954bb8dc49018f8717379acbcc4be9c66fee443531e8", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57" + }, + { + "path": "research/crt-mixed-row-entry/bridge.py", + "usage": "input", + "git_blob": "57f6853e262a6136bc616f1e47a31d0ace28495c", + "sha256": "89c38638c0d66da731566c903c32e7fa1ad31088d29cfd2634fce823dd07c1f9", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57" + }, + { + "path": "research/crt-mixed-row-entry/PROOF.md", + "usage": "input", + "git_blob": "76e75e002b5c5860a43b2fe6313ba4339efcc3ff", + "sha256": "8a529ece497c62d5225261cdacebfd88979322b3a8886d1a31eb6295f1989e4b", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57" + }, + { + "path": "research/crt-mixed-row-entry/README.md", + "usage": "input", + "git_blob": "14b1ab67d5fbf879be952087ca02a0628617dec5", + "sha256": "355cb36dddf59a3f7db0c04543ee075bf4bf9d9f4b9eab7cf489b2eefdefebd2", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "3404fbdd5e7529a0674eef26114b5071e4586cec", + "sha256": "ead6cdc9d0af6d58e8a49744d8ec8c7c15e13d2ba93c276c434bcf9b51b93a81", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57" + }, + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "75d77b328ea02ded535e7f23aee5b1e55d0bb1a8", + "sha256": "154c3d30455d778fd3343b6b4851f0fa4665f0f7625b0adb3675e2bafbbf6bf1", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57" + } + ] +} diff --git a/research/encoded-balanced-crt-entry/TASK.json b/research/encoded-balanced-crt-entry/TASK.json new file mode 100644 index 0000000000..a70117565d --- /dev/null +++ b/research/encoded-balanced-crt-entry/TASK.json @@ -0,0 +1,95 @@ +{ + "schema_version": 1, + "task_id": "uniform-transfer-audit", + "priority_revision": 8, + "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "original_card": { + "id": "uniform-transfer-audit", + "question": "Can one of the selected record's five inherited assumptions be proved at its actual caller?", + "starting_points": [ + "docs/research/current-priorities.md", + "docs/research/research-family-status.md", + "certificates/selected-result.json", + "docs/research/pr-intake-evidence/pr5599-completion/PROOF-REVIEW.md" + ], + "methods": [ + "Construct and independently check one source-bound instance of the stated first experiment.", + "Seek an exact counterexample or target-specific complete-budget obstruction to that same proposed change." + ], + "acceptance_gate": "Identify the proposition and what would change downstream; do not equate a finite replay with a universal proof.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_selected_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Read revision 8, the selected review and live exact-source handoffs. Then follow this card's bounded first_experiment.", + "scope": "Source-bound orientation only, not a supplier replay or theorem proof." + }, + "first_experiment": "Choose one assumption ID (native_all_columns, owned_erasure, compiler, precision_tape, analytic_recovery), one quantified implication and exact dependency closure. Check current handoffs, including #5625 row reentry and #5707 root-prefix lowering, without treating their partial scope as the whole theorem. Prove or falsify that implication with a caller-bound argument; stop at the chosen obligation. Finite tests or root digits do not discharge an all-size statement.", + "bottleneck_link": "Judge the actual current supplier contract and complete signed target/paid bill; frozen-profile ceilings require an applicability proof.", + "allowed_variations": [ + "One exact source head, helper/cut region or quantified proposition and changed hypothesis; check live handoffs first. Different seeds are not different scopes." + ], + "scope_change_triggers": [ + "Changing source head, helper/cut domain, operation alphabet or caller boundary without recording the new scope.", + "Treating an archived proposal or local numerical pass as complete supplier admission." + ], + "overlap_terms": [ + "native_all_columns", + "owned_erasure", + "compiler", + "precision_tape", + "analytic_recovery" + ], + "existing_checks": [ + { + "scope": "PR #4100: proposed unconditional construction and finite checks, without independent acceptance.", + "evidence": "research/unconditional-batched-crt/README.md", + "remaining": "Independent proof audit of one caller-bound all-size implication; all other premises remain explicit.", + "status": "author-checked", + "source_commit": "337d04939571a637aeab54a0f58f54fde811663a", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "Selected PR5599: complete helper-subspace construction and independent caller replay; five framework assumptions remain.", + "evidence": "docs/research/pr-intake-evidence/pr5599-completion/PROOF-REVIEW.md", + "remaining": "The next experiment must identify uncovered source-specific work. Successor archive intake does not transfer this admission.", + "status": "reviewed", + "source_commit": "09dd0965711ca7eeb169057a420abab1c9052137", + "selected_record_sha256": "2a0220e866417774606e0f991e41b9c1d26b1f43b97857238cf478dbc7d330b5" + } + ] + }, + "scope_status": "refined", + "actual_scope": "Execute a tape-driven balanced-node selector and actual numerical Entry consumer without host geometry, with complete source/cursor/guide/guard lifecycle and historical backing.", + "scope_change_reason": "Wave1 retained compiled topology; #5353 numerical entry still takes host node/width arguments. This package manufactures encoded balanced-node selection and invokes its actual numerical consumer, leaving row/ROM/update topology open.", + "bottleneck_link": "Reduces the analytic_recovery uniform control boundary through one actual numerical provider-consumer seam; no complete assumption or multiplication bound is claimed.", + "budget_minutes": 90, + "stop_rule": "At most70 minutes implementation and20 minutes proof/review. Stop if a nonzero-start/changing-half fixture needs a host geometry decode or silently changed provider premise. Finish exact scope, complete source/cursor/guard/output cost, role histories, controls and independent review; do not expand into row/ROM or full CRT payload execution.", + "outcome": "completed", + "evidence": "PROOF.md; RESULT.json; source-authenticated normal/optimized registered replay; independent review when completed", + "author": "Jerry Chen / CubeJerry", + "ai_assistance": "Substantial OpenAI assistance; independent AI source/proof review, not human or proof-kernel acceptance", + "open_questions": [ + { + "question": "How can the actual current-row query derive its synchronized row, active target and h/layer ROM headers from encoded geometry?", + "first_step": "Consume the numerical lease provided here and replace one compiled target/row header in #5496 with actual tape-driven selection.", + "blocked_by": "Current RowQuery still uses widths, ell, level, start and row as host constants.", + "why_it_matters": "This is a named remaining interface before the whole CRT caller can be uniform and completely charged." + }, + { + "question": "Can this numerical iterator be bound to a complete changing-source row update?", + "first_step": "Compose encoded row selection with #5625 retirement-before-write consumer and the retained whole-tree ordering.", + "blocked_by": "The source update consumer also retains compiled geometry.", + "why_it_matters": "This is a named remaining interface before the whole CRT caller can be uniform and completely charged." + }, + { + "question": "What complete binary transition and source-production cost admits the resulting caller?", + "first_step": "Bind canonical axis production, geometry transport and numerical arithmetic to one fixed tape representation and charge each seam.", + "blocked_by": "Neither this source operation theorem nor a fixed small repair refinement supplies that complete bit-step caller.", + "why_it_matters": "This is a named remaining interface before the whole CRT caller can be uniform and completely charged." + } + ] +} diff --git a/research/encoded-balanced-crt-entry/VALIDATION.md b/research/encoded-balanced-crt-entry/VALIDATION.md new file mode 100644 index 0000000000..ff5e383857 --- /dev/null +++ b/research/encoded-balanced-crt-entry/VALIDATION.md @@ -0,0 +1,83 @@ +# Executed validation and review status + +Base e54523517d0f03e58352e647c403a5af3e525a57. Prepared for CubeJerry with +substantial OpenAI assistance. Environment: CPython3.12.14, Clang22.1.3, +Linux x86_64, glibc2.41, standard library only. + +## Author checks completed on2026-11-10 + +The metadata/source-pin check passed with12 live scientific inputs and two +historical provenance rows. The initial normal and optimized registered +replays passed on the warm-source-tail receipt in3.813 seconds combined, +well inside the individual60-second limits. After the scoped review +corrections below, the receipt was regenerated and the metadata check and +both registered modes passed again: + +```sh +python -B scripts/research_package.py --package research/encoded-balanced-crt-entry --check-only +python -B scripts/research_package.py --package research/encoded-balanced-crt-entry +``` + +Each registered verifier printed: + +```text +PASS_ENCODED_BALANCED_CRT_ENTRY nodes=14 owned_roles=78 controls=8 +``` + +The runner printed: + +```text +PASS_REGISTERED_RESEARCH_PACKAGE research/encoded-balanced-crt-entry outcome=completed +``` + +Both normal and optimized modes authenticate scientific inputs before +execution and compare the same type-sensitive frozen JSON receipt. The +runtime source parser and counter controller actually run; the actual +Entry and numerical producer are unchanged. None of the oracle's decoded +coordinates or widths enters runtime state. The same source snapshots and +all owned-role histories are checked at every boundary. + +The eight-axis fixture includes97 pre-existing source-tail cells; its +raw-action envelope uses logical M, while retained storage counts the entire source +backing. Non-dyadic shape rejection and early retired-boundary close +physically clear the owned histories and return the source head. + +A separate direct Port-method calibration of the guide-driven protected +word routine at precisions5,11,5,31 measured792,1464,792,3704 raw actions +for all eight words. These equal8(14P+29), including every guide rewind. +The quantified count is proved in PROOF.md; these four observations are +corroboration, not its universal justification. + +## Scoped review corrections + +Lead and independent review identified two overstatements in the earlier +author freeze. The physical API now states the linear-use current-lease +protocol. Immediate current-phase misuse is distinct from the interpreter's +extra protection against stale Python object identities retained through +later entries; that historical-handle service is not a physical theorem. + +The earlier literal32-instruction finite-control premise had no enumerated +primitive expansion. It has been removed, along with the resulting explicit +complete-control majorant. The explicit `2^16(M+2)^2` bound now applies only +to raw local Port actions. Complete frontend work is `C_front(M+2)^2` for +a fixed input-independent refinement constant; the uniform `O(p^4)` result +is unchanged. The receipt labels its finite comparison `raw_action_bound` +and records both cost and lease scope. The mathematical and executable +numerical pipeline is unchanged. + +## Independent review gate + +A separate ownership research worker completed the source/proof review at +addb3c9a404df9a5a7b7543ae2984477db784233 after the two corrections. +Its independent checker uses a different node-order derivation and direct +CRT-sum oracle, importing no author verifier or oracle. Normal and optimized +checks print PASS_INDEPENDENT_BALANCED_ENTRY 63 78 6 3. Coverage separates +57 topology nodes with actual Entry/Bank and explicitly dummy arithmetic +from six actual numerical nodes. It checks all78 retained role histories, +warm inaccessible source tails, exact varying-width guards,16 record-action +calibrations and three controls. See independent-review/REVIEW.md for exact +pins, universal derivations, scope and reproduction. This is separate +AI-assisted review, not human or proof-kernel acceptance. + +No full CRT row/ROM/payload program, binary transition program, selected cold +replay, human review or proof-kernel verification has been executed. diff --git a/research/encoded-balanced-crt-entry/VERIFY.json b/research/encoded-balanced-crt-entry/VERIFY.json new file mode 100644 index 0000000000..cc6dc04eec --- /dev/null +++ b/research/encoded-balanced-crt-entry/VERIFY.json @@ -0,0 +1,64 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/r437-preparation-composition/predecessor4025/source/words.py", + "research/r437-preparation-composition/predecessor4025/source/records.py", + "research/encoded-crt-entry-lifecycle/entry.py", + "research/encoded-crt-entry-lifecycle/PROOF.md", + "research/encoded-current-crt/producer.py", + "research/encoded-current-crt/PROOF.md", + "research/crt-persistent-numerical-owner/owner.py", + "research/crt-persistent-numerical-owner/PROOF.md", + "research/crt-persistent-numerical-owner/README.md", + "research/crt-mixed-row-entry/bridge.py", + "research/crt-mixed-row-entry/PROOF.md", + "research/crt-mixed-row-entry/README.md" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 60, + "checks": "Actual tape-driven d2/d4/d8 numerical-node executions; independent congruence oracle; no host geometry; constructor seal; all78 roles, current guides/guards, source/head and historical cleanup; eight controls." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 60, + "checks": "Repeat complete explicit checks with assertions disabled and compare the same type-sensitive frozen receipt." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/independent-review/independent.py" + ], + "timeout_seconds": 120, + "checks": "Independent source/cursor/Port-count and all-history review:57 actual Entry/Bank topology nodes with labelled dummy arithmetic,6 actual numerical nodes with direct CRT-sum oracle,16 record calibrations,3 controls; raw versus full-control scope explicit." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/independent-review/independent.py" + ], + "timeout_seconds": 120, + "checks": "Independent source/cursor/Port-count and all-history review:57 actual Entry/Bank topology nodes with labelled dummy arithmetic,6 actual numerical nodes with direct CRT-sum oracle,16 record calibrations,3 controls; raw versus full-control scope explicit." + } + ] +} diff --git a/research/encoded-balanced-crt-entry/frontend.py b/research/encoded-balanced-crt-entry/frontend.py new file mode 100644 index 0000000000..8adbe2cfef --- /dev/null +++ b/research/encoded-balanced-crt-entry/frontend.py @@ -0,0 +1,277 @@ +"""Tape-driven balanced-node selection into the unchanged CRT numerical entry. + +No runtime width, axis count, start, level or precision is decoded. All variable +iteration is driven by local symbols on the supplied source or owned unary +tapes. Numeric arithmetic and its 63-role bank are pinned predecessor code. +Prepared for CubeJerry with substantial OpenAI assistance. Apache-2.0. +""" +from types import SimpleNamespace + + +COUNTERS = ('axis', 'depth', 'halve_a', 'halve_b', 'half', 'double', 'width') +GUARDS = ('g0', 'g1', 'g2', 'g3', 'g4', 'g5', 'g6', 'g7') + + +class Iterator: + """One numerical result at a time; source contents stay read-only. + +The supplied source has the #5353 tagged padded-axis encoding and enters at +head one. Construction charges shape manufacture. next() takes no geometry +arguments. The physical interface is linear-use: consume the current lease +once before the next result and relinquish its borrowed aliases. Historical +Python-handle identity checks are interpreter guards, not a tape service. +""" + def __init__(self, words, records, entry, numeric, owner, canonical, source): + self.w, self.r, self.e = words, records, entry + self.numeric, self.canonical, self.source = numeric, canonical, source + self.bank = owner.Bank(words, entry) + self.guards = tuple(entry.Port(words) for _ in GUARDS) + for port in self.guards: + port.retire() + self.counters = {name: entry.Port(words) for name in COUNTERS} + self.live, self.closed = False, False + try: + self._shape() + except ValueError: + # Source framing errors and nondyadic counts precede numerical entry. + source.rewind() + for port in self.counters.values(): + port.retire() + self.closed = True + raise + + def _record(self, target=None, guide=None): + """Read one exact axis record; optionally project its canonical pair.""" + w, r, source = self.w, self.r, self.source + width = self.counters['width'] + width.clear() + w.need(source.read() == r.ROOT, 'axis tag') + source.step(1) + if target is not None: + target.append(r.ROOT) + seen = False + while source.read() == w.ONE: + seen = True + width.append(w.ONE) + if guide is not None: + guide.append(w.ONE) + source.step(1) + w.need(seen and source.read() == r.WORD_END, 'positive unary width') + source.step(1) + width.append(w.RIGHT) + width.rewind() + for delimiter in (r.WORD_END, r.RECORD_END): + while width.read() == w.ONE: + bit = source.read() + w.need(bit in (w.ZERO, w.ONE), 'padded source bit') + if target is not None: + target.append(bit) + source.step(1) + width.step(1) + w.need(width.read() == w.RIGHT and source.read() == delimiter, + 'exact source field extent') + source.step(1) + width.rewind() + if target is not None: + self.canonical.canonical_end(target, w, r) + if target is not None: + target.append(r.RECORD_END) + width.clear() + + def _many(self, port): + w = self.w + w.need(port.read() == w.ONE, 'nonempty reduction count') + port.step(1) + symbol = port.read() + w.need(symbol in (w.ONE, w.RIGHT), 'unary reduction shape') + port.rewind() + return symbol == w.ONE + + def _shape(self): + w, source = self.w, self.source + axis, depth = self.counters['axis'], self.counters['depth'] + current, spare = self.counters['halve_a'], self.counters['halve_b'] + while source.read() != w.RIGHT: + self._record() + axis.append(w.ONE) + current.append(w.ONE) + source.rewind() + axis.append(w.RIGHT) + axis.rewind() + current.append(w.RIGHT) + current.rewind() + w.need(self._many(current), 'at least two source axes') + while self._many(current): + depth.append(w.ONE) + odd = False + while current.read() == w.ONE: + odd = not odd + if not odd: + spare.append(w.ONE) + current.step(1) + w.need(current.read() == w.RIGHT and not odd, 'dyadic source axis count') + spare.append(w.RIGHT) + spare.rewind() + current.clear() + current, spare = spare, current + current.clear() + spare.clear() + depth.append(w.RIGHT) + depth.rewind() + half = self.counters['half'] + half.append(w.ONE) + half.append(w.RIGHT) + half.rewind() + w.need(axis.read() == w.ONE, 'first axis') + axis.write(self.r.STEP) # Unique current-node marker. + + def _prepare_guards(self, guide): + w = self.w + for port in self.guards: + port.step(-1) + w.need(port.read() == w.BLANK, 'retired protected marker') + port.write(w.LEFT) + port.step(1) + while guide.read() == w.ONE: + w.need(port.read() == w.BLANK, 'retired protected body') + port.write(w.ZERO) + port.step(1) + guide.step(1) + w.need(guide.read() == w.BLANK and port.read() == w.BLANK, + 'current protected extent') + port.write(w.RIGHT) + port.rewind() + guide.rewind() + + def _entry(self, w, r, adapter, numeric, source, dirty, + widths, ell, level, start, row): + # Bank.open's fixed call signature is preserved. Geometry is never supplied. + w.need(widths is None and ell is None and level is None and + start is None and row is None, 'no host geometry arguments') + w.need(source is self.source and dirty is self.guards, 'actual borrowed ports') + return NodeEntry(self, adapter) + + def next(self): + self.w.need(not self.live, 'previous node result must close') + if self.closed: + return None + self.w.need(self.counters['depth'].read() == self.w.ONE, 'active encoded level') + self.live = True + bridge = SimpleNamespace(RowEntry=self._entry) + lease = self.bank.open(self.r, self.numeric, bridge, self.source, self.guards, + None, None, None, None, None) + return NodeLease(self, lease) + + def _double_half(self): + w = self.w + half, temporary = self.counters['half'], self.counters['double'] + while half.read() == w.ONE: + temporary.append(w.ONE) + half.step(1) + w.need(half.read() == w.RIGHT, 'half-size delimiter') + half.write(w.BLANK) + temporary.append(w.RIGHT) + temporary.rewind() + while temporary.read() == w.ONE: + half.append(w.ONE) + temporary.step(1) + w.need(temporary.read() == w.RIGHT, 'copied half size') + half.append(w.RIGHT) + half.rewind() + temporary.clear() + + def _advance(self, last): + w, r = self.w, self.r + axis, depth = self.counters['axis'], self.counters['depth'] + while axis.read() != r.STEP: + w.need(axis.read() == w.ONE, 'preserved current cursor') + axis.step(1) + axis.write(w.ONE) + if last: + while axis.read() != w.RIGHT: + w.need(axis.read() == w.ONE, 'last-node suffix') + axis.step(1) + axis.rewind() + depth.step(1) + if depth.read() == w.RIGHT: + self.close() + return + w.need(depth.read() == w.ONE, 'next encoded level') + self._double_half() + axis.write(r.STEP) + else: + while axis.read() != r.VALUE: + w.need(axis.read() == w.ONE, 'next-node interval') + axis.step(1) + axis.write(r.STEP) + axis.rewind() + + def close(self): + self.w.need(not self.live and not self.closed, 'retired iterator closes once') + for port in self.counters.values(): + port.retire() + self.closed = True + + +class NodeEntry: + """Actual canonical streams and precision guide into unchanged Entry.""" + def __init__(self, iterator, adapter): + self.iterator = iterator + w, r, source = iterator.w, iterator.r, iterator.source + self.guide, self.left, self.right = (adapter.Port(w), adapter.Port(w), adapter.Port(w)) + self.inputs = (self.guide, self.left, self.right) + self.active = True + axis, half = iterator.counters['axis'], iterator.counters['half'] + while axis.read() != r.STEP: + w.need(axis.read() == w.ONE, 'prefix cursor') + iterator._record() + axis.step(1) + for target in (self.left, self.right): + while half.read() == w.ONE: + w.need(axis.read() in (w.ONE, r.STEP), 'complete selected node') + iterator._record(target, self.guide) + axis.step(1) + half.step(1) + w.need(half.read() == w.RIGHT, 'encoded half extent') + half.rewind() + target.append(w.RIGHT) + target.rewind() + self.last = axis.read() == w.RIGHT + if not self.last: + w.need(axis.read() == w.ONE, 'following source axis') + axis.write(r.VALUE) # Pending next cursor; current cursor survives handoff. + axis.rewind() + source.rewind() + self.guide.append(w.ONE) + self.guide.rewind() + iterator._prepare_guards(self.guide) + self.context = adapter.Entry(w, r, self.guide, iterator.guards) + self.result = self.context.invoke(iterator.numeric, self.left, self.right) + + def close(self): + self.context.consume(self.result) + self.context.close() + for port in self.inputs: + port.retire() + for port in self.iterator.guards: + port.retire() + + +class NodeLease: + """Interpreter wrapper for the single current linear-use continuation. + +The closed flag also guards stale Python references, but the fixed-role +physical theorem does not implement an unbounded stale-handle history. +""" + def __init__(self, iterator, lease): + self.iterator, self.lease = iterator, lease + self.actual = lease.actual + self.closed = False + + def close(self): + self.iterator.w.need(not self.closed, 'node lease closes once') + last = self.actual.last + self.lease.close() + self.closed = True + self.iterator.live = False + self.iterator._advance(last) diff --git a/research/encoded-balanced-crt-entry/independent-review/RESULT.json b/research/encoded-balanced-crt-entry/independent-review/RESULT.json new file mode 100644 index 0000000000..bfb7013f7a --- /dev/null +++ b/research/encoded-balanced-crt-entry/independent-review/RESULT.json @@ -0,0 +1,581 @@ +{ + "actual_numeric_nodes": 6, + "control_cost_scope": "raw bound and unspecified finite C_front; not an exact full-control coefficient", + "controls": [ + "omitted pending VALUE", + "nondyadic source with full cleanup", + "understated exact guard invoice" + ], + "core_hashes": { + "PROOF.md": "85af742286dc6ee90ea6671877682607d204979025c122aee509c5cded8957af", + "SOURCES.json": "e657d63bfc08f9f7562c44d13343c9259b42effa38517837af4b976f339e4635", + "frontend.py": "6ec9aab626a9d7a229b6f13ce6863e1ca77fa30ef65a4a66ae03a6ffaf2ee78c" + }, + "guard_counts": [ + [ + 5, + 472, + 320 + ], + [ + 31, + 2344, + 1360 + ], + [ + 6, + 544, + 360 + ], + [ + 127, + 9256, + 5200 + ], + [ + 5, + 472, + 320 + ] + ], + "quadratic_positive_coefficients": [ + 0, + 48, + 30 + ], + "quartic_scaled_positive_coefficients": [ + 5, + 16020, + 28830, + 19860, + 4997 + ], + "record_counts": [ + [ + 2, + false, + true, + 94, + 94 + ], + [ + 2, + false, + false, + 94, + 94 + ], + [ + 2, + true, + true, + 150, + 150 + ], + [ + 2, + true, + false, + 134, + 150 + ], + [ + 3, + false, + true, + 118, + 118 + ], + [ + 3, + false, + false, + 118, + 118 + ], + [ + 3, + true, + true, + 189, + 189 + ], + [ + 3, + true, + false, + 167, + 189 + ], + [ + 9, + false, + true, + 262, + 262 + ], + [ + 9, + false, + false, + 262, + 262 + ], + [ + 9, + true, + true, + 423, + 423 + ], + [ + 9, + true, + false, + 365, + 423 + ], + [ + 257, + false, + true, + 6214, + 6214 + ], + [ + 257, + false, + false, + 6214, + 6214 + ], + [ + 257, + true, + true, + 10095, + 10095 + ], + [ + 257, + true, + false, + 8549, + 10095 + ] + ], + "rejected_roles": 78, + "roles": 78, + "schema": 1, + "scientific_input_pins": { + "research/crt-mixed-row-entry/PROOF.md": "8a529ece497c62d5225261cdacebfd88979322b3a8886d1a31eb6295f1989e4b", + "research/crt-mixed-row-entry/README.md": "355cb36dddf59a3f7db0c04543ee075bf4bf9d9f4b9eab7cf489b2eefdefebd2", + "research/crt-mixed-row-entry/bridge.py": "89c38638c0d66da731566c903c32e7fa1ad31088d29cfd2634fce823dd07c1f9", + "research/crt-persistent-numerical-owner/PROOF.md": "9a76f73d1fd582cb66cd490de3a71bb1255049e920a00af72e762243909dc08e", + "research/crt-persistent-numerical-owner/README.md": "c605a3b0c38f29c91c3c954bb8dc49018f8717379acbcc4be9c66fee443531e8", + "research/crt-persistent-numerical-owner/owner.py": "1d73f432f8de9c791260c43335eb207d82bbb3f5b190cc76d0d914a4db076f41", + "research/encoded-crt-entry-lifecycle/PROOF.md": "a619be48c8c85749ea5411929aa6ff3986443b467133d32d19d543250b0054b0", + "research/encoded-crt-entry-lifecycle/entry.py": "0537ec98f306270c8ff6a424841886cf53f675d9947029347090c7dc779616d7", + "research/encoded-current-crt/PROOF.md": "7da614e737414a373c8716158f2c02a52666620ea1f114fac7ca09b3b38489bc", + "research/encoded-current-crt/producer.py": "88dab4ca02a92164a67826db361214fa1405e4b4a588f8c4279a21bcee95ab76", + "research/r437-preparation-composition/predecessor4025/source/records.py": "0c9c4b23e998597fb877bb1a29da69ac869b68262abe635b162b4dba9c69b372", + "research/r437-preparation-composition/predecessor4025/source/words.py": "5c37f57708ba3131bdcb03139f9dbc29886bee44569c09cbba51b68f75acd7f9" + }, + "topology_uses_actual_entry_bank": true, + "topology_uses_dummy_numeric": true, + "total_nodes": 63, + "trees": [ + { + "actual_numeric": false, + "axes": 2, + "nodes": [ + [ + 0, + 2, + 6 + ] + ], + "owned_bound": 644, + "retained_owned": 607, + "role_count": 78, + "source_history": 62, + "source_logical": 25 + }, + { + "actual_numeric": false, + "axes": 4, + "nodes": [ + [ + 0, + 2, + 8 + ], + [ + 2, + 2, + 8 + ], + [ + 0, + 4, + 15 + ] + ], + "owned_bound": 1459, + "retained_owned": 1334, + "role_count": 78, + "source_history": 97, + "source_logical": 60 + }, + { + "actual_numeric": false, + "axes": 8, + "nodes": [ + [ + 0, + 2, + 12 + ], + [ + 2, + 2, + 12 + ], + [ + 4, + 2, + 12 + ], + [ + 6, + 2, + 12 + ], + [ + 0, + 4, + 23 + ], + [ + 4, + 4, + 23 + ], + [ + 0, + 8, + 45 + ] + ], + "owned_bound": 4553, + "retained_owned": 4003, + "role_count": 78, + "source_history": 203, + "source_logical": 166 + }, + { + "actual_numeric": false, + "axes": 16, + "nodes": [ + [ + 0, + 2, + 14 + ], + [ + 2, + 2, + 14 + ], + [ + 4, + 2, + 14 + ], + [ + 6, + 2, + 14 + ], + [ + 8, + 2, + 14 + ], + [ + 10, + 2, + 14 + ], + [ + 12, + 2, + 14 + ], + [ + 14, + 2, + 14 + ], + [ + 0, + 4, + 27 + ], + [ + 4, + 4, + 27 + ], + [ + 8, + 4, + 27 + ], + [ + 12, + 4, + 27 + ], + [ + 0, + 8, + 53 + ], + [ + 8, + 8, + 53 + ], + [ + 0, + 16, + 105 + ] + ], + "owned_bound": 12901, + "retained_owned": 10790, + "role_count": 78, + "source_history": 415, + "source_logical": 378 + }, + { + "actual_numeric": false, + "axes": 32, + "nodes": [ + [ + 0, + 2, + 18 + ], + [ + 2, + 2, + 18 + ], + [ + 4, + 2, + 18 + ], + [ + 6, + 2, + 18 + ], + [ + 8, + 2, + 18 + ], + [ + 10, + 2, + 18 + ], + [ + 12, + 2, + 18 + ], + [ + 14, + 2, + 18 + ], + [ + 16, + 2, + 18 + ], + [ + 18, + 2, + 18 + ], + [ + 20, + 2, + 18 + ], + [ + 22, + 2, + 18 + ], + [ + 24, + 2, + 18 + ], + [ + 26, + 2, + 18 + ], + [ + 28, + 2, + 18 + ], + [ + 30, + 2, + 18 + ], + [ + 0, + 4, + 35 + ], + [ + 4, + 4, + 35 + ], + [ + 8, + 4, + 35 + ], + [ + 12, + 4, + 35 + ], + [ + 16, + 4, + 35 + ], + [ + 20, + 4, + 35 + ], + [ + 24, + 4, + 35 + ], + [ + 28, + 4, + 35 + ], + [ + 0, + 8, + 69 + ], + [ + 8, + 8, + 69 + ], + [ + 16, + 8, + 69 + ], + [ + 24, + 8, + 69 + ], + [ + 0, + 16, + 137 + ], + [ + 16, + 16, + 137 + ], + [ + 0, + 32, + 273 + ] + ], + "owned_bound": 46253, + "retained_owned": 36420, + "role_count": 78, + "source_history": 983, + "source_logical": 946 + }, + { + "actual_numeric": true, + "axes": 4, + "nodes": [ + [ + 0, + 2, + 9 + ], + [ + 2, + 2, + 9 + ], + [ + 0, + 4, + 17 + ] + ], + "owned_bound": 1625, + "retained_owned": 1568, + "role_count": 78, + "source_history": 103, + "source_logical": 66 + }, + { + "actual_numeric": true, + "axes": 4, + "nodes": [ + [ + 0, + 2, + 9 + ], + [ + 2, + 2, + 9 + ], + [ + 0, + 4, + 17 + ] + ], + "owned_bound": 1625, + "retained_owned": 1569, + "role_count": 78, + "source_history": 103, + "source_logical": 66 + } + ] +} diff --git a/research/encoded-balanced-crt-entry/independent-review/REVIEW.md b/research/encoded-balanced-crt-entry/independent-review/REVIEW.md new file mode 100644 index 0000000000..6003fbe592 --- /dev/null +++ b/research/encoded-balanced-crt-entry/independent-review/REVIEW.md @@ -0,0 +1,161 @@ +# Independent review of encoded balanced CRT node entry + +**Scoped pass after two review corrections.** Reviewed author commit: +`addb3c9a404df9a5a7b7543ae2984477db784233`, scientific base +`e54523517d0f03e58352e647c403a5af3e525a57`. The portable receipt pins the +proof, frontend and source manifest, plus all twelve `usage: input` source +files. The reviewed PROOF.md SHA256 is +`85af742286dc6ee90ea6671877682607d204979025c122aee509c5cded8957af`. + +This is a separate OpenAI research-worker derivation and implementation, +prepared for @CubeJerry. It is not independent human or proof-kernel review. +The checker does not import the author's verifier, fixtures, record decoder, +node-order generator or arithmetic oracle. + +## Corrections required and resolved + +The first proof asserted at most 32 finite-control instructions between raw +Port operations without defining and counting that expansion. Boundedness +alone did not prove its numeric coefficient. The corrected proof retains +`2^16(M+2)^2` only as a raw read/write/unit-move allowance, and uses a fixed +input-independent `C_front(M+2)^2` for complete frontend source operations. +The new code has fixed procedure depth and finite role vocabularies; its +variable loops perform local tape actions, so such a constant exists in the +stated source model. No explicit full-control coefficient or literal binary +TM tariff is certified. The inherited numerical tariffs remain inherited +contracts, rather than a new independent audit of every predecessor constant. + +The corrected theorem also requires a linear current-lease protocol. +Consumed leases and output aliases are relinquished before the next node. +Python's per-object `closed` field is not a physical service for validating +unbounded old handle identities. Immediate current-phase errors can use a +finite phase state and incur their own fixed cost. Same-bank restart of a +whole iterator is outside the implemented lifecycle. These are substantive +scope restrictions, not assertions that stale-handle generations are encoded. + +## Universal source reasoning + +The count tape is reduced by adjacent pairs. A finite parity bit rejects +an odd count greater than one; the number of successful reductions is the +encoded depth. At level size 2H, STEP is the unique unprocessed aligned +start. Reading H records to each side places VALUE exactly at the next start, +if one exists, while retaining STEP until the actual numerical result retires. +Advancement clears the old STEP, promotes VALUE, or advances the depth and +doubles H after the rightmost node. The doubling appends a physical copy +of the previous H tokens, so no numerical half-size is supplied by a host. +This establishes every level and the final root, not only tested trees. + +The actual old #5353 projection at synchronized row zero activates every +right axis because ell>=2. Its canonical two-word records are uniquely the +low-first binary encodings with high zero padding removed, retaining one +zero bit for zero. The new scanner constructs exactly those records for the +selected intervals and adds one guide token after their widths. This gives +P_G=1+sum_G h_i, the same canonical inputs and guide consumed by the unchanged +Entry. Bank.open still acquires three canonical/guide roles, then 56 private +words, one template and three padded streams. All geometry positions are +None, and the bridge rejects any supplied geometry. Compatibility follows +from these actual bytes and acquisitions, rather than an abstract node list. + +Source bytes are never written, including the old tail after its RIGHT. +The source head is restored before handoff. Eight guide-manufactured protected +words have the current exact width and are retired before a later guide. +The same 63 bank, eight guard and seven topology arrays are reused through +one lifecycle, with no shrinking or identity replacement. The separate +historical role envelope simplifies to + + owned backing <= 3dA + 71A + 19d + 221. + +The complete supplied source adds K_source, not just its logical length M. +With h_i>=2 one has d<=A/2; hence the owned envelope is O(A^2), while an +arbitrarily large supplied source tail must still be charged. The predecessor +role bounds count retained allocated arrays; reads of a virtual next blank +do not allocate that cell in this model. No Python heap bound is inferred. + +## Independent raw-action accounting + +Expanding the actual Port methods gives at most `24h+46` actions for a skipped +record and `39h+72` for a selected/copied record. These include width creation, +all returns, two complete padded field scans, canonical trimming, and width +retirement. They are below the author's `64(3h+4)` allowance. The separate +checker reaches both bounds on all-zero local record bit patterns; those +shape-only zero-modulus calibrations are not claimed as admitted CRT inputs. + +For each protected word, the exact preparation count is `9P+14` and retirement +is `5P+15`. Their sum is `14P+29`, including repeated guide scans and rewinds. +The checker reproduces this exactly at precisions 5,31,6,127,5 on the same +historical guards. It rejects a bill smaller by one action per word. The +remaining source/axis/counter scans and input retirement fit the loose +`512(M+2)` per-node raw allowance; root shape/final cleanup have the same +allowance. Pairwise reduction scans fewer than 2d count tokens. Direct half +doubling costs at most `23H+33` actions, whose completed-level sum fits the +stated `128(d+2)` allowance. Thus the advertised raw quadratic envelope is +safe, including rightmost source seeks and final retirement. + +For the inherited numerical sums, writing ell=t+2 gives nonnegative +coefficients for +`7*715*(t+1)^4-8*(t+5)^4` and +`32*(t+1)^2-2*(t+4)^2`. +The checker derives these coefficients by binomial expansion. Together with +the exact dyadic geometric series they justify the 715p^4 and 32p^2 bounds. +They do not assign a numerical value to C_front or prove the complete CRT +permutation tariff. + +## Executed independent coverage + +The 63 observed node handoffs are intentionally divided: + +* **57 topology/substitution nodes** in trees with 2,4,8,16,32 axes use the + unchanged Entry and Bank with a clearly labelled dummy numerical producer. + This isolates the cursor, canonical-input and lifecycle proof without + repeating the author's entire expensive arithmetic suite. The expected + order comes from root-interval breadth-first subdivision followed by + bottom-up layers. Every node is checked for exact canonical bytes, guide, + STEP/VALUE positions, rightmost flag, protected current width, no fresh + Port construction, source restoration and all 78 rolewise history bounds. +* **Six actual numerical nodes** in two distinct four-axis trees invoke the + unchanged numerical producer. A direct Chinese-remainder sum using modular + inverses supplies the oracle, rather than the author's exhaustive search. + One tree has valid current coordinates and a nontrivial two-axis CRT lower + value; the other exercises invalid-left disabling and padded right values. + The actual lower/product words and every P-bit output word are checked. + +Every source has a nonblank inaccessible 37-cell tail, which remains unchanged +and is included in K_source. Separate tests reuse eight guards across both +increasing and decreasing precisions and check their exact action counts. +Sixteen local record calibrations use widths 2,3,9,257 and both extreme bit +patterns. The three controls detect a missing pending VALUE, reject a +nondyadic source with all 78 histories and the source restored, and detect +an understated guard invoice. These finite checks corroborate the source +reasoning; neither 32 axes nor 257-bit fields is a universal-search limit +from which an asymptotic theorem is inferred. + +Executed with CPython 3.12.14, standard library only, 2026-11-10: + +```sh +python3 -B coordination/review-node-entry/independent.py \ + --package-root wt-crt-control/research/encoded-balanced-crt-entry +python3 -O -B coordination/review-node-entry/independent.py \ + --package-root wt-crt-control/research/encoded-balanced-crt-entry +``` + +Both read-only runs returned: + + PASS_INDEPENDENT_BALANCED_ENTRY 63 78 6 3 + +`--write-result` is the sole receipt-regeneration option. When copied to the +package's `independent-review` directory, the default package path is portable; +otherwise pass `--package-root`. Provenance-only selected/catalogue records +are not mistaken for immutable live scientific inputs. + +## Remaining scope + +No encoded row/target selector, h/layer ROM-header producer, source-coordinate +update, three-epoch transport or complete payload permutation is supplied by +this package. No whole-iterator reusable-bank restart, stale generation +service, arbitrary exception rollback, external consumer cost or source +production workspace is absorbed into its 78 roles. The fixed source-model +control factor C_front remains unspecified numerically, and binary lowering +of inherited arithmetic remains separate. All five foundational assumptions +and the accepted conditional kappa retain their status. Within the corrected +numerical-node, one-lifecycle, linear-use scope, no unresolved core defect was +found by this review. diff --git a/research/encoded-balanced-crt-entry/independent-review/independent.py b/research/encoded-balanced-crt-entry/independent-review/independent.py new file mode 100644 index 0000000000..3546eddba9 --- /dev/null +++ b/research/encoded-balanced-crt-entry/independent-review/independent.py @@ -0,0 +1,264 @@ +#!/usr/bin/env python3 +"""Independent review: no author verifier, fixtures or oracle imported.""" +import argparse +from hashlib import sha256 +import json +from math import comb, prod +from pathlib import Path +from types import ModuleType, SimpleNamespace +import sys + +def need(condition,label): + if not condition: raise ValueError(label) + +def load(name,path): + module=ModuleType(name); module.__file__=str(path); sys.modules[name]=module + exec(compile(path.read_bytes(),str(path),'exec'),module.__dict__) + return module + +def context(package): + root=package.parents[1]; pins={} + for row in json.loads((package/'SOURCES.json').read_text())['files']: + if row['usage']!='input': continue + digest=sha256((root/row['path']).read_bytes()).hexdigest() + need(digest==row['sha256'],'source pin '+row['path']); pins[row['path']]=digest + w=load('words',root/'research/r437-preparation-composition/predecessor4025/source/words.py') + r=load('records',root/'research/r437-preparation-composition/predecessor4025/source/records.py') + e=load('_review_entry',root/'research/encoded-crt-entry-lifecycle/entry.py') + n=load('_review_numeric',root/'research/encoded-current-crt/producer.py') + o=load('_review_owner',root/'research/crt-persistent-numerical-owner/owner.py') + c=load('_review_canonical',root/'research/crt-mixed-row-entry/bridge.py') + f=load('_review_frontend',package/'frontend.py') + return SimpleNamespace(w=w,r=r,e=e,n=n,o=o,c=c,f=f,pins=pins) + +def emit_source(m,moduli,widths,values,tail=37): + p=m.e.Port(m.w) + for modulus,width,value in zip(moduli,widths,values,strict=True): + data=[m.r.ROOT]+[m.w.ONE]*width+[m.r.WORD_END] + data += [(modulus>>j)&1 for j in range(width)]+[m.r.WORD_END] + data += [(value>>j)&1 for j in range(width)]+[m.r.RECORD_END] + for symbol in data: p.append(symbol) + p.append(m.w.RIGHT); p.rewind() + p.cells.extend(([m.r.STEP,m.w.ONE,m.w.BLANK,m.r.ROOT]*((tail+3)//4))[:tail]) + return p + +def canonical_bytes(m,moduli,values): + data=[m.w.LEFT] + for modulus,value in zip(moduli,values,strict=True): + data.append(m.r.ROOT) + for item in (modulus,value): + data.extend((item>>j)&1 for j in range(max(1,item.bit_length()))) + data.append(m.r.WORD_END) + data.append(m.r.RECORD_END) + return bytes(data+[m.w.RIGHT]) + +def logical_bytes(m,port): + return bytes(port.cells[:port.cells.index(m.w.RIGHT,1)+1]) + +def word(m,value): + end=value.cells.index(m.w.RIGHT,1) + return sum(value.cells[j]<<(j-1) for j in range(1,end)) + +def node_order(count): + # Root-interval breadth-first refinement, then bottom-up layers. + layer=[(0,count)]; layers=[] + while layer: + layers.append(layer); next_layer=[] + for start,size in layer: + if size>2: + next_layer.extend(((start,size//2),(start+size//2,size//2))) + layer=next_layer + return [interval for layer in reversed(layers) for interval in layer] + +def dummy_produce(arena,left,right,w,r): + output=r.Tape(); output.append(w.RIGHT); output.rewind() + return {'lower':arena.zero(),'product':arena.zero(),'stream':output} + +def crt_sum(moduli,values): + modulus=prod(moduli) + if any(value>=base for base,value in zip(moduli,values,strict=True)): + return 0,modulus + total=0; prefix=1 + for base,value in zip(moduli,values,strict=True): + cofactor=modulus//base + total+=(value*prefix%base)*cofactor*pow(cofactor,-1,base) + prefix*=base + return total%modulus,modulus + +def run_tree(m,moduli,widths,values,actual=False,mutate_cursor=False): + count=len(moduli); total_width=sum(widths); logical=2+3*total_width+4*count + source=emit_source(m,moduli,widths,values) + snapshot=bytes(source.cells),source.head + iterator=m.f.Iterator(m.w,m.r,m.e,m.n if actual else SimpleNamespace(produce=dummy_produce), + m.o,m.c,source) + ports=(*iterator.bank.ports,*iterator.guards,*iterator.counters.values()) + need(len(ports)==78 and len({id(p.cells) for p in ports})==78,'78 distinct backings') + identities=tuple(id(p.cells) for p in ports); pstar=total_width+1 + bounds=([pstar+1]+[2*total_width+2*count+2]*2+[pstar+2]*57+ + [count*(pstar+2)+2]*3+[pstar+2]*8+[count+2]*6+[total_width+2]) + need(len(bounds)==78,'role envelope shape') + original_init=m.e.Port.__init__ + def forbidden(*args,**kwargs): raise ValueError('new physical Port during node traversal') + m.e.Port.__init__=forbidden; seen=[] + try: + for start,size in node_order(count): + axis=iterator.counters['axis'] + need(axis.cells[1:count+1].count(m.r.STEP)==1,'unique current STEP') + need(axis.cells[start+1]==m.r.STEP,'independent interval start') + need(m.r.VALUE not in axis.cells[1:count+1],'no pending VALUE before entry') + lease=iterator.next(); entry=lease.actual; half=size//2 + need(logical_bytes(m,entry.left)==canonical_bytes(m,moduli[start:start+half],values[start:start+half]), + 'independent canonical left bytes') + need(logical_bytes(m,entry.right)==canonical_bytes(m,moduli[start+half:start+size],values[start+half:start+size]), + 'independent canonical right bytes') + precision=1+sum(widths[start:start+size]) + need(entry.guide.cells[1:precision+1]==bytes([m.w.ONE])*precision,'exact current guide') + need(len(entry.guide.cells)<=precision+1 or entry.guide.cells[precision+1]==m.w.BLANK, + 'guide ends at current precision') + last=start+size==count + need(entry.last==last,'actual rightmost marker') + if not last: + need(axis.cells[start+size+1]==m.r.VALUE,'pending VALUE at interval successor') + if mutate_cursor: axis.cells[start+size+1]=m.w.ONE + need(axis.cells[start+1]==m.r.STEP,'current cursor retained until retirement') + for guard in iterator.guards: + need(guard.cells[:precision+2]==bytes([m.w.LEFT]+[m.w.ZERO]*precision+[m.w.RIGHT]), + 'actual exact-width protected word') + need(all(x==m.w.BLANK for x in guard.cells[precision+2:]),'protected old tail blank') + if actual: + lower,product=crt_sum(moduli[start:start+half],values[start:start+half]) + offsets=[]; targets=[]; current=product + for base,value in zip(moduli[start+half:start+size],values[start+half:start+size],strict=True): + offset=lower*pow(current,-1,base)%base + offsets.append(offset); targets.append((value+offset)%base if value8*(14*p+28) for p,a,b in rows),'one-action understated guard bill rejected') + return rows + +def rejected_shape(m): + source=emit_source(m,[3,5,7],[4,4,4],[1,2,3]); before=bytes(source.cells),source.head + old=m.e.Port.__init__; created=[] + def capture(port,*args,**kwargs): old(port,*args,**kwargs); created.append(port) + m.e.Port.__init__=capture + try: + try: m.f.Iterator(m.w,m.r,m.e,SimpleNamespace(produce=dummy_produce),m.o,m.c,source) + except ValueError as exc: need('dyadic source axis count' in str(exc),'actual nondyadic guard') + else: raise ValueError('nondyadic source accepted') + finally: m.e.Port.__init__=old + need(len(created)==78,'rejected construction fixed roles') + need(all(p.head==1 and all(x==m.w.BLANK for x in p.cells) for p in created),'rejected entire-history cleanup') + need((bytes(source.cells),source.head)==before,'rejected source and old tail preserved') + return len(created) + +def record_counts(m): + rows=[] + def actions(ports): return sum(p.meter.reads+p.meter.writes+p.meter.moves for p in ports) + for width in (2,3,9,257): + for selected in (False,True): + for value in (0,(1<=0: multiply the quartic difference by7. + quartic=[7*715*comb(4,k)-8*comb(4,k)*5**(4-k) for k in range(5)] + quadratic=[32*comb(2,k)-2*comb(2,k)*4**(2-k) for k in range(3)] + need(all(v>=0 for v in quartic+quadratic),'positive all-ell geometric constants') + return {'schema':1,'core_hashes':{name:sha256((package/name).read_bytes()).hexdigest() + for name in ('PROOF.md','frontend.py','SOURCES.json')}, + 'scientific_input_pins':m.pins,'trees':trees,'guard_counts':guards,'record_counts':record_counts(m), + 'quartic_scaled_positive_coefficients':quartic,'quadratic_positive_coefficients':quadratic, + 'controls':controls,'rejected_roles':rejected, + 'total_nodes':sum(len(t['nodes']) for t in trees),'roles':78, + 'topology_uses_actual_entry_bank':True,'topology_uses_dummy_numeric':True, + 'actual_numeric_nodes':6,'control_cost_scope':'raw bound and unspecified finite C_front; not an exact full-control coefficient'} + +def main(): + parser=argparse.ArgumentParser(); parser.add_argument('--package-root',type=Path) + parser.add_argument('--write-result',action='store_true'); args=parser.parse_args() + here=Path(__file__).resolve().parent; package=(args.package_root or here.parent).resolve() + result=run(package); serialized=json.dumps(result,sort_keys=True,separators=(',',':')) + if args.write_result: (here/'RESULT.json').write_text(json.dumps(result,indent=2,sort_keys=True)+'\n') + else: + expected=json.loads((here/'RESULT.json').read_text()) + need(serialized==json.dumps(expected,sort_keys=True,separators=(',',':')),'typed independent receipt') + print('PASS_INDEPENDENT_BALANCED_ENTRY',result['total_nodes'],result['roles'],result['actual_numeric_nodes'],len(result['controls'])) + +if __name__=='__main__': main() diff --git a/research/encoded-balanced-crt-entry/verify.py b/research/encoded-balanced-crt-entry/verify.py new file mode 100644 index 0000000000..3725b57c3e --- /dev/null +++ b/research/encoded-balanced-crt-entry/verify.py @@ -0,0 +1,295 @@ +"""Actual producer executions; all host decoding below is observer-only.""" +from contextlib import contextmanager +from hashlib import sha1, sha256 +from pathlib import Path +from types import ModuleType +import json +import math +import sys + +P = Path(__file__).resolve().parent +ROOT = P.parents[1] + + +def need(ok, message): + if not ok: + raise ValueError(message) + + +def canonical(value): + return json.dumps(value, sort_keys=True, separators=(',', ':'), allow_nan=False) + + +def source_check(): + pins = json.loads((P/'SOURCES.json').read_text())['files'] + count = 0 + for pin in pins: + if pin['usage'] != 'input': + continue + raw = (ROOT/pin['path']).read_bytes() + need(sha256(raw).hexdigest() == pin['sha256'], 'source SHA256 '+pin['path']) + need(sha1(b'blob '+str(len(raw)).encode()+b'\0'+raw).hexdigest() == pin['git_blob'], + 'source Git blob '+pin['path']) + count += 1 + return count + + +def load(name, path): + m = ModuleType(name) + m.__file__ = str(path) + sys.modules[name] = m + exec(compile(path.read_bytes(), str(path), 'exec'), m.__dict__) + return m + + +def modules(): + w = load('words', ROOT/'research/r437-preparation-composition/predecessor4025/source/words.py') + r = load('records', ROOT/'research/r437-preparation-composition/predecessor4025/source/records.py') + e = load('entry', ROOT/'research/encoded-crt-entry-lifecycle/entry.py') + n = load('numeric', ROOT/'research/encoded-current-crt/producer.py') + o = load('owner', ROOT/'research/crt-persistent-numerical-owner/owner.py') + c = load('canonical', ROOT/'research/crt-mixed-row-entry/bridge.py') + return w, r, e, n, o, c + + +def fixture(w, r, e, moduli, widths, values): + source = e.Port(w) + for s, h, x in zip(moduli, widths, values, strict=True): + source.append(r.ROOT) + for _ in range(h): + source.append(w.ONE) + source.append(r.WORD_END) + for value, delimiter in ((s, r.WORD_END), (x, r.RECORD_END)): + for j in range(h): + source.append((value >> j) & 1) + source.append(delimiter) + source.append(w.RIGHT) + source.rewind() + return source + + +def unword(cells, index, delimiter): + value, bit = 0, 0 + while cells[index] != delimiter: + need(cells[index] in (0, 1), 'observer binary word') + value += cells[index] << bit + bit += 1 + index += 1 + return value, index+1 + + +def records(port, w, r): + result, at = [], 1 + while port.cells[at] != w.RIGHT: + need(port.cells[at] == r.ROOT, 'observer record tag') + first, at = unword(port.cells, at+1, r.WORD_END) + second, at = unword(port.cells, at, r.WORD_END) + need(port.cells[at] == r.RECORD_END, 'observer record end') + at += 1 + result.append([first, second]) + return result + + +def numeric_oracle(moduli, values, start, half): + """Independent exhaustive congruence solution, no predecessor arithmetic.""" + left = moduli[start:start+half] + left_values = values[start:start+half] + product = math.prod(left) + if all(x < s for x, s in zip(left_values, left)): + residues, prefix = [], 1 + for s, x in zip(left, left_values): + residues.append((x*prefix) % s) + prefix *= s + lower = next(k for k in range(product) + if all(k % s == residue for s, residue in zip(left, residues))) + else: + lower = 0 + result, prefix = [], product + for s, x in zip(moduli[start+half:start+2*half], values[start+half:start+2*half]): + offset = next(o for o in range(s) if (o*prefix-lower) % s == 0) + result.append([offset, (x+offset) % s if x < s else x]) + prefix *= s + return lower, product, result + + +def poison(module): + def denied(*a, **k): + raise ValueError('forbidden host geometry/decode') + for name in ('int', 'float', 'len', 'range', 'sum', 'min', 'max', 'enumerate', 'pow', 'sorted'): + module.__dict__[name] = denied + return denied + + +@contextmanager +def sealed(w, e): + old = e.Port.__init__, w.Word.__init__, w.Arena.__init__, w.Word.inspect + def denied(*a, **k): + raise ValueError('forbidden runtime constructor/decode') + e.Port.__init__ = w.Word.__init__ = w.Arena.__init__ = w.Word.inspect = denied + try: + yield + finally: + e.Port.__init__, w.Word.__init__, w.Arena.__init__, w.Word.inspect = old + + +def actions(ports): + return sum(p.meter.reads+p.meter.writes+p.meter.moves for p in ports) + + +def check_fixture(f, m, name, moduli, widths, values, source_tail=0): + w, r, e, n, o, c = m + source = fixture(w, r, e, moduli, widths, values) + source.cells.extend([w.BLANK]*source_tail) # Supplied entry history, outside runtime. + snapshot = bytes(source.cells), source.head + before = actions([source]) + it = f.Iterator(w, r, e, n, o, c, source) + ports = (*it.bank.ports, *it.guards, *it.counters.values()) + need(len(ports) == 78 and len({id(p.cells) for p in ports}) == 78, '78 distinct owned roles') + identities = tuple(id(p.cells) for p in ports) + expected = [(level, start, 1 << (level-1)) + for level in range(1, len(widths).bit_length()) + for start in range(0, len(widths), 1 << level)] + trace, numeral_work, last_lease = [], 0, None + try: + with sealed(w, e): + for level, start, half in expected: + lease = it.next() + last_lease = lease + need(lease is not None, 'every balanced node produced') + a = lease.actual + precision = 1+sum(widths[start:start+2*half]) + need(records(a.left, w, r) == [[s, x] for s, x in + zip(moduli[start:start+half], values[start:start+half])], 'selected left records') + need(records(a.right, w, r) == [[s, x] for s, x in + zip(moduli[start+half:start+2*half], values[start+half:start+2*half])], 'selected right records') + need(a.guide.cells[1:precision+1] == bytearray([w.ONE])*precision and + (len(a.guide.cells) == precision+1 or a.guide.cells[precision+1] == w.BLANK), + 'physical current guide extent') + lower, product, output = numeric_oracle(moduli, values, start, half) + need(unword(a.result['lower'].cells, 1, w.RIGHT)[0] == lower, 'independent lower congruences') + need(unword(a.result['product'].cells, 1, w.RIGHT)[0] == product, 'independent left product') + need(records(a.result['stream'], w, r) == output, 'independent actual numerical output') + for guard in it.guards: + need(guard.cells[:precision+2] == bytearray([w.LEFT]+[w.ZERO]*precision+[w.RIGHT]), + 'current exact-width protected zeros') + need(all(x == w.BLANK for x in guard.cells[precision+2:]), 'blank protected historical tail') + need((bytes(source.cells), source.head) == snapshot, 'source restored during result handoff') + lease.close() + meter = a.context.arena.meter + numeral_work += meter.reads+meter.writes+meter.moves + need(tuple(id(p.cells) for p in ports) == identities, 'stable whole-iterator backing') + need(all(p.head == 1 and all(x == w.BLANK for x in p.cells) + for p in (*it.bank.ports, *it.guards)), 'numerical history retired') + trace.append({'level': level, 'start': start, 'half': half, 'precision': precision, + 'lower': lower, 'product': product, 'output': output, + 'retained': [len(p.cells) for p in ports]}) + need(it.next() is None and it.closed, 'exact final rightmost node and termination') + finally: + if last_lease is not None and not last_lease.closed: + last_lease.close() + if not it.closed and not it.live: + it.close() + need((bytes(source.cells), source.head) == snapshot, 'all source bytes and head restored') + need(all(p.head == 1 and all(x == w.BLANK for x in p.cells) for p in ports), 'all owned history blank') + total = actions([source, *ports])-before+numeral_work + length = 2+3*sum(widths)+4*len(widths) + raw_action_bound = 2**16*(length+2)**2 + sum(2**20*(t['precision']+2)**4 + + 2**16*(t['precision']+2)**2 + 4096 for t in trace) + 4096 + need(total <= raw_action_bound, 'raw local-action envelope calibration') + return {'name': name, 'moduli': list(moduli), 'widths': list(widths), 'values': list(values), + 'source_length': length, 'source_backing': len(source.cells), + 'trace': trace, 'actions': total, 'raw_action_bound': raw_action_bound, + 'retained_total': len(source.cells)+sum(len(p.cells) for p in ports), 'owned_roles': 78} + + +def controls(f, m): + w, r, e, n, o, c = m + rejected = [] + def rejects(label, fn, message=None): + try: + fn() + except ValueError as error: + need(message is None or message in str(error), 'specific rejection: '+label) + rejected.append(label) + else: + raise ValueError('undetected negative control: '+label) + source = fixture(w, r, e, (5,7,3,2), (3,3,2,2), (3,2,1,1)) + snapshot = bytes(source.cells), source.head + it = f.Iterator(w, r, e, n, o, c, source) + ports = (*it.bank.ports, *it.guards, *it.counters.values()) + rejects('host_geometry_argument', lambda: it._entry(w, r, None, n, source, it.guards, + (3,3,2,2), 3, 1, 0, 0), 'no host geometry') + with sealed(w, e): + lease = it.next() + before = actions([source, *ports]) + rejects('live_next', it.next, 'previous node result') + rejects('live_iterator_close', it.close, 'retired iterator') + need(actions([source, *ports]) == before, 'live rejection has no tape traffic') + lease.close() + # No later next has occurred: this is a current-phase violation, + # not a claim of physical validation of historical object identities. + rejects('double_lease_close', lease.close, 'node lease closes once') + it.close() # Early close at a retired boundary is paid and complete. + need((bytes(source.cells), source.head) == snapshot, 'early-close source restoration') + need(all(p.head == 1 and all(x == w.BLANK for x in p.cells) for p in ports), 'early-close history') + ports[0].cells[-1] = w.ONE + rejects('stale_retired_history', lambda: need(all(x == w.BLANK for x in ports[0].cells), 'stale tail')) + ports[0].cells[-1] = w.BLANK + + malformed = fixture(w, r, e, (2,3,5), (2,2,3), (1,2,4)) + bad_snapshot = bytes(malformed.cells), malformed.head + captured = [] + original_init = e.Port.__init__ + def capture(port, *args, **kwargs): + original_init(port, *args, **kwargs) + captured.append(port) + before = actions([malformed]) + e.Port.__init__ = capture + try: + rejects('nondyadic_shape_with_cleanup', lambda: f.Iterator(w, r, e, n, o, c, malformed), + 'dyadic source axis count') + finally: + e.Port.__init__ = original_init + need(len(captured) == 78, 'rejected preparation fixed inventory') + need(all(p.head == 1 and all(x == w.BLANK for x in p.cells) for p in captured), 'rejected preparation retires') + need((bytes(malformed.cells), malformed.head) == bad_snapshot, 'rejected preparation source restoration') + rejection_actions = actions([malformed, *captured])-before + need(rejection_actions <= 2**16*(len(malformed.cells)+2)**2, 'rejected preparation allowance') + + mutant = load('wrong_half_frontend', P/'frontend.py') + poison(mutant) + mutant.Iterator._double_half = lambda self: None + rejects('omitted_half_size_doubling', lambda: check_fixture(mutant, m, 'mutant', + (5,7,3,2), (3,3,2,2), (3,2,1,1)), 'selected left records') + rejects('typed_receipt_boolean_integer', lambda: need(canonical({'x': True}) == canonical({'x': 1}), + 'typed receipt')) + return {'rejections': rejected, 'rejected_shape_actions': rejection_actions, + 'early_close_restores': True} + + +def main(): + source_count = source_check() + m = modules() + f = load('encoded_frontend', P/'frontend.py') + poison(f) + cases = [check_fixture(f, m, 'changing_half_and_nonzero_start', (5,7,3,2), (3,3,2,2), (3,2,1,1)), + check_fixture(f, m, 'invalid_left_and_padded_right', (7,3), (3,2), (7,3)), + check_fixture(f, m, 'wide_declared_axes', (7,5,3,2), (4,4,3,3), (6,4,2,1)), + check_fixture(f, m, 'eight_axis_tree', (3,5,7,11,13,17,19,23), + (4,4,4,4,4,5,5,5), (2,4,6,10,12,16,18,22), source_tail=97)] + result = {'status': 'PASS_ENCODED_BALANCED_CRT_ENTRY', 'cases': cases, + 'host_geometry_poisoned': True, 'runtime_constructors_sealed': True, + 'cost_scope': 'raw_action_envelope; complete_source_constant_unspecified', + 'lease_scope': 'linear_use_current_lease; historical_host_handles_excluded', + 'full_crt_permutation': False, 'new_kappa': None, + 'source_count': source_count, 'controls': controls(f, m)} + if '--write-result' in sys.argv: + (P/'RESULT.json').write_text(json.dumps(result, indent=2)+'\n') + else: + need(canonical(result) == canonical(json.loads((P/'RESULT.json').read_text())), 'frozen typed receipt') + print(result['status'], 'nodes='+str(sum(len(c['trace']) for c in cases)), 'owned_roles=78', + 'controls='+str(len(result['controls']['rejections']))) + + +if __name__ == '__main__': + main()