From 43007c979859fa84ccc3a3509ccacc9620d181fa Mon Sep 17 00:00:00 2001 From: rohanarun Date: Fri, 20 Nov 2026 00:56:37 -0500 Subject: [PATCH] Verify the 832-factor grade-14 paid cutoff under the inherited P104 premises --- research/p104-grade14-paid-cut/AUDIT.json | 254 +++++++++++++++++ research/p104-grade14-paid-cut/BIT.json | 284 ++++++++++++++++++++ research/p104-grade14-paid-cut/Grade14.lean | 41 +++ research/p104-grade14-paid-cut/LICENSE | 201 ++++++++++++++ research/p104-grade14-paid-cut/NOTICE | 16 ++ research/p104-grade14-paid-cut/README.md | 31 +++ research/p104-grade14-paid-cut/RESULT.json | 34 +++ research/p104-grade14-paid-cut/SOURCES.json | 86 ++++++ research/p104-grade14-paid-cut/verify.py | 236 ++++++++++++++++ 9 files changed, 1183 insertions(+) create mode 100644 research/p104-grade14-paid-cut/AUDIT.json create mode 100644 research/p104-grade14-paid-cut/BIT.json create mode 100644 research/p104-grade14-paid-cut/Grade14.lean create mode 100644 research/p104-grade14-paid-cut/LICENSE create mode 100644 research/p104-grade14-paid-cut/NOTICE create mode 100644 research/p104-grade14-paid-cut/README.md create mode 100644 research/p104-grade14-paid-cut/RESULT.json create mode 100644 research/p104-grade14-paid-cut/SOURCES.json create mode 100644 research/p104-grade14-paid-cut/verify.py diff --git a/research/p104-grade14-paid-cut/AUDIT.json b/research/p104-grade14-paid-cut/AUDIT.json new file mode 100644 index 0000000000..bccec371b1 --- /dev/null +++ b/research/p104-grade14-paid-cut/AUDIT.json @@ -0,0 +1,254 @@ +{ + "actual_grid_fixture": { + "exact_outputs_each": 1289, + "fixture_signed_width": 165, + "minimum_product_grid": 3203382489907091224335482880000, + "native_independent_wide_incidences_executed": 3296, + "native_signed_components": 4, + "whole_prefix_width_bits": 147 + }, + "audit_program_sha256": "0316153c1822724e1a3d08066aec9601a891073b0209954eaf302ffa014bf5ac", + "basis_grid": { + "all_basis_products": 13030044, + "dyadic_height": 22, + "exact_basis_owners": 1289, + "minimal_grid": true, + "nontrivial_basis_divisions": 7535400, + "odd_factors": [ + 15658669, + 13190315, + 15217125, + 243 + ], + "positive_path_mass": "15395907155338566341333/146520", + "product_grid": 3203382489907091224335482880000 + }, + "common_root": { + "W": "W=p+h+2D+3", + "common_context_c": 856, + "reference_words_in_recount": [ + "tested", + "original_7781", + "current_7786" + ], + "replayed_context_c": 856, + "temporary_width": "W+26" + }, + "compiler_report_sha256": "3366feccd6cc059c51943ee08c68bee2efd48d559c0b6507db4906cfaa27d00b", + "layout": "f7de788c4a559282d35a9fce42f841a0e8de5a4015db871e718f9245569b0aa7", + "locked_inputs_verified": 86, + "ordinary": { + "common_depth_guards": { + "current_7786": { + "argument_bit_length": 14083, + "compiler_H": 15164800000000000000, + "strict_guard_passed": true + }, + "original_7781": { + "argument_bit_length": 14083, + "compiler_H": 15132200000000000000, + "strict_guard_passed": true + }, + "tested": { + "argument_bit_length": 14083, + "compiler_H": 15171300000000000000, + "strict_guard_passed": true + } + }, + "extra_allowance_all_48_native_calls": 399792, + "native_numeric_homes": 8290, + "native_selected_resets": 88840992, + "native_selected_transfers": 23703552, + "ordinary_elementary_record_upper": 151912932864, + "ordinary_map_slots": 1601376, + "ordinary_scalar_services": 1315098624, + "ordinary_scalar_step_rate": 4294967296, + "selected_steps_linear_and_constant": [ + 13066144414176, + 58832521372992 + ] + }, + "outer": { + "claim": "0.00387992802601", + "finite_compiler": { + "BIT_margin": "3/200000000000000", + "BIT_pin": "775985605219/200000000000000", + "H": "15171300000000000000", + "alpha": [ + 0.9999997122994679, + 0.9999997122994679 + ], + "claim": "387992802601/100000000000000", + "compiler_gap": "1/100000000000000", + "delta": [ + 0.8461062289269066, + 0.8461062289269066 + ], + "derivative_upper": -1003215.0574564605, + "gamma": [ + 0.9399386130048315, + 0.9399386130048315 + ], + "input_lift": { + "absolute_curvature_upper": "2355391845541459904210316251401050062978110588940190425603051116764979485783867649/25000000000000000000000000000000000000000000000000000000000000000000000000000000", + "derivative_upper_on_required_interval": "-19673961944039645907445178692631341440689365425138144719338946039898678799237031527196963947/125000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "interval_kappa_cap": "775985605219/200000000000000", + "margins": { + "24249550163/6250000000000": [ + "5280443672045311399444245805938863031233942313841313921803692746771915469009/4000000000000000000000000000000000000000000000000000000000000000000000000000000", + "33002772950283196246526536287117893945212139461508212011273079667324471681793/25000000000000000000000000000000000000000000000000000000000000000000000000000000" + ], + "387992802601/100000000000000": [ + "66005545899429749425330467881709733216841632253174395282784734987051459729237/50000000000000000000000000000000000000000000000000000000000000000000000000000000", + "132011091798859498850660935763419466433683264506348790565569469974102919460441/100000000000000000000000000000000000000000000000000000000000000000000000000000000" + ] + }, + "signed_curvature_upper": "31960881757465108748156055549877382773720954815102950527044995237546502905778087/625000000000000000000000000000000000000000000000000000000000000000000000000000", + "signed_derivative_ceiling": "17790058447175641876263482763505090461437978190383344010344228678780469811693673/2556870540597208699852484443990190621897676385208236042163599619003720232462246960" + }, + "minimum_log_power": 2380, + "moment_margin_float": { + "15520545779/4000000000000": [ + -4.230404347279244e-09, + -4.230404347279244e-09 + ], + "194006822237/50000000000000": [ + 5.9549994370255654e-09, + 5.9549994370255654e-09 + ], + "24249550163/6250000000000": [ + 0.21228291839763283, + 0.21228291839763283 + ] + }, + "moment_margins": { + "15520545779/4000000000000": [ + "-26440027170495274242236130143046913082028620424234575109900535466078499/6250000000000000000000000000000000000000000000000000000000000000000000000000000", + "-413125424538988660034939533485108016906697194128665236092195866562177/97656250000000000000000000000000000000000000000000000000000000000000000000000" + ], + "194006822237/50000000000000": [ + "7443749296281956654836615141466304893781086673170604731451951437122473/1250000000000000000000000000000000000000000000000000000000000000000000000000000", + "3721874648140978327418307570733152446890543336585302365725975719170661/625000000000000000000000000000000000000000000000000000000000000000000000000000" + ], + "24249550163/6250000000000": [ + "265353647997041035881354492233393251084072587746296596781820155571989412670009/1250000000000000000000000000000000000000000000000000000000000000000000000000000", + "1326768239985205179406772461166966255420362938731482983909100777859947069402083/6250000000000000000000000000000000000000000000000000000000000000000000000000000" + ] + }, + "outer": { + "BIT_just_below_effective_rejected": true, + "functional_count": 4, + "minimum_margin": "1/1000000000000000", + "strict_count": 54 + }, + "raw_bracket": [ + "194006822237/50000000000000", + "15520545779/4000000000000" + ], + "tested": "24249550163/6250000000000", + "written_log_power": 2381 + }, + "input_lift": { + "absolute_curvature_upper": "2355391845541459904210316251401050062978110588940190425603051116764979485783867649/25000000000000000000000000000000000000000000000000000000000000000000000000000000", + "derivative_upper_on_required_interval": "-19673961944039645907445178692631341440689365425138144719338946039898678799237031527196963947/125000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "interval_kappa_cap": "775985605219/200000000000000", + "margins": { + "24249550163/6250000000000": [ + "5280443672045311399444245805938863031233942313841313921803692746771915469009/4000000000000000000000000000000000000000000000000000000000000000000000000000000", + "33002772950283196246526536287117893945212139461508212011273079667324471681793/25000000000000000000000000000000000000000000000000000000000000000000000000000000" + ], + "387992802601/100000000000000": [ + "66005545899429749425330467881709733216841632253174395282784734987051459729237/50000000000000000000000000000000000000000000000000000000000000000000000000000000", + "132011091798859498850660935763419466433683264506348790565569469974102919460441/100000000000000000000000000000000000000000000000000000000000000000000000000000000" + ] + }, + "signed_curvature_upper": "31960881757465108748156055549877382773720954815102950527044995237546502905778087/625000000000000000000000000000000000000000000000000000000000000000000000000000", + "signed_derivative_ceiling": "17790058447175641876263482763505090461437978190383344010344228678780469811693673/2556870540597208699852484443990190621897676385208236042163599619003720232462246960" + }, + "outer_checks": { + "BIT_just_below_effective_rejected": true, + "functional_count": 4, + "minimum_margin": "1/1000000000000000", + "strict_count": 54 + }, + "pinned_binary_cap": "0.003879928026095", + "signed_curvature_bound": "-314783391104634334519122859082101463051029846802210315509423136638378860787792505478046953762809534654596516725154320673700531570620451728809379401220311040781775226088046667/2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + "premises": [ + "native_all_columns", + "owned_erasure", + "compiler", + "precision_tape", + "analytic_recovery" + ], + "scalar_plans": { + "charged_extra_services_per_native": 8329, + "concrete_signed_inputs_tested": 5000, + "expanded_coefficients": 500, + "expanded_terms": 824, + "extra_clean_replacements_per_native": 1748, + "literal_terms": 220217, + "lowered_primitives_per_native": { + "ADD": 713, + "DIV": 1146, + "MUL": 2250 + }, + "max_literal_bits": 37, + "omitted_extra_clear_control": { + "coefficient": "-69893383680", + "instruction": 2, + "rejected": true, + "stream": 1 + }, + "retirement_of_wide_term_streams_in_existing_allowance": 2472 + }, + "schema": "p104-24-bit-expanded-independent-recount/v1", + "signed": { + "caller_sha256": "156fdf3a4a129b39225fd6ca51011de27974d7f104e8b04907c17ed5344bc858", + "candidate_raw_bracket": [ + "0.00388013644474", + "0.00388013644475" + ], + "native_calls": 48, + "paid": { + "1": 184800, + "16": 1248, + "2": 37920, + "24": 1248, + "3": 23472, + "32": 1248, + "4": 11040, + "40": 1248, + "48": 1248, + "5": 15072, + "56": 1248, + "6": 1920, + "7": 144, + "8": 1296 + }, + "productive": { + "1": 960, + "129": 624, + "17": 1248, + "2": 336, + "25": 1248, + "3": 480, + "33": 1248, + "4": 11616, + "41": 1248, + "49": 1248, + "5": 1536, + "57": 1248, + "65": 1248, + "7": 672, + "8": 1536, + "9": 26016 + }, + "signed_target_margin": [ + "0.32987103926763023716557450", + "0.32987103926763023716557451" + ], + "target": "0.00387981257853" + }, + "word": "7660985e0b618cdbee13e4190a4c6d5f91fbdf01a8f7a5186fdde8b980c19b48" +} diff --git a/research/p104-grade14-paid-cut/BIT.json b/research/p104-grade14-paid-cut/BIT.json new file mode 100644 index 0000000000..62402a789b --- /dev/null +++ b/research/p104-grade14-paid-cut/BIT.json @@ -0,0 +1,284 @@ +{ + "covered": "484991003263/125000000000000", + "endpoint_margins": [ + [ + "0.000000000003252368598458919233554954829", + "0.000000000003252368598458919233554954830" + ], + [ + "-0.000000000381874566916336446610288956313", + "-0.000000000381874566916336446610288956312" + ] + ], + "independent_ratios": [ + [ + "0.999999999999933434532609206067600709924", + "0.999999999999933434532609206067600709925" + ], + [ + "0.878519229281134076395964614978427139811", + "0.878519229281134076395964614978427139812" + ], + [ + "0.943578737373791363241715378674895986390", + "0.943578737373791363241715378674895986391" + ] + ], + "loss_each": "1/100000000000", + "native": { + "caller_polynomial_coefficients_each_way": 1444, + "caller_sha256": "757b3523798f840bdb02028b23708c3416627a99ea09e7a3c4bcdc5cd0c7ce4b", + "candidate_canonical_sha256": "d3aa4426fa8fe7dc167270d01f2515184f2bff6a82744a14e941c5dd3afca27d", + "candidate_file_sha256": "3bf6e12edfc00aa2ec72d65c83c850d09de377c47fe97b9cf8c2b1b4161741f5", + "candidate_gzip_sha256": "d28f0d28d9d87d5fe57b8ef19e12faf98014f0bbef781987ce22daaa82f21cb9", + "dual_nonzero_retirement": 3554, + "frames": 636, + "instruction_counts": { + "ADD": 32296, + "CLEAR": 3554, + "INIT": 3554, + "MOVE": 2874, + "SWAP": 680 + }, + "main_ports": 111, + "native_calls": 36, + "native_paid": { + "1": 1376, + "2": 1281, + "3": 54, + "4": 44, + "5": 17, + "6": 102 + }, + "native_scalar_coefficients_each_way": 462400, + "native_targets": { + "1": 8, + "2": 9, + "4": 43, + "5": 8, + "6": 1, + "8": 389 + }, + "omitted_CLEAR_clock": 38725, + "omitted_CLEAR_rejected": true, + "ordinary": { + "caller_bank_transits": 3507600, + "native_bank_transits_per_call": 2912896064, + "native_banks_and_scratch": 4238, + "ordinary_records": 934182831504, + "owned_backing": 6998544, + "raw_ordinary_allowance": 1000000000000, + "raw_owned_allowance": 10000000, + "route_groups": 573048, + "route_records": 829315065600 + }, + "owned_nonzero_CLEAR": 3554, + "paid": { + "1": 49980, + "2": 46116, + "3": 1944, + "4": 1584, + "5": 612, + "6": 3672, + "7": 444, + "14": 444, + "21": 444, + "28": 444, + "35": 444, + "42": 444, + "49": 444, + "56": 444 + }, + "public": 680, + "status": "PASS_LITERAL_BINARY_CANDIDATE", + "targets": { + "1": 288, + "2": 324, + "4": 1548, + "5": 288, + "6": 36, + "8": 14448, + "15": 444, + "22": 444, + "29": 444, + "36": 444, + "43": 444, + "50": 444, + "57": 444, + "64": 444, + "127": 222 + } + }, + "native_calls": 36, + "normalized_gap": [ + "0.000000000054911999", + "0.000000000054912000" + ], + "ordinary_admitted": "0.003879928026095", + "ordinary_bootstrap": [ + { + "claim": "0.003879818233998", + "envelope": [ + "0.003879818233999584", + "0.003879818233999584" + ], + "previous": "12039/3125000", + "slack": [ + "0.000000000000001584", + "0.000000000000001584" + ] + }, + { + "claim": "0.003879927586934", + "envelope": [ + "0.003879927586935576", + "0.003879927586935576" + ], + "previous": "1939909116999/500000000000000", + "slack": [ + "0.000000000000001576", + "0.000000000000001576" + ] + }, + { + "claim": "0.003879928024346", + "envelope": [ + "0.003879928024347320", + "0.003879928024347320" + ], + "previous": "1939963793467/500000000000000", + "slack": [ + "0.000000000000001320", + "0.000000000000001320" + ] + }, + { + "claim": "0.003879928026095", + "envelope": [ + "0.003879928026096968", + "0.003879928026096968" + ], + "previous": "1939964012173/500000000000000", + "slack": [ + "0.000000000000001968", + "0.000000000000001968" + ] + } + ], + "paid_tuple_witness": { + "new_calls": 1, + "new_cutoff": "14^832", + "old_calls": 37890094139078630732099290807613408160000565303748712092109533767110880114850558578280907565358706805285649027832657517839, + "previous_cutoff": "10^832", + "rank": "14^832" + }, + "raw_crossing": [ + "0.003879928046154", + "0.003879928046155" + ], + "separation": { + "alpha": { + "lower": "0.999999999999933434532609206067", + "upper": "0.999999999999933434532609206068" + }, + "ambient": "127^832", + "construction": "chronological product; specialize low complete targets to owned zero; retain all original paid calls; split paid calls on disjoint axes", + "cutoff_base": 14, + "floor_base": 16, + "gamma": { + "lower": "0.878519229281134076395964614978", + "upper": "0.878519229281134076395964614979" + }, + "label": "source", + "lambda": { + "lower": "0.943578737373791363241715378674", + "upper": "0.943578737373791363241715378675" + }, + "maximum_paid": "14^832", + "minimum_retained_target": "16^832", + "normalized_paid_plus_lost_target_upper": { + "lower": "0.999999999945088000004051465278", + "upper": "0.999999999945088000004051465279" + }, + "owned_allocation_records_bound": "2*20706^832", + "paid": { + "1": 49980, + "14": 444, + "2": 46116, + "21": 444, + "28": 444, + "3": 1944, + "35": 444, + "4": 1584, + "42": 444, + "49": 444, + "5": 612, + "56": 444, + "6": 3672, + "7": 444 + }, + "paid_tail_offset": "11/50", + "product_or_uniform_word_materialized": false, + "product_raw_invocation_count": "sum(i=0..831, 20706^(831-i)*107460^i)", + "rank_mass_surplus": "positive by separated t-moment advantage; no discarded target mass retained as credit", + "rational_upper_limits": [ + "499999999999967/500000000000000", + "175703845856227/200000000000000", + "29486835542931/31250000000000" + ], + "retained_productive_fields": "W = sum over target tuples with product >= 16^832 of their multiplicities", + "source_paid_calls": 107460, + "source_paid_rank_mass": 291360, + "source_public_fields": 20706, + "source_status": "unadmitted", + "specialized_initial_and_final": 0, + "specialized_owned_fields": "D = 20706^832 - W", + "split_paid_calls_upper": "291360^832", + "strict_normalized_gap": { + "lower": "0.000000000054911999995948534721", + "upper": "0.000000000054911999995948534722" + }, + "target_tail_offset": "3/10", + "targets": { + "1": 288, + "127": 222, + "15": 444, + "2": 324, + "22": 444, + "29": 444, + "36": 444, + "4": 1548, + "43": 444, + "5": 288, + "50": 444, + "57": 444, + "6": 36, + "64": 444, + "8": 14448 + }, + "tensor_power": 832, + "tested_saving": "484991005763/125000000000000" + }, + "status": "PASS_GRADE14_BIT_FINITE", + "uniform": { + "H": 1642800000000000, + "N": "2^1642800000000000", + "eta": { + "lower": "0.000000135457921027150727728823", + "upper": "0.000000135457921027150727728824" + }, + "gap": "1/100000000000", + "integer_test_exponent": 16428, + "logarithm_power": 325, + "ordinary_base_bound": { + "lower": "7353723.314225655807181322391713827724", + "upper": "7353723.314225655807181322391713827725" + }, + "preceding_integer_grid_fails": true, + "previous_logarithm_power_fails": true, + "proof": "retained separated finite compiler and logarithmic majorant, with all new owned fields charged", + "theta": "20/21", + "uniform_saving": "484991004513/125000000000000" + }, + "word_sha256": "d3aa4426fa8fe7dc167270d01f2515184f2bff6a82744a14e941c5dd3afca27d" +} diff --git a/research/p104-grade14-paid-cut/Grade14.lean b/research/p104-grade14-paid-cut/Grade14.lean new file mode 100644 index 0000000000..73ecb7f3c3 --- /dev/null +++ b/research/p104-grade14-paid-cut/Grade14.lean @@ -0,0 +1,41 @@ +import Init.Data.Rat +import Lean.Elab.Tactic.Decide + +/-! +The rational arithmetic in the finite BIT tensor certificate. +The three bounds are outward enclosures from the exact source moments. +-/ + +namespace P104Grade14 + +def paidMomentCap : Rat := 499999999999967 / 500000000000000 +def paidTailCap : Rat := 175703845856227 / 200000000000000 +def targetTailCap : Rat := 29486835542931 / 31250000000000 + +def paidBudget : Rat := + 1 / (1 + 832 * (1 - paidMomentCap)) + 2 * paidTailCap ^ (832 : Nat) + +def discardedBudget : Rat := targetTailCap ^ (832 : Nat) + +set_option maxRecDepth 8192 in +set_option maxHeartbeats 2000000 in +theorem verified_gap : paidBudget + discardedBudget < 1 - 54911999 / 10^18 := by + decide +kernel + +/-- Bounds on the two normalized charges suffice for strict separation. -/ +theorem strict_separation (paid discarded : Rat) + (hp : paid ≤ paidBudget) (hd : discarded ≤ discardedBudget) : + paid + discarded < 1 := by + have hsum : paid + discarded ≤ paidBudget + discardedBudget := + Rat.le_trans (Rat.add_le_add_right.mpr hp) (Rat.add_le_add_left.mpr hd) + have hthreshold : ¬ (1 : Rat) ≤ 1 - 54911999 / 10^18 := by decide +kernel + exact Rat.not_le.mp fun h => + hthreshold (Rat.le_trans (Rat.le_trans h hsum) (Rat.le_of_lt verified_gap)) + +theorem paid_cutoff_changes : (10 : Nat)^832 < 14^832 ∧ (14 : Nat)^832 < 16^832 := by + decide +kernel + +end P104Grade14 + +#print axioms P104Grade14.strict_separation +#print axioms P104Grade14.paid_cutoff_changes diff --git a/research/p104-grade14-paid-cut/LICENSE b/research/p104-grade14-paid-cut/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/research/p104-grade14-paid-cut/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/research/p104-grade14-paid-cut/NOTICE b/research/p104-grade14-paid-cut/NOTICE new file mode 100644 index 0000000000..3b083891bf --- /dev/null +++ b/research/p104-grade14-paid-cut/NOTICE @@ -0,0 +1,16 @@ +Iterated returns on the P104 ordinary suppliers + +Clear1nsight prepared the successor construction, explicit witnesses and verification +with substantial OpenAI Codex assistance, including independent computational checks. +The new material is offered under Apache-2.0. + +The exact starting words and the rational and binary replay interfaces are from +Clear1nsight's PR #7781. The paid and productive scalar operations, the 48-call +complex schedule, the punctured binary supplier and the common outer application +come from Ali Romman's PR #7776. The two paid projections build on the local +quotient and terminal repair in #7774 and #7781. The binary paired caller and +finite compiler use work by DreamingOfClouds, Jerry Chen (CubeJerry), zxv and the +contributors cited in their retained sources. SYLforge, Rohan Arun, Cinna Davis, +Douglas Colkitt and other predecessors contributed the caller, physical and +analytic framework. The source-fetch helper is adapted from #7774. The immutable +source manifest identifies the public inputs and their notices. diff --git a/research/p104-grade14-paid-cut/README.md b/research/p104-grade14-paid-cut/README.md new file mode 100644 index 0000000000..08c266e739 --- /dev/null +++ b/research/p104-grade14-paid-cut/README.md @@ -0,0 +1,31 @@ +# Grade-14 paid cuts for conditional integer multiplication + +The two finite application checks give **κ ≥ 0.00387992802601** for the construction in #7831 under its five framework premises. The gain over the open predecessor is **0.00000000000095**. The repository’s maintainer-selected result has a separate review process. + +Use 832 tensor factors, split paid ranks at 14^832, and retain productive ranks at or above 16^832. A homogeneous grade-14 paid tuple now fits in one call. Applying the predecessor's cutoff base 10 at the same power would require ceil(14^832 / 10^832) calls. The charged source words and the rational caller are inherited. This trades a larger tensor and a larger uniform threshold for a small improvement in the exponent. + +At trial 0.003879928046104 the price checker and the independent interval implementation both bound the paid moment, paid tail and discarded target tail. Their outward caps are 499999999999967/500000000000000, 175703845856227/200000000000000 and 29486835542931/31250000000000. The normalized strict surplus exceeds 0.000000000054911999. On the full ambient 134^832 the shifted-log factor is 20/21, the logarithm power is 325, and log₂ N is 1642800000000000. Both inherited uniform and delayed losses are 1/10¹¹. Four strict stock stages admit ordinary BIT saving 0.003879928026095. The expanded rational caller and its independent audit agree on the advertised bound across 54 strict and four functional checks. + +The five premises are native_all_columns, owned_erasure, compiler, precision_tape and analytic_recovery. Lean checks the exact rational separation and cutoff comparison. The full finite replay also verifies the 12 explicit inputs, 127 inherited sources, both native words and the application charges. The Lean file covers the stated arithmetic lemmas. + +## Reproduce + +From this directory, use CPython 3.12 and a fresh output directory. The fetch step downloads pinned public inputs and verifies their hashes. A populated source cache can be replayed offline by omitting the fetch flag. + +```sh +python3.12 -IB verify.py --work inputs --out replay --fetch +lean Grade14.lean +cmp RESULT.json replay/RESULT.json +cmp BIT.json replay/BIT.json +cmp AUDIT.json replay/AUDIT.json +``` + +The Lean replay used Lean 4.34.1. The strict separation lemma uses propext, Classical.choice and Quot.sound. The cutoff comparison is axiom-free. + +## Open next questions + +The unchanged signed BIT crossing is below 0.003879928046155. A substantially higher exponent calls for a new BIT profile. A practical first experiment is to audit a multi-coordinate helper projection with shared endpoints and replay all bridge and cleanup charges in both orientations. + +## Credit + +Submitted by [@RohanArun](https://x.com/RohanArun) through [the original X request](https://x.com/RohanArun/status/2123655584797143516). Codex performed the schedule experiment, finite replays and Lean check. Dugongue and contributors supplied the preceding verifier, tensor estimate and caller. The Apache-2.0 predecessor code and attribution are retained. [PR #7831](https://github.com/CrocSwap/integer-mult-bounds/pull/7831) · [PR #7830](https://github.com/CrocSwap/integer-mult-bounds/pull/7830) · [PR #7786](https://github.com/CrocSwap/integer-mult-bounds/pull/7786) · [Predecessor notice](https://github.com/CrocSwap/integer-mult-bounds/blob/89a67c404226d51028e135de2b9169e9020d57af/research/p104-iterated-returns/NOTICE) diff --git a/research/p104-grade14-paid-cut/RESULT.json b/research/p104-grade14-paid-cut/RESULT.json new file mode 100644 index 0000000000..4d15f03768 --- /dev/null +++ b/research/p104-grade14-paid-cut/RESULT.json @@ -0,0 +1,34 @@ +{ + "binary_ordinary": "0.003879928026095", + "binary_raw_bracket": [ + "0.003879928046154", + "0.003879928046155" + ], + "binary_word": "d3aa4426fa8fe7dc167270d01f2515184f2bff6a82744a14e941c5dd3afca27d", + "claim": "0.00387992802601", + "gain": "19/20000000000000", + "log2_carrier": 1642800000000000, + "log_power": 325, + "paid_cutoff": 14, + "power": 832, + "premises": [ + "native_all_columns", + "owned_erasure", + "compiler", + "precision_tape", + "analytic_recovery" + ], + "productive_floor": 16, + "rational_raw_bracket": [ + "0.00388013644474", + "0.00388013644475" + ], + "rational_word": "7660985e0b618cdbee13e4190a4c6d5f91fbdf01a8f7a5186fdde8b980c19b48", + "sharp_outer": { + "BIT_just_below_effective_rejected": true, + "functional_count": 4, + "minimum_margin": "1/1000000000000000", + "strict_count": 54 + }, + "status": "PASS_COMPLETE_CONDITIONAL_APPLICATION" +} diff --git a/research/p104-grade14-paid-cut/SOURCES.json b/research/p104-grade14-paid-cut/SOURCES.json new file mode 100644 index 0000000000..0ba3a8c451 --- /dev/null +++ b/research/p104-grade14-paid-cut/SOURCES.json @@ -0,0 +1,86 @@ +[ + { + "head": "89a67c404226d51028e135de2b9169e9020d57af", + "path": "research/p104-iterated-returns/SOURCE-LOCK.json", + "pr": 7786, + "repo": "CrocSwap/integer-mult-bounds", + "sha256": "b46b919292e1a1907345056b6925f5f1400d45650e2f0f610779a07163bb64ee" + }, + { + "head": "89a67c404226d51028e135de2b9169e9020d57af", + "path": "research/p104-iterated-returns/prepare_sources.py", + "pr": 7786, + "repo": "CrocSwap/integer-mult-bounds", + "sha256": "c70c3be6e48717c6a9a561ef2294d23437a60d7dbcbbddc1305a6fc54001bb3d" + }, + { + "head": "89a67c404226d51028e135de2b9169e9020d57af", + "path": "research/p104-iterated-returns/binary/finite.py", + "pr": 7786, + "repo": "CrocSwap/integer-mult-bounds", + "sha256": "c780cea060f4a9efef064b239636162a7e8e84e40369abc1a1c4679dfbeb3041" + }, + { + "head": "89a67c404226d51028e135de2b9169e9020d57af", + "path": "research/p104-iterated-returns/binary/WORD.json.gz", + "pr": 7786, + "repo": "CrocSwap/integer-mult-bounds", + "sha256": "d28f0d28d9d87d5fe57b8ef19e12faf98014f0bbef781987ce22daaa82f21cb9" + }, + { + "head": "89a67c404226d51028e135de2b9169e9020d57af", + "path": "research/p104-iterated-returns/binary/INDEPENDENT.json", + "pr": 7786, + "repo": "CrocSwap/integer-mult-bounds", + "sha256": "5865e19155488b80ccb1faa1ba74c2ffbc5ac22e8f22f10c5f4496ae49fc1229" + }, + { + "head": "89a67c404226d51028e135de2b9169e9020d57af", + "path": "research/p104-iterated-returns/continuation/qualify.py", + "pr": 7786, + "repo": "CrocSwap/integer-mult-bounds", + "sha256": "fdf559fbe15f52c2b31f2947712a46aa6b4c93f211ea9a0b1f05b07d69664227" + }, + { + "head": "89a67c404226d51028e135de2b9169e9020d57af", + "path": "research/p104-iterated-returns/continuation/compiler.py", + "pr": 7786, + "repo": "CrocSwap/integer-mult-bounds", + "sha256": "c160563bc51f984224bbb0a00f9e69b276fa618a83591c00f38fb9fa8d958d9c" + }, + { + "head": "89a67c404226d51028e135de2b9169e9020d57af", + "path": "research/p104-iterated-returns/continuation/audit_expanded.py", + "pr": 7786, + "repo": "CrocSwap/integer-mult-bounds", + "sha256": "0316153c1822724e1a3d08066aec9601a891073b0209954eaf302ffa014bf5ac" + }, + { + "head": "89a67c404226d51028e135de2b9169e9020d57af", + "path": "research/p104-iterated-returns/continuation/LAYOUT.json.gz", + "pr": 7786, + "repo": "CrocSwap/integer-mult-bounds", + "sha256": "b0f3ebc5710e469f3e8fc5ce159cbba048b563944182b50993431ef94f4fedbf" + }, + { + "head": "89a67c404226d51028e135de2b9169e9020d57af", + "path": "research/p104-iterated-returns/evidence/application.json", + "pr": 7786, + "repo": "CrocSwap/integer-mult-bounds", + "sha256": "88486d49f2ba1fc0e6c9f4a7402c82e91c44026cf90cd1387d1e5c45cf5e88d3" + }, + { + "head": "14c74c6a67108f675ac1196a5f2415ead0920e71", + "path": "research/p104-chart306-chain/DOUBLE-CANDIDATE.json.gz", + "pr": 7830, + "repo": "CrocSwap/integer-mult-bounds", + "sha256": "1b1b3294e86979f1f41076fb056f3c0a08ace6df7bf80f2886bc579a22962f4b" + }, + { + "head": "14c74c6a67108f675ac1196a5f2415ead0920e71", + "path": "research/p104-chart306-chain/DOUBLE-APPLICATION.json", + "pr": 7830, + "repo": "CrocSwap/integer-mult-bounds", + "sha256": "1b2d87e93ae023f5ffd464546af53281b6cb4963dfd76ae4742e0a5540b752fa" + } +] diff --git a/research/p104-grade14-paid-cut/verify.py b/research/p104-grade14-paid-cut/verify.py new file mode 100644 index 0000000000..785ac62266 --- /dev/null +++ b/research/p104-grade14-paid-cut/verify.py @@ -0,0 +1,236 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +"""Replay the grade-14 paid-cut certificate with the two inherited application checkers.""" + +import argparse +from collections import Counter +from fractions import Fraction as Q +from hashlib import sha256 +import gzip +import importlib.util +import json +from pathlib import Path +import shutil +import sys +from urllib.request import urlopen + +HERE = Path(__file__).resolve().parent +PRED = Path("7786/research/p104-iterated-returns") +CHAIN = Path("7830/research/p104-chart306-chain") +RAW = "https://raw.githubusercontent.com" +BASE_BIT = "d3aa4426fa8fe7dc167270d01f2515184f2bff6a82744a14e941c5dd3afca27d" +BASE_RATIONAL = "7660985e0b618cdbee13e4190a4c6d5f91fbdf01a8f7a5186fdde8b980c19b48" +LAYOUT = "f7de788c4a559282d35a9fce42f841a0e8de5a4015db871e718f9245569b0aa7" +TRIAL = Q("0.003879928046104") +LOSS = Q(1, 10**11) +POWER = 832 +CUTOFF, FLOOR, AMBIENT = 14, 16, 134 +PAID_TILT, TARGET_TILT = Q(11, 50), Q(3, 10) +EXPECTED = Q("0.00387992802601") +OLD_BOUND = Q("0.00387990740712") + + +def check(condition, message): + if not condition: + raise ValueError(message) + + +def digest(content): + return sha256(content).hexdigest() + + +def read(path): + return json.loads(path.read_bytes()) + + +def write(path, value): + path.write_bytes((json.dumps(value, indent=2, sort_keys=True) + "\n").encode()) + + +def load(name, path): + spec = importlib.util.spec_from_file_location(name, path) + module = importlib.util.module_from_spec(spec) + sys.modules[name] = module + spec.loader.exec_module(module) + return module + + +def pinned_inputs(work, fetch): + locks = read(HERE / "SOURCES.json") + for item in locks: + prefix = str(item["pr"]) + path = work / prefix / item["path"] + if not path.exists() and fetch: + url = f"{RAW}/{item['repo']}/{item['head']}/{item['path']}" + with urlopen(url, timeout=45) as response: + data = response.read() + check(digest(data) == item["sha256"], f"fetched SHA-256 {item['path']}") + path.parent.mkdir(parents=True, exist_ok=True) + path.write_bytes(data) + check(digest(path.read_bytes()) == item["sha256"], f"source SHA-256 {item['path']}") + + +def finite_bit(work, out): + package = work / PRED + source = work / "cache/source" + parent = work / "cache/parent" + binary = load("candidate_finite", package / "binary/finite.py") + for name, pin in binary.SOURCE_PINS.items(): + binary.pinned(source / name, pin) + for name, pin in binary.PACKAGE_PINS.items(): + binary.pinned(parent / name, pin) + literal = binary.load(parent / "binary/independent/literal.py", "literal") + price = binary.load(parent / "binary/independent/price.py", "directed_price") + credited = binary.load(source / binary.FINITE, "credited_trim") + baseline = literal.candidate_word(parent / "binary/WORD.json.gz") + caller = literal.pinned(source / binary.PAIRED / "EFREE-CALLER.json.gz", literal.CALLER_SHA) + word = package / "binary/WORD.json.gz" + native = binary.candidate_receipt(literal, word, BASE_BIT, baseline, caller) + + predecessor = read(package / "binary/INDEPENDENT.json") + paid, targets = native["paid"], native["targets"] + for actual, previous in ((paid, "complete_paid"), (targets, "complete_productive")): + check(actual == Counter({int(k): v for k, v in predecessor[previous].items()}), + f"independently verified {previous} is unchanged") + check(native["ordinary"] == predecessor["ordinary"], "unchanged all-call ordinary charge") + signed = price.signed_profile(targets, paid) + crossing, signs, _ = binary.exact_crossing(price, signed) + check(crossing == ["0.003879928046154", "0.003879928046155"], "raw signed BIT bracket") + check(TRIAL < Q(crossing[0]), "strict finite trial below raw crossing") + + separation = credited.certificate(targets, paid, TRIAL, POWER, CUTOFF, FLOOR, + PAID_TILT, TARGET_TILT) + monomial_targets = price.moment(targets, TRIAL) + ratios = ( + price.divide(price.moment(paid, TRIAL), monomial_targets), + price.divide(price.moment(paid, TRIAL, PAID_TILT), + price.mul(price.exp_log(CUTOFF, PAID_TILT), monomial_targets)), + price.divide(price.mul(price.exp_log(FLOOR, TARGET_TILT), + price.moment(targets, TRIAL, -TARGET_TILT)), monomial_targets), + ) + upper = tuple(Q(value) for value in separation["rational_upper_limits"]) + check(all(Q(interval[1], price.GRID) <= bound for interval, bound in zip(ratios, upper)), + "second interval implementation fits all three bounds") + a, g, l = upper + moment_upper = 1 / (1 + POWER * (1 - a)) + 2 * g**POWER + l**POWER + check(moment_upper < 1, "strict moment after paid splitting and target debit") + + # Independent full-ambient check of the historical uniform certificate. + uniform = credited.uniform_certificate(TRIAL, POWER, CUTOFF, FLOOR, AMBIENT, LOSS) + theta, log_power = Q(uniform["theta"]), uniform["logarithm_power"] + numerator, denominator = theta.as_integer_ratio() + check(CUTOFF**denominator < FLOOR**numerator + and 2 * CUTOFF**(POWER * denominator) <= AMBIENT**(POWER * numerator), + "both shifted-log inequalities on the 134-base ambient") + ambient_power = price.raise_interval(price.exp_log(AMBIENT, TRIAL), POWER) + eta = price.scale(price.invert(ambient_power), 1 - TRIAL) + check(theta**log_power < Q(eta[0], price.GRID) + and Q(ambient_power[1], price.GRID) < 2**log_power, + "independent uniform logarithmic majorant") + horizon, residual = divmod(uniform["H"], LOSS.denominator) + check(residual == 0 and (uniform["H"] + 1)**log_power < 2**horizon, + "integer uniform cutoff") + check(2**45 * LOSS > 256 and 1 + LOSS / 2 <= 2**horizon, + "retained delayed cover inequalities at the new loss") + + # A grade-14 homogeneous tuple now needs exactly one paid call. + # The predecessor cutoff would split it at this same tensor power. + check(paid[14] > 0 and 10**POWER < 14**POWER == CUTOFF**POWER, + "homogeneous paid tuple has a different physical subdivision") + old = Q(read(source / binary.CLAIM)["admitted_BIT_saving"]) + rho = Q(1, 250) + covered = TRIAL - 2 * LOSS + steps, previous = [], old + for _ in range(4): + envelope = (1 - rho) * covered + rho * previous + ticks = int(envelope * 10**15) - 1 + steps.append(f"0.{ticks:015d}") + previous = Q(steps[-1]) + admitted, stages = price.bootstrap(old, covered, steps) + check(admitted == Q(steps[-1]) and admitted > OLD_BOUND, "four strict stock stages") + result = dict(status="PASS_GRADE14_BIT_FINITE", word_sha256=BASE_BIT, + native_calls=native["native_calls"], native=native, + raw_crossing=crossing, endpoint_margins=signs, + separation=separation, independent_ratios=[price.decimal_interval(r) for r in ratios], + normalized_gap=price.rational_display(1 - moment_upper), + uniform=uniform, loss_each=str(LOSS), covered=str(covered), + ordinary_bootstrap=stages, ordinary_admitted=steps[-1], + paid_tuple_witness=dict(rank=f"14^{POWER}", previous_cutoff=f"10^{POWER}", + new_cutoff=f"14^{POWER}", old_calls=(14**POWER+10**POWER-1)//10**POWER, new_calls=1)) + write(out / "BIT.json", result) + return result + + +def rational_application(work, out, bit): + package = work / PRED + chain = work / CHAIN + bit_path = out / "BIT.json" + application_path = out / "APPLICATION.json" + audit_path = out / "AUDIT.json" + + # The consumer uses the same literal BIT word with our independently + # recomputed finite admission receipt. Keep both public sources immutable. + adapter = out / "input" + (adapter / "binary").mkdir(parents=True, exist_ok=True) + shutil.copyfile(package / "SOURCE-LOCK.json", adapter / "SOURCE-LOCK.json") + shutil.copyfile(package / "binary/WORD.json.gz", adapter / "binary/WORD.json.gz") + shutil.copyfile(bit_path, adapter / "binary/FINITE.json") + cap_pin = digest(bit_path.read_bytes()) + common = dict(cache=work / "cache", word=chain / "DOUBLE-CANDIDATE.json.gz", + layout=package / "continuation/LAYOUT.json.gz", word_sha=BASE_RATIONAL, layout_sha=LAYOUT) + qualifier = load("expanded_qualifier", package / "continuation/qualify.py") + qualifier.BIT_FINITE_PIN = cap_pin + reference = package / "evidence/application.json" + app = qualifier.qualify(argparse.Namespace(**common, package=adapter, + e40b_receipt=reference, out=application_path)) + write(application_path, app) + app = read(application_path) + check(app["binary_word"] == bit["word_sha256"] + and Q(app["binary_ordinary"]) == Q(bit["ordinary_admitted"]), "BIT consumer consumes recomputed cap") + + audit = load("expanded_audit", package / "continuation/audit_expanded.py") + audit.BINARY_INDEPENDENT_SHA = cap_pin + audit.main(argparse.Namespace(**common, receipt=application_path, binary_receipt=bit_path, + reference_application=reference, out=audit_path)) + checked = read(audit_path) + old = read(chain / "DOUBLE-APPLICATION.json") + check(Q(old["application"]["claim"]) == OLD_BOUND, "comparison matches pinned PR #7830 bound") + for name in ("invoice", "ordinary", "bracket"): + check(old["application"][name] == app["application"][name], f"retained rational {name}") + claim = app["application"]["claim"] + check(Q(claim) == EXPECTED and Q(claim) == Q(checked["outer"]["claim"]) and EXPECTED > Q("0.00387992802506"), "independent end-to-end κ comparison") + return app, checked + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--work", required=True, type=Path, help="immutable source cache root") + parser.add_argument("--out", required=True, type=Path, help="new evidence directory") + parser.add_argument("--fetch", action="store_true") + parser.add_argument("--bit-only", action="store_true") + args = parser.parse_args() + check(__debug__, "verification requires assertions") + work, out = args.work.resolve(), args.out.resolve() + out.mkdir(parents=True, exist_ok=False) + pinned_inputs(work, args.fetch) + prepare = load("source_preparer", work / PRED / "prepare_sources.py") + count = prepare.sources(work / "cache", args.fetch) + print(f"Authenticated {count} inherited sources.", flush=True) + bit = finite_bit(work, out) + print("PASS_GRADE14_BIT_FINITE", bit["ordinary_admitted"], flush=True) + if args.bit_only: + return + app, audit = rational_application(work, out, bit) + result = dict(status="PASS_COMPLETE_CONDITIONAL_APPLICATION", rational_word=BASE_RATIONAL, + binary_word=BASE_BIT, binary_ordinary=bit["ordinary_admitted"], + binary_raw_bracket=bit["raw_crossing"], rational_raw_bracket=app["application"]["bracket"], + claim=app["application"]["claim"], gain=str(EXPECTED-Q("0.00387992802506")), + premises=app["premises"], sharp_outer=audit["outer"]["outer_checks"], + power=POWER, paid_cutoff=CUTOFF, productive_floor=FLOOR, + log_power=bit["uniform"]["logarithm_power"], log2_carrier=bit["uniform"]["H"]) + write(out / "RESULT.json", result) + print("PASS_COMPLETE_CONDITIONAL_APPLICATION", result["claim"], flush=True) + + +if __name__ == "__main__": + main()