From ebd6a08ed7d517387794c066490aa02aadcc78d4 Mon Sep 17 00:00:00 2001 From: "Dr. Maksym Kitsera" Date: Sat, 10 Oct 2026 13:01:37 +0200 Subject: [PATCH] Verify conditional 12-helper co-retiming improvement on pinned PR #299 --- research/gen5b-coretime12/NOTICE.md | 30 + research/gen5b-coretime12/PROOF.md | 151 ++ research/gen5b-coretime12/README.md | 108 ++ .../gen5b-coretime12/assembly_arithmetic.py | 108 ++ .../gen5b-coretime12/baseline_arithmetic.py | 126 ++ .../gen5b-coretime12/certificates/banks.json | 42 + .../gen5b-coretime12/certificates/charts.json | 177 ++ .../certificates/finite-bill.json | 73 + .../gen5b-coretime12/certificates/frames.json | 1489 +++++++++++++++++ .../gen5b-coretime12/certificates/local.json | 285 ++++ .../certificates/pricing.json | 710 ++++++++ .../certificates/scalar-transport.json | 321 ++++ .../gen5b-coretime12/certificates/suffix.json | 47 + .../certificates/summary.json | 21 + research/gen5b-coretime12/chart_bounds.py | 130 ++ .../gen5b-coretime12/check_bank_assignment.py | 113 ++ .../gen5b-coretime12/check_complete_suffix.py | 196 +++ research/gen5b-coretime12/check_coretime.py | 173 ++ research/gen5b-coretime12/check_rootcuts.py | 74 + .../gen5b-coretime12/check_suffix_frames.py | 128 ++ research/gen5b-coretime12/exact_geometry.py | 57 + research/gen5b-coretime12/exact_intervals.py | 77 + research/gen5b-coretime12/fetch_inputs.py | 34 + research/gen5b-coretime12/finite_bill.py | 72 + research/gen5b-coretime12/inputs.json | 62 + research/gen5b-coretime12/packing.py | 51 + research/gen5b-coretime12/reprice.py | 67 + research/gen5b-coretime12/run_checks.py | 116 ++ .../gen5b-coretime12/scalar_norm_transport.py | 69 + research/gen5b-coretime12/source_data.py | 49 + .../gen5b-coretime12/test_bank_assignment.py | 32 + .../gen5b-coretime12/test_chart_bounds.py | 26 + research/gen5b-coretime12/test_coretime.py | 35 + research/gen5b-coretime12/test_finite_bill.py | 23 + research/gen5b-coretime12/test_pipeline.py | 71 + research/gen5b-coretime12/test_pricing.py | 51 + research/gen5b-coretime12/test_rootcuts.py | 8 + research/gen5b-coretime12/test_scalar_norm.py | 31 + research/gen5b-coretime12/test_source_data.py | 59 + 39 files changed, 5492 insertions(+) create mode 100644 research/gen5b-coretime12/NOTICE.md create mode 100644 research/gen5b-coretime12/PROOF.md create mode 100644 research/gen5b-coretime12/README.md create mode 100644 research/gen5b-coretime12/assembly_arithmetic.py create mode 100644 research/gen5b-coretime12/baseline_arithmetic.py create mode 100644 research/gen5b-coretime12/certificates/banks.json create mode 100644 research/gen5b-coretime12/certificates/charts.json create mode 100644 research/gen5b-coretime12/certificates/finite-bill.json create mode 100644 research/gen5b-coretime12/certificates/frames.json create mode 100644 research/gen5b-coretime12/certificates/local.json create mode 100644 research/gen5b-coretime12/certificates/pricing.json create mode 100644 research/gen5b-coretime12/certificates/scalar-transport.json create mode 100644 research/gen5b-coretime12/certificates/suffix.json create mode 100644 research/gen5b-coretime12/certificates/summary.json create mode 100644 research/gen5b-coretime12/chart_bounds.py create mode 100644 research/gen5b-coretime12/check_bank_assignment.py create mode 100644 research/gen5b-coretime12/check_complete_suffix.py create mode 100644 research/gen5b-coretime12/check_coretime.py create mode 100644 research/gen5b-coretime12/check_rootcuts.py create mode 100644 research/gen5b-coretime12/check_suffix_frames.py create mode 100644 research/gen5b-coretime12/exact_geometry.py create mode 100644 research/gen5b-coretime12/exact_intervals.py create mode 100644 research/gen5b-coretime12/fetch_inputs.py create mode 100644 research/gen5b-coretime12/finite_bill.py create mode 100644 research/gen5b-coretime12/inputs.json create mode 100644 research/gen5b-coretime12/packing.py create mode 100644 research/gen5b-coretime12/reprice.py create mode 100644 research/gen5b-coretime12/run_checks.py create mode 100644 research/gen5b-coretime12/scalar_norm_transport.py create mode 100644 research/gen5b-coretime12/source_data.py create mode 100644 research/gen5b-coretime12/test_bank_assignment.py create mode 100644 research/gen5b-coretime12/test_chart_bounds.py create mode 100644 research/gen5b-coretime12/test_coretime.py create mode 100644 research/gen5b-coretime12/test_finite_bill.py create mode 100644 research/gen5b-coretime12/test_pipeline.py create mode 100644 research/gen5b-coretime12/test_pricing.py create mode 100644 research/gen5b-coretime12/test_rootcuts.py create mode 100644 research/gen5b-coretime12/test_scalar_norm.py create mode 100644 research/gen5b-coretime12/test_source_data.py diff --git a/research/gen5b-coretime12/NOTICE.md b/research/gen5b-coretime12/NOTICE.md new file mode 100644 index 0000000000..d305dc0d75 --- /dev/null +++ b/research/gen5b-coretime12/NOTICE.md @@ -0,0 +1,30 @@ +# Attribution and scope + +New material is provided under the repository's Apache-2.0 license and was +prepared with substantial OpenAI assistance. Separate AI-assisted checks are +not human peer review, an OpenAI endorsement or proof-assistant verification. + +This proposal builds on Chafik Boukhalfa's PR #299 package, prepared with +substantial Anthropic Claude assistance, pinned at +`5f6bd3fbc0e6796dd31263cef1f06dc968186f64`. It retains that package's source +lineage, licensing and assistance disclosures. Its +[full immutable notice](https://github.com/CrocSwap/integer-mult-bounds/blob/5f6bd3fbc0e6796dd31263cef1f06dc968186f64/research/five-stage-gen5b-kernels-restorations-sinks/NOTICE.md) +remains applicable to the input data and inherited mechanisms. + +In particular, the construction inherits DreamingOfClouds' gen5/stagealt word, +Rohan Arun's descent and target stages, eumemic's scalar/five-stage/kernel +pipeline, utcorvusvolat-dotcom's early restoration mechanism, Dugongue's +endpoint-aware banking and terminal-sink work, Evan McKinney's completed-bank +method, and Chafik Boukhalfa's complex supplier. The full notice credits +Henry Grant, Jacob Sussman, ikeboy, icekylinx, James Chang, sennemmi and the +earlier contributors and dependencies. + +The new contribution is the coordinated 12-helper/root/partner schedule, +explicit undo of six overlapping restorations, independently authored +changed-stage checks, and its conditional repricing. It makes no exclusive +priority claim for inherited mechanisms or a global optimum claim. PR #294's +separate assembly-domain proposal is not modified or required. + +Upstream input files are fetched as immutable data. Their original notices +and source-specific licensing remain unchanged. No upstream executable is +imported or run by this package. diff --git a/research/gen5b-coretime12/PROOF.md b/research/gen5b-coretime12/PROOF.md new file mode 100644 index 0000000000..b27fea986b --- /dev/null +++ b/research/gen5b-coretime12/PROOF.md @@ -0,0 +1,151 @@ +# Co-retiming twelve helpers with their partner deliveries + +All claims below concern the pinned PR #299 input and retain its unchanged +stage and compiler interfaces. All ranks and containments are over Q unless +the field is explicitly stated. This is a differential construction proof, +not a new proof of the inherited all-size foundations. + +## 1. Selection and the obstruction to an unchanged-frame restoration + +The root-cut screen identifies 34 rank-21 entrance helpers `a`. Each has one +forward write `a += b`. Their common write frame `J` has dimension 22. Their +last root deliveries occur at different dimension-23 hyperplanes `A` and `B`, +whose intersection is `J` and whose join is full dimension 24. + +Thus merely moving `a -= b` earlier, while preserving both delivery frames, +does not improve its endpoint. The local candidate screen instead identifies +a preceding rank-22 root delivery by a blocker `c` to the relevant target `t`. +Two conflicting candidates are excluded. Among the remaining 32, keep exactly +the candidates whose old-restoration pair is hit twice. This gives 12 new +helpers and six old restorations to undo; all selected identities are derived +from pinned data and recorded in `certificates/local.json`. + +## 2. The changed schedule + +At each selected blocker root: + +1. Move `b`'s later delivery to `t` earlier, at `J`. +2. Deliver `c` to its unaffected target at its old frame `K`. +3. Perform the partner setup and its unaffected delivery at the inherited + post-descent rank-22 frame. +4. Advance the affected target, blocker and partner carrier as required to + `B`, and perform their remaining deliveries there. +5. After `a`'s original final delivery at `A`, perform `a -= b` at `A`, + omitting its original cleanup write. + +The selected preceding prefix and gauge frames lie in `J`. For each moved +donor, the union of all uncancelled source dependencies has 180 leaves and +lies in `J`; this check is stronger than a mod-2 cancellation test. The local +checker verifies the integer root map on independent helper/target values. + +The complete suffix checker includes all unchanged side roots, partner +deliveries, inverse cleanup, uninject operations and kernel restorations. +It constructs both 55,985-event streams and compares all 18,954 columns over +F2 and Z in both directions. Its entry states are arbitrary, so the equality +composes with the same unchanged prefix. Missing restoration is a negative +control. The inherited prefix's own correctness is not re-proved. + +The two overlapping kernel donors are never pivots; their pinned setup bases +lie in `J`. Kernel setup precedes first ordinary use and inverse kernel writes +follow cleanup under the retained stage contract. Seven inherited sinks and +all other suffix operations remain in the comparison. + +## 3. Correct chronological geometry + +The earlier root-only proposal missed a partner delivery at the old `K` frame. +Promoting the target to `B` and then delivering again at `K` is non-monotone. +The schedule above explicitly co-retimes that partner read and charges its +carrier's split climb. + +The frame checker starts affected helpers at their actual base-forward final +frames. No affected helper participates in a descent change. Each of the 12 +selected partner setups does participate: its pinned descent record replaces +a dimension-2 setup by a dimension-22 setup. The checker verifies the exact +new basis and uses it in both schedules. It checks every affected helper, +carrier and target path, including the six reverted endpoints, and rejects +omitting the partner promotion or old-restoration undo. + +Targets use a difference census from ZERO. Their unchanged earlier prefixes +end within the verified first precursor frame under the retained source +admission; the local source/gauge/target-prefix checks explicitly establish +the required new cut containments. No full untouched-prefix frame replay is +claimed. + +## 4. Paid profile and endpoint demands + +For the new helper/blocker operations alone, one surgery changes the local +histogram by `{1:+1, 2:-1}`. Undoing one inherited early restoration reverses +its delta `{1:+3, 2:-2}`. Co-retiming each partner carrier splits one rank-2 +climb into two rank-1 climbs, adding `{1:+2, 2:-1}`. Therefore + +``` +12*{1:+1, 2:-1} - 6*{1:+3, 2:-2} + 12*{1:+2, 2:-1} + = {1:+18, 2:-12}. +``` + +The actual chronological path census independently obtains this delta; it is +not used as an unchecked input to pricing. It adds six calls and removes six +units of rank mass locally. Five stages therefore add 30 calls and remove 30 +units of rank mass. The reflected paid ledger has the same rank increments +because annihilator inclusion reverses each nested frame pair. + +Each new helper changes residual rank 3 to 2. Each of the six reverted old +helpers changes residual rank 3 to 4. Thus the family-count delta is +`{2:+12, 3:-18, 4:+6}`, of total rank mass -6. + +For each stage's 60 replicas, replace 27 full rank-3 banks by 12 full rank-2 +banks and 12 full rank-4 banks. Each bank has width 120. Demand is exact and +the number of banks drops by three per stage, or 15 in the five-stage literal +stock. The bank checker reconstructs every role's entrance and endpoint, removes the +seven sinks, and assigns all 925,620 role/replica occurrences in a stage to +explicit bank and block addresses without collisions or omissions. Five +disjoint stage namespaces give 4,628,100 assignments. Every bank is full, +attaining the exact volume lower bound. The +unreplicated stock drops by `15/60 = 1/4`; this convention differs from +normalizing the literal stock by five. + +With `W = 1229735/60`, the independently repriced histogram has 482,665 calls, +rank mass 2,455,070 and unchanged deficit `120 W - 2455070 = 4400`. + +## 5. Changed chart and scalar bounds + +Using the retained weighted form `G = I - J/9`, construct each new rank-2 +residual projector as the endpoint projector minus its rank-21 entrance +projector. Its complementary completion has rank 22. An exact orthogonal +block basis uses residual, entrance and exterior columns. The six reverted +rank-4 charts are reconstructed from their original rank-20 entrances. + +Every changed 24-by-24 chart is invertible. A separately replayed exact +factor program recovers it from the identity. The largest uses 142 factors; +factor numerators are at most 11 and denominators at most 9. These fit the +retained chart-factor bound 576 and normalizer bound 815. New pure rank-2 +banks require at most 60 block scalars, within width 120; all are units under +the retained characteristic `q > 2^80` hypothesis. + +The before/after nonnegative coefficient majorant maps agree exactly in both +directions. A second certificate transports the old scalar norms through +172,944 commuting adjacent swaps. Only twelve destination update orders +change; each differs by moving one unit update. At intermediate cuts the new +row is an old row plus or minus one old source row, yielding a conservative +factor-two bound in each direction. Its resulting 103-bit payload remains +below the inherited 104-bit cap. + +The changed displayed finite coefficient is 90,386,288,803,484,701, or 57 bits, +below the retained 80-bit coefficient cap. All three bootstrap gaps and the +displayed cutoffs remain positive. These are checks at the displayed fixed +bill, not a numerical assignment to the unknown inherited full constant. + +## 6. Exact conditional rate + +The independently authored rational enclosure engine certifies the coarse +root between adjacent points `750469712644613/10^18` and +`750469712644614/10^18`, accepting the lower point and rejecting the higher. +Three retained ordinary bootstrap steps and the unchanged complex saving +produce `kappa = 749906929903449/10^18`. All 47 displayed outer constraints +are strict; increasing kappa by `10^-18` fails `g3_above_kappa`. + +This establishes the stated conditional arithmetic consequence of the changed +profile. It supplies no unconditional bound, replacement of the inherited +finite admission, or full proof-assistant verification of multiplication. + +Prepared with substantial OpenAI assistance. See [NOTICE.md](NOTICE.md). diff --git a/research/gen5b-coretime12/README.md b/research/gen5b-coretime12/README.md new file mode 100644 index 0000000000..39d3c474cb --- /dev/null +++ b/research/gen5b-coretime12/README.md @@ -0,0 +1,108 @@ +# A 12-helper co-retiming proposal on pinned PR #299 + +This is a standalone changed-stage verifier and conditional research proposal. +It adds no changes from PR #299 to `main`, and does not depend on PR #294. +PR #299 is an unmerged dependency, not an already available `main` package. + +The proposal introduces 12 early helper restorations while undoing six old +restorations, with coordinated root and partner deliveries. Its measured local +paid histogram delta is `{1: +18, 2: -12}` and its residual-family delta is +`{2: +12, 3: -18, 4: +6}`. Under the retained PR #299 admission and all-size +interfaces, the resulting exact arithmetic gives: + +- Bit coarse saving: `750469712644613 / 10^18` +- Conditional kappa: `749906929903449 / 10^18 = 0.000749906929903449` +- PR #299 comparison: `0.000749899215319498` +- Literal stock: `1,229,735`, down by 15 +- Unreplicated paid calls: `482,665`; rank mass: `2,455,070`; deficit: `4,400` + +The gain is `7714583951 / 10^18`, about 0.001029% of PR #299's kappa. +All identified changed-stage obligations pass the checks in this packet, +conditional on the retained source/compiler interfaces. This is not an +unconditional multiplication bound or a full replay of the inherited finite +admission. The earlier optimistic 32-helper price omitted +partner-carrier work and is superseded; it is not a result of this package. + +## Dependency and data acquisition + +Every input is pinned to PR #299 head +`5f6bd3fbc0e6796dd31263cef1f06dc968186f64`, under +`research/five-stage-gen5b-kernels-restorations-sinks`. +[Immutable source package](https://github.com/CrocSwap/integer-mult-bounds/tree/5f6bd3fbc0e6796dd31263cef1f06dc968186f64/research/five-stage-gen5b-kernels-restorations-sinks). + +`inputs.json` records each exact byte count, SHA-256 and Git blob SHA-1. Large +word, frame and selection files are deliberately not duplicated here. The +loader rejects missing, altered or unpinned data before parsing it. + +From this directory, use Python 3.11 or newer, without optimization (`-O`): + +```sh +python3 -B fetch_inputs.py --destination /tmp/coretime12-inputs +export CORETIME_SOURCE_DIR=/tmp/coretime12-inputs +python3 -B -m unittest discover -s . -p 'test_*.py' -v +python3 -B run_checks.py --check +``` + +The fetcher retrieves only the immutable public files listed in `inputs.json` +from GitHub and verifies their bytes. It never runs a downloaded producer, +installs a dependency or imports upstream Python. It needs network access only +for missing data. An existing directory is verified rather than overwritten. + +Alternatively, set `CORETIME_SOURCE_DIR` to the package directory in an existing +checkout containing exactly those pinned files. A normal `main` checkout is +not sufficient while PR #299 remains unmerged. The source root can be anywhere; +all checks work independently of the current working directory. + +To regenerate the compact receipts, explicit bank-address table and full chart +factor programs elsewhere: + +```sh +python3 -B run_checks.py --output-dir /tmp/coretime12-results --check +``` + +Add `--write-streams` to save both complete scalar suffixes as compressed JSON. +The generated streams, full bank-address table and full matrix/factor listings +are not committed; their deterministic reproducer and digest receipts are. + +## Verification coverage + +- Exact local integer-map and source-span checks select 12 compatible helpers + from the independently reproduced candidate census. +- The complete 55,985-addition changed suffix preserves all 18,954 independent + entry columns forward and backward over F2 and over the integers. Sources, + targets and dirty entries are arbitrary, rather than initialized to zero. +- Exact nonnegative coefficient majorant operators also agree in both + directions. A separate 172,944-swap commutation certificate proves signed + equivalence and a conservative factor-two scalar-norm bound. +- All 60 affected chronological frame paths are checked over the rationals, + including 212 containments and the 12 inherited post-descent partner setups. +- All 18 changed endpoint charts are constructed and exactly factored. They + use at most 142 factors, within the retained 576-chart/815-normalizer bounds. +- Explicit role-to-bank assignment covers all 15,427 helpers and 925,620 + role/replica occurrences per stage, with five disjoint stage namespaces. + A full-width bank packing witness, exact moments, all 47 outer inequalities, + and rejection of both adjacent coarse and kappa grid points are recomputed. +- The changed displayed finite bill is `90386288803484701`, below `2^80`; + the conservative payload bound has 103 bits, below the retained `2^104` cap. +- Mutation controls reject missing restoration, missing partner promotion, + missing bank capacity, incompatible frames, invalid arithmetic inputs and + altered source data. + +See [PROOF.md](PROOF.md) for the surgery and accounting argument, +`certificates/` for exact reproducible receipts, and [NOTICE.md](NOTICE.md) +for contributor attribution and AI-assistance disclosure. + +## What remains conditional + +The pinned unchanged prefix and its original admission are inherited. The +unchanged finite compiler, weighted compilation, routing, prime, setup and +all-size interfaces are not rerun here. The displayed finite-bill check does +not assign a value to the source theorem's unknown full constant `C_full`. +Its positive bridge inputs remain conditional on the retained finite bridge. +The bit payload contract remains F2; the stronger integer suffix identity does +not assert that the whole parity-filtered supplier is an integer decoder. + +Neither repository-wide `make verify` nor the inherited full admission suites +were run: only newly authored verifier programs execute. Passing these checks +does not establish a full machine-checked multiplication theorem. No production +guard, selected main certificate or inherited manuscript patch is modified. diff --git a/research/gen5b-coretime12/assembly_arithmetic.py b/research/gen5b-coretime12/assembly_arithmetic.py new file mode 100644 index 0000000000..4845766309 --- /dev/null +++ b/research/gen5b-coretime12/assembly_arithmetic.py @@ -0,0 +1,108 @@ +"""Independent transcription of the inherited 47 rational assembly slacks. + +The positive bridge gaps remain explicit inputs. No finite bridge or all-size +claim follows from these formulas. See NOTICE.md for the inherited lineage. +Prepared with substantial OpenAI assistance. Apache-2.0. +""" +from fractions import Fraction as F +import re +CAP_NAME='b_below_one_over32' +def rational(value): + if type(value) is int or type(value) is F: + return F(value) + if type(value) is str and re.fullmatch(r'-?[0-9]+(?:/[1-9][0-9]*)?', value): + return F(value) + raise ValueError('Expected an exact integer or rational fraction; floats/bools rejected') + + +def require(condition, reason): + if not condition: + raise ValueError(reason) + + +def direct_slacks(a, b, beta, h, kappa, scalar_gap=1, row_gap=1): + """Independent transcription of the displayed equations, using exact fractions. + + Return violations rather than suppressing the production cap. The caller + explicitly chooses a diagnostic evaluation mode in verdict(). + """ + a,b,beta,h,kappa,scalar_gap,row_gap = map(rational, + (a,b,beta,h,kappa,scalar_gap,row_gap)) + q = a*(1-2*h) + require(1+q != 0, 'Undefined epsilon') + eps = (1-h)/(1+q) + G = eps*q + tau, sigma = 1-a, 1-b + lp, c = 1-q, q+h/4 + lam = (tau+lp)/2 + r, delta = (G+1-eps)/2, h/8 + internal = tau+(1-beta)*max(sigma-tau, F(0)) + leaf = sigma+beta*(1-sigma) + margins = {'g1':1-eps, 'g2':a, 'g3':G, 'g4':a, + 'g5':min(1-eps-delta,r-delta), 'g6':1-eps-delta,'g7':eps} + slacks = { + 'a_positive':a, 'a_below_b':b-a, CAP_NAME:F(1,32)-b, + 'beta_positive':beta, 'beta_below_one':1-beta, + 'phase_leaf_above_bit':(1-beta)*b-a, + 'q_positive':q, 'q_below_internal':1-internal-q, + 'q_below_leaf':1-leaf-q, 'c_positive':c,'c_below_one':1-c, + 'q_below_reservations':c-q, 'lambda_above_tau':lam-tau, + 'lambda_above_sigma':lam-sigma, 'lambda_above_internal':lam-internal, + 'lambda_prime_above_lambda':lp-lam, 'compact_leaf':lp-leaf, + 'compact_reservations':lp-(1-c),'lambda_prime_below_one':q, + 'epsilon_positive':eps,'epsilon_below_one':1-eps,'guard_width':1-eps, + 'K_geometry':1-eps*(1+c),'K_dominates_log':eps*c, + 'record_suffix':1-eps, 'phase_local':1-eps-delta, + 'phase_boundary':r-delta, 'gamma_sublinear':1-eps-r, + 'cell_above_band':eps-(1-r)/2,'prime_interval_packing':1-eps, + 'alpha_positive':r,'alpha_below_one':1-r, + 'alpha_below_one_fourth':F(1,4)-r,'delta_positive':delta, + 'delta_below_one_eighth':F(1,8)-delta,'short_record_fallback':eps-a, + 'small_field_exposure':1-eps-G, + 'artificial_boundary':8-eps+r-delta-G, + 'literal_scalar_guard':scalar_gap,'row_product_gap':row_gap} + slacks.update({name+'_above_kappa':value-kappa for name,value in margins.items()}) + preconditions = {'positive_backoff':h>0, 'backoff_below_half':h0} + return dict(slacks=slacks, margins=margins, preconditions=preconditions, + parameters=dict(a=a,b=b,beta=beta,h=h,kappa=kappa,q=q, + epsilon=eps,G=G,r=r,delta=delta,c=c)) + + +def factored_slacks(a,b,beta,h,kappa,scalar_gap=1,row_gap=1): + """Second evaluation, from the proof's factorizations for a < b.""" + a,b,beta,h,kappa,scalar_gap,row_gap = map(rational, + (a,b,beta,h,kappa,scalar_gap,row_gap)) + require(a=0, 'Minimum-margin factorization assumes h >= 0') + q=a*(1-2*h); eps=(1-h)/(1+q); G=eps*q; L=(1-beta)*b-a + r=G+h/2; c=q+h/4 + result={ + 'a_positive':a,'a_below_b':b-a,CAP_NAME:F(1,32)-b, + 'beta_positive':beta,'beta_below_one':1-beta,'phase_leaf_above_bit':L, + 'q_positive':q,'q_below_internal':2*a*h,'q_below_leaf':L+2*a*h, + 'c_positive':c,'c_below_one':1-c,'q_below_reservations':h/4, + 'lambda_above_tau':a*h,'lambda_above_sigma':b-a+a*h, + 'lambda_above_internal':a*h,'lambda_prime_above_lambda':a*h, + 'compact_leaf':L+2*a*h,'compact_reservations':h/4, + 'lambda_prime_below_one':q,'epsilon_positive':eps, + 'epsilon_below_one':G+h,'guard_width':G+h, + 'K_geometry':h*(1-eps/4),'K_dominates_log':eps*c, + 'record_suffix':G+h,'phase_local':G+7*h/8,'phase_boundary':G+3*h/8, + 'gamma_sublinear':h/2,'cell_above_band':eps-(1-r)/2, + 'prime_interval_packing':G+h,'alpha_positive':r,'alpha_below_one':1-r, + 'alpha_below_one_fourth':F(1,4)-r,'delta_positive':h/8, + 'delta_below_one_eighth':(1-h)/8,'short_record_fallback':eps-a, + 'small_field_exposure':h,'artificial_boundary':8-eps+3*h/8, + 'literal_scalar_guard':scalar_gap,'row_product_gap':row_gap} + margins={'g1':G+h,'g2':a,'g3':G,'g4':a,'g5':G+3*h/8,'g6':G+7*h/8,'g7':eps} + result.update({name+'_above_kappa':value-kappa for name,value in margins.items()}) + return result + + +def serial(value): + if type(value) is F: return str(value) + if isinstance(value,dict): return {k:serial(v) for k,v in value.items()} + if isinstance(value,(list,tuple)): return [serial(v) for v in value] + return value + diff --git a/research/gen5b-coretime12/baseline_arithmetic.py b/research/gen5b-coretime12/baseline_arithmetic.py new file mode 100644 index 0000000000..fc589e8a8e --- /dev/null +++ b/research/gen5b-coretime12/baseline_arithmetic.py @@ -0,0 +1,126 @@ +"""Independently authored replay of pinned PR299 declared profile data. + +This recovers a declared cost profile; it is not a physical admission replay. +Prepared with substantial OpenAI assistance. Apache-2.0. +""" +from collections import Counter,defaultdict +from fractions import Fraction as F +import source_data as sd +import exact_intervals as ex +import assembly_arithmetic as ae +HEAD=sd.HEAD + +def read(name): + aliases={'target-selection-full.json':'target-selection.json', + 'target-selection-metadata.json':'target-selection.json', + 'descent-selection-metadata.json':'descent-selection.json'} + return sd.read_json(aliases.get(name,name.replace('__','/').removesuffix('.base64'))) + +def source_integrity(): + return sd.verify_all() +def hist(x):return Counter({int(k):int(v)for k,v in x.items()if int(k)>0 and int(v)}) + + +def rank(H):return sum(r*n for r,n in H.items()) + + +def base_histogram(): + w=read('gen5bit__selected__bit__word_p12.json.gz.base64') + fr=read('gen5bit__selected__bit__frames_p12.json.gz.base64') + p=read('gen5bit__selected__bit__profile_p12.json') + assert p['h']==fr['h']==24 and p['v']==1760 and p['R']==17160 + d={int(k):v['dim']for k,v in fr['frames'].items()} + assert all(type(z)is int and 0<=z<=24 for z in d.values()) + gauge={z['role']:z for z in w['gauges']} + assert all(d[z['frame']]==z['dim']for z in gauge.values()) + source={s:int(n)for n,s in w['sources'].items()} + recipient={donor:borrower for donor,borrower in w['pairs']} + removed=set(recipient.values()) + assert len(recipient)==len(removed)==1726 + assert not set(recipient)&removed + assert all(s not in gauge and b in gauge for s,b in recipient.items()) + phase=set(w['phase1']);order=w['phase1']+[i for i in range(len(w['ops']))if i not in phase] + assert len(order)==len(set(order))==len(w['ops']) + seq=defaultdict(list) + for i in order: + for s in w['ops'][i][:2]:seq[s].append(w['op_frame'][i]) + for s,f in zip(w['rootroles'],w['root_frame']):seq[s].append(f) + H=Counter() + for s in range(p['R']): + if s in removed:continue + start=gauge[s]['frame']if s in gauge else w['source_frame'][source[s]]if s in source else None + previous=0 if start is None else d[start] + path=seq[s][:] + if s in recipient: + b=recipient[s];path+=[gauge[b]['frame']]+seq[b] + path+=[w['full_frame']] + for f in path: + delta=d[f]-previous + assert delta>=0,(s,previous,d[f]) + if delta:H[delta]+=1 + previous=d[f] + if s in source:H[1]+=1 + # Center copies and the source/target path census are declared source data. + H[22]+=24 + for key in ('source_data_histogram','target_data_histogram'):H.update(hist(p[key])) + assert sum(H.values())==92937 and rank(H)==407228 + return H + + +def final_histogram(): + target=read('target-selection-full.json');total=Counter() + for group in target['groups']:total.update(hist(group['local_histogram_delta'])) + assert len(target['groups'])==220 and {r:n for r,n in total.items()if n}==dict(hist(target['expected_total_delta'])) + p=read('expected__kernel-pins.json');H=base_histogram();stages={} + deltas=[('descent',read('descent-selection-metadata.json')['expected_local_histogram_delta']), + ('target',read('target-selection-metadata.json')['expected_total_delta']), + ('kernel',p['kernel_local_delta']),('restore',p['restore_local_delta']),('sink',p['sink_local_delta'])] + for label,D in deltas: + D=hist(D);H.update(D);assert min(H.values())>=0 + stages[label]=dict(calls=sum(H.values()),rank_mass=rank(H),delta=dict(D)) + assert stages['descent']['rank_mass']==407228 + assert stages['kernel']['rank_mass']==p['kernel_helper_rank_mass']==405036 + assert stages['restore']['rank_mass']==404596 + assert stages['sink']['rank_mass']==404428 + idle={4:3520,23:3520,46:3520,50:3520} + final=Counter({r:5*n for r,n in H.items()if n});final.update(idle) + assert sum(final.values())==p['priced_five_stage_calls']==482635 + assert rank(final)==p['priced_five_stage_rank_mass']==2455100 + completion={5*r:n for r,n in hist(p['completion_rank_histogram']).items()} + before=final.copy();before.update(completion) + assert sum(before.values())==p['sink_five_stage_calls']==486589 + assert rank(before)==p['final_five_stage_rank_mass']==2691640 + return final,stages + + +def moment(H,m,W,a,bad=True): + lo,hi=ex.moment_interval(m,W,H,a) + if bad: + L,U=ex.log_interval(F(m));E,G=ex.exp_interval(a*L,a*U) + factor=F(32*m*sum(H.values()),10**16*W) + lo+=factor*E;hi+=factor*G + return lo,hi + + +def assembly(c,b,k): + chain=[F(384599,10**10)] + for i in range(3): + z=(1-c)*c+c*chain[-1] + assert chain[-1]0 + assert len(z['margins'])==7 + znext=ae.direct_slacks(a,b,beta,eta,k+F(1,10**18),1,row_gap) + failed=[n for n,v in znext['slacks'].items()if v<=0] + assert failed==['g3_above_kappa'] + q=a*(1-2*eta);G=(1-eta)*q/(1+q) + assert k2^80.", + "normalizer_factor_bound": 815, + "bank_selector_calls": 905994200400, + "displayed_finite_coefficient": 90386288803484701, + "coefficient_bits": 57, + "retained_coefficient_cap_bits": 80, + "conservative_payload_upper": 5952636918929489086220792832000, + "payload_bits": 103, + "retained_payload_cap_bits": 104, + "bad_fallback_per_child": 460800, + "internal_row_coefficient": 14401, + "external_row_coefficient": 20161, + "ordinary_degree_gap": "23971789/25", + "delta_tau_lower": "162010638578148661476934065453601092098381297973/75057067871093750000000000000000000000000000000000000000000000000", + "delta_linear": "171874999131203/96073046875000000", + "bootstrap_chain": [ + "384599/10000000000", + "749935370845117452542180262080231/1000000000000000000000000000000000000", + "750469311637276278571083649465802007924743795945603/1000000000000000000000000000000000000000000000000000000", + "750469712343669139242287674571932051331269403223951476323612218986639/1000000000000000000000000000000000000000000000000000000000000000000000000" + ], + "bootstrap_gaps": [ + { + "stage": 1, + "slacks": { + "atom": "534341799495547457819737919769/1000000000000000000000000000000000000", + "borrowing": "998499594916510269547457819737919769/1000000000000000000000000000000000000", + "remainder": "998499623779500370888009338437919769/1000000000000000000000000000000000000", + "stock": "999249530287355387/1000000000000000000" + }, + "minimum": "534341799495547457819737919769/1000000000000000000000000000000000000", + "cutoff_log2_at_displayed_coefficient": 126085226627008 + }, + { + "stage": 2, + "slacks": { + "atom": "401007336721428916350534197992075256204054397/1000000000000000000000000000000000000000000000000000000", + "borrowing": "998499060975718110721428916350534197992075256204054397/1000000000000000000000000000000000000000000000000000000", + "remainder": "998499623779500370888009338437919769/1000000000000000000000000000000000000", + "stock": "999249530287355387/1000000000000000000" + }, + "minimum": "401007336721428916350534197992075256204054397/1000000000000000000000000000000000000000000000000000000", + "cutoff_log2_at_displayed_coefficient": 223871012739882766625 + }, + { + "stage": 3, + "slacks": { + "atom": "300943860757712325428067948668730596776048523676387781013361/1000000000000000000000000000000000000000000000000000000000000000000000000", + "borrowing": "998499060575011717860757712325428067948668730596776048523676387781013361/1000000000000000000000000000000000000000000000000000000000000000000000000", + "remainder": "998499623779500370888009338437919769/1000000000000000000000000000000000000", + "stock": "999249530287355387/1000000000000000000" + }, + "minimum": "300943860757712325428067948668730596776048523676387781013361/1000000000000000000000000000000000000000000000000000000000000000000000000", + "cutoff_log2_at_displayed_coefficient": 397494866654308308705346463 + } + ], + "cutoff_scope": "Displayed fixed bill only. The retained theorem rule uses C_full including inherited primitive, wrapper and earlier ordinary-level constants; this check does not assign those unknown constants a value.", + "source_head": "5f6bd3fbc0e6796dd31263cef1f06dc968186f64", + "source_pins_sha256": "bdc0cb4aebaa9c1209c0598f14f69df4e0489e65b2208d0c51f7a3aaee1f1a77" +} diff --git a/research/gen5b-coretime12/certificates/frames.json b/research/gen5b-coretime12/certificates/frames.json new file mode 100644 index 0000000000..ee79673d29 --- /dev/null +++ b/research/gen5b-coretime12/certificates/frames.json @@ -0,0 +1,1489 @@ +{ + "status": "PASS_MEASURED_AFFECTED_SUFFIX_FRAME_LEDGER", + "source_head": "5f6bd3fbc0e6796dd31263cef1f06dc968186f64", + "affected_streams": 60, + "changed_paths": 60, + "exact_rational_containment_checks": 212, + "affected_helper_descent_overlaps": 0, + "partner_setup_descent_replacements_applied": 12, + "old_histogram": { + "21": 23, + "1": 101, + "22": 1, + "2": 12 + }, + "new_histogram": { + "21": 23, + "1": 119, + "22": 1 + }, + "local_histogram_delta": { + "1": 18, + "2": -12 + }, + "both_reflected_ledgers": true, + "reflected_justification": "For each nested frame pair A\u2282B, the annihilator inclusion reverses and the codimension drop equals the dimension gain.", + "paths": [ + { + "stream": 408, + "before_frames": [ + 101628, + 24867, + "FULL" + ], + "after_frames": [ + 101628, + 24867, + 2174, + "FULL" + ], + "before_dimensions": [ + 1, + 22, + 24 + ], + "after_dimensions": [ + 1, + 22, + 23, + 24 + ] + }, + { + "stream": 412, + "before_frames": [ + 101620, + 24863, + "FULL" + ], + "after_frames": [ + 101620, + 24863, + 2170, + "FULL" + ], + "before_dimensions": [ + 1, + 22, + 24 + ], + "after_dimensions": [ + 1, + 22, + 23, + 24 + ] + }, + { + "stream": 416, + "before_frames": [ + 101612, + 24889, + "FULL" + ], + "after_frames": [ + 101612, + 24889, + 2182, + "FULL" + ], + "before_dimensions": [ + 1, + 22, + 24 + ], + "after_dimensions": [ + 1, + 22, + 23, + 24 + ] + }, + { + "stream": 420, + "before_frames": [ + 101604, + 24885, + "FULL" + ], + "after_frames": [ + 101604, + 24885, + 2178, + "FULL" + ], + "before_dimensions": [ + 1, + 22, + 24 + ], + "after_dimensions": [ + 1, + 22, + 23, + 24 + ] + }, + { + "stream": 424, + "before_frames": [ + 101596, + 24911, + "FULL" + ], + "after_frames": [ + 101596, + 24911, + 2190, + "FULL" + ], + "before_dimensions": [ + 1, + 22, + 24 + ], + "after_dimensions": [ + 1, + 22, + 23, + 24 + ] + }, + { + "stream": 425, + "before_frames": [ + 101594, + 24909, + "FULL" + ], + "after_frames": [ + 101594, + 24909, + 2189, + "FULL" + ], + "before_dimensions": [ + 1, + 22, + 24 + ], + "after_dimensions": [ + 1, + 22, + 23, + 24 + ] + }, + { + "stream": 428, + "before_frames": [ + 101588, + 24907, + "FULL" + ], + "after_frames": [ + 101588, + 24907, + 2186, + "FULL" + ], + "before_dimensions": [ + 1, + 22, + 24 + ], + "after_dimensions": [ + 1, + 22, + 23, + 24 + ] + }, + { + "stream": 429, + "before_frames": [ + 101586, + 24905, + "FULL" + ], + "after_frames": [ + 101586, + 24905, + 2185, + "FULL" + ], + "before_dimensions": [ + 1, + 22, + 24 + ], + "after_dimensions": [ + 1, + 22, + 23, + 24 + ] + }, + { + "stream": 432, + "before_frames": [ + 101580, + 24933, + "FULL" + ], + "after_frames": [ + 101580, + 24933, + 2198, + "FULL" + ], + "before_dimensions": [ + 1, + 22, + 24 + ], + "after_dimensions": [ + 1, + 22, + 23, + 24 + ] + }, + { + "stream": 433, + "before_frames": [ + 101578, + 24931, + "FULL" + ], + "after_frames": [ + 101578, + 24931, + 2197, + "FULL" + ], + "before_dimensions": [ + 1, + 22, + 24 + ], + "after_dimensions": [ + 1, + 22, + 23, + 24 + ] + }, + { + "stream": 436, + "before_frames": [ + 101572, + 24929, + "FULL" + ], + "after_frames": [ + 101572, + 24929, + 2194, + "FULL" + ], + "before_dimensions": [ + 1, + 22, + 24 + ], + "after_dimensions": [ + 1, + 22, + 23, + 24 + ] + }, + { + "stream": 437, + "before_frames": [ + 101570, + 24927, + "FULL" + ], + "after_frames": [ + 101570, + 24927, + 2193, + "FULL" + ], + "before_dimensions": [ + 1, + 22, + 24 + ], + "after_dimensions": [ + 1, + 22, + 23, + 24 + ] + }, + { + "stream": 2169, + "before_frames": [ + "ZERO", + 24856, + 24863, + 2170 + ], + "after_frames": [ + "ZERO", + 24856, + 30953, + 2170 + ], + "before_dimensions": [ + 0, + 21, + 22, + 23 + ], + "after_dimensions": [ + 0, + 21, + 22, + 23 + ] + }, + { + "stream": 2173, + "before_frames": [ + "ZERO", + 24859, + 24867, + 2174 + ], + "after_frames": [ + "ZERO", + 24859, + 30949, + 2174 + ], + "before_dimensions": [ + 0, + 21, + 22, + 23 + ], + "after_dimensions": [ + 0, + 21, + 22, + 23 + ] + }, + { + "stream": 2177, + "before_frames": [ + "ZERO", + 24885, + 2178 + ], + "after_frames": [ + "ZERO", + 30939, + 2178 + ], + "before_dimensions": [ + 0, + 22, + 23 + ], + "after_dimensions": [ + 0, + 22, + 23 + ] + }, + { + "stream": 2181, + "before_frames": [ + "ZERO", + 24881, + 24889, + 2182 + ], + "after_frames": [ + "ZERO", + 24881, + 30935, + 2182 + ], + "before_dimensions": [ + 0, + 21, + 22, + 23 + ], + "after_dimensions": [ + 0, + 21, + 22, + 23 + ] + }, + { + "stream": 2184, + "before_frames": [ + "ZERO", + 24900, + 24905, + 2185 + ], + "after_frames": [ + "ZERO", + 24900, + 30927, + 2185 + ], + "before_dimensions": [ + 0, + 21, + 22, + 23 + ], + "after_dimensions": [ + 0, + 21, + 22, + 23 + ] + }, + { + "stream": 2185, + "before_frames": [ + "ZERO", + 24900, + 24907, + 2186 + ], + "after_frames": [ + "ZERO", + 24900, + 30925, + 2186 + ], + "before_dimensions": [ + 0, + 21, + 22, + 23 + ], + "after_dimensions": [ + 0, + 21, + 22, + 23 + ] + }, + { + "stream": 2188, + "before_frames": [ + "ZERO", + 24903, + 24909, + 2189 + ], + "after_frames": [ + "ZERO", + 24903, + 30923, + 2189 + ], + "before_dimensions": [ + 0, + 21, + 22, + 23 + ], + "after_dimensions": [ + 0, + 21, + 22, + 23 + ] + }, + { + "stream": 2189, + "before_frames": [ + "ZERO", + 24903, + 24911, + 2190 + ], + "after_frames": [ + "ZERO", + 24903, + 30921, + 2190 + ], + "before_dimensions": [ + 0, + 21, + 22, + 23 + ], + "after_dimensions": [ + 0, + 21, + 22, + 23 + ] + }, + { + "stream": 2192, + "before_frames": [ + "ZERO", + 24922, + 24927, + 2193 + ], + "after_frames": [ + "ZERO", + 24922, + 30913, + 2193 + ], + "before_dimensions": [ + 0, + 21, + 22, + 23 + ], + "after_dimensions": [ + 0, + 21, + 22, + 23 + ] + }, + { + "stream": 2193, + "before_frames": [ + "ZERO", + 24922, + 24929, + 2194 + ], + "after_frames": [ + "ZERO", + 24922, + 30911, + 2194 + ], + "before_dimensions": [ + 0, + 21, + 22, + 23 + ], + "after_dimensions": [ + 0, + 21, + 22, + 23 + ] + }, + { + "stream": 2196, + "before_frames": [ + "ZERO", + 24925, + 24931, + 2197 + ], + "after_frames": [ + "ZERO", + 24925, + 30909, + 2197 + ], + "before_dimensions": [ + 0, + 21, + 22, + 23 + ], + "after_dimensions": [ + 0, + 21, + 22, + 23 + ] + }, + { + "stream": 2197, + "before_frames": [ + "ZERO", + 24925, + 24933, + 2198 + ], + "after_frames": [ + "ZERO", + 24925, + 30907, + 2198 + ], + "before_dimensions": [ + 0, + 21, + 22, + 23 + ], + "after_dimensions": [ + 0, + 21, + 22, + 23 + ] + }, + { + "stream": 6221, + "before_frames": [ + 32783, + 24863, + "REST:18849", + "FULL" + ], + "after_frames": [ + 32783, + 24863, + 2170, + "FULL" + ], + "before_dimensions": [ + 21, + 22, + 23, + 24 + ], + "after_dimensions": [ + 21, + 22, + 23, + 24 + ] + }, + { + "stream": 6249, + "before_frames": [ + 32467, + 24885, + "REST:18869", + "FULL" + ], + "after_frames": [ + 32467, + 24885, + 2178, + "FULL" + ], + "before_dimensions": [ + 21, + 22, + 23, + 24 + ], + "after_dimensions": [ + 21, + 22, + 23, + 24 + ] + }, + { + "stream": 6270, + "before_frames": [ + 31993, + 24905, + "REST:18899", + "FULL" + ], + "after_frames": [ + 31993, + 24905, + 2185, + "FULL" + ], + "before_dimensions": [ + 21, + 22, + 23, + 24 + ], + "after_dimensions": [ + 21, + 22, + 23, + 24 + ] + }, + { + "stream": 6277, + "before_frames": [ + 32151, + 24907, + "REST:18889", + "FULL" + ], + "after_frames": [ + 32151, + 24907, + 2186, + "FULL" + ], + "before_dimensions": [ + 21, + 22, + 23, + 24 + ], + "after_dimensions": [ + 21, + 22, + 23, + 24 + ] + }, + { + "stream": 6298, + "before_frames": [ + 31677, + 24927, + "REST:18919", + "FULL" + ], + "after_frames": [ + 31677, + 24927, + 2193, + "FULL" + ], + "before_dimensions": [ + 21, + 22, + 23, + 24 + ], + "after_dimensions": [ + 21, + 22, + 23, + 24 + ] + }, + { + "stream": 6305, + "before_frames": [ + 31835, + 24929, + "REST:18909", + "FULL" + ], + "after_frames": [ + 31835, + 24929, + 2194, + "FULL" + ], + "before_dimensions": [ + 21, + 22, + 23, + 24 + ], + "after_dimensions": [ + 21, + 22, + 23, + 24 + ] + }, + { + "stream": 9373, + "before_frames": [ + 30927, + 2185, + "FULL" + ], + "after_frames": [ + 30927, + 2187, + "FULL" + ], + "before_dimensions": [ + 22, + 23, + 24 + ], + "after_dimensions": [ + 22, + 23, + 24 + ] + }, + { + "stream": 9377, + "before_frames": [ + 30925, + 2186, + "FULL" + ], + "after_frames": [ + 30925, + 2188, + "FULL" + ], + "before_dimensions": [ + 22, + 23, + 24 + ], + "after_dimensions": [ + 22, + 23, + 24 + ] + }, + { + "stream": 9397, + "before_frames": [ + 30939, + 2178, + "FULL" + ], + "after_frames": [ + 30939, + 2180, + "FULL" + ], + "before_dimensions": [ + 22, + 23, + 24 + ], + "after_dimensions": [ + 22, + 23, + 24 + ] + }, + { + "stream": 14958, + "before_frames": [ + 30953, + 2170, + "FULL" + ], + "after_frames": [ + 30953, + 2172, + "FULL" + ], + "before_dimensions": [ + 22, + 23, + 24 + ], + "after_dimensions": [ + 22, + 23, + 24 + ] + }, + { + "stream": 16169, + "before_frames": [ + 30913, + 2193, + "FULL" + ], + "after_frames": [ + 30913, + 2195, + "FULL" + ], + "before_dimensions": [ + 22, + 23, + 24 + ], + "after_dimensions": [ + 22, + 23, + 24 + ] + }, + { + "stream": 16198, + "before_frames": [ + 30911, + 2194, + "FULL" + ], + "after_frames": [ + 30911, + 2196, + "FULL" + ], + "before_dimensions": [ + 22, + 23, + 24 + ], + "after_dimensions": [ + 22, + 23, + 24 + ] + }, + { + "stream": 17463, + "before_frames": [ + 30935, + 2182, + "FULL" + ], + "after_frames": [ + 30935, + 2184, + "FULL" + ], + "before_dimensions": [ + 22, + 23, + 24 + ], + "after_dimensions": [ + 22, + 23, + 24 + ] + }, + { + "stream": 17518, + "before_frames": [ + 30923, + 2189, + "FULL" + ], + "after_frames": [ + 30923, + 2191, + "FULL" + ], + "before_dimensions": [ + 22, + 23, + 24 + ], + "after_dimensions": [ + 22, + 23, + 24 + ] + }, + { + "stream": 17530, + "before_frames": [ + 30909, + 2197, + "FULL" + ], + "after_frames": [ + 30909, + 2199, + "FULL" + ], + "before_dimensions": [ + 22, + 23, + 24 + ], + "after_dimensions": [ + 22, + 23, + 24 + ] + }, + { + "stream": 17568, + "before_frames": [ + 30949, + 2174, + "FULL" + ], + "after_frames": [ + 30949, + 2176, + "FULL" + ], + "before_dimensions": [ + 22, + 23, + 24 + ], + "after_dimensions": [ + 22, + 23, + 24 + ] + }, + { + "stream": 17573, + "before_frames": [ + 30921, + 2190, + "FULL" + ], + "after_frames": [ + 30921, + 2192, + "FULL" + ], + "before_dimensions": [ + 22, + 23, + 24 + ], + "after_dimensions": [ + 22, + 23, + 24 + ] + }, + { + "stream": 17585, + "before_frames": [ + 30907, + 2198, + "FULL" + ], + "after_frames": [ + 30907, + 2200, + "FULL" + ], + "before_dimensions": [ + 22, + 23, + 24 + ], + "after_dimensions": [ + 22, + 23, + 24 + ] + }, + { + "stream": 18849, + "before_frames": [ + 32783, + 24867, + "REST:18849" + ], + "after_frames": [ + 32783, + 24867, + 2174, + "FULL" + ], + "before_dimensions": [ + 21, + 22, + 23 + ], + "after_dimensions": [ + 21, + 22, + 23, + 24 + ] + }, + { + "stream": 18869, + "before_frames": [ + 32467, + 24889, + "REST:18869" + ], + "after_frames": [ + 32467, + 24889, + 2182, + "FULL" + ], + "before_dimensions": [ + 21, + 22, + 23 + ], + "after_dimensions": [ + 21, + 22, + 23, + 24 + ] + }, + { + "stream": 18889, + "before_frames": [ + 32151, + 24911, + "REST:18889" + ], + "after_frames": [ + 32151, + 24911, + 2190, + "FULL" + ], + "before_dimensions": [ + 21, + 22, + 23 + ], + "after_dimensions": [ + 21, + 22, + 23, + 24 + ] + }, + { + "stream": 18899, + "before_frames": [ + 31993, + 24909, + "REST:18899" + ], + "after_frames": [ + 31993, + 24909, + 2189, + "FULL" + ], + "before_dimensions": [ + 21, + 22, + 23 + ], + "after_dimensions": [ + 21, + 22, + 23, + 24 + ] + }, + { + "stream": 18909, + "before_frames": [ + 31835, + 24933, + "REST:18909" + ], + "after_frames": [ + 31835, + 24933, + 2198, + "FULL" + ], + "before_dimensions": [ + 21, + 22, + 23 + ], + "after_dimensions": [ + 21, + 22, + 23, + 24 + ] + }, + { + "stream": 18919, + "before_frames": [ + 31677, + 24931, + "REST:18919" + ], + "after_frames": [ + 31677, + 24931, + 2197, + "FULL" + ], + "before_dimensions": [ + 21, + 22, + 23 + ], + "after_dimensions": [ + 21, + 22, + 23, + 24 + ] + }, + { + "stream": 18920, + "before_frames": [ + 30953, + 2172, + "FULL" + ], + "after_frames": [ + 30953, + 2172 + ], + "before_dimensions": [ + 22, + 23, + 24 + ], + "after_dimensions": [ + 22, + 23 + ] + }, + { + "stream": 18921, + "before_frames": [ + 30949, + 2176, + "FULL" + ], + "after_frames": [ + 30949, + 2176 + ], + "before_dimensions": [ + 22, + 23, + 24 + ], + "after_dimensions": [ + 22, + 23 + ] + }, + { + "stream": 18922, + "before_frames": [ + 30939, + 2180, + "FULL" + ], + "after_frames": [ + 30939, + 2180 + ], + "before_dimensions": [ + 22, + 23, + 24 + ], + "after_dimensions": [ + 22, + 23 + ] + }, + { + "stream": 18923, + "before_frames": [ + 30935, + 2184, + "FULL" + ], + "after_frames": [ + 30935, + 2184 + ], + "before_dimensions": [ + 22, + 23, + 24 + ], + "after_dimensions": [ + 22, + 23 + ] + }, + { + "stream": 18924, + "before_frames": [ + 30927, + 2187, + "FULL" + ], + "after_frames": [ + 30927, + 2187 + ], + "before_dimensions": [ + 22, + 23, + 24 + ], + "after_dimensions": [ + 22, + 23 + ] + }, + { + "stream": 18925, + "before_frames": [ + 30925, + 2188, + "FULL" + ], + "after_frames": [ + 30925, + 2188 + ], + "before_dimensions": [ + 22, + 23, + 24 + ], + "after_dimensions": [ + 22, + 23 + ] + }, + { + "stream": 18926, + "before_frames": [ + 30923, + 2191, + "FULL" + ], + "after_frames": [ + 30923, + 2191 + ], + "before_dimensions": [ + 22, + 23, + 24 + ], + "after_dimensions": [ + 22, + 23 + ] + }, + { + "stream": 18927, + "before_frames": [ + 30921, + 2192, + "FULL" + ], + "after_frames": [ + 30921, + 2192 + ], + "before_dimensions": [ + 22, + 23, + 24 + ], + "after_dimensions": [ + 22, + 23 + ] + }, + { + "stream": 18928, + "before_frames": [ + 30913, + 2195, + "FULL" + ], + "after_frames": [ + 30913, + 2195 + ], + "before_dimensions": [ + 22, + 23, + 24 + ], + "after_dimensions": [ + 22, + 23 + ] + }, + { + "stream": 18929, + "before_frames": [ + 30911, + 2196, + "FULL" + ], + "after_frames": [ + 30911, + 2196 + ], + "before_dimensions": [ + 22, + 23, + 24 + ], + "after_dimensions": [ + 22, + 23 + ] + }, + { + "stream": 18930, + "before_frames": [ + 30909, + 2199, + "FULL" + ], + "after_frames": [ + 30909, + 2199 + ], + "before_dimensions": [ + 22, + 23, + 24 + ], + "after_dimensions": [ + 22, + 23 + ] + }, + { + "stream": 18931, + "before_frames": [ + 30907, + 2200, + "FULL" + ], + "after_frames": [ + 30907, + 2200 + ], + "before_dimensions": [ + 22, + 23, + 24 + ], + "after_dimensions": [ + 22, + 23 + ] + } + ], + "scope": "Chronological required-frame census of all affected helper, source-carrier and target streams. Targets start at ZERO for this difference census; their unchanged prior prefixes terminate within the checked first unchanged precursor frame, under retained source admission. Helper prefix frames are read from the actual base forward word and no affected helper overlaps descent changes; all 12 selected partner setups use their verified post-descent rank-22 frames. No global finite/compiler replay is claimed." +} diff --git a/research/gen5b-coretime12/certificates/local.json b/research/gen5b-coretime12/certificates/local.json new file mode 100644 index 0000000000..cddad6555b --- /dev/null +++ b/research/gen5b-coretime12/certificates/local.json @@ -0,0 +1,285 @@ +{ + "status": "PASS_LOCAL_INTEGER_ROOT_SCHEDULE_CERTIFICATE", + "head": "5f6bd3fbc0e6796dd31263cef1f06dc968186f64", + "selected": 12, + "undone_old_restorations": 6, + "local_histogram_delta": { + "1": -6, + "2": 0 + }, + "residual_rank_count_delta": { + "2": 12, + "3": -18, + "4": 6 + }, + "literal_stock_delta": -15, + "unreplicated_stock_delta": "-1/4", + "exact_integer_root_schedule_identity": true, + "missing_restoration_control_rejected": true, + "unchanged_root_read_coefficients": true, + "candidates": [ + { + "helper": 15813, + "donor": 11438, + "blocker": 2701, + "target": 409, + "helper_root": 1546, + "donor_root": 1540, + "blocker_root": 1533, + "old_restored_helper": 15329, + "old_restored_helper_stream": 18849, + "common_frame": 30953, + "new_endpoint": 2172, + "promoted_blocker_frame": 2170, + "target_precursor_roots": [ + 1530 + ], + "prefix_group_present": false, + "source_union_size": 180 + }, + { + "helper": 15815, + "donor": 14048, + "blocker": 15329, + "target": 413, + "helper_root": 1558, + "donor_root": 1552, + "blocker_root": 1535, + "old_restored_helper": 15329, + "old_restored_helper_stream": 18849, + "common_frame": 30949, + "new_endpoint": 2176, + "promoted_blocker_frame": 2174, + "target_precursor_roots": [ + 1531 + ], + "prefix_group_present": true, + "source_union_size": 180 + }, + { + "helper": 15821, + "donor": 5877, + "blocker": 2729, + "target": 417, + "helper_root": 1576, + "donor_root": 1570, + "blocker_root": 1563, + "old_restored_helper": 15349, + "old_restored_helper_stream": 18869, + "common_frame": 30939, + "new_endpoint": 2180, + "promoted_blocker_frame": 2178, + "target_precursor_roots": [ + 1560 + ], + "prefix_group_present": false, + "source_union_size": 180 + }, + { + "helper": 15823, + "donor": 13943, + "blocker": 15349, + "target": 421, + "helper_root": 1588, + "donor_root": 1582, + "blocker_root": 1565, + "old_restored_helper": 15349, + "old_restored_helper_stream": 18869, + "common_frame": 30935, + "new_endpoint": 2184, + "promoted_blocker_frame": 2182, + "target_precursor_roots": [ + 1561 + ], + "prefix_group_present": true, + "source_union_size": 180 + }, + { + "helper": 15828, + "donor": 5853, + "blocker": 2750, + "target": 424, + "helper_root": 1603, + "donor_root": 1597, + "blocker_root": 1592, + "old_restored_helper": 15379, + "old_restored_helper_stream": 18899, + "common_frame": 30927, + "new_endpoint": 2187, + "promoted_blocker_frame": 2185, + "target_precursor_roots": [ + 1590 + ], + "prefix_group_present": false, + "source_union_size": 180 + }, + { + "helper": 15829, + "donor": 5857, + "blocker": 2757, + "target": 425, + "helper_root": 1606, + "donor_root": 1600, + "blocker_root": 1593, + "old_restored_helper": 15369, + "old_restored_helper_stream": 18889, + "common_frame": 30925, + "new_endpoint": 2188, + "promoted_blocker_frame": 2186, + "target_precursor_roots": [ + 1590 + ], + "prefix_group_present": false, + "source_union_size": 180 + }, + { + "helper": 15830, + "donor": 13998, + "blocker": 15379, + "target": 428, + "helper_root": 1615, + "donor_root": 1609, + "blocker_root": 1594, + "old_restored_helper": 15379, + "old_restored_helper_stream": 18899, + "common_frame": 30923, + "new_endpoint": 2191, + "promoted_blocker_frame": 2189, + "target_precursor_roots": [ + 1591 + ], + "prefix_group_present": true, + "source_union_size": 180 + }, + { + "helper": 15831, + "donor": 14053, + "blocker": 15369, + "target": 429, + "helper_root": 1618, + "donor_root": 1612, + "blocker_root": 1595, + "old_restored_helper": 15369, + "old_restored_helper_stream": 18889, + "common_frame": 30921, + "new_endpoint": 2192, + "promoted_blocker_frame": 2190, + "target_precursor_roots": [ + 1591 + ], + "prefix_group_present": true, + "source_union_size": 180 + }, + { + "helper": 15836, + "donor": 12649, + "blocker": 2778, + "target": 432, + "helper_root": 1633, + "donor_root": 1627, + "blocker_root": 1622, + "old_restored_helper": 15399, + "old_restored_helper_stream": 18919, + "common_frame": 30913, + "new_endpoint": 2195, + "promoted_blocker_frame": 2193, + "target_precursor_roots": [ + 1620 + ], + "prefix_group_present": false, + "source_union_size": 180 + }, + { + "helper": 15837, + "donor": 12678, + "blocker": 2785, + "target": 433, + "helper_root": 1636, + "donor_root": 1630, + "blocker_root": 1623, + "old_restored_helper": 15389, + "old_restored_helper_stream": 18909, + "common_frame": 30911, + "new_endpoint": 2196, + "promoted_blocker_frame": 2194, + "target_precursor_roots": [ + 1620 + ], + "prefix_group_present": false, + "source_union_size": 180 + }, + { + "helper": 15838, + "donor": 14010, + "blocker": 15399, + "target": 436, + "helper_root": 1645, + "donor_root": 1639, + "blocker_root": 1624, + "old_restored_helper": 15399, + "old_restored_helper_stream": 18919, + "common_frame": 30909, + "new_endpoint": 2199, + "promoted_blocker_frame": 2197, + "target_precursor_roots": [ + 1621 + ], + "prefix_group_present": true, + "source_union_size": 180 + }, + { + "helper": 15839, + "donor": 14065, + "blocker": 15389, + "target": 437, + "helper_root": 1648, + "donor_root": 1642, + "blocker_root": 1625, + "old_restored_helper": 15389, + "old_restored_helper_stream": 18909, + "common_frame": 30907, + "new_endpoint": 2200, + "promoted_blocker_frame": 2198, + "target_precursor_roots": [ + 1621 + ], + "prefix_group_present": true, + "source_union_size": 180 + } + ], + "rejected": [ + { + "helper": 16485, + "reason": "Shared K-source would need two distinct promoted target hyperplanes" + }, + { + "helper": 16709, + "reason": "Shared K-source would need two distinct promoted target hyperplanes" + } + ], + "kernel_donor_contracts": [ + { + "donor": 12649, + "stream": 16169, + "entries": 1, + "pivot_entries": 0, + "setup_entry_ranks": [ + 4 + ], + "all_entry_frames_inside_J": true, + "interval_contract": "Imported: setup before first ordinary use, restoration after complete original cleanup" + }, + { + "donor": 12678, + "stream": 16198, + "entries": 1, + "pivot_entries": 0, + "setup_entry_ranks": [ + 4 + ], + "all_entry_frames_inside_J": true, + "interval_contract": "Imported: setup before first ordinary use, restoration after complete original cleanup" + } + ], + "scope": "Local source-data surgery certificate with exact integer root map, geometry/source-span conditions and net ledger. Full emitted postkernel word and global all-column replay have NOT been reconstructed. Existing valid monotone source-stage/target-prefix/sink contracts are retained assumptions; no certified new multiplication exponent is claimed." +} diff --git a/research/gen5b-coretime12/certificates/pricing.json b/research/gen5b-coretime12/certificates/pricing.json new file mode 100644 index 0000000000..b37d91556d --- /dev/null +++ b/research/gen5b-coretime12/certificates/pricing.json @@ -0,0 +1,710 @@ +{ + "status": "CONDITIONAL_ARITHMETIC_ONLY", + "physical_admission": false, + "local_histogram_delta": { + "1": 18, + "2": -12 + }, + "role_rank_count_delta": { + "2": 12, + "3": -18, + "4": 6 + }, + "histogram": { + "1": 220930, + "2": 82670, + "3": 45045, + "4": 25805, + "5": 12040, + "6": 10115, + "7": 4435, + "8": 1700, + "9": 3365, + "10": 2015, + "11": 3335, + "12": 3145, + "13": 1470, + "14": 2425, + "15": 300, + "16": 8345, + "17": 385, + "18": 3805, + "19": 180, + "20": 3180, + "21": 35095, + "22": 2320, + "23": 3520, + "46": 3520, + "50": 3520 + }, + "calls": 482665, + "rank_mass": 2455070, + "literal_stock": 1229735, + "unreplicated_stock": "245947/12", + "deficit": "4400", + "packing": { + "capacity": 120, + "demand": { + "10": 60, + "12": 60, + "13": 240, + "14": 60, + "15": 60, + "17": 120, + "18": 180, + "19": 120, + "20": 1260, + "21": 960, + "22": 4920, + "23": 94440, + "24": 688380, + "3": 27360, + "4": 104880, + "6": 1020, + "7": 180, + "8": 360, + "9": 240, + "2": 720 + }, + "patterns": [ + { + "widths": [ + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4 + ], + "count": 10 + }, + { + "widths": [ + 6, + 6, + 6, + 6, + 24, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4 + ], + "count": 15 + }, + { + "widths": [ + 7, + 7, + 7, + 7, + 24, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4 + ], + "count": 15 + }, + { + "widths": [ + 8, + 8, + 8, + 8, + 24, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4 + ], + "count": 90 + }, + { + "widths": [ + 9, + 9, + 9, + 9, + 24, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4 + ], + "count": 60 + }, + { + "widths": [ + 10, + 10, + 10, + 10, + 24, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4 + ], + "count": 15 + }, + { + "widths": [ + 12, + 12, + 12, + 12, + 24, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4 + ], + "count": 15 + }, + { + "widths": [ + 13, + 13, + 13, + 13, + 24, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4 + ], + "count": 60 + }, + { + "widths": [ + 14, + 14, + 14, + 14, + 24, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4 + ], + "count": 15 + }, + { + "widths": [ + 15, + 15, + 15, + 15, + 24, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4 + ], + "count": 15 + }, + { + "widths": [ + 17, + 17, + 17, + 17, + 24, + 4, + 4, + 4, + 4, + 4, + 4, + 4 + ], + "count": 30 + }, + { + "widths": [ + 18, + 18, + 18, + 18, + 24, + 4, + 4, + 4, + 4, + 4, + 4 + ], + "count": 45 + }, + { + "widths": [ + 19, + 19, + 19, + 19, + 24, + 4, + 4, + 4, + 4, + 4 + ], + "count": 30 + }, + { + "widths": [ + 20, + 20, + 20, + 20, + 24, + 4, + 4, + 4, + 4 + ], + "count": 315 + }, + { + "widths": [ + 21, + 21, + 21, + 21, + 24, + 4, + 4, + 4 + ], + "count": 240 + }, + { + "widths": [ + 22, + 22, + 22, + 22, + 24, + 4, + 4 + ], + "count": 1230 + }, + { + "widths": [ + 23, + 23, + 23, + 23, + 24, + 4 + ], + "count": 23610 + }, + { + "widths": [ + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4 + ], + "count": 2397 + }, + { + "widths": [ + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3 + ], + "count": 684 + }, + { + "widths": [ + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6 + ], + "count": 48 + }, + { + "widths": [ + 24, + 24, + 24, + 24, + 24 + ], + "count": 132516 + }, + { + "widths": [ + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2 + ], + "count": 12 + } + ], + "total_rank_demand": 19376040, + "feasible_bins": 161467, + "unused_coordinate_capacity": 0, + "dual_prices": { + "10": "1/12", + "12": "1/10", + "13": "13/120", + "14": "7/60", + "15": "1/8", + "17": "17/120", + "18": "3/20", + "19": "19/120", + "20": "1/6", + "21": "7/40", + "22": "11/60", + "23": "23/120", + "24": "1/5", + "3": "1/40", + "4": "1/30", + "6": "1/20", + "7": "7/120", + "8": "1/15", + "9": "3/40", + "2": "1/60" + }, + "dual_objective": "161467", + "integer_lower_bound": 161467, + "optimal": true + }, + "root_bracket": [ + "750469712644613/1000000000000000000", + "375234856322307/500000000000000000" + ], + "moment_interval": [ + "739023437499999998404818327845920871611726124764535716171947537743/739023437500000000000000000000000000000000000000000000000000000000", + "75057067871093749837989361421851338523065934546398907901618702027/75057067871093750000000000000000000000000000000000000000000000000" + ], + "adjacent_moment_interval": [ + "9607304687500000002190362034337412745338689578098215529763051037867/9607304687500000000000000000000000000000000000000000000000000000000", + "1200913085937500000273795254292176593167336197262288928866865863333/1200913085937500000000000000000000000000000000000000000000000000000" + ], + "kappa": "749906929903449/1000000000000000000", + "kappa_decimal": "0.000749906929903449", + "assembly": { + "coarse": "750469712644613/1000000000000000000", + "complex_coarse": "754736418878859/1000000000000000000", + "bootstrap_chain": [ + "384599/10000000000", + "749935370845117452542180262080231/1000000000000000000000000000000000000", + "750469311637276278571083649465802007924743795945603/1000000000000000000000000000000000000000000000000000000", + "750469712343669139242287674571932051331269403223951476323612218986639/1000000000000000000000000000000000000000000000000000000000000000000000000" + ], + "strict_constraints": { + "a_positive": "750469712343669139242287674571932051331269403223951476323612218986639/1000000000000000000000000000000000000000000000000000000000000000000000000", + "a_below_b": "4266706535189860757712325428067948668730596776048523676387781013361/1000000000000000000000000000000000000000000000000000000000000000000000000", + "b_below_one_over32": "30495263581121141/1000000000000000000", + "beta_positive": "1/1000000000", + "beta_below_one": "999999999/1000000000", + "phase_leaf_above_bit": "4266705780453441878853325428067948668730596776048523676387781013361/1000000000000000000000000000000000000000000000000000000000000000000000000", + "q_positive": "375234856171084099908800168146723737991062769560644468758582158016995887781013361/500000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "q_below_internal": "750469712343669139242287674571932051331269403223951476323612218986639/500000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "q_below_leaf": "2133352890977190651770331853276262008937230439355531241417841983004112218986639/500000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "c_positive": "375234856296084099908800168146723737991062769560644468758582158016995887781013361/500000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "c_below_one": "499624765143703915900091199831853276262008937230439355531241417841983004112218986639/500000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "q_below_reservations": "1/4000000000000", + "lambda_above_tau": "750469712343669139242287674571932051331269403223951476323612218986639/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "lambda_above_sigma": "4266706535940330470055994567310236343302528827379793079611732489684612218986639/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "lambda_above_internal": "750469712343669139242287674571932051331269403223951476323612218986639/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "lambda_prime_above_lambda": "750469712343669139242287674571932051331269403223951476323612218986639/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "compact_leaf": "2133352890977190651770331853276262008937230439355531241417841983004112218986639/500000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "compact_reservations": "1/4000000000000", + "lambda_prime_below_one": "375234856171084099908800168146723737991062769560644468758582158016995887781013361/500000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "epsilon_positive": "499999999999500000000000000000000000000000000000000000000000000000000000000000000000/500375234856171084099908800168146723737991062769560644468758582158016995887781013361", + "epsilon_below_one": "375234856671084099908800168146723737991062769560644468758582158016995887781013361/500375234856171084099908800168146723737991062769560644468758582158016995887781013361", + "guard_width": "375234856671084099908800168146723737991062769560644468758582158016995887781013361/500375234856171084099908800168146723737991062769560644468758582158016995887781013361", + "K_geometry": "375375234856296084099908800168146723737991062769560644468758582158016995887781013361/500375234856171084099908800168146723737991062769560644468758582158016995887781013361000000000000", + "K_dominates_log": "375234856295708865052504084046814937822916045822653405989021513548237305622996365112218986639/500375234856171084099908800168146723737991062769560644468758582158016995887781013361000000000000", + "record_suffix": "375234856671084099908800168146723737991062769560644468758582158016995887781013361/500375234856171084099908800168146723737991062769560644468758582158016995887781013361", + "phase_local": "3001878852868297564414230261073881103760355432747164687299096619667208520090089892112218986639/4003001878849368672799270401345173789903928502156485155750068657264135967102248106888000000000000", + "phase_boundary": "600375770173359324997909184934849180617553707559040087244170808358434838291604381712218986639/800600375769873734559854080269034757980785700431297031150013731452827193420449621377600000000000", + "gamma_sublinear": "1/2000000000000", + "cell_above_band": "999999999998499624765143828915900091199831853276262008937230439355531241417841983004112218986639/2001500939424684336399635200672586894951964251078242577875034328632067983551124053444000000000000", + "prime_interval_packing": "375234856671084099908800168146723737991062769560644468758582158016995887781013361/500375234856171084099908800168146723737991062769560644468758582158016995887781013361", + "alpha_positive": "750469712841792964961429252193538675813978815383297874747603671565233193404009726112218986639/1000750469712342168199817600336293447475982125539121288937517164316033991775562026722000000000000", + "alpha_below_one": "999999999999500375234856171084099908800168146723737991062769560644468758582158016995887781013361/1000750469712342168199817600336293447475982125539121288937517164316033991775562026722000000000000", + "alpha_below_one_fourth": "249437147715243749084992970831879823193181552569397024359631687407443264750486496954387781013361/1000750469712342168199817600336293447475982125539121288937517164316033991775562026722000000000000", + "delta_positive": "1/8000000000000", + "delta_below_one_eighth": "999999999999/8000000000000", + "short_record_fallback": "499624483540933593398831635806135547078311015333512173884611517468493247681667714755947201326827175624609378257400090082659309412947282905526234784060516321/500375234856171084099908800168146723737991062769560644468758582158016995887781013361000000000000000000000000000000000000000000000000000000000000000000000000", + "small_field_exposure": "1/1000000000000", + "artificial_boundary": "28024015030800450508098731724013690045631932457423095219188857940046494012564458906091663343040083/4003001878849368672799270401345173789903928502156485155750068657264135967102248106888000000000000", + "literal_scalar_guard": "1", + "row_product_gap": "23971789/25", + "g1_above_kappa": "500375579977263920873575639168182501635312723517657778543827697372923575728124652891017911/500375234856171084099908800168146723737991062769560644468758582158016995887781013361000000000000000000", + "g2_above_kappa": "562782440220139242287674571932051331269403223951476323612218986639/1000000000000000000000000000000000000000000000000000000000000000000000000", + "g3_above_kappa": "345121092836773666839000035777897321660748097134075069115214906579840343639530017911/500375234856171084099908800168146723737991062769560644468758582158016995887781013361000000000000000000", + "g4_above_kappa": "562782440220139242287674571932051331269403223951476323612218986639/1000000000000000000000000000000000000000000000000000000000000000000000000", + "g5_above_kappa": "187641058192156993311132639063090799299068309286682375750853583524162953298261519540392911/500375234856171084099908800168146723737991062769560644468758582158016995887781013361000000000000000000", + "g6_above_kappa": "437828675620242535361087039147164161168063840671462697985232874603171451242152026220892911/500375234856171084099908800168146723737991062769560644468758582158016995887781013361000000000000000000", + "g7_above_kappa": "499624765143329291480068463752726851901177119732074668254759075620526831809591910214728124652891017911/500375234856171084099908800168146723737991062769560644468758582158016995887781013361000000000000000000" + }, + "margins": { + "g1": "375234856671084099908800168146723737991062769560644468758582158016995887781013361/500375234856171084099908800168146723737991062769560644468758582158016995887781013361", + "g2": "750469712343669139242287674571932051331269403223951476323612218986639/1000000000000000000000000000000000000000000000000000000000000000000000000", + "g3": "375234856170708865052629084046814937822916045822653405989021513548237305622996365112218986639/500375234856171084099908800168146723737991062769560644468758582158016995887781013361000000000000", + "g4": "750469712343669139242287674571932051331269403223951476323612218986639/1000000000000000000000000000000000000000000000000000000000000000000000000", + "g5": "600375770173359324997909184934849180617553707559040087244170808358434838291604381712218986639/800600375769873734559854080269034757980785700431297031150013731452827193420449621377600000000000", + "g6": "3001878852868297564414230261073881103760355432747164687299096619667208520090089892112218986639/4003001878849368672799270401345173789903928502156485155750068657264135967102248106888000000000000", + "g7": "499999999999500000000000000000000000000000000000000000000000000000000000000000000000/500375234856171084099908800168146723737991062769560644468758582158016995887781013361" + }, + "kappa": "749906929903449/1000000000000000000", + "kappa_decimal": "0.000749906929903449", + "minimum_margin": "375234856170708865052629084046814937822916045822653405989021513548237305622996365112218986639/500375234856171084099908800168146723737991062769560644468758582158016995887781013361000000000000", + "absorption_gap": "345121092836773666839000035777897321660748097134075069115214906579840343639530017911/500375234856171084099908800168146723737991062769560644468758582158016995887781013361000000000000000000", + "adjacent_grid_rejected": [ + "g3_above_kappa" + ], + "bridge_scope": "The positive literal gap and supplied row gap are assumptions in this arithmetic check." + }, + "source_head": "5f6bd3fbc0e6796dd31263cef1f06dc968186f64", + "binding": "Measured chronological frame delta and exact selected endpoint residual changes.", + "prior_kappa": "374949607659749/500000000000000000", + "kappa_gain": "7714583951/1000000000000000000" +} diff --git a/research/gen5b-coretime12/certificates/scalar-transport.json b/research/gen5b-coretime12/certificates/scalar-transport.json new file mode 100644 index 0000000000..db37041de6 --- /dev/null +++ b/research/gen5b-coretime12/certificates/scalar-transport.json @@ -0,0 +1,321 @@ +{ + "status": "PASS_EXACT_SCALAR_NORM_TRANSPORT", + "suffix_additions": 55985, + "commuting_adjacent_swaps": 172944, + "destinations_with_changed_update_order": [ + { + "destination": 2169, + "moved_old_event": 2684, + "moved_gate": [ + 2169, + 14958, + 1 + ], + "old_order": [ + 2653, + 2665, + 2668, + 2683, + 2684, + 2685 + ], + "new_order": [ + 2653, + 2684, + 2665, + 2668, + 2683, + 2685 + ] + }, + { + "destination": 2173, + "moved_old_event": 2696, + "moved_gate": [ + 2173, + 17568, + 1 + ], + "old_order": [ + 2657, + 2675, + 2678, + 2695, + 2696, + 2697 + ], + "new_order": [ + 2657, + 2696, + 2675, + 2678, + 2695, + 2697 + ] + }, + { + "destination": 2181, + "moved_old_event": 2744, + "moved_gate": [ + 2181, + 17463, + 1 + ], + "old_order": [ + 2705, + 2723, + 2726, + 2743, + 2744, + 2745 + ], + "new_order": [ + 2705, + 2744, + 2723, + 2726, + 2743, + 2745 + ] + }, + { + "destination": 2177, + "moved_old_event": 2732, + "moved_gate": [ + 2177, + 9397, + 1 + ], + "old_order": [ + 2713, + 2716, + 2731, + 2732, + 2733 + ], + "new_order": [ + 2732, + 2713, + 2716, + 2731, + 2733 + ] + }, + { + "destination": 2184, + "moved_old_event": 2781, + "moved_gate": [ + 2184, + 9373, + 1 + ], + "old_order": [ + 2752, + 2760, + 2763, + 2780, + 2781, + 2782 + ], + "new_order": [ + 2752, + 2781, + 2760, + 2763, + 2780, + 2782 + ] + }, + { + "destination": 2185, + "moved_old_event": 2784, + "moved_gate": [ + 2185, + 9377, + 1 + ], + "old_order": [ + 2753, + 2765, + 2768, + 2783, + 2784, + 2785 + ], + "new_order": [ + 2753, + 2784, + 2765, + 2768, + 2783, + 2785 + ] + }, + { + "destination": 2188, + "moved_old_event": 2793, + "moved_gate": [ + 2188, + 17518, + 1 + ], + "old_order": [ + 2756, + 2770, + 2773, + 2792, + 2793, + 2794 + ], + "new_order": [ + 2756, + 2793, + 2770, + 2773, + 2792, + 2794 + ] + }, + { + "destination": 2189, + "moved_old_event": 2796, + "moved_gate": [ + 2189, + 17573, + 1 + ], + "old_order": [ + 2757, + 2775, + 2778, + 2795, + 2796, + 2797 + ], + "new_order": [ + 2757, + 2796, + 2775, + 2778, + 2795, + 2797 + ] + }, + { + "destination": 2192, + "moved_old_event": 2833, + "moved_gate": [ + 2192, + 16169, + 1 + ], + "old_order": [ + 2804, + 2812, + 2815, + 2832, + 2833, + 2834 + ], + "new_order": [ + 2804, + 2833, + 2812, + 2815, + 2832, + 2834 + ] + }, + { + "destination": 2193, + "moved_old_event": 2836, + "moved_gate": [ + 2193, + 16198, + 1 + ], + "old_order": [ + 2805, + 2817, + 2820, + 2835, + 2836, + 2837 + ], + "new_order": [ + 2805, + 2836, + 2817, + 2820, + 2835, + 2837 + ] + }, + { + "destination": 2196, + "moved_old_event": 2845, + "moved_gate": [ + 2196, + 17530, + 1 + ], + "old_order": [ + 2808, + 2822, + 2825, + 2844, + 2845, + 2846 + ], + "new_order": [ + 2808, + 2845, + 2822, + 2825, + 2844, + 2846 + ] + }, + { + "destination": 2197, + "moved_old_event": 2848, + "moved_gate": [ + 2197, + 17585, + 1 + ], + "old_order": [ + 2809, + 2827, + 2830, + 2847, + 2848, + 2849 + ], + "new_order": [ + 2809, + 2848, + 2827, + 2830, + 2847, + 2849 + ] + } + ], + "forward_norm_factor": 2, + "inverse_norm_factor": 2, + "original_forward_bound": 77985, + "original_inverse_bound": 2475558, + "new_forward_bound": 155970, + "new_inverse_bound": 4951116, + "payload_upper": 5952636918929489086220792832000, + "payload_bits": 103, + "retained_payload_cap_bits": 104, + "unchanged_literal_scalar_multiset": true, + "source_hashes": { + "original_suffix": "46abcfd74d8a06328b4a37c3bb5e353f8d1cfeea8ac03093f4f70a88949a11a3", + "modified_suffix": "a3ce5ed25c101d9a6c529222ab63fa91f2a1fd1c2333f15add5f88176eff34ae" + }, + "theorem": "Commuting swaps preserve each source value sampled by a gate. Every unchanged destination update sequence has the old row-value trajectory. Each changed destination order moves one unit update; at intermediate cuts its row is an old row plus or minus that same old source row. Reversing both schedules gives the identical property. The unchanged prefix is composed using the retained old global row-norm bounds.", + "scope": "Changed scalar suffix and retained old prefix bounds only. Address geometry and inherited finite compiler hypotheses are separate." +} diff --git a/research/gen5b-coretime12/certificates/suffix.json b/research/gen5b-coretime12/certificates/suffix.json new file mode 100644 index 0000000000..2daa23f5f0 --- /dev/null +++ b/research/gen5b-coretime12/certificates/suffix.json @@ -0,0 +1,47 @@ +{ + "all_independent_entry_roles": 18954, + "active_roles_after_sinks": 18947, + "selected": 12, + "old_restorations_undone": 6, + "sink_roles_removed": 7, + "kernel_member_donors": [ + { + "role": 12649, + "stream": 16169 + }, + { + "role": 12678, + "stream": 16198 + } + ], + "sink_target_overlaps_contained_in_new_frame": [ + 2177 + ], + "target_prefix_closed_before_suffix": { + "prefix_odd_adds": 700340, + "mandatory_positive_move_lower_bound": 11392, + "last_close_record": 702034 + }, + "co_retimed_partner_deliveries": 12, + "original_suffix_adds": 55985, + "modified_suffix_adds": 55985, + "status": "PASS_COMPLETE_SUFFIX_ALL_COLUMN_EQUALITY", + "field": "F2", + "forward_all_column_equal": true, + "inverse_all_column_equal": true, + "arbitrary_source_target_dirty_entry_values": true, + "exact_integer_signed_operators_equal_forward_inverse": true, + "exact_integer_absolute_coefficient_operators_equal": true, + "forward_inverse_absolute_operator_nonzeros": [ + 194718, + 6007476 + ], + "unchanged_forward_inverse_row_l1_bounds": true, + "norm_justification": "Pinned scalar_check.py replay_projection uses norms[a] += abs(c)*norms[b]. For arbitrary nonnegative entry weights, these before/after suffix majorant maps agree exactly over integers, in both directions. Every majorant row grows monotonically during the ADD-only suffix, so its maximal intermediate value is its final value. The unchanged prefix and suffix therefore retain the inherited forward/inverse maximum row-L1 bounds.", + "omitted_new_restoration_rejected": true, + "unchanged_scalar_multiset": true, + "original_suffix_sha256": "46abcfd74d8a06328b4a37c3bb5e353f8d1cfeea8ac03093f4f70a88949a11a3", + "modified_suffix_sha256": "a3ce5ed25c101d9a6c529222ab63fa91f2a1fd1c2333f15add5f88176eff34ae", + "source_head": "5f6bd3fbc0e6796dd31263cef1f06dc968186f64", + "scope": "Complete changed scalar suffix with all untouched suffix operations, seven sinks, inverse cleanup and kernel restores. Equality on arbitrary independent entry states composes with the inherited unchanged prefix. Rational address-frame legality and cost are separate checks; this does not rerun inherited all-size or finite-bridge hypotheses." +} diff --git a/research/gen5b-coretime12/certificates/summary.json b/research/gen5b-coretime12/certificates/summary.json new file mode 100644 index 0000000000..bc07e64cb0 --- /dev/null +++ b/research/gen5b-coretime12/certificates/summary.json @@ -0,0 +1,21 @@ +{ + "status": "PASS_CHANGED_STAGE_CHECKS_CONDITIONAL_ON_PINNED_BASE", + "source_head": "5f6bd3fbc0e6796dd31263cef1f06dc968186f64", + "new_restorations": 12, + "old_restorations_undone": 6, + "kappa": "749906929903449/1000000000000000000", + "kappa_decimal": "0.000749906929903449", + "literal_stock": 1229735, + "paid_calls": 482665, + "rank_mass": 2455070, + "deficit": "4400", + "full_inherited_admission_replayed": false, + "all_size_theorem_verified": false, + "verification_limits": [ + "The pinned PR299 unchanged prefix and its original admission remain hypotheses.", + "Unchanged finite compiler, weighted chart, routing, prime and setup contracts are inherited.", + "Changed charts, selector bound and scalar payload bound are checked here; the complete inherited finite compiler is not rerun.", + "Outer positive literal and row-gap inputs remain conditional on the inherited finite bridge.", + "No full all-size or machine-verification claim is made." + ] +} diff --git a/research/gen5b-coretime12/chart_bounds.py b/research/gen5b-coretime12/chart_bounds.py new file mode 100644 index 0000000000..2dc075b7cc --- /dev/null +++ b/research/gen5b-coretime12/chart_bounds.py @@ -0,0 +1,130 @@ +"""Original exact constructions and factor programs for all 18 changed charts. +Prepared with substantial OpenAI assistance. Apache-2.0. +""" +from fractions import Fraction as F +from math import gcd,lcm +import hashlib,json +import source_data as sd +import check_coretime +import exact_geometry as geo +def rref(A): + A=[[F(x)for x in row]for row in A];piv=[] + for j in range(len(A[0])if A else 0): + q=next((i for i in range(len(piv),len(A))if A[i][j]),None) + if q is None:continue + i=len(piv);A[i],A[q]=A[q],A[i];v=A[i][j];A[i]=[x/v for x in A[i]] + for k in range(len(A)): + if k!=i and A[k][j]: + v=A[k][j];A[k]=[a-v*b for a,b in zip(A[k],A[i])] + piv.append(j) + if len(piv)==len(A):break + return A,piv + + +def primitive(v): + d=lcm(*(F(x).denominator for x in v));v=[int(F(x)*d)for x in v];g=gcd(*v) + assert g;return [x//g for x in v] + + +def nullspace(A,n=24): + R,piv=rref(A);out=[] + for free in range(n): + if free in piv:continue + v=[F(0)]*n;v[free]=1 + for i,j in enumerate(piv):v[j]=-R[i][free] + out.append(primitive(v)) + return out + + +def factor(B): + n=len(B);A=[[F(x)for x in row]for row in B];ops=[];det=F(1) + for j in range(n): + pivot=next(i for i in range(j,n)if A[i][j]) + if pivot!=j:A[pivot],A[j]=A[j],A[pivot];ops.append(('swap',j,pivot,F(1)));det=-det + v=A[j][j];det*=v + if v!=1:A[j]=[x/v for x in A[j]];ops.append(('scale',j,j,1/v)) + for i in range(n): + if i!=j and A[i][j]: + q=-A[i][j];A[i]=[x+q*y for x,y in zip(A[i],A[j])];ops.append(('add',i,j,q)) + assert A==[[int(i==j)for j in range(n)]for i in range(n)] + # Independently replay inverse operations from I and recover B. + C=[[F(i==j)for j in range(n)]for i in range(n)] + for kind,i,j,q in reversed(ops): + if kind=='swap':C[i],C[j]=C[j],C[i] + elif kind=='scale':C[i]=[x/q for x in C[i]] + else:C[i]=[x-q*y for x,y in zip(C[i],C[j])] + assert C==B + return dict(determinant=det,factors=ops,count=len(ops), + max_numerator=max((abs(q.numerator)for kind,i,j,q in ops),default=1), + max_denominator=max((q.denominator for kind,i,j,q in ops),default=1)) + + +def serial(x): + if isinstance(x,F):return str(x) + if isinstance(x,dict):return {str(k):serial(v)for k,v in x.items()} + if isinstance(x,(list,tuple)):return [serial(v)for v in x] + return x + + +def endpoint_columns(candidate,w,frames): + gauges={z['role']:z for z in w['gauges']} + sigma=frames[str(gauges[candidate['helper']]['frame'])]['a'] + endpoint=frames[str(candidate['new_endpoint'])]['a'] + common=frames[str(candidate['common_frame'])]['a'] + assert gauges[candidate['helper']]['dim']==21 + assert len(rref(sigma)[1])==3 and len(rref(sigma+endpoint)[1])==3 + assert len(rref(common)[1])==2 and len(rref(common+endpoint)[1])==2 + P=geo.projector(sigma);E=geo.projector(endpoint);I=geo.eye(24) + assert geo.mul(P,E)==P and geo.mul(E,P)==P + residual=geo.add(E,P,-1);completion=geo.add(I,residual,-1) + assert geo.mul(residual,residual)==residual and sum(residual[i][i]for i in range(24))==2 + assert geo.mul(completion,completion)==completion and sum(completion[i][i]for i in range(24))==22 + residual_columns,_=geo.integer_columns(residual,2) + entrance_columns,_=geo.integer_columns(P,21) + exterior_columns,_=geo.integer_columns(geo.add(I,E,-1),1) + columns=residual_columns+entrance_columns+exterior_columns + assert len(rref(list(zip(*columns)))[1])==24 + gram=lambda a,b:9*sum(x*y for x,y in zip(a,b))-sum(a)*sum(b) + assert all(gram(a,b)==0 for a in columns[:2]for b in columns[2:]) + assert all(gram(a,columns[-1])==0 for a in columns[:23]) + return columns + + +def run(): + candidate=check_coretime.run(minimal=True) + w=sd.read_json('gen5bit/selected/bit/word_p12.json.gz') + frames=sd.read_json('gen5bit/selected/bit/frames_p12.json.gz')['frames'] + pins=sd.read_json('expected/kernel-pins.json') + undone={c['old_restored_helper']for c in candidate['candidates']} + assert len(candidate['candidates'])==12 and len(undone)==6 + gauges={z['role']:z for z in w['gauges']};matrices=[] + for c in candidate['candidates']: + matrices.append(('new_rank2',c['helper'],endpoint_columns(c,w,frames))) + for role in sorted(undone): + ann=frames[str(gauges[role]['frame'])]['a'];assert len(ann)==4 + residual=[primitive([15*x-sum(a)for x in a])for a in ann] + entrance=nullspace(ann);assert len(entrance)==20 + assert all(9*sum(x*y for x,y in zip(a,b))-sum(a)*sum(b)==0 for a in residual for b in entrance) + matrices.append(('reverted_rank4',role,residual+entrance)) + out=[] + for kind,role,cols in matrices: + assert len(cols)==24 and all(len(c)==24 for c in cols) + B=[list(row)for row in zip(*cols)];f=factor(B) + assert f['max_numerator']<2**80 and f['max_denominator']<2**80 + out.append(dict(kind=kind,role=role,basis_columns=cols,**f)) + assert len(out)==18 + largest=max(z['count']for z in out) + retained=pins['max_chart_factors'];assert retained==576 + bound=max(retained,largest)+119+120 + assert bound==pins['normalizer_factor_bound']==815 + stock=pins['literal_stock']-15;roles=pins['physical_R'] + selectors=600*((stock-1)+roles*120*bound) + assert selectors<2**40 + return dict(status='PASS_CHANGED_CHART_FACTORIZATION_BOUNDS',charts=len(out), + max_changed_chart_factors=largest,retained_chart_factor_bound=retained, + combined_normalizer_factor_bound=bound,selector_calls_bound=selectors, + selector_bound_less_than_2_power_40=True, + max_factor_numerator=max(z['max_numerator']for z in out), + max_factor_denominator=max(z['max_denominator']for z in out), + source_head=sd.HEAD,factor_programs=out, + scope='All changed chart constructions, exact inverse factor replay and selector bounds; retained finite-compiler and unchanged-stage hypotheses remain conditional.') diff --git a/research/gen5b-coretime12/check_bank_assignment.py b/research/gen5b-coretime12/check_bank_assignment.py new file mode 100644 index 0000000000..cd370caee9 --- /dev/null +++ b/research/gen5b-coretime12/check_bank_assignment.py @@ -0,0 +1,113 @@ +"""Explicit role-resolved bank assignment for the minimal twelve-helper rewrite.""" +from collections import Counter,defaultdict +import hashlib,json,time +from check_complete_suffix import read,HERE,CANDIDATE_FILE + +def run(output_dir=None, mutation=None): + started=time.monotonic() + w=read('gen5bit__selected__bit__word_p12.json.gz.base64') + selection=read(CANDIDATE_FILE)['candidates'];kernel=read('kernel-selection.json') + restore=read('restore-selection.json')['entries'];sinks=read('sink-selection.json')['sinks'] + removed={b for a,b in w['pairs']};regs=sorted(set(range(17160))-removed) + original_from_stream={3520+i:r for i,r in enumerate(regs)} + sinkroles={r['role']for r in sinks};roles=sorted(set(regs)-sinkroles) + assert len(roles)==15427 + entrances={r:0 for r in roles};entrance_type={r:'ZERO'for r in roles} + for z in w['gauges']: + if z['role']in entrances: + entrances[z['role']]=z['dim'];entrance_type[z['role']]=f'frame:{z["frame"]}' + pivots=[(z['a'],z['rank'])for z in kernel['pairs']]+[(z['pivot'],z['rank'])for z in kernel['families']] + pivot_residuals=Counter() + for stream,rank in pivots: + role=original_from_stream[stream];assert entrances[role]==0 + entrances[role]=rank;entrance_type[role]=f'kernel:{stream}' + pivot_residuals[24-rank]+=1 + endpoints={r:24 for r in roles};endpoint_type={r:'FULL'for r in roles} + undo={z['old_restored_helper_stream']for z in selection} + assert len(undo)==6 + retained=[z for z in restore if z['helper']not in undo] + assert len(retained)==434 + for z in retained: + r=original_from_stream[z['helper']];assert entrances[r]==20 + endpoints[r]=23;endpoint_type[r]=f'old_restore:{z["helper"]}' + for z in selection: + r=z['helper'];assert entrances[r]==21 and endpoints[r]==24 + endpoints[r]=23;endpoint_type[r]=f'frame:{z["new_endpoint"]}' + families=defaultdict(list) + for r in roles: + width=endpoints[r]-entrances[r];assert 0=0 and 120%width==0 and leftover%blocks==0 + patterns.append(([width]*blocks,leftover//blocks)) + total=Counter();segments=defaultdict(list);bank_start=0 + for pattern,(widths,n) in enumerate(patterns): + assert sum(widths)==120 and n>0 + offsets=[];x=0 + for r in widths:offsets.append(x);x+=r + for r in set(widths): + blocks=[(i,offsets[i])for i,v in enumerate(widths)if v==r] + lo=total[r];hi=lo+n*len(blocks) + segments[r].append(dict(lo=lo,hi=hi,pattern=pattern,bank_start=bank_start,blocks=blocks)) + total[r]=hi + bank_start+=n + assert total=={r:60*n for r,n in counts.items()} + assert bank_start==161467 + def assignment(role_index,replica,width): + q=60*role_index+replica + for s in segments[width]: + if s['lo']<=q0: + positive_plain.update(alias.get(s,s)for s in w['ops'][index][:2]if alias.get(s,s)not in gauges) + assert len(positive_plain)==13200 + lower_moves=len(positive_plain)-2*904 + last_close=max(x['close_after_record']for x in target['groups']) + assert prefix_adds+lower_moves>last_close + # No target-prefix changes remain in this suffix; descent never changes + # scalar coefficients. Kernel restoration calls are appended explicitly. + byroot=defaultdict(list) + for e in partner:byroot[e['deliver_after_root']].append(e) + insert={z['blocker_root']:z for z in candidate} + omit={z['donor_root']for z in candidate} + finish={z['helper_root']:z for z in candidate} + undo={z['old_restored_helper_stream']for z in candidate} + assert len(candidate)==12 and len(undo)==6 + + def emit(changed): + out=[] + def add(a,b,c,tag): + assert a!=b and c%2 + out.append((a,b,c,tag)) + def root(i,exclude=None,only=None): + r=graph['roots'][i];s=w['rootroles'][i] + if r['kind']!='side' or s in sunk:return + for t in r['targets']: + if t==exclude or only is not None and t!=only:continue + add(V+t,sid(s),r.get('coefficient',1),f'root:{i}:{t}') + for i,r in enumerate(graph['roots']): + if changed and i in insert: + z=insert[i];root(z['donor_root']);root(i,exclude=z['target']) + for e in byroot[i]: + add(e['carrier'],e['passive'],1,f'partner_setup:{i}') + for t in e['receivers']: + if t!=z['target']:add(V+t,e['carrier'],1,f'partner_delivery:{i}:{t}') + root(i,only=z['target']) + for e in byroot[i]: + for t in e['receivers']: + if t==z['target']:add(V+t,e['carrier'],1,f'partner_delivery:{i}:{t}') + else: + if not(changed and i in omit):root(i) + for e in byroot[i]: + add(e['carrier'],e['passive'],1,f'partner_setup:{i}') + for t in e['receivers']:add(V+t,e['carrier'],1,f'partner_delivery:{i}:{t}') + if changed and i in finish: + z=finish[i];add(sid(z['helper']),sid(z['donor']),-1,f'new_restore:{z["helper"]}') + for e in partner:add(e['carrier'],e['passive'],-1,'partner_cleanup') + retained=[z for z in oldrestore if not(changed and z['helper']in undo)] + for z in sorted(retained,key=lambda z:z['helper']):add(z['helper'],z['donor'],z['coefficient'],f'old_restore:{z["helper"]}') + moved={(z['helper'],z['donor']):0 for z in retained} + newpairs={(sid(z['helper']),sid(z['donor'])):0 for z in candidate}if changed else {} + for index in reversed(order): + a,b,_=w['ops'][index] + if a in sunk:continue + pair=(sid(a),sid(b)) + if pair in moved:moved[pair]+=1;continue + if pair in newpairs:newpairs[pair]+=1;continue + add(*pair,-1,f'cleanup:{index}') + assert all(x==1 for x in moved.values())and all(x==1 for x in newpairs.values()) + for source,role in w['sources'].items():add(sid(role),int(source),-1,'uninject') + for z in entries: + for donor in z['donors']:add(donor,z['pivot'],-1,f'kernel_restore:{z["pivot"]}') + return out + old,new=emit(False),emit(True) + assert Counter((a,b,c)for a,b,c,_ in old)==Counter((a,b,c)for a,b,c,_ in new) + return n,old,new,dict(all_independent_entry_roles=n,active_roles_after_sinks=n-7, + selected=len(candidate),old_restorations_undone=len(undo),sink_roles_removed=7, + kernel_member_donors=kernel_candidate_donors,sink_target_overlaps_contained_in_new_frame=sink_target_overlaps, + target_prefix_closed_before_suffix=dict(prefix_odd_adds=prefix_adds, + mandatory_positive_move_lower_bound=lower_moves,last_close_record=last_close), + co_retimed_partner_deliveries=sum(z['target'] in e['receivers']for z in candidate for e in byroot[z['blocker_root']]), + original_suffix_adds=len(old),modified_suffix_adds=len(new)) + +def evaluate(events,n,reverse=False): + rows=[1<>s&1] + assert len(leaves)==180 + assert all(not any(sum(z[j]for j in g['labels'][s])for z in J)for s in leaves) + assert g['roots'][bi]['node']==g['roots'][ai]['node'] + # a has exactly one forward incidence and b is unchanged from that write to the roots. + ai_ops=[(i,o)for i,o in enumerate(w['ops'])if a in o[:2]] + assert len(ai_ops)==1 and ai_ops[0][1][:2]==[a,b] + aop=ai_ops[0][0] + assert not any(o[0]==b for o in w['ops'][aop+1:]) + candidates.append(dict(helper=a,donor=b,blocker=c,target=t,helper_root=ai,donor_root=bi, + blocker_root=ki,old_restored_helper=regs[prior['helper']-3520],old_restored_helper_stream=prior['helper'], + common_frame=row['write_frame_id'],new_endpoint=row['helper_frame_id'],promoted_blocker_frame=row['donor_frame_id'], + target_precursor_roots=predecessors,prefix_group_present=bool(group),source_union_size=len(leaves))) + if minimal: + multiplicity=Counter(z['old_restored_helper_stream'] for z in candidates) + candidates=[z for z in candidates if multiplicity[z['old_restored_helper_stream']]==2] + retained={z['old_restored_helper_stream']for z in candidates} + lost={h:z for h,z in lost.items()if h in retained} + expected_candidates,expected_undo=(12,6)if minimal else(32,26) + if mutation=='omit_old_restoration_undo':lost.pop(next(iter(lost))) + if mutation=='shared_blocker':candidates[1]['blocker']=candidates[0]['blocker'] + if mutation=='wrong_promoted_frame':candidates[0]['promoted_blocker_frame']=candidates[0]['new_endpoint'] + assert {z['old_restored_helper_stream']for z in candidates}<=set(lost),'Missing old restoration undo' + assert len({z['blocker']for z in candidates})==len(candidates),'Shared blocker' + for z in candidates: + promoted=f[z['promoted_blocker_frame']]['a'];cap=f[w['root_frame'][z['donor_root']]]['a'] + assert sub(promoted,cap),'Promoted delivery outside target cap' + assert len(candidates)==expected_candidates and len(lost)==expected_undo and len(rejected)==2 + aa={z['helper']for z in candidates};bb={z['donor']for z in candidates};cc={z['blocker']for z in candidates} + assert len(aa)==len(bb)==len(cc)==expected_candidates and not(aa&bb or aa&cc or bb&cc) + kernel_donor_contracts=[z for z in kernel_donor_contracts if z['donor'] in bb] + assert not (aa|bb|cc)&set(w['sources'].values()), 'A moved helper is a source carrier with possible partner-mix writes' + # Construct the literal altered root schedule and compare its EXACT INTEGER + # linear map on arbitrary independent helper registers and target contents. + insert={z['blocker_root']:z for z in candidates};omit={z['donor_root']for z in candidates} + finish={z['helper_root']:z for z in candidates} + def root_events(i,exclude=None): + z=g['roots'][i] + return [(1760*10+t,w['rootroles'][i],z.get('coefficient',1))for t in z['targets']if t!=exclude] + original=[];modified=[] + for i,z in enumerate(g['roots']): + original+=root_events(i) + if i in insert: + row=insert[i];modified+=root_events(row['donor_root']) + # First deliver K-source to its unaffected target(s), then promote + # that source and the affected target to B and deliver there. + modified+=root_events(i,exclude=row['target']) + modified += [(1760*10+row['target'],row['blocker'],z.get('coefficient',1))] + elif i not in omit:modified+=root_events(i) + if i in finish: + row=finish[i];modified.append((row['helper'],row['donor'],-1)) + original += [(z['helper'],z['donor'],-1)for z in candidates] + def evaluate(events): + rows={} + def get(i):return rows.setdefault(i,{i:1}) + for dest,src,coeff in events:add(get(dest),get(src),coeff) + return {i:row for i,row in rows.items()if row!={i:1}} + A=evaluate(original);C=evaluate(modified);assert A==C + corrupted=modified[:];removed_restore=next(i for i,z in enumerate(corrupted)if z[0]in aa) + del corrupted[removed_restore];assert evaluate(corrupted)!=A + # Local role-path ledger. Unchanged target dimensions 21->22->23. + # Per new surgery a loses 23->24; blocker changes 22->24 to 22->23->24. + gross=Counter({1:len(candidates),2:-len(candidates)}) + gross.update({1:-3*len(lost),2:2*len(lost)}) + residual={2:len(candidates),3:-len(candidates)-len(lost),4:len(lost)} + assert dict(gross)==({1:-6,2:0}if minimal else{1:-46,2:20}) + assert sum(r*n for r,n in gross.items())==-6 + assert sum(r*n for r,n in residual.items())==-6 and sum(residual.values())==0 + return dict(status='PASS_LOCAL_INTEGER_ROOT_SCHEDULE_CERTIFICATE',head=old['head'], + selected=len(candidates),undone_old_restorations=len(lost),local_histogram_delta=dict(gross), + residual_rank_count_delta=residual,literal_stock_delta=-15,unreplicated_stock_delta='-1/4', + exact_integer_root_schedule_identity=True,missing_restoration_control_rejected=True, + unchanged_root_read_coefficients=True,candidates=candidates,rejected=rejected, + kernel_donor_contracts=kernel_donor_contracts, + scope='Local source-data surgery certificate with exact integer root map, geometry/source-span conditions and net ledger. Full emitted postkernel word and global all-column replay have NOT been reconstructed. Existing valid monotone source-stage/target-prefix/sink contracts are retained assumptions; no certified new multiplication exponent is claimed.') + +if __name__=='__main__': + r=run();(HERE/'coretime-result.json').write_text(json.dumps(r,indent=2)+'\n') + print(r['status'],r['selected'],'new restorations,',r['undone_old_restorations'],'old restorations undone, delta',r['local_histogram_delta']) diff --git a/research/gen5b-coretime12/check_rootcuts.py b/research/gen5b-coretime12/check_rootcuts.py new file mode 100644 index 0000000000..9e76fa4c36 --- /dev/null +++ b/research/gen5b-coretime12/check_rootcuts.py @@ -0,0 +1,74 @@ +"""Original exact rational cut screen. Upstream inputs are JSON data only.""" +from fractions import Fraction +from pathlib import Path +import base64, gzip, hashlib, json +import source_data as sd +HEAD='5f6bd3fbc0e6796dd31263cef1f06dc968186f64' + +def rank(rows, width=24): + a=[[Fraction(x) for x in row] for row in rows] + if any(len(row)!=width for row in a): raise ValueError('Wrong row width') + result=0 + for col in range(width): + pivot=next((i for i in range(result,len(a)) if a[i][col]),None) + if pivot is None: continue + a[result],a[pivot]=a[pivot],a[result] + scale=a[result][col];a[result]=[x/scale for x in a[result]] + for i in range(result+1,len(a)): + scale=a[i][col] + if scale:a[i]=[x-scale*y for x,y in zip(a[i],a[result])] + result+=1 + return result + +def read(name): + return sd.read_json(name.replace('__','/').removesuffix('.base64')) + +def valid_witness(row): + A,B,C=row['helper_annihilator'],row['donor_annihilator'],row['write_annihilator'] + return (row['donor_root_index']=3520} + assert not [e for e in descent if set(e['scalar'][:2])&affected_helpers] + # Canonical annihilator matrices; exact containment uses row-span inclusion. + cache={'FULL':[], 'ZERO':[[Q(i==j)for j in range(24)]for i in range(24)]} + dims={'FULL':24,'ZERO':0} + def ann(key): + if key not in cache: + if isinstance(key,int): + d=ff[str(key)];cache[key]=d.get('a') if 'a'in d else nullspace(d['b']);dims[key]=d['dim'] + elif key.startswith('REST:'): + z=oldr[int(key[5:])];cache[key]=nullspace(z['basis']);dims[key]=z['rank'] + elif key.startswith('CAP:'): + t=int(key[4:]);S=set(g['labels'][t]);cache[key]=[[3*int(j in S)-1 for j in range(24)]];dims[key]=23 + else:raise ValueError(key) + return cache[key] + containment={} + def sub(a,b): + if (a,b)not in containment: + A,B=ann(a),ann(b) + containment[a,b]=len(echelon(A+B)[1])==len(A) + return containment[a,b] + setup_frames={} + for z in sel: + e=partner_by_root[z['blocker_root']] + selected=[d for d in descent if d['scalar'][:3]==[e['carrier'],e['passive'],1]] + assert len(selected)==1 and selected[0]['old_dimension']==2 and selected[0]['new_dimension']==22 + d=selected[0];A=ann(e['deliver_frame']) + assert len(echelon(d['new_basis'])[1])==22 + assert all(sum(x*y for x,y in zip(a,b))==0 for a in A for b in d['new_basis']) + setup_frames[z['blocker_root']]=e['deliver_frame'] + phase=set(w['phase1']);order=w['phase1']+[i for i in range(len(w['ops']))if i not in phase] + initial={x:'ZERO'for x in affected} + for x in affected: + if x=3520:ann(initial[x]);assert dims[initial[x]]<=22,(x,initial[x],dims[initial[x]]) + def frame(tag,changed): + if tag.startswith('root:'): + _,ii,tt=tag.split(':');i,t=int(ii),int(tt) + if changed and i in bydonor:return bydonor[i]['common_frame'] + if changed and i in byblocker and t==byblocker[i]['target']:return byblocker[i]['promoted_blocker_frame'] + return w['root_frame'][i] + if tag.startswith('new_restore:'):return bynew[int(tag.split(':')[1])]['new_endpoint'] + if tag.startswith('old_restore:'):return 'REST:'+tag.split(':')[1] + if tag.startswith('partner_setup:'): + i=int(tag.split(':')[1]);return setup_frames.get(i,partner_by_root[i]['mix_frame']) + if tag.startswith('partner_delivery:'): + _,ii,tt=tag.split(':');i,t=int(ii),int(tt) + if changed and mutation!='omit_partner_promotion' and i in byblocker and t==byblocker[i]['target']:return byblocker[i]['promoted_blocker_frame'] + return partner_by_root[i]['deliver_frame'] + return 'FULL' + def check(events,changed): + state=dict(initial);hist=Counter();paths={x:[initial[x]]for x in affected} + def move(x,f): + if x not in affected:return + a=state[x];assert sub(a,f),('nonnested',changed,x,a,f) + ann(f);delta=dims[f]-dims[a] + if delta:hist[delta]+=1;paths[x].append(f) + state[x]=f + for a,b,c,tag in events: + f=frame(tag,changed);move(a,f);move(b,f) + for x in affected: + endpoint='FULL'if x<1760 or x>=3520 else 'CAP:'+str(x-V) + if x in oldr and not(changed and x in undo and mutation!='omit_old_undo'):endpoint='REST:'+str(x) + if changed: + match=next((z for z in sel if sid(z['helper'])==x),None) + if match:endpoint=match['new_endpoint'] + move(x,endpoint) + return hist,paths + oldH,oldP=check(old,False);newH,newP=check(new,True) + delta=Counter(newH);delta.subtract(oldH);delta={r:c for r,c in delta.items()if c} + assert delta=={1:18,2:-12},delta + byrole=[] + for x in sorted(affected): + if oldP[x]!=newP[x]: + byrole.append(dict(stream=x,before_frames=oldP[x],after_frames=newP[x], + before_dimensions=[dims[f]for f in oldP[x]],after_dimensions=[dims[f]for f in newP[x]])) + return dict(status='PASS_MEASURED_AFFECTED_SUFFIX_FRAME_LEDGER',source_head='5f6bd3fbc0e6796dd31263cef1f06dc968186f64', + affected_streams=len(affected),changed_paths=len(byrole),exact_rational_containment_checks=len(containment), + affected_helper_descent_overlaps=0,partner_setup_descent_replacements_applied=len(setup_frames), + old_histogram=dict(oldH),new_histogram=dict(newH),local_histogram_delta=delta, + both_reflected_ledgers=True,reflected_justification='For each nested frame pair A⊂B, the annihilator inclusion reverses and the codimension drop equals the dimension gain.', + paths=byrole,seconds=time.monotonic()-start, + scope='Chronological required-frame census of all affected helper, source-carrier and target streams. Targets start at ZERO for this difference census; their unchanged prior prefixes terminate within the checked first unchanged precursor frame, under retained source admission. Helper prefix frames are read from the actual base forward word and no affected helper overlaps descent changes; all 12 selected partner setups use their verified post-descent rank-22 frames. No global finite/compiler replay is claimed.') + +if __name__=='__main__': + if not __debug__:raise RuntimeError('Assertions required') + r=run() + print(json.dumps({k:v for k,v in r.items()if k!='paths'},indent=2)) diff --git a/research/gen5b-coretime12/exact_geometry.py b/research/gen5b-coretime12/exact_geometry.py new file mode 100644 index 0000000000..e4bbb9d0d9 --- /dev/null +++ b/research/gen5b-coretime12/exact_geometry.py @@ -0,0 +1,57 @@ +"""Original exact weighted-frame linear algebra over rational numbers. +Prepared with substantial OpenAI assistance. Apache-2.0. +""" +from fractions import Fraction as Q +from math import gcd,lcm +def transpose(A):return list(map(list,zip(*A))) + + +def eye(n):return [[Q(i==j)for j in range(n)]for i in range(n)] + + +def add(A,B,c=1):return [[x+c*y for x,y in zip(a,b)]for a,b in zip(A,B)] + + +def mul(A,B): + cols=transpose(B) + return [[sum((x*y for x,y in zip(row,col)if x and y),Q(0))for col in cols]for row in A] + + +def echelon(A): + A=[[Q(x)for x in row]for row in A];piv=[];n=len(A) + if not n:return A,piv + for j in range(len(A[0])): + k=next((k for k in range(len(piv),n)if A[k][j]),None) + if k is None:continue + i=len(piv);A[i],A[k]=A[k],A[i];c=A[i][j];A[i]=[x/c for x in A[i]] + for k in range(n): + if k!=i and A[k][j]: + c=A[k][j];A[k]=[x-c*y for x,y in zip(A[k],A[i])] + piv.append(j) + if len(piv)==n:break + return A,piv + + +def inv(A): + n=len(A);B,p=echelon([a+b for a,b in zip(A,eye(n))]);assert p[:n]==list(range(n)) + return [r[n:]for r in B] + + +def projector(ann): + # G=I-J/9; its inverse is I-J/15 in dimension24. + I=eye(24);Gi=[[I[i][j]-Q(1,15)for j in range(24)]for i in range(24)] + A=[[Q(x)for x in row]for row in ann] + gram=mul(mul(A,Gi),transpose(A));gram_inv=inv(gram) + return add(I,mul(mul(mul(Gi,transpose(A)),gram_inv),A),-1) + + +def integer_columns(A,count): + _,p=echelon(A);assert len(p)==count + out=[] + for j in p: + col=[row[j]for row in A];den=lcm(*(x.denominator for x in col)) + col=[int(x*den)for x in col];g=0 + for x in col:g=gcd(g,abs(x)) + out.append([x//g for x in col]) + return out,p + diff --git a/research/gen5b-coretime12/exact_intervals.py b/research/gen5b-coretime12/exact_intervals.py new file mode 100644 index 0000000000..e28b500b2b --- /dev/null +++ b/research/gen5b-coretime12/exact_intervals.py @@ -0,0 +1,77 @@ +"""Original rational log/exp enclosures; upstream programs are never run. + +Atanh series uses 64 terms and an explicit positive tail. Exponential series +uses 32 terms with a geometric upper bound for its tail, on arguments <= 1. +Prepared with substantial OpenAI assistance. Apache-2.0. +""" +from fractions import Fraction as F +from decimal import Decimal, localcontext +from functools import lru_cache +GRID=10**50 +def floor_grid(x): + return F((x * GRID).numerator // (x * GRID).denominator, GRID) + + +def ceil_grid(x): + return -floor_grid(-x) + + +@lru_cache(None) +def log_interval(x): + """ln(x), x>=1, binary reduction and 64-term positive atanh series.""" + x = F(x) + if x < 1: + raise ValueError('log argument must be at least one') + k = 0 + while x >= 2: + x /= 2 + k += 1 + def short(y): + z = (y - 1) / (y + 1) + power, total = z, F(0) + for j in range(64): + total += 2 * power / (2*j + 1) + power *= z*z + return total, total + 2*power / (129*(1-z*z)) + lo, hi = short(x) + a, b = short(F(2)) + return floor_grid(lo+k*a), ceil_grid(hi+k*b) + + +def exp_interval(lo, hi): + if not 0 <= lo <= hi <= 1: + raise ValueError('exponential interval is outside certified range') + def poly(x): + term = total = F(1) + for n in range(1, 33): + term = term*x/n + total += term + return total, term + low, _ = poly(lo) + high, term = poly(hi) + tail = (term*hi/33) / (1-hi/34) + return floor_grid(low), ceil_grid(high+tail) + + +def moment_interval(m, W, histogram, a): + W, a = F(W), F(a) + if not isinstance(m, int) or m <= 1 or W <= 0 or not 0 <= a < 1: + raise ValueError('invalid moment dimensions or exponent') + lo = hi = F(0) + for r, n in histogram.items(): + if not isinstance(r, int) or not 0 < r < m or F(n) <= 0: + raise ValueError('invalid positive-rank child') + L, U = log_interval(F(m,r)) + E, G = exp_interval(a*L,a*U) + weight = F(n)*r/(m*W) + lo += weight*E + hi += weight*G + return lo, hi + + +def dec(x): + x = F(x) + with localcontext() as c: + c.prec = 45 + return str(Decimal(x.numerator)/Decimal(x.denominator)) + diff --git a/research/gen5b-coretime12/fetch_inputs.py b/research/gen5b-coretime12/fetch_inputs.py new file mode 100644 index 0000000000..a535d386af --- /dev/null +++ b/research/gen5b-coretime12/fetch_inputs.py @@ -0,0 +1,34 @@ +"""Download only hash-pinned public data; no upstream program is executed.""" +import argparse +from pathlib import Path +import urllib.request + +from source_data import MANIFEST, verify_bytes + + +def fetch(destination): + destination = Path(destination).expanduser().resolve() + prefix = ('https://raw.githubusercontent.com/' + MANIFEST['repository'] + '/' + + MANIFEST['commit'] + '/' + MANIFEST['package'] + '/') + for name, pin in MANIFEST['files'].items(): + target = destination / name + if target.exists(): + verify_bytes(name, target.read_bytes()) + print('Verified existing ' + name) + continue + with urllib.request.urlopen(prefix + name, timeout=60) as response: + data = response.read(pin['bytes'] + 1) + verify_bytes(name, data) + target.parent.mkdir(parents=True, exist_ok=True) + # Exclusive creation avoids replacing a file written during download. + with target.open('xb') as output: + output.write(data) + print('Verified downloaded ' + name) + return destination + + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--destination', type=Path, required=True) + args = parser.parse_args() + print('Input directory: ' + str(fetch(args.destination))) diff --git a/research/gen5b-coretime12/finite_bill.py b/research/gen5b-coretime12/finite_bill.py new file mode 100644 index 0000000000..d74463da3c --- /dev/null +++ b/research/gen5b-coretime12/finite_bill.py @@ -0,0 +1,72 @@ +"""Original changed-obligation check for the retained finite bill. + +Constants and formulas are independently transcribed from pinned PR299. +Unchanged all-size interfaces and original norm bounds remain hypotheses. +""" +from pathlib import Path +from fractions import Fraction as F +import json,hashlib +import source_data as sd + +def ceil(x):return -((-x.numerator)//x.denominator) +def cutoff(delta,C): + assert 00 + return max(1,ceil(36/delta**2),ceil(F(2*(4+(C-1).bit_length()),1)/delta)) + +def serial(x): + if isinstance(x,F):return str(x) + if isinstance(x,dict):return {str(k):serial(v)for k,v in x.items()} + if isinstance(x,(list,tuple)):return [serial(v)for v in x] + return x + +def run(chart,norm,math): + pins=sd.read_json('expected/kernel-pins.json') + assert chart['charts']==18 and chart['max_changed_chart_factors']==142 + assert norm['status']=='PASS_EXACT_SCALAR_NORM_TRANSPORT' + m=120;R=pins['physical_R'];v=1760;T=60;stock=math['literal_stock'];d=m*m;N=2*m + assert R==15427 and stock==1229735 + E=T*math['calls'];mass=T*math['rank_mass'];assert m*stock-mass==264000 + assert math['calls']==482665 and math['rank_mass']==2455070 + weighted=T*(5*pins['scalar_events']+6*v) + unit=T*(5*pins['literal_unit_additions']+6*v) + J=T*(24*v+10*R);good=8*m*m+8;high=16*(d+1)**2 + K=600*((stock-1)+R*120*chart['combined_normalizer_factor_bound']) + assert K==chart['selector_calls_bound']==905994200400<2**40 + coefficient=unit+J*high+J*(stock+24)+E*good+E*(128*N**3)+16*m**3+120*T+E+K+1 + assert coefficient<2**80 and 2*m**3*10**16<2**80 and stock+24<2**80 + # Use the independent conservative factor-two norm transport, even though + # the bridge worker separately checks the stronger unchanged majorant. + payload=64*(2*pins['forward_max_row_l1'])**3*(2*pins['inverse_max_row_l1'])**2 + assert payload==norm['payload_upper']<2**104 + c=F(math['root_bracket'][0]);moment_upper=F(math['moment_interval'][1]) + delta_tau=1-moment_upper + delta_linear=1-F(mass,m*stock)-F(32*m*E,10**16*stock) + assert delta_tau>0 and delta_linear>0 + chain=[F(384599,10**10)];gaps=[] + for stage in range(3): + prior=chain[-1];a=(1-c)*c+c*prior + ds=dict(atom=c-a,borrowing=1-a-c,remainder=1-a-c*(1-prior),stock=1-c) + delta=min(ds.values());assert prior0 + L=cutoff(delta,coefficient) + assert F(L)*delta**2>=36 and F(L)*delta>=2*(4+(coefficient-1).bit_length()) + gaps.append(dict(stage=stage+1,slacks=ds,minimum=delta,cutoff_log2_at_displayed_coefficient=L)) + chain.append(a) + assert chain==list(map(F,math['assembly']['bootstrap_chain'])) + # Pure rank-2 banks introduce sixty block-separation scalar choices. + max_bank_scalar=max(len(p['widths'])for p in math['packing']['patterns']) + assert max_bank_scalar==60<=m + return dict(status='PASS_CHANGED_FINITE_OBLIGATIONS_UNDER_RETAINED_INTERFACES', + scalar_weighted_additions=weighted,scalar_unit_additions=unit,literal_children=E, + literal_rank_mass=mass,literal_stock=stock,route_families=J, + new_chart_count=18,max_changed_chart_factors=142,max_changed_chart_numerator=11,max_changed_chart_denominator=9, + new_bank_block_scalars_up_to=max_bank_scalar, + scalar_unit_reason='Every block+1 scalar is at most60; chart factor numerators≤11 and denominators≤9. All are units in retained prime characteristic q>2^80.', + normalizer_factor_bound=815,bank_selector_calls=K,displayed_finite_coefficient=coefficient, + coefficient_bits=coefficient.bit_length(),retained_coefficient_cap_bits=80, + conservative_payload_upper=payload,payload_bits=payload.bit_length(),retained_payload_cap_bits=104, + bad_fallback_per_child=32*m*m,internal_row_coefficient=14401,external_row_coefficient=20161, + ordinary_degree_gap=F(10**6)-F(51*20161,25),delta_tau_lower=delta_tau,delta_linear=delta_linear, + bootstrap_chain=chain,bootstrap_gaps=gaps, + cutoff_scope='Displayed fixed bill only. The retained theorem rule uses C_full including inherited primitive, wrapper and earlier ordinary-level constants; this check does not assign those unknown constants a value.', + source_head=sd.HEAD,source_pins_sha256=sd.MANIFEST['files']['expected/kernel-pins.json']['sha256']) + diff --git a/research/gen5b-coretime12/inputs.json b/research/gen5b-coretime12/inputs.json new file mode 100644 index 0000000000..e3296fc5d8 --- /dev/null +++ b/research/gen5b-coretime12/inputs.json @@ -0,0 +1,62 @@ +{ + "repository": "CrocSwap/integer-mult-bounds", + "commit": "5f6bd3fbc0e6796dd31263cef1f06dc968186f64", + "package": "research/five-stage-gen5b-kernels-restorations-sinks", + "files": { + "gen5bit/selected/bit/word_p12.json.gz": { + "git_blob": "ad318242f00ab47190660dd57f30e0d1d612f6f8", + "sha256": "f2a8b915209c28812c73a6a51a1b30b9cf830d7e0acbf00e7094b976d513cdb8", + "bytes": 727150 + }, + "gen5bit/selected/bit/frames_p12.json.gz": { + "git_blob": "a558091c81ab56c8a8b74ab3c5ebe28b2a1d9694", + "sha256": "c5e9eadf7ea06cefcb31f94f00b99c9cf3b850231af222bc88efee51f5d01295", + "bytes": 297501 + }, + "gen5bit/selected/bit/graph_p12.json": { + "git_blob": "d25a5f7be51c6a064a30a210c0aac3811e44e9f1", + "sha256": "73814dd03979f08b13cf981a30b56dc9b8127f618162407b815009e44298cb00", + "bytes": 927750 + }, + "gen5bit/selected/bit/kchron_p12.json": { + "git_blob": "f8295fab205a81dfdf2612e9b37ef536aea952e7", + "sha256": "e28cd9e9842605af568eea62203a15c48fb08a92e99b38a3480f2fe462d8e1b4", + "bytes": 226522 + }, + "gen5bit/selected/bit/profile_p12.json": { + "git_blob": "f00ab5c99495fd3912dd8c744e0611bdbf3d9753", + "sha256": "bcfebb851f1d2e91c604867da2235d83f36f3d591a14d113a4aab734417b3c0b", + "bytes": 917 + }, + "restore-selection.json": { + "git_blob": "118ea83e27fc4cb51c28fcef6ce96a8aa076c834", + "sha256": "494885a7c371c60c29c7dc8add574c589be9705f4299fcf1f64138bdd7878f7b", + "bytes": 808745 + }, + "kernel-selection.json": { + "git_blob": "32afa7b3dbab3b661c47cb0b84b9a038fa0e133b", + "sha256": "cf4321ad481b99a59a6e0e022a770d55da9ecc69070ca203398ff615181880a9", + "bytes": 873734 + }, + "target-selection.json": { + "git_blob": "e43472750bb21afca82c3f0853a8f3e64792affe", + "sha256": "2feaa1d43d663f3360722f5377824ca2e9f31ac52294827c2f753cf95f82a4ea", + "bytes": 1040746 + }, + "sink-selection.json": { + "git_blob": "7112747fca58dfa86ed38da6a994c21b92f4594e", + "sha256": "9909ec8ecbbf28fb0f6b22af7e4d3a7cf83a6af9e8d4b8545940389d11de1efb", + "bytes": 31837 + }, + "expected/kernel-pins.json": { + "git_blob": "f66743863692473f2862792eaa13ca28cb125b27", + "sha256": "bdc0cb4aebaa9c1209c0598f14f69df4e0489e65b2208d0c51f7a3aaee1f1a77", + "bytes": 2937 + }, + "descent-selection.json": { + "git_blob": "d204e192f859a2055e9b1947a7709ec275904953", + "sha256": "f68d5a0949e22e4f4ddc8da915caa4a1b30919e25ae1ce956ddd7ce4fb18bfd8", + "bytes": 4225342 + } + } +} diff --git a/research/gen5b-coretime12/packing.py b/research/gen5b-coretime12/packing.py new file mode 100644 index 0000000000..b966e6d584 --- /dev/null +++ b/research/gen5b-coretime12/packing.py @@ -0,0 +1,51 @@ +"""Original exact primal/dual width-120 bank inventory checker. + +No geometry or chronological admission is implied by a packing witness. +Prepared with substantial OpenAI assistance. Apache-2.0. +""" +from collections import Counter +from fractions import Fraction as F +import source_data as sd +def verify(capacity,demand,patterns): + assert type(capacity)is int and capacity>0 + assert all(type(r)is int and 00 for r,n in demand.items()) + supplied=Counter();bins=0;waste=0 + for row in patterns: + count=row['count'];widths=row['widths'] + assert type(count)is int and count>0 + assert all(type(r)is int and 01 + while hi-lo>1: + mid=(lo+hi)//2;L,U=old.moment(H,120,W,F(mid,scale)) + if U<1:lo=mid + elif L>1:hi=mid + else:raise ArithmeticError('More interval precision required') + c=F(lo,scale);upper=F(hi,scale) + return c,upper,old.moment(H,120,W,c),old.moment(H,120,W,upper) + +def reprice(local_histogram_delta,role_rank_count_delta,patterns=None): + if any(type(r)is not int or type(n)is not int or r<=0 or r>=120 for D in (local_histogram_delta,role_rank_count_delta)for r,n in D.items()): + raise ValueError('Deltas require positive integer ranks and integer counts') + old.source_integrity();H,_=old.final_histogram() + H.update({r:5*n for r,n in local_histogram_delta.items()}) + if any(n<0 for n in H.values()):raise ValueError('Negative child count') + H=Counter({r:n for r,n in H.items()if n}) + original=packing.calculate()['stage_certificate'];demand=original['demand'].copy() + for r,n in role_rank_count_delta.items():demand[r]=demand.get(r,0)+60*n + if any(n<0 for n in demand.values()):raise ValueError('Negative residual demand') + demand={r:n for r,n in demand.items()if n} + if patterns is None:patterns=pure_retile(role_rank_count_delta) + witness=packing.verify(120,demand,patterns) + stock=422400+5*witness['feasible_bins'];W=F(stock,60) + c,upper,L,U=moment_root(H,W);b=F(754736418878859,10**18) + chain=[F(384599,10**10)] + for i in range(3):chain.append((1-c)*c+c*chain[-1]) + eta=F(1,10**12);beta=F(1,10**9) + if not chain[-1]<(1-beta)*b: + raise ValueError('Complex side now binds: this narrow repricer needs a revised bootstrap/backoff policy') + q=chain[-1]*(1-2*eta);G=(1-eta)*q/(1+q);ticks=G*10**18 + k=F((ticks.numerator-1)//ticks.denominator,10**18) + assembly=old.assembly(c,b,k) + return dict(status='CONDITIONAL_ARITHMETIC_ONLY',physical_admission=False, + local_histogram_delta=local_histogram_delta,role_rank_count_delta=role_rank_count_delta, + histogram=dict(sorted(H.items())),calls=sum(H.values()),rank_mass=old.rank(H), + literal_stock=stock,unreplicated_stock=W,deficit=120*W-old.rank(H), + packing=witness,root_bracket=[c,upper],moment_interval=L,adjacent_moment_interval=U, + kappa=k,kappa_decimal=old.ex.dec(k),assembly=assembly) diff --git a/research/gen5b-coretime12/run_checks.py b/research/gen5b-coretime12/run_checks.py new file mode 100644 index 0000000000..0e3536dcb1 --- /dev/null +++ b/research/gen5b-coretime12/run_checks.py @@ -0,0 +1,116 @@ +"""Reproduce the independently authored changed-stage checks and exact pricing.""" +import argparse +import hashlib +import json +from pathlib import Path + +import assembly_arithmetic as arithmetic +import baseline_arithmetic as baseline +import chart_bounds +import check_bank_assignment +import check_complete_suffix +import check_coretime +import check_suffix_frames +import reprice +import finite_bill +import scalar_norm_transport +import source_data + +HERE = Path(__file__).resolve().parent + + +def compact_charts(value): + value = dict(value) + programs = value.pop('factor_programs') + value['chart_summaries'] = [] + for program in programs: + summary = {key: item for key, item in program.items() + if key not in ('basis_columns', 'factors')} + data = json.dumps(arithmetic.serial(program), sort_keys=True, + separators=(',', ':')).encode() + summary['factor_program_sha256'] = hashlib.sha256(data).hexdigest() + value['chart_summaries'].append(summary) + return value + + +def run(output_dir=None, write_streams=False): + source_data.verify_all() + local = check_coretime.run(minimal=True) + suffix = check_complete_suffix.run(output_dir if write_streams else None) + frames = check_suffix_frames.run() + transport = scalar_norm_transport.run() + charts = chart_bounds.run() + banks = check_bank_assignment.run(output_dir) + priced = reprice.reprice(frames['local_histogram_delta'], + local['residual_rank_count_delta']) + assert banks['family_counts'] == {rank:count//60 for rank,count in priced['packing']['demand'].items()} + assert banks['literal_stock'] == priced['literal_stock'] + pins = source_data.read_json('expected/kernel-pins.json') + assert priced['literal_stock'] == pins['literal_stock'] + local['literal_stock_delta'] + assert transport['source_hashes']['original_suffix'] == suffix['original_suffix_sha256'] + assert transport['source_hashes']['modified_suffix'] == suffix['modified_suffix_sha256'] + assert charts['selector_calls_bound'] < 2 ** 40 + assert transport['payload_upper'] < 2 ** 104 + assert priced['kappa'] == arithmetic.F(749906929903449, 10 ** 18) + priced['source_head'] = source_data.HEAD + priced['binding'] = 'Measured chronological frame delta and exact selected endpoint residual changes.' + priced['prior_kappa'] = arithmetic.F(pins['kappa']) + priced['kappa_gain'] = priced['kappa'] - priced['prior_kappa'] + finite = finite_bill.run(charts, transport, arithmetic.serial(priced)) + results = {'local': local, 'suffix': suffix, 'frames': frames, + 'scalar-transport': transport, 'charts': compact_charts(charts), + 'pricing': priced, 'finite-bill': finite, 'banks': banks} + results['summary'] = { + 'status': 'PASS_CHANGED_STAGE_CHECKS_CONDITIONAL_ON_PINNED_BASE', + 'source_head': source_data.HEAD, + 'new_restorations': local['selected'], + 'old_restorations_undone': local['undone_old_restorations'], + 'kappa': str(priced['kappa']), + 'kappa_decimal': priced['kappa_decimal'], + 'literal_stock': priced['literal_stock'], + 'paid_calls': priced['calls'], + 'rank_mass': priced['rank_mass'], + 'deficit': str(priced['deficit']), + 'full_inherited_admission_replayed': False, + 'all_size_theorem_verified': False, + 'verification_limits': [ + 'The pinned PR299 unchanged prefix and its original admission remain hypotheses.', + 'Unchanged finite compiler, weighted chart, routing, prime and setup contracts are inherited.', + 'Changed charts, selector bound and scalar payload bound are checked here; the complete inherited finite compiler is not rerun.', + 'Outer positive literal and row-gap inputs remain conditional on the inherited finite bridge.', + 'No full all-size or machine-verification claim is made.' + ]} + for name, result in results.items(): + result.pop('seconds', None) + # Normalize integer map keys to their JSON representation before comparing. + results[name] = json.loads(json.dumps(arithmetic.serial(result))) + if output_dir is not None: + output_dir = Path(output_dir) + output_dir.mkdir(parents=True, exist_ok=True) + for name, result in results.items(): + (output_dir / (name + '.json')).write_text(json.dumps(result, indent=2) + '\n') + (output_dir / 'chart-factor-programs.json').write_text( + json.dumps(arithmetic.serial(charts['factor_programs']), indent=2) + '\n') + return results + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--output-dir', type=Path) + parser.add_argument('--write-streams', action='store_true') + parser.add_argument('--check', action='store_true', + help='Compare every regenerated receipt with the committed certificates') + args = parser.parse_args() + if args.write_streams and args.output_dir is None: + parser.error('--write-streams requires --output-dir') + results = run(args.output_dir, args.write_streams) + if args.check: + for name, actual in results.items(): + expected = json.loads((HERE / 'certificates' / (name + '.json')).read_text()) + if actual != expected: + raise ValueError('Certificate drift: ' + name) + print(json.dumps(results['summary'], indent=2)) + + +if __name__ == '__main__': + main() diff --git a/research/gen5b-coretime12/scalar_norm_transport.py b/research/gen5b-coretime12/scalar_norm_transport.py new file mode 100644 index 0000000000..a97c805c36 --- /dev/null +++ b/research/gen5b-coretime12/scalar_norm_transport.py @@ -0,0 +1,69 @@ +"""Original exact trace-commutation check and conservative scalar norm transport. + +If all swaps commute and each destination's update order changes by moving only +one unit-coefficient update, each new row lies on the old row trajectory or is +one old row plus/minus one old source row. Both forward and inverse maxima grow +by at most two. Upstream programs are never executed. +""" +from pathlib import Path +from collections import defaultdict,deque,Counter +import gzip,json,hashlib,time +ROOT=Path(__file__).resolve().parent +import check_complete_suffix as scalar +import source_data as sd + +def check(old,new): + assert Counter(tuple(z[:3])for z in old)==Counter(tuple(z[:3])for z in new) + buckets=defaultdict(deque) + for i,z in enumerate(old):buckets[tuple(z[:3])].append(i) + desired=[buckets[tuple(z[:3])].popleft()for z in new] + assert len(set(desired))==len(old) + old_rows=defaultdict(list);new_rows=defaultdict(list) + for i,z in enumerate(old):old_rows[z[0]].append(i) + for i in desired:new_rows[old[i][0]].append(i) + changed=[] + for dest,seq in old_rows.items(): + target=new_rows[dest] + if seq==target:continue + # No quadratic search over all updates: only at most three updates + # are expected on affected targets; still test the literal sequences. + chosen=next((x for x in seq if abs(old[x][2])==1 and + [i for i in seq if i!=x]==[i for i in target if i!=x]),None) + assert chosen is not None,('more than one update moved on row',dest) + changed.append(dict(destination=dest,moved_old_event=chosen, + moved_gate=old[chosen][:3],old_order=seq,new_order=target)) + current=list(range(len(old)));pos=current[:];swaps=0 + for i,wanted in enumerate(desired): + j=pos[wanted];assert j>=i + if j==i:continue + a,b,c=old[wanted][:3] + for k in range(i,j): + token=current[k];d,e,f=old[token][:3] + assert b!=d and e!=a,('noncommuting crossed additions',old[wanted],old[token]) + pos[token]+=1;swaps+=1 + current[i:j+1]=[wanted]+current[i:j];pos[wanted]=i + assert current==desired + return dict(commuting_adjacent_swaps=swaps,destinations_with_changed_update_order=changed, + forward_norm_factor=2,inverse_norm_factor=2) + +def run(): + start=time.monotonic();_,old,new,_=scalar.build() + certificate=check(old,new) + assert len(certificate['destinations_with_changed_update_order'])==12 + pins=sd.read_json('expected/kernel-pins.json') + old_forward=pins['forward_max_row_l1'];old_inverse=pins['inverse_max_row_l1'] + assert (old_forward,old_inverse)==(77985,2475558) + forward=2*old_forward;inverse=2*old_inverse;payload=64*forward**3*inverse**2 + assert payload<2**104 + return dict(status='PASS_EXACT_SCALAR_NORM_TRANSPORT',suffix_additions=len(old), + **certificate,original_forward_bound=old_forward,original_inverse_bound=old_inverse, + new_forward_bound=forward,new_inverse_bound=inverse,payload_upper=payload, + payload_bits=payload.bit_length(),retained_payload_cap_bits=104, + unchanged_literal_scalar_multiset=True, + source_hashes={name:hashlib.sha256(json.dumps(events,separators=(',',':')).encode()).hexdigest()for name,events in [('original_suffix',old),('modified_suffix',new)]}, + theorem='Commuting swaps preserve each source value sampled by a gate. Every unchanged destination update sequence has the old row-value trajectory. Each changed destination order moves one unit update; at intermediate cuts its row is an old row plus or minus that same old source row. Reversing both schedules gives the identical property. The unchanged prefix is composed using the retained old global row-norm bounds.', + scope='Changed scalar suffix and retained old prefix bounds only. Address geometry and inherited finite compiler hypotheses are separate.',seconds=time.monotonic()-start) + +if __name__=='__main__': + x=run() + print(x['status'],'swaps',x['commuting_adjacent_swaps'],'changed row orders',len(x['destinations_with_changed_update_order']),'payload bits',x['payload_bits'],'seconds',x['seconds']) diff --git a/research/gen5b-coretime12/source_data.py b/research/gen5b-coretime12/source_data.py new file mode 100644 index 0000000000..0d4d8f28d4 --- /dev/null +++ b/research/gen5b-coretime12/source_data.py @@ -0,0 +1,49 @@ +"""Read immutable PR #299 data; never import or execute its programs.""" +from pathlib import Path +import gzip +import hashlib +import json +import os + +if not __debug__: + raise RuntimeError('Run without -O; certificate assertions must remain enabled.') + +HERE = Path(__file__).resolve().parent +MANIFEST = json.loads((HERE / 'inputs.json').read_text()) +HEAD = MANIFEST['commit'] + + +def source_root(): + value = os.environ.get('CORETIME_SOURCE_DIR') + if not value: + raise RuntimeError('Set CORETIME_SOURCE_DIR to the pinned input directory; see README.md.') + return Path(value).expanduser().resolve() + + +def verify_bytes(name, data): + pin = MANIFEST['files'][name] + if len(data) != pin['bytes'] or hashlib.sha256(data).hexdigest() != pin['sha256']: + raise ValueError('Pinned input bytes changed: ' + name) + blob = hashlib.sha1(b'blob ' + str(len(data)).encode() + b'\0' + data).hexdigest() + if blob != pin['git_blob']: + raise ValueError('Pinned Git blob changed: ' + name) + return data + + +def read_bytes(name): + if name not in MANIFEST['files']: + raise ValueError('Unpinned input: ' + name) + return verify_bytes(name, (source_root() / name).read_bytes()) + + +def read_json(name): + data = read_bytes(name) + if name.endswith('.gz'): + data = gzip.decompress(data) + return json.loads(data) + + +def verify_all(): + for name in MANIFEST['files']: + read_bytes(name) + return len(MANIFEST['files']) diff --git a/research/gen5b-coretime12/test_bank_assignment.py b/research/gen5b-coretime12/test_bank_assignment.py new file mode 100644 index 0000000000..60de45aa65 --- /dev/null +++ b/research/gen5b-coretime12/test_bank_assignment.py @@ -0,0 +1,32 @@ +import unittest + +import check_bank_assignment as banks + + +class BankAssignmentTests(unittest.TestCase): + @classmethod + def setUpClass(cls): + cls.result = banks.run() + + def test_complete_role_and_replica_bijection(self): + x = self.result + self.assertEqual(x['helper_roles'], 15427) + self.assertEqual(x['checked_role_replica_assignments_per_stage'], 925620) + self.assertEqual(x['total_stage_assignments'], 4628100) + self.assertTrue(x['stages_have_disjoint_bank_namespaces']) + + def test_frozen_assignment_and_stock(self): + x = self.result + self.assertEqual(x['assignment_sha256'], + '0317c568260dafde4cbc6ac1b88cae8afaa66d164ea454c372c01ea551af5f5b') + self.assertEqual(x['banks_per_stage'], 161467) + self.assertEqual(x['literal_stock'], 1229735) + self.assertTrue(x['all_banks_full']) + + def test_duplicated_role_rejected(self): + with self.assertRaisesRegex(AssertionError, 'Missing or duplicated helper role'): + banks.run(mutation='duplicate_role') + + +if __name__ == '__main__': + unittest.main() diff --git a/research/gen5b-coretime12/test_chart_bounds.py b/research/gen5b-coretime12/test_chart_bounds.py new file mode 100644 index 0000000000..3b749700e3 --- /dev/null +++ b/research/gen5b-coretime12/test_chart_bounds.py @@ -0,0 +1,26 @@ +from fractions import Fraction as F +import unittest +import chart_bounds as c + +class ChartTests(unittest.TestCase): + def test_identity(self): + r=c.factor([[1,0],[0,1]]) + self.assertEqual(r['count'],0);self.assertEqual(r['determinant'],1) + def test_exact_nontrivial_factorization(self): + r=c.factor([[1,2],[3,5]]) + self.assertEqual(r['determinant'],-1) + self.assertGreater(r['count'],0) + def test_singular_rejected(self): + with self.assertRaises(StopIteration):c.factor([[1,2],[2,4]]) + def test_integer_nullspace(self): + A=[[1,2,3],[2,4,6]];B=c.nullspace(A,3) + self.assertEqual(len(B),2) + self.assertTrue(all(sum(x*y for x,y in zip(a,b))==0 for a in A for b in B)) + def test_all_actual_charts(self): + r=c.run();self.assertEqual(r['charts'],18) + self.assertEqual(r['max_changed_chart_factors'],142) + self.assertEqual(r['max_factor_numerator'],11) + self.assertEqual(r['max_factor_denominator'],9) + self.assertEqual(r['selector_calls_bound'],905994200400) + +if __name__=='__main__':unittest.main(verbosity=2) diff --git a/research/gen5b-coretime12/test_coretime.py b/research/gen5b-coretime12/test_coretime.py new file mode 100644 index 0000000000..26acf83d02 --- /dev/null +++ b/research/gen5b-coretime12/test_coretime.py @@ -0,0 +1,35 @@ +import unittest +import check_coretime as c + +class TestCoretime(unittest.TestCase): + @classmethod + def setUpClass(cls):cls.result=c.run() + def test_selected_and_lost(self): + self.assertEqual((self.result['selected'],self.result['undone_old_restorations']),(32,26)) + def test_exact_integer_identity(self): + self.assertTrue(self.result['exact_integer_root_schedule_identity']) + self.assertTrue(self.result['missing_restoration_control_rejected']) + def test_net_histogram(self): + self.assertEqual(self.result['local_histogram_delta'],{1:-46,2:20}) + self.assertEqual(self.result['residual_rank_count_delta'],{2:32,3:-58,4:26}) + def test_conflicts_explicit(self): + self.assertEqual({z['helper']for z in self.result['rejected']},{16485,16709}) + def test_exact_source_spans(self): + self.assertTrue(all(z['source_union_size']==180 for z in self.result['candidates'])) + def test_wrong_promoted_frame_rejected(self): + with self.assertRaisesRegex(AssertionError,'Promoted delivery outside target cap'): + c.run('wrong_promoted_frame') + def test_missing_old_undo_rejected(self): + with self.assertRaisesRegex(AssertionError,'Missing old restoration undo'): + c.run('omit_old_restoration_undo') + def test_shared_blocker_rejected(self): + with self.assertRaisesRegex(AssertionError,'Shared blocker'): + c.run('shared_blocker') + def test_incompatible_prefix_rejected(self): + with self.assertRaisesRegex(AssertionError,'Prefix closing frame outside common frame'): + c.run('incompatible_prefix') + def test_kernel_donor_overlap_disclosed(self): + self.assertEqual({r['donor']for r in self.result['kernel_donor_contracts']}, + {12649,12678,8811,11313,11329}) + +if __name__=='__main__':unittest.main() diff --git a/research/gen5b-coretime12/test_finite_bill.py b/research/gen5b-coretime12/test_finite_bill.py new file mode 100644 index 0000000000..d71471a416 --- /dev/null +++ b/research/gen5b-coretime12/test_finite_bill.py @@ -0,0 +1,23 @@ +from fractions import Fraction as F +import unittest + +import finite_bill + + +class FiniteBillTests(unittest.TestCase): + def test_explicit_cutoff_inequalities(self): + for delta in (F(1), F(1, 100), F(1, 10 ** 20)): + for coefficient in (1, 90386288803484701): + cutoff = finite_bill.cutoff(delta, coefficient) + self.assertGreaterEqual(F(cutoff) * delta ** 2, 36) + self.assertGreaterEqual(F(cutoff) * delta, + 2 * (4 + (coefficient - 1).bit_length())) + + def test_invalid_gap_rejected(self): + for delta in (F(0), F(-1), F(2)): + with self.assertRaises(AssertionError): + finite_bill.cutoff(delta, 1) + + +if __name__ == '__main__': + unittest.main() diff --git a/research/gen5b-coretime12/test_pipeline.py b/research/gen5b-coretime12/test_pipeline.py new file mode 100644 index 0000000000..018f181708 --- /dev/null +++ b/research/gen5b-coretime12/test_pipeline.py @@ -0,0 +1,71 @@ +"""Independent local and complete-suffix controls for the 12-helper exchange.""" +from collections import Counter +import unittest + +import check_coretime +import check_complete_suffix as scalar +import check_suffix_frames as frames + + +class PipelineTests(unittest.TestCase): + @classmethod + def setUpClass(cls): + cls.local = check_coretime.run(minimal=True) + cls.size, cls.before, cls.after, cls.scalar = scalar.build() + + def test_minimal_selection(self): + self.assertEqual(self.local['selected'], 12) + self.assertEqual(self.local['undone_old_restorations'], 6) + groups = Counter(z['old_restored_helper_stream'] for z in self.local['candidates']) + self.assertEqual(set(groups.values()), {2}) + + def test_integer_local_map(self): + self.assertTrue(self.local['exact_integer_root_schedule_identity']) + self.assertTrue(self.local['missing_restoration_control_rejected']) + + def test_all_columns_forward(self): + self.assertEqual(self.size, 18954) + self.assertEqual(scalar.evaluate(self.before, self.size), + scalar.evaluate(self.after, self.size)) + + def test_all_columns_reverse(self): + self.assertEqual(scalar.evaluate(self.before, self.size, True), + scalar.evaluate(self.after, self.size, True)) + + def test_exact_integer_operators_and_majorants(self): + for reverse in (False, True): + for absolute in (False, True): + self.assertEqual(scalar.integer_operator(self.before, self.size, reverse, absolute), + scalar.integer_operator(self.after, self.size, reverse, absolute)) + + def test_complete_scalar_multiset(self): + self.assertEqual(len(self.before), 55985) + self.assertEqual(Counter(x[:3] for x in self.before), + Counter(x[:3] for x in self.after)) + self.assertEqual(self.scalar['co_retimed_partner_deliveries'], 12) + + def test_missing_restoration_is_detected(self): + bad = self.after[:] + index = next(i for i, row in enumerate(bad) if row[3].startswith('new_restore:')) + del bad[index] + self.assertNotEqual(scalar.evaluate(self.before, self.size), + scalar.evaluate(bad, self.size)) + + def test_measured_paid_delta(self): + result = frames.run() + self.assertEqual(result['local_histogram_delta'], {1: 18, 2: -12}) + self.assertEqual(result['affected_streams'], 60) + self.assertTrue(result['both_reflected_ledgers']) + self.assertEqual(result['partner_setup_descent_replacements_applied'], 12) + + def test_missing_partner_promotion_rejected(self): + with self.assertRaisesRegex(AssertionError, 'nonnested'): + frames.run('omit_partner_promotion') + + def test_missing_old_restoration_undo_rejected(self): + with self.assertRaises(AssertionError): + frames.run('omit_old_undo') + + +if __name__ == '__main__': + unittest.main() diff --git a/research/gen5b-coretime12/test_pricing.py b/research/gen5b-coretime12/test_pricing.py new file mode 100644 index 0000000000..d1967e8efd --- /dev/null +++ b/research/gen5b-coretime12/test_pricing.py @@ -0,0 +1,51 @@ +from fractions import Fraction as F +import unittest + +import baseline_arithmetic as baseline +import packing +import reprice + + +class PricingTests(unittest.TestCase): + @classmethod + def setUpClass(cls): + cls.result = reprice.reprice({1: 18, 2: -12}, {2: 12, 3: -18, 4: 6}) + + def test_profile_and_packing(self): + x = self.result + self.assertEqual((x['calls'], x['rank_mass'], x['literal_stock']), + (482665, 2455070, 1229735)) + self.assertEqual(x['deficit'], 4400) + self.assertEqual(x['packing']['feasible_bins'], 161467) + self.assertTrue(x['packing']['optimal']) + self.assertEqual(x['packing']['unused_coordinate_capacity'], 0) + + def test_adjacent_moment_bounds(self): + x = self.result + self.assertEqual(x['root_bracket'], + [F(750469712644613, 10 ** 18), F(750469712644614, 10 ** 18)]) + self.assertLess(x['moment_interval'][1], 1) + self.assertGreater(x['adjacent_moment_interval'][0], 1) + + def test_outer_constraints_and_scope(self): + x = self.result + self.assertEqual(x['kappa'], F(749906929903449, 10 ** 18)) + self.assertEqual(len(x['assembly']['strict_constraints']), 47) + self.assertTrue(all(v > 0 for v in x['assembly']['strict_constraints'].values())) + self.assertEqual(x['assembly']['adjacent_grid_rejected'], ['g3_above_kappa']) + self.assertFalse(x['physical_admission']) + + def test_missing_bank_is_rejected(self): + x = self.result['packing'] + patterns = [dict(widths=row['widths'][:], count=row['count']) for row in x['patterns']] + patterns[0]['count'] -= 1 + with self.assertRaises(AssertionError): + packing.verify(120, x['demand'], patterns) + + def test_float_delta_is_rejected(self): + with self.assertRaises(ValueError): + reprice.reprice({1: 18.0}, {}) + + +if __name__ == '__main__': + unittest.main() diff --git a/research/gen5b-coretime12/test_rootcuts.py b/research/gen5b-coretime12/test_rootcuts.py new file mode 100644 index 0000000000..d619f1d891 --- /dev/null +++ b/research/gen5b-coretime12/test_rootcuts.py @@ -0,0 +1,8 @@ +import unittest +import check_rootcuts as c +class TestCutScreen(unittest.TestCase): + def test_rank_empty(self): self.assertEqual(c.rank([]),0) + def test_rank_dependent(self): self.assertEqual(c.rank([[1,2],[2,4]],2),1) + def test_rank_independent(self): self.assertEqual(c.rank([[1,2],[2,5]],2),2) + def test_all_actual_roles(self): self.assertEqual(c.run()['count'],34) +if __name__=='__main__': unittest.main() diff --git a/research/gen5b-coretime12/test_scalar_norm.py b/research/gen5b-coretime12/test_scalar_norm.py new file mode 100644 index 0000000000..b42503bfb5 --- /dev/null +++ b/research/gen5b-coretime12/test_scalar_norm.py @@ -0,0 +1,31 @@ +import unittest + +import scalar_norm_transport as transport + + +class ScalarNormTests(unittest.TestCase): + def test_commuting_same_destination_updates(self): + old = [(0, 1, 1, 'a'), (0, 2, -1, 'b')] + result = transport.check(old, old[::-1]) + self.assertEqual(result['commuting_adjacent_swaps'], 1) + self.assertEqual(result['forward_norm_factor'], 2) + + def test_noncommuting_swap_rejected(self): + old = [(0, 1, 1, 'a'), (1, 2, 1, 'b')] + with self.assertRaisesRegex(AssertionError, 'noncommuting'): + transport.check(old, old[::-1]) + + def test_changed_coefficient_rejected(self): + with self.assertRaises(AssertionError): + transport.check([(0, 1, 1, 'a')], [(0, 1, -1, 'a')]) + + def test_complete_transport(self): + result = transport.run() + self.assertEqual(result['commuting_adjacent_swaps'], 172944) + self.assertEqual(len(result['destinations_with_changed_update_order']), 12) + self.assertEqual(result['payload_bits'], 103) + self.assertLess(result['payload_upper'], 2 ** 104) + + +if __name__ == '__main__': + unittest.main() diff --git a/research/gen5b-coretime12/test_source_data.py b/research/gen5b-coretime12/test_source_data.py new file mode 100644 index 0000000000..57a857209c --- /dev/null +++ b/research/gen5b-coretime12/test_source_data.py @@ -0,0 +1,59 @@ +"""Mutation and portability controls for the immutable input loader.""" +import io +import os +from pathlib import Path +import tempfile +import unittest +from unittest.mock import patch + +import fetch_inputs +import source_data as sd + + +class SourceDataTests(unittest.TestCase): + def test_all_input_pins(self): + self.assertEqual(sd.verify_all(), 11) + + def test_altered_input_rejected(self): + name = 'expected/kernel-pins.json' + with self.assertRaisesRegex(ValueError, 'Pinned input bytes changed'): + sd.verify_bytes(name, sd.read_bytes(name) + b' ') + + def test_unpinned_path_rejected(self): + with self.assertRaisesRegex(ValueError, 'Unpinned input'): + sd.read_bytes('../untrusted.json') + + def test_source_location_is_explicit(self): + with patch.dict(os.environ, {}, clear=True): + with self.assertRaisesRegex(RuntimeError, 'CORETIME_SOURCE_DIR'): + sd.source_root() + + def test_fetch_url_and_exact_bytes(self): + name = 'expected/kernel-pins.json' + raw = sd.read_bytes(name) + manifest = dict(sd.MANIFEST, files={name: sd.MANIFEST['files'][name]}) + with tempfile.TemporaryDirectory() as directory: + with patch.object(fetch_inputs, 'MANIFEST', manifest): + with patch('urllib.request.urlopen', return_value=io.BytesIO(raw)) as request: + fetch_inputs.fetch(directory) + url = request.call_args.args[0] + self.assertIn('/' + sd.HEAD + '/', url) + self.assertTrue(url.endswith('/' + name)) + self.assertEqual((Path(directory) / name).read_bytes(), raw) + with patch('urllib.request.urlopen') as request: + fetch_inputs.fetch(directory) + request.assert_not_called() + + def test_fetch_rejects_corrupted_download(self): + name = 'expected/kernel-pins.json' + manifest = dict(sd.MANIFEST, files={name: sd.MANIFEST['files'][name]}) + with tempfile.TemporaryDirectory() as directory: + with patch.object(fetch_inputs, 'MANIFEST', manifest): + with patch('urllib.request.urlopen', return_value=io.BytesIO(b'{}')): + with self.assertRaisesRegex(ValueError, 'Pinned input bytes changed'): + fetch_inputs.fetch(directory) + self.assertFalse((Path(directory) / name).exists()) + + +if __name__ == '__main__': + unittest.main()