diff --git a/research/p104-live-relative-gain/APPLICATION-SOURCES.tar.gz b/research/p104-live-relative-gain/APPLICATION-SOURCES.tar.gz new file mode 100644 index 0000000000..7117005363 Binary files /dev/null and b/research/p104-live-relative-gain/APPLICATION-SOURCES.tar.gz differ diff --git a/research/p104-live-relative-gain/APPLICATION.json b/research/p104-live-relative-gain/APPLICATION.json new file mode 100644 index 0000000000..38aa4014c5 --- /dev/null +++ b/research/p104-live-relative-gain/APPLICATION.json @@ -0,0 +1,184 @@ +{ + "H": "15216900000000000000", + "binary_H": 299610000000000, + "binary_native": { + "calls": 36, + "instructions": { + "ADD": 29301, + "CLEAR": 3433, + "INIT": 3433, + "MOVE": 2803, + "SWAP": 630 + }, + "ordinary": { + "caller_bank_transits": 3507600, + "native_bank_transits_per_call": 2576851200, + "native_banks_and_scratch": 4067, + "ordinary_records": 896869203600, + "owned_backing": 6994188, + "raw_ordinary_allowance": 1000000000000, + "raw_owned_allowance": 10000000, + "route_groups": 555624, + "route_records": 804099052800 + }, + "paid": { + "1": 1348, + "2": 1247, + "3": 55, + "4": 42, + "5": 29, + "6": 81, + "7": 1 + }, + "paid_all": { + "1": 48972, + "14": 444, + "2": 44892, + "21": 444, + "28": 444, + "3": 1980, + "35": 444, + "4": 1512, + "42": 444, + "49": 444, + "5": 1044, + "56": 444, + "6": 2916, + "7": 480 + }, + "productive": { + "4": 17, + "8": 391 + }, + "productive_all": { + "127": 222, + "15": 444, + "22": 444, + "29": 444, + "36": 444, + "4": 612, + "43": 444, + "50": 444, + "57": 444, + "64": 444, + "8": 14520 + }, + "public": 630 + }, + "binary_ordinary": "0.003890115076583", + "binary_product": { + "paid_tuples": 12810, + "raw_occurrences": 12793, + "raw_ordinary_records": 12833, + "raw_owned_fields": 12816, + "split_paid_calls": 13919, + "target_specialization_records": 10912, + "target_tuples": 10911 + }, + "binary_raw": [ + "0.003890115286594", + "0.003890115286595" + ], + "binary_word": "b096d6df2a0c4688296b13ab0cfd50fec1c7dec732819c624ddd7a745a144b69", + "claim": "0.00389011507650", + "enrolled": "0.00391884648", + "fixture": { + "exact_outputs_each": 1291, + "fixture_signed_width": 181, + "minimum_product_grid": 154113755636630124932500335624192000, + "native_independent_wide_incidences_executed": 119176, + "native_signed_components": 4, + "whole_prefix_width_bits": 163 + }, + "historical_comparator": "0.00387992804541", + "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": 15216900000000000000, + "strict_guard_passed": true + } + }, + "extra_allowance_all_48_native_calls": 16745856, + "native_numeric_homes": 8261, + "native_selected_resets": 128512224, + "native_selected_transfers": 33613632, + "ordinary_elementary_record_upper": 151630617600, + "ordinary_map_slots": 1598400, + "ordinary_scalar_services": 1996621824, + "ordinary_scalar_step_rate": 4294967296, + "selected_steps_linear_and_constant": [ + 18756522451872, + 84454718248224 + ] + }, + "outer": { + "BIT_just_below_effective_rejected": true, + "functional_count": 4, + "minimum_margin": "1/1000000000000000", + "strict_count": 54 + }, + "plans": { + "charged_extra_services_per_native": 348872, + "concrete_signed_inputs_tested": 241710, + "expanded_coefficients": 24171, + "expanded_terms": 29794, + "extra_clean_replacements_per_native": 85063, + "literal_terms": 323573, + "lowered_primitives_per_native": { + "ADD": 29776, + "DIV": 55305, + "MUL": 89346 + }, + "max_literal_bits": 57, + "omitted_extra_clear_control": { + "coefficient": "-69893383680", + "instruction": 2, + "rejected": true, + "stream": 1 + }, + "retirement_of_wide_term_streams_in_existing_allowance": 89382 + }, + "premises": [ + "native_all_columns", + "owned_erasure", + "compiler", + "precision_tape", + "analytic_recovery" + ], + "previous_gain_factor": "0.00385896148992 / 0.00382063778177", + "rational_calls": 48, + "rational_grid": { + "all_basis_products": 25146238, + "dyadic_height": 30, + "exact_basis_owners": 1291, + "minimal_grid": true, + "nontrivial_basis_divisions": 17231591, + "odd_factors": [ + 14326729, + 5632621, + 13941785, + 127575 + ], + "positive_path_mass": "205356183613728386434052488657699504746980105023/1621896683681232672237748224000", + "product_grid": 154113755636630124932500335624192000 + }, + "rational_layout": "0ce3f9e383fc4bfdd22612b9e34fc9759d97204215937b82d23aec2cedd9b8ee", + "rational_raw": [ + "0.00389848144654", + "0.00389848144655" + ], + "rational_word": "38d2b3a2311a9ba5fee091cc7aa204c7ed95651aec95d75184b2391df090cbfb", + "source_archive": "d85d011ca74e8592c21c1e4db91a1a9021af26dcebc4dfdc2af7251f9c1bf968", + "source_count": 134 +} diff --git a/research/p104-live-relative-gain/AUDIT.json b/research/p104-live-relative-gain/AUDIT.json new file mode 100644 index 0000000000..e07a369f61 --- /dev/null +++ b/research/p104-live-relative-gain/AUDIT.json @@ -0,0 +1,523 @@ +{ + "by_denominator": { + "1": 5553670, + "10": 50897, + "100": 13, + "10005120": 2, + "1010240": 7, + "101088768": 1, + "1010887680": 2, + "102052224": 1, + "1023": 2, + "10332": 2, + "104220": 1, + "10530080": 2, + "1063044": 2, + "10630440": 38, + "106304400": 1, + "10656": 695, + "11": 757, + "110": 27, + "110112": 120, + "1101120": 340, + "11016": 11, + "110208": 2, + "111": 3475, + "112": 830, + "11339136": 2, + "113391360": 6, + "1147": 36, + "11470": 162, + "1152": 59, + "1158": 6, + "11580": 29, + "1174528": 166, + "11745280": 28, + "118116": 3, + "1181160": 2, + "1184": 8803, + "11846340": 1, + "1185792": 1, + "119040": 10, + "11959245": 2, + "12": 15468, + "120": 8, + "1212288": 1, + "1224": 46, + "12352": 1, + "123520": 2, + "1235200": 1, + "124": 1020, + "1240": 87, + "1250640": 18, + "12599040": 1, + "126360960": 17, + "1264": 2221, + "12640": 859, + "12730368": 38, + "12756528": 7, + "127565280": 27, + "128": 4292, + "1280": 5, + "1312": 1, + "13124": 1, + "131547136": 18, + "132": 2, + "1321344": 100, + "13213440": 10, + "1328805": 27, + "13288050": 2, + "1332": 3475, + "136": 321, + "1364": 1, + "13764": 34, + "137640": 70, + "1377": 130, + "13776": 3, + "1389970560": 2, + "14": 1031, + "1403218080": 1, + "1408": 2, + "14094336": 12, + "140943360": 1002, + "14173920": 5, + "14208": 9035, + "142080": 20, + "1435920": 1, + "144": 1234, + "1440": 401, + "14475": 6, + "146816": 780, + "1468160": 272, + "14688": 4, + "148": 4261, + "148224": 3, + "1482240": 13, + "1488": 377, + "14880": 450, + "15": 479, + "15007680": 2, + "1504": 971, + "15040": 3, + "15147": 6, + "1515360": 6, + "153": 2, + "1536": 27, + "1544": 3, + "15440": 9, + "155": 1740, + "15633": 3, + "156330": 4, + "157488": 1, + "15795120": 15, + "158": 2647, + "1580": 301, + "1594566": 2, + "15945660": 96, + "16": 235322, + "160": 1526, + "1616384": 4, + "1632": 14, + "165168": 18, + "1651680": 20, + "168481280": 6, + "1691320320": 580, + "17": 522, + "17008704": 3, + "170087040": 10, + "17370": 2, + "174": 64, + "174592": 2, + "175402260": 4, + "176": 38, + "1761792": 772, + "17617920": 90, + "1771740": 8, + "1776": 42395, + "18": 137, + "18352": 780, + "183520": 964, + "1836": 5, + "18368": 10, + "185280": 14, + "186": 90, + "1860": 2691, + "187": 7, + "1875960": 45, + "18792448": 18, + "187924480": 87, + "188": 1156, + "1880": 1155, + "18898560": 1, + "192": 1138, + "1920": 4, + "193": 14, + "1930": 10, + "19686": 1, + "1973207040": 18, + "1974390": 2, + "197632": 2, + "1976320": 7, + "198": 4, + "1984": 30, + "19932075": 8, + "2": 3201194, + "20": 29589, + "200": 5, + "2020480": 11, + "204": 3, + "20664": 1, + "20844": 1, + "208440": 1, + "21060160": 1, + "2126088": 1, + "21260880": 42, + "21824": 1, + "22": 208, + "220": 24, + "220224": 418, + "2202240": 460, + "22032": 8, + "220416": 4, + "2204160": 2, + "222": 6255, + "223665": 708, + "224": 280, + "227328": 695, + "2294": 102, + "22940": 324, + "2316": 2, + "23160": 6, + "231600": 2, + "232": 480, + "233869680": 1, + "234495": 3, + "2349056": 30, + "235": 323, + "236232": 3, + "2362320": 3, + "2368": 10269, + "23918490": 1, + "24": 11263, + "240": 409, + "2424576": 22, + "2448": 30, + "24704": 1, + "247040": 2, + "248": 756, + "2480": 268, + "25": 42, + "2501280": 14, + "25272192": 2, + "252721920": 10, + "2528": 44, + "25513056": 1, + "255130560": 4, + "256": 3396, + "2560": 1, + "2624": 2, + "2642688": 46, + "265761": 2, + "2657610": 10, + "26576100": 3, + "2664": 1390, + "27": 3, + "272": 221, + "27528": 58, + "275280": 116, + "2754": 7, + "27552": 1, + "277994112": 1, + "28": 1433, + "281886720": 415, + "28347840": 5, + "28416": 2798, + "288": 1646, + "2895": 336, + "29": 288, + "29233710": 1, + "293632": 306, + "2936320": 188, + "29376": 2, + "296": 3656, + "2964480": 4, + "2976": 91, + "3": 230366, + "30": 12, + "3008": 1, + "3030720": 22, + "306": 23, + "3072": 1, + "30880": 3, + "31": 2058, + "310": 598, + "31266": 2, + "312660": 1, + "314976": 1, + "31590240": 23, + "316": 1320, + "3160": 859, + "3189132": 4, + "31891320": 75, + "32": 76062, + "320": 400, + "3264": 8, + "33": 9, + "330336": 54, + "333": 1390, + "336962560": 2, + "34": 245, + "341": 238, + "3441": 12, + "34410": 18, + "346368": 4, + "348": 32, + "349184": 1, + "35080452": 2, + "350804520": 1, + "352": 17, + "3523584": 136, + "35235840": 310, + "3543480": 4, + "35434800": 1, + "3552": 34768, + "36": 45, + "36704": 1270, + "367040": 800, + "3672": 1, + "36736": 4, + "37": 3511, + "370560": 23, + "372": 54, + "3720": 3296, + "3751": 9, + "375192": 2, + "3751920": 26, + "376": 1155, + "37888": 695, + "384": 418, + "3840": 1, + "386": 5, + "3860": 13, + "3936": 1, + "3948780": 2, + "395": 367, + "396": 4, + "3968": 18, + "3986415": 98, + "39864150": 1, + "4": 2357912, + "40": 7387, + "400": 2, + "405": 1536, + "408": 12, + "41292": 18, + "42120320": 6, + "4252176": 3, + "42521760": 33, + "432960": 1, + "43648": 3, + "43850565": 2, + "44": 339, + "440": 4, + "440448": 1188, + "4404480": 330, + "44064": 4, + "442935": 3, + "444": 9035, + "448": 180, + "45": 24, + "4588": 138, + "45880": 766, + "4592": 1, + "46320": 1, + "463200": 1, + "465": 5009, + "46773936": 1, + "468990": 20, + "4698112": 30, + "46981120": 10, + "47": 2695, + "470": 969, + "472464": 1, + "4724640": 3, + "4736": 1622, + "48": 1627, + "480": 8, + "481": 6635, + "4825": 3, + "4849152": 2, + "4896": 8, + "49330176": 18, + "49408": 1, + "496": 198, + "4960": 105, + "5": 187002, + "50": 6, + "500256": 1, + "5002560": 6, + "5049": 2, + "50544384": 3, + "505443840": 11, + "51": 1, + "51026112": 2, + "512": 420, + "5166": 1, + "5211": 1, + "52110": 2, + "531522": 1, + "5315220": 23, + "53152200": 3, + "5328": 2085, + "544": 132, + "55": 83, + "55056": 106, + "550560": 188, + "5508": 7, + "55104": 10, + "5559882240": 1, + "56": 1127, + "56377344": 18, + "563773440": 402, + "5669568": 1, + "56695680": 1, + "56832": 695, + "5735": 144, + "576": 843, + "579": 17, + "5790": 38, + "58": 160, + "58467420": 1, + "587264": 192, + "5872640": 58, + "58752": 1, + "59058": 2, + "592": 8544, + "5920": 36, + "6": 52471, + "60": 434, + "6061440": 13, + "612": 47, + "61760": 1, + "617600": 1, + "62": 1302, + "620": 167, + "62532": 1, + "625320": 12, + "6299520": 1, + "6318048": 2, + "63180480": 22, + "632": 1723, + "6365184": 19, + "6378264": 12, + "63782640": 63, + "64": 37197, + "640": 1036, + "65": 1, + "656": 1, + "66": 2, + "660672": 36, + "6606720": 20, + "666": 695, + "68": 402, + "68034816": 1, + "682": 12, + "6882": 36, + "68820": 36, + "6888": 2, + "68880": 1, + "694985280": 1, + "7": 1929, + "70160904": 1, + "701609040": 2, + "704": 2, + "7047168": 54, + "70471680": 283, + "708696": 1, + "7086960": 7, + "70869600": 1, + "7104": 23630, + "72": 32, + "73408": 1200, + "734080": 414, + "7344": 3, + "74": 65, + "741120": 22, + "744": 127, + "7440": 1450, + "750384": 1, + "7503840": 10, + "752": 2127, + "7520": 1, + "757680": 2, + "768": 1, + "772": 2, + "7720": 2, + "78165": 8, + "78744": 1, + "7897560": 14, + "79": 13697, + "792": 1, + "7936": 36, + "797283": 4, + "7972830": 85, + "8": 707934, + "80": 2440, + "800": 2, + "808192": 16, + "8081920": 4, + "81": 12905, + "816": 18, + "825840": 10, + "833760": 1, + "84240640": 4, + "845660160": 506, + "85": 5, + "8504352": 10, + "85043520": 32, + "865920": 1, + "8685": 6, + "87296": 4, + "87701130": 2, + "88": 148, + "880": 5, + "880896": 1024, + "8808960": 230, + "88128": 1, + "885870": 4, + "888": 26410, + "9": 969, + "9176": 360, + "91760": 1162, + "918": 40, + "9184": 8, + "9264": 1, + "928": 1312, + "93": 496, + "930": 2009, + "935478720": 1, + "937980": 44, + "9396224": 18, + "94": 1093, + "940": 385, + "9449280": 4, + "9472": 18, + "96": 3427, + "960": 7, + "965": 46, + "9650": 1, + "9843": 2, + "986603520": 19, + "98816": 1, + "99": 39, + "992": 126, + "9920": 91 + }, + "literal_peak_bits": 37, + "minimum_product_grid": 35237207388978003467690311680000, + "nontrivial_divisions": 7556199, + "path_grid": 55622918505308669857846252315607040000, + "products": 13109869, + "public_rows": 1289, + "word_sha256": "7e74ad15ba7564ad2207acac6c6cafcc57ae3b19386f6d332dd1c0fca968a17e" +} diff --git a/research/p104-live-relative-gain/BANK-FACTORS-EVENTS.json b/research/p104-live-relative-gain/BANK-FACTORS-EVENTS.json new file mode 100644 index 0000000000..3bb375bfae --- /dev/null +++ b/research/p104-live-relative-gain/BANK-FACTORS-EVENTS.json @@ -0,0 +1,260 @@ +{ + "parent": "a7a98bd3cd1044011ab62b103cb363d4ea6924f01340745e5a895ef650de953c", + "word": "38d2b3a2311a9ba5fee091cc7aa204c7ed95651aec95d75184b2391df090cbfb", + "public_split_sha256": "a69c9128d7bb582c63dc60c1b7fa8eb42eaae9ed95eca4f0b0a9dfd006dbdf0d", + "bank_split_sha256": "d02590768a74bf326f9c331bcf3e4b514abe8ff8b19fafc8d4e4e2fb0100becc", + "events": [ + { + "transposed": false, + "old": 746, + "new": 916, + "arrivals": [ + 98724 + ], + "sends": [ + 98728, + 98753, + 104 + ], + "rotations": [], + "generators": [ + { + "slot": 106, + "row": 98728 + }, + { + "slot": 110, + "row": 98753 + } + ], + "removed_paid": [ + 98728, + 98753 + ] + }, + { + "transposed": false, + "old": 267, + "new": 234, + "arrivals": [ + 90901 + ], + "sends": [ + 103551 + ], + "rotations": [ + { + "public": false, + "slots": [ + 90901, + 103322 + ], + "rows": [ + [ + 103322, + [ + [ + 90901, + "1/2" + ], + [ + 103322, + "1" + ] + ] + ] + ] + }, + { + "public": false, + "slots": [ + 103551, + 103558, + 103668, + 103995, + 104061, + 104069, + 104077, + 104082 + ], + "rows": [ + [ + 103551, + [ + [ + 104061, + "1" + ] + ] + ], + [ + 103558, + [ + [ + 103551, + "1" + ] + ] + ], + [ + 103668, + [ + [ + 103558, + "1" + ] + ] + ], + [ + 103995, + [ + [ + 103668, + "1" + ] + ] + ], + [ + 104061, + [ + [ + 103995, + "1" + ] + ] + ], + [ + 104069, + [ + [ + 104061, + "1/6888" + ], + [ + 104069, + "1" + ] + ] + ], + [ + 104082, + [ + [ + 104061, + "-1/6888" + ], + [ + 104082, + "1" + ] + ] + ] + ] + } + ], + "generators": [], + "removed_paid": [ + 90901 + ] + }, + { + "transposed": false, + "old": 396, + "new": 598, + "arrivals": [ + 97223 + ], + "sends": [ + 91358 + ], + "rotations": [ + { + "public": false, + "slots": [ + 97223, + 98691 + ], + "rows": [ + [ + 97223, + [ + [ + 98691, + "1" + ] + ] + ], + [ + 98691, + [ + [ + 97223, + "1" + ], + [ + 98691, + "1" + ] + ] + ] + ] + }, + { + "public": false, + "slots": [ + 91358, + 93997, + 99678, + 99688 + ], + "rows": [ + [ + 91358, + [ + [ + 99688, + "1" + ] + ] + ], + [ + 93997, + [ + [ + 91358, + "1" + ] + ] + ], + [ + 99678, + [ + [ + 93997, + "1" + ] + ] + ], + [ + 99688, + [ + [ + 99678, + "1/16" + ], + [ + 99688, + "1" + ] + ] + ] + ] + } + ], + "generators": [], + "removed_paid": [ + 97223 + ] + } + ] +} diff --git a/research/p104-live-relative-gain/BANK-FACTORS-RECEIPT.json b/research/p104-live-relative-gain/BANK-FACTORS-RECEIPT.json new file mode 100644 index 0000000000..3ac5af6d50 --- /dev/null +++ b/research/p104-live-relative-gain/BANK-FACTORS-RECEIPT.json @@ -0,0 +1,60 @@ +{ + "old_word": "a7a98bd3cd1044011ab62b103cb363d4ea6924f01340745e5a895ef650de953c", + "new_word": "38d2b3a2311a9ba5fee091cc7aa204c7ed95651aec95d75184b2391df090cbfb", + "layout": "0ce3f9e383fc4bfdd22612b9e34fc9759d97204215937b82d23aec2cedd9b8ee", + "old_moves": 5676, + "moves": 5674, + "retired": 8, + "new_moves": 6, + "coefficient_edits": 1162, + "changed_rows": 394, + "forward_terms": 25146238, + "minimum_product_grid": "154113755636630124932500335624192000", + "literal_peak_bits": 57, + "adjoint_terms": 88780788, + "public": 1291, + "paid": { + "1": 183312, + "2": 38016, + "3": 23040, + "4": 10848, + "5": 15072, + "6": 1968, + "7": 480, + "8": 1344, + "16": 1248, + "24": 1248, + "32": 1248, + "40": 1248, + "48": 1248, + "56": 1248 + }, + "productive": { + "1": 1008, + "2": 432, + "3": 480, + "4": 11568, + "5": 1584, + "6": 48, + "7": 672, + "8": 1584, + "9": 25872, + "17": 1248, + "25": 1248, + "33": 1248, + "41": 1248, + "49": 1248, + "57": 1248, + "65": 1248, + "129": 624 + }, + "crossing_e14": [ + 389848144654, + 389848144655 + ], + "trial": "0.00391884648", + "trial_margin": [ + "-20.643024976178467386243716678", + "-20.643024976178467386243716677" + ] +} diff --git a/research/p104-live-relative-gain/BANK-FACTORS.json.gz b/research/p104-live-relative-gain/BANK-FACTORS.json.gz new file mode 100644 index 0000000000..de611b5588 Binary files /dev/null and b/research/p104-live-relative-gain/BANK-FACTORS.json.gz differ diff --git a/research/p104-live-relative-gain/BIDIRECTIONAL-QUOTIENT-RECEIPT.json b/research/p104-live-relative-gain/BIDIRECTIONAL-QUOTIENT-RECEIPT.json new file mode 100644 index 0000000000..7606122e82 --- /dev/null +++ b/research/p104-live-relative-gain/BIDIRECTIONAL-QUOTIENT-RECEIPT.json @@ -0,0 +1,57 @@ +{ + "old_moves": 5680, + "moves": 5676, + "public": 1289, + "retired": 8, + "new_moves": 4, + "new_word": "9f055ab54604b1a56688138ef80c854a53f53d2fc3cab420b823ae58a92c10d3", + "forward_terms": 25106153, + "minimum_product_grid": "154113755636630124932500335624192000", + "literal_peak_bits": 57, + "adjoint_terms": 89136223, + "trial": "0.00391884648", + "trial_margin": [ + "-23.306408786869726116585221074", + "-23.306408786869726116585221073" + ], + "paid": { + "1": 183408, + "2": 38016, + "3": 23040, + "4": 10896, + "5": 15024, + "6": 2016, + "7": 432, + "8": 1344, + "16": 1248, + "24": 1248, + "32": 1248, + "40": 1248, + "48": 1248, + "56": 1248 + }, + "productive": { + "1": 960, + "2": 432, + "3": 432, + "4": 11568, + "5": 1584, + "7": 672, + "8": 1536, + "9": 25968, + "17": 1248, + "25": 1248, + "33": 1248, + "41": 1248, + "49": 1248, + "57": 1248, + "65": 1248, + "129": 624 + }, + "crossing_e14": [ + 389586937146, + 389586937147 + ], + "coefficient_edits": 126844, + "changed_rows": 771 +} diff --git a/research/p104-live-relative-gain/BIDIRECTIONAL-QUOTIENT.json.gz b/research/p104-live-relative-gain/BIDIRECTIONAL-QUOTIENT.json.gz new file mode 100644 index 0000000000..93b35fe944 Binary files /dev/null and b/research/p104-live-relative-gain/BIDIRECTIONAL-QUOTIENT.json.gz differ diff --git a/research/p104-live-relative-gain/BIDIRECTIONAL-RECEIPT.json b/research/p104-live-relative-gain/BIDIRECTIONAL-RECEIPT.json new file mode 100644 index 0000000000..81a0f7fdbc --- /dev/null +++ b/research/p104-live-relative-gain/BIDIRECTIONAL-RECEIPT.json @@ -0,0 +1,191 @@ +{ + "old_moves": 5700, + "moves": 5680, + "old_paid": { + "1": 184368, + "2": 38208, + "3": 23232, + "4": 10992, + "5": 15216, + "6": 1872, + "7": 144, + "8": 1296, + "16": 1248, + "24": 1248, + "32": 1248, + "40": 1248, + "48": 1248, + "56": 1248 + }, + "public": 1289, + "retired": 31, + "new_moves": 11, + "changed_bank": 28, + "changed_primary_bundles": 21, + "new_word": "202f18538b7d954565ad4cb3a87058af1d39907842df446c7d20045ca5a78c04", + "paid": { + "1": 183456, + "2": 38064, + "3": 23280, + "4": 10896, + "5": 15024, + "6": 1872, + "7": 432, + "8": 1344, + "16": 1248, + "24": 1248, + "32": 1248, + "40": 1248, + "48": 1248, + "56": 1248 + }, + "productive": { + "1": 960, + "2": 432, + "3": 432, + "4": 11568, + "5": 1584, + "7": 672, + "8": 1536, + "9": 25968, + "17": 1248, + "25": 1248, + "33": 1248, + "41": 1248, + "49": 1248, + "57": 1248, + "65": 1248, + "129": 624 + }, + "adjoint_terms": 86265205, + "trial_margin": [ + "-25.998285898888967762317173727870552481", + "-25.998285898888967762317173727870552480" + ], + "crossing_e14": [ + 389323292306, + 389323292307 + ], + "changed_rows": 1445, + "coefficient_edits": 199225, + "forward_terms": 24268860, + "minimum_product_grid": "154113755636630124932500335624192000", + "literal_peak_bits": 57, + "trial": "0.00391884648", + "internal_pairs": [ + [ + 34, + 514 + ], + [ + 235, + 267 + ], + [ + 237, + 267 + ], + [ + 353, + 361 + ], + [ + 361, + 235 + ], + [ + 409, + 417 + ], + [ + 417, + 242 + ], + [ + 446, + 451 + ], + [ + 447, + 455 + ], + [ + 451, + 244 + ], + [ + 455, + 244 + ], + [ + 503, + 508 + ], + [ + 504, + 512 + ], + [ + 508, + 516 + ], + [ + 512, + 516 + ], + [ + 514, + 516 + ], + [ + 549, + 593 + ], + [ + 593, + 712 + ], + [ + 693, + 208 + ], + [ + 712, + 1094 + ], + [ + 746, + 207 + ] + ], + "interior_charts": [ + 34, + 207, + 208, + 235, + 237, + 242, + 244, + 267, + 353, + 361, + 409, + 417, + 446, + 447, + 451, + 455, + 503, + 504, + 508, + 512, + 514, + 516, + 549, + 593, + 693, + 712, + 746, + 1094 + ] +} diff --git a/research/p104-live-relative-gain/BIDIRECTIONAL.json.gz b/research/p104-live-relative-gain/BIDIRECTIONAL.json.gz new file mode 100644 index 0000000000..3c91100fb0 Binary files /dev/null and b/research/p104-live-relative-gain/BIDIRECTIONAL.json.gz differ diff --git a/research/p104-live-relative-gain/BIDIRECTIONAL.md b/research/p104-live-relative-gain/BIDIRECTIONAL.md new file mode 100644 index 0000000000..b6180eae03 --- /dev/null +++ b/research/p104-live-relative-gain/BIDIRECTIONAL.md @@ -0,0 +1,59 @@ +# Rational circuits with 5,680 and 5,676 paid transfers + +The 5,676-transfer circuit raises the rational crossing from [0.00388013644474, 0.00388013644475] in PR 7830 to [0.00389586937146, 0.00389586937147], a gain of 0.40547%. It uses the same 1,289 input and output charts as the 5,700-transfer circuit. Both exact passes check the map on every independent field. [Four-term quotient and replay](#the-four-term-quotient) · [PR 7830](https://github.com/CrocSwap/integer-mult-bounds/pull/7830) + +## The 5,680-transfer circuit + +The circuit has the same 1,289 independent inputs, output charts and scalar map as the 5,700-transfer circuit in this package. It changes the signals shared by 21 ordered chart pairs. Across the 48 calls, the number of paid occurrences falls from 282,816 to 281,856. All 52,512 productive occurrences keep their grades. The new rational crossing is between 0.00389323292306 and 0.00389323292307. Its lower endpoint is 0.2552% above the previous rational crossing and 0.3375% above the rational crossing in PR 7830. [Counts, chart pairs and crossing](BIDIRECTIONAL-RECEIPT.json) · [PR 7830](https://github.com/CrocSwap/integer-mult-bounds/pull/7830) + +## How two signals can share a transfer + +Let M be the required rational map. Let X contain the coordinates of inputs that start outside chart 3. For each scalar in the old circuit, compute two row vectors. The first, u, gives its coefficients on X. To obtain the second, z, apply the X rows of the inverse of M to the outputs. Propagate those linear forms backward through the circuit. The entries of z give the effect of a change in the scalar on the recovered X coordinates. + +At a chart, let U and Z have one row for each incoming or outgoing scalar. A new local coefficient matrix K must satisfy both equations + +```text +K U_in = U_out, Kᵀ Z_out = Z_in. +``` + +These equations imply that the sum of the outer products uᵀz is the same on both sides. For example, two transfers with vector pairs (u,0) and (0,z) have zero total outer product. One transfer with pair (u,z) carries both directions. This replacement adds uᵀz to the sum on that link. The other links or boundary transfers at its two charts must account for the difference. At each changed chart, factor the remaining difference into outer products and solve the two equations for the local coefficients. The 21 changed pairs involve 28 interior charts. The word retires 31 old transfers and adds 11. [Exact chart list and transfer witness](BIDIRECTIONAL.json.gz) · [Chart pair inventory](BIDIRECTIONAL-RECEIPT.json) + +At chart 127, choose the terminal rows to recover the protected coordinates. If the resulting trial map is F, check that M⁻¹F is the identity on X and has an invertible block on the inputs at chart 3, with zero blocks between these groups. Precompose the chart 3 encoder with the inverse of its block. The resulting circuit now has the required map on every independent input. These chart equations give a construction method. The replay checks the final circuit directly over the rationals in dependency order. + +## Reproduce the result + +```sh +python3.12 -I -B research/p104-live-relative-gain/verify_bidirectional.py +``` + +The witness stores differences from the supplied parent word. An `add` record gives the difference vector for its row. A `combine` record gives a linear combination of earlier literal difference vectors. Apply each difference to the corresponding parent row. Fresh transfers start with an empty row. After expansion, 1,445 rows have 199,225 changed coefficients. The checker reconstructs the dependency order and verifies the canonical SHA-256 digest. + +The forward pass checks all 1,289 terminal rows with 24,268,860 rational scalar products. The smallest integer grid that contains each such product on integer basis inputs is 154113755636630124932500335624192000. The largest literal numerator or denominator uses 57 bits. The adjoint pass independently checks the 1,289 input columns with 86,265,205 terms. It also checks that each donor is at the correct chart and that each paid and productive move joins strictly nested charts. Outward bounds from integer square roots verify the two signs at the reported crossing and the strict decrease of the signed margin on [0, 0.004]. [Replay](verify_bidirectional.py) · [Receipt](BIDIRECTIONAL-RECEIPT.json) + +## The four-term quotient + +A second choice of 25 chart pairs at 34 interior charts gives an intermediate word with 5,678 paid transfers and 1,290 independent fields. In the transpose of this word, write each source at chart 127 as a variable x indexed by its original owner. Impose the relation + +```text +x[1017] = -x[371] + x[946]/2 + x[970]. +``` + +On this subspace, transfer 104455 equals the difference of transfers 98030 and 104472, and transfer 106 is zero. Substitute the difference at its readers and omit the zero term. This retires one grade-three and one grade-six transfer and surrenders the original grade-nine helper 1017. The additional independent field from chart 3 to chart 127 takes its public role number. The exported word realizes the original ordered map, including every independent terminal in that public layout. + +The supplied delta goes directly from 5,680 to 5,676. It retires eight transfer records and installs four. Transfer label 105 is reused with new endpoints and an empty initial coefficient row. The exact replay expands 126,844 coefficient changes in 771 rows. It checks 25,106,153 forward products and 89,136,223 adjoint terms. The largest literal still uses 57 bits and the least common product grid equals that of the 5,680-transfer word. The complete 48-call tally is 281,664 paid occurrences and 52,512 productive occurrences. [Delta](BIDIRECTIONAL-QUOTIENT.json.gz) · [Receipt](BIDIRECTIONAL-QUOTIENT-RECEIPT.json) + +```sh +python3.12 -I -B research/p104-live-relative-gain/verify_bidirectional.py --quotient +``` + +## Two independent helper splits + +With the same 5,676 paid transfers, split helper 233 at chart 750 and helper 205 at chart 34. The first grade-nine job becomes grade-three and grade-six jobs. The second becomes grade-one and grade-eight jobs. Each new input is independent. At each cut, a local expression reads a linear combination of source fields. The injection replaces that combination with the new input in the remaining program. A basis change within the original source and return banks keeps the other fields independent. The journal gives the two covectors, their nonzero pairings with the source directions, the literal readers and the injection coefficients. [Journal](HELPER-SPLITS.json) · [Reconstruction](verify_split_helpers.py) + +The word now delivers 1,291 independent fields. The forward check covers 25,038,131 products. The adjoint check covers 88,780,337 terms. The 48-call rational crossing is between 0.00389749436514 and 0.00389749436515. The full replay also checks the short scalar programs for the new 57-bit literals. [Split receipt](HELPER-SPLITS-RECEIPT.json) · [Complete application](APPLICATION.md) + +## Open next questions + +At κ = 0.00391884648 the rational margin is between −21.649081521691 and −21.649081521690. Another circuit needs more than 0.45102 per rational call. A further split must identify where the independent return can be read and where the second input can enter in time for its readers. [Binary and rational budgets](README.md#open-next-questions) + +Ali Romman prepared the construction and replay with substantial OpenAI Codex assistance. The 48-call profile and parent come from Clear1nsight's PR 7830 and the preceding P104 constructions. [Pinned sources and attribution](README.md#reproduce) diff --git a/research/p104-live-relative-gain/BINARY-CANDIDATE.json.gz b/research/p104-live-relative-gain/BINARY-CANDIDATE.json.gz new file mode 100644 index 0000000000..16f8cafb1c Binary files /dev/null and b/research/p104-live-relative-gain/BINARY-CANDIDATE.json.gz differ diff --git a/research/p104-live-relative-gain/CALLER-CENSUS.json b/research/p104-live-relative-gain/CALLER-CENSUS.json new file mode 100644 index 0000000000..0064ec09dd --- /dev/null +++ b/research/p104-live-relative-gain/CALLER-CENSUS.json @@ -0,0 +1,24 @@ +{ + "calls": 48, + "fixed_caller_paid": { + "1": 480, + "16": 1248, + "24": 1248, + "32": 1248, + "40": 1248, + "48": 1248, + "56": 1248, + "8": 1248 + }, + "fixed_root_targets": { + "129": 624, + "17": 1248, + "25": 1248, + "33": 1248, + "41": 1248, + "49": 1248, + "57": 1248, + "65": 1248, + "9": 480 + } +} diff --git a/research/p104-live-relative-gain/EVENTS.json b/research/p104-live-relative-gain/EVENTS.json new file mode 100644 index 0000000000..57f3d63707 --- /dev/null +++ b/research/p104-live-relative-gain/EVENTS.json @@ -0,0 +1,1135 @@ +{ + "before_erasure_sha256": "679fe0866211ecb052ecaf85a9e2dac98eb0d3d1bd9efc1052664aca10939ad4", + "before_quotient_sha256": "d241df2a70bbab43427211e0cffb517b741918a02a19f4bf65cd314a698675ee", + "birth": { + "calibration": [ + [ + 20007, + "4/3" + ], + [ + 93579, + "1/3" + ], + [ + 93586, + "1" + ], + [ + 93590, + "-8/3" + ], + [ + 93615, + "-1/3" + ] + ], + "pulse": [ + [ + 99166, + "1" + ], + [ + 99181, + "1" + ], + [ + 100851, + "-1" + ], + [ + 100856, + "1" + ], + [ + 101256, + "1" + ] + ], + "readout": [ + [ + 93590, + "1" + ] + ], + "return_chart": 127, + "return_covector": [ + [ + 266, + "-1" + ], + [ + 288, + "1/3" + ], + [ + 289, + "1" + ], + [ + 335, + "1/3" + ], + [ + 354, + "-1/6" + ], + [ + 359, + "-1/2" + ], + [ + 400, + "4/3" + ], + [ + 404, + "-1/3" + ], + [ + 410, + "1/2" + ], + [ + 411, + "1/6" + ], + [ + 418, + "2/3" + ], + [ + 431, + "4/3" + ], + [ + 578, + "-2/3" + ], + [ + 579, + "4/3" + ], + [ + 588, + "-4/3" + ], + [ + 1094, + "-4/3" + ], + [ + 1097, + "4" + ], + [ + 1131, + "2/3" + ] + ], + "return_direction": [ + [ + 449, + "-4/3" + ], + [ + 488, + "-2/3" + ], + [ + 494, + "-2/3" + ], + [ + 581, + "2/3" + ], + [ + 891, + "-2/3" + ], + [ + 1040, + "1/3" + ], + [ + 1090, + "-2/3" + ], + [ + 1097, + "-1/3" + ], + [ + 1102, + "2/3" + ], + [ + 1107, + "2/3" + ], + [ + 1247, + "1/3" + ] + ], + "role": 449, + "source_chart": 3, + "source_covector": [ + [ + 579, + "-1/2" + ], + [ + 588, + "3/2" + ], + [ + 774, + "1" + ], + [ + 827, + "-2" + ], + [ + 831, + "-3" + ], + [ + 1094, + "1" + ], + [ + 1097, + "-3" + ] + ], + "source_direction": [ + [ + 449, + "-4/3" + ], + [ + 488, + "-2/3" + ], + [ + 494, + "-2/3" + ], + [ + 581, + "2/3" + ], + [ + 891, + "-2/3" + ], + [ + 1040, + "1/3" + ], + [ + 1090, + "-2/3" + ], + [ + 1097, + "-1/3" + ], + [ + 1102, + "2/3" + ], + [ + 1107, + "2/3" + ], + [ + 1247, + "1/3" + ] + ], + "split_chart": 1048 + }, + "birth_source_label": 1542, + "canonical_sha256": "7e74ad15ba7564ad2207acac6c6cafcc57ae3b19386f6d332dd1c0fca968a17e", + "child_layout_sha256": "90929fe1885c0b22004933c22fa57d1bea09f6c1d5955f540e3afb4a8fd0cf42", + "erasure": { + "calibration": 91155, + "move": 92453, + "pivot": 1255, + "receiver": 498, + "responses": { + "1068": "-1/4", + "1255": "1/4", + "1256": "-1", + "1257": "-2", + "1283": "1/96" + }, + "sender": 480, + "source": 3 + }, + "layout": "f7de788c4a559282d35a9fce42f841a0e8de5a4015db871e718f9245569b0aa7", + "quotient": { + "final": 234, + "initial": 3, + "pivot": 324, + "pivot_coefficient": "1/4", + "proportion": "2", + "receipts": [ + { + "donors": [ + [ + 90283, + "5" + ], + [ + 92933, + "2" + ] + ], + "move": 92917 + }, + { + "donors": [ + [ + 89077, + "5/4" + ], + [ + 40, + "1/8" + ] + ], + "move": 94384 + } + ], + "support": 404, + "via": 337 + }, + "semantic_modules": { + "bank_split.py": "d02590768a74bf326f9c331bcf3e4b514abe8ff8b19fafc8d4e4e2fb0100becc", + "birth_event.py": "b64c955e5183b93cc48fe7a1a6149b242d5e3b0e9abcdd0c64bbb4de9361995a", + "public_split.py": "a69c9128d7bb582c63dc60c1b7fa8eb42eaae9ed95eca4f0b0a9dfd006dbdf0d", + "retained/vendor/network.py": "a9169fd6ad0a13c69cf39bd32649d53256f6d6fa2ed2ceda854f848b64f4c546" + }, + "source": "7660985e0b618cdbee13e4190a4c6d5f91fbdf01a8f7a5186fdde8b980c19b48", + "splits": [ + { + "arrivals": [ + 96070 + ], + "generators": [ + { + "row": 96079, + "slot": 89 + }, + { + "row": 99199, + "slot": 90 + } + ], + "new": 777, + "old": 571, + "removed_paid": [ + 96079, + 99199 + ], + "rotations": [ + { + "public": false, + "rows": [ + [ + 96070, + [ + [ + 96073, + "1" + ], + [ + 96185, + "1" + ] + ] + ], + [ + 96073, + [ + [ + 96070, + "1" + ], + [ + 96073, + "1" + ] + ] + ] + ], + "slots": [ + 96070, + 96073, + 96185 + ] + }, + { + "public": false, + "rows": [ + [ + 96079, + [ + [ + 99199, + "-1" + ] + ] + ], + [ + 99199, + [ + [ + 96079, + "1" + ] + ] + ] + ], + "slots": [ + 96079, + 99199 + ] + } + ], + "sends": [ + 96079, + 99199, + 96271 + ], + "transposed": false + }, + { + "arrivals": [ + -1255, + 90050 + ], + "generators": [ + { + "row": 90613, + "slot": 91 + } + ], + "new": 293, + "old": 2, + "removed_paid": [ + 90065, + 90613 + ], + "rotations": [ + { + "public": true, + "rows": [ + [ + 1254, + [ + [ + 1254, + "-1/4" + ] + ] + ] + ], + "slots": [ + 1254 + ] + }, + { + "public": false, + "rows": [ + [ + 90065, + [ + [ + 90065, + "-4" + ], + [ + 90613, + "1" + ] + ] + ], + [ + 90613, + [ + [ + 90065, + "1" + ] + ] + ] + ], + "slots": [ + 90065, + 90613 + ] + }, + { + "public": false, + "rows": [ + [ + 90050, + [ + [ + 90050, + "-4" + ], + [ + 90072, + "-4" + ], + [ + 90553, + "-1" + ], + [ + 90555, + "2" + ] + ] + ] + ], + "slots": [ + 90050, + 90072, + 90553, + 90555 + ] + } + ], + "sends": [ + 87, + 90065, + 90613 + ], + "transposed": false + }, + { + "arrivals": [ + 88551, + 88572 + ], + "generators": [ + { + "row": 93100, + "slot": 92 + } + ], + "new": 369, + "old": 46, + "removed_paid": [ + 88574, + 93100 + ], + "rotations": [ + { + "public": false, + "rows": [ + [ + 88551, + [ + [ + 88572, + "1" + ] + ] + ], + [ + 88572, + [ + [ + 88551, + "1/2" + ], + [ + 88572, + "-2" + ], + [ + 94602, + "1" + ], + [ + 95170, + "-1/2" + ], + [ + 95546, + "1" + ] + ] + ], + [ + 90281, + [ + [ + 88572, + "1" + ], + [ + 90281, + "1" + ] + ] + ], + [ + 94602, + [ + [ + 88572, + "-2" + ], + [ + 94602, + "1" + ] + ] + ] + ], + "slots": [ + 88551, + 88572, + 90281, + 94602, + 95170, + 95546 + ] + }, + { + "public": false, + "rows": [ + [ + 88574, + [ + [ + 93100, + "1" + ] + ] + ], + [ + 93100, + [ + [ + 88574, + "1/2" + ], + [ + 93100, + "-2" + ] + ] + ] + ], + "slots": [ + 88574, + 93100 + ] + } + ], + "sends": [ + 88574, + 93100, + 97370 + ], + "transposed": false + }, + { + "arrivals": [ + 86 + ], + "generators": [ + { + "row": 43, + "slot": 93 + } + ], + "new": 117, + "old": 594, + "removed_paid": [ + 43, + 86 + ], + "rotations": [ + { + "public": false, + "rows": [ + [ + 86, + [ + [ + 86, + "-5/4" + ] + ] + ] + ], + "slots": [ + 86 + ] + }, + { + "public": false, + "rows": [ + [ + 43, + [ + [ + 43, + "-65/54" + ] + ] + ] + ], + "slots": [ + 43 + ] + }, + { + "public": false, + "rows": [ + [ + 49, + [ + [ + 49, + "-1/2" + ], + [ + 99031, + "1" + ] + ] + ], + [ + 91701, + [ + [ + 49, + "16/81" + ], + [ + 91701, + "1" + ] + ] + ], + [ + 91705, + [ + [ + 49, + "-32/81" + ], + [ + 91705, + "1" + ] + ] + ], + [ + 91707, + [ + [ + 49, + "-32/81" + ], + [ + 91707, + "1" + ] + ] + ], + [ + 91709, + [ + [ + 49, + "16/81" + ], + [ + 91709, + "1" + ] + ] + ], + [ + 95071, + [ + [ + 49, + "16/81" + ], + [ + 95071, + "1" + ] + ] + ], + [ + 98438, + [ + [ + 49, + "8/81" + ], + [ + 98438, + "1" + ] + ] + ], + [ + 99031, + [ + [ + 49, + "130/81" + ], + [ + 99031, + "1" + ] + ] + ], + [ + 99539, + [ + [ + 49, + "-32/81" + ], + [ + 99539, + "1" + ] + ] + ] + ], + "slots": [ + 49, + 91701, + 91705, + 91707, + 91709, + 95071, + 98438, + 99031, + 99539 + ] + } + ], + "sends": [ + 43, + 49 + ], + "transposed": true + }, + { + "arrivals": [ + 20008 + ], + "generators": [], + "new": 127, + "old": 930, + "removed_paid": [ + 20008 + ], + "rotations": [ + { + "public": false, + "rows": [ + [ + 104004, + [ + [ + 20008, + "1" + ], + [ + 104004, + "1" + ] + ] + ] + ], + "slots": [ + 20008, + 104004 + ] + }, + { + "public": false, + "rows": [ + [ + 96081, + [ + [ + 96271, + "1" + ] + ] + ], + [ + 96271, + [ + [ + 96081, + "1" + ], + [ + 96271, + "1" + ] + ] + ] + ], + "slots": [ + 96081, + 96271 + ] + } + ], + "sends": [ + 96081 + ], + "transposed": true + }, + { + "arrivals": [ + 92453, + 92690 + ], + "generators": [ + { + "row": 90109, + "slot": 43 + } + ], + "new": 480, + "old": 493, + "removed_paid": [ + 90109, + 92687 + ], + "rotations": [ + { + "public": false, + "rows": [ + [ + 92453, + [ + [ + 92453, + "2" + ], + [ + 104292, + "2" + ] + ] + ], + [ + 103822, + [ + [ + 92690, + "-1" + ], + [ + 103822, + "1" + ] + ] + ], + [ + 104292, + [ + [ + 92690, + "-5/4" + ], + [ + 104292, + "1" + ] + ] + ] + ], + "slots": [ + 92453, + 92690, + 103822, + 104292 + ] + }, + { + "public": false, + "rows": [ + [ + 90109, + [ + [ + 90109, + "2" + ] + ] + ] + ], + "slots": [ + 90109, + 92687 + ] + }, + { + "public": false, + "rows": [ + [ + 91155, + [ + [ + 91155, + "-2" + ], + [ + 91363, + "1" + ] + ] + ], + [ + 91363, + [ + [ + 91155, + "1/2" + ], + [ + 91363, + "1" + ] + ] + ] + ], + "slots": [ + 91155, + 91363 + ] + } + ], + "sends": [ + 90109, + 92687, + 91155 + ], + "transposed": true + }, + { + "arrivals": [ + 89 + ], + "generators": [ + { + "row": 96182, + "slot": 86 + }, + { + "row": 96071, + "slot": 94 + } + ], + "new": 330, + "old": 571, + "removed_paid": [ + 96071, + 96182 + ], + "rotations": [ + { + "public": false, + "rows": [ + [ + 89, + [ + [ + 89, + "1" + ], + [ + 90, + "1" + ] + ] + ], + [ + 90, + [ + [ + 89, + "1" + ] + ] + ] + ], + "slots": [ + 89, + 90 + ] + }, + { + "public": false, + "rows": [ + [ + 96071, + [ + [ + 96182, + "-1" + ] + ] + ], + [ + 96182, + [ + [ + 96071, + "1" + ] + ] + ] + ], + "slots": [ + 96071, + 96182 + ] + } + ], + "sends": [ + 96071, + 96182, + 96185 + ], + "transposed": true + } + ], + "subdivide": { + "move": 96070, + "new": 20007, + "original": [ + 3, + 777 + ], + "through": 1048 + } +} diff --git a/research/p104-live-relative-gain/HELPER-SPLITS-RECEIPT.json b/research/p104-live-relative-gain/HELPER-SPLITS-RECEIPT.json new file mode 100644 index 0000000000..f35d9f85be --- /dev/null +++ b/research/p104-live-relative-gain/HELPER-SPLITS-RECEIPT.json @@ -0,0 +1,54 @@ +{ + "splits": 2, + "moves": 5676, + "public": 1291, + "new_word": "a7a98bd3cd1044011ab62b103cb363d4ea6924f01340745e5a895ef650de953c", + "crossing_e14": [ + 389749436514, + 389749436515 + ], + "trial": "0.00391884648", + "trial_margin": [ + "-21.649081521690097244332831920", + "-21.649081521690097244332831919" + ], + "forward_terms": 25038131, + "adjoint_terms": 88780337, + "minimum_product_grid": "154113755636630124932500335624192000", + "literal_peak_bits": 57, + "paid": { + "1": 183408, + "2": 38016, + "3": 23040, + "4": 10896, + "5": 15024, + "6": 2016, + "7": 432, + "8": 1344, + "16": 1248, + "24": 1248, + "32": 1248, + "40": 1248, + "48": 1248, + "56": 1248 + }, + "productive": { + "1": 1008, + "2": 432, + "3": 480, + "4": 11568, + "5": 1584, + "6": 48, + "7": 672, + "8": 1584, + "9": 25872, + "17": 1248, + "25": 1248, + "33": 1248, + "41": 1248, + "49": 1248, + "57": 1248, + "65": 1248, + "129": 624 + } +} diff --git a/research/p104-live-relative-gain/HELPER-SPLITS.json b/research/p104-live-relative-gain/HELPER-SPLITS.json new file mode 100644 index 0000000000..a6225bf11b --- /dev/null +++ b/research/p104-live-relative-gain/HELPER-SPLITS.json @@ -0,0 +1,156 @@ +{ + "parent": "9f055ab54604b1a56688138ef80c854a53f53d2fc3cab420b823ae58a92c10d3", + "word": "a7a98bd3cd1044011ab62b103cb363d4ea6924f01340745e5a895ef650de953c", + "layout": "0ce3f9e383fc4bfdd22612b9e34fc9759d97204215937b82d23aec2cedd9b8ee", + "splits": [ + { + "role": 233, + "chart": 750, + "covector": [ + [3, "-1"], + [233, "1"], + [266, "2/3"], + [274, "-5/8"], + [299, "1"], + [308, "-10"], + [322, "2"], + [350, "3/2"], + [362, "-4"], + [364, "4"], + [402, "-1"], + [411, "1/3"], + [419, "2"], + [421, "5/4"], + [432, "4"], + [433, "2"], + [439, "-4"], + [440, "4"], + [441, "47/24"], + [450, "-1/12"], + [457, "-1"], + [459, "1/3"], + [462, "-2"], + [464, "3/2"], + [472, "-23/12"], + [482, "1"], + [488, "-2/3"], + [492, "1"], + [495, "-2/3"], + [501, "-1/2"], + [502, "3/4"], + [547, "3"], + [579, "1/3"], + [630, "-3"], + [645, "-3/4"], + [679, "1/2"], + [890, "1/2"], + [921, "1"], + [1025, "2"], + [1052, "2"], + [1064, "3"], + [1092, "-13/24"], + [1094, "2/3"], + [1115, "-17/4"], + [1118, "2/3"], + [1122, "-13/16"], + [1148, "-2"], + [1186, "-3/2"], + [1191, "21/2"], + [1224, "-2"], + [1227, "-2"], + [1236, "-2"] + ], + "direction": [ + [233, "-1/2"], + [894, "1/2"] + ], + "read": [ + [99004, "1"] + ], + "inject": [ + [105, "-1/2"], + [97761, "1"] + ] + }, + { + "role": 205, + "chart": 34, + "covector": [ + [205, "1"], + [234, "-1/4"], + [240, "2"], + [270, "1"], + [274, "7/24"], + [294, "4/3"], + [299, "1/6"], + [304, "-1/6"], + [308, "-1/3"], + [322, "-1/3"], + [328, "-2/3"], + [330, "-1/3"], + [335, "1/3"], + [350, "5/6"], + [358, "1/6"], + [375, "-4/3"], + [387, "-2/3"], + [394, "-1"], + [401, "4/3"], + [402, "-61/45"], + [410, "-1/6"], + [419, "-1"], + [421, "61/180"], + [432, "-2"], + [433, "2/3"], + [438, "1/3"], + [441, "-11/24"], + [450, "-43/12"], + [457, "2/3"], + [462, "-4/3"], + [464, "5/6"], + [472, "9/4"], + [478, "1/6"], + [482, "4/3"], + [485, "-1/6"], + [490, "1/3"], + [502, "-17/12"], + [503, "-1"], + [505, "4/3"], + [547, "5/3"], + [630, "-17/3"], + [634, "5/6"], + [645, "-5/12"], + [679, "-1/6"], + [890, "1/3"], + [913, "-4"], + [921, "1/3"], + [1003, "2/5"], + [1025, "-2/3"], + [1027, "-1"], + [1029, "-1/3"], + [1043, "11/3"], + [1049, "-4/3"], + [1052, "-4/3"], + [1064, "5/3"], + [1092, "1/24"], + [1115, "-11/12"], + [1122, "1/16"], + [1142, "-1"], + [1186, "1"], + [1191, "5/2"], + [1224, "2/3"], + [1227, "2/3"], + [1235, "-5/3"] + ], + "direction": [ + [205, "-1"] + ], + "read": [ + [89027, "1"] + ], + "inject": [ + [95, "-1"], + [94844, "1"] + ] + } + ] +} diff --git a/research/p104-live-relative-gain/LAYOUT.json.gz b/research/p104-live-relative-gain/LAYOUT.json.gz new file mode 100644 index 0000000000..3ee3637e63 Binary files /dev/null and b/research/p104-live-relative-gain/LAYOUT.json.gz differ diff --git a/research/p104-live-relative-gain/LICENSE b/research/p104-live-relative-gain/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/research/p104-live-relative-gain/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-live-relative-gain/PARENT-NOTICE b/research/p104-live-relative-gain/PARENT-NOTICE new file mode 100644 index 0000000000..fe51894a1a --- /dev/null +++ b/research/p104-live-relative-gain/PARENT-NOTICE @@ -0,0 +1,31 @@ +Mixed paid cutoffs for the P104 ordinary BIT supplier + +Prepared for Clear1nsight with substantial OpenAI Codex assistance. The +new schedule, directed comparison, occurrence controls, and documentation +are offered under Apache-2.0. + +verify.py adapts the Apache-2.0 verifiers from Dugongue's PR #7831 +(2d1fb9c878ae1e292cb918de40fa8e4f7fa7f75e) and Rohan Arun's PR #7835 +(43007c979859fa84ccc3a3509ccacc9620d181fa). Rohan Arun submitted #7835 +through the original X request at +https://x.com/RohanArun/status/2123655584797143516. The source manifest +retains the published #7835 NOTICE. + +Retained predecessor NOTICE from the grade-14 package follows. + +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-live-relative-gain/RATIONAL-RECEIPT.json b/research/p104-live-relative-gain/RATIONAL-RECEIPT.json new file mode 100644 index 0000000000..2687233d8d --- /dev/null +++ b/research/p104-live-relative-gain/RATIONAL-RECEIPT.json @@ -0,0 +1,51 @@ +{ + "public": 1289, + "adjoint_terms": 28670764, + "word": "7e74ad15ba7564ad2207acac6c6cafcc57ae3b19386f6d332dd1c0fca968a17e", + "paid": { + "1": 184368, + "2": 38208, + "3": 23232, + "4": 10992, + "5": 15216, + "6": 1872, + "7": 144, + "8": 1296, + "16": 1248, + "24": 1248, + "32": 1248, + "40": 1248, + "48": 1248, + "56": 1248 + }, + "productive": { + "1": 960, + "2": 432, + "3": 432, + "4": 11568, + "5": 1584, + "7": 672, + "8": 1536, + "9": 25968, + "17": 1248, + "25": 1248, + "33": 1248, + "41": 1248, + "49": 1248, + "57": 1248, + "65": 1248, + "129": 624 + }, + "crossing": [ + "388332156403/100000000000000", + "97083039101/25000000000000" + ], + "numerators_at_1e14": [ + 388332156403, + 388332156404 + ], + "target_margin": [ + "-36.1508758544792045", + "-36.1508758544792044" + ] +} diff --git a/research/p104-live-relative-gain/README.md b/research/p104-live-relative-gain/README.md new file mode 100644 index 0000000000..4dfde1acb8 --- /dev/null +++ b/research/p104-live-relative-gain/README.md @@ -0,0 +1,45 @@ +# Conditional κ ≥ 0.00389011507650 for general integer multiplication + +The two changed circuits give **κ ≥ 0.00389011507650** under the five assumptions in the source framework. The power-20 version of PR 8026 gives 0.00387992804541. The relative gain against that version is 0.26255722%. The selected record on main has its own review. [Finite receipt and comparison](APPLICATION.json) · [Power-20 comparison](https://github.com/CrocSwap/integer-mult-bounds/blob/156137f70e7819cca8d86a1925d4c2873c77552e/research/bit-451-carrier-cover/tensor/MEAN.md) · [Selected record](../../certificates/selected-result.json) + +| Checked quantity | Binary | Rational | +| --- | ---: | ---: | +| Native calls in the full invoice | 36 | 48 | +| Independent public fields per call | 630 | 1,291 | +| Paid transfers per call | 2,803 | 5,674 | +| Lower endpoint of the raw crossing | 0.003890115286594 | 0.00389848144654 | +| Upper endpoint of the raw crossing | 0.003890115286595 | 0.00389848144655 | + +## Binary construction + +The binary circuit uses the same 111 physical main port quartets as the iterated-return supplier. Each input pair has the scalar map (x, y) ↦ (x, y+x). The other 408 inputs have separate identity outputs. The construction first routes the 111 data inputs to their receivers. At each chart, independent input columns can fill unused directions of the outgoing coefficient matrix. The rest of the incoming independent space drains to the terminal bank. Choose a basis for these spaces, then carry each new input and its eventual return in the word. This completes the data routes to a map on arbitrary independent public inputs. [Literal word](BINARY-CANDIDATE.json.gz) + +The choice of basis changes where an individual helper can return. For a terminal change, a combination of deliveries from one chart affects an unprotected helper direction. Rotate the remaining deliveries to remove their component in that direction. A linear form at an earlier bank distinguishes the affected helper. Return the form there and rotate its independent source coordinates. If the form needs an additional delivery, charge the delivery between the actual charts. Two further changes use receipts already present at the input charts for main fields 19 and 97. Their helper terms cancel in the main outputs and permit shorter returns. The public helper returns comprise 17 at grade four and 391 at grade eight. The complete binary word contains 29,301 XOR additions, 3,433 initializations, 3,433 clears, 2,803 paid moves and 630 swaps. Its forward and reverse maps each check all 396,900 scalar coefficients. The omitted-clear control must fail. + +The paired caller retains 36 native calls. Its literal readback accounts for the root targets, 32 idles and four queries across 111 ports. The 768-factor finite compiler starts at the admitted ordinary seed of 0.00385248. It charges discarded targets, checks the uniform and delayed-cover losses, then runs four finite bootstrap stages. It admits 0.003890115076583 at the ordinary BIT interface. [Finite counts, histograms and cap](APPLICATION.json) · [Predecessor finite compiler](https://github.com/CrocSwap/integer-mult-bounds/blob/89a67c404226d51028e135de2b9169e9020d57af/research/p104-iterated-returns/binary/finite.py) + +## Rational consumer + +The rational circuit uses the four-term quotient, two independent helper splits and three further changes of bank. The first moves a group of scalar operations from chart 746 to chart 916. The next two factor the local maps at charts 267 and 396 through existing receipts. They remove transfers 90901 and 97223. A replay of the three bank operations gives the same word as the separate journal of 1,162 coefficient edits. [Bank operations](BANK-FACTORS-EVENTS.json) · [Coefficient journal](BANK-FACTORS.json.gz) + +The rational word has 1,291 independent fields. Its 48-call invoice includes all caller work. The smallest common product grid is 154113755636630124932500335624192000. The basis replay includes 25,146,238 products. The bounded scalar compiler lowers 29,794 occurrences with literals wider than 24 bits. Its independent reader executes the lowered programs in four signed components and checks dirty register retirement, ordinary work and the depth bound. [Rational construction](BIDIRECTIONAL.md) · [Forward and adjoint counts](BANK-FACTORS-RECEIPT.json) · [Grid, fixture and ordinary work](APPLICATION.json) + +The compiler passes the measured ordinary BIT cap to the rational consumer. It checks 54 strict and four functional inequalities. The smallest outer margin is 10⁻¹⁵. The five inherited hypotheses concern the native operators on all columns, owned erasure, the all-size compiler, tape precision and analytic recovery. The finite replays check the particular circuits and their interfaces. Independent scientific review of this changed application remains open. [Inherited source and scope](https://github.com/CrocSwap/integer-mult-bounds/tree/89a67c404226d51028e135de2b9169e9020d57af/research/p104-iterated-returns/continuation) + +## Reproduce + +Run from a checkout with CPython 3.12 and the standard library. + +```sh +python3.12 -I -B research/p104-live-relative-gain/verify_application.py +``` + +The program extracts 134 source files into a temporary directory. Seven files come from the pinned PR 7786 package. Its original source lock checks the SHA-256 and Git blob of each of the other 127 files. The binary compiler rereads the proposed literal word. The rational compiler rebuilds the proposed program from its journals. The independent reader then rebuilds the grids, signed costs, ordinary costs and outer conditions. Use `--out FILE` to retain the full physical receipt. [Replay](verify_application.py) · [Offline sources with retained notices](APPLICATION-SOURCES.tar.gz) · [Source lock](https://github.com/CrocSwap/integer-mult-bounds/blob/89a67c404226d51028e135de2b9169e9020d57af/research/p104-iterated-returns/SOURCE-LOCK.json) + +## Open next questions + +At κ = 0.00391884648, the 36-call binary invoice has a deficit of about 11.035 and the 48-call rational invoice has a deficit of about 20.64. A cheaper paid delivery or a new independent split must preserve each primary and auxiliary output. Can a change to the internal data routes make another low-grade helper available before a paid terminal delivery? + +Ali Romman prepared the new circuits, composition and replay with substantial OpenAI Codex assistance. The binary routes start from the punctured 111-port E8 construction. The literal serializer comes from the source retained in PR 7912. [E8 construction](../../research/e8-bit-p111-tuned/README.md) · [Serializer source package](https://github.com/CrocSwap/integer-mult-bounds/pull/7912) + +Clear1nsight supplied the pinned iterated-return programs and independent scalar audit. The project also credits Jerry Chen, DreamingOfClouds, zxv, SYLforge, Rohan Arun, Cinna Davis, Douglas Colkitt and the predecessors named in the retained notices. [Attribution](PARENT-NOTICE) diff --git a/research/p104-live-relative-gain/SOURCES.json b/research/p104-live-relative-gain/SOURCES.json new file mode 100644 index 0000000000..8e3d960fb1 --- /dev/null +++ b/research/p104-live-relative-gain/SOURCES.json @@ -0,0 +1,130 @@ +{ + "schema_version": 1, + "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "75d77b328ea02ded535e7f23aee5b1e55d0bb1a8", + "sha256": "154c3d30455d778fd3343b6b4851f0fa4665f0f7625b0adb3675e2bafbbf6bf1" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "3404fbdd5e7529a0674eef26114b5071e4586cec", + "sha256": "ead6cdc9d0af6d58e8a49744d8ec8c7c15e13d2ba93c276c434bcf9b51b93a81" + }, + { + "path": "research/p104-chart306-chain/DOUBLE-APPLICATION.json", + "usage": "provenance", + "pin": "head:87fbf4f7b35b0f18ab12b5767775a9a424cf0b15:research/p104-chart306-chain/DOUBLE-APPLICATION.json", + "git_blob": "714f7b48a2a70bb2cc9f7cd4206b2a8701bbb062", + "sha256": "1b2d87e93ae023f5ffd464546af53281b6cb4963dfd76ae4742e0a5540b752fa" + }, + { + "path": "research/p104-chart306-chain/DOUBLE-CANDIDATE.json.gz", + "usage": "provenance", + "pin": "head:87fbf4f7b35b0f18ab12b5767775a9a424cf0b15:research/p104-chart306-chain/DOUBLE-CANDIDATE.json.gz", + "git_blob": "51ac72e499cdf6efac62cbd34a9f217d6d135b14", + "sha256": "1b1b3294e86979f1f41076fb056f3c0a08ace6df7bf80f2886bc579a22962f4b" + }, + { + "path": "research/p104-dual-supplier-lift/complex/bank_split.py", + "usage": "provenance", + "pin": "head:4f7c67ae387cc91580f469aeda4d508b372b9ec1:research/p104-dual-supplier-lift/complex/bank_split.py", + "git_blob": "bec6e66421694dd4eef08d71d86693dc36fc3a24", + "sha256": "d02590768a74bf326f9c331bcf3e4b514abe8ff8b19fafc8d4e4e2fb0100becc" + }, + { + "path": "research/p104-dual-supplier-lift/complex/birth_event.py", + "usage": "provenance", + "pin": "head:4f7c67ae387cc91580f469aeda4d508b372b9ec1:research/p104-dual-supplier-lift/complex/birth_event.py", + "git_blob": "7ea89cbb8e12aa780afb8bea5417b7927800c207", + "sha256": "b64c955e5183b93cc48fe7a1a6149b242d5e3b0e9abcdd0c64bbb4de9361995a" + }, + { + "path": "research/p104-dual-supplier-lift/complex/public_split.py", + "usage": "provenance", + "pin": "head:4f7c67ae387cc91580f469aeda4d508b372b9ec1:research/p104-dual-supplier-lift/complex/public_split.py", + "git_blob": "9e2099c90548e718e2e9ed53b3a0069a39f7fad2", + "sha256": "a69c9128d7bb582c63dc60c1b7fa8eb42eaae9ed95eca4f0b0a9dfd006dbdf0d" + }, + { + "path": "research/p104-dual-supplier-lift/complex/retained/vendor/network.py", + "usage": "provenance", + "pin": "head:4f7c67ae387cc91580f469aeda4d508b372b9ec1:research/p104-dual-supplier-lift/complex/retained/vendor/network.py", + "git_blob": "0ebc1925c40cc6c11af59e405221ea51801a6e92", + "sha256": "a9169fd6ad0a13c69cf39bd32649d53256f6d6fa2ed2ceda854f848b64f4c546" + }, + { + "path": "research/p104-iterated-returns/continuation/LAYOUT.json.gz", + "usage": "provenance", + "pin": "head:89a67c404226d51028e135de2b9169e9020d57af:research/p104-iterated-returns/continuation/LAYOUT.json.gz", + "git_blob": "35af1c9e36953cd223eadfca734e122792703de8", + "sha256": "b0f3ebc5710e469f3e8fc5ce159cbba048b563944182b50993431ef94f4fedbf" + }, + { + "path": "research/p104-mixed-rank-supplier/NOTICE", + "usage": "provenance", + "pin": "head:87fbf4f7b35b0f18ab12b5767775a9a424cf0b15:research/p104-mixed-rank-supplier/NOTICE", + "git_blob": "fe51894a1a630c6feee4b13da2a0499e41ee6edf", + "sha256": "b213998c8dae6d88e4a1f0fd17c81dd78c31ef35bc9460fa16ca692326f1a02b" + }, + { + "path": "research/p104-iterated-returns/binary/WORD.json.gz", + "usage": "provenance", + "pin": "head:89a67c404226d51028e135de2b9169e9020d57af:research/p104-iterated-returns/binary/WORD.json.gz", + "git_blob": "efb2e9d1c3caec25bea36803ca6994997e3256b0", + "sha256": "d28f0d28d9d87d5fe57b8ef19e12faf98014f0bbef781987ce22daaa82f21cb9" + }, + { + "path": "research/p104-iterated-returns/SOURCE-LOCK.json", + "usage": "provenance", + "pin": "head:89a67c404226d51028e135de2b9169e9020d57af:research/p104-iterated-returns/SOURCE-LOCK.json", + "git_blob": "c4df7913475708c11784e16932d55ec9569c47cd", + "sha256": "b46b919292e1a1907345056b6925f5f1400d45650e2f0f610779a07163bb64ee" + }, + { + "path": "research/p104-iterated-returns/prepare_sources.py", + "usage": "provenance", + "pin": "head:89a67c404226d51028e135de2b9169e9020d57af:research/p104-iterated-returns/prepare_sources.py", + "git_blob": "0511286ba3b78fbc710612850cb011f4ee6ebf16", + "sha256": "c70c3be6e48717c6a9a561ef2294d23437a60d7dbcbbddc1305a6fc54001bb3d" + }, + { + "path": "research/p104-iterated-returns/binary/finite.py", + "usage": "provenance", + "pin": "head:89a67c404226d51028e135de2b9169e9020d57af:research/p104-iterated-returns/binary/finite.py", + "git_blob": "f4e8dff455fd8f574e087327b56743546f97b9bc", + "sha256": "c780cea060f4a9efef064b239636162a7e8e84e40369abc1a1c4679dfbeb3041" + }, + { + "path": "research/p104-iterated-returns/continuation/qualify.py", + "usage": "provenance", + "pin": "head:89a67c404226d51028e135de2b9169e9020d57af:research/p104-iterated-returns/continuation/qualify.py", + "git_blob": "ddc62cc718cc22ec39e195d707187bb7f6604e09", + "sha256": "fdf559fbe15f52c2b31f2947712a46aa6b4c93f211ea9a0b1f05b07d69664227" + }, + { + "path": "research/p104-iterated-returns/continuation/compiler.py", + "usage": "provenance", + "pin": "head:89a67c404226d51028e135de2b9169e9020d57af:research/p104-iterated-returns/continuation/compiler.py", + "git_blob": "0e0580ae4a977010ed30a4ba259c2f0ad20ab33f", + "sha256": "c160563bc51f984224bbb0a00f9e69b276fa618a83591c00f38fb9fa8d958d9c" + }, + { + "path": "research/p104-iterated-returns/continuation/audit_expanded.py", + "usage": "provenance", + "pin": "head:89a67c404226d51028e135de2b9169e9020d57af:research/p104-iterated-returns/continuation/audit_expanded.py", + "git_blob": "6feff832d51b1909d6d73dcff6527db7f6c9ad54", + "sha256": "0316153c1822724e1a3d08066aec9601a891073b0209954eaf302ffa014bf5ac" + }, + { + "path": "research/p104-iterated-returns/evidence/application.json", + "usage": "provenance", + "pin": "head:89a67c404226d51028e135de2b9169e9020d57af:research/p104-iterated-returns/evidence/application.json", + "git_blob": "0ca5af670cdea99c002ba992d92b2b8647258244", + "sha256": "88486d49f2ba1fc0e6c9f4a7402c82e91c44026cf90cd1387d1e5c45cf5e88d3" + } + ] +} diff --git a/research/p104-live-relative-gain/TASK.json b/research/p104-live-relative-gain/TASK.json new file mode 100644 index 0000000000..0624e56e38 --- /dev/null +++ b/research/p104-live-relative-gain/TASK.json @@ -0,0 +1,123 @@ +{ + "schema_version": 1, + "task_id": "p104-side-correction", + "priority_revision": 8, + "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "original_card": { + "id": "p104-side-correction", + "question": "Can joint helper bases and a legal causal split improve the complete P104 productive/paid invoice?", + "starting_points": [ + "docs/research/current-priorities.md", + "docs/research/research-family-status.md", + "certificates/selected-result.json", + "docs/research/pr-intake-evidence/pr5599-completion/PROOF-REVIEW.md", + "research/p104-helper-subspace-splits/README.md", + "research/dyadic-helper-channel-capacity/README.md" + ], + "methods": [ + "Construct and independently check one source-bound instance of the stated first experiment.", + "Seek an exact counterexample or target-specific complete-budget obstruction to that same proposed change." + ], + "acceptance_gate": "An exact arbitrary-input identity, source/target frame availability and restoration at the chosen cut, plus the complete channel+correction+idle/hosting bill or an explicit favorable bound. The native channel alone is not a supplier. A scoped local result may be retained without a complete supplier. Expanding it into further construction rounds requires the family-level budget and obligation gate in research-family-status.md; an optimistic passing relaxation alone is not acceptance.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_selected_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Read revision 8, the selected review and live exact-source handoffs. Then follow this card's bounded first_experiment.", + "scope": "Source-bound orientation only, not a supplier replay or theorem proof." + }, + "first_experiment": "Start with the selected #5599 emitted word and review pending #5718 distinct input/output bases plus #5717/#5719 coverage before claiming work. Pick one uncovered source word, helper group and cut region. Prove the arbitrary-input relation and legal entry/exit corrections, then compare full target and paid profiles. Reject if completion, owned lifetimes or consumer costs repay the gain. A static pairing rank alone is not a physical split.", + "bottleneck_link": "Judge the actual current supplier contract and complete signed target/paid bill; frozen-profile ceilings require an applicability proof.", + "allowed_variations": [ + "One exact source head, helper/cut region or quantified proposition and changed hypothesis; check live handoffs first. Different seeds are not different scopes." + ], + "scope_change_triggers": [ + "Changing source head, helper/cut domain, operation alphabet or caller boundary without recording the new scope.", + "Treating an archived proposal or local numerical pass as complete supplier admission." + ], + "overlap_terms": [ + "P104", + "helper basis", + "helper split", + "5718", + "dyadic capacity" + ], + "existing_checks": [ + { + "scope": "PR #4133: literal-slot defect", + "evidence": "research/p104-literal-slot-defect/README.md", + "remaining": "Independently validate the stated scope or change its producer/consumer premise and pay the complete boundary.", + "status": "author-checked", + "source_commit": "88666f1dee93fbd85b31fd5d6f91a219e111b5f4", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "PR #4136: uniform commutation gap", + "evidence": "research/p104-uniform-commutation-gap/README.md", + "remaining": "Independently validate the stated scope or change its producer/consumer premise and pay the complete boundary.", + "status": "author-checked", + "source_commit": "281ce601a8be9db470de630759179c23e1dfaa88", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "PR #4140: uniform encoding gap", + "evidence": "research/p104-uniform-encoding-gap/README.md", + "remaining": "Independently validate the stated scope or change its producer/consumer premise and pay the complete boundary.", + "status": "author-checked", + "source_commit": "de25c6525aa866962309df5d107b32d55e6e5628", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "PR #4153: source-chart shortcut exhausts its optimistic allowance", + "evidence": "research/p104-source-chart-shortcut/README.md", + "remaining": "Independently validate the stated scope or change its producer/consumer premise and pay the complete boundary.", + "status": "author-checked", + "source_commit": "9123241fea53df77e51ffe30d9aca1625d4bf3a8", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "PR #4154: fiber-tag seam mismatch", + "evidence": "research/p104-fiber-tag-seam/README.md", + "remaining": "Independently validate the stated scope or change its producer/consumer premise and pay the complete boundary.", + "status": "author-checked", + "source_commit": "4ffcdaee5d6255a9cea1fe53a5424435068089d0", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "Selected PR5599: complete helper-subspace construction and independent caller replay; five framework assumptions remain.", + "evidence": "docs/research/pr-intake-evidence/pr5599-completion/PROOF-REVIEW.md", + "remaining": "The next experiment must identify uncovered source-specific work. Successor archive intake does not transfer this admission.", + "status": "reviewed", + "source_commit": "09dd0965711ca7eeb169057a420abab1c9052137", + "selected_record_sha256": "2a0220e866417774606e0f991e41b9c1d26b1f43b97857238cf478dbc7d330b5" + } + ] + }, + "scope_status": "refined", + "actual_scope": "Build new rational and binary native circuits. Verify their independent public fields, both complete caller bills, the finite ordinary BIT cap and the resulting general multiplication bound.", + "scope_change_reason": "The latest mixed-rank graph on the live queue supplies the concrete bank and the matching closed caller.", + "bottleneck_link": "The 36-call ordinary binary cap limits the complete application with these two native circuits.", + "budget_minutes": 720, + "stop_rule": "Report the finite conditional application after the registered replay and a fresh live comparison.", + "outcome": "completed", + "evidence": "EVENTS.json and AUDIT.json bind the 5700-transfer parent. The BIDIRECTIONAL and BIDIRECTIONAL-QUOTIENT witnesses rebuild the 5680- and 5676-transfer circuits. Each has an independent receipt for both scalar replays and the 48-call cost. HELPER-SPLITS.json adds two independent fields. BANK-FACTORS-EVENTS.json and the separate coefficient journal give the same 5674-transfer program. BINARY-CANDIDATE.json.gz and APPLICATION.json give the two changed suppliers and the finite conditional application.", + "author": "Ali Romman", + "ai_assistance": "Substantial OpenAI Codex assistance.", + "open_questions": [ + { + "question": "Can another pair of forward and adjoint signals share one paid transfer?", + "why_it_matters": "The 48-call circuit still has a negative signed margin at the trial.", + "first_step": "Use the 21 chart pairs in BIDIRECTIONAL-RECEIPT.json to reconstruct the changed graph. Check all reader dependencies when testing a new pair.", + "blocked_by": "A new exact delivery and restoration for all independent inputs." + }, + { + "question": "Can a changed binary word clear the same trial?", + "why_it_matters": "The ordinary binary supplier also limits the complete result.", + "first_step": "Recompute the 36-call invoice against the trial.", + "blocked_by": "A qualifying binary word and full compiler replay." + } + ] +} diff --git a/research/p104-live-relative-gain/VERIFY.json b/research/p104-live-relative-gain/VERIFY.json new file mode 100644 index 0000000000..036509e458 --- /dev/null +++ b/research/p104-live-relative-gain/VERIFY.json @@ -0,0 +1,39 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify_component.py" + ], + "timeout_seconds": 120, + "checks": "Check the signed coefficients on every independent input, the chart of each donor, both signs of the 48-call crossing and the complete deficit at the trial." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify_split_helpers.py" + ], + "timeout_seconds": 360, + "checks": "Rebuild both bidirectional circuits and the two helper splits. Apply three final bank changes. Check all four rational maps in both directions, their product grids, the 48-call crossing signs and trial margins." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify_application.py" + ], + "timeout_seconds": 420, + "checks": "Rebuild the 36-call binary and 48-call rational suppliers. Check the finite ordinary cap, dirty-bank program, integer product grid, signed invoices, and all 58 outer conditions." + } + ] +} diff --git a/research/p104-live-relative-gain/WORD.json.gz b/research/p104-live-relative-gain/WORD.json.gz new file mode 100644 index 0000000000..31786df96c Binary files /dev/null and b/research/p104-live-relative-gain/WORD.json.gz differ diff --git a/research/p104-live-relative-gain/replay.py b/research/p104-live-relative-gain/replay.py new file mode 100644 index 0000000000..129817a60c --- /dev/null +++ b/research/p104-live-relative-gain/replay.py @@ -0,0 +1,267 @@ +"""Rebuild seven chart splits, one new helper and three removed transfers. Use Python 3.10 or later.""" +from argparse import ArgumentParser +from collections import Counter +from fractions import Fraction +from hashlib import sha256 +from math import gcd, lcm +from pathlib import Path +import gzip +import json +import sys + + +def encoded(value): + return json.dumps(value, sort_keys=True, separators=(",", ":")).encode() + + +def read(path): + raw = path.read_bytes() + return json.loads(gzip.decompress(raw) if raw[:2] == b"\x1f\x8b" else raw) + + +def require(condition, detail): + if not condition: + raise ValueError(detail) + + +def expected(layout, count, grid): + out = [{r: grid} for r in range(count)] + hosted = layout["hosted"] + for p, x in enumerate(layout["live"]): + y = x + 112 + if p in hosted["Dports"]: + out[y][x] = grid + else: + require(grid % 2 == 0, "odd main grid") + out[x][y] = -grid + out[y] = {x: grid // 2, y: grid // 2} + for x, y in zip(hosted["X2"], hosted["Y2"], strict=True): + out[x][y] = -grid + return out + + +def verify_integer_grid(net, graph, layout): + n = len(net.initial) + divisors = {~r: 1 for r in range(n)} + grid = 1 + peak_literal = 0 + for k in graph["schedule"]: + row_grid = 1 + for j, q in net.forms[k].items(): + peak_literal = max(peak_literal, q.numerator.bit_length(), q.denominator.bit_length()) + row_grid = lcm(row_grid, divisors[j] * q.denominator) + divisors[k] = row_grid + grid = lcm(grid, row_grid) + + ends = expected(layout, n, grid) + scalar = {~r: {r: grid} for r in range(n)} + checked = Counter() + common = grid + for k in graph["schedule"]: + row = {} + for j, q in net.forms[k].items(): + for c, value in scalar[j].items(): + term, remainder = divmod(q.numerator * value, q.denominator) + require(remainder == 0, f"inexact division at row {k}, donor {j}, column {c}") + common = gcd(common, term) + result = row.get(c, 0) + term + if result: + row[c] = result + else: + row.pop(c, None) + checked[q.denominator] += 1 + if k in net.moves: + scalar[k] = row + else: + require(row == ends[k-net.first_output], f"public output {k-net.first_output}") + return dict(path_grid=grid, minimum_product_grid=grid // common, literal_peak_bits=peak_literal, + products=sum(checked.values()), nontrivial_divisions=sum(checked.values())-checked[1], + by_denominator=dict(sorted(checked.items())), public_rows=n) + + +def add(row, donor, factor): + for index, value in donor.items(): + new = row.get(index, 0) + value * factor + if new: + row[index] = new + else: + row.pop(index, None) + + +def input_forms(net, labels): + needed = set(labels) + stack = list(needed) + while stack: + node = stack.pop() + for donor in net.forms[node]: + if donor >= 0 and donor not in needed: + needed.add(donor) + stack.append(donor) + signals = {} + for node in net.schedule(): + if node in needed: + row = {} + for donor, factor in net.forms[node].items(): + add(row, {donor: 1} if donor < 0 else signals[donor], factor) + signals[node] = row + return signals + + +def erase_return(net, event): + from network import Network + + move = event["move"] + calibration = event["calibration"] + pivot = event["pivot"] + receiver = event["receiver"] + sender = event["sender"] + initial = event["source"] + first = net.first_output + require(net.moves[move] == (sender, receiver), "erased move") + require(net.moves[calibration][1] == sender, "calibration receipt") + consumers = {k - first: row[move] for k, row in net.forms.items() if move in row} + require(consumers == {int(k): Fraction(v) for k, v in event["responses"].items()}, + "erased consumers") + require(all(net.initial[r] == initial and net.final[r] == receiver for r in consumers), + "helper endpoints") + form = input_forms(net, [calibration])[calibration] + require(all(net.initial[~i] == initial for i in form), "one calibration source") + pairing = sum(form.get(~r, 0) * value for r, value in consumers.items()) + require(pairing == 1, "calibration pairing") + lift = {i: -q / pairing for i, q in form.items() if i != ~pivot} + lift[~pivot] = 1 / pairing + rows = {} + for node, old in net.forms.items(): + if node == move: + continue + r = node - first + if r == pivot: + row = {calibration: 1} + else: + row = dict(old) + if r in consumers: + add(row, net.forms[first + pivot], -consumers[r] / consumers[pivot]) + require(move not in row, "erasure cancellation") + factor = sum(row.get(~r, 0) * q for r, q in consumers.items()) + row.pop(~pivot, None) + add(row, lift, factor) + rows[node] = row + moves = dict(net.moves) + del moves[move] + final = list(net.final) + final[pivot] = sender + return Network(first, list(net.initial), final, moves, rows) + + +def restrict_source(net, layout, event): + from network import Network + + first = net.first_output + pivot = event["pivot"] + last = len(net.initial) - 1 + require(last == 1289 and net.initial[pivot] == event["initial"] and net.final[pivot] == event["final"], + "old helper stock") + first_leg, second_leg = (entry["move"] for entry in event["receipts"]) + require(net.moves[first_leg] == (event["initial"], event["via"]) and + net.moves[second_leg] == (event["via"], event["final"]), "paid chain") + local = {entry["move"]: {i: Fraction(q) for i, q in entry["donors"]} + for entry in event["receipts"]} + values = input_forms(net, set(local) | {i for row in local.values() for i in row}) + relations = {} + for node, replacement in local.items(): + row = dict(values[node]) + for donor, amount in replacement.items(): + add(row, values[donor], -amount) + relations[node] = row + source = relations[first_leg] + require(source == {j: Fraction(event["proportion"]) * value for j, value in relations[second_leg].items()}, + "proportional source relations") + require(len(source) == event["support"] and all(net.initial[~j] == event["initial"] for j in source), + "one source chart") + divisor = source[~pivot] + require(divisor == Fraction(event["pivot_coefficient"]), "source pivot") + rewrites = dict(local) + rewrites[~pivot] = {j: -v / divisor for j, v in source.items() if j != ~pivot} + rows = {} + for node, row in net.forms.items(): + if node in local or node == first + pivot: + continue + out = {j: v for j, v in row.items() if j not in rewrites} + for donor in row.keys() & rewrites.keys(): + add(out, rewrites[donor], row[donor]) + if ~last in out: + out[~pivot] = out.pop(~last) + rows[first + pivot if node == first + last else node] = out + + def pack(sequence): + result = list(sequence[:-1]) + result[pivot] = sequence[last] + return result + + moves = {k: chart for k, chart in net.moves.items() if k not in local} + require(layout["public"] == last + 1 and layout["source_labels"][last] == 1542, + "public layout") + updated = dict(layout, public=last, source_labels=pack(layout["source_labels"])) + return Network(first, pack(net.initial), pack(net.final), moves, rows), updated + + +def replay(source, layout, journal, engines): + require(sha256(encoded(source)).hexdigest() == journal["source"], "source word pin") + require(sha256(encoded(layout)).hexdigest() == journal["layout"], "source layout pin") + for name, digest in journal["semantic_modules"].items(): + require(sha256((engines / name).read_bytes()).hexdigest() == digest, name) + sys.path[:0] = [str(engines), str(engines / "retained" / "vendor")] + from network import Network + from public_split import split + from birth_event import apply_split + + net = Network(source["first_output"], source["initial"], source["final"], + {k: (a, b) for k, a, b in source["moves"]}, + {k: {i: Fraction(v) for i, v in row} for k, row in source["forms"]}) + for e in journal["splits"]: + net = split(net, e) + net.schedule() + e = journal["subdivide"] + k, j, chart = e["move"], e["new"], e["through"] + a, b = net.moves[k] + require([a, b] == e["original"] and j not in net.moves, "carrier preimage") + moves = dict(net.moves) + forms = dict(net.forms) + moves[j], moves[k] = (a, chart), (chart, b) + forms[j], forms[k] = forms[k], {j: Fraction(1)} + net = apply_split(Network(net.first_output, net.initial, net.final, moves, forms), journal["birth"]) + layout = dict(layout, public=len(net.initial), + source_labels=[*layout["source_labels"], journal["birth_source_label"]]) + net = erase_return(net, journal["erasure"]) + net, layout = restrict_source(net, layout, journal["quotient"]) + require(sha256(encoded(layout)).hexdigest() == journal["child_layout_sha256"], "child layout pin") + graph = dict(first_output=net.first_output, initial=net.initial, final=net.final, frames=source["frames"], + moves=[[k, *pair] for k, pair in sorted(net.moves.items())], + forms=[[k, [[i, str(q)] for i, q in sorted(row.items())]] for k, row in sorted(net.forms.items())], + schedule=net.schedule()) + digest = sha256(encoded(graph)).hexdigest() + require(digest == journal["canonical_sha256"], "child word pin") + audit = verify_integer_grid(net, graph, layout) + return graph, dict(word_sha256=digest, **audit) + + +def main(): + parser = ArgumentParser(description=__doc__) + parser.add_argument("--source", required=True, type=Path) + parser.add_argument("--layout", required=True, type=Path) + parser.add_argument("--engines", required=True, type=Path) + parser.add_argument("--journal", type=Path, default=Path(__file__).with_name("EVENTS.json")) + parser.add_argument("--write-word", type=Path) + parser.add_argument("--write-audit", type=Path) + args = parser.parse_args() + require(sys.flags.optimize == 0, "the source engines use assertions") + graph, audit = replay(read(args.source), read(args.layout), read(args.journal), args.engines) + if args.write_word: + args.write_word.write_bytes(gzip.compress(encoded(graph), mtime=0)) + if args.write_audit: + args.write_audit.write_text(json.dumps(audit, sort_keys=True, indent=2)+"\n") + print(json.dumps(audit, sort_keys=True)) + + +if __name__ == "__main__": + main() diff --git a/research/p104-live-relative-gain/verify_application.py b/research/p104-live-relative-gain/verify_application.py new file mode 100644 index 0000000000..5fe3de6bd6 --- /dev/null +++ b/research/p104-live-relative-gain/verify_application.py @@ -0,0 +1,192 @@ +"""Replay the two native circuits and the finite conditional multiplication claim.""" +import argparse +from fractions import Fraction +from hashlib import sha256 +import importlib.util +import json +from pathlib import Path +import sys +import tarfile +from tempfile import TemporaryDirectory + +HERE = Path(__file__).resolve().parent +sys.path.insert(0, str(HERE)) +from verify_split_helpers import canonical, check, read, rebuild, reconstruct + + +def module(name, path): + spec = importlib.util.spec_from_file_location(name, path) + result = importlib.util.module_from_spec(spec) + sys.modules[name] = result + spec.loader.exec_module(result) + return result + + +def source_tree(work, receipt): + archive = HERE / "APPLICATION-SOURCES.tar.gz" + check(sha256(archive.read_bytes()).hexdigest() == receipt["source_archive"], "public source archive") + with tarfile.open(archive) as files: + names = files.getmembers() + check(len(names) == len({item.name for item in names}) == receipt["source_count"] + and all(item.isfile() for item in names), "source file inventory") + files.extractall(work, members=names, filter="data") + package = work / "recipient" + prefix = "research/p104-iterated-returns/" + pins = {item["path"].removeprefix(prefix): item["sha256"] for item in read("SOURCES.json")["files"] + if item["path"].startswith(prefix)} + for path in package.rglob("*"): + if path.is_file(): + check(sha256(path.read_bytes()).hexdigest() == pins[str(path.relative_to(package))], + f"recipient source {path.relative_to(package)}") + prepare = module("locked_sources", package / "prepare_sources.py") + check(prepare.sources(work) + 7 == len(names), "SHA-256 and Git blobs of all inherited files") + return package + + +def ordinary_bit(work, package, result): + finite = module("finite_bit", package / "binary/finite.py") + source, parent = work / "source", work / "parent" + for path, pin in finite.SOURCE_PINS.items(): + finite.pinned(source / path, pin) + for path, pin in finite.PACKAGE_PINS.items(): + finite.pinned(parent / path, pin) + literal = module("literal", parent / "binary/independent/literal.py") + price = module("binary_price", parent / "binary/independent/price.py") + compiler = module("credited_product", source / finite.FINITE) + baseline = literal.candidate_word(parent / "binary/WORD.json.gz") + caller = literal.pinned(source / finite.PAIRED / "EFREE-CALLER.json.gz", literal.CALLER_SHA) + native = finite.candidate_receipt(literal, HERE / "BINARY-CANDIDATE.json.gz", + result["binary_word"], baseline, caller) + seed = Fraction(json.loads((source / finite.CLAIM).read_bytes())["admitted_BIT_saving"]) + proof = finite.ordinary_certificate(price, compiler, native, seed, None, None) + summary = dict(public=native["public"], instructions=native["instruction_counts"], + productive=native["native_targets"], paid=native["native_paid"], calls=native["native_calls"], + paid_all=native["paid"], productive_all=native["targets"], ordinary=native["ordinary"]) + check(json.loads(json.dumps(summary)) == result["binary_native"], "binary native and complete bills") + check(proof["raw_crossing"] == result["binary_raw"] and proof["ordinary_admitted"] == result["binary_ordinary"] + and proof["independent_directed_compiler"]["H"] == result["binary_H"] + and proof["finite_product_bound_bit_lengths"] == result["binary_product"], "finite ordinary BIT") + check(native["native_calls"] == 36 and seed == Fraction("0.00385248"), "binary caller and ordinary seed") + return Fraction(proof["ordinary_admitted"]) + + +def rational_application(work, package, result, bit): + sys.path.insert(0, str(package / "continuation")) + import qualify + + qualify.check_sources(work, package) + sys.path.insert(0, str(work / "parent")) + import qualify_complex + + reference = qualify_complex.historical_checker(work / "peer") + engine = work / "source/research/p104-dual-supplier-lift" + sys.path.insert(0, str(engine / "complex")) + import supplier + import supplier_gate + from closed_application import main_boundary, verify_caller + + parent, layout = rebuild() + word, _ = reconstruct(parent, read("BANK-FACTORS.json.gz")) + events = read("BANK-FACTORS-EVENTS.json") + moves, rows = reference.graph_inputs(parent) + net = supplier.Network(parent["first_output"], parent["initial"], parent["final"], + moves, {k: dict(row) for k, row in rows.items()}) + check(canonical(parent) == events["parent"], "bank change source") + for name in ("public_split", "bank_split"): + check(sha256((engine / "complex" / (name + ".py")).read_bytes()).hexdigest() + == events[name + "_sha256"], f"bank change engine {name}") + net = supplier.replay_events(net, events["events"]) + check(canonical(supplier.dump_graph(net, parent["frames"])) == events["word"] == canonical(word), + "bank operations and coefficient journal agree") + check((canonical(word), canonical(layout)) == (result["rational_word"], result["rational_layout"]), + "rational program and public addresses") + main_boundary(word, layout) + owners = qualify_complex.owners(layout) + caller = supplier.read(supplier.SOURCE / "data/CALLER.json.gz") + phases = supplier.read(supplier.SOURCE / "data/CALLER-PHASE-BASES.json") + signed, guard, census, coefficients = verify_caller(caller, word, layout, phases) + check(census["readback"]["event_stream_sha256"] == qualify.CALLER_PIN + and signed["calls"] == result["rational_calls"] == 48, "complete physical caller") + moves, rows = reference.graph_inputs(word) + native, conversion = qualify.native_replay(reference, supplier, word, layout, owners, moves, rows, caller) + weights = reference.invoice(native, reference.count_caller(caller)) + claim, tested, lower, upper = qualify_complex.price(reference, weights, bit) + # The upstream application sets this supplier input from an ordinary BIT proof. + supplier_gate.BIT_PIN = str(bit) + app = qualify.apply_expanded(native, signed, guard, coefficients, conversion, supplier.physical, + claim, tested, lower, upper, bit) + check(app["invoice"] == {"paid": weights["P"], "targets": weights["T"]}, "complete signed rational bill") + check(app["claim"] == result["claim"] and app["bracket"] == result["rational_raw"], "claimed endpoints") + parent = json.loads((work / "parent/evidence/application.json").read_bytes()) + previous = qualify.checked_json(package / "evidence/application.json", qualify.E40B_APP_PIN, compressed=False) + cases = {"tested": {"native": native, "application": app}, "original_7781": parent, "current_7786": previous} + root = supplier.physical.root_envelope({key: case["native"] for key, case in cases.items()}, guard) + depth = {key: supplier.physical.check_depth_guard(root, int(case["application"]["compiler"]["H"])) + for key, case in cases.items()} + check(qualify.PREMISES == result["premises"], "five inherited premises") + return word, layout, dict(application=app, native=native, conversion=conversion, common_root=root, + common_depth_guards=depth, caller_census=signed, caller_proof=census, + caller=qualify.CALLER_PIN, compiler_controls=qualify.controls(supplier.physical), + target_signed_margin=list(map(str, reference.dyadic_price(weights, qualify.TARGET)))) + + +def audit(work, package, result, bit, word, layout, proof): + import audit_expanded as review + + reader, interval, _ = review.pinned_context(work) + engine = work / "source/research/p104-dual-supplier-lift" + graph = reader.Graph.parse(word) + spans = [reader.span(frame) for frame in graph.frames] + expected, mains = reader.public_operator(graph, layout, spans) + grid = review.basis_grid(graph, expected, proof["native"], proof["conversion"]) + counts, plans = review.audit_plans(word, proof["conversion"]["scalar_cases"]) + fixture = review.replay_grid(graph, expected, proof["native"], plans) + check(fixture["native_independent_wide_incidences_executed"] == 4 * counts["expanded_terms"], + "four signed components for every wide scalar incidence") + check((grid, counts, fixture) == (result["rational_grid"], result["plans"], result["fixture"]), + "precision and dirty-stream audit") + signed = review.signed_readback(reader, interval, engine, graph, layout, mains, spans, proof) + ordinary = review.audit_ordinary(word, proof, counts, signed) + check(ordinary == result["ordinary"], "ordinary records and selected transfers") + review.audit_root(work, engine, word, layout, proof, package / "evidence/application.json") + + # Check the input-lift derivative independently through the new supplier cap. + pos, neg = {7: 1, 3: 1, 5: 1}, {9: 1, 4: 1, 1: 2} + slope = sum(Fraction(interval.log(r)[1], interval.B) * r * n for r, n in pos.items()) + slope -= sum(Fraction(interval.log(r)[0], interval.B) * r * n for r, n in neg.items()) + curvature = sum(Fraction(interval.log(r)[1], interval.B)**2 * r * n for r, n in neg.items()) + check(slope + bit * curvature < 0, "signed derivative through the admitted cap") + gate = review.load("independent_outer", engine / "complex/supplier_gate.py", review.SUPPLIER_GATE_SHA) + gate.BIT_PIN = str(bit) + claim = Fraction(result["claim"]) + tested = claim + Fraction(7, 10**14) + check(0 < claim < tested < bit <= Fraction("0.0069"), "strict ordinary headroom") + outer = gate.gate({"T": signed["productive"], "P": signed["paid"]}, claim, tested, + *signed["candidate_raw_bracket"], bit) + for key in ("H", "minimum_log_power", "written_log_power", "compiler_gap", "moment_margins", "outer"): + check(outer[key] == proof["application"]["compiler"][key], f"independent compiler {key}") + check(outer["outer"] == result["outer"] and outer["H"] == result["H"], "complete outer receipt") + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--out", type=Path, help="write the full physical application receipt") + args = parser.parse_args() + check(__debug__, "proof checks require assertions") + result = read("APPLICATION.json") + with TemporaryDirectory(prefix="p104-application-") as name: + work = Path(name) + package = source_tree(work, result) + bit = ordinary_bit(work, package, result) + print("PASS binary map, both literal directions, credited product and finite ordinary cap", flush=True) + word, layout, proof = rational_application(work, package, result, bit) + # The independent reader takes the public JSON representation of each histogram. + proof = json.loads(json.dumps(proof)) + audit(work, package, result, bit, word, layout, proof) + if args.out: + args.out.write_text(json.dumps(proof, indent=2, sort_keys=True) + "\n") + print("PASS complete conditional multiplication claim", result["claim"], flush=True) + + +if __name__ == "__main__": + main() diff --git a/research/p104-live-relative-gain/verify_bidirectional.py b/research/p104-live-relative-gain/verify_bidirectional.py new file mode 100644 index 0000000000..dad4414718 --- /dev/null +++ b/research/p104-live-relative-gain/verify_bidirectional.py @@ -0,0 +1,152 @@ +"""Rebuild the rational circuit and replay its scalar map and caller tariff.""" +import argparse +from collections import Counter +from fractions import Fraction +from functools import cache +from graphlib import TopologicalSorter +from math import gcd, lcm +from pathlib import Path +import sys + +sys.path.insert(0, str(Path(__file__).resolve().parent)) +from verify_component import canonical, check, check_decrease, expected_columns, factor, inspect, margin, read + + +@cache +def rational(text): + return Fraction(text) + + +def reconstruct(parent, delta): + check(canonical(parent) == delta["parent"], "parent word") + moves = {k: (a, b) for k, a, b in parent["moves"]} + forms = {k: dict(row) for k, row in parent["forms"]} + for k in delta["removed"]: + del moves[k], forms[k] + for k, a, b in delta["moves"]: + check(k not in forms, "new transfer label") + moves[k], forms[k] = (a, b), {} + + differences = {} + literals = {} + for k, kind, entries in delta["differences"]: + check(k not in differences and k in forms, "changed coefficient row") + weights = {j: rational(s) for j, s in entries} + check(len(weights) == len(entries) and all(weights.values()), "distinct nonzero weights") + if kind == "add": + change = weights + literals[k] = change + else: + check(kind == "combine", "difference format") + change = {} + for j, weight in weights.items(): + for donor, value in literals[j].items(): + change[donor] = change.get(donor, 0) + weight * value + change = {j: v for j, v in change.items() if v} + differences[k] = len(change) + row = forms[k] + for j, v in change.items(): + coefficient = rational(row.get(j, "0")) + v + if coefficient: + row[j] = str(coefficient) + else: + del row[j] + deps = {k: tuple(j for j in sorted(row) if j >= 0) for k, row in sorted(forms.items())} + word = dict(parent, forms=[[k, sorted(row.items())] for k, row in sorted(forms.items())], + moves=[[k, a, b] for k, (a, b) in sorted(moves.items())], + schedule=list(TopologicalSorter(deps).static_order())) + check(canonical(word) == delta["word"], "reconstructed word") + return word, sum(differences.values()) + + +def forward(word, layout): + """Check all terminal rows. Find the smallest grid that contains every scalar product.""" + n, first = len(word["initial"]), word["first_output"] + columns, _ = expected_columns(layout, n) + want = [{} for _ in range(n)] + for i, column in enumerate(columns): + for j, fraction in column.items(): + want[j][i] = Fraction(*fraction) + rows = dict(word["forms"]) + stock = {~i: ({i: 1}, 1, 1) for i in range(n)} + uses = Counter(j for row in rows.values() for j, _ in row) + grid = literal_bits = 1 + products = 0 + for k in word["schedule"]: + terms = [] + divisor = 1 + for j, s in rows[k]: + num, den = factor(s) + literal_bits = max(literal_bits, num.bit_length(), den.bit_length()) + values, source_den, content = stock[j] + total_den = den * source_den + grid = lcm(grid, total_den // gcd(total_den, num * content)) + terms.append((values, num, total_den)) + divisor = lcm(divisor, total_den) + uses[j] -= 1 + if not uses[j]: + del stock[j] + result = {} + for values, num, den in terms: + products += len(values) + multiple = num * (divisor // den) + for i, v in values.items(): + result[i] = result.get(i, 0) + multiple * v + result = {i: v for i, v in result.items() if v} + if first <= k < first + n: + check(result.keys() == want[k-first].keys() and + all(v == divisor * want[k-first][i] for i, v in result.items()), f"terminal row {k-first}") + else: + content = gcd(*result.values()) + common = gcd(content, divisor) + stock[k] = ({i: v // common for i, v in result.items()}, divisor // common, content // common) + return products, grid, literal_bits + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--quotient", action="store_true", help="check the four-term quotient on the rebuilt parent") + args = parser.parse_args() + parent = read("WORD.json.gz") + check(canonical(parent) == read("RATIONAL-RECEIPT.json")["word"], "initial word") + prefix = "BIDIRECTIONAL" + if args.quotient: + parent, _ = reconstruct(parent, read("BIDIRECTIONAL.json.gz")) + check(canonical(parent) == read("BIDIRECTIONAL-RECEIPT.json")["new_word"], "intermediate word") + prefix = "BIDIRECTIONAL-QUOTIENT" + verify_step(parent, prefix) + + +def verify_step(parent, prefix, layout=None): + delta = read(prefix + ".json.gz") + receipt = read(prefix + "-RECEIPT.json") + word, edits = reconstruct(parent, delta) + check(delta["word"] == receipt["new_word"] and len(word["moves"]) == receipt["moves"], "word and charge count") + check(len(parent["moves"]) == receipt["old_moves"] and len(delta["removed"]) == receipt["retired"] + and len(delta["moves"]) == receipt["new_moves"], "changed transfers") + check(edits == receipt["coefficient_edits"] and len(delta["differences"]) == receipt["changed_rows"], + "coefficient count") + check_circuit(word, receipt, read("LAYOUT.json.gz") if layout is None else layout) + return word + + +def check_circuit(word, receipt, layout): + work, grid, bits = forward(word, layout) + check([work, grid, bits] == [receipt["forward_terms"], int(receipt["minimum_product_grid"]), + receipt["literal_peak_bits"]], "forward precision and work") + paid, targets, adjoint = inspect(word, layout, read("CALLER-CENSUS.json")) + check(adjoint == receipt["adjoint_terms"] and len(word["initial"]) == receipt["public"], "adjoint census") + for name, bins in (("paid", paid), ("productive", targets)): + check({str(k): v for k, v in bins.items()} == receipt[name], name) + lower, upper = [Fraction(v, 10**14) for v in receipt["crossing_e14"]] + check(margin(paid, targets, lower)[0] > 0 and margin(paid, targets, upper)[1] < 0, "crossing signs") + check_decrease(paid, targets) + lo, hi = margin(paid, targets, receipt["trial"]) + a, b = map(Fraction, receipt["trial_margin"]) + check(a <= lo <= hi <= b < 0, "trial margin") + print(f"PASS {len(word['moves'])} transfers, {work} forward products, {adjoint} adjoint terms, " + f"{len(word['initial'])} independent fields and both crossing signs") + + +if __name__ == "__main__": + main() diff --git a/research/p104-live-relative-gain/verify_component.py b/research/p104-live-relative-gain/verify_component.py new file mode 100644 index 0000000000..6f2aff9a04 --- /dev/null +++ b/research/p104-live-relative-gain/verify_component.py @@ -0,0 +1,189 @@ +"""Check the rational graph over every input and price its 48 calls.""" +from collections import Counter, defaultdict +from fractions import Fraction +from functools import cache +from hashlib import sha256 +from math import gcd, isqrt, lcm +from pathlib import Path +import gzip +import json + + +ROOT = Path(__file__).resolve().parent +SCALE = 1 << 192 + + +def check(condition, message): + if not condition: + raise ValueError(message) + + +def read(name): + raw = (ROOT / name).read_bytes() + return json.loads(gzip.decompress(raw) if name.endswith(".gz") else raw) + + +def canonical(value): + return sha256(json.dumps(value, sort_keys=True, separators=(",", ":")).encode()).hexdigest() + + +@cache +def factor(text): + value = Fraction(text) + return value.numerator, value.denominator + + +def frame_span(basis): + points = {0} + for vector in basis: + check(0 < vector < 512 and vector not in points, "invalid frame basis") + points.update([old ^ vector for old in points]) + return points + + +def expected_columns(layout, n): + expected = [{i: (1, 1)} for i in range(n)] + main = set() + hosted = layout["hosted"] + for port, x in enumerate(layout["live"]): + y = x + 112 + main.update((x, y)) + if port in hosted["Dports"]: + expected[x][y] = (1, 1) + else: + expected[x][y] = (1, 2) + expected[y] = {x: (-1, 1), y: (1, 2)} + for x, y in zip(hosted["X2"], hosted["Y2"], strict=True): + main.update((x, y)) + expected[y][x] = (-1, 1) + check(len(main) == 400, "main role count") + return expected, main + + +def inspect(word, layout, caller): + starts, ends = word["initial"], word["final"] + n = len(starts) + check(len(ends) == n == layout["public"] == len(layout["source_labels"]), "endpoint count") + check(word["frames"] == layout["frames"], "layout frames") + expected, main = expected_columns(layout, n) + rank = [len(f) for f in word["frames"]] + spans = list(map(frame_span, word["frames"])) + moves = {k: (a, b) for k, a, b in word["moves"]} + graph = dict(word["forms"]) + order = word["schedule"] + first = word["first_output"] + outputs = set(range(first, first + n)) + check(len(moves) == len(word["moves"]) and moves.keys().isdisjoint(outputs), "paid labels") + check(len(order) == len(graph) == len(word["forms"]), "row count") + check(set(order) == graph.keys() == moves.keys() | outputs, "schedule coverage") + + def grade(a, b): + check(spans[a] < spans[b] or spans[b] < spans[a], "strictly nested charts") + return abs(rank[b] - rank[a]) + + calls = caller["calls"] + paid = Counter({int(k): v for k, v in caller["fixed_caller_paid"].items()}) + targets = Counter({int(k): v for k, v in caller["fixed_root_targets"].items()}) + for i, (a, b) in enumerate(zip(starts, ends, strict=True)): + if i not in main: + targets[grade(a, b)] += calls + + bank = {~i: a for i, a in enumerate(starts)} + consumers = defaultdict(list) + for k in order: + a = moves[k][0] if k in moves else ends[k - first] + for donor, text in graph[k]: + check(bank[donor] == a, f"donor chart at {k}") + num, den = factor(text) + consumers[donor].append((k, num, den)) + if k in moves: + a, b = moves[k] + paid[grade(a, b)] += calls + bank[k] = b + + # Store a common positive denominator for every sparse adjoint row. + back = {first + i: ({i: 1}, 1) for i in range(n)} + terms = 0 + keys = [k for k in reversed(order) if k in moves] + [~i for i in range(n)] + for k in keys: + users = consumers[k] + common = lcm(*(den * back[j][1] for j, num, den in users)) + row = {} + for j, num, den in users: + values, divisor = back[j] + scale = num * (common // (den * divisor)) + for i, value in values.items(): + row[i] = row.get(i, 0) + scale * value + terms += len(values) + divisor = gcd(common, *row.values()) + back[k] = ({i: v // divisor for i, v in row.items() if v}, common // divisor) + for i, want in enumerate(expected): + row, divisor = back[~i] + check(row.keys() == want.keys(), f"column support at {i}") + check(all(v * want[j][1] == divisor * want[j][0] for j, v in row.items()), f"column {i}") + return paid, targets, terms + + +def price(rank, saving): + # Enclose rank**saving by successive integer square roots. Each bit + # selects the next positive root. The last root bounds the full tail. + lo = hi = rank * SCALE + product_lo = product_hi = SCALE + rem = Fraction(saving) + for _ in range(152): + lo = isqrt(lo * SCALE) + hi = 1 + isqrt(hi * SCALE - 1) + rem *= 2 + if rem >= 1: + rem -= 1 + product_lo = product_lo * lo // SCALE + product_hi = (product_hi * hi + SCALE - 1) // SCALE + if rem: + product_hi = (product_hi * hi + SCALE - 1) // SCALE + mass = rank * SCALE * SCALE + return mass // product_hi, (mass + product_lo - 1) // product_lo + + +def margin(paid, targets, saving): + lo = hi = 0 + for rank in targets.keys() | paid.keys(): + count = targets[rank] - paid[rank] + a, b = price(rank, saving) + lo += min(count * a, count * b) + hi += max(count * a, count * b) + return Fraction(lo, SCALE), Fraction(hi, SCALE) + + +def check_decrease(paid, targets): + # Bound the derivative divided by ln(2) from above on [0, 0.004]. + derivative = 0 + for rank in paid.keys() | targets.keys(): + count = targets[rank] - paid[rank] + if count > 0: + derivative -= count * (rank.bit_length() - 1) * price(rank, "0.004")[0] + else: + derivative -= count * (rank - 1).bit_length() * rank * SCALE + check(derivative < 0, "strict decrease on the comparison interval") + + +def main(): + word = read("WORD.json.gz") + layout = read("LAYOUT.json.gz") + receipt = read("RATIONAL-RECEIPT.json") + check(canonical(word) == receipt["word"] == read("EVENTS.json")["canonical_sha256"], "word pin") + check(canonical(layout) == read("EVENTS.json")["child_layout_sha256"], "layout pin") + paid, targets, terms = inspect(word, layout, read("CALLER-CENSUS.json")) + check(terms == receipt["adjoint_terms"] and len(word["initial"]) == receipt["public"], "adjoint census") + for name, bins in (("paid", paid), ("productive", targets)): + check({str(k): v for k, v in bins.items()} == receipt[name], name) + lower, upper = map(Fraction, receipt["crossing"]) + check(margin(paid, targets, lower)[0] > 0 and margin(paid, targets, upper)[1] < 0, "crossing signs") + check_decrease(paid, targets) + probe = margin(paid, targets, "0.00391884648") + left, right = map(Fraction, receipt["target_margin"]) + check(left <= probe[0] <= probe[1] <= right < 0, "target interval") + print(f"PASS {receipt['public']} columns, {terms} adjoint terms, both crossing signs and the target deficit") + + +if __name__ == "__main__": + main() diff --git a/research/p104-live-relative-gain/verify_split_helpers.py b/research/p104-live-relative-gain/verify_split_helpers.py new file mode 100644 index 0000000000..d596f75f1f --- /dev/null +++ b/research/p104-live-relative-gain/verify_split_helpers.py @@ -0,0 +1,95 @@ +"""Rebuild two helper splits and check the resulting rational program.""" +from fractions import Fraction +from graphlib import TopologicalSorter +from pathlib import Path +import sys + +sys.path.insert(0, str(Path(__file__).resolve().parent)) +from replay import add +from verify_bidirectional import canonical, check, check_circuit, read, reconstruct, verify_step + + +def split(word, event): + first = word["first_output"] + initial, final = word["initial"].copy(), word["final"].copy() + role, chart = event["role"], event["chart"] + fresh = len(initial) + check((initial[role], final[role]) == (3, 127), "old helper endpoints") + + def load_row(entries): + return {i: Fraction(q) for i, q in entries} + + rows = {k: load_row(entries) for k, entries in word["forms"]} + s, w = load_row(event["covector"]), load_row(event["direction"]) + pairing = sum(s.get(i, 0) * v for i, v in w.items()) + check(pairing and w.get(role), "nonzero helper pivots") + substitute = {~i: -v / pairing for i, v in s.items() if i != role} + substitute[~role] = 1 / pairing + + def change_source(row): + coefficient = sum(row.get(~i, 0) * v for i, v in w.items()) + row.pop(~role, None) + if coefficient: + add(row, substitute, coefficient) + + for row in rows.values(): + change_source(row) + observed = load_row(event["read"]) + change_source(observed) + difference = {~fresh: 1 / pairing} + add(difference, observed, -1 / pairing) + for k, coefficient in load_row(event["inject"]).items(): + add(rows[k], difference, coefficient) + + recovered = {} + for i, v in s.items(): + add(recovered, rows[first + i], v) + old_return = rows[first + role] + for i, v in w.items(): + if i != role: + add(rows[first + i], old_return, -v / w[role]) + rows[first + role] = observed + rows[first + fresh] = recovered + initial.append(chart) + final.append(final[role]) + final[role] = chart + deps = {k: tuple(j for j in sorted(row) if j >= 0) for k, row in sorted(rows.items())} + return dict(word, initial=initial, final=final, schedule=list(TopologicalSorter(deps).static_order()), + forms=[[k, [[j, str(q)] for j, q in sorted(row.items())]] for k, row in sorted(rows.items())]) + + +def rebuild(check_parents=False): + parent = read("WORD.json.gz") + for name in ("BIDIRECTIONAL", "BIDIRECTIONAL-QUOTIENT"): + if check_parents: + parent = verify_step(parent, name) + else: + parent, _ = reconstruct(parent, read(name + ".json.gz")) + journal, receipt = read("HELPER-SPLITS.json"), read("HELPER-SPLITS-RECEIPT.json") + check(canonical(parent) == journal["parent"] == read("BIDIRECTIONAL-QUOTIENT-RECEIPT.json")["new_word"], + "split parent") + events = journal["splits"] + check(len(events) == receipt["splits"], "split count") + word = parent + for event in events: + word = split(word, event) + check(canonical(word) == journal["word"] == receipt["new_word"], "split word") + check(word["moves"] == parent["moves"] and len(word["moves"]) == receipt["moves"], "shared paid transfers") + layout = read("LAYOUT.json.gz") + labels = layout["source_labels"] + first_label = max(labels) + 1 + layout = dict(layout, public=len(word["initial"]), + source_labels=[*labels, *range(first_label, first_label + len(events))]) + check(canonical(layout) == journal["layout"], "new public labels") + return word, layout + + +def main(): + word, layout = rebuild(check_parents=True) + receipt = read("HELPER-SPLITS-RECEIPT.json") + check_circuit(word, receipt, layout) + verify_step(word, "BANK-FACTORS", layout) + + +if __name__ == "__main__": + main()