diff --git a/research/p104-retained-native-copy/LOCAL-EDITS.json b/research/p104-retained-native-copy/LOCAL-EDITS.json new file mode 100644 index 0000000000..abaad1de79 --- /dev/null +++ b/research/p104-retained-native-copy/LOCAL-EDITS.json @@ -0,0 +1,10 @@ +[ + [ + "8 <= owned <= 9", + "8 <= owned <= 22" + ], + [ + "0 < peak <= 2", + "0 < peak <= 12" + ] +] diff --git a/research/p104-retained-native-copy/NOTICE b/research/p104-retained-native-copy/NOTICE new file mode 100644 index 0000000000..b8818bf730 --- /dev/null +++ b/research/p104-retained-native-copy/NOTICE @@ -0,0 +1,61 @@ +Paid intermediate meetings and collective helper splits. +Ali Romman, with substantial OpenAI Codex assistance. Apache-2.0. +No subagents. All checks are author-side calculations. + +The complete PR5718 notice follows unchanged. + +Four paid interior public-basis changes. +Ali Romman, with substantial OpenAI Codex assistance. Apache-2.0. +No subagents. + +The following exact notice is retained from PR5660. + +New helper-subspace construction, proof and replay: +Ali Romman with substantial OpenAI Codex assistance. Apache-2.0. +The same assistant performed the construction and author-side checks. + +Retained contributions: +flyingviper: PR5605 shared relay, PR5612 delayed relay, and the PR5608/PR5613 +relay/split compositions. +Scratch-net: PR5606 prepared-helper identities and target debit. +Pierre-Loic Doulcet (hexapode): PR5565 commuting-contact construction, used as the exact source. +Ali Romman: PR5602 fixed boundary relations, PR5601 three-contact frame +change, PR5580 contact step, +and PR5544/5545 complete P104 caller. +Joel Pulikkan (GamingPuzzled): PR5569 priced helper handoff. +DreamingOfClouds: PR5561 free helper endpoints and PR5568 search tools. +thu-nmrc: PR5551 contact improvements. +Gareth Davidson (bitplane): PR2305 source composition. +David Arias: PR2152 coalesced P104 word. +Cinna Davis: PR2219 private reuse and the controller lineage. +Jacob Alan Sussman: productive mixed-target recursion. +zxv and Cao Yifan: exact intervals, compiler and native/pricing lineage. +GamingPuzzled: PR5472 successor handoff, a predecessor to the split concept. +The retained source notices preserve earlier geometry, BIT and analytic credit. + +The elementary rank-one basis identity is not claimed as a new general +linear-algebra theorem. The contribution is its explicit independent-target +use on this P104 word and the complete conditional kappa improvement. + +New contribution: Ali Romman, with substantial OpenAI Codex assistance. +The four-gate source-version rewrite composes zxv PR5643 and Ali Romman PR5644. +The A2 method retains Chris R/Clear1nsight PR3998 and ToikY PR4019 credit. +The compensated triangle method retains Cinna Davis PR4692 credit. +No subagents were used for this contribution. Apache-2.0. + +Concurrent PR5650 by zxv publishes the PR5643/PR5644 composition. PR5651 by +Ali Romman corroborates it. This package credits that released composition +and contributes the further four-gate placement. + +New work: distributed scalar updates on an unobserved public field interval, the exact witness and complete conditional price. Prepared for Ali Romman with substantial OpenAI Codex assistance. No subagents. Apache-2.0. The source archive retains all predecessor notices. + +Two-boundary main-assisted helper split and early cleanup: flyingviper with substantial +OpenAI Codex assistance, including independent AI review agents. Apache-2.0. + +Retained native-copy construction +Prepared by Ali Romman with substantial OpenAI Codex assistance. No subagents. +The paid-meeting source is PR5751 by Ali Romman with OpenAI Codex assistance. +The dimension-four span [265,194,164,75] is from Joel Pulikkan / GamingPuzzled +PR5739, with Claude Opus 5.5 assistance. The R22 block edits are not included. +The retained-copy mechanism, exact constructor, source-specific verification, +new price and proof are the contribution of this package. Apache-2.0. diff --git a/research/p104-retained-native-copy/PLAN.json b/research/p104-retained-native-copy/PLAN.json new file mode 100644 index 0000000000..05723fc4ea --- /dev/null +++ b/research/p104-retained-native-copy/PLAN.json @@ -0,0 +1,120 @@ +{ + "source_canonical_sha256": "c3b338bd5b48d916f332a64470a86d2ee5534d8839c9d80b23a7e89bed9742f5", + "appended_frames": [ + [ + 265, + 194, + 164, + 75 + ], + [ + 11, + 21, + 51, + 469 + ] + ], + "steps": [ + { + "anchor": 1090, + "changed_nodes": [ + 2002, + 3753, + 3756, + 3794, + 3817 + ], + "source_sha256": "8c6fbcb70e545c1af0dc0b61408b9113f613ced4fa971739e4be66a34b75d960", + "output_sha256": "80d2dc6dcb01650ab481f0f54093eb98fea9aa63aee71bcc55ab627d8fdb72f8" + }, + { + "anchor": 1091, + "changed_nodes": [ + 1988, + 3743, + 3777, + 3779, + 3782 + ], + "source_sha256": "80d2dc6dcb01650ab481f0f54093eb98fea9aa63aee71bcc55ab627d8fdb72f8", + "output_sha256": "103ed3cc9fdea6c4a814eaad7dd1948ab0db93276bab5bff23fdc0c784af154c" + }, + { + "anchor": 240, + "changed_nodes": [ + 1982, + 2718, + 3774, + 3788, + 3809 + ], + "source_sha256": "103ed3cc9fdea6c4a814eaad7dd1948ab0db93276bab5bff23fdc0c784af154c", + "output_sha256": "7bf889ef2a80c21052e4ea952ae4eebb724622a13d25a65efbc6f90681e7185a" + }, + { + "anchor": 243, + "changed_nodes": [ + 1999, + 3753, + 3794, + 3840, + 3843 + ], + "source_sha256": "7bf889ef2a80c21052e4ea952ae4eebb724622a13d25a65efbc6f90681e7185a", + "output_sha256": "de1a355529c63cb4bd390c1593be6f99ddd4f2c84838ccb6ea7adce1d1597758" + }, + { + "anchor": 260, + "changed_nodes": [ + 1990, + 1994, + 1996, + 3783 + ], + "source_sha256": "de1a355529c63cb4bd390c1593be6f99ddd4f2c84838ccb6ea7adce1d1597758", + "output_sha256": "d575b9cd85b2692e60167dbcf905f5a3a843c33d4072acd7b5dee27958cf4362" + }, + { + "anchor": 394, + "changed_nodes": [ + 1982, + 1986, + 1988, + 3814 + ], + "source_sha256": "d575b9cd85b2692e60167dbcf905f5a3a843c33d4072acd7b5dee27958cf4362", + "output_sha256": "3bcc97cc552116b889fb417e900203022dea2bacca2c91c3a567ea2b5f4aed07" + }, + { + "anchor": 431, + "changed_nodes": [ + 2005, + 2009, + 2010, + 3799 + ], + "source_sha256": "3bcc97cc552116b889fb417e900203022dea2bacca2c91c3a567ea2b5f4aed07", + "output_sha256": "c9cb46f134a10586f3a6785893aae5a138676f18cdaf26cde46e031554a6794c" + }, + { + "anchor": 470, + "changed_nodes": [ + 2017, + 2021, + 2022, + 3770 + ], + "source_sha256": "c9cb46f134a10586f3a6785893aae5a138676f18cdaf26cde46e031554a6794c", + "output_sha256": "3766e9a0fcf4e6ab8990c8c02ed35ed8073aa657f9cfbdc9269ed35eff18b124" + }, + { + "anchor": 549, + "changed_nodes": [ + 1962, + 3106 + ], + "source_sha256": "3766e9a0fcf4e6ab8990c8c02ed35ed8073aa657f9cfbdc9269ed35eff18b124", + "output_sha256": "75f429fc0c8b206f4439bfbda4b621fc62ea892e6e3008c17409f2d3ee0981bb" + } + ] +} diff --git a/research/p104-retained-native-copy/PRICING-EDITS.json b/research/p104-retained-native-copy/PRICING-EDITS.json new file mode 100644 index 0000000000..27df420ea8 --- /dev/null +++ b/research/p104-retained-native-copy/PRICING-EDITS.json @@ -0,0 +1,14 @@ +[ + [ + "Q('.00311301600'), Q('.003113016005')", + "Q('.00312192127'), Q('.003121921275')" + ], + [ + "PREVIOUS = Q('.00311024570')", + "PREVIOUS = Q('.00311301600')" + ], + [ + "'kappa_decimal':'0.00311301600','previous_pr5718'", + "'kappa_decimal':'0.00312192127','previous_pr5751'" + ] +] diff --git a/research/p104-retained-native-copy/PROOF.md b/research/p104-retained-native-copy/PROOF.md new file mode 100644 index 0000000000..b8d8e1cae1 --- /dev/null +++ b/research/p104-retained-native-copy/PROOF.md @@ -0,0 +1,188 @@ +# Retained native copies + +## Source and claim + +The source is PR5751 at `8483f9a679d06c1e270141dbc686a7e76e7a7522`. +Its package is `research/p104-paid-meeting-splits`. The source claim is +conditional kappa 0.00311301600. This package claims conditional kappa +0.00312192127 under the same five framework assumptions. + +The complete source export is retained and authenticated before import. +PLAN.json binds the source word and each of the nine changes by canonical SHA256. +A canonical hash uses sorted JSON keys and compact separators. + +All scalar rows below refer to decoded values. A native frame specifies the +physical encoding of each value. The public endpoint is + +```text +T = I + sum e_(r+112) e_r^T, over the 104 live ports r. +``` + +Every helper input is arbitrary. Owned input columns are erased by INIT and +must be zero at exit. COPY does not turn a public helper into a free zero. + +## Changed contact contract + +The source requires a scalar operation to use fields in the same native frame. +The new construction can supply its source operand from a retained converted copy. +It does not assume that an earlier value remains available. + +A chart node is the interval between successive MOVE, INIT or CLEAR operations +on one field. A scalar update does not change that field's chart node. +The constructor assigns a fixed new frame to each selected node. +Each main input and output keeps its source frame. + +A source version is the interval after one write or native MOVE and before the +next such operation on that field. The constructor groups scalar reads by the +actual source role and version. For each group, it compares the source frame +with the frames of its consumers. + +If the frames differ, the fixed plan has one other consumer frame B. Let A +be the source frame. Each accepted cache has B strictly contained in A. +The constructor emits these operations before its first changed use: + +```text +INIT cache at A +COPY cache = source at A +MOVE cache from A to B, as a paid owned query +``` + +It then uses cache for every source operand in B. It emits CLEAR after the +last such use. The source value has no write between these uses. The cache +also has no scalar write between COPY and CLEAR. Thus every redirected read +has exactly the decoded value of the original read. + +The native MOVE changes the physical encoding and preserves the decoded value. +Its rank is dim(A)-dim(B). The verifier checks its exact native map and phase. +All changed public queries remain strictly forward and nested. All changed +owned queries remain strictly reverse and nested. A MOVE whose two frames +become identical is removed; it is the identity operator. + +Induction over the scalar program proves the same decoded endpoint T. Each +inserted COPY reads a current value, and each CLEAR occurs after all uses. +Changing a helper boundary changes its native Gaussian target, so its new rank +must replace the old productive credit. The main endpoint and its adapters +remain fixed. The exact forward replay and a separate dense transpose replay +check every public and dirty owned input column. + +## Fixed construction + +The first four changes retain a dimension-four copy of a dimension-eight value. +Each copy serves one existing owned path and four helper corrections. +The next four changes retain intermediate copies for those paths. The last +change serves the remaining helper 705 contact. The table identifies the plan; +WITNESS.json gives each exact role, version, event interval and use list. + +| Step | New frame | Added cache lifetimes | Removed identity transports | +|---|---:|---:|---:| +| 1 | 1090 | 1 | 0 | +| 2 | 1091 | 1 | 0 | +| 3 | 240 | 1 | 0 | +| 4 | 243 | 1 | 0 | +| 5 | 260 | 2 | 3 | +| 6 | 394 | 2 | 3 | +| 7 | 431 | 2 | 3 | +| 8 | 470 | 2 | 3 | +| 9 | 549 | 1 | 1 | + +Frame 1090 has basis `[265,194,164,75]`. This basis is credited to Joel Pulikkan / +GamingPuzzled in PR5739. Frame 1091 has basis `[11,21,51,469]`. Its span is the +sum of the relevant source subspaces. The R22 block edits are not used here. +The other frame definitions are unchanged source data. + +There are thirteen new paid conversions and thirteen removed identity +transports. The final word has 25,882 instructions, 767 public inputs and +22 owned labels. It has 24 owned lifetimes and peak 12 live owned fields. +The scalar replay checks all 789 input columns. The transpose checks the same +622,521 endpoint coefficients by a separate arithmetic implementation. + +## Strict signed-moment gain + +Let H_r = r^t for 0 sum y_i^t for every 0 2^26*N^5 avoiding all fixed denominators and rank witnesses" + }, + "outer": { + "functional_checks": { + "actual_new_BIT_stock_sublinear": "348599999999253/350000000000000", + "fixed_halo_explicit_metadata_branch": "26950000000001/350000000000", + "new_BIT_row_stock_sublinear_in_active_group": "1395799999997009/1400000000000000", + "new_semantic_group_guard": "3/1400000000000" + }, + "margins": { + "boundary_algebraic_matrix": "6118965694795629310219/1960000000000000000000000", + "fused_gaussian": "6118965694786887930657/1960000000000000000000000", + "global_coordinate_router": "2185344891/700000000000", + "group_bit_router": "3059482848093443965327/980000000000000000000000", + "group_scans": "699999999999/700000000000", + "main_transform": "6118965693395629310219/1960000000000000000000000", + "microbox_face_corrections": "26950000000001/350000000000", + "polynomial_products": "1399999999999/1400000000000", + "sparse_union_movement": "802368965694795629310219/1960000000000000000000000" + }, + "parameters": { + "a": "2185344891/700000000000", + "b": "4370689783/1400000000000", + "beta": "1399999999997/1400000000000", + "bit_saving": "17/5000", + "cap_xi": "1782368965693395629310219/1960000000000000000000000", + "complex_uniform_saving": "546336223/175000000000", + "d": "1/1400000000000", + "epsilon": "1399999999999/1400000000000", + "kappa": "312192127/100000000000", + "lambda_": "398751231491/400000000000", + "lambda_prime": "1395629310219/1400000000000", + "layout": "1/1400000000000", + "q": "4370689781/1400000000000", + "r0": "1/14000000000000", + "stop": "1/1400000000000", + "tested_saving": "124876851/40000000000" + }, + "strict_checks": { + "actual_bit_above_effective": "194655109/700000000000", + "actual_logarithmic_gamma_guard": "1/1400000000000", + "actual_logarithmic_group_guard": "177631034308704370689781/980000000000000000000000", + "alpha_logarithm_absorption": "1/14000000000000", + "boundary_algebraic_matrix_above_kappa": "5595629310219/1960000000000000000000000", + "cap_above_band": "802368965693395629310219/1960000000000000000000000", + "cap_below_cell": "177631034305204370689781/1960000000000000000000000", + "cap_below_phase_cell_power": "2137631034306604370689781/1960000000000000000000000", + "complex_above_effective": "1/1400000000000", + "complex_below_one_over_32": "39379310217/1400000000000", + "complex_endpoint": "1/700000000000", + "epsilon_below_one": "1/1400000000000", + "epsilon_positive": "1399999999999/1400000000000", + "fine_prime_halo_umbrella": "7/2", + "fused_gaussian_above_kappa": "5586887930657/1960000000000000000000000", + "gaussian_above_main": "695629310219/980000000000000000000000", + "global_coordinate_router_above_kappa": "1/350000000000", + "global_gamma_power_slack": "9/14000000000000", + "group_below_dimension": "1/700000000000", + "group_bit_router_above_kappa": "3493443965327/980000000000000000000000", + "group_gauge_power_slack": "177631034308634370689781/980000000000000000000000", + "group_key_fits_record": "1/700000000000", + "group_positive": "1399999999997/1400000000000", + "group_scans_above_kappa": "69781465511/70000000000", + "halo_covers_generic_inverse_radius": "5", + "improvement_over_user_baseline": "695475425400418148631/500000000000000000000000", + "lambda_above_internal": "1/2800000000000", + "lambda_above_sigma": "3/2800000000000", + "lambda_above_tau": "1/2800000000000", + "lambda_prime_above_lambda": "1/2800000000000", + "lambda_prime_above_leaf": "2795629310217/1960000000000000000000000", + "leaf_saving_above_effective": "1395629310217/1960000000000000000000000", + "main_transform_above_kappa": "4195629310219/1960000000000000000000000", + "membership_arithmetic_fits_record": "1/1400000000000", + "microbox_face_corrections_above_kappa": "53897814655113/700000000000", + "microbox_halo_volume": "110600000000003/1400000000000", + "new_complex_uniform_saving_above_b": "1/1400000000000", + "new_semantic_guard_with_C1_one": "1/1400000000000", + "polynomial_products_above_kappa": "1395629310221/1400000000000", + "positive_layout_slack": "1/1400000000000", + "q_below_effective": "1/1400000000000", + "q_below_internal": "1/1400000000000", + "q_below_leaf": "2795629310217/1960000000000000000000000", + "q_positive": "4370689781/1400000000000", + "short_record_fallback": "1395629310217/1400000000000", + "source_axis_superpolynomial": "1/1400000000000", + "sparse_union_movement_above_kappa": "796250000005595629310219/1960000000000000000000000", + "stop_below_one": "1399999999999/1400000000000", + "stop_positive": "1/1400000000000", + "strassen_integer_power_gap": "1951441519231", + "support_router_span": "3/1400000000000", + "theta_positive_polynomial_power": "2", + "union_header_fits_record": "3/1400000000000", + "union_tag_work_per_visit_fits_record": "3/1400000000000" + } + }, + "paid": { + "1": 41718, + "16": 416, + "2": 8172, + "24": 416, + "3": 8928, + "32": 416, + "4": 1728, + "40": 416, + "48": 416, + "5": 2862, + "56": 416, + "6": 126, + "64": 416, + "7": 180, + "72": 208 + }, + "paid_calls": 66834, + "previous_pr5751": "389127/125000000", + "productive_fields": 13390, + "query_shears": 15, + "rank_mass_surplus": 760, + "raw_ceiling": { + "derivative_upper": "-23016733636056060468809768683975953030727966023990044802689041/98079714615416886934934209737619787751599303819750539264", + "interval": [ + "0", + "17/5000" + ] + }, + "raw_headroom": [ + "69/2000000000000", + "3451/100000000000000" + ], + "raw_root_interval": [ + "6243842609/2000000000000", + "312192130451/100000000000000" + ], + "relative_gain_percent": "890527/3113016", + "strictification": { + "alpha": { + "lower": "0.999999999969984119802576312582", + "upper": "0.999999999969984119802576312583" + }, + "cutoff": 16, + "delta": { + "lower": "0.949234740902898217233390415076", + "upper": "0.949234740902898217233390415077" + }, + "floor": 17, + "gamma": { + "lower": "0.975826192284422696653482356626", + "upper": "0.975826192284422696653482356627" + }, + "normalized_paid_upper": "1048576000976562501/1048576001073741824", + "power": 1024, + "reserve": "1/1000000000000", + "tail_block": 128, + "tail_decay": "125/128", + "tail_offset": "1/7", + "tested": "124876851/40000000000" + }, + "targets": { + "1": 450, + "145": 208, + "17": 416, + "2": 90, + "25": 416, + "3": 72, + "33": 416, + "4": 1854, + "41": 416, + "49": 416, + "5": 108, + "57": 416, + "65": 416, + "7": 126, + "73": 208, + "8": 378, + "9": 6984 + }, + "whole_idle_jobs": 3120 + }, + "instructions": 25882, + "limits": [ + "The five inherited framework assumptions remain.", + "The large uniform word and rounded multiplier are not materialized.", + "Author checks do not establish independent acceptance.", + "The selected frontier is unchanged." + ], + "local": { + "endpoint_coefficients": 622521, + "helpers": { + "1": 25, + "2": 5, + "3": 4, + "4": 103, + "5": 6, + "7": 7, + "8": 21, + "9": 388 + }, + "owned_fields": 22, + "owned_lifetimes": 24, + "paid": { + "1": 2231, + "2": 454, + "3": 496, + "4": 96, + "5": 159, + "6": 7, + "7": 10 + }, + "paid_rank_mass": 5918, + "peak_owned_fields": 12, + "public_inputs": 767, + "real_scalar_allowance": 224294 + }, + "majorization": { + "ascending_prefix_margins": [ + 3, + 6, + 9, + 12, + 15, + 18, + 21, + 24, + 28, + 32, + 36, + 40, + 39, + 36, + 33, + 30, + 27, + 24, + 21, + 18, + 15, + 12, + 9, + 6, + 5, + 4, + 3, + 2, + 1, + 0 + ], + "delta_paid": { + "1": 12, + "3": 4, + "4": 4, + "5": -16, + "6": 1, + "7": -5 + }, + "delta_targets": { + "3": 4, + "4": 12, + "7": 1, + "8": -17 + }, + "negative_ranks": [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 6, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8 + ], + "positive_ranks": [ + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 7, + 7, + 7, + 7, + 7, + 7 + ], + "scope": "Strict signed-moment improvement for every exponent 0= public and r not in live_owned, 'Owned initialization') + live_owned.add(r) + lifetimes += 1 + peak = max(peak, len(live_owned)) + rows[r] = {} + current[r] = e[2] + scalar += 2 + elif op == 'CLEAR': + need(r in live_owned and current[r] == e[2], 'Owned erasure at declared frame') + rows[r] = {} + current[r] = None + live_owned.remove(r) + scalar += 2 + else: + q, f = Q(e[-2]), e[-1] + need(q and current[r] == f, 'Scalar destination and coefficient') + n, d = abs(q.numerator), q.denominator + need(d & (d-1) == 0, 'Dyadic scalar coefficient') + need(abs(q)+1 < 2**16, 'Fixed scalar growth bound') + if op == 'SCALE': + need(n & (n-1) == 0, 'Dyadic unit SCALE') + rows[r] = {k:q*x for k,x in rows[r].items()} + scalar += 2*(abs(n.bit_length()-d.bit_length()) + int(q < 0)) + else: + s = e[2] + need(s != r and 0 <= s < public+owned and current[s] == f, 'Common scalar chart') + if op == 'COPY': + need(r in live_owned and not rows[r], 'COPY into cleared owned field') + rows[r] = {k:q*x for k,x in rows[s].items()} + else: + need(op == 'ADD', 'Scalar opcode') + add(rows[r], rows[s], q) + scalar += 2*(3+n.bit_length()-1+n.bit_count()+d.bit_length()-1) + need(not live_owned and 0 < peak <= 12 and current[:public] == w['final'], 'All public and owned exits') + live = set(w['live']) + for r,row in enumerate(rows): + expected = {r:Q(1)} if r < public else {} + if r-112 in live: + expected[r-112] = Q(1) + need(row == expected, 'All public and owned rows') + main = live | {r+112 for r in live} + helpers = Counter(len(w['frames'][w['final'][r]])-len(w['frames'][w['initial'][r]]) for r in range(public) if r not in main) + need(len(live) == len(w['ports']) == 104 and len(main) == 208 and min(helpers) > 0, 'Independent productive inputs') + return {'paid':dict(paid), 'helpers':dict(helpers), 'public_inputs':public, 'owned_fields':owned, 'owned_lifetimes':lifetimes, + 'peak_owned_fields':peak, 'real_scalar_allowance':scalar, 'endpoint_coefficients':(public+owned)*(public+owned), + 'paid_rank_mass':sum(r*count for r,count in paid.items())} + +def reverse_columns(w): + """Check the transpose with dense dyadic rows and the reverse chronology.""" + public = w['public'] + n = public+w.get('owned_fields', 8) + rows = [[int(i == j) for j in range(n)] for i in range(n)] + exponents = [0]*n + for e in reversed(w['program']): + op,r = e[:2] + if op == 'MOVE': + continue + if op in ('INIT','CLEAR'): + rows[r] = [0]*n + exponents[r] = 0 + continue + q = Q(e[-2]) + qe = q.denominator.bit_length()-1 + if op == 'SCALE': + rows[r] = [q.numerator*x for x in rows[r]] + exponents[r] += qe + else: + s = e[2] + level = max(exponents[s], exponents[r]+qe) + a, b = 1 << (level-exponents[s]), q.numerator << (level-exponents[r]-qe) + rows[s] = [a*x+b*y for x,y in zip(rows[s],rows[r])] + exponents[s] = level + if op == 'COPY': + rows[r] = [0]*n + exponents[r] = 0 + r = s + while exponents[r] and not any(x & 1 for x in rows[r]): + rows[r] = [x//2 for x in rows[r]] + exponents[r] -= 1 + for r,row in enumerate(rows): + expected = [0]*n + if r < public: + expected[r] = 1 << exponents[r] + if r in w['live']: + expected[r+112] = 1 << exponents[r] + need(row == expected, 'Independent dense transpose columns') + return {'columns':n, 'coefficients':n*n, 'arithmetic':'Dense integer rows with binary denominators; reverse chronology'} + +def native(w): + n = w['public'] + C = load(ROOT/'research/p104-native-channel/vendor/clifford_exact.py', 'p104_productive_clifford') + V = load(ROOT/'research/p104-native-channel/vendor/native_verify.py', 'p104_productive_gaussian') + @lru_cache(None) + def chart(i): + return C.canonical_frame(9, tuple(w['frames'][i])) + recipes = {} + def check(a,b): + if (a,b) not in recipes: + recipe,_ = C.lower_child(chart(a).adjoint().then(chart(b))) + expected = V.adjoint(V.frame(w['frames'][a],9)) + V.frame(w['frames'][b],9) + V.equal(V.recipe(recipe),expected,'Native chart change and exact global phase') + need(recipe['rank'] == abs(len(w['frames'][a])-len(w['frames'][b])), 'Native boundary rank') + recipes[a,b] = recipe + return recipes[a,b] + for e in w['program']: + if e[0] == 'MOVE': + check(e[2],e[3]) + main = set(w['live']) | {r+112 for r in w['live']} + helper_profile = Counter() + for r in range(n): + if r not in main: + helper_profile[check(w['initial'][r],w['final'][r])['rank']] += 1 + adapters = [] + for r,q in zip(w['live'],w['ports']): + need(w['frames'][w['initial'][r]] == [q], 'Literal central port') + need(span(w['frames'][w['final'][r+112]]) == frozenset(x for x in range(512) if not (x&q).bit_count()%2), 'Literal output hyperplane') + tests = [ + (C.cgate(9,q,1).adjoint().then(chart(w['initial'][r])), V.adjoint((('C',q,1),))+V.frame(w['frames'][w['initial'][r]],9)), + (chart(w['final'][r+112]).adjoint().then(C.cgate(9,q,-1).then(C.fourier(9))), V.adjoint(V.frame(w['frames'][w['final'][r+112]],9))+(('C',q,-1),)+V.fourier(9))] + for actual,expected in tests: + recipe,_ = C.lower_child(actual) + need(recipe['rank'] == 0, 'Free intrinsic main adapter') + V.equal(V.recipe(recipe),expected,'Main endpoint phase') + adapters.append(recipe) + bad = json.loads(json.dumps(next(iter(recipes.values())))) + bad['left']['phase'] = (bad['left']['phase']+1)%4 + a,b = next(iter(recipes)) + try: + V.equal(V.recipe(bad),V.adjoint(V.frame(w['frames'][a],9))+V.frame(w['frames'][b],9),'Wrong phase control') + except ValueError: + pass + else: + raise ValueError('Wrong native phase accepted') + payload = [[a,b,recipes[a,b]] for a,b in sorted(recipes)] + adapters + return {'distinct_maps':len(recipes),'main_adapters':len(adapters),'helper_normalizers':2*sum(helper_profile.values()), + 'helpers':dict(helper_profile),'recipe_payload_sha256':sha256(json.dumps(payload,sort_keys=True,separators=(',',':')).encode()).hexdigest(), + 'wrong_phase_rejected':True, 'proof':'Every signed Pauli image and exact global phase; frame induction at every positive tensor width'} diff --git a/research/p104-retained-native-copy/pricing.py b/research/p104-retained-native-copy/pricing.py new file mode 100644 index 0000000000..5a74b4ac99 --- /dev/null +++ b/research/p104-retained-native-copy/pricing.py @@ -0,0 +1,184 @@ +"""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. +The source commuting-contact construction is by Pierre-Loic Doulcet (hexapode) in PR5565. +The source coupled-frame change is by Ali Romman with OpenAI Codex in PR5601. +Five fixed boundary relations are from Ali Romman's PR5602. +The shared and delayed relays are from flyingviper's PR5605 and PR5612. The preparation is from +Scratch-net's PR5606. Their costs and target debit are included. +Ali Romman's complete caller/price proof and all predecessor credit are retained. +The paid A2 change is from zxv PR5643. The three helper relations are from +Ali Romman PR5644. The four-gate change is by Ali Romman with Codex assistance. +The four interior basis changes are by Ali Romman with Codex assistance. +Paid intermediate meetings: Ali Romman with substantial OpenAI Codex assistance. +Apache-2.0. +""" +from collections import Counter +from fractions import Fraction as Q +import local as L + +KAPPA, TESTED = Q('.00312192127'), Q('.003121921275') +PREVIOUS = Q('.00311301600') + + +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()) == 13390 and sum(paid.values()) == 66834, '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 the source claim') + t,u,v,c,b = 1-TESTED,Q(1,7),1024,16,17 + 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**12),Q(125,128) + 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') + old_completion = E.divide((Q(sum(T.values())*18),)*2,E.mul(E.power(17,TESTED),target)) + L.need(old_completion[0] > Q(39,40), 'PR5718 completion-tail bound fails with the new target count') + old_offset = E.divide(E.moment(P,t+Q(1,5)),E.mul(E.power(16,Q(1,5)),target)) + L.need(old_offset[0] > decay, 'The old tail offset fails at the new cutoff') + 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':'0.00312192127','previous_pr5751':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':local['paid_rank_mass'], + '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':{'source_completion':'Rejected at cutoff17, floor18 and decay39/40', + 'source_offset':'Rejected at cutoff16 with tail offset1/5', + 'old_cutoff':'Rejected by completion-tail ratio greater than one','old_BIT':'Rejected by outer inequalities'}}) diff --git a/research/p104-retained-native-copy/sources.py b/research/p104-retained-native-copy/sources.py new file mode 100644 index 0000000000..8436b38830 --- /dev/null +++ b/research/p104-retained-native-copy/sources.py @@ -0,0 +1,74 @@ +"""Authenticate the retained PR5751 export before any source import. + +Ali Romman with substantial OpenAI Codex assistance. Apache-2.0. +PR5718 source interface: flyingviper with substantial OpenAI Codex assistance. +Rebound to PR5718 by Ali Romman with substantial OpenAI Codex assistance. +The archive checks follow the repository exporter and flyingviper's PR5613. +""" +from contextlib import contextmanager +from hashlib import sha1, sha256 +from pathlib import Path, PurePosixPath +import importlib.util +import io +import json +import sys +import tarfile +import tempfile + +HERE = Path(__file__).resolve().parent + + +def need(ok, why): + if not ok: + raise ValueError(why) + + +def load(path, name): + spec = importlib.util.spec_from_file_location(name, path) + module = importlib.util.module_from_spec(spec) + sys.modules[name] = module + spec.loader.exec_module(module) + return module + + +@contextmanager +def sources(): + pins = json.loads((HERE/'SOURCES.json').read_bytes()) + for row in pins['direct_sources']: + payload = (HERE/row['local_path']).read_bytes() + need(sha256(payload).hexdigest() == row['sha256'], 'Exact direct source SHA256') + need(sha1(b'blob '+str(len(payload)).encode()+b'\0'+payload).hexdigest() == row['git_blob'], + 'Exact direct source Git blob') + pin = pins['source_export'] + raw = (HERE/pin['local_path']).read_bytes() + need(sha256(raw).hexdigest() == pin['sha256'], 'Exact predecessor archive SHA256') + need(sha1(b'blob '+str(len(raw)).encode()+b'\0'+raw).hexdigest() == pin['git_blob'], + 'Exact retained archive Git blob') + with tempfile.TemporaryDirectory(prefix='p104-native-copy-source-') as directory: + root, names = Path(directory), set() + with tarfile.open(fileobj=io.BytesIO(raw), mode='r:') as bundle: + for member in bundle.getmembers(): + path = PurePosixPath(member.name) + need(member.isfile() and not path.is_absolute() and '..' not in path.parts + and '\\' not in member.name and ':' not in member.name, + 'Regular relative source path') + need(member.name not in names, 'Unique source path') + names.add(member.name) + target = root.joinpath(*path.parts) + target.parent.mkdir(parents=True, exist_ok=True) + target.write_bytes(bundle.extractfile(member).read()) + manifest = json.loads((root/'.research-export.json').read_bytes()) + need(manifest['commit'] == pin['commit'] and manifest['package'] == pin['package'] + and len(manifest['files']) == pin['files'], 'Exact source commit and inventory') + need(names == {'.research-export.json'} | {r['path'] for r in manifest['files']}, + 'No missing or additional source payload') + origins = {row['path']: row for row in pins['archived_files']} + for row in manifest['files']: + origin = origins[row['path']] + need(origin['pin'] == 'head:'+pin['commit']+':'+row['path'] + and origin['sha256'] == row['sha256'], + 'Export payload has an exact source pin') + payload = (root/row['path']).read_bytes() + need(len(payload) == row['size'] and sha256(payload).hexdigest() == row['sha256'], + 'Authenticated payload: '+row['path']) + yield root/pin['package'], root diff --git a/research/p104-retained-native-copy/verify.py b/research/p104-retained-native-copy/verify.py new file mode 100644 index 0000000000..e05fc946e7 --- /dev/null +++ b/research/p104-retained-native-copy/verify.py @@ -0,0 +1,193 @@ +"""Check the retained native copies and the complete conditional price. + +Ali Romman with substantial OpenAI Codex assistance. Apache-2.0. +NOTICE retains the source, native, caller and compiler credit. +""" +import argparse +from collections import Counter +from contextlib import ExitStack +from copy import deepcopy +from hashlib import sha256 +import gzip +import json +from pathlib import Path +import sys +import tempfile + +sys.dont_write_bytecode = True +HERE = Path(__file__).resolve().parent +sys.path.insert(0, str(HERE)) +from sources import sources, load, need +import construct + + +def digest(word): + return sha256(json.dumps(word, sort_keys=True, separators=(',', ':')).encode()).hexdigest() + + +def declared_copy(source, target, edits): + text = source.read_text(encoding='utf-8') + for before, after in json.loads(edits.read_bytes()): + need(text.count(before) == 1, 'Unique declared source edit') + text = text.replace(before, after) + need(text == target.read_text(encoding='utf-8'), 'Only declared source edits: '+target.name) + + +def reject(action): + try: + action() + except ValueError as error: + return str(error) + raise ValueError('Invalid candidate accepted') + + +def delta(before, after): + out = Counter(after) + out.subtract(before) + return {r: n for r, n in out.items() if n} + + +def majorization(before, after): + paid = delta(before['paid'], after['paid']) + targets = delta(before['helpers'], after['helpers']) + need(paid == {1: 12, 3: 4, 4: 4, 5: -16, 6: 1, 7: -5}, 'Exact paid delta') + need(targets == {3: 4, 4: 12, 7: 1, 8: -17}, 'Exact target delta') + gain = Counter(targets) + gain.subtract(paid) + gain = {r: n for r, n in gain.items() if n} + positive = sorted(r for r, n in gain.items() for _ in range(max(n, 0))) + negative = sorted(r for r, n in gain.items() for _ in range(max(-n, 0))) + need(len(positive) == len(negative) == 30 and sum(positive) == sum(negative) == 154, + 'Equal majorization lengths and rank sums') + margins = [sum(positive[:j])-sum(negative[:j]) for j in range(1, 31)] + need(min(margins) >= 0 and max(margins) > 0 and margins[-1] == 0, + 'Strict concave majorization gain') + need(sum(before['paid'].values()) == sum(after['paid'].values()) + and sum(before['helpers'].values()) == sum(after['helpers'].values()), + 'Unchanged paid and productive call counts') + need(before['paid_rank_mass']-after['paid_rank_mass'] == 69, + 'Paid and productive rank reduction') + return {'delta_paid': paid, 'delta_targets': targets, 'signed_gain': gain, + 'positive_ranks': positive, 'negative_ranks': negative, + 'ascending_prefix_margins': margins, + 'scope': 'Strict signed-moment improvement for every exponent 0= first_new) + move = next(i for i, e in enumerate(word['program']) if e[0] == 'MOVE' and e[1] >= first_new) + clear = next(i for i, e in enumerate(word['program']) if e[0] == 'CLEAR' and e[1] >= first_new) + out = {} + bad = deepcopy(word) + del bad['program'][move] + out['omit_paid_cache_query'] = reject(lambda: L.replay(bad)) + bad = deepcopy(word) + bad['program'][copy][-2] = '2' + out['wrong_cache_value'] = reject(lambda: L.replay(bad)) + bad = deepcopy(word) + del bad['program'][clear] + out['omit_cache_clear'] = reject(lambda: L.replay(bad)) + bad = deepcopy(word) + event = bad['program'].pop(clear) + last_use = max(i for i, e in enumerate(bad['program']) + if e[0] in ('COPY', 'ADD') and e[2] == event[1]) + bad['program'].insert(last_use, event) + out['clear_before_last_use'] = reject(lambda: L.replay(bad)) + bad = deepcopy(word) + changed = next(r for r in range(word['public']) if word['final'][r] != source['final'][r]) + bad['final'][changed] = source['final'][changed] + out['retain_old_helper_credit'] = reject(lambda: L.replay(bad)) + bad = deepcopy(word) + bad['owned_fields'] -= 1 + out['omit_owned_storage'] = reject(lambda: L.replay(bad)) + return out + + +def run(): + with ExitStack() as contexts: + parent, _ = contexts.enter_context(sources()) + cursor = parent + for depth in range(5): + module = load(cursor/'sources.py', 'native_copy_source_'+str(depth)) + cursor, root = contexts.enter_context(module.sources()) + declared_copy(parent/'local.py', HERE/'local.py', HERE/'LOCAL-EDITS.json') + declared_copy(parent/'pricing.py', HERE/'pricing.py', HERE/'PRICING-EDITS.json') + L = load(HERE/'local.py', 'local') + L.ROOT = root + source = L.read(parent/'WORD.json.gz') + plan = L.read(HERE/'PLAN.json') + need(digest(source) == plan['source_canonical_sha256'], 'Exact source word') + baseline = L.replay(source) + word = deepcopy(source) + word['frames'].extend(plan['appended_frames']) + witnesses = [] + for request in plan['steps']: + need(digest(word) == request['source_sha256'], 'Exact step input') + word, witness = construct.construct(word, request) + need(digest(word) == request['output_sha256'], 'Exact step output') + witness['local'] = L.replay(word) + witnesses.append(witness) + local = L.replay(word) + need((local['public_inputs'], local['owned_fields'], local['owned_lifetimes'], + local['peak_owned_fields']) == (767, 22, 24, 12), 'Exact storage inventory') + need(local['public_inputs']+local['owned_fields'] < 1000, 'Retained fixed slot allowance') + need(len(witnesses) == 9 and sum(len(w['caches']) for w in witnesses) == 13 + and sum(w['removed_zero_queries'] for w in witnesses) == 13, + 'Thirteen paid copies and thirteen removed zero transports') + proof = majorization(baseline, local) + transpose = L.reverse_columns(word) + negative = controls(source, word, L) + print('PASS exact construction, all scalar columns, ownership and majorization', flush=True) + native = L.native(word) + C = load(root/'research/p104-productive-controller/caller.py', 'native_copy_caller') + caller = C.construct() + need(caller == L.read(root/'research/p104-productive-controller/CONTROLLER.json'), + 'Unchanged full physical caller') + physical = C.physical(caller, word) + print('PASS exact native maps, phases and complete physical caller', flush=True) + P = load(HERE/'pricing.py', 'native_copy_price') + price = P.run(local, native, caller, physical) + need(price['previous_pr5751'] == L.read(parent/'RESULT.json')['complete_cost']['kappa'], + 'Exact predecessor exponent') + negative.update(C.controls(caller)) + bad = deepcopy(local) + bad['paid'][4] -= 1 + negative['omit_paid_query_from_invoice'] = reject(lambda: P.assemble(bad, native, caller, physical)) + bad = deepcopy(local) + bad['helpers'][8] += 1 + negative['invent_helper_credit'] = reject(lambda: P.assemble(bad, native, caller, physical)) + result = {'status': 'PASS_P104_RETAINED_NATIVE_COPY_KAPPA_00312192127', + 'source_commit': '8483f9a679d06c1e270141dbc686a7e76e7a7522', + 'canonical_word_sha256': digest(word), 'instructions': len(word['program']), + 'local': local, 'separate_columns': transpose, 'majorization': proof, + 'native': native, 'physical_caller': physical, 'complete_cost': price, + 'negative_controls': negative, + 'limits': ['The five inherited framework assumptions remain.', + 'The large uniform word and rounded multiplier are not materialized.', + 'Author checks do not establish independent acceptance.', + 'The selected frontier is unchanged.']} + return P.encode(result), P.encode(witnesses), word + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--write', action='store_true') + args = parser.parse_args() + with tempfile.TemporaryDirectory(prefix='p104-native-copy-bytecode-') as cache: + sys.pycache_prefix = cache + result, witness, word = run() + for name, value in (('RESULT.json', result), ('WITNESS.json', witness), ('WORD.json.gz', word)): + path = HERE/name + if args.write: + raw = (json.dumps(value, sort_keys=True, indent=2)+'\n').encode() + path.write_bytes(gzip.compress(raw, mtime=0) if name.endswith('.gz') else raw) + else: + raw = path.read_bytes() + need(json.loads(gzip.decompress(raw) if name.endswith('.gz') else raw) == value, + 'Complete retained output: '+name) + print(result['status']) + + +if __name__ == '__main__': + main()