diff --git a/research/p104-delayed-basis/PRICING-CHANGES.diff b/research/p104-delayed-basis/PRICING-CHANGES.diff new file mode 100644 index 0000000000..e81d250d0b --- /dev/null +++ b/research/p104-delayed-basis/PRICING-CHANGES.diff @@ -0,0 +1,31 @@ +--- PR5612/pricing.py ++++ pricing.py +@@ -12,8 +12,8 @@ + from fractions import Fraction as Q + import local as L + +-KAPPA, TESTED = Q('.00310299'), Q('.0031029905') +-PREVIOUS = Q('.00310184') ++KAPPA, TESTED = Q('.00310440'), Q('.0031044005') ++PREVIOUS = Q('.00310299') + + + def encode(x): +@@ -62,7 +62,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()) == 13030 and sum(paid.values()) == 66636, 'Complete field and call counts') ++ L.need(sum(targets.values()) == 13030 and sum(paid.values()) == 66618, '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 + +@@ -150,7 +150,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':'.00310299','previous_open_pr5608':PREVIOUS,'gain':KAPPA-PREVIOUS, ++ return encode({'kappa':KAPPA,'kappa_decimal':'.00310440','previous_open_pr5612':PREVIOUS,'gain':KAPPA-PREVIOUS, + 'relative_gain_percent':100*(KAPPA/PREVIOUS-1),'raw_root_interval':[lower,upper], + 'raw_headroom':[lower-KAPPA,upper-KAPPA], + 'raw_ceiling':{'interval':[Q(0),cap],'derivative_upper':derivative_upper},'margin_at_previous':E.display(margin(PREVIOUS)), diff --git a/research/p104-delayed-basis/PRICING-EDITS.json b/research/p104-delayed-basis/PRICING-EDITS.json new file mode 100644 index 0000000000..aed083b0bd --- /dev/null +++ b/research/p104-delayed-basis/PRICING-EDITS.json @@ -0,0 +1,22 @@ +[ + [ + "KAPPA, TESTED = Q('.00310299'), Q('.0031029905')", + "KAPPA, TESTED = Q('.00310440'), Q('.0031044005')" + ], + [ + "PREVIOUS = Q('.00310184')", + "PREVIOUS = Q('.00310299')" + ], + [ + "sum(paid.values()) == 66636", + "sum(paid.values()) == 66618" + ], + [ + "'kappa_decimal':'.00310299'", + "'kappa_decimal':'.00310440'" + ], + [ + "previous_open_pr5608", + "previous_open_pr5612" + ] +] diff --git a/research/p104-delayed-basis/PROOF.md b/research/p104-delayed-basis/PROOF.md new file mode 100644 index 0000000000..ae129b1c74 --- /dev/null +++ b/research/p104-delayed-basis/PROOF.md @@ -0,0 +1,44 @@ +# Helper341 boundary composition + +This composes Ali Romman's PR5602 identity, pinned at +`6c224aa720203c4f4615e6538d8038a275387db8`, with the published delayed/prepared +word. The source canonical SHA256 is +`df44a24231edd04954ebf066b1efb311441e5d9d48b64d03e555cbea087b25c6`. +This is a checked composition, not a new basis identity. + +Immediately after the source's last read of341, event11285, +`ADD346,341,+1` at frame240, exact rational replay gives + +`current341 - 2*current337 = x341 - 2*x93 - 2*x339 + 2*x351`. + +Both current rows are at240. Initially93,339,341,351 are all at frame3. +Precompose the word with the three ordinary ADDs implementing + +`x341 <- x341 + 2*x93 + 2*x339 - 2*x351`. + +The update is invertible and does not change its source coordinates. +The original endpoint column of input341 is the unit helper341 column, so +this precomposition changes no other final output. After the last341 read, +subtract twice337 from341. The displayed relation now gives exactly the +original independent input `x341`. + +There are no later reads of341. Its remaining eight destination operations, +including its rank5 ascent240-to127, can therefore be removed, and its final +frame declared240. All other operations remain unchanged. No new input, +temporary, owned lifetime, or zeroing operation is introduced. + +The exact paid change is `-H5`. Helper341's productive target changes from +rank9 to rank4, giving target change `H4-H9`. Thus the signed funding gain +is `H4+H5-H9`, strictly positive for `H_r=r^t`, `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": "608462455956538397/196000000000000000000", + "fused_gaussian": "608462455869615191/196000000000000000000", + "global_coordinate_router": "10865401/3500000000", + "group_bit_router": "152115617467403797/49000000000000000000", + "group_scans": "6999999999/7000000000", + "main_transform": "608462441956538397/196000000000000000000", + "microbox_face_corrections": "269500000001/3500000000", + "polynomial_products": "13999999999/14000000000", + "sparse_union_movement": "80233462455956538397/196000000000000000000" + }, + "parameters": { + "a": "10865401/3500000000", + "b": "8692321/2800000000", + "beta": "13999999997/14000000000", + "bit_saving": "17/5000", + "cap_xi": "178233462441956538397/196000000000000000000", + "complex_uniform_saving": "21730803/7000000000", + "d": "1/14000000000", + "epsilon": "13999999999/14000000000", + "kappa": "7761/2500000", + "lambda_": "3987582399/4000000000", + "lambda_prime": "13956538397/14000000000", + "layout": "1/14000000000", + "q": "43461603/14000000000", + "r0": "1/140000000000", + "stop": "1/14000000000", + "tested_saving": "6208801/2000000000" + }, + "strict_checks": { + "actual_bit_above_effective": "1034599/3500000000", + "actual_logarithmic_gamma_guard": "1/14000000000", + "actual_logarithmic_group_guard": "17766537579043461603/98000000000000000000", + "alpha_logarithm_absorption": "1/140000000000", + "boundary_algebraic_matrix_above_kappa": "55956538397/196000000000000000000", + "cap_above_band": "80233462441956538397/196000000000000000000", + "cap_below_cell": "17766537544043461603/196000000000000000000", + "cap_below_phase_cell_power": "213766537558043461603/196000000000000000000", + "complex_above_effective": "1/14000000000", + "complex_below_one_over_32": "78807679/2800000000", + "complex_endpoint": "1/7000000000", + "epsilon_below_one": "1/14000000000", + "epsilon_positive": "13999999999/14000000000", + "fine_prime_halo_umbrella": "7/2", + "fused_gaussian_above_kappa": "55869615191/196000000000000000000", + "gaussian_above_main": "6956538397/98000000000000000000", + "global_coordinate_router_above_kappa": "1/3500000000", + "global_gamma_power_slack": "9/140000000000", + "group_below_dimension": "1/7000000000", + "group_bit_router_above_kappa": "17467403797/49000000000000000000", + "group_gauge_power_slack": "17766537578343461603/98000000000000000000", + "group_key_fits_record": "1/7000000000", + "group_positive": "13999999997/14000000000", + "group_scans_above_kappa": "6978269199/7000000000", + "halo_covers_generic_inverse_radius": "5", + "improvement_over_user_baseline": "686714790400418148631/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": "5591307679/39200000000000000000", + "leaf_saving_above_effective": "2791307679/39200000000000000000", + "main_transform_above_kappa": "41956538397/196000000000000000000", + "membership_arithmetic_fits_record": "1/14000000000", + "microbox_face_corrections_above_kappa": "269489134601/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": "13956538399/14000000000", + "positive_layout_slack": "1/14000000000", + "q_below_effective": "1/14000000000", + "q_below_internal": "1/14000000000", + "q_below_leaf": "5591307679/39200000000000000000", + "q_positive": "43461603/14000000000", + "short_record_fallback": "2791307679/2800000000", + "source_axis_superpolynomial": "1/14000000000", + "sparse_union_movement_above_kappa": "79625000055956538397/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": 41160, + "16": 416, + "2": 8208, + "24": 416, + "3": 8892, + "32": 416, + "4": 1638, + "40": 416, + "48": 416, + "5": 3006, + "56": 416, + "6": 324, + "64": 416, + "7": 270, + "72": 208 + }, + "paid_calls": 66618, + "previous_open_pr5612": "310299/100000000", + "productive_fields": 13030, + "query_shears": 15, + "rank_mass_surplus": 760, + "raw_ceiling": { + "derivative_upper": "-740697379185468431509527785786174826824653618646482726012475981/3138550867693340381917894711603833208051177722232017256448", + "interval": [ + "0", + "17/5000" + ] + }, + "raw_headroom": [ + "547057/100000000000000", + "273529/50000000000000" + ], + "raw_root_interval": [ + "310440547057/100000000000000", + "155220273529/50000000000000" + ], + "relative_gain_percent": "4700/103433", + "strictification": { + "alpha": { + "lower": "0.999999994949040620715159453913", + "upper": "0.999999994949040620715159453914" + }, + "cutoff": 17, + "delta": { + "lower": "0.971449605270240749626604265289", + "upper": "0.971449605270240749626604265290" + }, + "floor": 18, + "gamma": { + "lower": "0.967776316507983286876701071739", + "upper": "0.967776316507983286876701071740" + }, + "normalized_paid_upper": "5242880004882813/5242880536870912", + "power": 1024, + "reserve": "1/10000000000", + "tail_block": 128, + "tail_decay": "39/40", + "tail_offset": "1/5", + "tested": "6208801/2000000000" + }, + "targets": { + "1": 36, + "145": 208, + "17": 416, + "2": 72, + "25": 416, + "33": 416, + "4": 1638, + "41": 416, + "49": 416, + "5": 180, + "57": 416, + "65": 416, + "7": 90, + "73": 208, + "8": 288, + "9": 7398 + }, + "whole_idle_jobs": 3120 + }, + "controls": { + "extra_unpaid_transport": "Complete field and call counts", + "missing_cut_correction": "All 756 public and owned rows", + "missing_initial_basis": "All 756 public and owned rows", + "missing_owned_initialization": "Scalar destination and coefficient", + "old_target_credit": "Every productive helper has a native target" + }, + "events": 25525, + "local": { + "endpoint_coefficients": 571536, + "helpers": { + "1": 2, + "2": 4, + "4": 91, + "5": 10, + "7": 5, + "8": 16, + "9": 411 + }, + "owned_lifetimes": 11, + "paid": { + "1": 2200, + "2": 456, + "3": 494, + "4": 91, + "5": 167, + "6": 18, + "7": 15 + }, + "peak_owned_fields": 2, + "public_inputs": 747, + "real_scalar_allowance": 220712 + }, + "local_paid_delta": { + "5": -1 + }, + "local_target_delta": { + "4": 1, + "9": -1 + }, + "native": { + "distinct_maps": 2917, + "helper_normalizers": 1078, + "helpers": { + "1": 2, + "2": 4, + "4": 91, + "5": 10, + "7": 5, + "8": 16, + "9": 411 + }, + "main_adapters": 208, + "proof": "Every signed Pauli image and exact global phase; frame induction at every positive tensor width", + "recipe_payload_sha256": "93be400a7ad26a4ec5a95de46ae510b434a94ed06b9272988cd4275da9543ad3", + "retired_helper": 573, + "wrong_phase_rejected": true + }, + "physical": { + "central_square_columns": 53248, + "full_calls": 18, + "main_targets": { + "145": 208, + "17": 416, + "25": 416, + "33": 416, + "41": 416, + "49": 416, + "57": 416, + "65": 416, + "73": 208 + }, + "new_paid_jobs": 0, + "physical_contacts": 7488, + "ports": 104, + "route_payload_sha256": "7f4f0ca768ffbc4f93dcff575592c4c67411f46b4289e45b73f715a2ad47b142", + "tensor_rule": "Factorwise native maps; scalar signs stay outside the tensor power.", + "whole_idle_jobs": { + "16": 416, + "24": 416, + "32": 416, + "40": 416, + "48": 416, + "56": 416, + "64": 416, + "72": 208 + }, + "wrapper_sites": [ + 1, + 3, + 5, + 7, + 9, + 11, + 13, + 15, + 17, + 19, + 21, + 23, + 25, + 27, + 29, + 31 + ] + }, + "status": "PASS_P104_DELAYED_BASIS_KAPPA_00310440", + "transpose": { + "arithmetic": "Dense integer rows with binary denominators; reverse chronology", + "coefficients": 571536, + "columns": 756 + }, + "witness": { + "cancel": [ + [ + 337, + "2" + ] + ], + "cut": 11285, + "frame": 240, + "helper": 341, + "kind": "boundary_basis", + "output": [ + [ + 93, + "-2" + ], + [ + 339, + "-2" + ], + [ + 341, + "1" + ], + [ + 351, + "2" + ] + ], + "reverse": false + } +} diff --git a/research/p104-delayed-basis/SOURCES.json b/research/p104-delayed-basis/SOURCES.json new file mode 100644 index 0000000000..2e5637231e --- /dev/null +++ b/research/p104-delayed-basis/SOURCES.json @@ -0,0 +1,63 @@ +{ + "schema_version": 1, + "base_commit": "d7633ce230196a1d5d061347de7a0fd8be512ed6", + "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-delayed-basis/inputs/pr5602-construct.py", + "usage": "input", + "pin": "head:f9525a27b8df57d60bedcf9483638017fa56c8ab:research/p104-delayed-basis/inputs/pr5602-construct.py", + "sha256": "2360066b0a1390c60a86d9788ada1504478e7e48bbfe3fcdf27a5563379fc001", + "git_blob": "ef5936ca89d6502d7f6af1ce6903d8500c117401" + }, + { + "path": "research/p104-delayed-basis/inputs/pr5602-WITNESS.json", + "usage": "input", + "pin": "head:f9525a27b8df57d60bedcf9483638017fa56c8ab:research/p104-delayed-basis/inputs/pr5602-WITNESS.json", + "sha256": "e4dfc526453eb9d232772ffdb587fff1923e247341405aee031318b0fb9cb638", + "git_blob": "8073b3c9772a4a7c94e07d613c2f5c45b1c650fc" + }, + { + "path": "research/p104-delayed-basis/inputs/pr5612-source.tar.gz", + "usage": "input", + "pin": "head:f9525a27b8df57d60bedcf9483638017fa56c8ab:research/p104-delayed-basis/inputs/pr5612-source.tar.gz", + "sha256": "79ccf2f4976351b7797f2bda0721a849829b75ed276d82a77c4f0c4f4059f71f", + "git_blob": "0527764dec5bae5b23893cd4126109e703fa1b1f" + } + ], + "external_inputs": [ + { + "local_path": "inputs/pr5602-construct.py", + "source_commit": "6c224aa720203c4f4615e6538d8038a275387db8", + "source_path": "research/p104-coupled-helper-bases/construct.py", + "sha256": "2360066b0a1390c60a86d9788ada1504478e7e48bbfe3fcdf27a5563379fc001", + "git_blob": "ef5936ca89d6502d7f6af1ce6903d8500c117401" + }, + { + "local_path": "inputs/pr5602-WITNESS.json", + "source_commit": "6c224aa720203c4f4615e6538d8038a275387db8", + "source_path": "research/p104-coupled-helper-bases/WITNESS.json", + "sha256": "e4dfc526453eb9d232772ffdb587fff1923e247341405aee031318b0fb9cb638", + "git_blob": "8073b3c9772a4a7c94e07d613c2f5c45b1c650fc" + } + ], + "source_export": { + "local_path": "inputs/pr5612-source.tar.gz", + "sha256": "79ccf2f4976351b7797f2bda0721a849829b75ed276d82a77c4f0c4f4059f71f", + "commit": "faa9f6dbe6b8cc4a996d3edeca71823056453e1a", + "package": "research/p104-delayed-shared-relay", + "files": 24, + "source_url": "https://github.com/CrocSwap/integer-mult-bounds/pull/5612" + } +} diff --git a/research/p104-delayed-basis/TASK.json b/research/p104-delayed-basis/TASK.json new file mode 100644 index 0000000000..ea46670c7d --- /dev/null +++ b/research/p104-delayed-basis/TASK.json @@ -0,0 +1,106 @@ +{ + "schema_version": 1, + "task_id": "scalar-to-moment", + "priority_revision": 7, + "base_commit": "d7633ce230196a1d5d061347de7a0fd8be512ed6", + "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": "Compose one existing paid-boundary helper identity with changed public dependencies and prepared owned storage; verify the complete bound.", + "scope_change_reason": "User assigned composition with concurrent methods. The existing basis witness remains valid after our changed word; its full target debit is essential.", + "bottleneck_link": "Complete changed invoice increases kappa from .00310299 to .00310440.", + "budget_minutes": 240, + "stop_rule": "Complete verification and publication; pause research at30percent account usage remaining.", + "outcome": "completed", + "evidence": "PROOF.md, WITNESS.json and RESULT.json: source-bound construction, all756 rows/columns, exact native/caller/cost/compiler and58 outer predicates.", + "author": "flyingviper with substantial OpenAI Codex assistance and independent agents", + "ai_assistance": "Substantial OpenAI Codex assistance with independent agents; no human or proof-kernel acceptance claimed.", + "open_questions": [ + { + "question": "Can another boundary identity survive a changed independent split cut?", + "why_it_matters": "It could remove a paid call while retaining sufficient productive target rank.", + "first_step": "Derive its actual current-value relation after the last source read and compare complete paid/target changes.", + "blocked_by": "Causal charts, all independent inputs and full ordinary/owned costs must remain valid." + } + ] +} diff --git a/research/p104-delayed-basis/VERIFY.json b/research/p104-delayed-basis/VERIFY.json new file mode 100644 index 0000000000..3d368b05f9 --- /dev/null +++ b/research/p104-delayed-basis/VERIFY.json @@ -0,0 +1,38 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/p104-delayed-basis/inputs/pr5602-construct.py", + "research/p104-delayed-basis/inputs/pr5602-WITNESS.json", + "research/p104-delayed-basis/inputs/pr5612-source.tar.gz" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-W", + "error", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 540, + "checks": "Authenticate all source exports and witness; compare two constructors; check756 rows/transpose columns, signed native maps, full caller, exact invoice, two interval engines, compiler and58 outer predicates; reject five semantic corruptions and compare full receipt." + }, + { + "argv": [ + "{python}", + "-I", + "-W", + "error", + "-B", + "-O", + "{package}/verify.py" + ], + "timeout_seconds": 540, + "checks": "Authenticate all source exports and witness; compare two constructors; check756 rows/transpose columns, signed native maps, full caller, exact invoice, two interval engines, compiler and58 outer predicates; reject five semantic corruptions and compare full receipt." + } + ] +} diff --git a/research/p104-delayed-basis/WITNESS.json b/research/p104-delayed-basis/WITNESS.json new file mode 100644 index 0000000000..3fdf391eb6 --- /dev/null +++ b/research/p104-delayed-basis/WITNESS.json @@ -0,0 +1,67 @@ +{ + "source_commit": "6c224aa720203c4f4615e6538d8038a275387db8", + "source_path": "research/p104-coupled-helper-bases/WITNESS.json", + "source_sha256": "e4dfc526453eb9d232772ffdb587fff1923e247341405aee031318b0fb9cb638", + "source_witness": { + "kind": "boundary_basis", + "reverse": false, + "helper": 341, + "cut": 11151, + "frame": 240, + "output": [ + [ + 93, + "-2" + ], + [ + 339, + "-2" + ], + [ + 341, + "1" + ], + [ + 351, + "2" + ] + ], + "cancel": [ + [ + 337, + "2" + ] + ] + }, + "adapted_witness": { + "kind": "boundary_basis", + "reverse": false, + "helper": 341, + "cut": 11285, + "frame": 240, + "output": [ + [ + 93, + "-2" + ], + [ + 339, + "-2" + ], + [ + 341, + "1" + ], + [ + 351, + "2" + ] + ], + "cancel": [ + [ + 337, + "2" + ] + ] + } +} diff --git a/research/p104-delayed-basis/WORD.json.gz b/research/p104-delayed-basis/WORD.json.gz new file mode 100644 index 0000000000..cf731bf8c4 Binary files /dev/null and b/research/p104-delayed-basis/WORD.json.gz differ diff --git a/research/p104-delayed-basis/construct.py b/research/p104-delayed-basis/construct.py new file mode 100644 index 0000000000..539028e9d1 --- /dev/null +++ b/research/p104-delayed-basis/construct.py @@ -0,0 +1,38 @@ +"""Compose only Ali Romman's PR5602 helper341 paid-boundary change. + +PR5602 head6c224aa720203c4f4615e6538d8038a275387db8 supplied the exact +boundary relation. Adapted and independently checked for flyingviper by +OpenAI Codex. Apache-2.0. This is a composition, not a new basis identity. +""" +from copy import deepcopy +from hashlib import sha256 +import json + +SOURCE_CANONICAL_SHA256='df44a24231edd04954ebf066b1efb311441e5d9d48b64d03e555cbea087b25c6' +CUT=11285 +MARKER=['ADD',346,341,'1',240] +REMOVED=[['SCALE',341,'-1',240],['ADD',341,339,'-1',240], + ['ADD',341,337,'1',240],['MOVE',341,240,127,False], + ['ADD',341,744,'-1',127],['SCALE',341,'-1',127], + ['ADD',341,712,'4',127],['ADD',341,744,'1',127]] + +def need(ok,why): + if not ok:raise ValueError(why) + +def construct(source): + digest=sha256(json.dumps(source,sort_keys=True,separators=(',',':')).encode()).hexdigest() + need(digest==SOURCE_CANONICAL_SHA256,'Exact final delayed/prepared source payload') + program=source['program'] + need(program[CUT]==MARKER,'Pinned final helper341 source read') + need(source['initial'][341]==3 and source['final'][341]==127,'Original helper341 interface') + need(all(source['initial'][r]==3 for r in [93,339,341,351]),'Initial helper basis at common zero chart') + tail=program[CUT+1:] + need(not any(e[0] in ('ADD','COPY') and e[2]==341 for e in tail),'No later helper341 source read') + need([e for e in tail if e[1]==341]==REMOVED,'Exact retired suffix, including one rank5 transport') + before=[['ADD',341,93,'2',3],['ADD',341,339,'2',3],['ADD',341,351,'-2',3]] + middle=[['ADD',341,337,'-2',240]] + out=deepcopy(source) + out['program']=before+deepcopy(program[:CUT+1])+middle+[deepcopy(e) for e in tail if e[1]!=341] + out['final'][341]=240 + need(len(out['program'])==25525,'Four added basis operations replace eight suffix operations') + return out diff --git a/research/p104-delayed-basis/inputs/pr5602-WITNESS.json b/research/p104-delayed-basis/inputs/pr5602-WITNESS.json new file mode 100644 index 0000000000..8073b3c977 --- /dev/null +++ b/research/p104-delayed-basis/inputs/pr5602-WITNESS.json @@ -0,0 +1,981 @@ +{ + "schema": "p104-coupled-helper-bases/1", + "steps": [ + { + "kind": "boundary_basis", + "reverse": true, + "helper": 652, + "cut": 11360, + "frame": 120, + "output": [ + [ + 205, + "-2" + ], + [ + 648, + "-1" + ], + [ + 649, + "-1" + ], + [ + 650, + "1" + ], + [ + 652, + "1" + ] + ], + "cancel": [ + [ + 648, + "1" + ], + [ + 649, + "1" + ], + [ + 650, + "-1" + ] + ] + }, + { + "kind": "boundary_basis", + "reverse": false, + "helper": 341, + "cut": 11151, + "frame": 240, + "output": [ + [ + 93, + "-2" + ], + [ + 339, + "-2" + ], + [ + 341, + "1" + ], + [ + 351, + "2" + ] + ], + "cancel": [ + [ + 337, + "2" + ] + ] + }, + { + "kind": "boundary_basis", + "reverse": true, + "helper": 596, + "cut": 11378, + "frame": 1053, + "output": [ + [ + 188, + "-1" + ], + [ + 592, + "-1" + ], + [ + 593, + "1" + ], + [ + 594, + "1" + ], + [ + 596, + "1" + ] + ], + "cancel": [ + [ + 592, + "1" + ], + [ + 593, + "-1" + ], + [ + 594, + "-1" + ] + ] + }, + { + "kind": "boundary_basis", + "reverse": true, + "helper": 668, + "cut": 11449, + "frame": 1051, + "output": [ + [ + 115, + "2" + ], + [ + 664, + "1" + ], + [ + 665, + "1" + ], + [ + 666, + "-1" + ], + [ + 668, + "1" + ] + ], + "cancel": [ + [ + 664, + "-1" + ], + [ + 665, + "-1" + ], + [ + 666, + "1" + ] + ] + }, + { + "kind": "boundary_basis", + "reverse": true, + "helper": 684, + "cut": 11493, + "frame": 1049, + "output": [ + [ + 126, + "2" + ], + [ + 680, + "-1" + ], + [ + 681, + "1" + ], + [ + 682, + "1" + ], + [ + 684, + "1" + ] + ], + "cancel": [ + [ + 680, + "1" + ], + [ + 681, + "-1" + ], + [ + 682, + "-1" + ] + ] + }, + { + "kind": "boundary_basis", + "reverse": true, + "helper": 649, + "cut": 11525, + "frame": 597, + "output": [ + [ + 649, + "1" + ], + [ + 650, + "-1" + ] + ], + "cancel": [ + [ + 198, + "1/2" + ], + [ + 650, + "1" + ] + ] + }, + { + "kind": "coupled_handoff", + "cut": 10053, + "frame": 306, + "group": [ + 3, + 127 + ], + "pivot": 61, + "v": [ + [ + 257, + "-1/2" + ], + [ + 261, + "1" + ] + ], + "u": [ + [ + 257, + "1" + ] + ], + "source_functional": [ + [ + 61, + "2" + ], + [ + 259, + "2" + ], + [ + 265, + "2" + ] + ], + "output_direction": [ + [ + 115, + "-1/2" + ], + [ + 173, + "1/2" + ], + [ + 188, + "-1/2" + ], + [ + 205, + "-1/2" + ], + [ + 257, + "1/2" + ], + [ + 258, + "-1/2" + ], + [ + 263, + "1/2" + ], + [ + 265, + "1/2" + ], + [ + 268, + "-1/2" + ], + [ + 269, + "-1/2" + ], + [ + 271, + "1/2" + ] + ] + }, + { + "kind": "coupled_handoff", + "cut": 12429, + "frame": 516, + "group": [ + 3, + 127 + ], + "pivot": 432, + "v": [ + [ + 20, + "1" + ], + [ + 110, + "-2" + ], + [ + 435, + "1" + ] + ], + "u": [ + [ + 37, + "2" + ], + [ + 110, + "1" + ] + ], + "source_functional": [ + [ + 21, + "-1" + ], + [ + 435, + "-1" + ] + ], + "output_direction": [ + [ + 432, + "2" + ], + [ + 433, + "2" + ], + [ + 434, + "-1" + ], + [ + 435, + "-1" + ], + [ + 436, + "-1" + ], + [ + 437, + "-1" + ], + [ + 440, + "-1" + ], + [ + 441, + "-1" + ], + [ + 446, + "1" + ], + [ + 447, + "1" + ] + ] + }, + { + "kind": "coupled_handoff", + "cut": 13584, + "frame": 603, + "group": [ + 3, + 127 + ], + "pivot": 572, + "v": [ + [ + 572, + "1/4" + ], + [ + 573, + "-1/4" + ], + [ + 710, + "1" + ] + ], + "u": [ + [ + 710, + "1" + ] + ], + "source_functional": [ + [ + 572, + "1/4" + ], + [ + 573, + "-1/4" + ] + ], + "output_direction": [ + [ + 115, + "2" + ], + [ + 126, + "-2" + ], + [ + 205, + "-2" + ], + [ + 242, + "2" + ], + [ + 243, + "-2" + ], + [ + 247, + "-2" + ], + [ + 249, + "2" + ], + [ + 252, + "-2" + ], + [ + 306, + "-2" + ], + [ + 311, + "-4" + ], + [ + 317, + "-2" + ], + [ + 456, + "4" + ], + [ + 457, + "-4" + ], + [ + 498, + "4" + ], + [ + 499, + "2" + ], + [ + 502, + "-2" + ], + [ + 503, + "2" + ], + [ + 572, + "2" + ], + [ + 573, + "-2" + ], + [ + 710, + "1" + ] + ] + }, + { + "kind": "coupled_handoff", + "cut": 13638, + "frame": 391, + "group": [ + 3, + 127 + ], + "pivot": 345, + "v": [ + [ + 345, + "1/8" + ], + [ + 351, + "-1/4" + ], + [ + 712, + "1" + ] + ], + "u": [ + [ + 712, + "1" + ] + ], + "source_functional": [ + [ + 93, + "1/4" + ] + ], + "output_direction": [ + [ + 93, + "4" + ], + [ + 205, + "-4" + ], + [ + 343, + "-2" + ], + [ + 344, + "-2" + ], + [ + 345, + "-2" + ], + [ + 347, + "-2" + ], + [ + 348, + "-2" + ], + [ + 349, + "-2" + ], + [ + 350, + "2" + ], + [ + 351, + "2" + ], + [ + 712, + "1" + ] + ] + }, + { + "kind": "coupled_handoff", + "cut": 13670, + "frame": 462, + "group": [ + 3, + 127 + ], + "pivot": 14, + "v": [ + [ + 14, + "1/8" + ], + [ + 52, + "-1/4" + ], + [ + 727, + "1" + ] + ], + "u": [ + [ + 727, + "1" + ] + ], + "source_functional": [ + [ + 14, + "1/4" + ] + ], + "output_direction": [ + [ + 14, + "4" + ], + [ + 126, + "-4" + ], + [ + 402, + "-4" + ], + [ + 403, + "-4" + ], + [ + 727, + "1" + ] + ] + }, + { + "kind": "coupled_handoff", + "cut": 13975, + "frame": 424, + "group": [ + 3, + 127 + ], + "pivot": 3, + "v": [ + [ + 3, + "1/4" + ], + [ + 67, + "1/8" + ], + [ + 722, + "1" + ] + ], + "u": [ + [ + 722, + "1" + ] + ], + "source_functional": [ + [ + 3, + "1/4" + ] + ], + "output_direction": [ + [ + 3, + "4" + ], + [ + 115, + "-4" + ], + [ + 370, + "-4" + ], + [ + 372, + "-4" + ], + [ + 722, + "1" + ] + ] + }, + { + "kind": "coupled_handoff", + "cut": 14010, + "frame": 252, + "group": [ + 3, + 127 + ], + "pivot": 76, + "v": [ + [ + 76, + "1/8" + ], + [ + 87, + "-1/4" + ], + [ + 717, + "1" + ] + ], + "u": [ + [ + 717, + "1" + ] + ], + "source_functional": [ + [ + 76, + "1/4" + ] + ], + "output_direction": [ + [ + 76, + "4" + ], + [ + 188, + "-4" + ], + [ + 226, + "-4" + ], + [ + 227, + "-4" + ], + [ + 717, + "1" + ] + ] + }, + { + "kind": "coupled_handoff", + "cut": 9716, + "frame": 267, + "group": [ + 3, + 127 + ], + "pivot": 224, + "v": [ + [ + 57, + "1" + ] + ], + "u": [ + [ + 57, + "-1" + ], + [ + 81, + "1" + ] + ], + "source_functional": [ + [ + 227, + "-1" + ] + ], + "output_direction": [ + [ + 115, + "1/2" + ], + [ + 146, + "1/2" + ], + [ + 151, + "1/2" + ], + [ + 188, + "-1" + ], + [ + 205, + "1/2" + ], + [ + 225, + "1/2" + ], + [ + 226, + "-1/2" + ], + [ + 227, + "-1" + ], + [ + 229, + "1/2" + ], + [ + 230, + "1/2" + ], + [ + 233, + "1/2" + ], + [ + 234, + "1/2" + ], + [ + 236, + "-1" + ], + [ + 237, + "-1/2" + ], + [ + 238, + "1/2" + ] + ] + }, + { + "kind": "coupled_handoff", + "cut": 12126, + "frame": 477, + "group": [ + 3, + 127 + ], + "pivot": 400, + "v": [ + [ + 42, + "1" + ] + ], + "u": [ + [ + 41, + "1" + ], + [ + 42, + "1" + ] + ], + "source_functional": [ + [ + 403, + "1" + ] + ], + "output_direction": [ + [ + 126, + "3/2" + ], + [ + 133, + "1/2" + ], + [ + 146, + "1/2" + ], + [ + 151, + "-1/2" + ], + [ + 400, + "1" + ], + [ + 401, + "-1" + ], + [ + 403, + "1" + ], + [ + 404, + "-1/2" + ], + [ + 405, + "-1/2" + ], + [ + 406, + "-1/2" + ], + [ + 407, + "-1/2" + ], + [ + 408, + "-1/2" + ], + [ + 409, + "-1" + ], + [ + 410, + "-1/2" + ], + [ + 412, + "1/2" + ], + [ + 413, + "1" + ], + [ + 414, + "1/2" + ] + ] + } + ] +} diff --git a/research/p104-delayed-basis/inputs/pr5602-construct.py b/research/p104-delayed-basis/inputs/pr5602-construct.py new file mode 100644 index 0000000000..ef5936ca89 --- /dev/null +++ b/research/p104-delayed-basis/inputs/pr5602-construct.py @@ -0,0 +1,215 @@ +"""Construct the fixed helper basis changes and coupled handoffs. + +Ali Romman with substantial OpenAI Codex assistance. Apache-2.0. +The source word and its contributors are recorded in SOURCES.json. +""" +from copy import deepcopy +from fractions import Fraction as Q +import local as L + + +def row(pairs): + out = {r: Q(q) for r, q in pairs} + L.need(len(out) == len(pairs) and all(out.values()), 'Unique nonzero witness row') + return out + + +def unit(q): + n, d = abs(q.numerator), q.denominator + return n > 0 and n & (n-1) == 0 and d & (d-1) == 0 + + +def main_fields(w): + return set(w['live']) | {r+112 for r in w['live']} + + +def prefix(w, cut): + n = w['public'] + rows = [{i: Q(1)} for i in range(n)] + [{} for _ in range(8)] + frames = w['initial'][:] + [None]*8 + L.need(0 <= cut < len(w['program']), 'Cut in the literal word') + for e in w['program'][:cut+1]: + op, r = e[:2] + if op == 'MOVE': + L.need(frames[r] == e[2], 'Prefix transport source') + frames[r] = e[3] + elif op in ('INIT', 'CLEAR'): + rows[r] = {} + frames[r] = e[2] if op == 'INIT' else None + else: + L.need(frames[r] == e[-1], 'Prefix scalar chart') + if op == 'SCALE': + rows[r] = {k: Q(e[-2])*v for k, v in rows[r].items()} + else: + L.need(frames[e[2]] == e[-1], 'Prefix source chart') + if op == 'COPY': + L.need(not rows[r], 'Source COPY into zero') + L.add(rows[r], rows[e[2]], Q(e[-2])) + return rows, frames + + +def suffix_columns(w, cut): + cols = [{i: Q(1)} for i in range(w['public'])] + [{} for _ in range(8)] + for e in reversed(w['program'][cut+1:]): + op, r = e[:2] + if op == 'MOVE': + continue + if op in ('INIT', 'CLEAR'): + cols[r] = {} + elif op == 'SCALE': + cols[r] = {k: Q(e[-2])*v for k, v in cols[r].items()} + else: + L.add(cols[e[2]], cols[r], Q(e[-2])) + if op == 'COPY': + cols[r] = {} + return cols + + +def transpose(w): + program = [] + for e in reversed(w['program']): + op, r = e[:2] + if op == 'MOVE': + z = ['MOVE', r, e[3], e[2], e[4]] + elif op in ('ADD', 'COPY'): + z = ['ADD', e[2], r, e[3], e[4]] + elif op == 'SCALE': + z = e[:] + else: + L.need(op in ('INIT', 'CLEAR'), 'Transpose opcode') + z = ['CLEAR' if op == 'INIT' else 'INIT', r, e[2]] + program.append(z) + return dict(w, initial=w['final'][:], final=w['initial'][:], program=program) + + +def boundary_basis(w, c): + w = transpose(w) if c['reverse'] else deepcopy(w) + h, cut, frame = c['helper'], c['cut'], c['frame'] + output, cancel = row(c['output']), row(c['cancel']) + helpers = set(range(w['public'])) - main_fields(w) + L.need(h in helpers and unit(output.get(h, Q(0))), 'Helper unit boundary pivot') + source = w['initial'][h] + L.need(set(output) <= {r for r in helpers if w['initial'][r] == source}, + 'Boundary basis uses one helper input chart') + rows, frames = prefix(w, cut) + L.need(frames[h] == frame and h not in cancel and + all(frames[r] == frame for r in cancel), 'Available boundary cancellation') + value = rows[h].copy() + for r, q in cancel.items(): + L.add(value, rows[r], -q) + L.need(value == output, 'Exact boundary helper relation') + tail = w['program'][cut+1:] + L.need(not any(e[0] in ('ADD', 'COPY') and e[2] == h for e in tail), + 'Retired helper has no later source read') + coefficient = output[h] + before = [['ADD', h, r, str(-q/coefficient), source] + for r, q in sorted(output.items()) if r != h] + middle = [['ADD', h, r, str(-q), frame] for r, q in sorted(cancel.items())] + if coefficient != 1: + middle.append(['SCALE', h, str(1/coefficient), frame]) + w['program'] = before + w['program'][:cut+1] + middle + [e for e in tail if e[1] != h] + w['final'][h] = frame + return transpose(w) if c['reverse'] else w + + +def inverse(ops): + out = [] + for e in reversed(ops): + z = e[:] + z[-2] = str(1/Q(e[-2]) if e[0] == 'SCALE' else -Q(e[-2])) + out.append(z) + return out + + +def basis(a, b, p, frame): + """Return a matrix R with a R = e_p^T and R e_p = b.""" + L.need(sum(a.get(h, 0)*q for h, q in b.items()) == 1, 'Dual basis pairing') + q = next((h for h in sorted(a) if unit(a[h])), None) + L.need(q is not None, 'Dyadic basis pivot') + ops = [] if p == q else [ + ['ADD', p, q, '1', frame], ['ADD', q, p, '-1', frame], + ['ADD', p, q, '1', frame], ['SCALE', q, '-1', frame]] + ops += [['ADD', j, q, str(c), frame] for j, c in sorted(b.items()) if j != q] + if a[q] != 1: + ops.append(['SCALE', q, str(1/a[q]), frame]) + ops += [['ADD', q, j, str(-c/a[q]), frame] for j, c in sorted(a.items()) if j != q] + return ops + + +def relabel(e, mapping): + z = e[:] + z[1] = mapping(z[1]) + if z[0] in ('ADD', 'COPY'): + z[2] = mapping(z[2]) + return z + + +def handoff(w, c): + n, cut, frame, p = w['public'], c['cut'], c['frame'], c['pivot'] + source, target = c['group'] + group = {h for h in range(n) if h not in main_fields(w) and + (w['initial'][h], w['final'][h]) == (source, target)} + v, u = row(c['v']), row(c['u']) + pairing = sum(v.get(h, 0)*q for h, q in u.items()) + L.need(unit(pairing), 'Nonzero dyadic handoff pairing') + v = {h: q/pairing for h, q in v.items()} + rows, frames = prefix(w, cut) + L.need(all(f is None for f in frames[n:]), 'No owned field at handoff cut') + L.need(p in group and frames[p] == frame and + all(0 <= h < n and frames[h] == frame for h in v.keys() | u.keys()), + 'Public handoff fields share the cut chart') + L.need(L.span(w['frames'][source]) < L.span(w['frames'][frame]) < + L.span(w['frames'][target]), 'Strict nested handoff boundaries') + cols, a, b = suffix_columns(w, cut), {}, {} + for r, q in v.items(): + L.add(a, rows[r], q) + for r, q in u.items(): + L.add(b, cols[r], q) + L.need(a == row(c['source_functional']) and b == row(c['output_direction']), + 'Exact prefix and suffix handoff witnesses') + L.need(set(a) <= group and set(b) <= group, 'Handoff has only helper boundary support') + input_ops, cut_basis = basis(a, b, p, source), basis(v, u, p, frame) + output_ops = inverse(input_ops) + for e in output_ops: + e[-1] = target + old = lambda r: r+1 if r >= n else r + tail = lambda r: n if r == p else old(r) + out = deepcopy(w) + out['public'] = n+1 + out['initial'].append(frame) + out['final'][p] = frame + out['final'].append(target) + out['program'] = input_ops + [relabel(e, old) for e in w['program'][:cut+1]] + out['program'] += inverse(cut_basis) + [relabel(e, tail) for e in cut_basis] + out['program'] += [relabel(e, tail) for e in w['program'][cut+1:]] + out['program'] += [relabel(e, tail) for e in output_ops] + return out + + +def restore_copy_opcodes(w): + fresh, copies = set(), 0 + for e in w['program']: + op, r = e[:2] + if op == 'INIT': + fresh.add(r) + elif r in fresh and op != 'MOVE': + L.need(op == 'ADD', 'First owned write is the retained copy') + e[0] = 'COPY' + fresh.remove(r) + copies += 1 + L.need(not fresh and copies == 8, 'All eight owned copy paths remain') + + +def construct(base, witness): + L.need(witness['schema'] == 'p104-coupled-helper-bases/1', 'Witness schema') + L.need([s['kind'] for s in witness['steps']] == + ['boundary_basis']*6 + ['coupled_handoff']*9, 'Fixed fifteen changes') + word, evidence = deepcopy(base), [] + for step in witness['steps']: + word = boundary_basis(word, step) if step['kind'] == 'boundary_basis' else handoff(word, step) + check = L.replay(word) + evidence.append(dict(kind=step['kind'], public=word['public'], + events=len(word['program']), paid=check['paid'], helpers=check['helpers'])) + restore_copy_opcodes(word) + L.replay(word) + return word, evidence diff --git a/research/p104-delayed-basis/inputs/pr5612-source.tar.gz b/research/p104-delayed-basis/inputs/pr5612-source.tar.gz new file mode 100644 index 0000000000..0527764dec Binary files /dev/null and b/research/p104-delayed-basis/inputs/pr5612-source.tar.gz differ diff --git a/research/p104-delayed-basis/pricing.py b/research/p104-delayed-basis/pricing.py new file mode 100644 index 0000000000..462831f853 --- /dev/null +++ b/research/p104-delayed-basis/pricing.py @@ -0,0 +1,169 @@ +"""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 were prepared for thu-nmrc with OpenAI Codex assistance. +Helper-subspace targets were added by Ali Romman with 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('.00310440'), Q('.0031044005') +PREVIOUS = Q('.00310299') + + +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()) == 13030 and sum(paid.values()) == 66618, '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) + signed = Counter(T) + signed.subtract(P) + cap = Q('.0034') + derivative_upper = Q(0) + for rank, count in signed.items(): + logarithm = E.log_bounds(rank) + low = E.mul(E.power(rank, 1-cap), logarithm)[0] + high = rank*logarithm[1] + derivative_upper -= count*(low if count >= 0 else high) + L.need(derivative_upper < 0, 'Unique raw crossing below the retained BIT cap') + 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(39,40) + 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),1024 + 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':'.00310440','previous_open_pr5612':PREVIOUS,'gain':KAPPA-PREVIOUS, + 'relative_gain_percent':100*(KAPPA/PREVIOUS-1),'raw_root_interval':[lower,upper], + 'raw_headroom':[lower-KAPPA,upper-KAPPA], + 'raw_ceiling':{'interval':[Q(0),cap],'derivative_upper':derivative_upper},'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,'tail_decay':decay,'tail_block':128, + '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':local['peak_owned_fields'], + 'fixed_scalar_growth_bound':'At most 2^(16*26000) before native factors; a declared constant, not an attained norm.', + 'local_paid_rank_mass':sum(r*n for r,n in local['paid'].items()), + 'tensor_native_growth_bound':'Each rank-r Gaussian has row l1 norm at most 2^(rf); use local_paid_rank_mass for the whole word.'}, + '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-delayed-basis/sources.py b/research/p104-delayed-basis/sources.py new file mode 100644 index 0000000000..8742cbafa9 --- /dev/null +++ b/research/p104-delayed-basis/sources.py @@ -0,0 +1,42 @@ +"""Authenticate the official PR5612 export before importing its source closure. + +Prepared for flyingviper with substantial OpenAI Codex assistance. Apache-2.0. +Source-export format and payload checks follow the retained repository exporter. +""" +from contextlib import contextmanager +from hashlib import sha256,sha1 +from pathlib import Path,PurePosixPath +import gzip,importlib.util,io,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);m=importlib.util.module_from_spec(spec);sys.modules[name]=m;spec.loader.exec_module(m);return m +@contextmanager +def sources(): + pins=read(HERE/'SOURCES.json') + for p in pins['external_inputs']: + raw=(HERE/p['local_path']).read_bytes() + need(sha256(raw).hexdigest()==p['sha256'],'Pinned source SHA256 '+p['local_path']) + need(sha1(('blob '+str(len(raw))+'\0').encode()+raw).hexdigest()==p['git_blob'],'Pinned source blob '+p['local_path']) + pin=pins['source_export'];raw=(HERE/pin['local_path']).read_bytes() + need(sha256(raw).hexdigest()==pin['sha256'],'Exact published export archive') + with tempfile.TemporaryDirectory(prefix='p104-composed-source-') as directory: + root=Path(directory) + with tarfile.open(fileobj=io.BytesIO(gzip.decompress(raw))) as bundle: + names=[] + for m in bundle.getmembers(): + p=PurePosixPath(m.name) + need(m.isfile() and not p.is_absolute() and '..' not in p.parts and '\\' not in m.name and ':' not in m.name,'Regular relative source file') + need(m.name not in names,'Unique export path');names.append(m.name) + target=root.joinpath(*p.parts);target.parent.mkdir(parents=True,exist_ok=True);target.write_bytes(bundle.extractfile(m).read()) + manifest=read(root/'.research-export.json') + need(manifest['commit']==pin['commit'] and len(manifest['files'])==pin['files'],'Exact published source inventory') + need(set(names)=={'.research-export.json'}|{r['path'] for r in manifest['files']},'No omitted or extra source payload') + for r in manifest['files']: + b=(root/r['path']).read_bytes();need(len(b)==r['size'] and sha256(b).hexdigest()==r['sha256'],'Authenticated source payload '+r['path']) + package=root/pin['package'] + parent=load(package/'sources.py','retained_delayed_sources') + with parent.sources() as (prior,framework):yield package,prior,framework diff --git a/research/p104-delayed-basis/verify.py b/research/p104-delayed-basis/verify.py new file mode 100644 index 0000000000..57b7c78770 --- /dev/null +++ b/research/p104-delayed-basis/verify.py @@ -0,0 +1,72 @@ +"""Exact full verification of PR5602's boundary relation composed with PR5612. + +Prepared for flyingviper with substantial OpenAI Codex assistance. Apache-2.0. +Ali Romman's identity and original native/caller/price notices remain credited. +""" +from copy import deepcopy +from pathlib import Path +import json,sys +sys.dont_write_bytecode=True +HERE=Path(__file__).resolve().parent;sys.path.insert(0,str(HERE)) +from sources import sources,load,need,read +import construct + +def diff(a,b):return {k:a.get(k,0)-b.get(k,0) for k in a.keys()|b.keys() if a.get(k,0)!=b.get(k,0)} +def reject(action): + try:action() + except ValueError as error:return str(error) + raise ValueError('Invalid control accepted') + +def main(): + with sources() as (parent,prior,framework): + L=load(prior/'inputs/pr5599-local.py','local');L.ROOT=framework + R=load(parent/'prepared573_local.py','basis_prepared_checker') + # Use the published checker unchanged, including its owned573 contract. + parent_text=(parent/'inputs/pr5606-prepared.py').read_text() + body=parent_text[parent_text.index('def add('):] + for a,b in [('750','748'),('758','756'),('749','747'),('ascending = r < 748','ascending = not private')]:body=body.replace(a,b) + adapted=(parent/'prepared573_local.py').read_text() + need(body==adapted[adapted.index('def add('):],'Exact inherited checker adaptation') + source=read(parent/'WORD.json.gz');old=R.replay(source) + witness=read(HERE/'WITNESS.json') + originals=[s for s in read(HERE/'inputs/pr5602-WITNESS.json')['steps'] if s.get('kind')=='boundary_basis' and s['helper']==341] + need(originals==[witness['source_witness']],'Exact published basis witness') + need(dict(witness['source_witness'],cut=11285)==witness['adapted_witness'],'Only the causal cut index changes') + B=load(HERE/'inputs/pr5602-construct.py','published_boundary_constructor') + candidate=B.boundary_basis(source,witness['adapted_witness']) + need(candidate==construct.construct(source)==read(HERE/'WORD.json.gz'),'Published and specialized constructors agree on entire payload') + local=R.replay(candidate) + pd,td=diff(local['paid'],old['paid']),diff(local['helpers'],old['helpers']) + need(pd=={5:-1} and td=={4:1,9:-1},'Exact paid and productive target change') + need((local['public_inputs'],local['owned_lifetimes'],local['peak_owned_fields'])==(747,11,2),'Unchanged independent and owned interface') + need([e for e in candidate['program'] if e[0] in ('INIT','CLEAR','COPY')]==[e for e in source['program'] if e[0] in ('INIT','CLEAR','COPY')],'Ownership sequence unchanged') + print('PASS source pins, exact original witness, two constructors and all756 endpoint rows',flush=True) + transpose=R.reverse_columns(candidate) + print('PASS all756 dense transpose columns',flush=True) + native=L.native(candidate) + native['helpers'][2]-=1;native['helper_normalizers']-=2;native['retired_helper']=573 + need(native['helpers']==local['helpers'],'Native census includes both target changes') + print('PASS every signed native map',native['distinct_maps'],flush=True) + C=load(framework/'research/p104-productive-controller/caller.py','basis_caller') + caller=C.construct();need(caller==read(framework/'research/p104-productive-controller/CONTROLLER.json'),'Unchanged full caller') + physical=C.physical(caller,candidate) + print('PASS full physical caller',flush=True) + text=(parent/'pricing.py').read_text() + for a,b in read(HERE/'PRICING-EDITS.json'): + need(text.count(a)==1,'Unique pricing declaration');text=text.replace(a,b) + need(text==(HERE/'pricing.py').read_text(),'Only five declared pricing changes') + P=load(HERE/'pricing.py','basis_price');price=P.run(local,native,caller,physical) + print('PASS full price, two interval engines, compiler and58 outer predicates',price['raw_root_interval'],flush=True) + controls={} + for label,event in [('missing_initial_basis',['ADD',341,93,'2',3]),('missing_cut_correction',['ADD',341,337,'-2',240]),('missing_owned_initialization',['INIT',573,3])]: + bad=deepcopy(candidate);need(bad['program'].count(event)==1,'Unique corruption site');bad['program'].remove(event) + controls[label]=reject(lambda:R.replay(bad)) + bad=deepcopy(local);bad['helpers'][4]-=1;bad['helpers'][9]+=1 + controls['old_target_credit']=reject(lambda:P.assemble(bad,native,caller,physical)) + bad=deepcopy(local);bad['paid'][5]-=1 + controls['extra_unpaid_transport']=reject(lambda:P.assemble(bad,native,caller,physical)) + result=P.encode({'status':'PASS_P104_DELAYED_BASIS_KAPPA_00310440','events':len(candidate['program']),'witness':witness['adapted_witness'],'local_paid_delta':pd,'local_target_delta':td,'local':local,'transpose':transpose,'native':native,'physical':physical,'complete_cost':price,'controls':controls}) + if '--write' in sys.argv:(HERE/'RESULT.json').write_text(json.dumps(result,indent=2,sort_keys=True)+'\n',encoding='utf-8',newline='\n') + else:need(result==read(HERE/'RESULT.json'),'Exact complete saved receipt') + print(result['status'],flush=True) +if __name__=='__main__':main()