From d622d8c62defa9defeb95741e88b33a120044866 Mon Sep 17 00:00:00 2001 From: Jerry Jiaheng Chen <80299683+CubeJerry@users.noreply.github.com> Date: Thu, 12 Nov 2026 10:59:45 +0800 Subject: [PATCH] Construct chronological rank libraries at independent ambient caps and prove the quadratic explicit width-output obstruction --- research/ambient-rank-library/NOTICE.md | 33 + research/ambient-rank-library/OVERLAP.json | 129 +++ research/ambient-rank-library/PR-TITLE.txt | 1 + research/ambient-rank-library/PR.md | 107 +++ research/ambient-rank-library/PROOF.md | 420 +++++++++ research/ambient-rank-library/README.md | 161 ++++ research/ambient-rank-library/SOURCES.json | 93 ++ research/ambient-rank-library/TASK.json | 99 ++ research/ambient-rank-library/VALIDATION.json | 850 ++++++++++++++++++ research/ambient-rank-library/VERIFY.json | 47 + .../ambient-rank-library/ambient_library.py | 312 +++++++ .../independent/RESULT.json | 321 +++++++ .../independent/REVIEW.md | 200 +++++ .../independent/SOURCE-BINDINGS.json | 79 ++ .../ambient-rank-library/independent/check.py | 241 +++++ .../inputs/default_library.py | 305 +++++++ .../ambient-rank-library/literal_oracle.py | 137 +++ .../reference/FINITE-PRECOMPILATION.md | 313 +++++++ .../reference/default-library-PROOF.md | 297 ++++++ .../reference/selected-ambient-PROOF.md | 381 ++++++++ .../reference/symbolic-batch-PROOF.md | 98 ++ .../reference/width-bound-README.md | 407 +++++++++ research/ambient-rank-library/verify.py | 277 ++++++ 23 files changed, 5308 insertions(+) create mode 100644 research/ambient-rank-library/NOTICE.md create mode 100644 research/ambient-rank-library/OVERLAP.json create mode 100644 research/ambient-rank-library/PR-TITLE.txt create mode 100644 research/ambient-rank-library/PR.md create mode 100644 research/ambient-rank-library/PROOF.md create mode 100644 research/ambient-rank-library/README.md create mode 100644 research/ambient-rank-library/SOURCES.json create mode 100644 research/ambient-rank-library/TASK.json create mode 100644 research/ambient-rank-library/VALIDATION.json create mode 100644 research/ambient-rank-library/VERIFY.json create mode 100644 research/ambient-rank-library/ambient_library.py create mode 100644 research/ambient-rank-library/independent/RESULT.json create mode 100644 research/ambient-rank-library/independent/REVIEW.md create mode 100644 research/ambient-rank-library/independent/SOURCE-BINDINGS.json create mode 100644 research/ambient-rank-library/independent/check.py create mode 100644 research/ambient-rank-library/inputs/default_library.py create mode 100644 research/ambient-rank-library/literal_oracle.py create mode 100644 research/ambient-rank-library/reference/FINITE-PRECOMPILATION.md create mode 100644 research/ambient-rank-library/reference/default-library-PROOF.md create mode 100644 research/ambient-rank-library/reference/selected-ambient-PROOF.md create mode 100644 research/ambient-rank-library/reference/symbolic-batch-PROOF.md create mode 100644 research/ambient-rank-library/reference/width-bound-README.md create mode 100644 research/ambient-rank-library/verify.py diff --git a/research/ambient-rank-library/NOTICE.md b/research/ambient-rank-library/NOTICE.md new file mode 100644 index 0000000000..c5064e06f0 --- /dev/null +++ b/research/ambient-rank-library/NOTICE.md @@ -0,0 +1,33 @@ +# Attribution and assistance + +Prepared for **@CubeJerry** with substantial OpenAI assistance in the +proof, evaluator, independent author-side arithmetic oracle, mutation +controls and writing. The lead agent's separately recorded review is +additional AI evidence, not human or formal-kernel acceptance. + +Credit Jacob Alan Sussman for the multinomial integer compiler and +Theorem 1G; zxv and the retained #4436/#4359 lineage for the chronological +flow and finite-precompilation argument; Mihir Srivastava for #4507's +least per-cut batching theorem; the authors and retained notices of +#4638/#5071 for the plateau divisor and separated symbolic recurrence. +Credit @CubeJerry and the selected #6916/#7000 lineage for the actual +independent ambient-cap geometry and its source-bound application. + +`ambient_library.py` adapts the algorithm of @CubeJerry's #7345 at +`022461f115369efd988ef8c459907f5544bb8bb3`. The original `library.py` is +retained byte-for-byte as `inputs/default_library.py`, with its proof as +`reference/default-library-PROOF.md`. This adaptation and the default +regression are not independent reproductions of that implementation. +The new `literal_oracle.py` imports neither evaluator, uses explicit +role/path/port occurrences, prime valuations and rational costs, and +serves as the separate arithmetic check on bounded fixtures. + +The root's leaf/owner companion at commit +`81f0b0b9a920bd1c9da583cbc3612efd5e75ea94` motivated the valid-library +interface; it is not imported here and has no claimed upstream PR number. + +Frozen references retain their original notices and attribution. New +material is provided under Apache-2.0. No predecessor result, default +width asymptotic, selected source admission or normalized kappa improvement +is claimed as new. Mathematical novelty is the explicit ambient quantitative +construction/budget and scoped uniform-output obstruction described here. diff --git a/research/ambient-rank-library/OVERLAP.json b/research/ambient-rank-library/OVERLAP.json new file mode 100644 index 0000000000..b450de1918 --- /dev/null +++ b/research/ambient-rank-library/OVERLAP.json @@ -0,0 +1,129 @@ +{ + "base": "e54523517d0f03e58352e647c403a5af3e525a57", + "date": "2026-11-12", + "scope": "Exact quantitative separated rank libraries at A>=m, plus a uniform evaluated-output obstruction; no native instruction emitter or new kappa.", + "queries": [ + { + "query": "\"ambient\" \"library\"", + "tool": "github_search_prs", + "sort": "updated descending", + "results": [ + { + "number": 7345, + "title": "Generate exact chronological compiler library tables with product aggregation and explicit binary and tape cost bounds", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/7345" + }, + { + "number": 7331, + "title": "Prove one crossing path keeps the proper-terminal rank-bill maximum and four break it (no κ)", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/7331" + }, + { + "number": 7293, + "title": "Bound fixed BIT destination-chart reuse (0% κ change)", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/7293" + }, + { + "number": 7263, + "title": "Attain exact factor-one Stein bounds with at most 2r terms (no κ)", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/7263" + }, + { + "number": 7254, + "title": "Construct polynomial two-capacity sampling without prescribed images (no κ)", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/7254" + }, + { + "number": 7248, + "title": "Prove four independent full guards beat their product over every field", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/7248" + }, + { + "number": 7205, + "title": "Prove the first central Schur state collision at pivot size four (no κ)", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/7205" + }, + { + "number": 7193, + "title": "Prove the sharp rank-two bound for five address-twist contributions (no κ)", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/7193" + } + ] + }, + { + "query": "\"ambient\" \"rank-library\"", + "tool": "github_search_prs", + "sort": "updated descending", + "results": [ + { + "number": 7345, + "title": "Generate exact chronological compiler library tables with product aggregation and explicit binary and tape cost bounds", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/7345" + }, + { + "number": 6384, + "title": "Prove a strictly weaker mirror-capacity criterion (no κ)", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/6384" + }, + { + "number": 5097, + "title": "Prove exact singular partial Pauli completion lengths", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/5097" + }, + { + "number": 4690, + "title": "Add charged Gaussian contact, phase and Pauli gauge searches (no new κ)", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/4690" + } + ] + }, + { + "query": "\"ambient-cap\" \"width\"", + "tool": "github_search_prs", + "sort": "updated descending", + "results": [ + { + "number": 6208, + "title": "Construct order-17 Gaussian-dyadic Clifford attaining native rank eight (no κ)", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/6208" + } + ] + } + ], + "precise_comparisons": [ + { + "pr": 7345, + "commit": "022461f115369efd988ef8c459907f5544bb8bb3", + "files": [ + "research/quantitative-rank-library/PROOF.md", + "research/quantitative-rank-library/library.py" + ], + "finding": "Explicitly A=m; general ambient and selected A=153^1920 outside its theorem." + }, + { + "pr": 4638, + "canonical_file": "research/chronological-width-bound/README.md", + "finding": "Default m-dependent contraction and plateau visits; general A divisor rederived, not imported unchanged." + }, + { + "pr": 6916, + "canonical_file": "research/p104-shared-native-helper-splits/retained/compiler/PROOF.md", + "finding": "Already proves general ambient flow and qualitative finite construction; the new claim is quantitative evaluated library and explicit parameter dependence." + }, + { + "prs": [ + 4507, + 5071 + ], + "canonical_file": "research/symbolic-integer-batch-width/PROOF.md", + "finding": "Least chronological recurrence and singleton cuts inherited; not a new denominator rule." + } + ], + "classification": "No exact superseding ambient quantitative claim identified in this bounded search; this is not exhaustive novelty evidence.", + "exclusions": [ + "Full scalar/phase/adapter emitter assigned separately", + "Fixed-template outer absorption already covered by retained sources", + "No selected practical materialization or kappa improvement" + ], + "coordination": "Lead orchestrator maintains current claims and wave manifest; no independent placeholder issue or upstream PR." +} diff --git a/research/ambient-rank-library/PR-TITLE.txt b/research/ambient-rank-library/PR-TITLE.txt new file mode 100644 index 0000000000..576fbed6fa --- /dev/null +++ b/research/ambient-rank-library/PR-TITLE.txt @@ -0,0 +1 @@ +Construct chronological rank libraries at independent ambient caps and prove the quadratic explicit width-output obstruction diff --git a/research/ambient-rank-library/PR.md b/research/ambient-rank-library/PR.md new file mode 100644 index 0000000000..a0810379b1 --- /dev/null +++ b/research/ambient-rank-library/PR.md @@ -0,0 +1,107 @@ +## Result and why it matters + +The exact rank-library generator in #7345 explicitly assumes that the +ambient cap equals the largest productive target. The selected compiler +instead uses the actual cap `A=153^1920`, above its maximum target. +This package proves and implements the evaluated least-chronological +library for every fixed separated rule with independent `A>=m`, retaining +every individual exit divisor and all recursive costs. + +It also proves a necessary qualification on uniform complexity. For the +fixed targets 2 and 3 and one paid rank-1 site, every A>=4 satisfies +`B_n=2^(floor((n-A)/2)+1)` on `A<=n<2A`. The width outputs on that plateau +alone contain exactly `floor((A-1)^2/4)+2A` bits. At `N=2A-1`, a uniform +near-linear explicit all-rank bit-output bound is therefore impossible. +This does not contradict the retained selected construction: its finite +template is fixed before multiplication input size varies. + +## Change and exact scope + +Adds only `research/ambient-rank-library/`, containing the proof, bounded +integer evaluator, separately written explicit-occurrence/prime-valuation +oracle, semantic controls, source pins, receipt and registered replay. + +The ambient-cap flow is inherited from the retained #6916 compiler proof +§6. The new quantitative analysis proves uniform contraction by `(A-1)/A`, +an all-prime plateau divisor with exponent `A*ceil(log2 k_min)`, and +explicit binary/indexed and sequential-tape metadata costs. The default +constant m cannot be substituted for A: for A=64 the actual width B_127 is +2^32 while that false one-plateau divisor is 8. + +For each fixed A and fixed histograms, evaluated row lengths remain +polylogarithmic in N, indexed construction is `N*polylog N`, and the +sequential companion is `N^2*polylog N`. The proof exposes every A-dependent +factor when A is supplied in binary. Initialization, arithmetic lengths, +sorting, child-table access, copying, head restoration and historical cells +are charged. These are metadata bounds, not native payload-movement claims. + +## Novelty and predecessor credit + +Credit #4507/#5071 for least chronological gcd/LCM integrality, #4638 for +the default plateau-visit argument, #6916 and the selected source lineage +for independent ambient geometry, and #7345 at +`022461f115369efd988ef8c459907f5544bb8bb3` for product aggregation and the +quantitative default-library framework. The new evaluator adapts that code; +its frozen original is used only for separately labelled regression checks. +The ambient extension and varying-A lower bound are the delta. + +This supplies a valid numerical library premise for the separately +published [chronological leaf/owner locator](https://github.com/CubeJerry/integer-mult-bounds/tree/81f0b0b9a920bd1c9da583cbc3612efd5e75ea94/research/chronological-leaf-owner-index). +That companion is contextual credit, not a runtime dependency or an +invented upstream PR reference. Canonical tested base is +`e54523517d0f03e58352e647c403a5af3e525a57`; exact nine-file provenance is +retained in `SOURCES.json`. + +## Reproduction and evidence + +From the repository root with Python 3.12 and the standard library: + +```sh +python -I -W error -B research/ambient-rank-library/verify.py +python -I -O -W error -B research/ambient-rank-library/verify.py +python -B scripts/research_package.py --package research/ambient-rank-library --check-only +``` + +Direct marker: `PASS_AMBIENT_RANK_LIBRARY`. Both direct commands compare +the complete computed hash-bound receipt without writing to the package. +The independent oracle explicitly constructs role words, paid paths and +target ports, then uses prime valuations for widths and exact rational +per-array costs. It imports no production evaluator. All fields agree on +1,267 ranks, 21,442 units, 31,124 cuts and 35,141 constraints; exact +all-prime divisibility holds at every checked rank. The lower-bound family +is checked on 4,000 plateau rows across 81 ambient values. Fifteen semantic +and domain controls reject. Separately, 146 default-A rows agree with the +frozen predecessor. Six frozen local source copies are authenticated. + +The large-A test uses the number `153^1920` only with toy histograms and +evaluates bounds/bit-count descriptors. It materializes zero library rows. +Finite checks corroborate the written universal proof, not replace it. +The separate reviewer accepted the universal argument and checked 269 complete +rows using a positive source census and brute-force least replication, plus +260 plateau widths and three semantic mutations. Normal and optimized +receipts match. The unchanged review and checker are retained under +`independent/`; the root authenticated all nine exact commit/path bindings. + +## Limitations, open obligations and kappa + +**No new kappa.** Selected `0.00363005817` and all five assumptions remain. +The actual selected evaluated target/paid manifest and winning library are +not materialized. This package proves neither native correctness nor full +scalar/phase/adapter instruction emission, physical owner routing, owned +erasure, precision/tape admission or analytic recovery. It supplies metadata +to those interfaces. Open questions are source-specific gcd-sensitive +widths, actual selected manifest binding, and full instruction emission +with all physical costs. No selected cold replay, Lean, Docker, human or +proof-kernel acceptance is claimed. + +Prepared for **@CubeJerry**, with substantial OpenAI assistance. Credit +Jacob Alan Sussman, zxv, Mihir Srivastava, the #4638/#5071 authors and all +retained native/outer lineage as detailed in `NOTICE.md`. Predecessor +notices remain. New material is Apache-2.0. + +## Merge scope + +One isolated package. No predecessor, shared implementation, fork main or +selected-frontier changes. This text is a proposed PR description; the run +publishes a checked fork branch for user review and does not submit an +upstream PR. diff --git a/research/ambient-rank-library/PROOF.md b/research/ambient-rank-library/PROOF.md new file mode 100644 index 0000000000..e67d99489c --- /dev/null +++ b/research/ambient-rank-library/PROOF.md @@ -0,0 +1,420 @@ +# Exact rank libraries at an independent ambient cap + +This is a quantified metadata theorem and a scoped output-size obstruction. +It constructs evaluated integer library rows for every separated fixed rule +with ambient cap A at least its largest productive rank m. It does not +construct the rule's native word or admit a multiplication algorithm. Exact +source pins are in SOURCES.json. The ambient flow is inherited from the +selected retained compiler proof, §6; the least-cut recurrence is inherited +from #4507/#5071. The algorithm and cost framework extend #7345. The +plateau argument follows #4638, with its ambient dependence proved below. + +## 1. Statement and the parameter boundary + +Supply sorted nonempty histograms `(k,W_k)` and `(r,P_r)` of positive +integer multiplicities, and an integer A satisfying + +``` +2 <= k_min <= k <= m <= A, 1 <= r <= r_max < k_min. +``` + +Let d and q be the numbers of distinct productive and paid ranks, +`W=sum W_k`, and `P=sum P_r`. Each of the P paid sites remains distinct, +even when ranks or physical owners agree. Histograms suffice for the +numerical output; an ordered native manifest is a separate interface. + +For every supplied positive maximum N, the algorithm evaluates, at all +`1<=n<=N`, the least chronological replication a_n, productive width B_n, +expanded rank-one leaf count P_n, and expanded mixed-unit count O_n. +O_n counts all executed unit occurrences, including recursive copies; +it is not a peak-live-storage or physical-cell claim. The construction +uses compressed product histograms, without enumerating paid paths. + +For each *fixed* A and fixed target/paid histograms, every output integer +has a number of bits polynomial in log N. The indexed arithmetic work is +`N*polylog N`; the explicitly charged sequential companion is +`N^2*polylog N`. The constants and polynomial degrees depend on the fixed +rule. Equations (9)--(12) below expose that dependence when A is instead +part of a binary input. + +There is no bound polynomial in `log N+log A` on individual output lengths +uniformly in A, even for fixed two-target and one-paid-site histograms. +For that family, writing every evaluated width through `N=2A-1` requires +Omega(N^2) bits. Thus the fixed-A indexed near-linear result does not +become a uniform near-linear result by treating A as an encoded constant. +This does not preclude polynomial algorithms in `N+log A`, compact symbolic +descriptions, alternate batching policies, or better bounds for selected +special histograms. + +## 2. The actual ambient flow and its exact census + +For `n=A`, let `C=floor(n/A)` and `G=floor(log_(k_min) C)`; both are +computed by integer multiplication and comparison. A class at depth h is +labelled by a complete sequence of actual paid sites, with rank product +rho. Its degree `g=G-h` units are the productive-role words of length g. +A word of product c is retained exactly when `A*rho*c<=n`. +Grouping words by rank multiplicities gives the same multinomial units as +the selected source's definition. This is an exact occurrence expansion, +not a quotient identifying equal products or equal physical owners. + +At a nondeepest parent, remove the first productive role k from its word. +At paid site r, the corresponding child has the extended paid path and +remaining productive word. Its ambient extent is + +``` +A*rho*r*(c/k) = (r/k)*A*rho*c < A*rho*c <= n. +``` + +It is therefore retained, and its target-k slot has exactly the parent's +paid rank `rho*c*r`. This association is injective: the child path's last +site and its target role reconstruct the parent. It is the ordered-word +form of the credited Pascal bijection. Every unmatched target slot is +a fresh top source. A root word of product `k_min^G` exists, so the flow +and its source set are nonempty. Every deepest paid path exists, since +`rho<=r_max^G<=k_min^G<=C`; it has one empty-word unit. + +The compressed evaluator uses + +``` +T_0(1)=R_0(1)=1, +T_(g+1)(c)=sum_(k|c) W_k*T_g(c/k), +R_(h+1)(rho)=sum_(r|rho) P_r*R_h(rho/r). +``` + +At rank n, visit every product pair from `R_h,T_(G-h)`, retaining it when +`A*rho*c<=n`. With `v=R_h(rho)*T_(G-h)(c)`, add v to U_n and add W_k v +to the target count at `s=rho*c*k`. For h0`. The preceding injection proves this sign claim; +an implementation check is only a diagnostic. + +The exit histogram is exactly + +``` +E_(n,e)=R_(G+1)(e). (2) +``` + +Each summand represents a different complete chronological cut containing +one array per replica. Equal-rank exits have identical denominators but +remain separate events. E_(n,e) is their number, not a batch size. + +## 3. Integrality, exact costs, and descent + +Source complements are grouped before the flow. A positive complement +`n-s` therefore needs `B_(n-s) | a_n*S_(n,s)`. At each individual exit of +rank e, precisely a_n replicas are available, so `B_e | a_n`. These are +exactly the credited least chronological constraints, giving + +``` +a_n=lcm({B_(n-s)/gcd(B_(n-s),S_(n,s)): s0} + union {B_e:E_(n,e)>0}), +B_n=a_n*S_n. (3) +``` + +The `s=n` source receives no complement and invokes no rank-zero program. +All exact expanded counts are + +``` +P_n=sum_(s=k_min^(G+1)>C`, and its integer rank exceeds n/A. At a deeper fresh +slot, its absent parent has `A*rho_parent*c_parent>n`. Multiplying by +the last paid rank r shows the source rank exceeds `r*n/A>=n/A`. +Fit and k<=A give s<=n. Consequently every positive complement obeys + +``` +02`, hence `alpha^A<1/2`. Set +`tau=A*ceil(log2 k_min)`; then `alpha^tau<1/k_min`. A chain cannot visit +one plateau more than tau times: its first rank is less than +`A*gamma_next`, so after tau edges it is strictly less than +`A*gamma_next/k_min<=A*gamma`, below that plateau. Visits are contiguous +because ranks decrease. Applying this to (6) for every prime gives the +all-prime integer certificate + +``` +B_n | Q_N = product_(gamma in Gamma, gamma<=floor(N/A)) + S(gamma)^tau, 1<=n<=N. (7) +``` + +This explicitly reproves the #4638 mechanism for independent ambient A. +Using `tau=m*ceil(log2 k_min)` here would be false: §7 gives actual +widths with more than m source factors on a single cap plateau. +Factorization is not used by the evaluator or required to apply (7). + +For N>=A, define integers + +``` +L=ell(N), C=floor(N/A), H=ell(C), G=floor(log_(k_min) C), +Ubar=(G+1)*max(W,P)^G, Sbar=W*Ubar, +F=1+(W+1)*Ubar+P^(G+1), D=A*H, +``` + +where `ell(x)=bit_length(x)` for positive integers. Deleting fit tests +gives U_n<=Ubar and S_n<=Sbar at every n<=N. Let b count distinct +integers >=2 among the target and paid ranks. Every Gamma product <=C +has a representation with each of its b exponents between 0 and H. +There are at most `(H+1)^b` such exponent vectors; redundant +representations only weaken this upper bound. Thus + +``` +beta=tau*(H+1)^b*ell(Sbar), +log2 B_n<=beta, log2 a_n<=beta. (8) +``` + +This uses all prime factors of each S(gamma), not just rank primes. The +semigroup bound counts locations and does not restrict width prime support. + +## 5. Expanded costs and explicit metadata budget + +For nonbase n put `Y_n=(B_n+P_n+O_n)/B_n`. Equation (4) yields + +``` +Y_n=1+U_n/S_n+sum_batches (t/S_n)*(P_e+O_e)/B_e + <=F*max_child Y_e. +``` + +Here t=S_(n,s) for a complement batch and t=1 for each individual exit. +There is at least one exit, and base ratios are `1+n<=A`. Since +`N/A=4, the complete interval `A<=n<2A` has G=0: +one root unit, two source slots of ranks 2 and 3, and one rank-one exit. +Both positive complements have source count one. Thus + +``` +B_n=2*lcm(B_(n-2),B_(n-3)), B_j=1 for j=2, the n-2 predecessor +has exponent floor(t/2); the n-3 predecessor, when nonbase, has no +larger exponent. The recurrence adds one. This proves (13) for the +whole interval, including both parity cases. + +In particular `ell(B_(2A-1))=ceil(A/2)+1`, exponential in ell(A). +Because `N=2A-1`, it also exceeds every fixed polylogarithm in N and A +as A grows. Summing the exact lengths gives + +``` +sum_(n=A)^(2A-1) ell(B_n) + =sum_(t=0)^(A-1) (floor(t/2)+2) + =floor((A-1)^2/4)+2A = Omega(A^2). (14) +``` + +These bits occur in the required explicit width output alone, before +replication, leaves, unit counts or source access. Any sequential binary +output of the evaluated all-rank library therefore needs Omega(N^2) +bit writes on this varying-A family. The obstruction is to a uniform +`N*polylog(N,A)` explicit-output bound; it is not a lower bound against +every algorithm polynomial in N, or against compressed expressions. + +The same family falsifies an unqualified reuse of default tau=m. For +A>=7 and C=1 there is only one plateau, S(1)=2, and default tau=3 +would give Q=8, whereas `B_(2A-1)=2^ceil(A/2)` does not divide 8. +The new tau=A certificate is valid. This is a universal exact example, +not extrapolation from the finite corroborations. + +## 8. Verification and remaining obligations + +The production evaluator adapts #7345 and therefore is not independent +of it. A separate oracle imports no production code: it enumerates every +productive-role word and paid-site path, constructs all target ports, +marks actual incoming parent demands, and retains distinct exit cuts. +It computes widths by prime-exponent constraints and costs using exact +rational per-array recurrences. All rows and census fields are compared. +An independent multiplication-closure enumeration checks the plateau +divisor with exact integer divisibility at every tested rank. Mutations +exercise lost ambient caps, wrong bases, pooled exits, omitted repeated +cuts, and a false default-width envelope. Default-A outputs are also +compared against the frozen predecessor as regression evidence. + +Bounded checks do not establish universal quantifiers; §§2--7 provide +the written argument. No human or formal-kernel acceptance is claimed. +Open tasks include a caller-bound evaluated selected manifest, a full +scalar/phase/adapter instruction emitter, physical gather/return pricing, +and tighter source-specific widths that exploit gcd cancellation. An +ambient-independent bound would need a changed output or extra hypotheses +excluding §7; no such change is assumed here. diff --git a/research/ambient-rank-library/README.md b/research/ambient-rank-library/README.md new file mode 100644 index 0000000000..de99f13364 --- /dev/null +++ b/research/ambient-rank-library/README.md @@ -0,0 +1,161 @@ +# Exact chronological libraries with a separate ambient cap + +**Result.** Extend the evaluated integer rank-library construction of +[#7345](https://github.com/CrocSwap/integer-mult-bounds/pull/7345) from +`A=m=max target` to every fixed integer `A>=m`, using the selected +source's actual ambient-cap flow. Prove explicit binary and fixed-tape +metadata bounds with A exposed, and a family where varying A forces +quadratic total bit output for evaluated all-rank widths. This is progress +on a numerical premise of the `compiler` assumption. **No new kappa**: +the selected `0.00363005817` remains conditional, with all five assumptions. + +The theorem takes a finite evaluated target/paid histogram and a maximum N. +It produces replication a_n, width B_n, expanded leaf count P_n and +expanded mixed-unit count O_n for every n<=N. Individual chronological +exits retain their own child divisibility constraints. Product aggregation +counts identical-rank occurrences without pooling their actual cuts. + +## Exact findings + +For fixed A and fixed separated histograms, output integers still have +polylogarithmic bit lengths in N. With the explicit parameters K,Z,J in +[PROOF.md](PROOF.md), indexed metadata construction costs `O(K Z^3)`; +the sequential companion costs `O(K (N Z+(J Z)^2+Z^3))` and uses +`O((N+J) Z)` historical cells. Reading children, sorting, setup, copying, +restoring tape heads, writing base rows and all integer bit lengths are +charged. These become `N*polylog N` and `N^2*polylog N` for each fixed +rule. They are metadata costs, not native payload execution costs. + +The ambient dependence is necessary in general. Fix targets +`((2,1),(3,1))`, one paid rank-1 site, and any A>=4. For A<=n<2A, + +``` +B_n = 2^(floor((n-A)/2)+1), +sum_(n=A)^(2A-1) bit_length(B_n) = floor((A-1)^2/4)+2A. +``` + +Thus the evaluated widths alone require Omega(N^2) output bits at +`N=2A-1` when A varies. This excludes a *uniform* near-linear explicit +output bound and uniform polylogarithmic row widths. It does not refute +the retained construction, which fixes its template before multiplication +input size varies, or exclude polynomial-in-N algorithms and succinct +symbolic representations. + +For A=64 the cap-1 plateau has `S=2` and `B_127=2^32`. Reusing the +default plateau exponent `m=3` would give divisor 8 and is false. +The proved general-ambient exponent is +`tau=A*ceil(log2 k_min)`. The exact proof, including contraction, +plateau visits and all-prime divisibility, is in PROOF.md §§3--5. + +A separate exit control uses A=4, two productive rank-3 roles and two +paid rank-2 sites. At rank 12 there are four distinct rank-4 cuts with +child width 2. Valid replication is 2; pooling their equal ranks would +incorrectly allow 1. + +## Predecessors and exact scope + +The ambient geometry already appears in the selected retained +[#6916 compiler proof §6](https://github.com/CrocSwap/integer-mult-bounds/blob/e54523517d0f03e58352e647c403a5af3e525a57/research/p104-shared-native-helper-splits/retained/compiler/PROOF.md). +[#4507](https://github.com/CrocSwap/integer-mult-bounds/pull/4507) and +[#5071](https://github.com/CrocSwap/integer-mult-bounds/pull/5071) supply +whole-cut gcd/LCM integrality. [#4638](https://github.com/CrocSwap/integer-mult-bounds/pull/4638) +supplies the default plateau-visit mechanism. #7345, exact head +`022461f115369efd988ef8c459907f5544bb8bb3`, supplies the default evaluator +and quantitative cost framework. This package proves their combined +quantitative extension at independent A, with an explicit obstruction to +silently dropping ambient dependence. The source census at a fixed cap +is inherited; recursive complements n-s do not follow by scaling a +default library. + +The theorem supplies a valid numerical library for an abstract chronological +leaf locator at the same ambient and histograms. The separate +[leaf/owner locator](https://github.com/CubeJerry/integer-mult-bounds/tree/81f0b0b9a920bd1c9da583cbc3612efd5e75ea94/research/chronological-leaf-owner-index) +is contextual companion work, not a runtime dependency or an upstream PR. +Ordered native manifests, owner routes and physical execution remain separate. + +The selected `A=153^1920` lies in the parameter domain. No selected +target/paid manifest or winning library was materialized. A huge-A test +evaluates only toy-rule bounds and bit-count descriptors using that same +ambient; it generates zero library rows. All native, owned-erasure, +complete instruction, tape/precision and analytic obligations remain. + +## Verification + +Run from the repository root with Python 3.12 and the standard library: + +```sh +python -I -W error -B research/ambient-rank-library/verify.py +python -I -O -W error -B research/ambient-rank-library/verify.py +python -B scripts/research_package.py --package research/ambient-rank-library --check-only +``` + +Expected direct marker: `PASS_AMBIENT_RANK_LIBRARY`. Default replay writes +nothing and checks its complete computed [VALIDATION.json](VALIDATION.json). +An optional `--receipt /absolute/new/external.json` refuses existing files +and paths inside the package. [VERIFY.json](VERIFY.json) declares both runs. + +The independent oracle [literal_oracle.py](literal_oracle.py) imports no +production evaluator. It materializes productive-role words, paid-site +paths and target slots, matches actual parent demands, and retains distinct +exiting cuts. Widths use prime valuations; costs use exact rational per-array +recurrences. The author evaluator instead aggregates products and uses +gcd/LCM with integer child-copy totals. All rows and census fields agree +on 12 fixtures: **1,267 ranks, 21,442 units, 31,124 cuts and 35,141 +chronological constraints**. Exact all-prime plateau divisibility holds +at every tested rank. Finite chain and plateau-visit dynamic programs +also check the envelopes. + +The lower-bound family is checked at all 4,000 plateau rows for A=4,...,80 +and A=127,128,255,256, including both parities. Fifteen controls reject +invalid domains/capacities and mutations of height, fit, base range, +individual exit divisibility, repeated cut costs, complement gcd savings +and the default-width constant. A fit mutation needed a heterogeneous +3/5-target fixture: the homogeneous initial fixture has no disputed fit +threshold. That diagnostic adjustment is disclosed; no scientific result +was silently overwritten. The 146 default-A rows agreeing with the frozen +#7345 evaluator are regression evidence, separate from the independent +oracle. Six frozen local sources are authenticated by SHA256 and Git blob +hashes before loading code. + +Universal statements rely on the written proof. A separate agent accepted +the proof and independently reconstructed positive source censuses and least +replications by bounded integer trial: 269 complete rows, 57,744 candidate +replications, 260 additional plateau widths and three mutation controls. +Normal and optimized receipts agree. The review and portable reproduction +command are retained in [independent/REVIEW.md](independent/REVIEW.md). +The root separately authenticated all nine exact commit/path source bindings. +No human or proof-kernel acceptance is claimed. No selected cold replay, Lean or Docker was run. + +## Sources and recovery + +Canonical base: `e54523517d0f03e58352e647c403a5af3e525a57`. +[SOURCES.json](SOURCES.json) pins nine files, including the selected +record/review, task catalogue, ambient proof, width proof and #7345 head. +Frozen predecessors remain unchanged. Only this package is added. +[TASK.json](TASK.json) records the assignment and [OVERLAP.json](OVERLAP.json) +the bounded overlap check. The lead agent manages claims, independent +review, commits and fork publication; no upstream PR is opened by this run. + +Direct verification needs only this package. Registration/provenance checks +additionally use canonical scripts and pinned Git objects. Scientific +files, source copies, receipt and [PR.md](PR.md) preserve the restart trail; +the publisher records the final branch and commit. Unpublished local files +are temporary, not a remotely durable checkpoint. + +## Open next questions + +1. **Bind an evaluated selected manifest.** Derive exact chronological + product, completion and split histograms and owner metadata from the + selected recipe. This supplies the actual finite input; a symbolic + product power is not a materialized table. +2. **Improve source-specific ambient constants.** Preserve gcd cancellation + in selected-profile widths. A uniform improvement needs hypotheses + excluding the two-target family or a changed output representation. +3. **Emit and execute the whole native instruction stream.** Supply unit + scalar/phase/adapter/lifecycle events, preserve owner identity, and price + each physical access and inverse return. Counts supply no missing native + endpoint or erasure contract. + +Prepared for **@CubeJerry**, with substantial OpenAI assistance. +[NOTICE.md](NOTICE.md) credits source authors and originating PRs. New +material is Apache-2.0; predecessor files retain their notices. diff --git a/research/ambient-rank-library/SOURCES.json b/research/ambient-rank-library/SOURCES.json new file mode 100644 index 0000000000..51e7940b97 --- /dev/null +++ b/research/ambient-rank-library/SOURCES.json @@ -0,0 +1,93 @@ +{ + "schema_version": 1, + "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "files": [ + { + "path": "docs/research/agent-task-catalog.json", + "pin": "base_commit:docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "3404fbdd5e7529a0674eef26114b5071e4586cec", + "sha256": "ead6cdc9d0af6d58e8a49744d8ec8c7c15e13d2ba93c276c434bcf9b51b93a81", + "bytes": 82822 + }, + { + "path": "certificates/selected-result.json", + "pin": "base_commit:certificates/selected-result.json", + "usage": "provenance", + "git_blob": "75d77b328ea02ded535e7f23aee5b1e55d0bb1a8", + "sha256": "154c3d30455d778fd3343b6b4851f0fa4665f0f7625b0adb3675e2bafbbf6bf1", + "bytes": 4803 + }, + { + "path": "docs/research/pr-intake-evidence/pr7000-application/PROOF-REVIEW.md", + "pin": "base_commit:docs/research/pr-intake-evidence/pr7000-application/PROOF-REVIEW.md", + "usage": "provenance", + "git_blob": "3dd1af2285e597676725e85ad4f65e7ad326d695", + "sha256": "4501502c2ceb9759b20372435fe4beb51082c5a5e2910c1fd5dbe6edca415055", + "bytes": 25533 + }, + { + "path": "research/p104-shared-native-helper-splits/retained/compiler/PROOF.md", + "pin": "base_commit:research/p104-shared-native-helper-splits/retained/compiler/PROOF.md", + "usage": "provenance", + "git_blob": "f5ef0d2e8289adfb6c5e73c4b58970da462d7df2", + "sha256": "95cc9e31bc030ec94b04decddcca2d28ee98cfec0ca7803b54666b2b76a5c9ab", + "bytes": 20219, + "local": "reference/selected-ambient-PROOF.md" + }, + { + "path": "research/kappa-rebuild/architecture/FINITE-PRECOMPILATION.md", + "pin": "base_commit:research/kappa-rebuild/architecture/FINITE-PRECOMPILATION.md", + "usage": "provenance", + "git_blob": "4badb40f0919c515823cb07e44c6470d4d6469ca", + "sha256": "4cb32f6b8e388ecf6ed41b5bbdeeb4539cb40c8424f194974afea58f7e0921e8", + "bytes": 15898, + "local": "reference/FINITE-PRECOMPILATION.md" + }, + { + "path": "research/chronological-width-bound/README.md", + "pin": "base_commit:research/chronological-width-bound/README.md", + "usage": "provenance", + "git_blob": "7548fd2060e41cf5b58485126d14b4dec936406a", + "sha256": "0a255788cd9b462c4cbef39721ce42d129878bf564fc08be33752ca84530e38d", + "bytes": 17667, + "local": "reference/width-bound-README.md" + }, + { + "path": "research/symbolic-integer-batch-width/PROOF.md", + "pin": "base_commit:research/symbolic-integer-batch-width/PROOF.md", + "usage": "provenance", + "git_blob": "6702d6aba2ad4149f9efc8570012a66aae640c8c", + "sha256": "f6fed469b53137c41d8543822b08e2381ebdfb6503c26663d01f56a2e8ab76bc", + "bytes": 9251, + "local": "reference/symbolic-batch-PROOF.md" + }, + { + "path": "research/quantitative-rank-library/PROOF.md", + "pin": "head:022461f115369efd988ef8c459907f5544bb8bb3:research/quantitative-rank-library/PROOF.md", + "usage": "provenance", + "git_blob": "36df15159497eca40d8a9c92023e7f4e91ba62d8", + "sha256": "05a04e5ba1db71b9e40397e3220f047411906a5e8a70609c7a879499e6325e88", + "bytes": 13441, + "local": "reference/default-library-PROOF.md" + }, + { + "path": "research/quantitative-rank-library/library.py", + "pin": "head:022461f115369efd988ef8c459907f5544bb8bb3:research/quantitative-rank-library/library.py", + "usage": "provenance", + "git_blob": "e1e34aa0e6ee47999784c834ede4f8c9998c5647", + "sha256": "06e3b44704048461de0ff0ab55fe158b95df412688324b88fd3d81b929ef0d92", + "bytes": 11110, + "local": "inputs/default_library.py" + } + ], + "predecessor_prs": [ + 4507, + 4638, + 5071, + 6916, + 7345 + ], + "selected_kappa": "0.00363005817", + "local_inputs": "Runtime predecessor replay uses only the authenticated package-local frozen copy; no mutable external source import." +} diff --git a/research/ambient-rank-library/TASK.json b/research/ambient-rank-library/TASK.json new file mode 100644 index 0000000000..72f0e6599b --- /dev/null +++ b/research/ambient-rank-library/TASK.json @@ -0,0 +1,99 @@ +{ + "schema_version": 1, + "task_id": "uniform-transfer-audit", + "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" + } + ] + }, + "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "scope_status": "changed", + "scope_change_reason": "The orchestrator selected the precise arbitrary-ambient rank-library obligation left outside #7345, plus a uniform-output obstruction; this is metadata progress toward compiler closure, not full selected caller admission.", + "actual_scope": "Construct evaluated least-chronological separated library rows for every fixed ambient A>=maximum productive target, with explicit binary/tape budgets, and prove a varying-A output-size obstruction.", + "bottleneck_link": "Selected compiler assumption and #7345 explicit A=m restriction; selected retained ambient is 153^1920.", + "stop_rule": "Stop after proving the ambient metadata construction and its exact limitations; do not infer actual selected manifest materialization, full instruction emission or new kappa.", + "evidence": "PROOF.md, independent literal occurrence and prime-valuation oracle, exact plateau divisors, negative controls and hash-bound VALIDATION.json.", + "outcome": "partial", + "review_status": "Accepted separate-agent universal proof review and independent exact checks; root authenticated nine exact commit/path bindings; ready for fork publication", + "author": "Prepared for @CubeJerry", + "ai_assistance": "Substantial OpenAI assistance in proof, implementation, exact replay and writing; independent human/formal-kernel acceptance unclaimed.", + "open_questions": [ + { + "question": "Can the actual selected separated target/paid manifest be emitted with exact all-rank recipe bindings?", + "why_it_matters": "The theorem accepts an evaluated finite histogram, while a selected full native word remains unmaterialized.", + "first_step": "Pin the selected chronological product, completion and split manifests and derive their exact histogram/owner interface.", + "blocked_by": "An actual ordered native manifest and its complete closure contract are not supplied by this package." + }, + { + "question": "Can selected special histograms give substantially smaller ambient-dependent widths?", + "why_it_matters": "The general varying-A family has quadratic explicit-output size; generic fixed-A asymptotics conceal large constants.", + "first_step": "Preserve source gcd cancellation in an exact selected-profile width bound.", + "blocked_by": "Need source-specific hypotheses that exclude the two-target obstruction." + }, + { + "question": "Can the whole scalar/phase/adapter lifecycle stream be emitted and physically executed?", + "why_it_matters": "Counts and leaf locators do not certify native actions, owned erasure or tape routing.", + "first_step": "Compose exact unit instruction and adapter emitters with persistent owner identity, then charge all accesses and returns.", + "blocked_by": "Native all-column and complete physical interfaces remain inherited assumptions." + } + ], + "track": 75, + "secondary_track": 50, + "wave": 2, + "selected_kappa": "0.00363005817", + "new_kappa": null +} diff --git a/research/ambient-rank-library/VALIDATION.json b/research/ambient-rank-library/VALIDATION.json new file mode 100644 index 0000000000..cdef209d21 --- /dev/null +++ b/research/ambient-rank-library/VALIDATION.json @@ -0,0 +1,850 @@ +{ + "all_base_rows": 20, + "base": "e54523517d0f03e58352e647c403a5af3e525a57", + "cases": [ + { + "ambient": 2, + "constraints": 398, + "divisor_bits": 1, + "literal_cuts": 372, + "literal_units": 341, + "max_depth": 4, + "max_plateau_visits": 1, + "max_width_bits": 1, + "maximum": 32, + "paid": [ + [ + 1, + 2 + ] + ], + "plateaus": 5, + "ranks": 32, + "targets": [ + [ + 2, + 1 + ] + ] + }, + { + "ambient": 2, + "constraints": 13930, + "divisor_bits": 1, + "literal_cuts": 13896, + "literal_units": 4619, + "max_depth": 4, + "max_plateau_visits": 1, + "max_width_bits": 1, + "maximum": 40, + "paid": [ + [ + 1, + 4 + ] + ], + "plateaus": 5, + "ranks": 40, + "targets": [ + [ + 2, + 1 + ] + ] + }, + { + "ambient": 5, + "constraints": 618, + "divisor_bits": 199, + "literal_cuts": 462, + "literal_units": 236, + "max_depth": 8, + "max_plateau_visits": 2, + "max_width_bits": 16, + "maximum": 50, + "paid": [ + [ + 1, + 1 + ], + [ + 2, + 2 + ] + ], + "plateaus": 9, + "ranks": 50, + "targets": [ + [ + 3, + 1 + ], + [ + 5, + 1 + ] + ] + }, + { + "ambient": 8, + "constraints": 1505, + "divisor_bits": 373, + "literal_cuts": 1155, + "literal_units": 624, + "max_depth": 14, + "max_plateau_visits": 3, + "max_width_bits": 31, + "maximum": 96, + "paid": [ + [ + 1, + 1 + ], + [ + 2, + 2 + ] + ], + "plateaus": 10, + "ranks": 96, + "targets": [ + [ + 3, + 1 + ], + [ + 5, + 1 + ] + ] + }, + { + "ambient": 13, + "constraints": 2075, + "divisor_bits": 310, + "literal_cuts": 1758, + "literal_units": 1490, + "max_depth": 21, + "max_plateau_visits": 7, + "max_width_bits": 62, + "maximum": 104, + "paid": [ + [ + 1, + 3 + ] + ], + "plateaus": 6, + "ranks": 104, + "targets": [ + [ + 2, + 2 + ], + [ + 3, + 1 + ] + ] + }, + { + "ambient": 7, + "constraints": 250, + "divisor_bits": 217, + "literal_cuts": 64, + "literal_units": 151, + "max_depth": 9, + "max_plateau_visits": 3, + "max_width_bits": 16, + "maximum": 70, + "paid": [ + [ + 2, + 1 + ] + ], + "plateaus": 9, + "ranks": 70, + "targets": [ + [ + 3, + 1 + ], + [ + 5, + 1 + ] + ] + }, + { + "ambient": 11, + "constraints": 5110, + "divisor_bits": 815, + "literal_cuts": 3556, + "literal_units": 5013, + "max_depth": 23, + "max_plateau_visits": 4, + "max_width_bits": 48, + "maximum": 400, + "paid": [ + [ + 2, + 2 + ] + ], + "plateaus": 14, + "ranks": 400, + "targets": [ + [ + 3, + 1 + ], + [ + 4, + 1 + ] + ] + }, + { + "ambient": 9, + "constraints": 10748, + "divisor_bits": 942, + "literal_cuts": 9612, + "literal_units": 8554, + "max_depth": 18, + "max_plateau_visits": 3, + "max_width_bits": 59, + "maximum": 300, + "paid": [ + [ + 2, + 3 + ] + ], + "plateaus": 13, + "ranks": 300, + "targets": [ + [ + 3, + 1 + ], + [ + 4, + 2 + ] + ] + }, + { + "ambient": 4, + "constraints": 189, + "divisor_bits": 105, + "literal_cuts": 152, + "literal_units": 164, + "max_depth": 5, + "max_plateau_visits": 2, + "max_width_bits": 5, + "maximum": 40, + "paid": [ + [ + 2, + 2 + ] + ], + "plateaus": 7, + "ranks": 40, + "targets": [ + [ + 3, + 2 + ] + ] + }, + { + "ambient": 32, + "constraints": 96, + "divisor_bits": 33, + "literal_cuts": 32, + "literal_units": 32, + "max_depth": 16, + "max_plateau_visits": 16, + "max_width_bits": 17, + "maximum": 63, + "paid": [ + [ + 1, + 1 + ] + ], + "plateaus": 1, + "ranks": 63, + "targets": [ + [ + 2, + 1 + ], + [ + 3, + 1 + ] + ] + }, + { + "ambient": 6, + "constraints": 129, + "divisor_bits": 48, + "literal_cuts": 43, + "literal_units": 133, + "max_depth": 9, + "max_plateau_visits": 3, + "max_width_bits": 13, + "maximum": 48, + "paid": [ + [ + 1, + 1 + ] + ], + "plateaus": 4, + "ranks": 48, + "targets": [ + [ + 2, + 1 + ], + [ + 4, + 1 + ] + ] + }, + { + "ambient": 3, + "constraints": 93, + "divisor_bits": 39, + "literal_cuts": 22, + "literal_units": 85, + "max_depth": 5, + "max_plateau_visits": 2, + "max_width_bits": 11, + "maximum": 24, + "paid": [ + [ + 1, + 1 + ] + ], + "plateaus": 6, + "ranks": 24, + "targets": [ + [ + 2, + 1 + ], + [ + 3, + 1 + ] + ] + } + ], + "default_regression_ranks": 146, + "frozen_sources": [ + { + "bytes": 20219, + "local": "reference/selected-ambient-PROOF.md", + "sha256": "95cc9e31bc030ec94b04decddcca2d28ee98cfec0ca7803b54666b2b76a5c9ab" + }, + { + "bytes": 15898, + "local": "reference/FINITE-PRECOMPILATION.md", + "sha256": "4cb32f6b8e388ecf6ed41b5bbdeeb4539cb40c8424f194974afea58f7e0921e8" + }, + { + "bytes": 17667, + "local": "reference/width-bound-README.md", + "sha256": "0a255788cd9b462c4cbef39721ce42d129878bf564fc08be33752ca84530e38d" + }, + { + "bytes": 9251, + "local": "reference/symbolic-batch-PROOF.md", + "sha256": "f6fed469b53137c41d8543822b08e2381ebdfb6503c26663d01f56a2e8ab76bc" + }, + { + "bytes": 13441, + "local": "reference/default-library-PROOF.md", + "sha256": "05a04e5ba1db71b9e40397e3220f047411906a5e8a70609c7a879499e6325e88" + }, + { + "bytes": 11110, + "local": "inputs/default_library.py", + "sha256": "06e3b44704048461de0ff0ab55fe158b95df412688324b88fd3d81b929ef0d92" + } + ], + "independent_constraints": 35141, + "independent_cuts": 31124, + "independent_ranks": 1267, + "independent_units": 21442, + "large_ambient_bound_only": { + "ambient_bits": 13935, + "ambient_expression": "153**1920", + "ambient_sha256": "d8f73cc4ff3133178b435460799e71580dd9df4e742e71413456f5d7e16070ae", + "bound_value_bits": 13938, + "endpoint_width_length_encoding_bits": 13934, + "materialized_rows": 0, + "maximum_bits": 13936, + "maximum_expression": "2*A-1", + "scope": "toy histogram bounds only, not selected library" + }, + "lower_bound_fixtures": [ + { + "ambient": 4, + "maximum": 7, + "written_width_bits": 10 + }, + { + "ambient": 5, + "maximum": 9, + "written_width_bits": 14 + }, + { + "ambient": 6, + "maximum": 11, + "written_width_bits": 18 + }, + { + "ambient": 7, + "maximum": 13, + "written_width_bits": 23 + }, + { + "ambient": 8, + "maximum": 15, + "written_width_bits": 28 + }, + { + "ambient": 9, + "maximum": 17, + "written_width_bits": 34 + }, + { + "ambient": 10, + "maximum": 19, + "written_width_bits": 40 + }, + { + "ambient": 11, + "maximum": 21, + "written_width_bits": 47 + }, + { + "ambient": 12, + "maximum": 23, + "written_width_bits": 54 + }, + { + "ambient": 13, + "maximum": 25, + "written_width_bits": 62 + }, + { + "ambient": 14, + "maximum": 27, + "written_width_bits": 70 + }, + { + "ambient": 15, + "maximum": 29, + "written_width_bits": 79 + }, + { + "ambient": 16, + "maximum": 31, + "written_width_bits": 88 + }, + { + "ambient": 17, + "maximum": 33, + "written_width_bits": 98 + }, + { + "ambient": 18, + "maximum": 35, + "written_width_bits": 108 + }, + { + "ambient": 19, + "maximum": 37, + "written_width_bits": 119 + }, + { + "ambient": 20, + "maximum": 39, + "written_width_bits": 130 + }, + { + "ambient": 21, + "maximum": 41, + "written_width_bits": 142 + }, + { + "ambient": 22, + "maximum": 43, + "written_width_bits": 154 + }, + { + "ambient": 23, + "maximum": 45, + "written_width_bits": 167 + }, + { + "ambient": 24, + "maximum": 47, + "written_width_bits": 180 + }, + { + "ambient": 25, + "maximum": 49, + "written_width_bits": 194 + }, + { + "ambient": 26, + "maximum": 51, + "written_width_bits": 208 + }, + { + "ambient": 27, + "maximum": 53, + "written_width_bits": 223 + }, + { + "ambient": 28, + "maximum": 55, + "written_width_bits": 238 + }, + { + "ambient": 29, + "maximum": 57, + "written_width_bits": 254 + }, + { + "ambient": 30, + "maximum": 59, + "written_width_bits": 270 + }, + { + "ambient": 31, + "maximum": 61, + "written_width_bits": 287 + }, + { + "ambient": 32, + "maximum": 63, + "written_width_bits": 304 + }, + { + "ambient": 33, + "maximum": 65, + "written_width_bits": 322 + }, + { + "ambient": 34, + "maximum": 67, + "written_width_bits": 340 + }, + { + "ambient": 35, + "maximum": 69, + "written_width_bits": 359 + }, + { + "ambient": 36, + "maximum": 71, + "written_width_bits": 378 + }, + { + "ambient": 37, + "maximum": 73, + "written_width_bits": 398 + }, + { + "ambient": 38, + "maximum": 75, + "written_width_bits": 418 + }, + { + "ambient": 39, + "maximum": 77, + "written_width_bits": 439 + }, + { + "ambient": 40, + "maximum": 79, + "written_width_bits": 460 + }, + { + "ambient": 41, + "maximum": 81, + "written_width_bits": 482 + }, + { + "ambient": 42, + "maximum": 83, + "written_width_bits": 504 + }, + { + "ambient": 43, + "maximum": 85, + "written_width_bits": 527 + }, + { + "ambient": 44, + "maximum": 87, + "written_width_bits": 550 + }, + { + "ambient": 45, + "maximum": 89, + "written_width_bits": 574 + }, + { + "ambient": 46, + "maximum": 91, + "written_width_bits": 598 + }, + { + "ambient": 47, + "maximum": 93, + "written_width_bits": 623 + }, + { + "ambient": 48, + "maximum": 95, + "written_width_bits": 648 + }, + { + "ambient": 49, + "maximum": 97, + "written_width_bits": 674 + }, + { + "ambient": 50, + "maximum": 99, + "written_width_bits": 700 + }, + { + "ambient": 51, + "maximum": 101, + "written_width_bits": 727 + }, + { + "ambient": 52, + "maximum": 103, + "written_width_bits": 754 + }, + { + "ambient": 53, + "maximum": 105, + "written_width_bits": 782 + }, + { + "ambient": 54, + "maximum": 107, + "written_width_bits": 810 + }, + { + "ambient": 55, + "maximum": 109, + "written_width_bits": 839 + }, + { + "ambient": 56, + "maximum": 111, + "written_width_bits": 868 + }, + { + "ambient": 57, + "maximum": 113, + "written_width_bits": 898 + }, + { + "ambient": 58, + "maximum": 115, + "written_width_bits": 928 + }, + { + "ambient": 59, + "maximum": 117, + "written_width_bits": 959 + }, + { + "ambient": 60, + "maximum": 119, + "written_width_bits": 990 + }, + { + "ambient": 61, + "maximum": 121, + "written_width_bits": 1022 + }, + { + "ambient": 62, + "maximum": 123, + "written_width_bits": 1054 + }, + { + "ambient": 63, + "maximum": 125, + "written_width_bits": 1087 + }, + { + "ambient": 64, + "maximum": 127, + "written_width_bits": 1120 + }, + { + "ambient": 65, + "maximum": 129, + "written_width_bits": 1154 + }, + { + "ambient": 66, + "maximum": 131, + "written_width_bits": 1188 + }, + { + "ambient": 67, + "maximum": 133, + "written_width_bits": 1223 + }, + { + "ambient": 68, + "maximum": 135, + "written_width_bits": 1258 + }, + { + "ambient": 69, + "maximum": 137, + "written_width_bits": 1294 + }, + { + "ambient": 70, + "maximum": 139, + "written_width_bits": 1330 + }, + { + "ambient": 71, + "maximum": 141, + "written_width_bits": 1367 + }, + { + "ambient": 72, + "maximum": 143, + "written_width_bits": 1404 + }, + { + "ambient": 73, + "maximum": 145, + "written_width_bits": 1442 + }, + { + "ambient": 74, + "maximum": 147, + "written_width_bits": 1480 + }, + { + "ambient": 75, + "maximum": 149, + "written_width_bits": 1519 + }, + { + "ambient": 76, + "maximum": 151, + "written_width_bits": 1558 + }, + { + "ambient": 77, + "maximum": 153, + "written_width_bits": 1598 + }, + { + "ambient": 78, + "maximum": 155, + "written_width_bits": 1638 + }, + { + "ambient": 79, + "maximum": 157, + "written_width_bits": 1679 + }, + { + "ambient": 80, + "maximum": 159, + "written_width_bits": 1720 + }, + { + "ambient": 127, + "maximum": 253, + "written_width_bits": 4223 + }, + { + "ambient": 128, + "maximum": 255, + "written_width_bits": 4288 + }, + { + "ambient": 255, + "maximum": 509, + "written_width_bits": 16639 + }, + { + "ambient": 256, + "maximum": 511, + "written_width_bits": 16768 + } + ], + "negative_controls": { + "false_default_divisor": { + "actual_width": 4294967296, + "ambient": 64, + "default_Q": 8, + "rank": 127, + "wrong_beta": 24 + }, + "pooling": { + "ambient": 4, + "child_width": 2, + "distinct_cuts": 4, + "exit_rank": 4, + "pooled_replication": 1, + "rank": 12, + "valid_replication": 2 + }, + "rejected": [ + "pooled-distinct-exits", + "ambient-below-target", + "unseparated", + "zero-rank", + "rank-capacity", + "ambient-bit-capacity", + "rank-zero-child", + "base-envelope", + "lost-ambient-height", + "lost-ambient-fit", + "wrong-base", + "pooled-exit-code", + "lost-cut-multiplicity", + "lost-complement-gcd", + "default-visit-constant" + ] + }, + "no_new_kappa": true, + "scientific_sha256": { + "PROOF.md": "a7d75efc8f4c38ca231324f99ce92b0d45df91cbd5ef89c93224700bf740b0c7", + "ambient_library.py": "4c709f98239782ba938aa70ee22c0cdf7204fbdac8a5c444e71adb568e06bbfe", + "literal_oracle.py": "82cb120c2245aeca51f5e73da7caf615ff8af5a29635794a4cf65c5395b015d8", + "verify.py": "b1eb5b5d9ae4c33cac99d3cd80d746792f08db04ef08ea24d5abc2e50ed8bc26" + }, + "selected_kappa": "0.00363005817", + "status": "PASS_AMBIENT_RANK_LIBRARY", + "trace_sha256": "860d1c9f0d0b2bf2417326fe45168ef1769c95c11aed56a7c0842644e805c260" +} diff --git a/research/ambient-rank-library/VERIFY.json b/research/ambient-rank-library/VERIFY.json new file mode 100644 index 0000000000..f00516e77c --- /dev/null +++ b/research/ambient-rank-library/VERIFY.json @@ -0,0 +1,47 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-W", + "error", + "-B", + "research/ambient-rank-library/verify.py" + ], + "timeout_seconds": 60, + "checks": "Independent literal target-port/paid-cut census, prime-valuation widths, rational costs, exact plateau divisors, lower bounds, source pins and semantic mutation controls." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-W", + "error", + "-B", + "research/ambient-rank-library/verify.py" + ], + "timeout_seconds": 60, + "checks": "Identical computed receipt with Python assertions disabled." + }, + { + "argv": [ + "{python}", + "-I", + "-W", + "error", + "-B", + "research/ambient-rank-library/independent/check.py", + "research/ambient-rank-library" + ], + "timeout_seconds": 60, + "checks": "Separate reviewer positive census and brute-force least replication, exact chain/plateau bounds and three controls; 269 complete rows." + } + ], + "inputs": [] +} diff --git a/research/ambient-rank-library/ambient_library.py b/research/ambient-rank-library/ambient_library.py new file mode 100644 index 0000000000..0d1165da81 --- /dev/null +++ b/research/ambient-rank-library/ambient_library.py @@ -0,0 +1,312 @@ +"""Exact ambient-cap chronological compiler metadata; Apache-2.0. + +Prepared for CubeJerry with substantial OpenAI assistance. Adapted from +PR #7345 at 022461f115369efd988ef8c459907f5544bb8bb3; see NOTICE.md. This reference +evaluates integers, not native programs. PROOF.md prices indexed arithmetic +and a separately described sequential implementation. +""" +from dataclasses import dataclass +from math import comb, gcd + + +class BudgetError(ValueError): + """The bounded executable refuses an unevaluated larger instance.""" + + +@dataclass(frozen=True) +class Limits: + max_rank: int = 4096 + max_records: int = 200000 + max_bits: int = 16384 + + def __post_init__(self): + if any(type(x) is not int or x < 1 for x in + (self.max_rank, self.max_records, self.max_bits)): + raise ValueError("positive integer capacities required") + + def integer(self, value): + if abs(value).bit_length() > self.max_bits: + raise BudgetError("integer bit capacity") + return value + + def records(self, count): + if count > self.max_records: + raise BudgetError("local record capacity") + + +@dataclass(frozen=True) +class Rule: + ambient: int + targets: tuple + paid: tuple + + def __post_init__(self): + for alphabet in (self.targets, self.paid): + if type(alphabet) is not tuple or not alphabet: + raise ValueError("nonempty tuple histograms required") + previous = 0 + for entry in alphabet: + if type(entry) is not tuple or len(entry) != 2: + raise ValueError("rank/count pairs required") + rank, count = entry + if (type(rank) is not int or type(count) is not int or + rank <= previous or count < 1): + raise ValueError("sorted distinct positive ranks/counts required") + previous = rank + if self.targets[0][0] < 2 or self.paid[-1][0] >= self.targets[0][0]: + raise ValueError("strict separation required") + if type(self.ambient) is not int or self.ambient < self.m: + raise ValueError("integer ambient at least maximum target required") + + @property + def m(self): + return self.targets[-1][0] + + @property + def kmin(self): + return self.targets[0][0] + + @property + def bits(self): + def gamma_length(v): + return 2 * v.bit_length() - 1 + total = gamma_length(self.ambient) + for alphabet in (self.targets, self.paid): + total += gamma_length(len(alphabet)) + total += sum(gamma_length(x) for row in alphabet for x in row) + return total + + +@dataclass(frozen=True) +class Row: + replication: int + width: int + leaves: int + units: int + + +@dataclass(frozen=True) +class Census: + rank: int + height: int + units: int + sources: tuple + exits: tuple + + +@dataclass +class Work: + product_records: int = 0 + candidate_pairs: int = 0 + source_contributions: int = 0 + complement_constraints: int = 0 + exit_constraints: int = 0 + completed_rows: int = 0 + + +@dataclass(frozen=True) +class Library: + rule: Rule + rows: tuple + work: Work + + +def height(rule, rank): + if rank < rule.ambient: + raise ValueError("height requires a nonbase rank") + threshold = rule.ambient + result = 0 + while threshold * rule.kmin <= rank: + threshold *= rule.kmin + result += 1 + return result + + +def merge_records(records, limits): + """Deterministic sort/add; input length and temporary integers charged.""" + limits.records(len(records)) + records.sort(key=lambda item: item[0]) + result = [] + key, value = None, 0 + for next_key, next_value in records: + if key is not None and next_key != key: + if value < 0: + raise ValueError("negative aggregate") + if value: + result.append((key, value)) + value = 0 + key = next_key + value = limits.integer(value + next_value) + if key is not None: + if value < 0: + raise ValueError("negative aggregate") + if value: + result.append((key, value)) + return tuple(result) + + +def product_tables(alphabet, degree, limits, work): + tables = [((1, 1),)] + for _ in range(degree): + limits.records(len(tables[-1]) * len(alphabet)) + candidates = [] + for product, count in tables[-1]: + for rank, multiplicity in alphabet: + candidates.append((limits.integer(product * rank), + limits.integer(count * multiplicity))) + work.product_records += len(candidates) + tables.append(merge_records(candidates, limits)) + return tuple(tables) + + +def census(rule, rank, targets, paid, limits, work): + gmax = height(rule, rank) + d, q = len(rule.targets), len(rule.paid) + bound = (d + q) * comb(gmax + d + q - 1, d + q - 1) + limits.records(bound) + contributions = [] + units = 0 + for depth in range(gmax + 1): + for rho, paths in paid[depth]: + for column, words in targets[gmax - depth]: + work.candidate_pairs += 1 + size = limits.integer(rho * column) + if limits.integer(rule.ambient * size) > rank: + continue + copies = limits.integer(paths * words) + units = limits.integer(units + copies) + for k, multiplicity in rule.targets: + contributions.append((limits.integer(size * k), + limits.integer(copies * multiplicity))) + if depth < gmax: + for r, multiplicity in rule.paid: + contributions.append((limits.integer(size * r), + -limits.integer(copies * multiplicity))) + work.source_contributions += len(contributions) + sources = merge_records(contributions, limits) + if not sources or any(not rank < rule.ambient * s <= rule.m * rank + for s, _ in sources): + raise ValueError("source band failure") + exits = paid[gmax + 1] + if any(not 0 < e * rule.ambient <= (rule.ambient - 1) * rank for e, _ in exits): + raise ValueError("exit contraction failure") + return Census(rank, gmax, units, sources, exits) + + +def child(rows, parent, rank): + if not 1 <= rank < parent or rank >= len(rows) or rows[rank] is None: + raise ValueError("positive previously completed child required") + return rows[rank] + + +def replication(flow, rows, limits, work): + result = 1 + for source, count in flow.sources: + if source == flow.rank: + continue + width = child(rows, flow.rank, flow.rank - source).width + factor = width // gcd(width, count) + result = limits.integer((result // gcd(result, factor)) * factor) + work.complement_constraints += 1 + for exit_rank, multiplicity in flow.exits: + factor = child(rows, flow.rank, exit_rank).width + result = limits.integer((result // gcd(result, factor)) * factor) + work.exit_constraints += 1 + return result + + +def whole_copies(arrays, width): + copies, remainder = divmod(arrays, width) + if remainder: + raise ValueError("nonintegral chronological child batch") + return copies + + +def finish_row(flow, rows, scale, limits): + width = limits.integer(scale * sum(count for _, count in flow.sources)) + leaves = 0 + units = limits.integer(scale * flow.units) + for source, count in flow.sources: + if source == flow.rank: + continue + old = child(rows, flow.rank, flow.rank - source) + copies = whole_copies(limits.integer(scale * count), old.width) + leaves = limits.integer(leaves + limits.integer(copies * old.leaves)) + units = limits.integer(units + limits.integer(copies * old.units)) + for exit_rank, multiplicity in flow.exits: + old = child(rows, flow.rank, exit_rank) + per_cut = whole_copies(scale, old.width) + copies = limits.integer(multiplicity * per_cut) + leaves = limits.integer(leaves + limits.integer(copies * old.leaves)) + units = limits.integer(units + limits.integer(copies * old.units)) + return Row(scale, width, leaves, units) + + +def compile_library(rule, maximum, limits=Limits()): + if type(maximum) is not int or maximum < 1: + raise ValueError("positive maximum rank required") + if maximum > limits.max_rank: + raise BudgetError("maximum rank capacity") + limits.integer(rule.ambient) + limits.records(len(rule.targets) + len(rule.paid)) + for alphabet in (rule.targets, rule.paid): + for record in alphabet: + for value in record: + limits.integer(value) + work = Work() + rows = [None] # no B_0 program is constructed or queried + if maximum >= rule.ambient: + gmax = height(rule, maximum) + mt = comb(gmax + len(rule.targets), len(rule.targets)) + mr = comb(gmax + len(rule.paid) + 1, len(rule.paid)) + limits.records(mt + mr) + targets = product_tables(rule.targets, gmax, limits, work) + paid = product_tables(rule.paid, gmax + 1, limits, work) + for rank in range(1, maximum + 1): + if rank < rule.ambient: + row = Row(1, 1, rank, 0) + else: + flow = census(rule, rank, targets, paid, limits, work) + scale = replication(flow, rows, limits, work) + row = finish_row(flow, rows, scale, limits) + rows.append(row) + work.completed_rows += 1 + return Library(rule, tuple(rows), work) + + +def envelope(rule, maximum): + """Evaluated integer bounds; never exponentiate by a width-bit bound.""" + if type(maximum) is not int or maximum < rule.ambient: + raise ValueError("nonbase maximum required for this envelope") + d, q = len(rule.targets), len(rule.paid) + w = sum(count for _, count in rule.targets) + p = sum(count for _, count in rule.paid) + g = height(rule, maximum) + length = maximum.bit_length() + cap_length = (maximum // rule.ambient).bit_length() + ubar = (g + 1) * max(w, p) ** g + sbar = w * ubar + factor = 1 + (w + 1) * ubar + p ** (g + 1) + depth = rule.ambient * cap_length + generators = sorted(set(k for alphabet in (rule.targets, rule.paid) + for k, _ in alphabet if k >= 2)) + visits = rule.ambient * (rule.kmin - 1).bit_length() + beta = visits * (cap_length + 1) ** len(generators) * sbar.bit_length() + mt, mr = comb(g + d, d), comb(g + q + 1, q) + pairs = comb(g + d + q - 1, d + q - 1) + exits = comb(g + q, q - 1) + operations = ((rule.bits + length + 1) ** 2 + d * mt + q * mr + + (maximum + 1) * ((d + q + 2) * pairs + exits + g + 3)) + combined = beta + rule.ambient.bit_length() + depth * factor.bit_length() + 1 + bit_cap = 8 * (rule.bits + length + + (g + 2) * (rule.ambient + w + p + 2).bit_length() + + beta + rule.ambient.bit_length() + depth * factor.bit_length() + + operations.bit_length() + 2) + local_records = mt + mr + (d + q + 2) * pairs + exits + g + rule.bits + length + 3 + return {"height": g, "cap_bits": cap_length, "target_records": mt, + "paid_records": mr, "pairs": pairs, "exit_records": exits, + "plateau_visit_bound": visits, "plateau_count_bound": (cap_length + 1) ** len(generators), + "width_log_bound": beta, "combined_output_bits": combined, + "unit_bound": ubar, "source_bound": sbar, "F": factor, "D": depth, + "K": operations, "Z": bit_cap, "J": local_records, + "L_local": local_records * bit_cap} diff --git a/research/ambient-rank-library/independent/RESULT.json b/research/ambient-rank-library/independent/RESULT.json new file mode 100644 index 0000000000..a7f987d848 --- /dev/null +++ b/research/ambient-rank-library/independent/RESULT.json @@ -0,0 +1,321 @@ +{ + "authenticated_local_sources": [ + "reference/selected-ambient-PROOF.md", + "reference/FINITE-PRECOMPILATION.md", + "reference/width-bound-README.md", + "reference/symbolic-batch-PROOF.md", + "reference/default-library-PROOF.md", + "inputs/default_library.py" + ], + "code_sha256": "4c709f98239782ba938aa70ee22c0cdf7204fbdac8a5c444e71adb568e06bbfe", + "coverage": { + "brute_replication_trials": 57744, + "represented_target_slots": 1697, + "rows": 269 + }, + "domains": [ + { + "ambient": 3, + "checked_slots": 170, + "divisor_bits": 39, + "max_chain_depth": 5, + "max_plateau_visits": 2, + "max_row_bits": 12, + "maximum": 24, + "paid": [ + [ + 1, + 1 + ] + ], + "plateaus": 6, + "replication_trials": 934, + "row_sha256": "12bf313ae3757263156665be63f71835b5e2c7a9b402b6d46b9f9670cd6776c6", + "rows": 24, + "targets": [ + [ + 2, + 1 + ], + [ + 3, + 1 + ] + ], + "tau": 3 + }, + { + "ambient": 6, + "checked_slots": 168, + "divisor_bits": 42, + "max_chain_depth": 8, + "max_plateau_visits": 3, + "max_row_bits": 18, + "maximum": 35, + "paid": [ + [ + 1, + 1 + ] + ], + "plateaus": 4, + "replication_trials": 33178, + "row_sha256": "40a3b9df9de75efa2ca14bcf3600f728465b806953923e21b383a5b5cbd1ed14", + "rows": 35, + "targets": [ + [ + 2, + 1 + ], + [ + 3, + 1 + ] + ], + "tau": 6 + }, + { + "ambient": 4, + "checked_slots": 72, + "divisor_bits": 49, + "max_chain_depth": 3, + "max_plateau_visits": 2, + "max_row_bits": 7, + "maximum": 18, + "paid": [ + [ + 2, + 2 + ] + ], + "plateaus": 4, + "replication_trials": 22, + "row_sha256": "9f87e0558dfd64c780e2ee97cb4568f4c618219fe401096aa68312f79dd8a988", + "rows": 18, + "targets": [ + [ + 3, + 2 + ] + ], + "tau": 8 + }, + { + "ambient": 9, + "checked_slots": 150, + "divisor_bits": 101, + "max_chain_depth": 8, + "max_plateau_visits": 3, + "max_row_bits": 16, + "maximum": 48, + "paid": [ + [ + 2, + 1 + ] + ], + "plateaus": 4, + "replication_trials": 4733, + "row_sha256": "71f021bff4e5d1023f9c3f88689e604a0b94b4899a39dce05908a4253eeaef61", + "rows": 48, + "targets": [ + [ + 3, + 1 + ], + [ + 4, + 1 + ] + ], + "tau": 18 + }, + { + "ambient": 7, + "checked_slots": 120, + "divisor_bits": 101, + "max_chain_depth": 7, + "max_plateau_visits": 3, + "max_row_bits": 14, + "maximum": 40, + "paid": [ + [ + 2, + 1 + ] + ], + "plateaus": 5, + "replication_trials": 1273, + "row_sha256": "4698968a60812f8a0e21f1dfc52bbcd9aeb617714757ddff904e33d2491bea24", + "rows": 40, + "targets": [ + [ + 3, + 1 + ], + [ + 5, + 1 + ] + ], + "tau": 14 + }, + { + "ambient": 8, + "checked_slots": 159, + "divisor_bits": 39, + "max_chain_depth": 6, + "max_plateau_visits": 4, + "max_row_bits": 18, + "maximum": 24, + "paid": [ + [ + 1, + 3 + ] + ], + "plateaus": 2, + "replication_trials": 4427, + "row_sha256": "4fce444dd0d0587353aae9e50f7b4172405bdd45e0215130d0d8984013973b83", + "rows": 24, + "targets": [ + [ + 2, + 2 + ], + [ + 4, + 1 + ] + ], + "tau": 8 + }, + { + "ambient": 5, + "checked_slots": 642, + "divisor_bits": 48, + "max_chain_depth": 6, + "max_plateau_visits": 3, + "max_row_bits": 8, + "maximum": 32, + "paid": [ + [ + 1, + 1 + ] + ], + "plateaus": 3, + "replication_trials": 28, + "row_sha256": "44aabb9ddbc23ceb030b3fa7c283235b3f9f356465ac6cf172dc9a8375e66d51", + "rows": 32, + "targets": [ + [ + 2, + 3 + ] + ], + "tau": 5 + }, + { + "ambient": 8, + "checked_slots": 216, + "divisor_bits": 129, + "max_chain_depth": 9, + "max_plateau_visits": 3, + "max_row_bits": 18, + "maximum": 48, + "paid": [ + [ + 1, + 1 + ], + [ + 2, + 1 + ] + ], + "plateaus": 5, + "replication_trials": 13149, + "row_sha256": "249137f66c8c064eb122438cac3422795906281f2457dd7d69deee8ea6c455ec", + "rows": 48, + "targets": [ + [ + 3, + 1 + ], + [ + 4, + 1 + ] + ], + "tau": 16 + } + ], + "limits": "Finite corroboration; universal acceptance is in REVIEW.md. No native realization, selected table, literal tape simulation, or multiplier admission.", + "negative_controls": [ + { + "failure": "nonintegral chronological child batch", + "mutant": "pooled_exit" + }, + { + "failure": "honest ambient plateau constant", + "mutant": "default_ambient_visits" + }, + { + "failure": "source band failure", + "mutant": "missing_consumed_demands" + } + ], + "plateau_output_fixtures": [ + { + "ambient": 4, + "endpoint_bits": 3, + "maximum": 7, + "width_bits_written": 10 + }, + { + "ambient": 5, + "endpoint_bits": 4, + "maximum": 9, + "width_bits_written": 14 + }, + { + "ambient": 7, + "endpoint_bits": 5, + "maximum": 13, + "width_bits_written": 23 + }, + { + "ambient": 8, + "endpoint_bits": 5, + "maximum": 15, + "width_bits_written": 28 + }, + { + "ambient": 13, + "endpoint_bits": 8, + "maximum": 25, + "width_bits_written": 62 + }, + { + "ambient": 32, + "endpoint_bits": 17, + "maximum": 63, + "width_bits_written": 304 + }, + { + "ambient": 64, + "endpoint_bits": 33, + "maximum": 127, + "width_bits_written": 1120 + }, + { + "ambient": 127, + "endpoint_bits": 65, + "maximum": 253, + "width_bits_written": 4223 + } + ], + "proof_sha256": "a7d75efc8f4c38ca231324f99ce92b0d45df91cbd5ef89c93224700bf740b0c7", + "status": "PASS_INDEPENDENT_AMBIENT_LIBRARY_REVIEW" +} diff --git a/research/ambient-rank-library/independent/REVIEW.md b/research/ambient-rank-library/independent/REVIEW.md new file mode 100644 index 0000000000..ed36e9cd33 --- /dev/null +++ b/research/ambient-rank-library/independent/REVIEW.md @@ -0,0 +1,200 @@ +# Independent review: evaluated libraries at an independent ambient cap + +Reviewer: the separate `literal_layer_boundary` agent, for Jerry Chen / +@CubeJerry, with OpenAI assistance. This is independent mathematical/source +review with separately written exact checks, not human or proof-kernel acceptance. + +## Decision and exact scope + +**Accept the stated general-ambient metadata theorem and variable-A explicit +output obstruction.** No defect requiring a scientific correction was found. +The proofs and code reviewed have SHA256 values: + +- `PROOF.md`: `a7d75efc8f4c38ca231324f99ce92b0d45df91cbd5ef89c93224700bf740b0c7`. +- `ambient_library.py`: `4c709f98239782ba938aa70ee22c0cdf7204fbdac8a5c444e71adb568e06bbfe`. + +The theorem accepts evaluated separated histograms and actual integer ambient +A. It supplies exact a_n, B_n, P_n and expanded unit counts O_n. It does not +supply an ordered native word, owner routes, peak live banks, physical payload +costs, selected astronomical tables or a multiplier. All five selected +assumptions and kappa remain unchanged. + +Six local frozen dependency files independently matched their lengths, +SHA256 values and Git blob identities. The three other provenance-only +manifest rows are not local verifier inputs and were not reauthenticated by +this review script. Canonical retrieval and registered-package validation are +the root's separate gates. + +## Exact source census and rank descent + +The ambient flow agrees with the retained selected proof: a unit at paid +prefix product rho and target product c is admitted by A*rho*c<=n. A parent +job at rank r matches a target-k child whose ambient extent is multiplied by +r/k<1. Reconstructing the parent from the paid site, first target letter and +remaining word proves injection. Hence the signed aggregate census counts +actual unmatched source slots; it does not obtain nonnegativity merely from +a runtime assertion. Equal-product words still contribute their multiplicity. + +A root source has degree G+1 and integer rank at least k_min^(G+1)>floor(n/A), +so it is strictly above n/A. A deeper fresh source has an absent potential +parent, giving rank strictly above r*n/A>=n/A. Fit bounds the rank above by n. +This uses A, not the maximum productive rank m. The code checks the valid +stronger upper bound A*s<=m*n, inherited directly from s=k*rho*c. + +Every deepest paid path exists because r_max^G<=k_min^G<=floor(n/A), and its +empty target word has multiplicity one. The G+1-site exit census is therefore +exactly the paid-product table at that degree. Source complements are strictly +below (A-1)n/A, exits are at most (A-1)n/A, and both are positive when used. +No rank-zero child is constructed. These statements hold without a native +realization or moment-root saving, as the scope says. + +The gcd factor for a complement is necessary and sufficient for its grouped +source count. The exit constraint uses B_e for **each individual cut**; its +multiplicity belongs in the expanded cost, never as a gcd divisor of the +required replication. Equation (3) is consequently the least positive valid +replication. The paid-leaf and executed-unit recurrences include every whole +child copy and the local a_n*U_n term. They are not peak-space recurrences. + +## All-prime divisor and the exposed ambient constant + +For fixed A, the census changes only when floor(n/A) crosses a product of +productive/paid rank generators, including the height thresholds. Counting +all semigroup plateaus may introduce redundant cut points, which only weakens +the divisor bound. If gamma_next follows gamma, k_min*gamma is another +semigroup member, so gamma_next<=k_min*gamma. + +Set alpha=(A-1)/A. The elementary inequality +(1+1/(A-1))^A>2 gives alpha^A<1/2. With +`tau=A*ceil(log2 k_min)`, alpha^tau<1/k_min. A chain beginning in +[A*gamma,A*gamma_next) is below A*gamma after tau edges. Its visits to the +plateau are contiguous, so there are at most tau of them, including the first +vertex. This checks the off-by-one convention in the visit bound. + +For each prime separately, the exact LCM recurrence gives +v_p(B_n)<=v_p(S_n)+max_child v_p(B_child). Following a maximizing child is +legitimate even though that child chain can differ with p. The uniform visit +bound controls every chain, hence every prime, and yields the displayed +integer divisor Q_N. No common maximizing chain or restriction to rank primes +is needed. Source counts can introduce new prime factors; the independent +fixture with only rank generator 2 and target multiplicity 3 exercises this. + +There are at most (H+1)^b possible bounded exponent vectors for semigroup +products <=C. With S_n<=W*(G+1)*max(W,P)^G, taking the logarithm of Q_N proves +beta. This counts plateau locations, not the prime support of widths. Replacing +A by m in tau is invalid; the exact lower-bound family provides a witness. + +## Expanded costs, field widths and complete metadata accounting + +The source count is positive, and base Y_n=(B_n+P_n+O_n)/B_n is 1+n<=A. +The recurrence for Y has only positive contributions. The proposed F bounds +its local term and the sum of complement/individual-exit weights, so +Y_n<=F*max_child Y_child is valid with slack. With H=bit_length(floor(N/A)), +N/A<2^H and alpha^(AH)<2^-H; D=AH edges put every dependency below A. +This gives equation (9), including units as well as leaves and widths. + +The stars-and-bars record counts include degree zero, paid degree G+1, +rejected capacity pairs and product collisions. Convolving paid and target +exponent-vector counts gives the proposed pair bound V. The code's sorted +aggregation is deterministic and does not assume constant expected hashing. + +All ordinary arithmetic fields fit the stated O(Z) envelope. Rank products, +weighted word counts and fit temporaries are bounded independently of final +row sizes. Total negative source contributions cannot exceed total positive +ones, by the parent-to-child injection, so arbitrary signed aggregation +prefixes fit the 2*W*Ubar bound. LCM updates divide before multiplication; +nonnegative expanded-count partial sums are bounded by final totals. The +factor eight safely accommodates the fixed sums of operand widths. + +The constructor does not exponentiate by a_n, B_n, P_n, O_n, beta or D. +Its envelope values are evaluated integers describing upper bounds, not +instructions to allocate 2^beta cells. Parsing, bounded-degree powers, +combinatorial bounds, all output/base rows and child accesses are included in +K up to absolute factors. Sorting adds at most O(Z) comparison factors; +schoolbook division/multiplication and a conservative Euclidean gcd justify +O(K*Z^3) indexed bit work. + +The sequential companion is explicitly separate from Python indexing. A child +read scans and returns over at most N tagged rows, costing O(NZ). Local +sorting/scans/copies fit O((JZ)^2) per counted operation; arithmetic fits O(Z^3) +time and O(Z) workspace. Completed rows plus reusable local regions occupy +O((N+J)Z) historical cells. Immutable row storage, append/return movements and +local erasure can be realized within these loose bounds on a fixed number of +tapes. This is an argued companion construction, not a supplied literal +transition table or a native movement admission. + +For fixed A and histograms, beta, Z and J are powers of log N, K is +N*polylog N, and the stated indexed/sequential asymptotics follow. The numerical +A factors in tau and D are explicit when A varies. No uniform logarithmic-A +bound is silently used. The N=4 both complements +are positive, with source count one. The recurrence is therefore exactly +B_n=2*lcm(B_(n-2),B_(n-3)), with preceding base widths one. Its binary exponent +is floor((n-A)/2)+1, by a direct two-predecessor induction, including t=0,1. + +The endpoint bit length is ceil(A/2)+1. Summing the actual width lengths, +including their leading one bit, gives floor((A-1)^2/4)+2A. With N=2A-1, +these required output bits alone force Omega(N^2) sequential writes. This is +a lower bound for explicit all-rank evaluated output, not a claim about a +compressed symbolic formula, arbitrary representations, or all polynomial-N +algorithms. The fixed histogram is a formal metadata family; it need not be +an admitted native supplier to refute the advertised uniform metadata bound. + +The varying-A family cannot contradict the retained multiplier's order of +quantifiers: its template and ambient are fixed before p varies. The README +correctly makes this distinction and says the selected A=153^1920 only lies +in the parameter domain. Its huge-A fixture evaluates toy bounds/lengths and +materializes no selected rows. The theorem does not transfer default-A bounds +or claim to have generated the selected native manifest. + +## Separately written exact corroboration + +`check.py` imports the tested evaluator only to inspect its returned answers. +It imports no author verifier, literal oracle, predecessor library generator +or compressed product engine to construct expected answers. The expected +census uses a different positive formulation: enumerate paid-site paths and +productive multiplicity lattice points, then count a slot iff its potential +parent fails the actual ambient test. It never subtracts consumed demands. +Multinomial weights use direct factorial identities, without enumerating all +productive words or matching slot lists. + +Expected replication is found by trying consecutive positive integers against +every literal divisibility constraint, with an explicit 50,000-trial cap per +rank. All declared cases finish within that cap; no failed rank is dropped. +This avoids both the production gcd/LCM update and the author's prime-valuation +oracle. Expanded counts then sum the exact integral whole-child copy totals. + +Eight declared domains cover 269 complete rows, 57,744 literal replication +trials and 1,697 represented target slots. All source, exit and local-unit +censuses and all four row values match. A bounded integer-division membership +DP constructs semigroup plateau locations; exact Q divisibility is checked +for every row. Longest-path DPs on the independent dependency graph check +chain depth and plateau visits. Bounds on combined output bits, ordinary +scalar fields and reported implementation-operation counters also hold. + +A separate closed-form check covers 260 plateau widths over A in +{4,5,7,8,13,32,64,127}, verifies exact written-length sums/endpoints, and exposes +the false divisor 8 for every listed A>=7 while the honest 2^A divisor holds. +A rank-2/target-multiplicity-3 fixture confirms source primes need not occur +among the rank generators. These finite checks supplement, not replace, the +universal proofs above. + +Three independently inserted faults fail: pooling equal-rank exit factors, +using m instead of A in the plateau constant, and omitting consumed-demand +subtraction. Complete domain counts, exact row digests and failures are in +RESULT.json. The script prints its receipt and never edits the package. + +Reproduce using the package path as its only argument: + +```sh +python3 -I -W error -B check.py PATH/TO/ambient-rank-library +python3 -I -W error -O -B check.py PATH/TO/ambient-rank-library +``` + +Expected status: PASS_INDEPENDENT_AMBIENT_LIBRARY_REVIEW. Normal and optimized +receipts agree. No author replay, native execution, selected giant table, +Lean run or fixed-tape machine simulation was used in these checks. diff --git a/research/ambient-rank-library/independent/SOURCE-BINDINGS.json b/research/ambient-rank-library/independent/SOURCE-BINDINGS.json new file mode 100644 index 0000000000..f5248fd268 --- /dev/null +++ b/research/ambient-rank-library/independent/SOURCE-BINDINGS.json @@ -0,0 +1,79 @@ +{ + "status": "PASS", + "package": "ambient-rank-library", + "method": "Exact git commit:path bytes; recomputed SHA256 and Git blob; frozen copies compared", + "rows": [ + { + "path": "docs/research/agent-task-catalog.json", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "bytes": 82822, + "sha256": "ead6cdc9d0af6d58e8a49744d8ec8c7c15e13d2ba93c276c434bcf9b51b93a81", + "git_blob": "3404fbdd5e7529a0674eef26114b5071e4586cec", + "pass": true + }, + { + "path": "certificates/selected-result.json", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "bytes": 4803, + "sha256": "154c3d30455d778fd3343b6b4851f0fa4665f0f7625b0adb3675e2bafbbf6bf1", + "git_blob": "75d77b328ea02ded535e7f23aee5b1e55d0bb1a8", + "pass": true + }, + { + "path": "docs/research/pr-intake-evidence/pr7000-application/PROOF-REVIEW.md", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "bytes": 25533, + "sha256": "4501502c2ceb9759b20372435fe4beb51082c5a5e2910c1fd5dbe6edca415055", + "git_blob": "3dd1af2285e597676725e85ad4f65e7ad326d695", + "pass": true + }, + { + "path": "research/p104-shared-native-helper-splits/retained/compiler/PROOF.md", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "bytes": 20219, + "sha256": "95cc9e31bc030ec94b04decddcca2d28ee98cfec0ca7803b54666b2b76a5c9ab", + "git_blob": "f5ef0d2e8289adfb6c5e73c4b58970da462d7df2", + "pass": true + }, + { + "path": "research/kappa-rebuild/architecture/FINITE-PRECOMPILATION.md", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "bytes": 15898, + "sha256": "4cb32f6b8e388ecf6ed41b5bbdeeb4539cb40c8424f194974afea58f7e0921e8", + "git_blob": "4badb40f0919c515823cb07e44c6470d4d6469ca", + "pass": true + }, + { + "path": "research/chronological-width-bound/README.md", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "bytes": 17667, + "sha256": "0a255788cd9b462c4cbef39721ce42d129878bf564fc08be33752ca84530e38d", + "git_blob": "7548fd2060e41cf5b58485126d14b4dec936406a", + "pass": true + }, + { + "path": "research/symbolic-integer-batch-width/PROOF.md", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "bytes": 9251, + "sha256": "f6fed469b53137c41d8543822b08e2381ebdfb6503c26663d01f56a2e8ab76bc", + "git_blob": "6702d6aba2ad4149f9efc8570012a66aae640c8c", + "pass": true + }, + { + "path": "research/quantitative-rank-library/PROOF.md", + "commit": "022461f115369efd988ef8c459907f5544bb8bb3", + "bytes": 13441, + "sha256": "05a04e5ba1db71b9e40397e3220f047411906a5e8a70609c7a879499e6325e88", + "git_blob": "36df15159497eca40d8a9c92023e7f4e91ba62d8", + "pass": true + }, + { + "path": "research/quantitative-rank-library/library.py", + "commit": "022461f115369efd988ef8c459907f5544bb8bb3", + "bytes": 11110, + "sha256": "06e3b44704048461de0ff0ab55fe158b95df412688324b88fd3d81b929ef0d92", + "git_blob": "e1e34aa0e6ee47999784c834ede4f8c9998c5647", + "pass": true + } + ] +} diff --git a/research/ambient-rank-library/independent/check.py b/research/ambient-rank-library/independent/check.py new file mode 100644 index 0000000000..f62eb1acfd --- /dev/null +++ b/research/ambient-rank-library/independent/check.py @@ -0,0 +1,241 @@ +"""Independent positive-source/brute-replication review of ambient rank libraries. + +Expected answers use no author verifier, oracle, compressed products, or +signed subtraction census. Source absence is tested on lattice points and +paid paths; least replication is found by literal positive-integer search. +""" +from collections import Counter +from hashlib import sha1, sha256 +from importlib.util import module_from_spec, spec_from_file_location +from itertools import product +from math import factorial, prod +from pathlib import Path +import json +import sys +import types + +CODE_SHA = '4c709f98239782ba938aa70ee22c0cdf7204fbdac8a5c444e71adb568e06bbfe' +PROOF_SHA = 'a7d75efc8f4c38ca231324f99ce92b0d45df91cbd5ef89c93224700bf740b0c7' +DOMAINS = ( + (3, ((2,1),(3,1)), ((1,1),), 24), + (6, ((2,1),(3,1)), ((1,1),), 35), + (4, ((3,2),), ((2,2),), 18), + (9, ((3,1),(4,1)), ((2,1),), 48), + (7, ((3,1),(5,1)), ((2,1),), 40), + (8, ((2,2),(4,1)), ((1,3),), 24), + (5, ((2,3),), ((1,1),), 32), + (8, ((3,1),(4,1)), ((1,1),(2,1)), 48), +) + + +def need(ok, message): + if not ok: + raise ValueError(message) + + +def points(total, dimension): + if dimension == 1: + yield (total,) + else: + for first in range(total+1): + for tail in points(total-first, dimension-1): + yield (first,)+tail + + +def fresh_census(A, target, paid, n): + kmin = target[0][0] + g = 0 + while A*kmin**(g+1) <= n: + g += 1 + sites = tuple(r for r, count in paid for _ in range(count)) + source, units, checked_slots = Counter(), 0, 0 + for h in range(g+1): + for indices in product(range(len(sites)), repeat=h): + rho = prod(sites[j] for j in indices) + for alpha in points(g-h, len(target)): + column = prod(k**a for (k,_), a in zip(target, alpha)) + if A*rho*column > n: + continue + u = factorial(g-h)//prod(factorial(a) for a in alpha) + u *= prod(w**a for (_,w), a in zip(target, alpha)) + units += u + for k, w in target: + checked_slots += u*w + if not h or A*(rho//sites[indices[-1]])*column*k > n: + source[rho*column*k] += u*w + cuts = tuple(prod(sites[j] for j in path) + for path in product(range(len(sites)), repeat=g+1)) + need(source and all(n < A*s <= target[-1][0]*n for s in source), 'fresh source band') + need(all(0 < A*e <= (A-1)*n for e in cuts), 'exit contraction') + return g, units, source, cuts, checked_slots + + +def direct_rows(A, target, paid, maximum): + rows, flows = [None], {} + trial_count = 0 + for n in range(1, maximum+1): + if n < A: + rows.append((1,1,n,0)) + continue + flow = fresh_census(A,target,paid,n) + g, unit_count, source, cuts, _ = flow + constraints = [(n-s,count) for s,count in source.items() if s=2}) + # Test each bounded integer by division into previously settled membership. + yes=[False]*(C+1) + if C:yes[1]=True + for n in range(2,C+1): + yes[n]=any(n%r==0 and yes[n//r] for r in generators) + return tuple(n for n in range(1,C+1) if yes[n]) + + +def check_domain(module, domain): + A,target,paid,maximum=domain + expected, flows, trials=direct_rows(A,target,paid,maximum) + rule=module.Rule(A,target,paid) + actual=module.compile_library(rule,maximum) + got=[None]+[(r.replication,r.width,r.leaves,r.units) for r in actual.rows[1:]] + need(got==expected,'positive-source/brute-replication row mismatch') + limits=module.Limits();work=module.Work();gmax=module.height(rule,maximum) + tt=module.product_tables(target,gmax,limits,work) + pp=module.product_tables(paid,gmax+1,limits,work) + for n,(g,u,source,cuts,_) in flows.items(): + census=module.census(rule,n,tt,pp,limits,work) + need(census.height==g and census.units==u,'direct height/unit census') + need(census.sources==tuple(sorted(source.items())),'positive fresh-source census') + need(census.exits==tuple(sorted(Counter(cuts).items())),'distinct-cut census') + env=module.envelope(rule,maximum) + exponent=0 + while 2**exponent < target[0][0]:exponent+=1 + tau=A*exponent + need(env['plateau_visit_bound']==tau,'honest ambient plateau constant') + need((A-1)**tau*target[0][0]=7:need(8%rows[n].width!=0,'false default divisor exposed') + records.append({'ambient':A,'maximum':n,'endpoint_bits':rows[n].width.bit_length(), + 'width_bits_written':written}) + # All-prime evidence: rank semigroup uses only 2, but a width uses prime 3. + r=module.compile_library(module.Rule(5,((2,3),),((1,1),)),16).rows[16] + need(r.width%3==0,'source-prime support is not rank-prime support') + return records + + +def run(package): + path=package/'ambient_library.py' + need(sha256(path.read_bytes()).hexdigest()==CODE_SHA,'science code changed') + need(sha256((package/'PROOF.md').read_bytes()).hexdigest()==PROOF_SHA,'science proof changed') + manifest=json.loads((package/'SOURCES.json').read_text());pins=[] + for item in manifest['files']: + if 'local' not in item:continue + data=(package/item['local']).read_bytes() + need(len(data)==item['bytes'] and sha256(data).hexdigest()==item['sha256'],'frozen local source bytes') + need(sha1(b'blob '+str(len(data)).encode()+b'\0'+data).hexdigest()==item['git_blob'],'frozen local Git blob') + pins.append(item['local']) + module=load(path,'independent_ambient_subject') + domains=[check_domain(module,d) for d in DOMAINS] + plateau=plateau_check(module) + mutations=( + ('pooled_exit', + 'factor = child(rows, flow.rank, exit_rank).width', + 'factor = child(rows, flow.rank, exit_rank).width // gcd(child(rows, flow.rank, exit_rank).width, multiplicity)',DOMAINS[2]), + ('default_ambient_visits', + 'visits = rule.ambient * (rule.kmin - 1).bit_length()', + 'visits = rule.m * (rule.kmin - 1).bit_length()',DOMAINS[1]), + ('missing_consumed_demands', + 'if depth < gmax:', 'if False:',DOMAINS[0]), + ) + controls=[] + for j,(label,old,new,domain) in enumerate(mutations): + mutant=load(path,'independent_ambient_mutant_'+str(j),(old,new)) + try:check_domain(mutant,domain) + except ValueError as error:controls.append({'mutant':label,'failure':str(error)}) + else:raise ValueError('undetected independent mutant '+label) + return {'status':'PASS_INDEPENDENT_AMBIENT_LIBRARY_REVIEW','code_sha256':CODE_SHA, + 'proof_sha256':PROOF_SHA,'authenticated_local_sources':pins,'domains':domains, + 'plateau_output_fixtures':plateau,'negative_controls':controls, + 'coverage':{'rows':sum(d['rows'] for d in domains), + 'brute_replication_trials':sum(d['replication_trials'] for d in domains), + 'represented_target_slots':sum(d['checked_slots'] for d in domains)}, + 'limits':'Finite corroboration; universal acceptance is in REVIEW.md. No native realization, selected table, literal tape simulation, or multiplier admission.'} + + +if __name__=='__main__': + package=Path(sys.argv[1]).resolve() + print(json.dumps(run(package),indent=2,sort_keys=True)) diff --git a/research/ambient-rank-library/inputs/default_library.py b/research/ambient-rank-library/inputs/default_library.py new file mode 100644 index 0000000000..e1e34aa0e6 --- /dev/null +++ b/research/ambient-rank-library/inputs/default_library.py @@ -0,0 +1,305 @@ +"""Exact separated chronological compiler metadata; Apache-2.0. + +Prepared for CubeJerry with substantial OpenAI assistance. This reference +evaluates integers, not native programs. PROOF.md prices indexed arithmetic +and a separately described sequential implementation. +""" +from dataclasses import dataclass +from math import comb, gcd + + +class BudgetError(ValueError): + """The bounded executable refuses an unevaluated larger instance.""" + + +@dataclass(frozen=True) +class Limits: + max_rank: int = 4096 + max_records: int = 200000 + max_bits: int = 16384 + + def __post_init__(self): + if any(type(x) is not int or x < 1 for x in + (self.max_rank, self.max_records, self.max_bits)): + raise ValueError("positive integer capacities required") + + def integer(self, value): + if abs(value).bit_length() > self.max_bits: + raise BudgetError("integer bit capacity") + return value + + def records(self, count): + if count > self.max_records: + raise BudgetError("local record capacity") + + +@dataclass(frozen=True) +class Rule: + targets: tuple + paid: tuple + + def __post_init__(self): + for alphabet in (self.targets, self.paid): + if type(alphabet) is not tuple or not alphabet: + raise ValueError("nonempty tuple histograms required") + previous = 0 + for entry in alphabet: + if type(entry) is not tuple or len(entry) != 2: + raise ValueError("rank/count pairs required") + rank, count = entry + if (type(rank) is not int or type(count) is not int or + rank <= previous or count < 1): + raise ValueError("sorted distinct positive ranks/counts required") + previous = rank + if self.targets[0][0] < 2 or self.paid[-1][0] >= self.targets[0][0]: + raise ValueError("strict separation required") + + @property + def m(self): + return self.targets[-1][0] + + @property + def kmin(self): + return self.targets[0][0] + + @property + def bits(self): + def gamma_length(v): + return 2 * v.bit_length() - 1 + total = 0 + for alphabet in (self.targets, self.paid): + total += gamma_length(len(alphabet)) + total += sum(gamma_length(x) for row in alphabet for x in row) + return total + + +@dataclass(frozen=True) +class Row: + replication: int + width: int + leaves: int + units: int + + +@dataclass(frozen=True) +class Census: + rank: int + height: int + units: int + sources: tuple + exits: tuple + + +@dataclass +class Work: + product_records: int = 0 + candidate_pairs: int = 0 + source_contributions: int = 0 + complement_constraints: int = 0 + exit_constraints: int = 0 + completed_rows: int = 0 + + +@dataclass(frozen=True) +class Library: + rule: Rule + rows: tuple + work: Work + + +def height(rule, rank): + if rank < rule.m: + raise ValueError("height requires a nonbase rank") + threshold = rule.m + result = 0 + while threshold * rule.kmin <= rank: + threshold *= rule.kmin + result += 1 + return result + + +def merge_records(records, limits): + """Deterministic sort/add; input length and temporary integers charged.""" + limits.records(len(records)) + records.sort(key=lambda item: item[0]) + result = [] + key, value = None, 0 + for next_key, next_value in records: + if key is not None and next_key != key: + if value < 0: + raise ValueError("negative aggregate") + if value: + result.append((key, value)) + value = 0 + key = next_key + value = limits.integer(value + next_value) + if key is not None: + if value < 0: + raise ValueError("negative aggregate") + if value: + result.append((key, value)) + return tuple(result) + + +def product_tables(alphabet, degree, limits, work): + tables = [((1, 1),)] + for _ in range(degree): + limits.records(len(tables[-1]) * len(alphabet)) + candidates = [] + for product, count in tables[-1]: + for rank, multiplicity in alphabet: + candidates.append((limits.integer(product * rank), + limits.integer(count * multiplicity))) + work.product_records += len(candidates) + tables.append(merge_records(candidates, limits)) + return tuple(tables) + + +def census(rule, rank, targets, paid, limits, work): + gmax = height(rule, rank) + d, q = len(rule.targets), len(rule.paid) + bound = (d + q) * comb(gmax + d + q - 1, d + q - 1) + limits.records(bound) + contributions = [] + units = 0 + for depth in range(gmax + 1): + for rho, paths in paid[depth]: + for column, words in targets[gmax - depth]: + work.candidate_pairs += 1 + size = limits.integer(rho * column) + if limits.integer(rule.m * size) > rank: + continue + copies = limits.integer(paths * words) + units = limits.integer(units + copies) + for k, multiplicity in rule.targets: + contributions.append((limits.integer(size * k), + limits.integer(copies * multiplicity))) + if depth < gmax: + for r, multiplicity in rule.paid: + contributions.append((limits.integer(size * r), + -limits.integer(copies * multiplicity))) + work.source_contributions += len(contributions) + sources = merge_records(contributions, limits) + if not sources or any(not rank < rule.m * s <= rule.m * rank + for s, _ in sources): + raise ValueError("source band failure") + exits = paid[gmax + 1] + if any(not 0 < e * rule.m <= (rule.m - 1) * rank for e, _ in exits): + raise ValueError("exit contraction failure") + return Census(rank, gmax, units, sources, exits) + + +def child(rows, parent, rank): + if not 1 <= rank < parent or rank >= len(rows) or rows[rank] is None: + raise ValueError("positive previously completed child required") + return rows[rank] + + +def replication(flow, rows, limits, work): + result = 1 + for source, count in flow.sources: + if source == flow.rank: + continue + width = child(rows, flow.rank, flow.rank - source).width + factor = width // gcd(width, count) + result = limits.integer((result // gcd(result, factor)) * factor) + work.complement_constraints += 1 + for exit_rank, multiplicity in flow.exits: + factor = child(rows, flow.rank, exit_rank).width + result = limits.integer((result // gcd(result, factor)) * factor) + work.exit_constraints += 1 + return result + + +def whole_copies(arrays, width): + copies, remainder = divmod(arrays, width) + if remainder: + raise ValueError("nonintegral chronological child batch") + return copies + + +def finish_row(flow, rows, scale, limits): + width = limits.integer(scale * sum(count for _, count in flow.sources)) + leaves = 0 + units = limits.integer(scale * flow.units) + for source, count in flow.sources: + if source == flow.rank: + continue + old = child(rows, flow.rank, flow.rank - source) + copies = whole_copies(limits.integer(scale * count), old.width) + leaves = limits.integer(leaves + limits.integer(copies * old.leaves)) + units = limits.integer(units + limits.integer(copies * old.units)) + for exit_rank, multiplicity in flow.exits: + old = child(rows, flow.rank, exit_rank) + per_cut = whole_copies(scale, old.width) + copies = limits.integer(multiplicity * per_cut) + leaves = limits.integer(leaves + limits.integer(copies * old.leaves)) + units = limits.integer(units + limits.integer(copies * old.units)) + return Row(scale, width, leaves, units) + + +def compile_library(rule, maximum, limits=Limits()): + if type(maximum) is not int or maximum < 1: + raise ValueError("positive maximum rank required") + if maximum > limits.max_rank: + raise BudgetError("maximum rank capacity") + limits.records(len(rule.targets) + len(rule.paid)) + for alphabet in (rule.targets, rule.paid): + for record in alphabet: + for value in record: + limits.integer(value) + work = Work() + rows = [None] # no B_0 program is constructed or queried + if maximum >= rule.m: + gmax = height(rule, maximum) + mt = comb(gmax + len(rule.targets), len(rule.targets)) + mr = comb(gmax + len(rule.paid) + 1, len(rule.paid)) + limits.records(mt + mr) + targets = product_tables(rule.targets, gmax, limits, work) + paid = product_tables(rule.paid, gmax + 1, limits, work) + for rank in range(1, maximum + 1): + if rank < rule.m: + row = Row(1, 1, rank, 0) + else: + flow = census(rule, rank, targets, paid, limits, work) + scale = replication(flow, rows, limits, work) + row = finish_row(flow, rows, scale, limits) + rows.append(row) + work.completed_rows += 1 + return Library(rule, tuple(rows), work) + + +def envelope(rule, maximum): + """Return explicit integer bounds, not the enormous powers B or F**D.""" + if type(maximum) is not int or maximum < rule.m: + raise ValueError("nonbase maximum required for this envelope") + d, q = len(rule.targets), len(rule.paid) + w = sum(count for _, count in rule.targets) + p = sum(count for _, count in rule.paid) + g = height(rule, maximum) + length = maximum.bit_length() + ubar = (g + 1) * max(w, p) ** g + sbar = w * ubar + f = 1 + (w + 1) * ubar + p ** (g + 1) + depth = rule.m * length + generators = [] + for rank in sorted(k for alphabet in (rule.targets, rule.paid) + for k, _ in alphabet if k >= 2): + if not generators or generators[-1] != rank: + generators.append(rank) + tau = rule.m * (rule.kmin - 1).bit_length() + beta = tau * (length + 1) ** len(generators) * sbar.bit_length() + mt, mr = comb(g + d, d), comb(g + q + 1, q) + pairs = comb(g + d + q - 1, d + q - 1) + exits = comb(g + q, q - 1) + operations = ((rule.bits + 1) ** 2 + d * mt + q * mr + + (maximum + 1) * ((d + q + 2) * pairs + exits + g + 2)) + bit_cap = 8 * (rule.bits + length + (g + 2) * (rule.m + w + p + 2).bit_length() + + beta + rule.m.bit_length() + depth * f.bit_length() + + operations.bit_length() + 2) + local_records = mt + mr + (d + q + 2) * pairs + exits + g + rule.bits + 2 + return {"height": g, "target_records": mt, "paid_records": mr, + "pairs": pairs, "exit_records": exits, "width_log_bound": beta, + "combined_output_bits": beta + rule.m.bit_length() + depth * f.bit_length() + 1, + "F": f, "D": depth, "K": operations, "Z": bit_cap, + "J": local_records, "L_local": local_records * bit_cap} diff --git a/research/ambient-rank-library/literal_oracle.py b/research/ambient-rank-library/literal_oracle.py new file mode 100644 index 0000000000..e5fbe44f37 --- /dev/null +++ b/research/ambient-rank-library/literal_oracle.py @@ -0,0 +1,137 @@ +"""Independent bounded explicit-occurrence and prime-valuation oracle. + +No import from the production evaluator. Each productive role, paid site, +word and path is materialized. Widths use prime exponents; expanded costs +use independent rational per-array recurrences. Apache-2.0; OpenAI-assisted. +""" +from collections import Counter +from fractions import Fraction +from itertools import product +from math import prod + + +def demand(ok, message): + if not ok: + raise ValueError(message) + + +def literal_flow(ambient, targets, paid, rank): + roles = tuple(k for k, count in targets for _ in range(count)) + sites = tuple(r for r, count in paid for _ in range(count)) + demand(rank >= ambient, "nonbase literal flow required") + demand(len(roles) + len(sites) <= 32, "literal alphabet budget") + degree, minimum_power = 0, min(roles) + while minimum_power <= rank // ambient: + degree += 1 + minimum_power *= min(roles) + units, slots = {}, {} + for depth in range(degree + 1): + for path in product(range(len(sites)), repeat=depth): + for word in product(range(len(roles)), repeat=degree - depth): + column = prod(sites[j] for j in path) * prod(roles[i] for i in word) + if ambient * column > rank: + continue + unit = (path, word) + units[unit] = column + demand(len(units) <= 200000, "literal unit budget") + for role, k in enumerate(roles): + slots[(unit, role)] = column * k + consumed, cuts = set(), [] + for (path, word), column in units.items(): + for site, r in enumerate(sites): + if word: + child = (path + (site,), word[1:]) + port = (child, word[0]) + demand(child in units, "missing demanded literal child") + demand(port not in consumed, "literal parent alias") + demand(slots[port] == column * r, "literal rank mismatch") + consumed.add(port) + else: + cuts.append((path + (site,), column * r)) + sources = Counter(value for port, value in slots.items() if port not in consumed) + exits = Counter(value for _, value in cuts) + demand(sources and all(rank < ambient * s and s <= rank for s in sources), + "literal source band") + demand(all(0 < e < rank for _, e in cuts), "literal exit descent") + return {"height": degree, "units": len(units), + "sources": tuple(sorted(sources.items())), + "exits": tuple(sorted(exits.items())), "cuts": tuple(sorted(cuts))} + + +def factor_integer(value): + demand(value >= 1 and value.bit_length() <= 64, "oracle factor budget") + factors, divisor = {}, 2 + while divisor * divisor <= value: + while value % divisor == 0: + factors[divisor] = factors.get(divisor, 0) + 1 + value //= divisor + divisor += 1 + if value > 1: + factors[value] = factors.get(value, 0) + 1 + return factors + + +def explicit_library(ambient, targets, paid, maximum): + rows, valuations, leaf_ratios, unit_ratios = [None], [None], [None], [None] + flows, raw_cuts, raw_units, constraints = {}, 0, 0, 0 + for n in range(1, maximum + 1): + if n < ambient: + rows.append((1, 1, n, 0)) + valuations.append({}) + leaf_ratios.append(Fraction(n)) + unit_ratios.append(Fraction(0)) + continue + flow = literal_flow(ambient, targets, paid, n) + flows[n] = flow + raw_cuts += len(flow["cuts"]) + raw_units += flow["units"] + sources = flow["sources"] + total = sum(count for _, count in sources) + requirements = {} + leaf = Fraction(0) + unit = Fraction(flow["units"]) + for s, count in sources: + if s == n: + continue + constraints += 1 + removed = factor_integer(count) + for prime, exponent in valuations[n - s].items(): + requirements[prime] = max(requirements.get(prime, 0), + exponent - removed.get(prime, 0)) + leaf += count * leaf_ratios[n - s] + unit += count * unit_ratios[n - s] + for _, e in flow["cuts"]: + constraints += 1 + for prime, exponent in valuations[e].items(): + requirements[prime] = max(requirements.get(prime, 0), exponent) + leaf += leaf_ratios[e] + unit += unit_ratios[e] + a = prod(prime ** exponent for prime, exponent in requirements.items()) + current = factor_integer(total) + for prime, exponent in requirements.items(): + current[prime] = current.get(prime, 0) + exponent + width = prod(prime ** exponent for prime, exponent in current.items()) + leaf /= total + unit /= total + leaves, occurrences = width * leaf, width * unit + demand(leaves.denominator == occurrences.denominator == 1, + "literal rational cost not integral") + rows.append((a, width, int(leaves), int(occurrences))) + valuations.append(current) + leaf_ratios.append(leaf) + unit_ratios.append(unit) + return {"rows": tuple(rows), "flows": flows, "cuts": raw_cuts, + "units": raw_units, "constraints": constraints} + + +def semigroup(generators, cap): + """Explicit bounded multiplication closure, not an exponent-box estimate.""" + seen, todo = {1}, [1] + while todo: + value = todo.pop() + for generator in generators: + new = value * generator + if new <= cap and new not in seen: + seen.add(new) + todo.append(new) + return tuple(sorted(seen)) diff --git a/research/ambient-rank-library/reference/FINITE-PRECOMPILATION.md b/research/ambient-rank-library/reference/FINITE-PRECOMPILATION.md new file mode 100644 index 0000000000..4badb40f09 --- /dev/null +++ b/research/ambient-rank-library/reference/FINITE-PRECOMPILATION.md @@ -0,0 +1,313 @@ +# Finite precompilation of a mixed-target rule + +Status: constructive bridge under the precise native hypotheses below, +independently audited in `../transfer-audit/AUDIT.md`. This is a written +argument, not a formal proof or a completed integer-multiplication admission. +The companion finite scheduler checks actual integer flow and ordering. +The original immediate-normalization BIT interface failed hypothesis 3. +`../bit/DELAYED-COVER-BRIDGE.md` supplies the distinct delayed-cover +implementation, with a finite local-ring check and the native binding in +`../bit/BIT-P3-NATIVE-BINDING.json`. Its fixed rational cover routes are a +costed program schema, not dense coordinate gates in a plain native word. + +Substantial OpenAI assistance. Apache-2.0. The mixed-target asymptotic flow is +Jacob Alan Sussman's Theorem 1G, PR4268, with the detailed proof at commit +`563b4e6e913625637f36ba7869bf5fcd0dd4975a` of +[`wht-power-saving-lean`](https://github.com/jacobalansussman/wht-power-saving-lean). +The source, exact scheduling code and notices are preserved under `sources/`. +The contribution proposed here is clearing the finite flow into a single +uniform native supplier before applying the inherited outer theorem. + +## 1. What needs to be assumed + +Let a job of rank `s` apply a specified tensor operator to `s` selected +coordinate blocks of one array, fixing all other coordinates. A block has +an arbitrary positive tensor multiplicity `f`. A completed rank `s` job +therefore acts on `s*f` axes. All productive inputs are arbitrary. + +Fix one mixed unit with productive targets `W_k` of ranks `k`, a chronological +list of paid child ranks `r_j`, and a finite number of scalar and routing +passes. These assumptions are required, separately from the moment inequality: + +1. **An all-column native word.** At every integer column count `c`, the unit + computes exactly its independent rank `k*c` output jobs. Its paid rounds + are rank `r_j*c` jobs in the stated order. All borrowed data return to the + declared endpoint, and owned storage is explicitly initialized and erased. + Its finite operation count is uniform in `c`. +2. **Disjoint splitting and spectators.** A rank `a+b` job is a rank `a` job + followed by a rank `b` job on disjoint coordinates. The resulting programs + preserve arbitrary complete spectator fields and accept arbitrary data. +3. **Whole-job adapters.** Any job passed between two units has an explicitly + priced, permitted embedding into its destination. For the intended complex + application these are fixed monomial binary address maps and unit quadratic + phases, together with role permutations. The adapters must work at every + tensor multiplicity. Rank equality by itself is insufficient. +4. **Finite-program closure.** A finite composition of these words and + adapters is again a permitted finite supplier. Constantly many owned fields + may be supplied with their full cost and no productive output credit. + The eventual ordinary recursion must have the same arbitrary-input, + restoration, scalar and precision interface as the retained supplier. + +Put `m=max{k:W_k>0}`, `k_min=min{k:W_k>0}`, and +`r_max=max{r_j}`. Require `r_max g*S`, keeps one +external weight throughout the entire finite circuit, and lowers only its +final rank-one leaves. All rational matchers, role routes and their inverses +are fixed before choosing the odd prime and its exclusions. Every route +uses complete equal-multiplicity cover fibers and the retained, costed row +permutation primitive. This gives the same finite DAG argument in the +rational-cover program category. The BIT binding supplies the actual native +projectors; a rank count alone would not provide this implementation. + +## 2. Proposed conclusion + +Suppose the preceding hypotheses hold and the mixed balance has root +`tau` in `(0,1)`: + +``` +sum_j r_j^tau = sum_k W_k k^tau. +``` + +For every `z` with `tau=2`, a fixed number `B_N` of productive arrays, +and only rank-one paid children, whose number `P_N` satisfies + +``` +P_N < B_N * N^z. +``` + +Every productive output is the full rank-`N` job. The construction may have +an enormous finite scalar word, role inventory and owned-storage requirement. +Those quantities affect constants and the eventual input threshold. They are +not omitted and are not credited as extra output jobs. + +If this uniform supplier is admitted under the retained native, precision and +fixed-tape premises, the existing uniform recursion applies directly. A new +dynamic RAM-to-Turing-machine simulation is not being assumed here. + +## 3. The integer lockstep flow at a fixed rank + +This is the part of Theorem 1G used by the compiler. At one fixed top rank +`N`, its units, source jobs and exit jobs have integer multiplicities. +For a multi-index `a` on the target types define + +``` +c(a) = product_k k^(a_k), +u(a) = multinomial(|a|;a) * product_k W_k^(a_k). +``` + +The exact Pascal identity is + +``` +u(b) = sum_{k:b_k>0} W_k*u(b-e_k). +``` + +Let `G` be the largest `|a|` with `m*c(a)<=N`. A class is indexed by a +sequence of paid rounds `s` of length `d<=G`; its dilation is +`rho_s=product r_j`. It contains `u(a)` units at column `rho_s*c(a)` for +each `a` with `|a|=G-d` and `m*rho_s*c(a)<=N`. + +For one parent paid round, the Pascal bijection matches its job copies to +target roles of the child class, at exactly equal integer ranks. Missing +demands are top sources. Separation ensures every parent job is consumed. +The source ranks lie in `(N/m,N]`; only the deepest classes produce exit +jobs, all strictly smaller than `N` once `N` is outside the finite base range. + +Process a class in word order. At round `j`, suspend every unit of that +class, complete the entire child class fed by that round, and only then +advance the parents to round `j+1`. This forbids a unit from requiring both +an earlier and a later round of the same suspended parent. The resulting +dependency graph is finite and acyclic. Its edges carry complete array jobs, +not individual scalar values copied for free. + +These integer quantities exist before normalizing the sources to total +weight one. Let `S_s` be the number of source jobs of rank `s`, let +`S=sum_s S_s`, and let the ordered exit batches be `(e,t)` with `t` jobs +of rank `e` each. This finite integer flow is the compiler input. + +## 4. Clear every batch denominator constructively + +Induct on the integer top rank `N`. For each smaller rank `e` the compiler +has already constructed a uniform program on `B_e` arbitrary arrays, +computing full rank `e` with `P_e` paid rank-one calls. For a sufficiently +small rank use the ordinary sequential program: `B_e=1`, `P_e=e`. + +For the current flow choose an integer `a` divisible by every `B_e` needed +for an exit and every `B_(N-s)` needed for a nonzero source remainder. +The product of those finitely many positive integers is a valid choice; +their least common multiple is a smaller optional choice. Set + +``` +B_N = a*S. +``` + +Assign `a*S_s` of the input arrays to each source rank `s`. On each of those +arrays, first complete its `N-s` complementary coordinates using the +already-compiled smaller uniform program. All such batches are integral +because `a` is divisible by their program widths. This preliminary action +commutes with the intended `s`-coordinate job and fixes its input coordinates. + +Make `a` copies of the integer lockstep flow. Route its source arrays to +their exact input slots using permitted whole-array adapters. At a deepest +exit batch, `a*t` is divisible by `B_e`; replace that batch by copies of +the smaller uniform rank-`e` program. Restore its role ordering and adapters +before resuming the suspended parent class. Execute the finite DAG in the +lockstep order, and finally restore the original source-array ordering. + +Every array has now received its disjoint complementary job and source job, +hence the full rank-`N` transform. No copied scalar input or blank helper is +treated as another independent output. Every original array occurs exactly +once as a source; interior target slots are jobs on those arrays, not new +productive inputs. + +Induction removes all recursive calls: the only remaining paid children +have rank one. Clearing denominators multiplies productive arrays and paid +operations equally, so it preserves the per-array leaf count. In formulas, + +``` +P_N/B_N = (1/S) * [ + sum_s S_s * (P_(N-s)/B_(N-s)) + + sum_(ordered exit batches e,t) t * (P_e/B_e) +]. +``` + +Zero-rank terms vanish. Any plain rank-one exits are the ordinary base +program. Scalar and routing passes have their own analogous nonnegative +count and must be included in the asymptotic cost used to choose `N`. + +This construction uses full integer batches; it does not assume that +fractional pieces of a physical array can be routed at zero cost. Its exact +replication factors can be impractically large, which is acceptable for a +fixed finite supplier existence statement but must be disclosed. + +## 5. Why some fixed N has the required saving + +The independent audit sharpened this step to a direct count of paid leaves. +It does not require a running-time comparison between a RAM flow and native +tapes. Let `L(n)=P_n/B_n`, let `w_s=S_s/S`, and let `x_e` be the exit counts +normalized by the number S of source arrays. The actual integer compiler +satisfies + +``` +L(n) = sum_s w_s L(n-s) + sum_e x_e L(e), +sum_s w_s = 1, +sum_e x_e e^tau = sum_s w_s s^tau. +``` + +The last equality follows by canceling every internal matched job in the +exact tau-potential balance. The source ranks satisfy `n/m0`, concavity gives + +``` +n^z0 - sum_s w_s (n-s)^z0 >= eta * sum_s w_s s^z0. +``` + +Indeed, for `t=s/n` in `[1/m,1]`, +`1-(1-t)^z0 >= z0*t >= eta*t^z0`. For every sufficiently large n the +exit coefficient is less than `eta/2`. Every complement and exit has +smaller rank than n, so strong induction on the exact recurrence proves +`L(n)<=A*n^z0`, with finite A chosen to cover the smaller ranks. Eventually +`L(N)=m. A depth-h path has paid +product rho; a unit profile of degree G_n-h has target product c and +multiplicity u(alpha). It is present iff `m*rho*c<=n`. Its target k and +paid r jobs have true ranks rho*c*k and rho*c*r. Pascal matching is a +bijection of formal occurrences, never a quotient by equal products. + +The outputs are evaluated binary integers: replication a_n, productive +width B_n, expanded rank-one leaf count P_n and expanded mixed-unit count +O_n. O_n is not peak live storage. If an actual unit contract supplies h +owned fields, h*O_n is a safe no-reuse count, before their physical extent. +Base rows are `a_n=B_n=1, P_n=n, O_n=0` for 1<=n0. (1) +``` + +Proof: A counts all target slots with their complete formal multiplicity. +Every nondeepest paid demand is matched: after removing target factor k, +its child has dilation rho*r and column c/k, and +`m*rho*r*c/k < m*rho*c<=n`. The Pascal identity partitions the parent +occurrences among these child slots, including their first role. Conversely +every matched target slot has this incoming demand at the same true rank. +Subtracting counts leaves exactly the fresh targets, hence S_s>=0. A root +unit of column k_min^G exists, so S>0. This is a universal matching proof; +an executable nonnegativity assertion would not replace it. + +Every deepest path is present because +`rho<=r_max^G<=k_min^G<=n/m`. It has one degree-zero unit and all its paid +jobs exit. Therefore + +``` +E_e=R_(G+1)(e) (2) +``` + +counts distinct one-job cuts of rank e. E_e is not the number of arrays +available at any one cut. These counts agree with the source-row and +complement-port codecs' fresh physical identities; this evaluator does +not enumerate or route their physical rows. + +## 3. Every batch constraint and expanded-count recurrence + +Source complements occur upfront, so each s0} + union {B_e:E_e>0}), +B_n=a_n*S, (3) +P_n=sum_(s=k_min^(G+1)>floor(n/m)` and integrality gives s>n/m. A nonroot +fresh source has a missing parent above the cap; multiplying that parent's +integer product by its positive last paid rank gives the same s>n/m. +Fit gives s<=n. Thus positive complement ranks obey +`n-s<(m-1)n/m`. Each exit obeys `e<=r_max*n/m<=(m-1)n/m`. +Set alpha=(m-1)/m: every recursive edge contracts by alpha. + +Evaluating (1)--(4) for n=1,...,N therefore gives exactly the separated +literal flow's least-chronological library metadata. Native arbitrary-input +correctness, all-column lift, adapters, disjoint splitting and physical +finite closure remain the source's separate hypotheses. + +## 4. Fully evaluated output sizes, without positive rank surplus + +Assume N>=m; otherwise all rows are base rows. For positive x let +ell(x)=bit_length(x). Put L=ell(N), G=G_N, K0=max(W,P), and + +``` +Ubar=(G+1)*K0^G, Sbar=W*Ubar, +F=1+(W+1)*Ubar+P^(G+1), D=m*L. (5) +``` + +Deleting eligibility tests gives +`U_n<=sum_(h=0)^G P^h W^(G-h)<=Ubar`, and hence S_n<=Sbar. +The sum of smaller-batch multiplicities is at most Sbar+P^(G+1). +These bounds hold for every n<=N since G_n<=G. + +### A cited width divisor, with no factorization cost + +Let b count distinct integers >=2 among all target and paid ranks. +The rank semigroup has at most (L+1)^b products <=floor(N/m): each has +a representation whose b generator exponents are <=L. Repeated +representations only loosen this upper bound. Rank one is omitted. + +#4638 proves, for this default policy, the all-prime divisor +`B_n | product_gamma S(gamma)^tau` for every n<=N, over source-count +plateaus up to the cap, with `tau=m*ceil(log2 k_min)`. Substituting the +generator-box and Sbar bounds yields the explicit integer envelope + +``` +beta=tau*(L+1)^b*ell(Sbar), +log2 B_n<=beta, log2 a_n<=beta. (6) +``` + +This uses all primes of the source counts, including new ones absent from +rank factors. No factorization, valuation algorithm or shared unevaluated +expression is used. The sharper multiplicative-rank result of #5962 is +available but unnecessary. Equation (6) instantiates an existing theorem; +it is not a new width asymptotic. It does not apply to the old nested +choice a_n=B_(n-1), which can have Theta(N log N) width bits. + +### Expanded leaves and mixed-unit occurrences + +Set Y_n=(B_n+P_n+O_n)/B_n. From (4), positivity and S>=1, + +``` +Y_n=1+U_n/S+sum_batches(t/S)*(P_q+O_q)/B_q + <=(1+U_n+sum_batches t)*max_child Y_q + <=F*max_child Y_q. (7) +``` + +There is a deepest exit since P>0, so the maximum is nonempty. Base +ratios are n+1<=m. Bernoulli gives alpha^m<1/2; after D=m*ell(N) +contracting edges a positive rank would be below one. Every actual chain +therefore reaches a base rank in at most D edges. Iterating (7) gives + +``` +B_n+P_n+O_n<=B_n*m*F^D, +ell(B_n+P_n+O_n)<=beta+ell(m)+D*ell(F)+1. (8) +``` + +This holds also for formal rules with zero or negative rank surplus. +No saving, moment-root or native-existence assertion is needed. All +replicated child copies remain counted. + +## 5. Record counts and an explicit common bit cap + +The total product-table and current-rank record counts are bounded by + +``` +M_T=binomial(G+d,d), M_R=binomial(G+q+1,q), +V=binomial(G+d+q-1,d+q-1), E=binomial(G+q,q-1). (9) +``` + +M_T covers target degrees 0..G; M_R covers paid degrees 0..G+1. For +h+g=G, stars and bars and convolution give at most V product pairs, +including rejected fits. The signed source list has at most (d+q)V +contributions before deduplication; E bounds distinct exits. Coincident +products do not increase these bounds. G=0 and singleton alphabets are +included in the displayed formulas. + +Let S_bit encode both nonempty lists as Gamma(list length), followed by +Gamma(rank) and Gamma(multiplicity) for each entry. This counts supplied +histogram bits, not an independently supplied native word. Define + +``` +K=(S_bit+1)^2+d*M_T+q*M_R + +(N+1)*((d+q+2)*V+E+G+2), +Z=8*(S_bit+L+(G+2)*ell(m+W+P+2) + +beta+ell(m)+D*ell(F)+ell(K)+2), +J=M_T+M_R+(d+q+2)*V+E+G+S_bit+2, +L_local=J*Z. (10) +``` + +Z bounds ordinary integer fields and arithmetic temporaries. Word-product +keys are at most m^(G+1). Weighted counts are at most the corresponding +powers of W and P. All target contributions together are <=W*Ubar; +matched incoming contributions are no larger, so signed partial sums +have magnitude <=2*W*Ubar. Equations (6)--(8) bound library values. +Division numerators such as a*S_s have at most the sum of operand bit +lengths, while each nonnegative completed summand is <=its final sum. +Loop counters and record addresses are covered by L, S_bit and ell(K). +Binomial bounds can be computed by successive exact multiply/divide +steps, whose intermediates add at most one factor's length. The generous +factor eight absorbs these fixed additions. No bound is emitted in unary. + +Build each T/R degree by generating fixed-rank extensions, sorting and +adding equal keys. At most d*M_T+q*M_R records are generated. At each n, +enumerate (9), aggregate signed source records by sorting, and evaluate +(3)--(4) against the earlier completed library rows. All zero candidates, +all actual recursive ranks and every chronological exit divisor are paid. + +## 6. Indexed and sequential construction models + +### Indexed metadata + +Specify indexed storage explicitly: fetching/storing an O(Z)-bit record +with an O(Z)-bit address costs O(Z) bit work. Schoolbook multiplication +and division cost O(Z^2). Euclid takes O(Z) divisions, so a conservative +gcd charge is O(Z^3). Comparison sorting k records costs O(k log k) +comparisons; log k=O(Z), so its bit bill fits O(k Z^2). Thus + +``` +T_indexed=O(K*Z^3). (11) +``` + +The reference integer operations can be replaced by these elementary +algorithms. This is not a literal CPython-runtime guarantee or a claim +of free random access to native payloads. + +### Sequential companion, with library access charged + +Keep completed library rows in an append-only sequence with rank tags. +For every child access, scan at most N records, copy the selected row to +arithmetic tapes, and return the library head. Comparisons, copying and +return together cost O(N*Z). The earlier child values remain immutable. + +Keep product tables and current-rank contributions in fixed local regions +of total extent O(L_local). Full scans and insertion sorting, including +copies, counter updates and head resets, cost at most O(L_local^2) per +generated record or recurrence operation. Elementary arithmetic uses +O(Z) workspace and O(Z^3) time per operation. Erase and reuse the same +local regions; their historical backing remains charged. These explicit +scan recipes give a fixed-number-of-tapes companion with + +``` +T_sequential=O(K*(N*Z+L_local^2+Z^3)). (12) +``` + +Python list access is not asserted to be a tape instruction. The four +library values, rank tags and work regions use O((N+J)*Z) historical +cells. Optionally retaining every per-rank source/exit census adds at +most O(K*Z) output bits; their writing fits both time bounds and their +backing is retained. Neither erasure nor streaming makes written output +free. Uniform parsing, validation and bound setup fit the S_bit term and +the explicitly counted arithmetic; alphabet-size dependence is retained. + +For each fixed rule, G=O(log N) and all parameters in (9)--(10), apart +from N in K, are fixed powers of log N. Thus the indexed bound is +N*polylog N and the sequential bound is N^2*polylog N. Every output is a +fully evaluated integer of polylogarithmic bit length. Constants and +powers depend on the fixed rule through the displayed formulas. This +is not polynomial in log N: the output contains N library rows. + +## 7. Scope and remaining obligations + +This quantitatively evaluates the complete formal rank-induction +metadata for the separated default-height least-chronological policy. +It includes every source complement and each original exit divisor, +without enumerating P^G paid paths or W^G unit slots. The new computation +uses the existing width theorem; the normalized count estimate also +bounds expanded leaves/units when no positive rank surplus is assumed. + +Actual scalar-word size is not determined by rank counts. It additionally +depends on the native word's instruction/constant encodings and on +whole-job adapter production. Such production bounds must be supplied +before an encoded native word or its physical runtime can be bounded. +An evaluated B_q is not proof of a valid smaller program. No arrays are +routed by this evaluator, and the native/all-column, ownership, precision, +fixed-tape payload, analytic and outer interfaces remain conditional. +No selected astronomical rank library or 1920-fold word is materialized. +There is no new kappa or foundational assumption discharge. + +Credit #4507/#5071 for batch recurrences, #4638/#5962 for width envelopes, +Jacob Alan Sussman and zxv for the lockstep/Pascal flow, and the published +source-row/port packages for exact occurrence binding. All original source +notices are retained. Prepared for CubeJerry with substantial OpenAI +assistance; independent human or proof-kernel acceptance is not claimed. diff --git a/research/ambient-rank-library/reference/selected-ambient-PROOF.md b/research/ambient-rank-library/reference/selected-ambient-PROOF.md new file mode 100644 index 0000000000..f5ef0d2e82 --- /dev/null +++ b/research/ambient-rank-library/reference/selected-ambient-PROOF.md @@ -0,0 +1,381 @@ +# The four-main caller is a complete mixed unit, with its actual ambient cap + +This is a source-bound compiler instantiation under the retained framework. +It resolves the declared new-form question in +CrocSwap/integer-mult-bounds#6902: a reducible root, one native serving two +chains, and different main fields carrying equal frame labels. It also makes +an omitted geometric parameter explicit: this raw word has **153 ambient +axes**, whereas its largest productive job has **rank 145**. + +**No new κ.** No selected-frontier update, unconditional compiler theorem, +BIT admission, physical erasure algorithm, or finite materialization of the +enormous uniform supplier is claimed. The five retained framework assumptions +remain. The claim is an implication from their positively stated job grammar +to this particular finite instance. + +The canonical contract base is +`7c49fe32c55de02c2c873655c804b16e4c3fef0a`; the exact proposal is +`e4d42607f24d7a049b0fca329dc4c34882405c25`. +`RETAINED.json` authenticates complete source files by Git blob, SHA256 and +size. Source author DreamingOfClouds retains construction priority. The +general integer flow is Jacob Alan Sussman's; the chronological product and +whole-job specialization retain the #4359/#4416/#5241 lineage. + +## 1. The theorem being instantiated + +`FINITE-PRECOMPILATION.md` §1 positively quantifies over a finite mixed unit +with arbitrary independent productive arrays, a chronological list of paid +single-array jobs, complete spectators, explicit whole-job adapters and +initialized/erased owned fields. Its §6 expressly permits a paid owner to +contain a correlated value or to be an owned center. The parent waits for the +entire child and its adapters before continuing. It does not identify a frame +type with a physical field. + +`SPECIALIZATION.md` §§1–4 supplies the permitted class: fixed finite +Gaussian-dyadic scalar words, binary monomial address maps with full unit +phases, positive Gaussian children, and the retained owner/restoration +interface. Its scope includes arbitrary nested source frames. This is a +positive implementation theorem for a fixed catalogue under retained +physical hypotheses, not permission for an arbitrary RAM permutation. + +Here is the precise conclusion proved below. Let the source word's signed +native factors and complete endpoint be interpreted under that grammar, +including the already stated ideal owned resets. Apply the ordinary global +normalizer lowering and owned-rise contract established separately in the +source-pinned companion results. Then its literal caller lowers to a finite +mixed unit on ambient rank 153 with 21,422 distinct arbitrary productive +fields and 119,872 chronological paid positions. Every target and every paid +position has a permitted full-field positive-job normal form. The caller's +two-chain origin and repeated frame types impose no additional compiler +axiom. After its actual chronological product, paid completion and splitting, +the finite integer compiler applies using the **actual ambient cap**, with +fresh finite constants. + +The local direction/current-content part of owned ascent is supplied by the +published companion at fork commit +`11aa5341e740a8d9dd14ab54437a45840686e991`; the global-LAMBDA macro is supplied +at `5cca8d4442d434a873ef905ffdea4b80bf9f2e34`. Their proofs preserve the same +physical and restoration assumptions. This note does not enlarge either +claim into a proof of those assumptions. + +## 2. Lower one HOST2 into actual fields and actual paid positions + +At each of the18 HOST2 events, for every one of 104 source ports, map the four +native mains injectively to the four named caller fields. The native X and +X2 may have the same input/output frame labels, as may Y and Y2. Their +physical tags are nevertheless distinct. Map each of the959 other native +public fields to its own fresh `(call, helper)` field, and map each owned +label to the creating native occurrence's owned bank. This is an explicit +map of 1375 public slots, not a map of frame classes. + +Run the **single complete shared native word once**. Every one of its6440 +MOVE events becomes its own paid request at its original chronological +position on its actual current owner. Each request retains the exact source +and destination chart, sign/phase convention, and ownership class. Equal +ranks, equal charts, equal times or equal current values do not merge two +requests. Nor are the two planes charged as two independent native copies: +the source is one specified multiarray algorithm, with one actual shared +helper field and one target credit for that field. + +The source's normalized endpoint is the direct sum of + +\[ + (X,Y)\mapsto(X,Y+X),\qquad + (X_2,Y_2)\mapsto(X_2-Y_2,Y_2), +\] + +autonomous helper identities, and zero owned final rows. Conjugating each +stream by its current exact chart proves the ordinary scalar endpoint on +arbitrary full arrays. A MOVE from U to V is the actual operator +`T_V T_U^-1`; it preserves the normalized value. Common-chart ADD/SCALEs +have their literal exterior coefficients. Those coefficients are not raised +to a tensor multiplicity. + +The source-specific scan verifies current charts and ownership throughout +all 38,334 events,54 owned lifetimes and peak30. A separate lead-written +reverse functional implementation checks all 1,890,625 public endpoint +coefficients. COPY is checked as ADD into a statically zero owned field in +the ideal algebra. Numerical dirty residuals still propagate as ADD errors; +later erasure cannot remove their earlier effect on another output. + +Helpers can interact with both planes internally because the verified +completed endpoint is autonomous on every arbitrary helper input. This is +exactly the multiarray contract that the compiler accepts. It does not +require independent intermediate values, and it never duplicates an input +to manufacture another productive field. + +## 3. Complete endpoints and canonical whole jobs + +At width f, use `Gamma_U=T_U^(tensor f)`, with arbitrary complete spectators. +The source factorization of each exact chart transition has form +`T_V T_U^-1=L C_r R`, including absolute phases. Tensoring the **product** +gives `L_f C_(r*f) R_f`; a monomial phase `i^a` becomes `i^(a*f)`. +The ordinary scalar role word remains unchanged. This establishes the +all-width native implication without distributing tensor power over sums. + +This universal algebraic statement does not enlarge the physical tariff's +domain. The retained complete compact-control reservations, `f<=p`, address +descriptor bound `O(p)` and superpolynomial record fiber still apply. Within +the eventual layer, every instantiated column width is bounded by its full +active width; fixed expanded dimensions change constants and thresholds. + +Only after the complete native call, normalize a helper's exact endpoint +`L C_r R`: feed its arbitrary canonical input through `R^-1`, and apply +`L^-1` to its output. These two-sided adapters need not be an inverse pair. +They surround the entire call, preserving the source's internal ADD charts. +All helpers are allocated once and both wrappers are charged. + +The retained main contact maps give, at each port, the actual operators +`D_s [[1,0],[Q^-1,1]]` and `D_s [[1,-Q],[0,1]]`. Here `Q=C_q^(tensor f)` +and `D_s` is the positive transform on the stage's eight fresh axis blocks. +The unchanged caller has an exact diagonal endpoint in +`Q(i)[q,D1,...,D18]/(q^4-1)`. The lead's reverse implementation checks all 1600 +coefficients in that polynomial ring, with free stage variables and a proven +packing bound. Substitution is valid for every f: the stage transforms commute +and `Q^4=I`. No finite random assignment is used for this acceptance check. + +Consequently each main field's completed job is `Q^e` times a product of +distinct stage transforms, where `e` is −1,0 or1. The retained literal port +basis `[q,q_perp_1,...,q_perp_8]` is orthonormal; its binary coordinate map +and fixed selected-axis permutations give a canonical positive job. If +`e=-1`, retain the exact translation `Q^2` because `Q^-1=Q^2 Q`. +Both whole-job boundaries are charged, even where an external interface could +keep one implicit. Every leftover coordinate is a complete spectator. + +IDLE_ONE is a single paid positive job on the union of its distinct stage +axes, on its stated owner. A QUERY copies into the separate owned query bank, +executes one signed rank-one job with its two coordinate maps and, if needed, +translation, adds to its destination and clears. It creates no target credit. +The global LAMBDA is ordinary work by the companion lowering: +`(1+s*i)/2 I+(1-s*i)/2 X_(q,...,q)`. All124×104 translations are charged, +and their macro completes before another caller event uses the bank. + +These constructions produce **4160 main fields plus 18×959 helpers**, each +with one positive target. The complete paid list has 18×6440 native requests, +32×104 whole idles and 6×104 queries. Their histograms, chronological digests +and actual owners are recorded in `RESULT.json`. Target rank mass317648 +minus paid rank mass316128 is 1520. A frame-labelled main alias, a reused +helper, missing/doubled paid positions and a same-rank order swap all fail +the signature checker. + +At this point the root's reducibility has been eliminated as an interface +question by construction. The compiler consumes the actual whole-word +endpoint and ordered requests just established. It has no root matrix or +Gram graph input. This conclusion relies on the direct caller identity; it +does not infer correctness from a root's rank or connectedness alone. + +## 4. Product construction with an independent ambient cap + +The retained product note specializes to units whose ambient rank equals +their maximum productive rank. The following slightly more general statement +is needed here and follows constructively from its algorithm. + +Let U,V have ambient caps A_U,A_V, containing every target and paid selected +axis set. At paid position l of U, instantiate U for each productive role j +of V at column count h_j. That instance uses ambient `A_U*h_j<=A_U*A_V`. +Suspend all such copies at the common position l, and invoke V at column +count r_l on their distinct actual owners. It uses ambient +`A_V*r_l<=A_U*A_V`. Whole-job adapters place the requested rank `r_l*h_j` +jobs on the proper coordinate sets; all unused coordinates remain complete +spectators. V and its adapters finish before any parent resumes. + +Thus the physical product fits ambient cap `A_U*A_V`, with targets `k_i*h_j` +and paid ranks `r_l*s_a`. The maximum target need not equal the ambient cap. +The moments still multiply, every productive field has its distinct pair +label `(i,j)`, and all owned banks have separate occurrence tags. No equality +`A_U=max k_i` or `A_V=max h_j` was used in this construction. Only the +displayed containment inequalities were needed. + +For v raw copies here, the correct conservative ambient is **153^v**, while +the maximum target is **145^v**. The source's primitive coordinates really +use9+18×8=153 axes. Rank145 is therefore not, by itself, a certificate of +145-axis working geometry. A smaller geometry might exist, but it would +require its own full adapter and internal-support construction. + +## 5. Strictification comes before the separated integer compiler + +The raw source has minimum target1 and maximum paid rank 64. It fails the +strict separation hypothesis. Theorem 1G must not be applied directly. + +Use the retained higher-moment construction at the source tested saving +`C=0.00351406007`, `t=1-C`, with cutoff base11, completion base12, +higher offset1/7 and power 1920. The authenticated rational engine checks + +\[ + \alpha=P_t/T_t<1-10^{-27},\quad + \gamma=P_{t+1/7}/(11^{1/7}T_t)<31/32,\quad + \delta=12B/(11^C T_t)<31/32. +\] + +After the chronological product, complete every target K below 12^1920 on +`12^1920-K` disjoint axes of that same owner. Split every paid job into +blocks of size at most11^1920. Whole-job wrappers stay around the complete +replacement. This fits ambient153^1920 and creates no new productive field. +The complete paid moment is bounded by + +\[ + \alpha^{1920}+2\gamma^{1920}+2\delta^{1920} + <{1\over1+1920\cdot10^{-27}}+4(31/32)^{1920}<1. +\] + +The finite separated unit therefore has `k_min=12^1920`, +`r_max<=11^1920`, maximum target145^1920, and actual ambient cap 153^1920. +All additional paid completions and split calls remain in the word. + +## 6. Ambient-cap version of the exact finite flow + +Let a separated mixed unit have targets k with multiplicities W_k, paid +ranks r_j, and a fixed integer ambient cap A at least every target and paid +rank. Assume its whole-job and owner contracts as above. In the exact flow +of `FINITE-PRECOMPILATION.md` §§3–5, replace the truncation by + +\[ + A\rho_s c(a)\le N, + \qquad c(a)=\prod_k k^{a_k},\qquad + u(a)={|a|!\over\prod a_k!}\prod_k W_k^{a_k}. +\] + +Take G to be the greatest |a| with `A*c(a)<=N`; use the ordinary sequential +program for NN`. +Its source rank is `s0=k*rho_child*c(b)>r_j*N/A>=N/A`. +It is at most N because `k<=A` and the child unit itself satisfies the +ambient truncation. Root-class sources also exceed N/A: otherwise adding +one target factor would contradict the maximality of G. Hence +`N/A1/A`, concavity gives + +\[ + 1-(1-y)^t\ge ty\ge \eta y^t, + \qquad\eta=tA^{t-1}. +\] + +Thus every step of the retained leaf-count induction holds with the ambient +cap A. The logarithmic majorant from `STRICTIFICATION.md` §4 becomes + +\[ + L(N)\le N^t(1+\log_2N)^p +\] + +provided `theta0, U_N the number of unit instances in the unreplicated finite flow, and `(label,e,t)` the ordered exit batches. Labels include paid **positions**, so repeated equal paid ranks remain separate rounds. Every nonzero complement q=N-s and every exit e is strictly between 0 and N. The base programs at 1<=n0}, m=max{k:W_k>0}, W=sum_k W_k and J=number of ordered paid positions. Assume m>=k_min>=2 and 1<=r_j=m, let G=floor(log_{k_min}(N/m)), computed by integer multiplication if evaluated. For a paid-position path p of length d, rho_p is the product of its paid ranks. For each multi-index a with |a|=G-d and m*rho_p*c(a)<=N, put + +``` +c(a) = product_k k^a_k, +u(a) = (|a|! / product_k a_k!) product_k W_k^a_k. +``` + +There are u(a) units in that class. A target role of rank k*rho_p*c(a) is a source exactly when p is empty or + +``` +m * (rho_p/r_last) * c(a) * k > N. +``` + +Otherwise the corresponding parent multi-index a+e_k is present and the Pascal bijection consumes all W_k*u(a) such roles. This is the precise missing-demand condition used by the verifier. Its independent literal construction represents each unit by a word of target **roles**, matches each eligible parent word to `(first role, suffix)` in the next class, and rejects any unconsumed parent demand. Distinct roles retain W_k multiplicity. + +At depth G there is just a=0, u(a)=1. Every one of the J^G deepest classes is present because m*r_max^G<=m*k_min^G<=N. Thus each of its J paid rounds is a separate exit batch with t=1. In particular all J^(G+1) labels are retained even if their product ranks agree. In this exact unsplit Section-3 flow, the exit factors in a_N are therefore B_e themselves; the gcd improvement can only arise from source-complement multiplicities. The more general batchwise statement above also applies if a valid upstream flow supplies larger individual exit batches, but does not authorize merging them. + +The code implements this source formula and compares it with the independently enumerated role-word construction for N=4,...,25. These fixtures support the implementation; the all-N statements depend on the source hypotheses and the argument above, not extrapolation from the fixture range. + +## 3. Bit bounds without materializing the word + +Let b_n=ceil(log2 B_n), o_n=ceil(log2(O_n+1)), both zero in the base range. The number of bits in B_n or O_n+1 is at most the corresponding bound plus one. Because a_N divides the uniform lcm and that lcm divides the product over **distinct child ranks**, + +``` +b_N <= ceil(log2 S_N) + sum_{q in D_N} b_q. +``` + +Let H_N=sum_{(q,t) in R_N} t. Since B_q>=1 and a_N>=1, the O recurrence gives + +``` +O_N+1 <= a_N (U_N+H_N+1) max_{q in D_N}(O_q+1), +o_N <= sum_{q in D_N} b_q + + ceil(log2(U_N+H_N+1)) + max_{q in D_N} o_q. +``` + +Take the maximum over an empty child set to be zero in the logarithmic formula. These provide direct recursive upper bounds using only the finite flow and smaller bounds, even when exact B_N or O_N are too large to emit. + +For a closed bound at an arbitrary finite N, put K=max(W,J) and + +``` +G_N = floor(log_{k_min}(N/m)), +C_N = ceil(log2 W) + ceil(log2(G_N+1)) + G_N ceil(log2 K), +D_N^* = 1 + ceil(log2(2+W+J)) + ceil(log2(G_N+1)) + + G_N ceil(log2 K). +``` + +Here D_N^* is a scalar bound, distinct from the child-rank set D_N. At depth d, deleting eligibility constraints bounds the total units by J^d W^(G_N-d), so U_N<=(G_N+1)K^G_N. There are at most W targets per unit and exactly J^(G_N+1) exits. Therefore S_N<=W U_N, H_N<=S_N+J^(G_N+1), and + +``` +ceil(log2 S_N) <= C_N, +ceil(log2(U_N+H_N+1)) <= D_N^*. +``` + +Both constants are nondecreasing in N. Since every child rank q25 before flow construction. It is not a general untrusted-input compiler; the recorded targets and paid list are small pinned constants. No giant N, compiled word, physical array or native product is materialized. diff --git a/research/ambient-rank-library/reference/width-bound-README.md b/research/ambient-rank-library/reference/width-bound-README.md new file mode 100644 index 0000000000..7548fd2060 --- /dev/null +++ b/research/ambient-rank-library/reference/width-bound-README.md @@ -0,0 +1,407 @@ +# A quasipolynomial width bound for chronological batching + +**Result: for a fixed default-height mixed rule, the least per-cut widths of +[#4507](https://github.com/CrocSwap/integer-mult-bounds/pull/4507) satisfy** + +\[ +\log B_N=O((\log N)^{d+1}), +\] + +where `d` is the number of distinct primes dividing the target and paid +ranks. Equivalently, `B_N = exp(O((log N)^(d+1)))`. This sharpens the +default-height bound `log B_N = O((1+log N)^(d+2))` already proved in +[#4586](https://github.com/CrocSwap/integer-mult-bounds/pull/4586) at +`aadb7bc59390683450b1969e4632f546929dc569`: bounded visits to each +source-count plateau remove one logarithmic factor. It sharpens the answer +to the all-rank width question in [Discussion #4503](https://github.com/CrocSwap/integer-mult-bounds/discussions/4503) +without changing the normalized leaf cost. It is an upper bound, not a +tight growth law or a practical size estimate. + +The proof is a prime-valuation argument over contracting rank chains. +Finite replays below exercise its hypotheses; they are not the proof of +an asymptotic claim. **No new κ, convergence theorem, physical supplier +admission or selected-frontier change is claimed.** + +This is one contribution with two separately replayable packages. This +package retains the default-height proof and witnesses; the companion +[adaptive package](../adaptive-chronological-batching/README.md) proves +arbitrary-height cut transfer and its conditional all-rank width bound. +Neither package is a second batching algorithm or a separate submission. + +## 1. Exact boundary and predecessor delta + +Let a fixed native rule have target multiplicities `W_k > 0` and paid +multiplicities `P_r > 0`, with + +```text +2 <= k_min <= k <= m = max target rank, +1 <= r <= r_max < m, +W = sum_k W_k, P = sum_r P_r. +``` + +The multiplicities are positive integers. `P` counts paid positions, not +just distinct paid ranks. At rank `n >= m`, use precisely #4436's default +height + +```text +C_n = floor(n/m), +G_n = floor(log_(k_min) C_n). +``` + +Use ordinary base widths `B_j = 1` for `0 <= j < m`. For every larger +rank, #4507's policy groups all source complements upfront, and groups +unmatched exits at one paid position of one chronological path class. +Repeated paths and paid positions remain separate cuts. If its source +count is `S_n` and its rank/count batches are `(e,q)`, its least replication +factor and width are + +```text +a_n = lcm_(e,q) B_e / gcd(B_e,q), +B_n = S_n * a_n. +``` + +Every parent waits for its exits and child before resuming. There is no +cross-cut pooling or fractional invocation. The correctness and minimality +of that policy are Mihir Srivastava's #4507 result; the integer flow is +zxv's #4436, building on Jacob Alan Sussman's compiler. This package adds +a **uniform growth bound for their width sequence**, not a new batching +algorithm. #4519 separately recomputes the predecessor's finite numbers. +[#4588](https://github.com/CrocSwap/integer-mult-bounds/pull/4588) at +`2f6578907b7f8718a13921552cc3069d3908e936` adds independent finite +default-height checks, not the new `d+1` proof. + +The fixed native word's arbitrary-input/all-column correctness, whole-job +adapters, owned state and physical execution contracts remain premises. +The theorem below is also a statement about an integer recurrence without +those physical premises. Positive rank surplus is not needed for the +width bound itself; resource consequences using surplus are conditional +on it, as in #4436. + +**Specialization and nonemptiness.** The default root has a unit because +`k_min^G <= C`; no paid rank-one position is required. The companion +[WIDTH.md](../adaptive-chronological-batching/WIDTH.md) assumes paid rank +one as a sufficient nonemptiness condition for arbitrary heights. At +`M=k_min, g=1` its symbolic formula gives `d'=d, z=0` and the same `d+1` +order on their common hypotheses. Its named adaptive height interface uses +positive `a,b` with `g=a+b>=2`, so that route does not exercise `g=1`. +The default plateau-product divisor here and the companion level-LCM +divisor are different certificates; no universal finite numerical dominance +is claimed. [#4591](https://github.com/CrocSwap/integer-mult-bounds/pull/4591) +at `84c0fb3a39bcb1e4b8c48892bfdd8a6e7ae58a50` checks arbitrary-height +aggregate identities, not the actual cut divisibility proved by the companion. + +## 2. Source-count plateaus + +Let `Γ` be the multiplicative semigroup generated by all target and paid +ranks, including `1`. Let `Π` be their prime support and `d = |Π|`. For a +positive integer cap `C`, the entire default flow depends only on + +```text +{ gamma in Γ : gamma <= C }. +``` + +To see this, the target-word counts at each degree are fixed integer +coefficients. The cap only tests target products, paid path products, +their products, and the powers of `k_min` determining the height. Every +threshold is in `Γ`. The child demand uses a target word with one factor +removed, then its paid-prefix product; this is still in `Γ`. Path +multiplicities and repeated paid positions do not introduce new threshold +values. Consequently sources, exits, cuts (including their repetition +counts), and `S` are constant between consecutive elements of `Γ`. + +Write `S(γ)` for the source count on the plateau starting at `γ`, and +`γ+` for the next semigroup element. Since `k_min * γ` is in `Γ`, + +```text +γ+ <= k_min * γ. +``` + +The plateaus need not have distinct source counts. Counting them rather +than deduplicating equal counts is safe. For `X >= 1`, + +\[ +|\Gamma\cap[1,X]| +\le \prod_{p\in\Pi}(1+\lfloor\log_p X\rfloor) +\le (1+\lfloor\log_2 X\rfloor)^d. +\] + +This is just the exponent box containing every `Π`-smooth product. The +box can contain numbers not in `Γ`; only an upper bound is used. + +At depth `h`, there are at most `P^h` paid paths and `W^(G-h)` units per +path. Thus, including degree zero, + +\[ +U\le\sum_{h=0}^G P^hW^{G-h}\le(W+P)^G, +\qquad 1\le S\le WU\le W(W+P)^G. +\] + +The middle inequality follows from the binomial expansion, whose +coefficients are at least one. A root unit with product `k_min^G <= C` +always exists; its target demands also give `S >= W`. + +## 3. Every recursive rank contracts + +Every source has rank `s > n/m`. A root source has target degree `G+1`, +so its product is at least `k_min^(G+1) > C_n`; integrality gives +`s >= C_n+1 > n/m`. A nonroot source comes from an absent parent point. +That parent's integer product exceeds `C_n`; multiplying by a paid rank +at least one retains the strict lower bound. Every source fits `n`, since +it is the target of an eligible native unit. + +Therefore a complement rank satisfies + +```text +0 <= n-s < (m-1)n/m. +``` + +An exit is a rank-`r` job from a unit of column at most `C_n`, hence + +```text +0 < e <= r_max * C_n <= (m-1)n/m < n. +``` + +Set `α = (m-1)/m < 1`. Every recursive edge has rank at most `α` times +its parent's rank. This specific fact is why the default-height boundary +matters. It is not inferred merely from strict descent. + +## 4. Prime valuations follow a contracting chain + +Fix any prime `p`, not necessarily a prime dividing a native rank. For a +batch `(e,q)`, + +```text +v_p(B_e/gcd(B_e,q)) <= v_p(B_e). +``` + +Since the valuation of an LCM is the maximum, + +\[ +v_p(B_n)\le v_p(S_n)+\max_{e\text{ invoked at }n}v_p(B_e). +\] + +Strong induction bounds this by the largest sum of source-count valuations +along a recursive rank chain ending below `m`. The maximizing chain may +be different for each prime; the next bound holds for **every** chain. +No joint choice of a maximizing chain is assumed. + +Put + +```text +τ = m * ceil(log2 k_min). +``` + +Bernoulli's inequality gives + +\[ +(m/(m-1))^m=(1+1/(m-1))^m +\ge1+m/(m-1)>2, +\] + +so `α^m < 1/2`, and `α^τ < 1/k_min`. A descending chain can visit a +single cap plateau at most `τ` times. Otherwise, let its first and +`τ`-steps-later ranks be `n_i` and `n_(i+τ)` in the same plateau `γ`. +The cap condition gives `mγ <= n_(i+τ)` and `n_i < mγ+`, while + +\[ +n_{i+\tau}\le\alpha^\tau n_i +< m\gamma^+/k_{\min}\le m\gamma, +\] + +contradiction. Caps never increase, so visits to one plateau are +contiguous. + +It follows for **every prime** that + +\[ +v_p(B_n)\le\tau\sum_{\gamma\in\Gamma,\ \gamma\le\lfloor N/m\rfloor} +v_p(S(\gamma)),\qquad n\le N. +\] + +Hence the explicit integer divisibility certificate is + +\[ +\boxed{\quad B_n\mid Q_N:= +\prod_{\gamma\in\Gamma,\ \gamma\le\lfloor N/m\rfloor}S(\gamma)^\tau, +\quad 0\le n\le N.\quad} +\] + +Repeated equal `S(γ)` values intentionally retain one factor per plateau. +Their prime factors need not lie in `Π`; `Π` bounds plateau **locations**, +not the prime support of the widths. + +## 5. Uniform logarithmic bound and consequence + +Let `C = floor(N/m)` and `G = floor(log_(k_min) C)` for `N >= m`. +Combining the preceding bounds yields + +\[ +\log_2 B_N\le +\tau\prod_{p\in\Pi}(1+\lfloor\log_p C\rfloor) +\bigl(\log_2 W+G\log_2(W+P)\bigr). +\] + +Replacing each logarithm on the right by its integer ceiling produces the +explicit bit envelope checked by `verify.py`. All parameters of the +native rule are fixed, so the right-hand side is +`O((log N)^(d+1))`. This proves the stated result for all ranks. + +The proof does not need the gcd savings: the same upper bound applies +when replication is the LCM of the invoked child widths without dividing +by batch counts. The structural improvement over #4436's nested choice +comes from using **only actually invoked, contracting ranks**, rather +than insisting that `B_(n-1)` divide each replication factor. + +When `W >= 2`, the old nested policy has +`B_N(old) = product_(n=m..N) S_n >= W^(N-m+1)`, an exponential lower bound. +The quasipolynomial upper bound is therefore an asymptotic width +improvement in that case. This does not say that the new upper bound is +tight. In the degenerate rule `{2:1} <- {1:1}`, both widths stay one. + +The normalized leaf recurrence is unchanged by valid replication, + +```text +L(n) = [sum_s S_s L(n-s) + sum_e E_e L(e)] / S_n. +``` + +Thus no saving exponent improves merely from this theorem. Where a +positive rank surplus `Δ` and the source native contracts apply, #4436's +identity `B_N*N - P_N = Δ*Qcol_N` also gives the same quasipolynomial +upper order for its raw-instance and owned-center counts. No unpriced +router, full fixed-tape constant or eventual multiplication threshold is +included in that consequence. + +## 6. Executed evidence + +Python 3.12.14, standard library, Linux. The direct isolated-Python +receipt-generation command completed in about four seconds in the author environment. +The receipt records five fixtures and **102,215 chronological batch +constraints**, with two source representations compared at every cap. + +| Fixed rule | N | Rank-prime count | Plateaus | Least width bits | Nested width bits | `Q_N` bits | +| --- | ---: | ---: | ---: | ---: | ---: | ---: | +| `{2:1,5:1} <- {1:2,4:1}` | 1000 | 2 | 19 | 136 | 8940 | 664 | +| `{2:4,3:1} <- {1:6,2:2}` | 1000 | 2 | 30 | 285 | 18105 | 1283 | +| `{2:1,4:1,8:1} <- {1:2,3:1,7:1}` | 300 | 3 | 18 | 153 | 2195 | 962 | +| Frozen raw p7 | 1000 | 7 | 8 | 2524 | 17504 | 59923 | +| `{2:1} <- {1:1}` | 100 | 1 | 6 | 1 | 1 | 1 | + +The raw-p7 finite width comparison is predecessor evidence reproduced here, +not a new finite improvement. Its conservative `Q_N` is larger than the +nested width at this small rank. A better asymptotic upper order does not +imply a numerically smaller bound at every finite rank. +The raw histograms here come from +`higher-moment-strictification/RESULT.json:invoice_oracle`. A separate exact +comparison found both target and paid histograms equal to #4507's vendored +`p7-RESULT.json:strictification.native_inventory` (7,688 targets and 55,998 +paid positions). That source-equivalence comparison is author-run evidence, +not an additional gate in this package's registered replay. + +New checks include full flow/cut plateau signatures, exponent-box counts, +source bounds, every child contraction, chain-depth and per-plateau-visit +dynamic programs, eleven explicit prime-valuation recurrences, and exact +**all-prime integer divisibility** for every computed width. The eleven +sampled valuations are diagnostics only; they are not substituted for the +all-prime divisibility check or the quantified proof. + +Four boundary controls are exercised: + +1. Omitting paid-rank generator `3` from `{2,5} <- {1,3}` misses the real + cap-3 change, where source count increases from 3 to 4. +2. Changing the height base to `5` at `n=50` introduces root source rank + `4 <= n/m=10`, invalidating the source lower bound used here. +3. The retained rank-12 pooled multiplier `175` fails the separate + one-job rank-8 cuts; the chronological multiplier is `700`. +4. Erasing prime `5` from the proposed divisor fails the actual rank-3 + width `5`, even if other-prime checks are retained. + +`verify.py` authenticates all live inputs before loading two predecessor +implementations. It **does not claim an independently written width +compiler**: #4507's compiler produces the widths, #4436's exponent-vector +flow cross-checks its source census, and the new checks certify the stated +bounds on those outputs. Cut correctness is inherited from #4507's literal +fixtures; this package does not replay that independent cut oracle. The +normalized-cost gate is the retained compiler's exact cross-product equality +between least-batch and nested leaf totals at every rank, not a separately +implemented rational recurrence. The symbolic proof is complete above. +Separate Anthropic-model review challenged it and supplied the sharper +bounded plateau-visit argument; that is not human or proof-kernel verification. + +## 7. Reproduction and coordination + +From the repository root: + +```sh +python3.12 -B scripts/research_package.py --package research/chronological-width-bound --check-only +python3.12 -B scripts/research_package.py --package research/chronological-width-bound +python3.12 -I -O -B research/chronological-width-bound/verify.py +``` + +The other scoped replay in the same PR is: + +```sh +python3.12 -B scripts/research_package.py --package research/adaptive-chronological-batching +``` + +`--write` regenerates only this package's `RESULT.json`. Source pins are in +`SOURCES.json`; the historical task card and selected record remain +provenance, not moving scientific inputs. Reproduction requires Python 3.12 +and the standard library; no Nix or direnv environment is required. + +Historical base: canonical main `f9f85c1e4fa1e955ff39f10fca447e3e2a4e4adc`, +priority revision 7. The historical selected record was `23/10000`; those +bytes and the task card remain provenance. The consolidation comparison +uses fetched main `fbc9ea0249746acca4f504d4fda2b84e0e36cf0d`, whose selected +conditional κ is `.00302015` from #4470; #4483 and #4507 are not selected. +No selected record is edited. Scope is explicitly **changed** from +`independent-moment` invoice coverage to #4507's open all-rank width question. + +The historical theorem-specific refresh at 2026-10-22 04:01 UTC searched +5,860 tracked local note paths, 317 open PRs and 3,412 Discussion records +with complete reported pagination, but no fresh closed-PR scan or diffs. +The consolidation refresh on the same date covered 408 open PRs at +13:08:38 UTC, 3,852 closed PRs at 13:09:39 UTC and 3,577 Discussion records +at 13:09:11 UTC, with complete reported pagination. It is a non-atomic +snapshot, not exhaustive novelty proof. Actual #4586/#4588/#4591 proofs +and code determine the scoped delta above. #4519's finite recount and +#4521's expanded-count audit remain complementary. + +Discussion posting returned HTTP 403, so this evidence remains +**LOCAL-ONLY until publication approval**. No public reservation or +result is claimed. The historical baseline fails on the new certificate's +missing `bit_lower`; the #4463 successor +`python3 -B scripts/research_selected_baseline.py` passed source-bound +orientation. No selected cold replay was run. + +## Open next questions + +1. **Can the logarithmic degree or constants be sharpened?** The prime-box + count ignores dependencies among generator exponent vectors. A first + step is to replace it by a rigorously bounded exponent lattice of lower + rank. The present argument supplies no tight lower bound for `B_N`. +2. **How can the adaptive envelope be sharpened?** The companion + [WIDTH.md](../adaptive-chronological-batching/WIDTH.md) now supplies a + root/decrement and level-visit argument for fixed adaptive parameters. + A next step is to retain actual gcd savings or narrower semigroup counts. + The rank-4 source control above still blocks copying the default + fixed-contraction proof unchanged to arbitrary heights. +3. **Which physical constants inherit the improved width?** Substitute + the bound into one actual emitted compiler's owned-state and routing + ledger, preserving encoded addresses and all temporary stock. Physical + realization and the retained analytic/precision/recovery contracts have + not been re-proved here. + +## Attribution + +Jacob Alan Sussman: multinomial integer compiler and Theorem 1G. +zxv: #4436's chronological overlapping flow and resource accounting, on +#4359 and the retained native/outer lineage. Mihir Srivastava / mihir-s-05: +#4507's least per-cut replication policy, finite width witnesses and +explicit all-rank handoff. Ryanson Jonathan / pinterbanget: #4456/#4476 +flow and width audits, and #4519's separate recount. Cinna Davis / +1337isnot1337: raw-p7 construction and inherited native lineage. + +Prepared for **codyw912**, with substantial OpenAI assistance in theorem, +implementation and writing, and separate Anthropic-model mathematical +challenge. Retained scientific sources keep their own notices. New work +is Apache-2.0. No independent human or formal-kernel acceptance is claimed. diff --git a/research/ambient-rank-library/verify.py b/research/ambient-rank-library/verify.py new file mode 100644 index 0000000000..2362bd3af6 --- /dev/null +++ b/research/ambient-rank-library/verify.py @@ -0,0 +1,277 @@ +"""Bounded exact replay, separate occurrence oracle, and semantic controls. + +Default operation is read-only and compares the computed receipt. Apache-2.0. +Prepared for CubeJerry with substantial OpenAI assistance. +""" +import argparse +from bisect import bisect_right +import hashlib +import importlib.util +import json +from math import gcd, lcm +from pathlib import Path +import sys +import types + +ROOT = Path(__file__).resolve().parent + + +def require(ok, message): + if not ok: + raise ValueError(message) + + +def load_module(name, path): + spec = importlib.util.spec_from_file_location(name, path) + module = importlib.util.module_from_spec(spec) + sys.modules[name] = module + spec.loader.exec_module(module) + return module + + +def authenticated_sources(): + sources = json.loads((ROOT / "SOURCES.json").read_text()) + checked = [] + for row in sources["files"]: + if "local" not in row: + continue + raw = (ROOT / row["local"]).read_bytes() + digest = hashlib.sha256(raw).hexdigest() + blob = hashlib.sha1(b"blob " + str(len(raw)).encode() + b"\0" + raw).hexdigest() + require(digest == row["sha256"] and blob == row["git_blob"], "source drift " + row["local"]) + checked.append({"local": row["local"], "sha256": digest, "bytes": len(raw)}) + require(len(checked) >= 6, "frozen source inventory incomplete") + return checked + + +def row_tuple(row): + return row.replication, row.width, row.leaves, row.units + + +def compare(subject, oracle, case, digest): + ambient, targets, paid, maximum = case + rule = subject.Rule(ambient, targets, paid) + library = subject.compile_library(rule, maximum) + literal = oracle.explicit_library(ambient, targets, paid, maximum) + work = subject.Work() + g = subject.height(rule, maximum) + targets_table = subject.product_tables(targets, g, subject.Limits(), work) + paid_table = subject.product_tables(paid, g + 1, subject.Limits(), work) + for rank in range(1, maximum + 1): + actual = row_tuple(library.rows[rank]) + require(actual == literal["rows"][rank], "independent row mismatch") + digest.update(json.dumps([case, rank, actual], separators=(",", ":")).encode()) + if rank < ambient: + continue + flow = subject.census(rule, rank, targets_table, paid_table, subject.Limits(), work) + other = literal["flows"][rank] + require((flow.height, flow.units, flow.sources, flow.exits) == + (other["height"], other["units"], other["sources"], other["exits"]), + "independent occurrence census mismatch") + envelope = subject.envelope(rule, maximum) + generators = {r for alphabet in (targets, paid) for r, _ in alphabet if r >= 2} + gamma = oracle.semigroup(generators, maximum // ambient) + require(len(gamma) <= envelope["plateau_count_bound"], "semigroup box failure") + divisor = 1 + for location in gamma: + source_count = sum(c for _, c in literal["flows"][ambient * location]["sources"]) + divisor *= source_count ** envelope["plateau_visit_bound"] + require(divisor <= 1 << envelope["width_log_bound"], "divisor envelope failure") + depth, runs, labels = [0] * (maximum + 1), [0] * (maximum + 1), [None] * (maximum + 1) + for rank, row in enumerate(library.rows[1:], 1): + require(divisor % row.width == 0, "all-prime divisor failure") + require(sum(row_tuple(row)[1:]).bit_length() <= envelope["combined_output_bits"], + "expanded output bit envelope failure") + require(max(abs(x).bit_length() for x in row_tuple(row)) <= envelope["Z"], "record bit cap") + if rank < ambient: + continue + flow = literal["flows"][rank] + label = gamma[bisect_right(gamma, rank // ambient) - 1] + labels[rank] = label + reference = literal["flows"][ambient * label] + require(flow == reference, "full literal plateau signature changed") + children = [rank - s for s, _ in flow["sources"] if s < rank] + children += [e for _, e in flow["cuts"]] + require(all(0 < e < rank and ambient * e <= (ambient - 1) * rank for e in children), + "contracting child failure") + depth[rank] = 1 + max(depth[e] for e in children) + runs[rank] = 1 + max(runs[e] if labels[e] == label else 0 for e in children) + require(depth[rank] <= envelope["D"] and runs[rank] <= envelope["plateau_visit_bound"], + "chain depth or plateau visit failure") + return {"ambient": ambient, "targets": targets, "paid": paid, "maximum": maximum, + "ranks": maximum, "literal_units": literal["units"], "literal_cuts": literal["cuts"], + "constraints": literal["constraints"], "plateaus": len(gamma), + "divisor_bits": divisor.bit_length(), "max_depth": max(depth), + "max_plateau_visits": max(runs), + "max_width_bits": max(row.width.bit_length() for row in library.rows[1:])} + + +def rejects(label, action): + try: + action() + except (ValueError, IndexError): + return label + raise ValueError("negative control escaped: " + label) + + +def mutant(label, old, new): + source = (ROOT / "ambient_library.py").read_text() + require(source.count(old) == 1, "mutation anchor not unique: " + label) + module = types.ModuleType("mutant_" + label) + sys.modules[module.__name__] = module + exec(compile(source.replace(old, new), "mutant_" + label, "exec"), module.__dict__) + return module + + +def lower_bounds(subject): + totals = [] + for ambient in tuple(range(4, 81)) + (127, 128, 255, 256): + maximum = 2 * ambient - 1 + rule = subject.Rule(ambient, ((2, 1), (3, 1)), ((1, 1),)) + library = subject.compile_library(rule, maximum) + bits = 0 + for rank in range(ambient, maximum + 1): + exponent = (rank - ambient) // 2 + 1 + require(library.rows[rank].width == 1 << exponent, "ambient lower-bound formula") + bits += library.rows[rank].width.bit_length() + expected = ((ambient - 1) ** 2) // 4 + 2 * ambient + require(bits == expected, "ambient aggregate bit formula") + totals.append({"ambient": ambient, "maximum": maximum, "written_width_bits": bits}) + return totals + + +def controls(subject, oracle): + rule = subject.Rule(4, ((3, 2),), ((2, 2),)) + library = subject.compile_library(rule, 12) + work = subject.Work() + target = subject.product_tables(rule.targets, 1, subject.Limits(), work) + paid = subject.product_tables(rule.paid, 2, subject.Limits(), work) + flow = subject.census(rule, 12, target, paid, subject.Limits(), work) + factors = [library.rows[12 - s].width // gcd(library.rows[12 - s].width, c) + for s, c in flow.sources if s < 12] + factors += [library.rows[e].width // gcd(library.rows[e].width, c) for e, c in flow.exits] + pooled = lcm(*factors) + require((flow.sources, flow.exits, library.rows[4].width, library.rows[12].replication, pooled) == + (((9, 4),), ((4, 4),), 2, 2, 1), "ambient pooling witness changed") + result = [rejects("pooled-distinct-exits", lambda: subject.finish_row(flow, library.rows, pooled, subject.Limits()))] + invalid = [ + ("ambient-below-target", lambda: subject.Rule(2, ((3, 1),), ((1, 1),))), + ("unseparated", lambda: subject.Rule(3, ((3, 1),), ((3, 1),))), + ("zero-rank", lambda: subject.compile_library(rule, 0)), + ("rank-capacity", lambda: subject.compile_library(rule, 5000)), + ("ambient-bit-capacity", lambda: subject.compile_library(subject.Rule(1 << 100, ((2, 1),), ((1, 1),)), 1, + subject.Limits(max_bits=32))), + ("rank-zero-child", lambda: subject.child(library.rows, 12, 0)), + ("base-envelope", lambda: subject.envelope(rule, 3)), + ] + result += [rejects(label, action) for label, action in invalid] + changes = [ + ("lost-ambient-height", "threshold = rule.ambient", "threshold = rule.m"), + ("lost-ambient-fit", "rule.ambient * size", "rule.m * size"), + ("wrong-base", "if rank < rule.ambient:\n row", "if rank < rule.m:\n row"), + ("pooled-exit-code", "factor = child(rows, flow.rank, exit_rank).width", + "factor = child(rows, flow.rank, exit_rank).width // gcd(child(rows, flow.rank, exit_rank).width, multiplicity)"), + ("lost-cut-multiplicity", "copies = limits.integer(multiplicity * per_cut)", "copies = per_cut"), + ("lost-complement-gcd", "factor = width // gcd(width, count)", "factor = width"), + ] + case = (4, ((3, 2),), ((2, 2),), 12) + for label, old, new in changes: + changed = mutant(label, old, new) + fixture = ((8, ((3, 1), (5, 1)), ((1, 1), (2, 1)), 40) + if label == "lost-ambient-fit" else case) + result.append(rejects(label, lambda mod=changed, test=fixture: compare(mod, oracle, test, hashlib.sha256()))) + changed = mutant("default-visit-constant", "visits = rule.ambient *", "visits = rule.m *") + bad_rule = changed.Rule(64, ((2, 1), (3, 1)), ((1, 1),)) + bad_bound = changed.envelope(bad_rule, 127)["width_log_bound"] + actual = subject.compile_library(subject.Rule(64, bad_rule.targets, bad_rule.paid), 127).rows[127].width + result.append(rejects("default-visit-constant", lambda: require(actual <= 1 << bad_bound, "false default envelope"))) + require(actual == 1 << 32 and (1 << 3) % actual != 0, "exact failed default divisor") + return {"rejected": result, "pooling": {"ambient": 4, "rank": 12, "exit_rank": 4, + "distinct_cuts": 4, "child_width": 2, "valid_replication": 2, "pooled_replication": 1}, + "false_default_divisor": {"ambient": 64, "rank": 127, "default_Q": 8, + "actual_width": actual, "wrong_beta": bad_bound}} + + +def run(): + sources = authenticated_sources() + subject = load_module("ambient_subject", ROOT / "ambient_library.py") + oracle = load_module("ambient_literal_oracle", ROOT / "literal_oracle.py") + default = load_module("frozen_default_library", ROOT / "inputs/default_library.py") + cases = [ + (2, ((2, 1),), ((1, 2),), 32), + (2, ((2, 1),), ((1, 4),), 40), + (5, ((3, 1), (5, 1)), ((1, 1), (2, 2)), 50), + (8, ((3, 1), (5, 1)), ((1, 1), (2, 2)), 96), + (13, ((2, 2), (3, 1)), ((1, 3),), 104), + (7, ((3, 1), (5, 1)), ((2, 1),), 70), + (11, ((3, 1), (4, 1)), ((2, 2),), 400), + (9, ((3, 1), (4, 2)), ((2, 3),), 300), + (4, ((3, 2),), ((2, 2),), 40), + (32, ((2, 1), (3, 1)), ((1, 1),), 63), + (6, ((2, 1), (4, 1)), ((1, 1),), 48), + (3, ((2, 1), (3, 1)), ((1, 1),), 24), + ] + trace = hashlib.sha256() + results = [compare(subject, oracle, case, trace) for case in cases] + default_ranks = 0 + for ambient, targets, paid, maximum in cases: + if ambient != targets[-1][0]: + continue + current = subject.compile_library(subject.Rule(ambient, targets, paid), maximum) + previous = default.compile_library(default.Rule(targets, paid), maximum) + require(tuple(map(row_tuple, current.rows[1:])) == tuple(map(row_tuple, previous.rows[1:])), + "default specialization regression") + default_ranks += maximum + base = subject.compile_library(subject.Rule(1000, ((3, 1),), ((2, 1),)), 20) + require(tuple(map(row_tuple, base.rows[1:])) == tuple((1, 1, n, 0) for n in range(1, 21)), + "all-base initialization") + lower = lower_bounds(subject) + negative = controls(subject, oracle) + ambient = 153 ** 1920 + huge_rule = subject.Rule(ambient, ((2, 1), (3, 1)), ((1, 1),)) + bounds = subject.envelope(huge_rule, 2 * ambient - 1) + require(bounds["height"] == 0 and bounds["D"] == ambient and + bounds["width_log_bound"] == 8 * ambient, "symbolic huge ambient envelope") + endpoint_length = (ambient + 1) // 2 + 1 + huge = {"ambient_expression": "153**1920", "ambient_bits": ambient.bit_length(), + "ambient_sha256": hashlib.sha256(ambient.to_bytes((ambient.bit_length() + 7) // 8, "big")).hexdigest(), + "maximum_expression": "2*A-1", "maximum_bits": (2 * ambient - 1).bit_length(), + "bound_value_bits": bounds["width_log_bound"].bit_length(), + "endpoint_width_length_encoding_bits": endpoint_length.bit_length(), + "materialized_rows": 0, "scope": "toy histogram bounds only, not selected library"} + science = {name: hashlib.sha256((ROOT / name).read_bytes()).hexdigest() + for name in ("ambient_library.py", "literal_oracle.py", "verify.py", "PROOF.md")} + return {"status": "PASS_AMBIENT_RANK_LIBRARY", "base": "e54523517d0f03e58352e647c403a5af3e525a57", + "selected_kappa": "0.00363005817", "no_new_kappa": True, + "cases": results, "independent_ranks": sum(x["ranks"] for x in results), + "independent_units": sum(x["literal_units"] for x in results), + "independent_cuts": sum(x["literal_cuts"] for x in results), + "independent_constraints": sum(x["constraints"] for x in results), + "default_regression_ranks": default_ranks, "all_base_rows": 20, + "lower_bound_fixtures": lower, "negative_controls": negative, + "large_ambient_bound_only": huge, "trace_sha256": trace.hexdigest(), + "frozen_sources": sources, "scientific_sha256": science} + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("--receipt", type=Path, help="write a new external receipt; refuse existing paths") + args = parser.parse_args() + result = json.loads(json.dumps(run(), sort_keys=True)) + encoded = json.dumps(result, indent=2, sort_keys=True) + "\n" + if args.receipt: + destination = args.receipt.resolve() + require(not destination.is_relative_to(ROOT), "receipt must be external to the package") + with destination.open("x", encoding="utf-8") as output: + output.write(encoded) + else: + expected = json.loads((ROOT / "VALIDATION.json").read_text()) + require(result == expected, "computed receipt differs from committed VALIDATION.json") + print(json.dumps({"status": result["status"], "independent_ranks": result["independent_ranks"], + "independent_cuts": result["independent_cuts"], + "negative_controls": len(result["negative_controls"]["rejected"]), + "trace_sha256": result["trace_sha256"], "no_new_kappa": True}, sort_keys=True)) + + +if __name__ == "__main__": + main()