From f248a5f1b4f9ad5f0a5c9c7d7e81dea52c9afdcf Mon Sep 17 00:00:00 2001 From: CubeJerry <80299683+CubeJerry@users.noreply.github.com> Date: Tue, 10 Nov 2026 00:30:18 +0800 Subject: [PATCH] research: prove an exact production Core interior guard --- .../core-production-nonempty/CHECKPOINT.md | 51 +++ research/core-production-nonempty/NOTICE.md | 26 ++ research/core-production-nonempty/PROOF.md | 250 ++++++++++++++ research/core-production-nonempty/PR_BODY.md | 73 +++++ research/core-production-nonempty/README.md | 109 ++++++ .../core-production-nonempty/RESULTS.json | 310 ++++++++++++++++++ .../core-production-nonempty/SOURCES.json | 42 +++ research/core-production-nonempty/TASK.json | 107 ++++++ research/core-production-nonempty/VERIFY.json | 32 ++ research/core-production-nonempty/guard.py | 91 +++++ .../production_sources.py | 80 +++++ research/core-production-nonempty/verify.py | 198 +++++++++++ 12 files changed, 1369 insertions(+) create mode 100644 research/core-production-nonempty/CHECKPOINT.md create mode 100644 research/core-production-nonempty/NOTICE.md create mode 100644 research/core-production-nonempty/PROOF.md create mode 100644 research/core-production-nonempty/PR_BODY.md create mode 100644 research/core-production-nonempty/README.md create mode 100644 research/core-production-nonempty/RESULTS.json create mode 100644 research/core-production-nonempty/SOURCES.json create mode 100644 research/core-production-nonempty/TASK.json create mode 100644 research/core-production-nonempty/VERIFY.json create mode 100644 research/core-production-nonempty/guard.py create mode 100644 research/core-production-nonempty/production_sources.py create mode 100644 research/core-production-nonempty/verify.py diff --git a/research/core-production-nonempty/CHECKPOINT.md b/research/core-production-nonempty/CHECKPOINT.md new file mode 100644 index 0000000000..7cfc732f15 --- /dev/null +++ b/research/core-production-nonempty/CHECKPOINT.md @@ -0,0 +1,51 @@ +# Wave 2: exact production nonempty-interior admission + +Status: **verified local package, ready for lead publication review**. +Canonical main was rechecked and remains +`7c49fe32c55de02c2c873655c804b16e4c3fef0a`. +Branch: `research/core-production-nonempty-20261109`. +Worker: analytic_join. Package: `research/core-production-nonempty`. + +## Established and independently reviewed + +The exact target-coordinate inverse image and longest phase-pure selected run +M give `I nonempty iff M>6W` for the unchanged production capped carve. The +uniform guard `S>=e(6W+1), L>=12W+2` admits every ordinary original start, +including short endpoint half-cells. Both one-unit adverse families retain +`N-L>=W`; sharpness is not asserted for dyadic aligned windows. + +The lead independently reviewed the inverse cuts, middle-cell maximum, +cap criterion, all-window proof and fixed-tape setup cost. The lead independently +checked the source-ratio adverse family; the worker separately checked both +families against the original source bodies. Common per-axis descriptors +permit O(g d^2) setup; heterogeneous or local tests retain up to O(K g d^2). +No payload pass, numerical recovery theorem or kappa gain is claimed. + +## Reproduction and executed checks + +`python3 -B scripts/research_package.py --package research/core-production-nonempty --check-only` +returned `PASS_PACKAGE_METADATA_AND_PINS`. + +`python3 -B scripts/research_package.py --package research/core-production-nonempty` +returned `PASS_REGISTERED_RESEARCH_PACKAGE` after both ordinary and optimized +runs passed the full frozen receipt. Coverage: 772,850 exact literal-coordinate +windows; 77,793 authenticated source partitions; 855 uniform-guard admissions; +17 negative controls; both sharp families W=1 through 16. No numerical or +native replay is represented by these geometry checks. + +The complete-Core source family is a cited conditional application. All three +executable dependencies are exact canonical-main files listed in SOURCES.json +and VERIFY.json. The phase-cell facts of #6259 and the capped density lineage +are prior work, explicitly credited. + +## Outstanding obligations and next action + +Source row gap, numerical accuracy/norms, uniform preparation, native lifecycle +and whole recovery remain. Empty short sections outside the uniform guard +still need a complete numerical/native solver. Next action: commit the checked +package, run the committed-byte/mode gate and give the exact head to the lead. +The worker has created no remote branch, external post or upstream PR. + +Wave 1 is preserved separately at public bridge commit +`73d5adaba2b7dc662e86eb901e81369a3f73be9f`; this package has no executable +dependency on that branch or another unmerged package. diff --git a/research/core-production-nonempty/NOTICE.md b/research/core-production-nonempty/NOTICE.md new file mode 100644 index 0000000000..e120132aac --- /dev/null +++ b/research/core-production-nonempty/NOTICE.md @@ -0,0 +1,26 @@ +# Credit and scope + +Prepared for **@CubeJerry** with substantial OpenAI assistance in mathematical +research, implementation, independent exact checking and packaging. Apache-2.0. +Independent AI review is not human acceptance or proof-assistant verification. + +Jose Manuel / jmbarrancoml authored the common rational Reference and Core +source. Vlado Vojdanovski, Jeremy Kothe and Cinna Davis supply its retained +geometry and capped-carve lineage; Mason Hale supplies interval arithmetic +used by the full numerical source, which this geometry projection does not run. +All three executable source inputs remain unchanged on canonical main. + +Nick Petalas's CrocSwap/integer-mult-bounds#6259 supplies the exact source-phase +cut formulas, endpoint half-cell lengths and boundary counts for the different +4w physical-source carve. Its credited Beatty-run/Gaussian-word predecessors, +including Dugongue and Jose Manuel's lineage, retain their attribution. The +capped phase-fusion source already supplies the 6W loop, separators and +asymptotic boundary density. + +The new work is the target-window inverse-image decision with identity holes, +the exact longest source-phase run, the sharp finite guard without long +endpoint half-cells, and its binding to literal current production bodies. +The root reviewer independently verified the mathematical implication and +supplied the complementary-gap refinement of the source-ratio sharp family; +the worker independently executed both refined sharp families on the original +partition bodies. This does not claim a new density order or Gaussian theorem. diff --git a/research/core-production-nonempty/PROOF.md b/research/core-production-nonempty/PROOF.md new file mode 100644 index 0000000000..596ac2951f --- /dev/null +++ b/research/core-production-nonempty/PROOF.md @@ -0,0 +1,250 @@ +# Exact nonempty-interior admission at every original target window + +Prepared for **@CubeJerry** with substantial OpenAI assistance. Apache-2.0. +**Source-bound geometry theorem; no new kappa.** Base: +`7c49fe32c55de02c2c873655c804b16e4c3fef0a`. + +## 1. Obligation, source and predecessor boundary + +The actual common rational Reference defines selected coordinates by + +`phi(j)=floor(e*j/S+1/2)`, `q(j)=j+phi(j)`, `0<=j0, put `D=A_c1-A_(c0+1)`. Since these m lengths +are h or h+1, their maximum is exactly `h+[D>m*h]`. Consequently + +`M=max(u,v,h+[D>m*h])` when m>0. (4) + +Equations (1)--(4) use a fixed number of integer operations independent of S, +e, N, L and the number of cells. Within a source phase, q(j+1)-q(j)=1; a phase +increase creates one hole and breaks the target run. Hence M is exactly the +maximum piece length passed to the original capped carve by `Core.partition`. +The exact total D detects whether any h+1 middle cell occurs; inspecting an +arbitrary representative middle cell would be insufficient. + +## 3. Exact admission for the unchanged capped carve + +Assume integer W>=1 and a positive dyadic cap with `2 cap<=S`, as required by +the source's dyadic interior interface. For a selected run of length m: + +* If `m<=6W`, the literal carve returns one boundary piece. +* If `m>6W`, its initial remaining length is `R=m-2W>4W`. Its first interior + length is `min(cap,2^floor(log2(R-W)))`, a positive dyadic integer at most + cap. The loop therefore produces at least one interior. + +For every ordinary target window in Section 2, + +`I is nonempty iff M>6W`. (5) + +There is no substitute interior or change to the source partition. The source +`Reference.interior` is invoked at the actual retained start and checks the +same phase and contiguous selected coordinates. The bound `2cap<=S` supplies +its source-size admission for every subblock. The first and last W selected +vertices of a long run remain boundary, so (5) also gives `|J|>=2W>0` and +`0<|I|= e(6W+1)`, `L >= 12W+2`, `L<=N`. (6) + +Then every ordinary original target window of length L has a nonempty interior +and a nonempty boundary under the literal production carve. + +**Proof.** Every complete **internal** source phase cell has length at least +`floor(S/e)>=6W+1`. The two endpoint half-cells may be short. Also +`e/S<=1/(6W+1)<1/2`, so the first selected coordinate is 0, the last is N-1, +and all holes are singletons between successive nonempty phase cells. + +Suppose a window had no selected run longer than 6W. It cannot meet three +selected phase cells: the middle one would be a complete internal cell, whose +length is at least 6W+1. If it meets two cells and starts or ends on an external +hole, the adjacent selected cell is complete and internal, again a +contradiction. Otherwise those two clipped runs contribute at most 6W vertices +each, with one hole between them, giving length at most `12W+1`. + +If it meets only one selected cell, it cannot include both neighboring holes, +because that would make the cell a complete internal cell. Its length is at +most `6W+1`. A window with no selected coordinate contains at most one hole. +These alternatives all contradict `L>=12W+2`. Thus M>6W; Section 3 proves the +assertion. ∎ + +Requiring `floor(S/(2e))>=6W+1` would also suffice, but unnecessarily requires +both original half-cells to be long. Equation (6) avoids that factor of two +while preserving clipped endpoint phases and identity holes. + +### Both integer thresholds have exact adverse families + +For each W>=1 choose `S=18W+3`, e=3, `a=3W+3`, `L=12W+1`. The two internal +phase cells both have length 6W+1, with one target hole between them. The window +clips one selected coordinate from each end of their union, leaving lengths +6W and 6W and that hole. The source-ratio guard holds with equality but I is +empty. Moreover `N-L=6W+5>=W`. Thus the ordinary-window length threshold cannot +be lowered by one even with the complementary-gap guard retained. + +Conversely choose `S=18W+2`, e=3, a=0 and `L=12W+2`. Then +`S=e(6W+1)-1`, N=18W+5, and the first two phase lengths are 3W+1 and 6W. +The window includes a prefix of 3W-1 selected coordinates from the next phase, +with two holes in total. Its largest selected run is 6W, so I is empty. +Here `N-L=6W+3>=W`. Thus the source-ratio threshold cannot be lowered by one +while retaining the length and complementary-gap guards. + +These are sharpness statements in the **ordinary-window/complementary-gap domain**. Their L +need not be dyadic. No separately optimal threshold for the narrower dyadic +aligned Core family is claimed; that family may use (6) or exact decision (5). + +## 5. Conservative complete-Core family and surviving admissions + +The [complete Core's source family](https://github.com/CubeJerry/integer-mult-bounds/blob/6fb9ab776b7d0956b8bcc2d3cfde0f3034421630/research/complete-core-physical-join/NUMERICS.md) +binds the unchanged `Core.partition` source to ordinary +original windows. Its additional admissions include dyadic side and cap, +original alignment, `2cap<=S`, the complementary gap `N-L>=W`, exact source +accuracy and norm certificates. These are preserved. Suppose its retained +conservative regime has uniform constants with + +`theta=e/S <= p^-2`, `W=O(sqrt(p) polylog p)`, +`L=2^ceil(400 log2 p)`. + +Then `theta(6W+1)->0` and `(12W+2)/L->0`, so both inequalities (6) hold for +all sufficiently large p. Every original Core start on every active axis +therefore has a nonempty interior and boundary. There is no separate +nonemptiness assumption for its K contexts. The conclusion is uniform in K +and the original positions, including the first and last complete sections. + +This removes only the empty-interior case in that stated asymptotic source +family. It neither supplies the theta or W bounds nor proves row gap, +conditioning, matrix/Schur formation, uniform precision, compiler, native +stock, owner lifecycle, whole halo delivery or final recovery. Short finite +families outside (6) retain exact classifier (5); an empty classification is +not an implementation of a missing zero-dimensional solver. + +The parameter family is a cited conditional source contract, supplied by the +complete-Core and global-cohort predecessors. The geometric statement does +not depend on their unpublished data, modified code or acceptance status: +its three executable inputs are already pinned on canonical main. + +## 6. Full added cost and model boundary + +The guard reads input-independent source descriptors S,e,W,L,cap. Let d be the +maximum of their binary lengths and the original endpoint lengths. The uniform +guard uses a fixed number of comparisons, shifts, additions and products, +including dyadic-cap validation. Exact single-window decision (1)--(4) adds a +fixed number of integer divisions. Ordinary binary arithmetic supplies +O(d^2) bit work and O(d) scratch for either calculation. This is not constant +bit time. Input access, produced descriptors and disposal have O(d) size and +are included in the bound. + +When each axis has the same S,e,W,L,cap descriptors across all K contexts, +the uniform guard is checked once per actual axis, costing O(g d^2) without +scanning or materializing contexts. Every distinct descriptor must otherwise +be checked and charged; heterogeneous families may require K g checks. If +a caller instead uses the exact local test at every context and axis, its full +extra setup is O(K g d^2). All existing coefficient, catalogue, route, backing, +payload and native bills are retained. This is source setup: there is no new +payload pass, floating-point computation, numerical error or supplier gain. + +These checks fit the cited complete-Core preparation envelope +`K 2^(O(ell_original)) poly(p)` with its full K factor retained. No new saving +in the dominant online bill follows. The finite-domain geometry theorem is +unconditional; the whole multiplication construction remains conditional on +every other source and physical premise. + +The verifier compiles only the authenticated Reference **geometry prefix**, +its original `interior` method, and unchanged `Core.partition` and capped +`carve` bodies. It excludes the constructor continuation that makes exponential +intervals and Gaussian values. This is a transparent source projection for +the geometric theorem, not an actual numerical Gaussian or native-tape run. +The decision formula is independent of that source projection. + +## 7. Evidence and remaining work + +The independent coordinate oracle covers all 772,850 ordinary windows for +every `2<=S<=40`, `1<=e6W` for the unchanged capped carve. It uses a fixed number of +integer operations without enumerating phases or rows. + +The uniform sufficient guard is + +`S>=e(6W+1), L>=12W+2`. + +Every ordinary original target start is covered, including short endpoint +half-cells. Both integer thresholds have one-unit adverse families that retain +`N-L>=W`. Sharpness is for ordinary integer windows, not dyadic-aligned +production windows. Source cap/alignment/complementary-gap admissions remain. + +In the cited conservative theta<=p^-2, W=O(sqrt(p) polylog p), L>=p^400 family, +these inequalities hold eventually. Thus I and J need no separate nonemptiness +assumption at each original context. The guard costs O(d^2) bit work for d-bit +descriptors. One check per axis covers K contexts when that axis's source and +width descriptors are common; heterogeneous descriptors retain their own +checks, up to the complete O(K g d^2) setup bill. + +## Novelty and exact sources + +Canonical base: `7c49fe32c55de02c2c873655c804b16e4c3fef0a`. +Three unchanged executable inputs on main: rational Reference, Core partition, +and authenticated capped carve. No unmerged executable dependency is used. +SOURCES.json binds exact Git blobs/SHA256 and the canonical task. + +Nick Petalas's CrocSwap/integer-mult-bounds#6259 owns phase cuts and endpoint +lengths for the different 4w physical-source carve. The capped phase-fusion +lineage already supplies cap, separation and asymptotic density. This adds the +target-coordinate/identity-hole decision and finite sharp guard for the 6W +source. It does not reclaim prior floor identities or density order. Current +complete-Core and source-halo joins remain credited predecessor work. + +## Reproduction and checks + +```sh +python3 -B scripts/research_package.py --package research/core-production-nonempty +python3 -B scripts/check_research_commit.py --package research/core-production-nonempty --check-modes +``` + +Ordinary and optimized runs compare their entire receipt with RESULTS.json. +Independent literal rational coordinates cover all 772,850 ordinary windows +for S=2 through 40 and every excess/start/length. Original authenticated source +geometry/partition/carve bodies check 77,793 configurations, including 855 +uniform-guard admissions. Sixteen W values check each sharp family; 17 controls +detect wrong coordinates/origins/width/ties, invalid domains and corruption of +each source input. Descriptors reach 1024 bits without enumeration. The written +proof carries the universal theorem. + +## Scope, limits and credit + +**No new kappa; all five foundational assumptions remain.** This is one +geometric source admission. It supplies no row gap, matrix/Schur formation, +conditioning, precision/compiler/native/ownership admission, whole halo run or +final recovery. The verifier projects the exact Reference geometry prefix and +interior method; it does not produce Gaussian coefficients or execute native +payloads. Genuinely empty short windows need their own complete solver. + +Prepared for **@CubeJerry** with substantial OpenAI assistance. Credit Jose +Manuel / jmbarrancoml, Nick Petalas, Vlado Vojdanovski, Cinna Davis, Jeremy Kothe, +Mason Hale, Dugongue and the retained source contributors. The root separately +reviewed the proof and refined the complementary-gap sharpness control. Full +notices and scopes are retained. Apache-2.0; no human or proof-kernel acceptance. diff --git a/research/core-production-nonempty/README.md b/research/core-production-nonempty/README.md new file mode 100644 index 0000000000..2e392d2e5f --- /dev/null +++ b/research/core-production-nonempty/README.md @@ -0,0 +1,109 @@ +# Admit nonempty production Core interiors in original coordinates + +**Exact source-geometry theorem; no new kappa.** Prepared for **@CubeJerry** +with substantial OpenAI assistance. Apache-2.0. Canonical base: +`7c49fe32c55de02c2c873655c804b16e4c3fef0a`. + +This package supplies an exact decision for whether the original capped +Gaussian source carve has a nonempty interior in any ordinary target window, +including identity holes, original phase boundaries and endpoint half-cells. +It also gives a finite guard admitting **every original start at once**: + +`S >= e(6W+1)` and `L >= 12W+2`. + +Here S is the source period, e its excess, N=S+e the target period, W>=1 the +actual carve width, and L the window length. With the source's positive +dyadic cap and `2cap<=S`, each window satisfying the guard has a genuine +production interior and a boundary of at least 2W rows. Dyadic alignment and +`N-L>=W` remain additional admissions when applying this to the actual Core. + +## Result and relevance + +The actual source uses `q(j)=j+floor(e*j/S+1/2)` for selected target coordinates. +The inverse image of `[a,b)` is computed exactly by two ceiling divisions. +The clipped endpoint phases and the exact total length of the complete middle +phases then give the largest selected phase run M using a fixed number of +integer operations. The unchanged capped carve has a nonempty interior +**if and only if M>6W**. + +The uniform guard uses only internal full-cell lengths; it allows short +endpoint half-cells. Both displayed integer thresholds have explicit one-unit +counterexamples in the general ordinary-window domain that also retain +`N-L>=W`. No separate sharpness claim is made for dyadic aligned windows. +The exact classifier still applies +when the simple uniform guard is inconclusive. + +In the cited conservative complete-Core source family, theta=e/S<=p^-2, +W=O(sqrt(p) polylog p) and L>=p^400 make this guard hold eventually. Thus a +separate nonempty-interior hypothesis for every original context is unnecessary +in that family. The other source geometry, row-gap, numerical, compiler, +ownership, native and recovery obligations remain. This is one source +admission, not removal of a foundational assumption as a whole. + +The added guard has O(d^2) bit cost for d-bit descriptors. Its sufficient +version is checked once per axis when that axis's descriptors are shared by +all K contexts, with no field scan. Heterogeneous descriptors and exact +per-context checks retain their O(K g d^2) setup cost. No multiplier recurrence or selected +certificate changes. [PROOF.md](PROOF.md) gives the full statement and argument. + +## Evidence and scope + +| Method | Coverage | Scope | +|---|---|---| +| Independent literal coordinate oracle | All 772,850 ordinary windows for 2<=S<=40 and every e; 10,660 hole-only windows | Exact finite corroboration of the closed formula | +| Authenticated source geometry and partition bodies | 77,793 configurations, including 855 admitted uniform-guard windows | Original Reference geometry prefix, interior method, Core.partition and carve; no numerical Gaussian calculation | +| Sharp controls | Both adverse families for W=1 through 16 | Integer-window sharpness; dyadic optimization unclaimed | +| Failure detection | 17 controls; corrupted source inputs, wrong coordinates/ties/origin/width, invalid domains | Explicit exceptions remain active with Python -O | +| Large descriptors | 64, 257 and 1024-bit source sizes | The closed formula enumerates no periods or cells | + +The complete N=128,L=64 fixture at S=127,e=1,W=4,cap=4 has two original +windows. Each actual source carve has five interior blocks, 20 interior rows +and 44 boundary rows. This is a geometry fixture, not a native Core execution. + +## Reproduction + +Python 3.12 and its standard library suffice. Three actual executable source +files and the credited proof provenance are pinned by [SOURCES.json](SOURCES.json). + +```sh +python3 -B scripts/research_package.py --package research/core-production-nonempty --check-only +python3 -B scripts/research_package.py --package research/core-production-nonempty +python3 -B research/core-production-nonempty/verify.py +``` + +Expected final marker: `PASS_CORE_PRODUCTION_NONEMPTY`. Registered ordinary +and optimized runs compare the complete scientific output to RESULTS.json. +The written proof supplies the all-size result; finite coverage does not. + +## Novelty and credit + +Nick Petalas's CrocSwap/integer-mult-bounds#6259 supplies the phase cut and +endpoint length facts for the different retained 4w physical-source carve. +Vlado Vojdanovski's capped phase-fusion lineage supplies the current 6W cap, +separation and boundary-density reasoning. Jose Manuel / jmbarrancoml supplies +the exact common Reference and Core source, with Cinna Davis, Jeremy Kothe, +Mason Hale and the retained Gaussian contributors. Those results are cited; +this package does not reclaim their proofs or asymptotic density order. + +The new contribution binds the target-coordinate inverse image, identity-hole +treatment, exact empty-window decision and sharp finite uniform guard to the +current production bodies. Earlier density estimates already imply eventual +nonemptiness qualitatively; this makes the actual finite source admission +explicit and directly checkable. Full source attribution is in NOTICE.md. + +## Open next questions + +1. **Apply the guard in the complete uniform source constructor.** It removes + one geometric case, but source accuracy, original partition validation, + row/column norms and complete source heights still need a common admission. + Start with the current complete-Core preparation and feed its actual S,e,W,L, + cap descriptors through this guard. The numerical source certificates remain + the blocker; finite tiny interiors should not stand in for production carve. +2. **Classify sharper dyadic aligned guards.** The exact decision is available, + but both sharp counterexample families here use arbitrary integer windows. + Start with powers-of-two N,L and starts divisible by L. A new claim must keep + the original phase and period cuts; current sharpness is deliberately wider. +3. **Implement truly empty short sections.** The classifier identifies them + without ambiguity. Start with one such actual source window and trace the + zero-dimensional dense branch and complete sparse inverse. Source/shape + ownership and complete numerical/cost contracts are still required. diff --git a/research/core-production-nonempty/RESULTS.json b/research/core-production-nonempty/RESULTS.json new file mode 100644 index 0000000000..11a5d6055e --- /dev/null +++ b/research/core-production-nonempty/RESULTS.json @@ -0,0 +1,310 @@ +{ + "complete_middle_phase_windows": 566753, + "complete_small_window_checks": 772850, + "exact_window_digest": "366bde30ea815962596c49f47649cb1544af27e19c199ae50d3c72e082f02c28", + "hole_only_windows": 10660, + "large_descriptor_bits": [ + 64, + 257, + 1024 + ], + "literal_nonempty_cases": 1545, + "literal_partition_cases": 77793, + "negative_controls": [ + "target_hole_must_not_be_deleted", + "half_up_ties_must_not_be_even", + "original_origin_must_not_be_rebased", + "actual_carve_width_must_be_used", + "invalid_window", + "invalid_window", + "invalid_window", + "invalid_window", + "invalid_window", + "invalid_carve_parameters", + "invalid_carve_parameters", + "invalid_carve_parameters", + "invalid_carve_parameters", + "invalid_carve_parameters", + "source_corruption_rejected", + "source_corruption_rejected", + "source_corruption_rejected" + ], + "no_new_kappa": true, + "period_endpoint_windows": 63180, + "scope": "Exact source geometry and original partition/carve AST bodies only; no Gaussian numerical or native payload execution.", + "sharp_threshold_families": [ + { + "W": 1, + "length_minus_one": { + "L": 13, + "S": 21, + "a": 6, + "e": 3 + }, + "source_guard_minus_one": { + "L": 14, + "S": 20, + "a": 0, + "e": 3 + } + }, + { + "W": 2, + "length_minus_one": { + "L": 25, + "S": 39, + "a": 9, + "e": 3 + }, + "source_guard_minus_one": { + "L": 26, + "S": 38, + "a": 0, + "e": 3 + } + }, + { + "W": 3, + "length_minus_one": { + "L": 37, + "S": 57, + "a": 12, + "e": 3 + }, + "source_guard_minus_one": { + "L": 38, + "S": 56, + "a": 0, + "e": 3 + } + }, + { + "W": 4, + "length_minus_one": { + "L": 49, + "S": 75, + "a": 15, + "e": 3 + }, + "source_guard_minus_one": { + "L": 50, + "S": 74, + "a": 0, + "e": 3 + } + }, + { + "W": 5, + "length_minus_one": { + "L": 61, + "S": 93, + "a": 18, + "e": 3 + }, + "source_guard_minus_one": { + "L": 62, + "S": 92, + "a": 0, + "e": 3 + } + }, + { + "W": 6, + "length_minus_one": { + "L": 73, + "S": 111, + "a": 21, + "e": 3 + }, + "source_guard_minus_one": { + "L": 74, + "S": 110, + "a": 0, + "e": 3 + } + }, + { + "W": 7, + "length_minus_one": { + "L": 85, + "S": 129, + "a": 24, + "e": 3 + }, + "source_guard_minus_one": { + "L": 86, + "S": 128, + "a": 0, + "e": 3 + } + }, + { + "W": 8, + "length_minus_one": { + "L": 97, + "S": 147, + "a": 27, + "e": 3 + }, + "source_guard_minus_one": { + "L": 98, + "S": 146, + "a": 0, + "e": 3 + } + }, + { + "W": 9, + "length_minus_one": { + "L": 109, + "S": 165, + "a": 30, + "e": 3 + }, + "source_guard_minus_one": { + "L": 110, + "S": 164, + "a": 0, + "e": 3 + } + }, + { + "W": 10, + "length_minus_one": { + "L": 121, + "S": 183, + "a": 33, + "e": 3 + }, + "source_guard_minus_one": { + "L": 122, + "S": 182, + "a": 0, + "e": 3 + } + }, + { + "W": 11, + "length_minus_one": { + "L": 133, + "S": 201, + "a": 36, + "e": 3 + }, + "source_guard_minus_one": { + "L": 134, + "S": 200, + "a": 0, + "e": 3 + } + }, + { + "W": 12, + "length_minus_one": { + "L": 145, + "S": 219, + "a": 39, + "e": 3 + }, + "source_guard_minus_one": { + "L": 146, + "S": 218, + "a": 0, + "e": 3 + } + }, + { + "W": 13, + "length_minus_one": { + "L": 157, + "S": 237, + "a": 42, + "e": 3 + }, + "source_guard_minus_one": { + "L": 158, + "S": 236, + "a": 0, + "e": 3 + } + }, + { + "W": 14, + "length_minus_one": { + "L": 169, + "S": 255, + "a": 45, + "e": 3 + }, + "source_guard_minus_one": { + "L": 170, + "S": 254, + "a": 0, + "e": 3 + } + }, + { + "W": 15, + "length_minus_one": { + "L": 181, + "S": 273, + "a": 48, + "e": 3 + }, + "source_guard_minus_one": { + "L": 182, + "S": 272, + "a": 0, + "e": 3 + } + }, + { + "W": 16, + "length_minus_one": { + "L": 193, + "S": 291, + "a": 51, + "e": 3 + }, + "source_guard_minus_one": { + "L": 194, + "S": 290, + "a": 0, + "e": 3 + } + } + ], + "source_ast_sha256": { + "carve": "c4703665333efa0c651961a5668aef8e0f3e313801c3c99a309530cd00161537", + "partition": "fe640e31abefbafc7ed74e42b13ea2c9d2944d80fbfc1cd3765188b63e9f3abc", + "reference_geometry": "851c2b45f884153f83a9c2de0577e914d59e36a0fefa41349d4ae5ae560733c6" + }, + "source_fixture": [ + { + "L": 64, + "S": 127, + "W": 4, + "boundary_rows": 44, + "cap": 4, + "e": 1, + "interior_blocks": 5, + "interior_rows": 20, + "longest_run": 64, + "start": 0 + }, + { + "L": 64, + "S": 127, + "W": 4, + "boundary_rows": 44, + "cap": 4, + "e": 1, + "interior_blocks": 5, + "interior_rows": 20, + "longest_run": 63, + "start": 64 + } + ], + "status": "PASS_CORE_PRODUCTION_NONEMPTY", + "uniform_admitted_original_windows": 855 +} diff --git a/research/core-production-nonempty/SOURCES.json b/research/core-production-nonempty/SOURCES.json new file mode 100644 index 0000000000..6fa6573784 --- /dev/null +++ b/research/core-production-nonempty/SOURCES.json @@ -0,0 +1,42 @@ +{ + "base_commit": "7c49fe32c55de02c2c873655c804b16e4c3fef0a", + "files": [ + { + "git_blob": "92addfabde50655cea7ad5a84cca9cff5457adee", + "path": "research/rational-unitary-fft/gaussian_reference.py", + "sha256": "ed4d0908646e391d4a0ea32c988a0301a1793a72294ac7058a664ed3283ca3c3", + "usage": "input" + }, + { + "git_blob": "218bee551a3916c0af41e9b65c7a3a778b888bdb", + "path": "research/rational-unitary-fft/core.py", + "sha256": "b93bb08c49f7a1a79fb31534f361eb3e4ec3c271a140c6f5685c68f1cd2b940f", + "usage": "input" + }, + { + "git_blob": "d6f5a14cb26c04ab3feb728430005808e56613fa", + "path": "research/capped-phase-fusion/evidence/gaussian_fast_ultra/check_capped_gauges.py", + "sha256": "121279bef47dd490bf29fc72ddbce547176cdaf1154af67dc8b96d7baa8cfc6f", + "usage": "input" + }, + { + "git_blob": "3404fbdd5e7529a0674eef26114b5071e4586cec", + "path": "docs/research/agent-task-catalog.json", + "sha256": "ead6cdc9d0af6d58e8a49744d8ec8c7c15e13d2ba93c276c434bcf9b51b93a81", + "usage": "provenance" + }, + { + "git_blob": "2bae5211eaba6ae5e7a14a5a9854b891b7845a5d", + "path": "research/gaussian-phase-boundary-count/PROOF.md", + "sha256": "7c1a0a852ed649f2d0c7c6a4ba2fa85baef19ff2bcf1c4d2b0b68e23df5fe24c", + "usage": "provenance" + }, + { + "git_blob": "a2d1c5ae923db7649627dbf419434e36267e57c6", + "path": "research/capped-phase-fusion/evidence/gaussian_fast_ultra/CAPPED-GAUGE-AUDIT.md", + "sha256": "1030a34922709ab8d3434a4c57a4a58934ae268c237fb598cb415697da411c9f", + "usage": "provenance" + } + ], + "schema_version": 1 +} diff --git a/research/core-production-nonempty/TASK.json b/research/core-production-nonempty/TASK.json new file mode 100644 index 0000000000..60a72599bf --- /dev/null +++ b/research/core-production-nonempty/TASK.json @@ -0,0 +1,107 @@ +{ + "actual_scope": "Prove an exact original target-window nonempty-interior decision for the current Reference/6W capped carve, and a sharp finite guard uniform over every original start.", + "ai_assistance": "Substantial OpenAI assistance in proofs, code, exact independent oracles and packaging. Root independently reviewed the mathematical source contract and ordinary-gap sharpness family. No human or proof-kernel acceptance.", + "author": "Prepared for @CubeJerry", + "base_commit": "7c49fe32c55de02c2c873655c804b16e4c3fef0a", + "bottleneck_link": "analytic_recovery and compiler need the actual source partition at every original complete context; arbitrary finite interiors do not supply this uniform geometry.", + "budget_minutes": 90, + "evidence": "PROOF.md derives the exact target inverse image/longest run, unchanged carve iff criterion and S>=e(6W+1),L>=12W+2 uniform guard. Independent literal coordinates and authenticated source bodies cover exact finite domains; both sharp ordinary-window families retain N-L>=W.", + "finite_domain": "All e, starts and positive ordinary lengths for 2<=S<=40; literal partition domain/original-start subsets explicit in verify.py. Deterministic exhaustive checks; no random seed.", + "independent_previous_package": "core-halo-source-bridge", + "no_new_kappa": true, + "open_questions": [ + { + "blocked_by": "Remaining analytic/numerical/compiler source admissions are separate; arbitrary finite interior providers are insufficient.", + "first_step": "Feed actual production S,e,W,L,cap descriptors through the guard and retain the same original partition in the complete-Core provider.", + "question": "Can the guard join the complete uniform source constructor with its remaining certificates?", + "why_it_matters": "It removes nonempty-interior case splitting but not source gaps, precision, matrices or uniform preparation heights." + }, + { + "blocked_by": "A domain-specific proof is needed; integer-window witnesses do not establish dyadic sharpness.", + "first_step": "Use the exact classifier for powers-of-two N,L and starts divisible by L, retaining original phase and period cuts.", + "question": "Is a sharper guard available for dyadic aligned target sections?", + "why_it_matters": "Current one-unit sharpness is in the wider ordinary-window/complementary-gap domain." + }, + { + "blocked_by": "No full native empty-interior service is supplied by this geometry package.", + "first_step": "Trace one actual empty window through source, numerical, ownership and complete-cost contracts.", + "question": "How should genuinely empty short sections execute at the full native interface?", + "why_it_matters": "The classifier diagnoses them but does not implement a zero-dimensional dense branch or complete sparse solve." + } + ], + "original_card": { + "acceptance_gate": "Identify the proposition and what would change downstream; do not equate a finite replay with a universal 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." + ], + "bottleneck_link": "Judge the actual current supplier contract and complete signed target/paid bill; frozen-profile ceilings require an applicability proof.", + "existing_checks": [ + { + "evidence": "research/unconditional-batched-crt/README.md", + "remaining": "Independent proof audit of one caller-bound all-size implication; all other premises remain explicit.", + "scope": "PR #4100: proposed unconditional construction and finite checks, without independent acceptance.", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129", + "source_commit": "337d04939571a637aeab54a0f58f54fde811663a", + "status": "author-checked" + }, + { + "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.", + "scope": "Selected PR5599: complete helper-subspace construction and independent caller replay; five framework assumptions remain.", + "selected_record_sha256": "2a0220e866417774606e0f991e41b9c1d26b1f43b97857238cf478dbc7d330b5", + "source_commit": "09dd0965711ca7eeb169057a420abab1c9052137", + "status": "reviewed" + } + ], + "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.", + "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." + }, + "id": "uniform-transfer-audit", + "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." + ], + "overlap_terms": [ + "native_all_columns", + "owned_erasure", + "compiler", + "precision_tape", + "analytic_recovery" + ], + "question": "Can one of the selected record's five inherited assumptions be proved at its actual caller?", + "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." + ], + "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" + ] + }, + "outcome": "completed", + "previous_public_commit": "73d5adaba2b7dc662e86eb901e81369a3f73be9f", + "priority_revision": 8, + "schema_version": 1, + "scope_change_reason": "The source-halo bridge exposed production-context admissions as a distinct obligation. Existing phase cuts and capped density are credited; this targets actual identity-hole coordinates and finite nonempty source admission rather than repeating a generic carve bound.", + "scope_status": "refined", + "seed": 75, + "source_projection_scope": "Exact Reference geometry constructor prefix and interior method, unchanged Core.partition and carve AST bodies; no exponential intervals, Gaussian values or native payloads.", + "stop_rule": "Freeze at a source-bound all-size theorem, exact independent finite controls and complete source setup invoice. Do not launch Gaussian/native payloads or broaden to numerical source admission.", + "task_id": "uniform-transfer-audit", + "tracks": [ + 60, + 75 + ], + "wave": 2, + "worker": "analytic_join" +} diff --git a/research/core-production-nonempty/VERIFY.json b/research/core-production-nonempty/VERIFY.json new file mode 100644 index 0000000000..adf9d0cd9f --- /dev/null +++ b/research/core-production-nonempty/VERIFY.json @@ -0,0 +1,32 @@ +{ + "commands": [ + { + "argv": [ + "{python}", + "-B", + "{package}/verify.py" + ], + "checks": "Closed target-window classifier against complete independent literal rational coordinates, original authenticated source bodies, sharp ordinary-gap thresholds and source/domain controls; compare full frozen receipt.", + "timeout_seconds": 180 + }, + { + "argv": [ + "{python}", + "-O", + "-B", + "{package}/verify.py" + ], + "checks": "Identical independent source geometry checks and frozen receipt under optimized Python; all admission and failure controls use explicit exceptions.", + "timeout_seconds": 180 + } + ], + "inputs": [ + "research/rational-unitary-fft/gaussian_reference.py", + "research/rational-unitary-fft/core.py", + "research/capped-phase-fusion/evidence/gaussian_fast_ultra/check_capped_gauges.py" + ], + "python": "3.12", + "requirements": [], + "schema_version": 1, + "status": "ready" +} diff --git a/research/core-production-nonempty/guard.py b/research/core-production-nonempty/guard.py new file mode 100644 index 0000000000..5f72c9aca8 --- /dev/null +++ b/research/core-production-nonempty/guard.py @@ -0,0 +1,91 @@ +"""Exact target-window admission for the retained capped Gaussian carve. + +Prepared for @CubeJerry with substantial OpenAI assistance. Apache-2.0. +This is input-independent source geometry, not an online payload primitive. +""" +from dataclasses import dataclass + + +def need(ok, message): + if not ok: + raise ValueError(message) + + +def ceil_div(numerator, denominator): + need(type(numerator) is int and type(denominator) is int and denominator > 0, + 'exact integer ceiling division') + return -((-numerator) // denominator) + + +@dataclass(frozen=True) +class Window: + source_size: int + excess: int + start: int + length: int + + def __post_init__(self): + need(all(type(x) is int for x in self.__dict__.values()), 'integer source geometry') + need(0 < self.excess < self.source_size, 'retained source/excess domain') + need(self.length > 0 and 0 <= self.start < self.start + self.length + <= self.source_size + self.excess, 'ordinary original target window') + + +def phase_cut(source_size, excess, phase): + need(0 <= phase <= excess + 1, 'original source phase cut') + if phase == 0: + return 0 + if phase == excess + 1: + return source_size + return ceil_div(source_size * (2 * phase - 1), 2 * excess) + + +def longest_run(window): + """Maximum phase-pure selected run in the original target interval. + + Uses a fixed number of integer operations; source periods and phase cells + are never enumerated. Returns exact source endpoints as a reviewable witness. + """ + s, e, a, length = (window.source_size, window.excess, window.start, window.length) + target = s + e + first = ceil_div(s * (2 * a - 1), 2 * target) + stop = ceil_div(s * (2 * (a + length) - 1), 2 * target) + need(0 <= first <= stop <= s, 'inverse selected-index interval') + if first == stop: + return {'maximum': 0, 'first_source': first, 'stop_source': stop, + 'first_phase': None, 'last_phase': None, 'complete_middle_cells': 0} + left_phase = (2 * e * first + s) // (2 * s) + right_phase = (2 * e * (stop - 1) + s) // (2 * s) + if left_phase == right_phase: + maximum = stop - first + middle_cells = 0 + else: + left_end = phase_cut(s, e, left_phase + 1) + right_start = phase_cut(s, e, right_phase) + maximum = max(left_end - first, stop - right_start) + middle_cells = right_phase - left_phase - 1 + if middle_cells: + lower = s // e + middle_total = right_start - left_end + need(middle_cells * lower <= middle_total <= middle_cells * (lower + 1), + 'two possible complete interior phase lengths') + maximum = max(maximum, lower + int(middle_total > middle_cells * lower)) + return {'maximum': maximum, 'first_source': first, 'stop_source': stop, + 'first_phase': left_phase, 'last_phase': right_phase, + 'complete_middle_cells': middle_cells} + + +def has_interior(window, width, cap): + need(type(width) is int and width >= 1, 'positive retained physical carve width') + need(type(cap) is int and cap >= 1 and cap & (cap - 1) == 0 + and 2 * cap <= window.source_size, 'admitted dyadic source interior cap') + return longest_run(window)['maximum'] > 6 * width + + +def uniform_guard(source_size, excess, width, length, cap): + """Sufficient for every original start; no per-context scan or cache.""" + Window(source_size, excess, 0, length) + need(type(width) is int and width >= 1, 'positive retained physical carve width') + need(type(cap) is int and cap >= 1 and cap & (cap - 1) == 0 + and 2 * cap <= source_size, 'admitted dyadic source interior cap') + return source_size >= excess * (6 * width + 1) and length >= 12 * width + 2 diff --git a/research/core-production-nonempty/production_sources.py b/research/core-production-nonempty/production_sources.py new file mode 100644 index 0000000000..65d54f82c9 --- /dev/null +++ b/research/core-production-nonempty/production_sources.py @@ -0,0 +1,80 @@ +"""Authenticate and project only exact source geometry, never Gaussian values. + +The retained Reference constructor prefix, interior method, Core.partition and +carve bodies are compiled unchanged from their pinned syntax trees. No ideal +Gaussian, dense solve, numerical Core or tape execution is asserted here. +""" +import ast +from copy import deepcopy +from dataclasses import dataclass +from fractions import Fraction +from hashlib import sha1, sha256 +import json +from pathlib import Path +from types import SimpleNamespace + +from guard import need + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +REFERENCE = 'research/rational-unitary-fft/gaussian_reference.py' +CORE = 'research/rational-unitary-fft/core.py' +CARVE = 'research/capped-phase-fusion/evidence/gaussian_fast_ultra/check_capped_gauges.py' + + +def authenticate(overrides=None): + rows = json.loads((HERE / 'SOURCES.json').read_text())['files'] + raw = {} + for row in rows: + if row['usage'] != 'input': + continue + path = ROOT / row['path'] + need(path.is_file() and not path.is_symlink(), 'regular source input') + body = (overrides or {}).get(row['path'], path.read_bytes()) + need(sha256(body).hexdigest() == row['sha256'], 'exact source SHA256: ' + row['path']) + need(sha1(b'blob ' + str(len(body)).encode() + b'\0' + body).hexdigest() == row['git_blob'], + 'exact source Git blob: ' + row['path']) + raw[row['path']] = body + return raw + + +def bind(overrides=None): + raw = authenticate(overrides) + reference = ast.parse(raw[REFERENCE]) + selected = [deepcopy(x) for x in reference.body + if isinstance(x, (ast.FunctionDef, ast.ClassDef)) + and x.name in ('nearest_up', 'ReferenceSpec', 'Coordinates', 'SelectedAddresses')] + need(len(selected) == 4, 'exact four source geometry definitions') + original = next(x for x in reference.body if isinstance(x, ast.ClassDef) and x.name == 'Reference') + init = deepcopy(next(x for x in original.body if isinstance(x, ast.FunctionDef) and x.name == '__init__')) + cuts = [i for i, x in enumerate(init.body) if isinstance(x, ast.Assign) + and any(isinstance(t, ast.Attribute) and isinstance(t.value, ast.Name) + and t.value.id == 'self' and t.attr == 'exp' for t in x.targets)] + need(len(cuts) == 1 and cuts[0] > 10, 'exact pre-exponential source constructor prefix') + init.body = init.body[:cuts[0]] + interior = deepcopy(next(x for x in original.body if isinstance(x, ast.FunctionDef) and x.name == 'interior')) + geometry = deepcopy(original) + geometry.name = 'Geometry' + geometry.body = [init, interior] + selected.append(geometry) + core = ast.parse(raw[CORE]) + core_class = next(x for x in core.body if isinstance(x, ast.ClassDef) and x.name == 'Core') + partition = deepcopy(next(x for x in core_class.body if isinstance(x, ast.FunctionDef) and x.name == 'partition')) + carve_tree = ast.parse(raw[CARVE]) + carve = deepcopy(next(x for x in carve_tree.body if isinstance(x, ast.FunctionDef) and x.name == 'carve')) + selected += [partition, carve] + module = ast.fix_missing_locations(ast.Module(body=selected, type_ignores=[])) + namespace = {'__name__': __name__, 'need': need, 'Q': Fraction, + 'rational': Fraction, 'dataclass': dataclass} + exec(compile(module, '', 'exec', optimize=0), namespace) + def run(source_size, excess, start, length, width, cap): + # Only original geometry is constructed. Numerical source constructor + # continuation is deliberately outside this projection's claimed scope. + reference = namespace['Geometry']({}, source_size, excess, 1, 0, 0, 8) + shell = SimpleNamespace(reference=reference, n=length, + coordinates=tuple(range(start, start + length)), + width=width, cap=cap, carve=namespace['carve']) + pieces, cells = namespace['partition'](shell) + return reference, pieces, cells + return run, {name: sha256(ast.dump(node, include_attributes=False).encode()).hexdigest() + for name, node in [('reference_geometry', geometry), ('partition', partition), ('carve', carve)]} diff --git a/research/core-production-nonempty/verify.py b/research/core-production-nonempty/verify.py new file mode 100644 index 0000000000..4c441b8bb0 --- /dev/null +++ b/research/core-production-nonempty/verify.py @@ -0,0 +1,198 @@ +"""Independent literal coordinates and exact original source-body controls.""" +import argparse +from fractions import Fraction as Q +from hashlib import sha256 +import json +from pathlib import Path + +from guard import Window, has_interior, longest_run, uniform_guard +from production_sources import bind, authenticate, CORE, CARVE, REFERENCE + + +def require(ok, message): + if not ok: + raise ValueError(message) + + +def literal_source(source_size, excess): + # Independent rational enumeration. No inverse-cut or longest-run formula. + selected = {} + for j in range(source_size): + real = Q(excess * j, source_size) + low = real.numerator // real.denominator + phase = low + int(real - low >= Q(1, 2)) + selected[j + phase] = (j, phase) + require(len(selected) == source_size, 'literal selected-coordinate injection') + return selected + + +def one_window(selected, start, length): + longest = current = 0 + previous = None + for coordinate in range(start, start + length): + item = selected.get(coordinate) + if item is None: + current = 0 + elif previous is not None and item == (previous[0] + 1, previous[1]): + current += 1 + else: + current = 1 + previous = item + longest = max(longest, current) + return longest + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('--emit', action='store_true', help='emit regenerated receipt without the frozen-receipt comparison') + cli = parser.parse_args() + literal_run, source_asts = bind() + digest = sha256() + windows = empty_windows = endpoint_windows = phase_middle_windows = 0 + # Complete finite coverage: every e, start and positive ordinary target + # window for 2<=S<=40. Incremental oracle shares no cut arithmetic. + for s in range(2, 41): + for e in range(1, s): + target = s + e + selected = literal_source(s, e) + for a in range(target): + current = best = 0 + previous = None + for stop in range(a + 1, target + 1): + item = selected.get(stop - 1) + if item is None: + current = 0 + elif previous is not None and item == (previous[0] + 1, previous[1]): + current += 1 + else: + current = 1 + previous = item + best = max(best, current) + actual = longest_run(Window(s, e, a, stop - a)) + require(actual['maximum'] == best, 'closed maximum differs from literal source') + require(sum(a <= coordinate < stop for coordinate in selected) + == actual['stop_source'] - actual['first_source'], + 'inverse selected interval count') + digest.update(bytes((s, e, a, stop - a, best))) + windows += 1 + empty_windows += best == 0 + endpoint_windows += a == 0 or stop == target + phase_middle_windows += actual['complete_middle_cells'] > 0 + + # Literal Core.partition and carve, with the original Reference geometry + # constructor prefix and interior method, for all original starts here. + native_cases = native_nonempty = uniform_cases = 0 + source_fixture_rows = [] + for s in (*range(2, 19), 31, 63, 127): + excesses = range(1, s) if s <= 18 else (1, 2, 3) + for e in excesses: + target = s + e + lengths = [1 << k for k in range(1, target.bit_length()) if (1 << k) <= target] + for width in (1, 2, 4): + for cap in (1, 2, 4): + if 2 * cap > s: + continue + for length in lengths: + admitted = uniform_guard(s, e, width, length, cap) + # Larger fixtures retain all aligned original windows, + # endpoints and every near-boundary original origin. + starts = range(target - length + 1) if s <= 18 else sorted( + set(range(0, target - length + 1, length)) + | {0, target - length, min(1, target-length)} + | {a for a in range(target - length + 1) + if a in (target // 2 - 2, target // 2 - 1, target // 2, target // 2 + 1)}) + for start in starts: + _, pieces, cells = literal_run(s, e, start, length, width, cap) + window = Window(s, e, start, length) + predicted = has_interior(window, width, cap) + require(predicted == bool(cells), 'actual source carve admission differs') + require(not admitted or cells, 'uniform guard admitted an empty original context') + require(all(0 < len(c['indices']) <= cap + and len(c['indices']) & (len(c['indices'])-1) == 0 for c in cells), + 'source interior cap/dyadic contract') + native_cases += 1 + native_nonempty += bool(cells) + uniform_cases += admitted + if (s,e,width,cap,length,start) in ((127,1,4,4,64,0),(127,1,4,4,64,64)): + source_fixture_rows.append({'S':s,'e':e,'W':width,'cap':cap,'L':length,'start':start, + 'longest_run':longest_run(window)['maximum'],'interior_blocks':len(cells), + 'interior_rows':sum(len(c['indices']) for c in cells), + 'boundary_rows':sum(p['stop']-p['start'] for p in pieces if p['kind']=='B')}) + + # Both simple sufficient guards are tight on ordinary target windows. + thresholds = [] + for width in range(1, 17): + s, e, length, start = 18*width+3, 3, 12*width+1, 3*width+3 + _, _, cells = literal_run(s,e,start,length,width,1) + require(not cells and longest_run(Window(s,e,start,length))['maximum'] == 6*width, + 'length-minus-one witness') + require(uniform_guard(s,e,width,length+1,1), 'funded uniform length threshold') + s2, e2, l2 = 18*width+2, 3, 12*width+2 + _, _, cells2 = literal_run(s2,e2,0,l2,width,1) + require(not cells2 and s2 == e2*(6*width+1)-1, + 'source-ratio-minus-one witness') + require(s+e-length >= width and s2+e2-l2 >= width, + 'both sharp families retain the ordinary complementary gap') + thresholds.append({'W':width,'length_minus_one':{'S':s,'e':e,'a':start,'L':length}, + 'source_guard_minus_one':{'S':s2,'e':e2,'a':0,'L':l2}}) + + # Neither old source-coordinate units nor tie-to-even rounding may be used. + selected = literal_source(14,1) + actual = longest_run(Window(14,1,1,13))['maximum'] + require(actual == 6 and one_window(selected,1,13) == 6, 'retained target hole witness') + wrong_source_run = max(sum(1 for j in range(1,14) if phase == (2*j+14)//28) + for phase in (0,1)) + require(wrong_source_run == 7 and wrong_source_run > actual, 'source/target coordinate confusion detected') + require(round(Q(1,2)) == 0 and literal_source(14,1)[8] == (7,1), + 'half-up versus ties-even control') + require(longest_run(Window(14,1,0,13))['maximum'] == 7 + and has_interior(Window(14,1,0,13),1,1) + and not has_interior(Window(14,1,1,13),1,1), 'unpaid origin rebasing detected') + _,_,actual_wide = literal_run(14,1,0,14,2,1) + require(not actual_wide and uniform_guard(14,1,1,14,1), + 'substituting a smaller width for the actual carve width detected') + controls = ['target_hole_must_not_be_deleted','half_up_ties_must_not_be_even', + 'original_origin_must_not_be_rebased','actual_carve_width_must_be_used'] + for args in ((True,1,0,1),(2,2,0,1),(4,1,-1,1),(4,1,0,0),(4,1,4,2)): + try: Window(*args) + except ValueError: controls.append('invalid_window') + else: raise ValueError('invalid window accepted') + for width,cap in ((0,1),(1,3),(1,32),(True,1),(1,True)): + try: has_interior(Window(15,1,0,8),width,cap) + except ValueError: controls.append('invalid_carve_parameters') + else: raise ValueError('invalid carve parameters accepted') + raw = authenticate() + for path in (REFERENCE,CORE,CARVE): + try: bind({path:raw[path]+b'\n# deliberately corrupted source\n'}) + except ValueError: controls.append('source_corruption_rejected') + else: raise ValueError('corrupted source was admitted') + + # Very large descriptors exercise the constant-size formula without + # constructing periods or enumerating cells. This is exact arithmetic only. + huge = [] + for bits in (64,257,1024): + s=(1<