diff --git a/research/p104-shared-residual-relay/LITERAL-CHANGES.diff b/research/p104-shared-residual-relay/LITERAL-CHANGES.diff new file mode 100644 index 0000000000..55eac573d1 --- /dev/null +++ b/research/p104-shared-residual-relay/LITERAL-CHANGES.diff @@ -0,0 +1,31 @@ +--- PR5580/pricing.py ++++ p104-shared-residual-relay/pricing.py +@@ -11,8 +11,8 @@ + from fractions import Fraction as Q + import local as L + +-KAPPA, TESTED = Q('.00308189'), Q('.0030818905') +-PREVIOUS = Q('.00308181') ++KAPPA, TESTED = Q('.00308326'), Q('.0030832605') ++PREVIOUS = Q('.00308189') + + + def encode(x): +@@ -61,7 +61,7 @@ + second_p[8*(j+1)] += 208 + L.need((targets,paid) == (second_t,second_p), 'Independent full invoice') + L.need(max(targets) == 145 and max(paid) == 72, 'Maximum recursive ranks') +- L.need(sum(targets.values()) == 12814 and sum(paid.values()) == 66852, 'Complete field and call counts') ++ L.need(sum(targets.values()) == 12814 and sum(paid.values()) == 66816, 'Complete field and call counts') + L.need(sum(r*n for r,n in targets.items())-sum(r*n for r,n in paid.items()) == 760, 'Complete rank surplus') + return targets,paid,counts + +@@ -139,7 +139,7 @@ + L.need(wrong_cutoff[0] > 1, 'Old cutoff fails with this helper inventory') + bad=outer_module.ledger(dict(params,bit_saving=Q('.0027'))) + L.need(any(x <= 0 for x in bad['strict_checks'].values()), 'Insufficient BIT contract rejected') +- return encode({'kappa':KAPPA,'kappa_decimal':'.00308189','previous_open_pr5569':PREVIOUS,'gain':KAPPA-PREVIOUS, ++ return encode({'kappa':KAPPA,'kappa_decimal':'.00308326','previous_open_pr5580':PREVIOUS,'gain':KAPPA-PREVIOUS, + 'relative_gain_percent':100*(KAPPA/PREVIOUS-1),'raw_root_interval':[lower,upper], + 'raw_headroom':[lower-KAPPA,upper-KAPPA],'margin_at_previous':E.display(margin(PREVIOUS)), + 'targets':T,'paid':P,'productive_fields':sum(T.values()),'paid_calls':sum(P.values()), diff --git a/research/p104-shared-residual-relay/PROOF.md b/research/p104-shared-residual-relay/PROOF.md new file mode 100644 index 0000000000..c3d454dd73 --- /dev/null +++ b/research/p104-shared-residual-relay/PROOF.md @@ -0,0 +1,101 @@ +# A shared dirty public relay for two P104 owned deliveries + +This note describes the scalar and frame mechanism for the exact PR5580 word +at head `6efa248cf456d6101d757e9d09ba29711d18a13a`. Source event numbers below +refer to that word. The scalar argument below is complemented by the package verifier's complete +native, ordinary-cost, productive-credit, caller and analytic predicate checks. +Their inherited theorem assumptions remain as stated in the README. + +Let `P` be the unchanged public row133 copied into owned738. That owned field +holds `-P/2`. Its three higher contacts add `P/2` to159, `-P` to203, and `-P` +to148 before it reaches its final line597. We retain the159 contact and replace +the other two contacts by one joint correction in the later public circuit. + +## The public relay + +The original public row734 at line597 is `x734-P/2`, where `x734` is its +arbitrary original zero-frame input. Public row587 is unchanged before its +first ascent, so after its original ADD from734 it contains + +`x587 - 4 x734 + 2 P = N + 2 P`, with `N = x587 - 4 x734`. + +The last read of587 while it is at zero is source event13610. Consequently +its original events14633–14634 can be moved immediately after13610. The +relay's next original frame773 contains frame652, so split its original +line597-to773 ascent through652. At frame652, immediately after source +event14010, insert `ADD 21,587,+1`. + +An exact rational suffix propagation gives the following useful identity: +omitting the203 and148 owned reads, then inserting `2P` into21 at this +point, leaves every non-full-nine-dimensional final public row unchanged. +The actual relay inserts `2P+N`, so its only remaining error on those rows is +`u N`, where + +`u = (e123 - e148 - e175 - e182 + e203 - e223)/2`. + +This is a joint identity. Neither owned contact is deleted on its own, and +the relay is allowed to change an intermediate public dependency. + +## Exact treatment of the arbitrary nuisance inputs + +No helper input is assumed zero. All six fields in the support of `u` start +at the zero frame. The full unchanged word maps their initial-direction +combination `u` to the same combination on its non-full-nine-dimensional +outputs. Also `N(u)=0`, because `N` uses only input fields587 and734. + +Precompose the word with `I-uN`: for each of those six initial fields, +subtract its coefficient in `u` times `x587-4x734`. Twelve explicit +common-zero-frame ADDs implement this transformation. Its source fields +are disjoint from its destinations, so sequential implementation has no +feedback. The inverse is `I+uN`. This cancels the entire `uN` output error +for arbitrary values of all735 public inputs. + +After this preconditioning, compare the two words immediately before the +original event24461, the first late cleanup update of row133. Exactly six +public rows differ: + +* Rows21 and47 have an extra `P+N/2`. +* Rows434,435,436,437 lack `P+N/2`. + +All six targets and sources133,587,734 are then at the full frame127. +The three sources are exactly `P`, `x587`, `x734`; this is checked from +their full original-input covectors. Eighteen explicit common-frame ADDs +remove the six errors without modifying these sources. The remaining +suffix is unchanged, so every final public row agrees exactly. + +## Transport saving and verification boundary + +Removing the two owned contacts replaces the owned ranks1,3,2 after159 by +one rank6 descent. The new public587 stop replaces one rank3 ascent by +ranks1 and2. This first changes the complete MOVE histogram by `H6-2H3`. + +The removed148 contact also makes its intermediate frame596 unused. Its +original events13416 and14017 are public MOVEs467-to596 and596-to655, +with ranks1 and2. No scalar read or write of148 remains between them. +Remove the first MOVE and replace the second by467-to655, of rank3. A +complete per-role adjacency audit, counting scalar source reads as well as +writes, finds no further unused intermediate MOVE frame in the new word. +The strongest verified complete histogram change is therefore + +`H6 - H1 - H2 - H3`. + +For `H_r(t)=r^t` and `0 2^26*N^5 avoiding all fixed denominators and rank witnesses" + }, + "outer": { + "functional_checks": { + "actual_new_BIT_stock_sublinear": "3485999999253/3500000000000", + "fixed_halo_explicit_metadata_branch": "269500000001/3500000000", + "new_BIT_row_stock_sublinear_in_active_group": "13957999997009/14000000000000", + "new_semantic_group_guard": "3/14000000000" + }, + "margins": { + "boundary_algebraic_matrix": "604319015956834357/196000000000000000000", + "fused_gaussian": "604319015870503071/196000000000000000000", + "global_coordinate_router": "10791411/3500000000", + "group_bit_router": "151079757467625767/49000000000000000000", + "group_scans": "6999999999/7000000000", + "main_transform": "604319001956834357/196000000000000000000", + "microbox_face_corrections": "269500000001/3500000000", + "polynomial_products": "13999999999/14000000000", + "sparse_union_movement": "80229319015956834357/196000000000000000000" + }, + "parameters": { + "a": "10791411/3500000000", + "b": "8633129/2800000000", + "beta": "13999999997/14000000000", + "bit_saving": "17/5000", + "cap_xi": "178229319001956834357/196000000000000000000", + "complex_uniform_saving": "21582823/7000000000", + "d": "1/14000000000", + "epsilon": "13999999999/14000000000", + "kappa": "154163/50000000", + "lambda_": "3987666959/4000000000", + "lambda_prime": "13956834357/14000000000", + "layout": "1/14000000000", + "q": "43165643/14000000000", + "r0": "1/140000000000", + "stop": "1/14000000000", + "tested_saving": "6166521/2000000000" + }, + "strict_checks": { + "actual_bit_above_effective": "1108589/3500000000", + "actual_logarithmic_gamma_guard": "1/14000000000", + "actual_logarithmic_group_guard": "17770681019043165643/98000000000000000000", + "alpha_logarithm_absorption": "1/140000000000", + "boundary_algebraic_matrix_above_kappa": "55956834357/196000000000000000000", + "cap_above_band": "80229319001956834357/196000000000000000000", + "cap_below_cell": "17770680984043165643/196000000000000000000", + "cap_below_phase_cell_power": "213770680998043165643/196000000000000000000", + "complex_above_effective": "1/14000000000", + "complex_below_one_over_32": "78866871/2800000000", + "complex_endpoint": "1/7000000000", + "epsilon_below_one": "1/14000000000", + "epsilon_positive": "13999999999/14000000000", + "fine_prime_halo_umbrella": "7/2", + "fused_gaussian_above_kappa": "55870503071/196000000000000000000", + "gaussian_above_main": "6956834357/98000000000000000000", + "global_coordinate_router_above_kappa": "1/3500000000", + "global_gamma_power_slack": "9/140000000000", + "group_below_dimension": "1/7000000000", + "group_bit_router_above_kappa": "17467625767/49000000000000000000", + "group_gauge_power_slack": "17770681018343165643/98000000000000000000", + "group_key_fits_record": "1/7000000000", + "group_positive": "13999999997/14000000000", + "group_scans_above_kappa": "6978417179/7000000000", + "halo_covers_generic_inverse_radius": "5", + "improvement_over_user_baseline": "676144790400418148631/500000000000000000000000", + "lambda_above_internal": "1/28000000000", + "lambda_above_sigma": "3/28000000000", + "lambda_above_tau": "1/28000000000", + "lambda_prime_above_lambda": "1/28000000000", + "lambda_prime_above_leaf": "5591366871/39200000000000000000", + "leaf_saving_above_effective": "2791366871/39200000000000000000", + "main_transform_above_kappa": "41956834357/196000000000000000000", + "membership_arithmetic_fits_record": "1/14000000000", + "microbox_face_corrections_above_kappa": "269489208591/3500000000", + "microbox_halo_volume": "1106000000003/14000000000", + "new_complex_uniform_saving_above_b": "1/14000000000", + "new_semantic_guard_with_C1_one": "1/14000000000", + "polynomial_products_above_kappa": "13956834359/14000000000", + "positive_layout_slack": "1/14000000000", + "q_below_effective": "1/14000000000", + "q_below_internal": "1/14000000000", + "q_below_leaf": "5591366871/39200000000000000000", + "q_positive": "43165643/14000000000", + "short_record_fallback": "2791366871/2800000000", + "source_axis_superpolynomial": "1/14000000000", + "sparse_union_movement_above_kappa": "79625000055956834357/196000000000000000000", + "stop_below_one": "13999999999/14000000000", + "stop_positive": "1/14000000000", + "strassen_integer_power_gap": "1951441519231", + "support_router_span": "3/14000000000", + "theta_positive_polynomial_power": "2", + "union_header_fits_record": "3/14000000000", + "union_tag_work_per_visit_fits_record": "3/14000000000" + } + }, + "paid": { + "1": 41340, + "16": 416, + "2": 8244, + "24": 416, + "3": 8874, + "32": 416, + "4": 1692, + "40": 416, + "48": 416, + "5": 2952, + "56": 416, + "6": 342, + "64": 416, + "7": 252, + "72": 208 + }, + "paid_calls": 66816, + "previous_open_pr5580": "308189/100000000", + "productive_fields": 12814, + "query_shears": 15, + "rank_mass_surplus": 760, + "raw_headroom": [ + "230971/50000000000000", + "461943/100000000000000" + ], + "raw_root_interval": [ + "154163230971/50000000000000", + "308326461943/100000000000000" + ], + "relative_gain_percent": "13700/308189", + "strictification": { + "alpha": { + "lower": "0.999999995787451589602073519530", + "upper": "0.999999995787451589602073519531" + }, + "cutoff": 17, + "delta": { + "lower": "0.954849072032867801906083722460", + "upper": "0.954849072032867801906083722461" + }, + "floor": 18, + "gamma": { + "lower": "0.967458246753597404095572407152", + "upper": "0.967458246753597404095572407153" + }, + "normalized_paid_upper": "5242880004882813/5242880536870912", + "power": 1024, + "reserve": "1/10000000000", + "tail_offset": "1/5", + "tested": "6166521/2000000000" + }, + "targets": { + "145": 208, + "17": 416, + "25": 416, + "33": 416, + "4": 1494, + "41": 416, + "49": 416, + "5": 90, + "57": 416, + "65": 416, + "73": 208, + "8": 270, + "9": 7632 + }, + "whole_idle_jobs": 3120 + }, + "status": "PASS_P104_SHARED_RESIDUAL_KAPPA_00308326", + "transpose": { + "arithmetic": "Dense integer rows with binary denominators; reverse chronology", + "coefficients": 552049, + "columns": 743 + } +} diff --git a/research/p104-shared-residual-relay/SOURCES.json b/research/p104-shared-residual-relay/SOURCES.json new file mode 100644 index 0000000000..75753b5ec0 --- /dev/null +++ b/research/p104-shared-residual-relay/SOURCES.json @@ -0,0 +1,78 @@ +{ + "schema_version": 1, + "base_commit": "5e0052ca0aa3036a3afa8b0438927377c8d97d53", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "fc3d4ba105e1f097d0d7d051a308281e86ab1446", + "sha256": "66974efdced4083c00025f97d95d83909a226cdf801edb9301c195c6641f6903" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "f126dd2e2dad2b669e75d1d0d0bd05c600725602", + "sha256": "f7a48bfa2659b88378282a8eee7d9fe52cdf505594124c4d1686b58510fffd72" + }, + { + "path": "research/p104-shared-residual-relay/inputs/pr5580-WORD.json.gz", + "usage": "input", + "git_blob": "9434855e7dad0d0236d23210b3e71a2b83a9ae64", + "sha256": "b2a98c4bd0dbe86c09e9d15ee060dcf1aab09dbef90aa1e2127676f4039f406b", + "pin": "head:f316b644060790f6bafd16ace47bf6b0942d6b62:research/p104-shared-residual-relay/inputs/pr5580-WORD.json.gz" + }, + { + "path": "research/p104-shared-residual-relay/inputs/pr5580-pricing.py", + "usage": "input", + "git_blob": "f8f09be7a16542b924bba903867f71f2a092840f", + "sha256": "e8ffdadf454639fd434a17e276b062d9d6df8310b1aa0ef15e5fb6a4468d6ba2", + "pin": "head:f316b644060790f6bafd16ace47bf6b0942d6b62:research/p104-shared-residual-relay/inputs/pr5580-pricing.py" + }, + { + "path": "research/p104-shared-residual-relay/inputs/pr5545-source-closure.tar.gz", + "usage": "input", + "git_blob": "3084088544d1e3136e1f38b8011b9e24edc969c6", + "sha256": "59768da554e11b11fae52d07f520f50684cc7a9ee0bec2873edbcd6b63814837", + "pin": "head:f316b644060790f6bafd16ace47bf6b0942d6b62:research/p104-shared-residual-relay/inputs/pr5545-source-closure.tar.gz" + }, + { + "path": "research/p104-shared-residual-relay/common.py", + "usage": "input", + "git_blob": "bd244313fc023a737055415f87003f2963c290f6", + "sha256": "e7c1bd9bfc0060d2d55da5c6e61cd3fae756e0fc8facacc2a074061d2f73c800", + "pin": "head:f316b644060790f6bafd16ace47bf6b0942d6b62:research/p104-shared-residual-relay/common.py" + } + ], + "retained_source": { + "path": "research/p104-event-contact-step/inputs/pr5545-source-closure.tar.gz", + "sha256": "59768da554e11b11fae52d07f520f50684cc7a9ee0bec2873edbcd6b63814837", + "export_manifest_sha256": "0a20358f9c089be1f5606c78077314e30a72998fb3c5123848d921a8d1814e76", + "commit": "18968423711fd902aaee1099979497d55603e1dc", + "files": 33, + "source_url": "https://github.com/CrocSwap/integer-mult-bounds/pull/5545", + "note": "Byte-identical copy of the capsule retained by PR5551/PR5561; used UNMODIFIED (the hand-off word keeps 735 public inputs)." + }, + "external_inputs": [ + { + "local_path": "inputs/pr5580-WORD.json.gz", + "source_commit": "6efa248cf456d6101d757e9d09ba29711d18a13a", + "source_path": "research/p104-event-contact-step/WORD.json.gz", + "sha256": "b2a98c4bd0dbe86c09e9d15ee060dcf1aab09dbef90aa1e2127676f4039f406b", + "git_blob": "9434855e7dad0d0236d23210b3e71a2b83a9ae64" + }, + { + "local_path": "inputs/pr5580-pricing.py", + "source_commit": "6efa248cf456d6101d757e9d09ba29711d18a13a", + "source_path": "research/p104-event-contact-step/pricing.py", + "sha256": "e8ffdadf454639fd434a17e276b062d9d6df8310b1aa0ef15e5fb6a4468d6ba2", + "git_blob": "f8f09be7a16542b924bba903867f71f2a092840f" + }, + { + "local_path": "common.py", + "source_commit": "6efa248cf456d6101d757e9d09ba29711d18a13a", + "source_path": "research/p104-event-contact-step/common.py", + "sha256": "e7c1bd9bfc0060d2d55da5c6e61cd3fae756e0fc8facacc2a074061d2f73c800", + "git_blob": "bd244313fc023a737055415f87003f2963c290f6" + } + ] +} diff --git a/research/p104-shared-residual-relay/TASK.json b/research/p104-shared-residual-relay/TASK.json new file mode 100644 index 0000000000..0db92ec59c --- /dev/null +++ b/research/p104-shared-residual-relay/TASK.json @@ -0,0 +1,112 @@ +{ + "schema_version": 1, + "task_id": "scalar-to-moment", + "priority_revision": 7, + "base_commit": "5e0052ca0aa3036a3afa8b0438927377c8d97d53", + "original_card": { + "id": "scalar-to-moment", + "question": "Can a changed frame itinerary remove a paid transition beyond the already covered scalar A2 contractions?", + "starting_points": [ + "docs/research/research-family-status.md", + "certificates/selected-result.json", + "research/staged544-a2-graph-rewrite/README.md", + "research/staged544-separated-a2/README.md", + "research/staged544-a2-composition-audit/README.md", + "research/staged544-a1858-contraction-audit/README.md" + ], + "methods": [ + "Derive the changed legal frame itinerary and exact child histogram.", + "Prove a scoped obstruction showing why that scalar gain cannot change the paid contract." + ], + "acceptance_gate": "An unchanged histogram is not a kappa gain; record any separate runtime or proof benefit explicitly.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Read the A2 and separated-A2 constructions and their composition/contraction audits. Scalar contractions can preserve the complete recursive histogram; fewer ADDs alone do not justify further scans.", + "scope": "Source-binding orientation only; no scientific replay, theorem acceptance or supplier admission. Budget any heavy replay separately." + }, + "first_experiment": "Identify an actual paid transition to remove and construct a legal replacement frame itinerary, charging restoration, source windows and changed helpers. Compare complete before/after histograms. Stop if only scalar count changes; report that benefit honestly, without expanding the same scalar-only census.", + "bottleneck_link": "A legal change to the histogram, not addition count alone, is the bridge to an exponent gain.", + "allowed_variations": [ + "One existing scalar simplification and one proposed frame-path change." + ], + "scope_change_triggers": [ + "Submitting only another scalar count as completion of a paid-profile task." + ], + "overlap_terms": [ + "scalar simplification", + "paid profile", + "R439", + "3998", + "4019", + "4112", + "4152", + "staged544-a2-graph-rewrite", + "staged544-separated-a2", + "staged544-a2-composition-audit", + "staged544-a1858-contraction-audit" + ], + "existing_checks": [ + { + "scope": "PR #3998: consecutive A2 scalar contraction", + "evidence": "research/staged544-a2-graph-rewrite/README.md", + "remaining": "A genuinely changed paid itinerary or a distinct independent audit; no default scalar-only expansion.", + "status": "author-checked", + "source_commit": "389268a6b5e0373a3125d5c6fcd6995f4ea324f5", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "PR #4019: separated A2 sites with unchanged recursive histogram", + "evidence": "research/staged544-separated-a2/README.md", + "remaining": "A genuinely changed paid itinerary or a distinct independent audit; no default scalar-only expansion.", + "status": "author-checked", + "source_commit": "f408e09df300b575235f7f77f81948071397e16d", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "PR #4112: composition audit", + "evidence": "research/staged544-a2-composition-audit/README.md", + "remaining": "A genuinely changed paid itinerary or a distinct independent audit; no default scalar-only expansion.", + "status": "author-checked", + "source_commit": "205b7380656ba4b6316a8a493b1a3c679b8f7a0e", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "PR #4152: A1858 contraction audit", + "evidence": "research/staged544-a1858-contraction-audit/README.md", + "remaining": "A genuinely changed paid itinerary or a distinct independent audit; no default scalar-only expansion.", + "status": "author-checked", + "source_commit": "caaa14cde5962adc372fdca71f63d0f29e73c8b2", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + } + ] + }, + "scope_status": "refined", + "actual_scope": "Replace two owned P104 deliveries by a shared dirty public relay, with invertible initial preconditioning and exact late cleanup, and price the complete changed word.", + "scope_change_reason": "The assigned changed-public-dependency and shared-owned-block research escapes fixed-contact obstructions; it retains the card goal of a legal changed paid itinerary.", + "bottleneck_link": "The exact local paid change H6-H1-H2-H3 strictly reduces every concave paid moment and raises the complete conditional kappa from .00308189 to .00308326 with unchanged productive targets.", + "budget_minutes": 240, + "stop_rule": "Freeze this independently reviewable construction after exact identity, legal native/caller, ordinary-cost and complete moment verification. Broader user-authorized research continues separately until 30 percent account allowance remains.", + "outcome": "completed", + "evidence": "construct.py, PROOF.md and RESULT.json: all743 arbitrary-input rows, exact dense transpose,2918 signed native maps, physical caller, two rational interval engines, compiler,58 outer predicates and five rejection controls.", + "author": "flyingviper with substantial OpenAI Codex assistance and independent agents", + "ai_assistance": "Substantial OpenAI Codex assistance. Separate agents independently derived and checked the relay, initial preconditioner, full-frame cleanup and orphan transport contraction. Root performed full framework replay; no independent human review or proof-kernel verification claimed.", + "open_questions": [ + { + "question": "Can multiple dirty relays replace further owned reads while sharing initial and final corrections?", + "why_it_matters": "This could change the complete paid profile beyond the fixed-invoice ceiling.", + "first_step": "Require exact agreement on all nonzero-frame input columns before solving helper-only initial corrections; then explicitly restore every full-frame output and charge all transport.", + "blocked_by": "A remaining nonzero-input endpoint defect cannot be repaired by the free helper-only correction lemma." + }, + { + "question": "Does independent substantive review validate this word and its inherited supplier assumptions?", + "why_it_matters": "Finite certificates and a conditional kappa are not selected-frontier admission.", + "first_step": "Replay the exported package and audit the arbitrary-input correction plus inherited native/compiler/endpoint contracts.", + "blocked_by": "Independent mathematical review and the inherited framework obligations remain." + } + ] +} diff --git a/research/p104-shared-residual-relay/VERIFY.json b/research/p104-shared-residual-relay/VERIFY.json new file mode 100644 index 0000000000..7c948a88bd --- /dev/null +++ b/research/p104-shared-residual-relay/VERIFY.json @@ -0,0 +1,39 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/p104-shared-residual-relay/inputs/pr5580-WORD.json.gz", + "research/p104-shared-residual-relay/inputs/pr5580-pricing.py", + "research/p104-shared-residual-relay/inputs/pr5545-source-closure.tar.gz", + "research/p104-shared-residual-relay/common.py" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-W", + "error", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 540, + "checks": "Authenticate source bytes and33 archive payloads; reconstruct the complete word; check all arbitrary-input rows, dense transpose,2918 signed native maps, physical caller, complete invoice, two rational engines, compiler,58 outer predicates, fixed-invoice ceiling and five rejection controls; compare complete receipt." + }, + { + "argv": [ + "{python}", + "-I", + "-W", + "error", + "-B", + "-O", + "{package}/verify.py" + ], + "timeout_seconds": 540, + "checks": "Authenticate source bytes and33 archive payloads; reconstruct the complete word; check all arbitrary-input rows, dense transpose,2918 signed native maps, physical caller, complete invoice, two rational engines, compiler,58 outer predicates, fixed-invoice ceiling and five rejection controls; compare complete receipt." + } + ] +} diff --git a/research/p104-shared-residual-relay/WORD.json.gz b/research/p104-shared-residual-relay/WORD.json.gz new file mode 100644 index 0000000000..508ad96b04 Binary files /dev/null and b/research/p104-shared-residual-relay/WORD.json.gz differ diff --git a/research/p104-shared-residual-relay/common.py b/research/p104-shared-residual-relay/common.py new file mode 100644 index 0000000000..bd244313fc --- /dev/null +++ b/research/p104-shared-residual-relay/common.py @@ -0,0 +1,47 @@ +"""Open the byte-pinned PR5545 source closure (same pins as PR5551/PR5561); Apache-2.0. + +Copied from PR5561's research/p104-free-endpoint-retime/common.py (DreamingOfClouds), package path +renamed only. Mechanism and all predecessor credit: see README.md. +""" +from contextlib import contextmanager +from hashlib import sha256 +from io import BytesIO +from pathlib import Path,PurePosixPath +import gzip,importlib.util,json,sys,tarfile,tempfile + +HERE=Path(__file__).resolve().parent +def need(ok,why): + if not ok: + raise ValueError(why) + +def read(path): + raw=Path(path).read_bytes() + return json.loads(gzip.decompress(raw) if str(path).endswith('.gz') else raw) + +def load(path,name): + spec=importlib.util.spec_from_file_location(name,path) + mod=importlib.util.module_from_spec(spec);sys.modules[name]=mod;spec.loader.exec_module(mod);return mod + +@contextmanager +def closure(): + pins=json.loads((HERE/'SOURCES.json').read_bytes())['retained_source'] + raw=(HERE/'inputs'/Path(pins['path']).name).read_bytes() + need(sha256(raw).hexdigest()==pins['sha256'],'Retained PR5545 capsule byte pin') + with tempfile.TemporaryDirectory(prefix='p104-priced-handoff-')as tmp: + root=Path(tmp) + with tarfile.open(fileobj=BytesIO(gzip.decompress(raw)),mode='r:')as archive: + members=archive.getmembers();names=[m.name for m in members] + need(len(names)==len(set(names)),'Unique retained source paths') + for m in members: + n=PurePosixPath(m.name) + need(m.isfile()and not n.is_absolute()and '..'not in n.parts,'Regular retained source path') + t=root/m.name;t.parent.mkdir(parents=True,exist_ok=True);t.write_bytes(archive.extractfile(m).read()) + mraw=(root/'.research-export.json').read_bytes() + need(sha256(mraw).hexdigest()==pins['export_manifest_sha256'],'Exact export inventory') + man=json.loads(mraw) + need(man['commit']==pins['commit']and len(man['files'])==pins['files']==33,'Exact predecessor closure') + need(set(names)=={'.research-export.json'}|{r['path']for r in man['files']},'No omitted or extra file') + for r in man['files']: + b=(root/r['path']).read_bytes() + need(len(b)==r['size']and sha256(b).hexdigest()==r['sha256'],'Source file '+r['path']) + yield root diff --git a/research/p104-shared-residual-relay/construct.py b/research/p104-shared-residual-relay/construct.py new file mode 100644 index 0000000000..31f9b76c9b --- /dev/null +++ b/research/p104-shared-residual-relay/construct.py @@ -0,0 +1,60 @@ +"""Reconstruct the shared587 relay from the frozen PR5580 word. + +Prepared for flyingviper with substantial OpenAI Codex assistance and +independent agents. Source word: Ali Romman and the retained P104 lineage. +Apache-2.0. +""" +from copy import deepcopy + + +def need(ok, why): + if not ok: + raise ValueError(why) + + +def construct(base): + old = base['program'] + need(len(old) == 25140, 'Pinned PR5580 event count') + expected = { + 13413: ['ADD',159,738,'-1',565], + 13414: ['MOVE',738,565,564,True], + 13415: ['ADD',203,738,'2',564], + 13416: ['MOVE',148,467,596,False], + 13417: ['MOVE',738,564,596,True], + 13418: ['ADD',148,738,'2',596], + 13420: ['MOVE',738,596,597,True], + 14010: ['ADD',165,21,'-1/2',652], + 14017: ['MOVE',148,596,655,False], + 14633: ['MOVE',587,3,597,False], + 14634: ['ADD',587,734,'-4',597], + 14635: ['MOVE',587,597,773,False], + } + need(all(old[i] == e for i,e in expected.items()), 'Pinned changed source events') + affected = {123: '1/2',148: '-1/2',175: '-1/2',182: '-1/2',203: '1/2',223: '-1/2'} + # Q = I-uN, N=e587-4e734. Supports are disjoint, so these ADDs + # implement the exact nilpotent inverse without implementation feedback. + from fractions import Fraction as Q + out = [['ADD',r,s,str(-Q(u)*v),3] + for r,u in sorted(affected.items()) for s,v in ((587,Q(1)),(734,Q(-4)))] + remove = {13414,13415,13416,13417,13418,13420,14633,14634} + for i,e in enumerate(old): + if i == 24461: + # Undo the shared residual while all six targets and three + # unmodified sources coexist at the full frame. + for r,sign in ((21,-1),(47,-1),(434,1),(435,1),(436,1),(437,1)): + out += [['ADD',r,133,str(sign),127], + ['ADD',r,587,str(Q(sign,2)),127], + ['ADD',r,734,str(-2*sign),127]] + if i not in remove: + out.append(['MOVE',587,652,773,False] if i == 14635 else + ['MOVE',148,467,655,False] if i == 14017 else deepcopy(e)) + if i == 13413: + out.append(['MOVE',738,565,597,True]) + if i == 13610: + out.extend(deepcopy([old[14633],old[14634]])) + if i == 14010: + out.extend([['MOVE',587,597,652,False],['ADD',21,587,'1',652]]) + word=deepcopy(base) + word['program']=out + need(len(out) == 25167, 'Exact reconstructed event count') + return word diff --git a/research/p104-shared-residual-relay/inputs/pr5545-source-closure.tar.gz b/research/p104-shared-residual-relay/inputs/pr5545-source-closure.tar.gz new file mode 100644 index 0000000000..3084088544 Binary files /dev/null and b/research/p104-shared-residual-relay/inputs/pr5545-source-closure.tar.gz differ diff --git a/research/p104-shared-residual-relay/inputs/pr5580-WORD.json.gz b/research/p104-shared-residual-relay/inputs/pr5580-WORD.json.gz new file mode 100644 index 0000000000..9434855e7d Binary files /dev/null and b/research/p104-shared-residual-relay/inputs/pr5580-WORD.json.gz differ diff --git a/research/p104-shared-residual-relay/inputs/pr5580-pricing.py b/research/p104-shared-residual-relay/inputs/pr5580-pricing.py new file mode 100644 index 0000000000..f8f09be7a1 --- /dev/null +++ b/research/p104-shared-residual-relay/inputs/pr5580-pricing.py @@ -0,0 +1,156 @@ +"""Complete mixed-target price, compiler and outer transfer. + +The interval and compiler bounds follow zxv and Cao Yifan. The productive +recursion is by Jacob Alan Sussman. The controller is by Cinna Davis. +Adapted from Ali Romman's PR5544/5545 for the two coupled contact changes. +Successor choices prepared for thu-nmrc with substantial OpenAI Codex assistance. +Ali Romman's complete caller/price proof and all predecessor credit are retained. +Apache-2.0. +""" +from collections import Counter +from fractions import Fraction as Q +import local as L + +KAPPA, TESTED = Q('.00308189'), Q('.0030818905') +PREVIOUS = Q('.00308181') + + +def encode(x): + if isinstance(x,Q): + return str(x) + if isinstance(x,dict): + return {str(k):encode(v) for k,v in x.items()} + if isinstance(x,(list,tuple)): + return [encode(v) for v in x] + return x + + +def assemble(local, native, word, physical): + paid, targets = Counter(), Counter() + counts = Counter() + L.need(local['helpers'] == native['helpers'], 'Every productive helper has a native target') + for e in word['physical_events']: + counts[e[0]] += 1 + if e[0] == 'LOCAL': + L.need(e[3] is False, 'Every source invocation is forward') + paid.update(local['paid']) + targets.update(local['helpers']) + elif e[0] == 'QUERY_SHEAR': + paid[1] += 104 + elif e[0] == 'IDLE': + paid[8*len(e[2])] += 208 + main = Counter() + idle = Counter({8*len(e[2]):0 for e in word['physical_events'] if e[0] == 'IDLE'}) + for e in word['physical_events']: + if e[0] == 'IDLE': + idle[8*len(e[2])] += 208 + L.need(idle == physical['whole_idle_jobs'], 'Every whole idle has a native Gaussian and full rank') + for term in word['diagonal']: + main[1+8*sum(term[1:])] += 104 + L.need(main == physical['main_targets'], 'Every main target has its full native phase') + targets.update(main) + L.need(counts['LOCAL'] == 18 and counts['QUERY_SHEAR'] == counts['IDLE'] == 15, 'Complete call census') + # Recount by the two path lengths, without using emitted main diagonals. + second_t = Counter({r:18*n for r,n in local['helpers'].items()}) + second_p = Counter({r:18*n for r,n in local['paid'].items()}) + second_t[145] += 208 + second_p[1] += 15*104 + for length in (7,8): + for j in range(1,length+1): + second_t[1+8*(j+1)] += 208 + second_p[8*(j+1)] += 208 + L.need((targets,paid) == (second_t,second_p), 'Independent full invoice') + L.need(max(targets) == 145 and max(paid) == 72, 'Maximum recursive ranks') + L.need(sum(targets.values()) == 12814 and sum(paid.values()) == 66852, 'Complete field and call counts') + L.need(sum(r*n for r,n in targets.items())-sum(r*n for r,n in paid.items()) == 760, 'Complete rank surplus') + return targets,paid,counts + + +def run(local,native,word,physical): + T,P,counts = assemble(local,native,word,physical) + E = L.load(L.ROOT/'research/higher-moment-strictification/verify.py','p104_productive_intervals') + other = L.load(L.ROOT/'research/kappa-rebuild/architecture/mixed_target_probe.py','p104_productive_second_intervals') + def margin(k): + a,b = E.moment(T,1-k), E.moment(P,1-k) + return a[0]-b[1],a[1]-b[0] + lo,hi,grid = 0,10**12,10**14 + while hi-lo > 1: + m=(lo+hi)//2 + if margin(Q(m,grid))[0] > 0: + lo=m + else: + hi=m + lower,upper = Q(lo,grid),Q(hi,grid) + L.need(margin(lower)[0] > 0 and margin(upper)[1] < 0, 'Strict rational crossing enclosure') + L.need(PREVIOUS < KAPPA < TESTED < lower and margin(PREVIOUS)[0] > 0, 'Changed complete bill improves selected kappa') + t,u,v,c,b = 1-TESTED,Q(1,5),1024,17,18 + target,paid = E.moment(T,t),E.moment(P,t) + tl,th = other.moment(T,TESTED) + pl,ph = other.moment(P,TESTED) + L.need(tl > ph and max(tl,target[0]) <= min(th,target[1]) and max(pl,paid[0]) <= min(ph,paid[1]), 'Two exact moment engines') + alpha = E.divide(paid,target) + gamma = E.divide(E.moment(P,t+u),E.mul(E.power(c,u),target)) + delta = E.divide((Q(sum(T.values())*b),)*2,E.mul(E.power(c,TESTED),target)) + reserve,decay = Q(1,10**10),Q(97,100) + L.need(alpha[1] < 1-reserve and gamma[1] < decay and delta[1] < decay, 'All three charged tail ratios') + L.need(decay**128 < Q(1,16), 'Both tail decay blocks') + normalized = 1/(1+v*reserve)+Q(4,2**32) + L.need(normalized < 1 and c**64 < b**63, 'Full completion, splitting and rounding charges') + theta,power = Q(63,64),1000 + eta = E.scale(E.power(145,-v*TESTED),t) + L.need(2*(c**v)**64 <= (145**v)**63 and eta[0] > theta**power, 'Shifted exits and complement capacity') + L.need(E.power(145,v*TESTED)[1] < 2**power, 'Compiler initial range') + gap = (TESTED-KAPPA)/7 + L.need(gap.numerator == 1, 'Exact compiler integer grid') + step = gap.denominator + def wins(j): + return (step*j+1)**power < 2**j + left,right=1,2 + while not wins(right): + left,right=right,2*right + while right-left > 1: + m=(left+right)//2 + if wins(m): + right=m + else: + left=m + H=step*right + L.need(H > 8*v and wins(right) and not wins(right-1), 'Finite uniform threshold with predecessor rejection') + local_routes = (sum(local['paid'].values())+native['helper_normalizers']+native['main_adapters']+4*104+4*local['owned_lifetimes'])*1000 + L.need(local['real_scalar_allowance']+local_routes < 10**7, 'Every local scalar, route and owned operation is funded') + boundary = sum(len(word['boundaries'][side+'_program']) for side in ('left','right')) + raw = 18*10**7 + 15*1664 + 32*104*(len(word['physical_events'])+boundary) + raw += 32*104*(26+1000) + L.need(raw < 10**9, 'Complete nonrecursive raw bound') + bit = L.read(L.ROOT/'research/query-thinned-controllers/RESULT.json')['ordinary_BIT'] + atom = Q(bit['atom']) + ordinary=(1-atom)*Q(bit['after_cover'])+atom*Q('.0000384599') + admitted=Q(bit['admitted']) + L.need(atom > ordinary > admitted > TESTED and atom < 1-ordinary, 'Retained BIT admission and stock') + outer_module=L.load(L.ROOT/'research/pr4359-p7-padding/dependencies/compiler-refill/endpoint.py','p104_productive_outer') + params={'kappa':KAPPA,'tested_saving':TESTED,'complex_uniform_saving':KAPPA+6*gap, + 'b':KAPPA+5*gap,'a':KAPPA+4*gap,'q':KAPPA+3*gap,'bit_saving':admitted, + 'epsilon':1-gap,'beta':1-3*gap,'r0':gap/10,'stop':gap,'layout':gap,'d':gap} + outer=outer_module.ledger(params) + outer['functional_checks']['actual_new_BIT_stock_sublinear']=params['beta']*(1-atom) + L.need(len(outer['strict_checks']) == 54 and len(outer['functional_checks']) == 4, 'Complete outer predicate inventory') + L.need(all(x > 0 for key in ('strict_checks','functional_checks') for x in outer[key].values()), 'All outer inequalities strict') + wrong_cutoff = E.divide((Q(sum(T.values())*21),)*2,E.mul(E.power(20,TESTED),target)) + L.need(wrong_cutoff[0] > 1, 'Old cutoff fails with this helper inventory') + bad=outer_module.ledger(dict(params,bit_saving=Q('.0027'))) + L.need(any(x <= 0 for x in bad['strict_checks'].values()), 'Insufficient BIT contract rejected') + return encode({'kappa':KAPPA,'kappa_decimal':'.00308189','previous_open_pr5569':PREVIOUS,'gain':KAPPA-PREVIOUS, + 'relative_gain_percent':100*(KAPPA/PREVIOUS-1),'raw_root_interval':[lower,upper], + 'raw_headroom':[lower-KAPPA,upper-KAPPA],'margin_at_previous':E.display(margin(PREVIOUS)), + 'targets':T,'paid':P,'productive_fields':sum(T.values()),'paid_calls':sum(P.values()), + 'rank_mass_surplus':760,'full_forward_calls':18,'query_shears':15,'whole_idle_jobs':3120, + 'strictification':{'tested':TESTED,'power':v,'cutoff':c,'floor':b,'tail_offset':u,'reserve':reserve, + 'alpha':E.display(alpha),'gamma':E.display(gamma),'delta':E.display(delta),'normalized_paid_upper':normalized}, + 'compiler':{'theta':theta,'logarithm_power':power,'eta':E.display(eta),'gap':gap,'H':H,'N':'2^'+str(H), + 'integer_test_exponent':right,'uniform_saving':params['complex_uniform_saving'],'word_materialized':False}, + 'nonrecursive':{'local_scalar':local['real_scalar_allowance'],'local_routes':local_routes, + 'raw_scalar_upper':raw,'raw_budget':10**9,'peak_owned_fields':1, + 'fixed_scalar_growth_bound':'At most 2^(16*26000) before native factors; a declared constant, not an attained norm.', + 'tensor_native_growth_bound':f'Each rank-r Gaussian has row l1 norm at most 2^(rf); sum of local ranks is {sum(r*n for r,n in local["paid"].items())}.'}, + 'ordinary_BIT':bit,'outer':outer, + 'negative_controls':{'old_cutoff':'Rejected by completion-tail ratio greater than one','old_BIT':'Rejected by outer inequalities'}}) diff --git a/research/p104-shared-residual-relay/pricing.py b/research/p104-shared-residual-relay/pricing.py new file mode 100644 index 0000000000..bf9c439d44 --- /dev/null +++ b/research/p104-shared-residual-relay/pricing.py @@ -0,0 +1,156 @@ +"""Complete mixed-target price, compiler and outer transfer. + +The interval and compiler bounds follow zxv and Cao Yifan. The productive +recursion is by Jacob Alan Sussman. The controller is by Cinna Davis. +Adapted from Ali Romman's PR5544/5545 for the two coupled contact changes. +Successor choices prepared for thu-nmrc with substantial OpenAI Codex assistance. +Ali Romman's complete caller/price proof and all predecessor credit are retained. +Apache-2.0. +""" +from collections import Counter +from fractions import Fraction as Q +import local as L + +KAPPA, TESTED = Q('.00308326'), Q('.0030832605') +PREVIOUS = Q('.00308189') + + +def encode(x): + if isinstance(x,Q): + return str(x) + if isinstance(x,dict): + return {str(k):encode(v) for k,v in x.items()} + if isinstance(x,(list,tuple)): + return [encode(v) for v in x] + return x + + +def assemble(local, native, word, physical): + paid, targets = Counter(), Counter() + counts = Counter() + L.need(local['helpers'] == native['helpers'], 'Every productive helper has a native target') + for e in word['physical_events']: + counts[e[0]] += 1 + if e[0] == 'LOCAL': + L.need(e[3] is False, 'Every source invocation is forward') + paid.update(local['paid']) + targets.update(local['helpers']) + elif e[0] == 'QUERY_SHEAR': + paid[1] += 104 + elif e[0] == 'IDLE': + paid[8*len(e[2])] += 208 + main = Counter() + idle = Counter({8*len(e[2]):0 for e in word['physical_events'] if e[0] == 'IDLE'}) + for e in word['physical_events']: + if e[0] == 'IDLE': + idle[8*len(e[2])] += 208 + L.need(idle == physical['whole_idle_jobs'], 'Every whole idle has a native Gaussian and full rank') + for term in word['diagonal']: + main[1+8*sum(term[1:])] += 104 + L.need(main == physical['main_targets'], 'Every main target has its full native phase') + targets.update(main) + L.need(counts['LOCAL'] == 18 and counts['QUERY_SHEAR'] == counts['IDLE'] == 15, 'Complete call census') + # Recount by the two path lengths, without using emitted main diagonals. + second_t = Counter({r:18*n for r,n in local['helpers'].items()}) + second_p = Counter({r:18*n for r,n in local['paid'].items()}) + second_t[145] += 208 + second_p[1] += 15*104 + for length in (7,8): + for j in range(1,length+1): + second_t[1+8*(j+1)] += 208 + second_p[8*(j+1)] += 208 + L.need((targets,paid) == (second_t,second_p), 'Independent full invoice') + L.need(max(targets) == 145 and max(paid) == 72, 'Maximum recursive ranks') + L.need(sum(targets.values()) == 12814 and sum(paid.values()) == 66816, 'Complete field and call counts') + L.need(sum(r*n for r,n in targets.items())-sum(r*n for r,n in paid.items()) == 760, 'Complete rank surplus') + return targets,paid,counts + + +def run(local,native,word,physical): + T,P,counts = assemble(local,native,word,physical) + E = L.load(L.ROOT/'research/higher-moment-strictification/verify.py','p104_productive_intervals') + other = L.load(L.ROOT/'research/kappa-rebuild/architecture/mixed_target_probe.py','p104_productive_second_intervals') + def margin(k): + a,b = E.moment(T,1-k), E.moment(P,1-k) + return a[0]-b[1],a[1]-b[0] + lo,hi,grid = 0,10**12,10**14 + while hi-lo > 1: + m=(lo+hi)//2 + if margin(Q(m,grid))[0] > 0: + lo=m + else: + hi=m + lower,upper = Q(lo,grid),Q(hi,grid) + L.need(margin(lower)[0] > 0 and margin(upper)[1] < 0, 'Strict rational crossing enclosure') + L.need(PREVIOUS < KAPPA < TESTED < lower and margin(PREVIOUS)[0] > 0, 'Changed complete bill improves selected kappa') + t,u,v,c,b = 1-TESTED,Q(1,5),1024,17,18 + target,paid = E.moment(T,t),E.moment(P,t) + tl,th = other.moment(T,TESTED) + pl,ph = other.moment(P,TESTED) + L.need(tl > ph and max(tl,target[0]) <= min(th,target[1]) and max(pl,paid[0]) <= min(ph,paid[1]), 'Two exact moment engines') + alpha = E.divide(paid,target) + gamma = E.divide(E.moment(P,t+u),E.mul(E.power(c,u),target)) + delta = E.divide((Q(sum(T.values())*b),)*2,E.mul(E.power(c,TESTED),target)) + reserve,decay = Q(1,10**10),Q(97,100) + L.need(alpha[1] < 1-reserve and gamma[1] < decay and delta[1] < decay, 'All three charged tail ratios') + L.need(decay**128 < Q(1,16), 'Both tail decay blocks') + normalized = 1/(1+v*reserve)+Q(4,2**32) + L.need(normalized < 1 and c**64 < b**63, 'Full completion, splitting and rounding charges') + theta,power = Q(63,64),1000 + eta = E.scale(E.power(145,-v*TESTED),t) + L.need(2*(c**v)**64 <= (145**v)**63 and eta[0] > theta**power, 'Shifted exits and complement capacity') + L.need(E.power(145,v*TESTED)[1] < 2**power, 'Compiler initial range') + gap = (TESTED-KAPPA)/7 + L.need(gap.numerator == 1, 'Exact compiler integer grid') + step = gap.denominator + def wins(j): + return (step*j+1)**power < 2**j + left,right=1,2 + while not wins(right): + left,right=right,2*right + while right-left > 1: + m=(left+right)//2 + if wins(m): + right=m + else: + left=m + H=step*right + L.need(H > 8*v and wins(right) and not wins(right-1), 'Finite uniform threshold with predecessor rejection') + local_routes = (sum(local['paid'].values())+native['helper_normalizers']+native['main_adapters']+4*104+4*local['owned_lifetimes'])*1000 + L.need(local['real_scalar_allowance']+local_routes < 10**7, 'Every local scalar, route and owned operation is funded') + boundary = sum(len(word['boundaries'][side+'_program']) for side in ('left','right')) + raw = 18*10**7 + 15*1664 + 32*104*(len(word['physical_events'])+boundary) + raw += 32*104*(26+1000) + L.need(raw < 10**9, 'Complete nonrecursive raw bound') + bit = L.read(L.ROOT/'research/query-thinned-controllers/RESULT.json')['ordinary_BIT'] + atom = Q(bit['atom']) + ordinary=(1-atom)*Q(bit['after_cover'])+atom*Q('.0000384599') + admitted=Q(bit['admitted']) + L.need(atom > ordinary > admitted > TESTED and atom < 1-ordinary, 'Retained BIT admission and stock') + outer_module=L.load(L.ROOT/'research/pr4359-p7-padding/dependencies/compiler-refill/endpoint.py','p104_productive_outer') + params={'kappa':KAPPA,'tested_saving':TESTED,'complex_uniform_saving':KAPPA+6*gap, + 'b':KAPPA+5*gap,'a':KAPPA+4*gap,'q':KAPPA+3*gap,'bit_saving':admitted, + 'epsilon':1-gap,'beta':1-3*gap,'r0':gap/10,'stop':gap,'layout':gap,'d':gap} + outer=outer_module.ledger(params) + outer['functional_checks']['actual_new_BIT_stock_sublinear']=params['beta']*(1-atom) + L.need(len(outer['strict_checks']) == 54 and len(outer['functional_checks']) == 4, 'Complete outer predicate inventory') + L.need(all(x > 0 for key in ('strict_checks','functional_checks') for x in outer[key].values()), 'All outer inequalities strict') + wrong_cutoff = E.divide((Q(sum(T.values())*21),)*2,E.mul(E.power(20,TESTED),target)) + L.need(wrong_cutoff[0] > 1, 'Old cutoff fails with this helper inventory') + bad=outer_module.ledger(dict(params,bit_saving=Q('.0027'))) + L.need(any(x <= 0 for x in bad['strict_checks'].values()), 'Insufficient BIT contract rejected') + return encode({'kappa':KAPPA,'kappa_decimal':'.00308326','previous_open_pr5580':PREVIOUS,'gain':KAPPA-PREVIOUS, + 'relative_gain_percent':100*(KAPPA/PREVIOUS-1),'raw_root_interval':[lower,upper], + 'raw_headroom':[lower-KAPPA,upper-KAPPA],'margin_at_previous':E.display(margin(PREVIOUS)), + 'targets':T,'paid':P,'productive_fields':sum(T.values()),'paid_calls':sum(P.values()), + 'rank_mass_surplus':760,'full_forward_calls':18,'query_shears':15,'whole_idle_jobs':3120, + 'strictification':{'tested':TESTED,'power':v,'cutoff':c,'floor':b,'tail_offset':u,'reserve':reserve, + 'alpha':E.display(alpha),'gamma':E.display(gamma),'delta':E.display(delta),'normalized_paid_upper':normalized}, + 'compiler':{'theta':theta,'logarithm_power':power,'eta':E.display(eta),'gap':gap,'H':H,'N':'2^'+str(H), + 'integer_test_exponent':right,'uniform_saving':params['complex_uniform_saving'],'word_materialized':False}, + 'nonrecursive':{'local_scalar':local['real_scalar_allowance'],'local_routes':local_routes, + 'raw_scalar_upper':raw,'raw_budget':10**9,'peak_owned_fields':1, + 'fixed_scalar_growth_bound':'At most 2^(16*26000) before native factors; a declared constant, not an attained norm.', + 'tensor_native_growth_bound':f'Each rank-r Gaussian has row l1 norm at most 2^(rf); sum of local ranks is {sum(r*n for r,n in local["paid"].items())}.'}, + 'ordinary_BIT':bit,'outer':outer, + 'negative_controls':{'old_cutoff':'Rejected by completion-tail ratio greater than one','old_BIT':'Rejected by outer inequalities'}}) diff --git a/research/p104-shared-residual-relay/verify.py b/research/p104-shared-residual-relay/verify.py new file mode 100644 index 0000000000..1a328714e4 --- /dev/null +++ b/research/p104-shared-residual-relay/verify.py @@ -0,0 +1,152 @@ +"""Full replay of the shared587 residual relay and conditional P104 saving. + +Prepared for flyingviper with substantial OpenAI Codex assistance and +independent agents. Native/caller/pricing framework credited to Ali Romman, +zxv, Cao Yifan, Jacob Alan Sussman, Cinna Davis and retained predecessors. +Apache-2.0. This is not a proof-kernel verification. +""" +from collections import Counter +from copy import deepcopy +from fractions import Fraction as Q +from hashlib import sha1, sha256 +from pathlib import Path +import json +import sys + +sys.dont_write_bytecode = True +HERE = Path(__file__).resolve().parent +sys.path.insert(0, str(HERE)) +from common import closure, load, need, read +from construct import construct + + +def inventory(base, word): + need(set(base) == set(word), 'Same word fields') + for key in base: + if key != 'program': + need(base[key] == word[key], 'Unchanged word field: '+key) + def bill(w): + return Counter(abs(len(w['frames'][e[2]])-len(w['frames'][e[3]])) + for e in w['program'] if e[0] == 'MOVE') + before, after = bill(base), bill(word) + delta = {r: after[r]-before[r] for r in before.keys() | after.keys() if after[r] != before[r]} + need(delta == {1: -1, 2: -1, 3: -1, 6: 1}, 'Exact shared-relay paid profile') + need(sum(r*n for r,n in delta.items()) == 0, 'Unchanged rank mass') + counts0, counts1 = Counter(e[0] for e in base['program']), Counter(e[0] for e in word['program']) + changed = {k: counts1[k]-counts0[k] for k in counts0.keys() | counts1.keys() if counts1[k] != counts0[k]} + need(changed == {'ADD': 29, 'MOVE': -2}, 'Exact ordinary and paid operation delta') + return {'source_events': len(base['program']), 'events': len(word['program']), + 'operation_delta': changed, 'local_paid_delta': delta, + 'global_paid_delta': {r: 18*n for r,n in delta.items()}, + 'public_endpoints_fixed': True, 'productive_targets_fixed': True, + 'owned_lifetimes_fixed': True, 'extra_owned_fields': 0} + + +def controls(L, base, word): + variants = {} + bad = deepcopy(word);bad['program'].pop(0) + variants['missing_zero_frame_correction'] = bad + bad = deepcopy(word) + bad['program'].remove(['ADD',21,133,'-1',127]) + variants['missing_full_frame_correction'] = bad + bad = deepcopy(word) + event = next(e for e in bad['program'] if e == ['ADD',21,587,'1',652]);event[3] = '2' + variants['wrong_relay_coefficient'] = bad + bad = deepcopy(word);bad['program'].remove(['MOVE',587,597,652,False]) + variants['missing_relay_transport'] = bad + rejected = {} + for name,bad in variants.items(): + try: + L.replay(bad) + except ValueError as error: + rejected[name] = str(error) + else: + raise ValueError('Accepted invalid word: '+name) + try: + inventory(base, base) + except ValueError as error: + rejected['unchanged_word'] = str(error) + else: + raise ValueError('Accepted unchanged word as a saving') + return rejected + + +def ceiling(E, targets, paid): + cap = Q('0.0034');lower = upper = Q(0) + for rank in targets.keys() | paid.keys(): + coefficient = paid.get(rank,0)-targets.get(rank,0) + power = (E.power(rank,1-cap)[0], Q(rank)) + term = E.scale(E.mul(power,E.log_bounds(rank)),coefficient) + lower += term[0];upper += term[1] + need(upper < 0, 'Strictly decreasing complete moment on retained BIT band') + return {'kappa_interval':[Q(0),cap], 'moment_derivative':[lower,upper], + 'scope':'This fixed invoice with the inherited BIT cap, not a family optimum.'} + + +def main(): + sources = read(HERE/'SOURCES.json') + for pin in sources['external_inputs']: + raw = (HERE/pin['local_path']).read_bytes() + need(sha256(raw).hexdigest() == pin['sha256'], 'Source bytes: '+pin['local_path']) + need(sha1(('blob '+str(len(raw))+'\0').encode()+raw).hexdigest() == pin['git_blob'], + 'Source Git blob: '+pin['local_path']) + base, word = read(HERE/'inputs/pr5580-WORD.json.gz'), read(HERE/'WORD.json.gz') + need(construct(base) == word, 'Exact regenerated complete word payload') + inv = inventory(base,word) + source_price = (HERE/'inputs/pr5580-pricing.py').read_text() + for before,after in ( + ("KAPPA, TESTED = Q('.00308189'), Q('.0030818905')", "KAPPA, TESTED = Q('.00308326'), Q('.0030832605')"), + ("PREVIOUS = Q('.00308181')", "PREVIOUS = Q('.00308189')"), + ("'kappa_decimal':'.00308189'", "'kappa_decimal':'.00308326'"), + ("'previous_open_pr5569':PREVIOUS", "'previous_open_pr5580':PREVIOUS"), + ("sum(paid.values()) == 66852", "sum(paid.values()) == 66816")): + need(source_price.count(before) == 1, 'Unique pricing declaration: '+before) + source_price = source_price.replace(before,after) + need(source_price == (HERE/'pricing.py').read_text(), 'Pricing only changes declared claims and exact call census') + print('PASS source pins, construction and H6-H1-H2-H3 invoice',flush=True) + with closure() as root: + L=load(root/'research/p104-productive-controller/local.py','local');L.ROOT=root + parent_local,local=L.replay(base),L.replay(word) + need(parent_local['helpers'] == local['helpers'], 'Unchanged productive helper census') + need(local['peak_owned_fields'] == parent_local['peak_owned_fields'] == 1, 'No extra owned storage') + rejected=controls(L,base,word) + print('PASS all743 arbitrary-input rows, frames, ownership and controls',flush=True) + reverse=L.reverse_columns(word) + print('PASS dense exact transpose',flush=True) + native=L.native(word) + print('PASS all exact signed native maps',native['distinct_maps'],flush=True) + C=load(root/'research/p104-productive-controller/caller.py','shared_relay_caller') + caller=C.construct() + need(caller == read(root/'research/p104-productive-controller/CONTROLLER.json'), 'Exact physical caller') + physical=C.physical(caller,word) + print('PASS complete physical caller',flush=True) + P=load(HERE/'pricing.py','shared_relay_pricing') + result=P.run(local,native,caller,physical) + print('PASS two interval engines, complete pricing, compiler and58 outer predicates',result['raw_root_interval'],flush=True) + E=L.load(root/'research/higher-moment-strictification/verify.py','shared_relay_margin') + targets={int(r):n for r,n in result['targets'].items()};paid={int(r):n for r,n in result['paid'].items()} + parent_paid=dict(paid) + for r,n in inv['global_paid_delta'].items():parent_paid[r]-=n + parent_interval=[Q('0.00308189496866'),Q('0.00308189496867')] + margins=[] + for k in parent_interval: + t,p=E.moment(targets,1-k),E.moment(parent_paid,1-k) + margins.append((t[0]-p[1],t[1]-p[0])) + need(margins[0][0] > 0 > margins[1][1], 'Exact predecessor raw crossing') + lo,hi=map(Q,result['raw_root_interval']) + gain=[lo-parent_interval[1],hi-parent_interval[0]] + need(gain[0] > 0, 'Strict raw gain over complete predecessor') + fixed_ceiling=ceiling(E,targets,paid) + receipt=P.encode({'status':'PASS_P104_SHARED_RESIDUAL_KAPPA_00308326','inventory':inv, + 'local':local,'transpose':reverse,'native':native,'physical':physical, + 'controls':rejected,'parent_raw_interval':parent_interval,'raw_gain_interval':gain, + 'fixed_invoice_ceiling':fixed_ceiling,'result':result}) + if '--write' in sys.argv: + (HERE/'RESULT.json').write_text(json.dumps(receipt,indent=2,sort_keys=True)+'\n') + else: + need(receipt == read(HERE/'RESULT.json'),'Exact committed complete receipt') + print(receipt['status'],flush=True) + + +if __name__ == '__main__': + main()