diff --git a/research/literal-tariff-conversion-audit/CONTROLS.json b/research/literal-tariff-conversion-audit/CONTROLS.json new file mode 100644 index 0000000000..608e551dfc --- /dev/null +++ b/research/literal-tariff-conversion-audit/CONTROLS.json @@ -0,0 +1,22 @@ +{ + "detected": [ + "COPY_must_not_be_included_in_ADD_count", + "one_native_call_is_not_the_complete_18_call_invoice", + "remainder_and_reversal_cost_is_not_zero", + "coded_read_is_not_three_raw_reads", + "upper_cap_inference_from_lower_bound_rejected", + "positive_abstract_countermodel_to_full_runtime_obstruction", + "quotient_fourth_move_counted" + ], + "invalid_inferences": [ + "An O(V) source lemma specifies rho=1.", + "A lower estimate under rho=3 proves an upper admission.", + "A failure of the retained replacement ledger proves all implementations exceed the cap.", + "Three installed compact source tokens constitute a full caller registry." + ], + "purely_algebraic_countermodel": { + "add_actual": 500000000, + "other_actual": 100000000, + "scope": "Consistency witness for cost inequalities only; no physical algorithm is asserted." + } +} diff --git a/research/literal-tariff-conversion-audit/DEPENDENCIES.json b/research/literal-tariff-conversion-audit/DEPENDENCIES.json new file mode 100644 index 0000000000..7658fac739 --- /dev/null +++ b/research/literal-tariff-conversion-audit/DEPENDENCIES.json @@ -0,0 +1,196 @@ +{ + "schema_version": 1, + "files": [ + { + "local_path": "data/word.json.gz", + "repository": "DreamingOfClouds/integer-mult-bounds", + "commit": "03626137d0bd57f09b0bf9597376183ce6fa9683", + "original_path": "research/p104-main-wire-native/data/word.json.gz", + "usage": "source", + "bytes": 349022, + "sha256": "273e81f176f001684b1fa3eb857992bf58b54748004fcfe806b83adb48d2cc00", + "git_blob": "d93e67ca7628bf5531ae6e369da4dd7b7907b88f" + }, + { + "local_path": "data/caller.json", + "repository": "CubeJerry/integer-mult-bounds", + "commit": "617903497387a98f7ca929ad0b6928dd32abffec", + "original_path": "research/p104-query-only-interval/QUERY-ONLY-CALLER.json", + "usage": "source", + "bytes": 73501, + "sha256": "3828d53e80ea97e8b866320f081af20b6b93bfebd58b95b56b85a7afe151af5e", + "git_blob": "cf55f4271009a06ad192a070d330a4466b6d44fa" + }, + { + "local_path": "kernel/compact_tables.py", + "repository": "CubeJerry/integer-mult-bounds", + "commit": "38cd824c60f2bb5c6f2603f848a9487cb3a57965", + "original_path": "research/compact-rounded-add/tables.py", + "usage": "runtime", + "bytes": 9089, + "sha256": "fe8a28fd523ebb7ec78dce4ba0855b3070a6cbff470602cd62f8d3ff445e0f0a", + "git_blob": "b90ecb6052e270095fdd048f992f9fc786f3f8c7" + }, + { + "local_path": "kernel/exact_builder.py", + "repository": "CubeJerry/integer-mult-bounds", + "commit": "13193a22b1070a74a8580c5d3ea27470443f815a", + "original_path": "research/current-scalar-flat-tables/tables.py", + "usage": "runtime", + "bytes": 12650, + "sha256": "654e9734ef80a9394807ca508543b1bc164afb5768d23d0e5a88c790d2f13bac", + "git_blob": "1cc22f75fbe53d48b84be42782e581c04820cd49" + }, + { + "local_path": "kernel/machine.py", + "repository": "CubeJerry/integer-mult-bounds", + "commit": "ab239cb6ee884e7a900dd9101c34448077fad0b0", + "original_path": "research/compiled-owned-bank-lifecycle/machine.py", + "usage": "runtime", + "bytes": 14932, + "sha256": "ec597bce13275003ff30e4be481c936401826c1d4af642b55eec0c410774d1df", + "git_blob": "acf475e4fccaff2fb64bd5b0b3f3fc0d246dc592" + }, + { + "local_path": "reference/COMPACT-PROOF.md", + "repository": "CubeJerry/integer-mult-bounds", + "commit": "38cd824c60f2bb5c6f2603f848a9487cb3a57965", + "original_path": "research/compact-rounded-add/PROOF.md", + "usage": "reference", + "bytes": 20517, + "sha256": "80035605d92c0a1cceb1f802f4adcfeb1b60590a4b7335b612f8c4f67079ceb0", + "git_blob": "07d0ad2d714c5e6e4b0b03db78657bf8d6a63bf9" + }, + { + "local_path": "reference/QUERY-PROOF.md", + "repository": "CubeJerry/integer-mult-bounds", + "commit": "617903497387a98f7ca929ad0b6928dd32abffec", + "original_path": "research/p104-query-only-interval/PROOF.md", + "usage": "reference", + "bytes": 14599, + "sha256": "0cede285a98dd61b78020651202729c6d9cd16fb078ee5fe9a01aa2400df5432", + "git_blob": "2f8610ae455bb8c6b79161223cc948e136253add" + }, + { + "local_path": "reference/query_invoice.py", + "repository": "CubeJerry/integer-mult-bounds", + "commit": "617903497387a98f7ca929ad0b6928dd32abffec", + "original_path": "research/p104-query-only-interval/complete_invoice.py", + "usage": "reference", + "bytes": 4478, + "sha256": "08e923f18bfb86c1b1664dd6c025e45e53e0e2be40af0ae7b7459bb7bd1414ba", + "git_blob": "eec03ab88b1a8cd97b97169e3d760a91a3ec23b0" + }, + { + "local_path": "reference/owned_invoice.py", + "repository": "CubeJerry/integer-mult-bounds", + "commit": "4e2fd1b6abed49c202a057fd5c73ead0a460f976", + "original_path": "research/p104-qself-owned-lowering/invoice.py", + "usage": "reference", + "bytes": 11454, + "sha256": "bb61a684d284942157e8b3ca48c40c4c98809298eee0d763d509bbbde8bec208", + "git_blob": "a576bd0e0054dccae91d7cf3ff7e65090a6257e0" + }, + { + "local_path": "reference/PRECISION-PROOF.md", + "repository": "CubeJerry/integer-mult-bounds", + "commit": "56bc9383594a3efc303148e00bb746851abd1ed5", + "original_path": "research/query-only-precision-envelope/PROOF.md", + "usage": "reference", + "bytes": 26757, + "sha256": "8ddafd9a4c5b51d4c0e3f9b4a9eba27712335a16de1868ba156557344af86e63", + "git_blob": "465a5dddd83bdea5db09f1030f99dffe698fe600" + }, + { + "local_path": "reference/precision_guards.py", + "repository": "CubeJerry/integer-mult-bounds", + "commit": "56bc9383594a3efc303148e00bb746851abd1ed5", + "original_path": "research/query-only-precision-envelope/guards.py", + "usage": "reference", + "bytes": 4750, + "sha256": "004393aea68177dac6378295a60a3f4a9a236068c939c5825eea41c58097fc08", + "git_blob": "0b0b7f0c0bc675152c222c2c53d559cb3648adc9" + }, + { + "local_path": "reference/PRECISION-GUARDS.json", + "repository": "CubeJerry/integer-mult-bounds", + "commit": "56bc9383594a3efc303148e00bb746851abd1ed5", + "original_path": "research/query-only-precision-envelope/GUARDS.json", + "usage": "reference", + "bytes": 2170, + "sha256": "fbcb30c44ff2436c8b2c84def832c37b8fd68598c8fdb3a122ba43c8b791e004", + "git_blob": "d295e9bb21973df7fa31cbf64f016fbd86ab9b9a" + }, + { + "local_path": "reference/LAMBDA-PROOF.md", + "repository": "CubeJerry/integer-mult-bounds", + "commit": "591394d8b791f6e8ac6e1aa36f8c3ea5389178c2", + "original_path": "research/current-rounded-lambda/PROOF.md", + "usage": "reference", + "bytes": 18690, + "sha256": "94aff5db5beca90a2ef27913a13783ac465b46c5b99cbd92d517e69d0cf2e4cf", + "git_blob": "538302771cb517c8a71dee0bc519c5ebf24ee32a" + }, + { + "local_path": "reference/LAMBDA-SOURCE.json", + "repository": "CubeJerry/integer-mult-bounds", + "commit": "591394d8b791f6e8ac6e1aa36f8c3ea5389178c2", + "original_path": "research/current-rounded-lambda/SOURCE.json", + "usage": "reference", + "bytes": 922, + "sha256": "1e76ff12b2469d5904c7b85e3775f6285e8a71580a0e49f1e333d518e6c584b4", + "git_blob": "0497a28a6d34a72caedd8d84cf426e34adc3facf" + }, + { + "local_path": "reference/ROUNDED-DIVISION-6937.md", + "repository": "DreamingOfClouds/integer-mult-bounds", + "commit": "a98df73ddae1d1ea85a62b6bdf2714b28cb7b359", + "original_path": "research/p104-two-chain-findings/ROUNDED-DIVISION.md", + "usage": "reference", + "bytes": 40736, + "sha256": "9ecff5835fae5fcdbf416711a5ef0e69d51afb535c55570ab3e1fef6f920f146", + "git_blob": "ed609f6a0e26dd00d6c55f876b667e15051507ca" + }, + { + "local_path": "reference/FINITE-PRECOMPILATION.md", + "repository": "CrocSwap/integer-mult-bounds", + "commit": "7c49fe32c55de02c2c873655c804b16e4c3fef0a", + "original_path": "research/kappa-rebuild/architecture/FINITE-PRECOMPILATION.md", + "usage": "reference", + "bytes": 15898, + "sha256": "4cb32f6b8e388ecf6ed41b5bbdeeb4539cb40c8424f194974afea58f7e0921e8", + "git_blob": "4badb40f0919c515823cb07e44c6470d4d6469ca" + }, + { + "local_path": "reference/physical_review_6936.py", + "repository": "DreamingOfClouds/integer-mult-bounds", + "commit": "03626137d0bd57f09b0bf9597376183ce6fa9683", + "original_path": "research/p104-main-wire-native/retained/physical-review/verify.py", + "usage": "reference", + "bytes": 33361, + "sha256": "c303c2812d530849d174088f0330a4d7ddac2698d92b91848dbce7a512573fc2", + "git_blob": "f41390e0246cd6604a94ef5b418f48a817a4208c" + }, + { + "local_path": "reference/02-streams.tex", + "repository": "CrocSwap/integer-mult-bounds", + "commit": "7c49fe32c55de02c2c873655c804b16e4c3fef0a", + "original_path": "upstream/build/sections/02-streams.tex", + "usage": "reference", + "bytes": 11311, + "sha256": "606c80db61cad13aa0c3b6060dc4b88dbbe7ac60cdd831aa93f28d908fd09dab", + "git_blob": "088fceea1867abc76271d7efe7532b779fee9039" + }, + { + "local_path": "reference/05-layers.tex", + "repository": "CrocSwap/integer-mult-bounds", + "commit": "7c49fe32c55de02c2c873655c804b16e4c3fef0a", + "original_path": "upstream/build/sections/05-layers.tex", + "usage": "reference", + "bytes": 46811, + "sha256": "20cfc8d12099d4e4ed9e3e7eeb6162edd9b6e0e076f24693364cd24377252594", + "git_blob": "5ce8b3c83c455f221bb84858a97230b0285644aa" + } + ], + "scope": "Exact bytes retained; public commit/path pins are source identities, not claims of canonical ancestry." +} diff --git a/research/literal-tariff-conversion-audit/LITERAL.json b/research/literal-tariff-conversion-audit/LITERAL.json new file mode 100644 index 0000000000..66d28506f0 --- /dev/null +++ b/research/literal-tariff-conversion-audit/LITERAL.json @@ -0,0 +1,767 @@ +{ + "cases": 36, + "exact_width_increment_controls": 9, + "observations": [ + { + "coefficient": "1", + "lower": [ + 196, + 42, + 408, + 102 + ], + "observed": [ + 651, + 173, + 1313, + 336 + ], + "rows_in_table": 1294, + "widths": [ + 1, + 1 + ] + }, + { + "coefficient": "1", + "lower": [ + 588, + 126, + 1224, + 306 + ], + "observed": [ + 1043, + 257, + 2129, + 540 + ], + "rows_in_table": 1294, + "widths": [ + 2, + 4 + ] + }, + { + "coefficient": "1", + "lower": [ + 3136, + 672, + 6528, + 1632 + ], + "observed": [ + 3983, + 917, + 8261, + 2088 + ], + "rows_in_table": 1294, + "widths": [ + 17, + 1, + 3, + 11 + ] + }, + { + "coefficient": "1", + "lower": [ + 12740, + 2730, + 26520, + 6630 + ], + "observed": [ + 13195, + 2861, + 27425, + 6864 + ], + "rows_in_table": 1294, + "widths": [ + 65, + 65 + ] + }, + { + "coefficient": "-1", + "lower": [ + 196, + 42, + 408, + 102 + ], + "observed": [ + 651, + 173, + 1313, + 336 + ], + "rows_in_table": 1294, + "widths": [ + 1, + 1 + ] + }, + { + "coefficient": "-1", + "lower": [ + 588, + 126, + 1224, + 306 + ], + "observed": [ + 1043, + 257, + 2129, + 540 + ], + "rows_in_table": 1294, + "widths": [ + 2, + 4 + ] + }, + { + "coefficient": "-1", + "lower": [ + 3136, + 672, + 6528, + 1632 + ], + "observed": [ + 3983, + 917, + 8261, + 2088 + ], + "rows_in_table": 1294, + "widths": [ + 17, + 1, + 3, + 11 + ] + }, + { + "coefficient": "-1", + "lower": [ + 12740, + 2730, + 26520, + 6630 + ], + "observed": [ + 13195, + 2861, + 27425, + 6864 + ], + "rows_in_table": 1294, + "widths": [ + 65, + 65 + ] + }, + { + "coefficient": "3/8", + "lower": [ + 328, + 60, + 696, + 180 + ], + "observed": [ + 1287, + 371, + 2861, + 804 + ], + "rows_in_table": 5449, + "widths": [ + 1, + 1 + ] + }, + { + "coefficient": "3/8", + "lower": [ + 984, + 180, + 2088, + 540 + ], + "observed": [ + 1943, + 491, + 4253, + 1164 + ], + "rows_in_table": 5449, + "widths": [ + 2, + 4 + ] + }, + { + "coefficient": "3/8", + "lower": [ + 5248, + 960, + 11136, + 2880 + ], + "observed": [ + 7103, + 1565, + 15389, + 4116 + ], + "rows_in_table": 5449, + "widths": [ + 17, + 1, + 3, + 11 + ] + }, + { + "coefficient": "3/8", + "lower": [ + 21320, + 3900, + 45240, + 11700 + ], + "observed": [ + 22279, + 4211, + 47405, + 12324 + ], + "rows_in_table": 5449, + "widths": [ + 65, + 65 + ] + }, + { + "coefficient": "-2/3", + "lower": [ + 260, + 48, + 540, + 138 + ], + "observed": [ + 959, + 227, + 1973, + 530 + ], + "rows_in_table": 2789, + "widths": [ + 1, + 1 + ] + }, + { + "coefficient": "-2/3", + "lower": [ + 780, + 144, + 1620, + 414 + ], + "observed": [ + 1479, + 323, + 3053, + 806 + ], + "rows_in_table": 2789, + "widths": [ + 2, + 4 + ] + }, + { + "coefficient": "-2/3", + "lower": [ + 4160, + 768, + 8640, + 2208 + ], + "observed": [ + 5495, + 1109, + 11429, + 2980 + ], + "rows_in_table": 2789, + "widths": [ + 17, + 1, + 3, + 11 + ] + }, + { + "coefficient": "-2/3", + "lower": [ + 16900, + 3120, + 35100, + 8970 + ], + "observed": [ + 17599, + 3299, + 36533, + 9362 + ], + "rows_in_table": 2789, + "widths": [ + 65, + 65 + ] + }, + { + "coefficient": "-7/10", + "lower": [ + 348, + 60, + 732, + 190 + ], + "observed": [ + 1447, + 371, + 3149, + 886 + ], + "rows_in_table": 6729, + "widths": [ + 1, + 1 + ] + }, + { + "coefficient": "-7/10", + "lower": [ + 1044, + 180, + 2196, + 570 + ], + "observed": [ + 2143, + 491, + 4613, + 1266 + ], + "rows_in_table": 6729, + "widths": [ + 2, + 4 + ] + }, + { + "coefficient": "-7/10", + "lower": [ + 5568, + 960, + 11712, + 3040 + ], + "observed": [ + 7703, + 1565, + 16469, + 4420 + ], + "rows_in_table": 6729, + "widths": [ + 17, + 1, + 3, + 11 + ] + }, + { + "coefficient": "-7/10", + "lower": [ + 22620, + 3900, + 47580, + 12350 + ], + "observed": [ + 23719, + 4211, + 49997, + 13046 + ], + "rows_in_table": 6729, + "widths": [ + 65, + 65 + ] + }, + { + "coefficient": "1/125", + "lower": [ + 480, + 78, + 1020, + 268 + ], + "observed": [ + 2359, + 677, + 5453, + 1600 + ], + "rows_in_table": 171204, + "widths": [ + 1, + 1 + ] + }, + { + "coefficient": "1/125", + "lower": [ + 1440, + 234, + 3060, + 804 + ], + "observed": [ + 3319, + 833, + 7493, + 2136 + ], + "rows_in_table": 171204, + "widths": [ + 2, + 4 + ] + }, + { + "coefficient": "1/125", + "lower": [ + 7680, + 1248, + 16320, + 4288 + ], + "observed": [ + 11375, + 2429, + 25109, + 6940 + ], + "rows_in_table": 171204, + "widths": [ + 17, + 1, + 3, + 11 + ] + }, + { + "coefficient": "1/125", + "lower": [ + 31200, + 5070, + 66300, + 17420 + ], + "observed": [ + 33079, + 5669, + 70733, + 18752 + ], + "rows_in_table": 171204, + "widths": [ + 65, + 65 + ] + }, + { + "coefficient": "-14729531/163840", + "lower": [ + 1228, + 180, + 2652, + 710 + ], + "observed": [ + 11607, + 4451, + 30749, + 9726 + ], + "rows_in_table": 100033, + "widths": [ + 1, + 1 + ] + }, + { + "coefficient": "-14729531/163840", + "lower": [ + 3684, + 540, + 7956, + 2130 + ], + "observed": [ + 14063, + 4811, + 36053, + 11146 + ], + "rows_in_table": 100033, + "widths": [ + 2, + 4 + ] + }, + { + "coefficient": "-14729531/163840", + "lower": [ + 19648, + 2880, + 42432, + 11360 + ], + "observed": [ + 40343, + 11405, + 98549, + 29380 + ], + "rows_in_table": 100033, + "widths": [ + 17, + 1, + 3, + 11 + ] + }, + { + "coefficient": "-14729531/163840", + "lower": [ + 79820, + 11700, + 172380, + 46150 + ], + "observed": [ + 90199, + 15971, + 200477, + 55166 + ], + "rows_in_table": 100033, + "widths": [ + 65, + 65 + ] + }, + { + "coefficient": "-1379/250", + "lower": [ + 656, + 102, + 1404, + 372 + ], + "observed": [ + 3911, + 1253, + 9533, + 2888 + ], + "rows_in_table": 187806, + "widths": [ + 1, + 1 + ] + }, + { + "coefficient": "-1379/250", + "lower": [ + 1968, + 306, + 4212, + 1116 + ], + "observed": [ + 5223, + 1457, + 12341, + 3632 + ], + "rows_in_table": 187806, + "widths": [ + 2, + 4 + ] + }, + { + "coefficient": "-1379/250", + "lower": [ + 10496, + 1632, + 22464, + 5952 + ], + "observed": [ + 16943, + 3917, + 38645, + 10972 + ], + "rows_in_table": 187806, + "widths": [ + 17, + 1, + 3, + 11 + ] + }, + { + "coefficient": "-1379/250", + "lower": [ + 42640, + 6630, + 91260, + 24180 + ], + "observed": [ + 45895, + 7781, + 99389, + 26696 + ], + "rows_in_table": 187806, + "widths": [ + 65, + 65 + ] + }, + { + "coefficient": "1085645/393216", + "lower": [ + 1096, + 162, + 2364, + 632 + ], + "observed": [ + 9471, + 3533, + 24773, + 7788 + ], + "rows_in_table": 76560, + "widths": [ + 1, + 1 + ] + }, + { + "coefficient": "1085645/393216", + "lower": [ + 3288, + 486, + 7092, + 1896 + ], + "observed": [ + 11663, + 3857, + 29501, + 9052 + ], + "rows_in_table": 76560, + "widths": [ + 2, + 4 + ] + }, + { + "coefficient": "1085645/393216", + "lower": [ + 17536, + 2592, + 37824, + 10112 + ], + "observed": [ + 34223, + 9317, + 82565, + 24412 + ], + "rows_in_table": 76560, + "widths": [ + 17, + 1, + 3, + 11 + ] + }, + { + "coefficient": "1085645/393216", + "lower": [ + 71240, + 10530, + 153660, + 41080 + ], + "observed": [ + 79615, + 13901, + 176069, + 48236 + ], + "rows_in_table": 76560, + "widths": [ + 65, + 65 + ] + } + ], + "primitive_units": { + "move_left": [ + 1, + 0, + 3 + ], + "move_right": [ + 1, + 0, + 3 + ], + "read": [ + 4, + 0, + 6 + ], + "write": [ + 0, + 3, + 6 + ] + }, + "scope": "Small literal hardware checks supporting the symbolic all-width pass proof; no whole word replay." +} diff --git a/research/literal-tariff-conversion-audit/OVERLAP.md b/research/literal-tariff-conversion-audit/OVERLAP.md new file mode 100644 index 0000000000..23641f3e08 --- /dev/null +++ b/research/literal-tariff-conversion-audit/OVERLAP.md @@ -0,0 +1,30 @@ +# Bounded overlap and scope selection + +The lead assigned wave 10 as a complementary audit of the new literal +kernels against the exact proposed caller's inherited cost model. +Canonical base remains 7c49fe32; exact source heads and publication pins +are in DEPENDENCIES and PROOF. The lead's latest upstream refresh found +no replacement for #6936/#6937; #6936's later head changes only timeout. +No external post or placeholder claim was opened by this worker. + +Read the QUERY-only invoice/proof at 6179034, precision guards/proof at +56bc938, compact ADD proof/table at 38cd824, lifecycle machine at ab239cb, +rounded-scalar lineage 6476455 and global LAMBDA proof/source at 591394d8. +Read #6937 ROUNDED-DIVISION section 7, the retained #6936 physical ordinary +formulas, and canonical 02-streams, 05-layers and FINITE-PRECOMPILATION. + +The missing-conversion warning was already explicit in those sources and +is not novel. The compact proof gave an upper bound and a few ordinary +position examples. It did not give the componentwise mandatory lower +vector, its 1,098,936-occurrence source sum, the full released ADD credit, +or the exact necessary converter threshold derived here. Its quotient +example understated an ordinary position by one move; the stated slack +upper bound remains valid, so this audit does not claim a failed proof. + +No new coefficient search, table implementation, complete ADD catalogue, +COPY lowering, LAMBDA/whole-MOVE run, endpoint identity or single-QSELF +determinant argument was attempted. Native and analytic workers' scopes +are unchanged. One evidence-driven narrowing was approved by the lead: +without a supplied numeric unit bridge, give a quantitative necessary +condition and conditional fixed-ledger obstruction rather than claiming +an absolute cap obstruction. diff --git a/research/literal-tariff-conversion-audit/PR-DESCRIPTION.md b/research/literal-tariff-conversion-audit/PR-DESCRIPTION.md new file mode 100644 index 0000000000..5a788d31f9 --- /dev/null +++ b/research/literal-tariff-conversion-audit/PR-DESCRIPTION.md @@ -0,0 +1,94 @@ +## Summary + +The proposed QUERY-only caller has a conditional 843,431,488-unit ordinary +invoice after its rounded-precision surcharge. The new literal arithmetic +kernels have physical tape/flat-table bills. The source already warns +that those units have not been numerically connected. + +This package sharpens that obligation with an all-width mandatory lower +cost vector for the actual compact ADD constructor, an exact source +census, maximal legitimate released ADD credit, and a necessary numeric +conversion threshold. **No new kappa, physical supplier admission or +unconditional runtime/cap obstruction is claimed.** + +## Exact result + +For reduced coefficient a/b, let L=max(bitlength(|a|),bitlength(b)) and +delta=[oddpart(b)>1]. Every successful retained compact ADD on B public +numeric data bits requires at least B*(250+73L+28delta) raw physical +reads/writes/moves. With fetched flat rows, the lower bill is +B*(288+86L+33delta). Initialization, mandatory Horner rewinds, staging, +installation, head returns and current private-body retirement are +included; omitted setup/extra-width/history costs are nonnegative. + +The actual local source has 61,052 ADDs, sum L=167,955 and 4,079 odd ADDs. +At 18 joint contacts, a direct full ADD substitution has mandatory bills +497,482,686B raw or 578,910,834B with rows, assuming equal comparison volumes. +The separate COPY is excluded, and this audit does not install a complete +source registry or build all 4,462 coefficient tables. + +Removing every old ADD and ADD-rounding charge releases 47,484,288. The +rest of the frozen model costs 795,947,200, leaving 204,052,800 for the +replacement ADD services. A converter permitting rho raw actions per +tariff unit per comparison data bit therefore necessarily requires +rho>=82913781/34008800. With flat rows included it requires +rho>=96485139/34008800. + +At explicitly assumed equal units rho=1, the fixed replacement ledger +already has lower endpoint 1,293,429,886 (raw) or 1,374,858,034 (with rows). +This rules out that numeric substitution certificate. It does not prove +the actual full program exceeds the cap: other entries remain inherited +upper/model charges, and neither the canonical O(V) lemmas nor the source +defines rho=1. Different implementations, repricing or conversions remain +possible. A concrete common-volume/clock bridge and complete upper bill +are still required. + +## Source pins and novelty + +Canonical base: `7c49fe32c55de02c2c873655c804b16e4c3fef0a`. +DreamingOfClouds' CrocSwap/integer-mult-bounds#6936 word is pinned at tested +head `03626137d0bd57f09b0bf9597376183ce6fa9683`; later head d360b118 changes +only VERIFY timeout. The QUERY-only caller is public 6179034, from +CrocSwap/integer-mult-bounds#6937 at a98df73; precision is 56bc938; compact +ADD is 38cd824; lifecycle is ab239cb; rounded SCALE is 6476455; global LAMBDA +is 591394d8. Full SHAs, paths, Git blobs and SHA256s are recorded locally. + +The existing warning that tariff conversion is owed is credited, not +claimed new. New contributions are the universal forced-pass vector, +its exact source-weighted sum and the necessary replacement inequality. +The proof also corrects an illustrative quotient-position count 64 versus +59 in the compact predecessor; that predecessor's slack 128U phase upper +bound remains valid. + +## Reproduction and checks + +```bash +python3 -I -B research/literal-tariff-conversion-audit/verify.py --suite all +python3 -I -O -B research/literal-tariff-conversion-audit/verify.py --suite all +``` + +Expected: three PASS_LITERAL_TARIFF_* markers. 19 authenticated immutable +dependencies; standard library; no runtime Git/network/solver. + +The checker independently reconstructs both full model invoices and the +complete source ADD multiplicities. 36 unchanged-executor zero cases use +independent hardware meters, heterogeneous widths through 65, all three +actual maximal-coefficient witnesses, dirty/displaced work, public/source +preservation and cleanup. Nine exact width-increment controls isolate +the symbolic coefficient. Controls detect COPY contamination, omitted +18-fold expansion, omitted residue rewinds, wrong coded-read units and +the fourth quotient move. Finite checks support the control-flow proof; +no full numerical caller is replayed. + +## Limitations and credit + +Global foundational assumptions remain premises, and the selected +certificate is unchanged. All LAMBDA/native/SCALE/compiler, rounding, +source access, owned history and recursive costs still need a complete +physical upper invoice. No improvement in accepted kappa is asserted. + +Prepared for **@CubeJerry**, with substantial **OpenAI assistance**. +Credit DreamingOfClouds' CrocSwap/integer-mult-bounds#6936 and CrocSwap/integer-mult-bounds#6937, the +canonical stream/finite-precompilation authors, and the originating +CubeJerry lifecycle, compact ADD, QUERY-only, precision and rounded +service packages. Separate AI review is not human or proof-kernel acceptance. diff --git a/research/literal-tariff-conversion-audit/PROOF.md b/research/literal-tariff-conversion-audit/PROOF.md new file mode 100644 index 0000000000..af5a4ac8c3 --- /dev/null +++ b/research/literal-tariff-conversion-audit/PROOF.md @@ -0,0 +1,293 @@ +# A source-specific literal cost vector and tariff conversion boundary + +Prepared for @CubeJerry with substantial OpenAI assistance. This is a +conditional implementation-cost audit. No new kappa, physical supplier +admission, or multiplication lower bound is claimed. + +## 1. Result and exact scope + +Fix the published compact rounded ADD constructor at CubeJerry commit +`38cd824c60f2bb5c6f2603f848a9487cb3a57965`, executed by the unchanged +lifecycle machine at `ab239cb6ee884e7a900dd9101c34448077fad0b0`. Let the +coefficient be reduced a/b, b>0, oddpart(b)<=125, and let + + L = max(bitlength(abs(a)), bitlength(b)), + delta = 1 if oddpart(b)>1, otherwise 0. + +For each successful invocation on matching positive component widths w_i, +put B=sum_i w_i. B counts public numeric data bits in ONE field: it excludes +numeric delimiters, the three-bit physical code expansion and all private +copies. The component count is positive and even. The data/grid/alias/head/ +frontier premises are precisely those of the retained compact theorem. + +In the physical metric of that actual implementation, the invocation makes +at least the following vector of operations: + + physical reads >= B*(76 + 22L + 10 delta), + physical writes >= B*(18 + 3L), + physical unit moves >= B*(156 + 48L + 18 delta), + executed flat rows >= B*(38 + 13L + 5 delta). + +Thus raw reads+writes+moves are at least B*(250+73L+28 delta). +Including executed flat rows gives B*(288+86L+33 delta). These are lower +bounds, not estimates obtained from a slack implementation upper bound. +They hold for every successful admitted input. In particular, the all-zero +input is successful at every positive width: all Horner prefixes are zero, +the rounding offset satisfies 0<=floor(b/2)1 | 10 | 0 | 18 | 5 | +| Quotient staging | 16 | 3 | 36 | 9 | +| Whole-field reverse scan | 8 | 0 | 18 | 6 | +| Final installation | 6 | 3 | 18 | 5 | +| Two long executor head returns | 6 | 0 | 6 | 0 | +| Retirement of two current private bodies | 12 | 6 | 12 | 0 | + +For example, a Horner bit uses three coded reads, one write, three moves +and one goto: (15,3,33,8). Its required public/numerator rewind uses three +moves, one read and one goto: (7,0,15,5). Their sum is (22,3,48,13). +There are exactly L such passes, including leading zero coefficient bits +in either member of the fixed pair. Each pass visits every public bit. + +Quotient staging uses three reads, one write and FOUR moves: numerator, +output, target and source. It therefore costs (16,3,36,9), or 55 physical +actions and 64 actions-plus-rows per ordinary bit. The predecessor proof's +illustrative sentence giving 59 for this particular phase omitted that +fourth move. Its deliberately slack 128U phase upper bound is unaffected; +this audit does not infer that the predecessor cost theorem fails. + +Initialization and its rewind contribute (18,3,42,12). The offset has a +single numerator read/write/advance and a one-tape rewind, giving +(10,3,24,6). An odd-residue traversal and rewind use no writes, giving +(10,0,18,5). The global reverse uses the numerator guide to move all three +other heads left once per public bit. Installation reads staged output, +writes the target and advances both heads. These yield the two indicated +rows directly. Delimiters, markers, extra K=L+2 numerator positions, +quotient low-bit drops, terminal guards and all phase transitions add +nonnegative work and are omitted from this lower bound. + +At final halt, both target and staged-output heads are at physical distance +3S, where S=sum_i(w_i+1), from their origins. The other heads are already +at their origins. The unchanged execute_table must return those two heads: +each origin operation makes at least 3S reads and 3S moves. Since S>=B, +the contribution is at least (6B,0,6B,0). + +The numerator body has length 3U with U=1+S+(K+1)R, and the output body has +length 3S. They are contiguous physical binary bodies, even where their +logical symbols encode blanks. A successful retire at an origin reads at +least twice the body's length, writes each physical cell once and moves +at least twice the body's length. Since U>=S>=B, both retirements together +contribute at least (12B,6B,12B,0). Entry retirement of arbitrary old bodies, +historically longer capacities, contexts, shape preparation, static table +construction and other wrappers are positive omitted costs. The bound +does not assert that any of them vanish or that allocated capacity shrinks. + +Summing the table, repeating Horner L times and residue delta times, proves +the four inequalities in section 1 for arbitrary matching widths. No +finite-width extrapolation or operation-time measurement enters the proof. + +## 4. Exact complete source census and maximal ADD credit + +The checker independently reconstructs the frozen source formula, including +the 18 local words, all outer ports, all main/idle/query maps, the second +LAMBDA charge, and the retained 1125 conversions. It obtains 826,265,904. +It independently adds the precision model's 17,165,584 to recover +843,431,488. These are arithmetic identities in the stated model. + +For an ADD with a=abs(numerator), b=denominator, the existing per-call +reviewed charge is 4(bitlength(a)+popcount(a)+bitlength(b)+1). Its rounded +offset/residue surcharge is zero for b=1 and otherwise +4(bitlength(b)+1)*(1+3*[oddpart(b)>1]). Summing ONLY the 61,052 ADDs gives + +| Existing term | One local word | All 18 words | +|---|---:|---:| +| Reviewed ADD tariff | 1,717,220 | 30,909,960 | +| ADD rounding surcharge | 920,796 | 16,574,328 | +| Total removable ADD credit | 2,638,016 | 47,484,288 | + +This credit is fully removed when substituting a new complete ADD charge; +there is no double billing of old and new ADD costs. The untouched +conditional invoice is therefore 795,947,200, leaving 204,052,800 below +10^9 for replacement ADD work. This is more generous than comparing the +new ADD cost with the old 156,568,512 margin alone. + +The exact source sum of the universal vectors gives the section 1 numbers. +It excludes COPY, all 3,660 local SCALEs per word, all native MOVEs and +owned administrative operations, and the outer 54,352 ADDs, 8,480 SCALEs, +14,480 LAMBDAs, 35,672 SWAPs and 416 QUERY lifetimes. Those terms remain in +the old invoice for the next conditional comparison; no claim is made +that those old tariffs have been physically verified. + +## 5. Necessary conversion condition, not a full-runtime obstruction + +Define rho>0 by the following proposed conversion contract: a tariff +allocation u, on a comparison volume B, permits at most rho*u*B physical +reads+writes+moves of the chosen implementation. This explicitly fixes +the volume convention as well as the operation metric. If another +comparison volume, f-dependent factor, simulator constant, simultaneous +multi-tape clock or delimiter convention is intended, it must be supplied +and folded into rho or into the individual event volumes. The source +does not currently supply this contract with a numeric rho. + +Consider the specific replacement certificate that keeps every other +existing invoice term and gives all the released ADD credit plus remaining +slack to the direct compact implementation. A necessary condition is + + rho >= 497482686 / 204052800 + = 82913781 / 34008800. + +If the tariff must also pay one extra unit for each fetched flat row in +the same metric, the necessary condition becomes + + rho >= 578910834 / 204052800 + = 96485139 / 34008800. + +Under the explicit equal-unit proposal rho=1, this fixed replacement +ledger has lower endpoints 1,293,429,886 or 1,374,858,034, respectively, +both above 10^9. That is an obstruction to THIS numeric substitution +certificate under THAT conversion. It is not a lower bound on the full +program's actual runtime: the retained 795,947,200 consists of inherited +upper/model charges, not lower bounds. Repricing other work more sharply, +changing the implementation, fusing services, specializing small scalars, +or proving a different conversion is outside this certificate. In +particular rho=3 passes this necessary lower-bound screen; that fact is +not a sufficient upper-cost admission. + +More generally, if a converter prices the vector with nonnegative weights +(c_r,c_w,c_m,c_u), the necessary left side is + + 150763536*c_r + 28850418*c_w + + 317868732*c_m + 81428148*c_u. + +It must be at most the replacement allocation in the corresponding +normalized units. This exposes the exact quantitative obligation rather +than assuming that unlike counters have equal units. + +## 6. Evidence, limitations and next obligation + +`verify.py` authenticates 19 immutable dependencies, recomputes all source +counts and both complete model invoices, and exercises the unchanged table +executor on 36 all-zero cases. The cases include heterogeneous widths, +width1, width65, both signs, even/odd denominators, three actual maximal +coefficient witnesses, and dirty displaced private banks. An independent +hardware meter checks each vector coordinate against the proved lower +bound and checks output/source preservation and cleanup. The numerical +tests corroborate the control-flow proof; they do not replace it. Small +primitive probes independently distinguish the actual 10-action coded +read from a three-read shortcut. Accounting controls distinguish omitted +18-fold expansion, COPY contamination, residue rewinds and the fourth +quotient move. No complete numerical caller is executed. + +The original warning about the tariff unit is not novel. The new result +is the all-width forced pass vector, its exact 1,098,936-occurrence source +sum, the maximal legitimate released credit and the resulting necessary +conversion inequality. The weakest next useful proof is a concrete common +volume and machine-clock conversion with a certified complete upper bill, +including native routing, all rounded services, source/shape work, setup, +head returns, cleanup, old backing and simultaneous recursive ancestors. +Only then can the displayed ordinary cap be accepted or rejected for an +actual complete implementation. All five foundational assumptions remain +global premises, the selected certificate is unchanged, and no new kappa +is claimed. + +Credit DreamingOfClouds' #6936/#6937 source and tariff qualifications; +CubeJerry's lifecycle, scalar, compact ADD, QUERY-only, precision and +global LAMBDA packages; and the canonical stream/finite-precompilation +authors. The counting principle is elementary. Separate AI review, when +recorded, is not human or proof-kernel acceptance. diff --git a/research/literal-tariff-conversion-audit/README.md b/research/literal-tariff-conversion-audit/README.md new file mode 100644 index 0000000000..b7345a828f --- /dev/null +++ b/research/literal-tariff-conversion-audit/README.md @@ -0,0 +1,78 @@ +# Literal tariff conversion audit + +**Result:** an all-width mandatory cost vector for the actual compact +rounded ADD kernel, its exact sum over the proposed QUERY-only source, +and a necessary numeric conversion condition. **No new kappa and no +unconditional physical tariff obstruction.** + +For coefficient a/b, put L=max(bitlength(|a|),bitlength(b)) and let delta +indicate an odd denominator. On B public numeric data bits, every +successful retained compact ADD must perform at least + + B * (250 + 73L + 28 delta) + +physical reads/writes/unit moves. Including fetched flat table rows gives +B*(288+86L+33 delta). The proof counts mandatory initialization, L Horner +passes and their rewinds, offset and residue scans, quotient staging, +installation, head returns and two current-body retirements. Zero inputs +provide valid witnesses at every positive width. Extra width, delimiters, +setup, contexts and old backing add nonnegative omitted work. + +The exact local source has 61,052 ADDs, sum L=167,955 and 4,079 odd ADDs, +used at 18 joint contacts. A direct full ADD substitution therefore has a +lower bill of **497,482,686 B raw actions**, or **578,910,834 B including +flat rows**, when the per-field comparison volumes agree. A separate COPY +is excluded. No new full source registry is installed here. + +The frozen precision model totals 843,431,488. Removing ALL the existing +ADD charges releases 47,484,288, so retaining the rest of that invoice +leaves 204,052,800 for replacement ADD work. If a proposed converter says +one tariff unit pays rho raw actions per comparison data bit, it necessarily +requires + + rho >= 82913781 / 34008800. + +The corresponding raw-plus-flat-row requirement is 96485139/34008800. +Equal units (rho=1) cannot support this specific replacement ledger. This +does not prove the full program exceeds the cap: other retained entries +are model/upper charges, and the source does not assert rho=1. A different +converter, implementation, volume convention or repricing needs its own +proof. The original source's warning about the missing converter is +credited; the universal forced-pass vector and exact replacement condition +are the new contribution. + +## Reproduction + +```bash +python3 -I -B research/literal-tariff-conversion-audit/verify.py --suite all +python3 -I -O -B research/literal-tariff-conversion-audit/verify.py --suite all +``` + +Expected: `PASS_LITERAL_TARIFF_SOURCE`, `PASS_LITERAL_TARIFF_LOWER_VECTOR`, +and `PASS_LITERAL_TARIFF_CONTROLS`. Standard library only; runtime needs +no Git, network or solver. The 36 small literal cases use the unchanged +executor, independent hardware counters, heterogeneous widths, the three +actual maximal coefficient witnesses, dirty scratch and exact source +preservation/cleanup. Nine width-increment checks isolate the proved +coefficient. No complete numerical word is run. + +See [PROOF.md](PROOF.md) for the vector proof, units, exact provenance, +limitations and necessary conversion inequality; [SOURCE.json](SOURCE.json) +for the full census; and [LITERAL.json](LITERAL.json) for the bounded +physical evidence. All 19 unchanged dependencies are authenticated. + +## Open next questions + +Supply the exact caller volume and machine-clock conversion, then a +complete upper bill for all arithmetic, native routing, owned banks, +setup/metadata, history and recursive ancestors. This audit leaves the +global five foundational assumptions and selected certificate unchanged. + +## Credit + +Prepared for **@CubeJerry** with substantial **OpenAI assistance**. +Credit DreamingOfClouds' CrocSwap/integer-mult-bounds#6936 and +CrocSwap/integer-mult-bounds#6937; the canonical stream and finite +precompilation authors; and CubeJerry's compact ADD, lifecycle, QUERY-only, +precision, rounded SCALE and global LAMBDA packages. This is an explicitly +complementary cost audit, not another arithmetic implementation. diff --git a/research/literal-tariff-conversion-audit/REVIEW.md b/research/literal-tariff-conversion-audit/REVIEW.md new file mode 100644 index 0000000000..3be275c389 --- /dev/null +++ b/research/literal-tariff-conversion-audit/REVIEW.md @@ -0,0 +1,42 @@ +# Separate review evidence + +The lead performed a separate Fraction coefficient-histogram census and +replayed the immutable predecessor invoice, rather than importing the +new audit reconstruction. It confirmed the exact ADD counts, aggregate +vector arithmetic, released credit, retained invoice, headroom and both +necessary exchange fractions. Four accounting controls distinguish +omitted replication, COPY contamination, omitted rows and failure to +release the old ADD credit. The unchanged runner and receipt are in +`review/tariff-lead-check.py` and `review/tariff-lead-review.json`. + +The lead reviewed the explicit hypothetical equal-volume converter and +the restriction to a fixed replacement ledger. The proof and audit hashes +in its receipt match the current files. Its receipt was written before +the complementary vector review and records that separate obligation. + +The native-physical agent subsequently completed that review: PASS, with +no blocking issue. The unchanged notes, AST checker and receipt are in +`review/native/`. It derives the vector directly from the frozen compact +constructor, lifecycle machine and Builder; it does not read/import +`audit.py`, execute a numerical table or replay the whole word. Its +separate traversal and lifecycle proof covers all positive widths, +all-zero success, head returns, retirement and omitted-cost signs. +Deleting the quotient numerator move changes the derived vector and is +detected. The checker is scoped AST accounting with stated manual +premises, not a general Python cost verifier. + +For a standalone review replay, from this package directory run: + +```bash +python3 -I -B review/tariff-lead-check.py . --output /tmp/tariff-lead-review.json +python3 -I -B review/native/independent_vector.py . --output /tmp/tariff-native-review.json +``` + +The first prints a status-pass JSON receipt; the second prints +`PASS_STATIC_INDEPENDENT_VECTOR` in its JSON status. Both have been +executed independently. The export check also replays them with empty +PATH, keeping outputs outside the frozen package. + +These are separate model-assisted checks with shared pinned sources, +not human review, independent experimental data, proof-kernel acceptance, +or a complete physical caller admission. diff --git a/research/literal-tariff-conversion-audit/SOURCE.json b/research/literal-tariff-conversion-audit/SOURCE.json new file mode 100644 index 0000000000..fe261552e7 --- /dev/null +++ b/research/literal-tariff-conversion-audit/SOURCE.json @@ -0,0 +1,96 @@ +{ + "baseline": 826265904, + "caller_events": 3095, + "coefficient_length_histogram": { + "1": 25148, + "2": 19313, + "3": 6350, + "4": 2629, + "5": 1392, + "6": 932, + "7": 693, + "8": 633, + "9": 542, + "10": 493, + "11": 405, + "12": 485, + "13": 450, + "14": 297, + "15": 339, + "16": 247, + "17": 239, + "18": 178, + "19": 103, + "20": 107, + "21": 54, + "22": 10, + "23": 10, + "24": 3 + }, + "coefficient_length_sum": 167955, + "combined_equal_unit_replacement_lower": 1374858034, + "kappa_status": "No new kappa; no physical cap or full-caller impossibility claim.", + "native_ADD_count": 61052, + "native_contacts": 18, + "native_events": 71144, + "native_extra_model": 941128, + "native_opcode_counts": { + "ADD": 61052, + "CLEAR": 54, + "COPY": 1, + "INIT": 54, + "MOVE": 6323, + "SCALE": 3660 + }, + "native_routes_model": 9861000, + "native_scalar_model": 1774872, + "odd_ADD_count": 4079, + "old_ADD_offset_tariff_per_native_call": 920796, + "old_ADD_tariff_per_native_call": 1717220, + "optimistic_complete": 843431488, + "optimistic_extra": 17165584, + "outer_physical_opcode_counts": { + "ADD": 54352, + "IDLE_ONE": 3616, + "LAMBDA": 14480, + "QUERY": 416, + "SCALE": 8480, + "SWAP": 35672 + }, + "physical_lower_vector_per_common_data_bit": { + "moves": 317868732, + "reads": 150763536, + "rows": 81428148, + "writes": 28850418 + }, + "proposed_full_ADD_dispatch_count": 1098936, + "raw_action_lower": 497482686, + "raw_equal_unit_replacement_lower": 1293429886, + "raw_plus_rows_lower": 578910834, + "raw_plus_rows_required_exchange_rate": "96485139/34008800", + "raw_required_exchange_rate": "82913781/34008800", + "registry_status": "Hypothetical direct compact-table substitution at all ADD sites; predecessor installs only three source tokens.", + "removed_ADD_credit": 47484288, + "replacement_headroom": 204052800, + "retained_other_invoice": 795947200, + "separate_COPY": [ + [ + "COPY", + 1485, + 770, + "1", + 115 + ] + ], + "source_model_terms": { + "caller_envelope": 144567808, + "idle_maps": 205536000, + "lambda_recharge": 14480000, + "main_maps": 248144000, + "main_normalizers": 102752, + "query_maps": 1248000, + "thin_lifecycle": 6656 + }, + "unit_status": "No numeric tape-action/flat-row-to-tariff converter is asserted by the sources.", + "volume_status": "The aggregate coefficient assumes equal per-field data-bit volume; otherwise sum the per-event weighted volumes." +} diff --git a/research/literal-tariff-conversion-audit/SOURCES.json b/research/literal-tariff-conversion-audit/SOURCES.json new file mode 100644 index 0000000000..75ea7c3d55 --- /dev/null +++ b/research/literal-tariff-conversion-audit/SOURCES.json @@ -0,0 +1,18 @@ +{ + "schema_version": 1, + "base_commit": "7c49fe32c55de02c2c873655c804b16e4c3fef0a", + "files": [ + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "3404fbdd5e7529a0674eef26114b5071e4586cec", + "sha256": "ead6cdc9d0af6d58e8a49744d8ec8c7c15e13d2ba93c276c434bcf9b51b93a81" + }, + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "d59b5035e7b4cbaa9d688a1d32dd0d6eb79c466a", + "sha256": "9b8d0eea95b3bf0dfcb7938a732a6439b87a2685dec2a5ab9e525b3b34debbfa" + } + ] +} diff --git a/research/literal-tariff-conversion-audit/TASK.json b/research/literal-tariff-conversion-audit/TASK.json new file mode 100644 index 0000000000..5c23c8282f --- /dev/null +++ b/research/literal-tariff-conversion-audit/TASK.json @@ -0,0 +1,87 @@ +{ + "schema_version": 1, + "task_id": "uniform-transfer-audit", + "base_commit": "7c49fe32c55de02c2c873655c804b16e4c3fef0a", + "original_card": { + "id": "uniform-transfer-audit", + "question": "Can one of the selected record's five inherited assumptions be proved at its actual caller?", + "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" + ], + "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": "Identify the proposition and what would change downstream; do not equate a finite replay with a universal proof.", + "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": "Choose one assumption ID (native_all_columns, owned_erasure, compiler, precision_tape, analytic_recovery), one quantified implication and exact dependency closure. Check current handoffs, including #5625 row reentry and #5707 root-prefix lowering, without treating their partial scope as the whole theorem. Prove or falsify that implication with a caller-bound argument; stop at the chosen obligation. Finite tests or root digits do not discharge an all-size statement.", + "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": [ + "native_all_columns", + "owned_erasure", + "compiler", + "precision_tape", + "analytic_recovery" + ], + "existing_checks": [ + { + "scope": "PR #4100: proposed unconditional construction and finite checks, without independent acceptance.", + "evidence": "research/unconditional-batched-crt/README.md", + "remaining": "Independent proof audit of one caller-bound all-size implication; all other premises remain explicit.", + "status": "author-checked", + "source_commit": "337d04939571a637aeab54a0f58f54fde811663a", + "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", + "scope_change_reason": "Lead wave10 audits the actual literal kernel cost against the current inherited caller tariff; missing conversion forces a quantitative necessary-condition scope.", + "actual_scope": "Universal compact-ADD mandatory cost vector, exact source sum and maximal released credit; necessary fixed-ledger conversion condition with explicit volume/metric premises.", + "bottleneck_link": "Makes the compiler/precision_tape numeric substitution obligation explicit without equating unlike units or inferring a runtime lower bound from retained upper charges.", + "stop_rule": "Stop at the exact direct-ADD substitution and cost bridge. No full table catalogue, COPY, whole numerical source run, new kernel or kappa.", + "evidence": "PROOF.md; SOURCE.json independent complete model reconstruction; 36 literal cases and nine width-increment controls; authenticated source bytes.", + "author": "@CubeJerry", + "ai_assistance": "Substantial OpenAI assistance in proof, implementation, source analysis and testing; separate AI review is not independent human or proof-kernel acceptance.", + "outcome": "completed", + "open_questions": [ + { + "question": "Supply the common volume and exact physical-to-tariff conversion.", + "why_it_matters": "The published scalar/pass invoice and tape/row action metric currently lack a numeric bridge.", + "first_step": "State the simulator clock, fixed costs and volume convention; prove the corresponding rho contract.", + "blocked_by": "No asserted numeric conversion in the inherited source." + }, + { + "question": "Produce a complete replacement upper invoice.", + "why_it_matters": "The new lower vector is necessary but cannot certify upper admission.", + "first_step": "Reprice native routing, all arithmetic, source access, setup, owned history and recursive ancestors with the same conversion.", + "blocked_by": "Incomplete physical caller registry and retained global assumptions." + } + ] +} diff --git a/research/literal-tariff-conversion-audit/VERIFY.json b/research/literal-tariff-conversion-audit/VERIFY.json new file mode 100644 index 0000000000..7bd809671b --- /dev/null +++ b/research/literal-tariff-conversion-audit/VERIFY.json @@ -0,0 +1,79 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/literal-tariff-conversion-audit/data/word.json.gz", + "research/literal-tariff-conversion-audit/data/caller.json", + "research/literal-tariff-conversion-audit/kernel/compact_tables.py", + "research/literal-tariff-conversion-audit/kernel/exact_builder.py", + "research/literal-tariff-conversion-audit/kernel/machine.py", + "research/literal-tariff-conversion-audit/reference/COMPACT-PROOF.md", + "research/literal-tariff-conversion-audit/reference/QUERY-PROOF.md", + "research/literal-tariff-conversion-audit/reference/query_invoice.py", + "research/literal-tariff-conversion-audit/reference/owned_invoice.py", + "research/literal-tariff-conversion-audit/reference/PRECISION-PROOF.md", + "research/literal-tariff-conversion-audit/reference/precision_guards.py", + "research/literal-tariff-conversion-audit/reference/PRECISION-GUARDS.json", + "research/literal-tariff-conversion-audit/reference/LAMBDA-PROOF.md", + "research/literal-tariff-conversion-audit/reference/LAMBDA-SOURCE.json", + "research/literal-tariff-conversion-audit/reference/ROUNDED-DIVISION-6937.md", + "research/literal-tariff-conversion-audit/reference/FINITE-PRECOMPILATION.md", + "research/literal-tariff-conversion-audit/reference/physical_review_6936.py", + "research/literal-tariff-conversion-audit/reference/02-streams.tex", + "research/literal-tariff-conversion-audit/reference/05-layers.tex" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "research/literal-tariff-conversion-audit/verify.py", + "--suite", + "source" + ], + "timeout_seconds": 120, + "checks": "Normal exact source/cost conversion audit: source" + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "research/literal-tariff-conversion-audit/verify.py", + "--suite", + "literal" + ], + "timeout_seconds": 120, + "checks": "Normal exact source/cost conversion audit: literal" + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "research/literal-tariff-conversion-audit/verify.py", + "--suite", + "source" + ], + "timeout_seconds": 120, + "checks": "Optimized exact source/cost conversion audit: source" + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "research/literal-tariff-conversion-audit/verify.py", + "--suite", + "literal" + ], + "timeout_seconds": 120, + "checks": "Optimized exact source/cost conversion audit: literal" + } + ] +} diff --git a/research/literal-tariff-conversion-audit/audit.py b/research/literal-tariff-conversion-audit/audit.py new file mode 100644 index 0000000000..10e97eca4c --- /dev/null +++ b/research/literal-tariff-conversion-audit/audit.py @@ -0,0 +1,148 @@ +"""Exact source census and mandatory cost-vector lower bound. + +The source tariff is deliberately not equated with this physical metric. +Prepared for @CubeJerry with substantial OpenAI assistance. Apache-2.0. +""" +from collections import Counter +from fractions import Fraction +import gzip +import json +from source_binding import ROOT, need + +# (physical reads, physical writes, physical unit moves, executed flat rows) +# Each entry is the mandatory contribution per ordinary public data bit. +PHASES = { + 'initialize_and_reset': (18, 3, 42, 12), + 'one_Horner_and_reset': (22, 3, 48, 13), + 'offset_and_rewind': (10, 3, 24, 6), + 'odd_residue_and_rewind': (10, 0, 18, 5), + 'quotient_stage': (16, 3, 36, 9), + 'global_reverse': (8, 0, 18, 6), + 'installation': (6, 3, 18, 5), + 'executor_head_returns': (6, 0, 6, 0), + 'two_current_body_retirements': (12, 6, 12, 0), +} + + +def coefficient_shape(q): + q = Fraction(q) + a, b = abs(q.numerator), q.denominator + odd = b + while odd % 2 == 0: + odd //= 2 + return a, b, max(a.bit_length(), b.bit_length()), odd + + +def lower_vector(coefficient): + _, _, length, odd = coefficient_shape(coefficient) + return tuple(sum(v[j] * (length if k == 'one_Horner_and_reset' else + int(odd > 1) if k == 'odd_residue_and_rewind' else 1) + for k, v in PHASES.items()) for j in range(4)) + + +def rounded_surcharge(q): + _, b, _, odd = coefficient_shape(q) + return 0 if b == 1 else 4 * (b.bit_length() + 1) * (1 + 3 * int(odd > 1)) + + +def exchange_count(axes): + return len(set(axes) - set(range(len(axes)))) + + +def inspect_sources(): + word = json.loads(gzip.decompress((ROOT / 'data/word.json.gz').read_bytes())) + caller = json.loads((ROOT / 'data/caller.json').read_text()) + program = word['program'] + native_counts = Counter(e[0] for e in program) + joints = [e for e in caller['events'] if e[0] == 'J'] + need([e[1] for e in joints] == list(range(1, 19)), 'exact 18 native contacts') + need(len(program) == 71144 and len(caller['events']) == 3095, 'frozen source lengths') + add = [e for e in program if e[0] == 'ADD'] + copies = [e for e in program if e[0] == 'COPY'] + need(copies == [['COPY', 1485, 770, '1', 115]], 'COPY kept separate') + shapes = [coefficient_shape(e[3]) for e in add] + lengths = Counter(s[2] for s in shapes) + total = [sum(lower_vector(e[3])[j] for e in add) * len(joints) for j in range(4)] + old_add_per_call = sum(4 * (a.bit_length() + a.bit_count() + b.bit_length() + 1) + for a, b, _, _ in shapes) + offset_add_per_call = sum(rounded_surcharge(e[3]) for e in add) + + # Independently reconstruct the entire frozen invoice. These are the + # predecessor's scalar/pass formulas; none is presented as a physical rate. + reviewed_scalars = 0 + native_extra = 0 + for e in program: + if e[0] not in ('ADD', 'COPY', 'SCALE'): + continue + q = Fraction(e[-2]); a, b = abs(q.numerator), q.denominator + reviewed_scalars += 4 * (a.bit_length() + b.bit_length() + 1 + + (0 if e[0] == 'SCALE' else a.bit_count())) + native_extra += rounded_surcharge(q) + n = word['public'] + main = (set(word['live']) | {x + 112 for x in word['live']} | + set(word['hosted']['X2']) | set(word['hosted']['Y2'])) + helper_count = n - len(main) + routes = 1000 * (native_counts['MOVE'] + 2 * helper_count + 208 + 2 * 96 + + 4 * 104 + 4 * 96 + 4 * native_counts['INIT']) + rest = Counter(); outer_counts = Counter(); outer_extra = 0 + for ty in ('A', 'B'): + t = caller['types'][ty]; p = len(t['ports']); roles = t['roles'] + events = [e for e in caller['events'] if e[0] in (ty, 'J')] + rest['caller_envelope'] += 32 * roles * p * len(events) + rest['main_normalizers'] += 26 * roles * p + for qp, zero, *mask in t['diagonal']: + axes = ([0] if qp else []) + [a for k, yes in enumerate(mask, 1) if yes + for a in range(9 + 8 * (k - 1), 9 + 8 * k)] + rest['main_maps'] += 1000 * p * (2 * exchange_count(axes) + 2 * bool(qp) + int(qp == -1)) + for e in events: + if e[0] == 'J': + continue + op = e[1]; outer_counts[op] += p + if op == 'QUERY': + rest['thin_lifecycle'] += 16 * p + rest['query_maps'] += 1000 * p * (2 + int(e[-1] == -1)) + elif op == 'IDLE_ONE': + axes = [a for k in e[3] for a in range(9 + 8 * (k - 1), 9 + 8 * k)] + rest['idle_maps'] += 2000 * p * exchange_count(axes) + elif op == 'LAMBDA': + rest['lambda_recharge'] += 1000 * p + outer_extra += 12 * p + elif op in ('ADD', 'SCALE'): + outer_extra += p * rounded_surcharge(e[-1]) + converted = 18 * n * 104 + baseline = 18 * (reviewed_scalars + routes) + sum(rest.values()) + converted + extra = 18 * native_extra + outer_extra + need((baseline, extra) == (826265904, 17165584), 'independent complete source model reconstruction') + current = baseline + extra + credit = 18 * (old_add_per_call + offset_add_per_call) + remaining = current - credit + room = 10 ** 9 - remaining + raw = sum(total[:3]); combined = sum(total) + need((len(add), sum(s[2] for s in shapes), sum(s[3] > 1 for s in shapes)) == + (61052, 167955, 4079), 'exact native ADD census') + need((credit, raw, combined, room) == (47484288, 497482686, 578910834, 204052800), + 'exact source-specific conversion frontier') + need(max(s[3] for s in shapes) <= 125, 'generic compact constructor odd-divisor domain') + return dict(native_events=len(program), caller_events=len(caller['events']), + native_opcode_counts=dict(sorted(native_counts.items())), + outer_physical_opcode_counts=dict(sorted(outer_counts.items())), + native_contacts=18, native_ADD_count=61052, separate_COPY=copies, + coefficient_length_sum=167955, coefficient_length_histogram=dict(sorted(lengths.items())), + odd_ADD_count=4079, proposed_full_ADD_dispatch_count=18*61052, + physical_lower_vector_per_common_data_bit=dict(zip(('reads','writes','moves','rows'), total)), + raw_action_lower=raw, raw_plus_rows_lower=combined, + old_ADD_tariff_per_native_call=old_add_per_call, + old_ADD_offset_tariff_per_native_call=offset_add_per_call, + removed_ADD_credit=credit, baseline=baseline, optimistic_extra=extra, + optimistic_complete=current, retained_other_invoice=remaining, + replacement_headroom=room, + raw_required_exchange_rate=str(Fraction(raw,room)), + raw_plus_rows_required_exchange_rate=str(Fraction(combined,room)), + raw_equal_unit_replacement_lower=remaining+raw, + combined_equal_unit_replacement_lower=remaining+combined, + source_model_terms=dict(rest), native_scalar_model=reviewed_scalars, + native_routes_model=routes, native_extra_model=native_extra, + unit_status='No numeric tape-action/flat-row-to-tariff converter is asserted by the sources.', + volume_status='The aggregate coefficient assumes equal per-field data-bit volume; otherwise sum the per-event weighted volumes.', + registry_status='Hypothetical direct compact-table substitution at all ADD sites; predecessor installs only three source tokens.', + kappa_status='No new kappa; no physical cap or full-caller impossibility claim.') diff --git a/research/literal-tariff-conversion-audit/data/caller.json b/research/literal-tariff-conversion-audit/data/caller.json new file mode 100644 index 0000000000..cf55f42710 --- /dev/null +++ b/research/literal-tariff-conversion-audit/data/caller.json @@ -0,0 +1 @@ +{"schema":"mixed-root-caller/1","stages":18,"ambient_rank":153,"roles":76,"types":{"A":{"form":"two-chain-HOST2","roles":38,"offset":0,"ports":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,16,18,19,20,21,22,23,24,25,26,28,29,30,31,32,33,36,37,38,39,40,41,43,44,45,46,48,49,50,51,52,53,54,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103],"alpha2":"-1","beta2":"0","diagonal":[[-1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],[-1,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0],[-1,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0],[-1,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0],[-1,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0],[-1,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0],[-1,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0],[-1,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0],[-1,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0],[-1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0],[-1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0],[-1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0],[-1,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0],[-1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0],[-1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0],[-1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0],[-1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0],[-1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0],[-1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1],[-1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],[-1,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0],[-1,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0],[-1,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0],[-1,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0],[-1,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0],[-1,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0],[-1,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0],[-1,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0],[-1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0],[-1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0],[-1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0],[-1,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0],[-1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0],[-1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0],[-1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0],[-1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0],[-1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0],[-1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1]]},"B":{"form":"hosted-HOST","roles":38,"offset":38,"ports":[15,17,27,34,35,42,47,55],"diagonal":[[-1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],[-1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],[-1,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0],[-1,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0],[-1,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0],[-1,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0],[-1,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0],[-1,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0],[-1,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0],[-1,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0],[-1,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0],[-1,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0],[-1,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0],[-1,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0],[-1,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0],[-1,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0],[-1,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0],[-1,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0],[-1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0],[-1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0],[-1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0],[-1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0],[-1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0],[-1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0],[-1,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0],[-1,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0],[-1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0],[-1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0],[-1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0],[-1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0],[-1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0],[-1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0],[-1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0],[-1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0],[-1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0],[-1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0],[-1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1],[-1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1]],"pairs":[[0,1,"-1","1/2","-1/2"],[2,3,"-1","1/2","-1/2"],[4,5,"-1","1/2","-1/2"],[6,7,"-1","1/2","-1/2"],[8,9,"-1","1/2","-1/2"],[10,11,"-1","1/2","-1/2"],[12,13,"-1","1/2","-1/2"],[14,15,"-1","1/2","-1/2"],[16,17,"-1","1/2","-1/2"],[22,23,"-1","1/2","-1/2"],[24,25,"-1","1/2","-1/2"],[26,27,"-1","1/2","-1/2"],[28,29,"-1","1/2","-1/2"],[30,31,"-1","1/2","-1/2"],[32,33,"-1","1/2","-1/2"],[34,35,"-1","1/2","-1/2"],[36,37,"-1","1/2","-1/2"],[38,39,"-1","1/2","-1/2"]]}},"events":[["A","ADD",0,1,"-1"],["A","SWAP",0,1],["A","LAMBDA",0,-1],["A","ADD",19,20,"-1"],["A","SWAP",19,20],["A","SCALE",20,"-1"],["A","LAMBDA",19,1],["B","ADD",40,41,"-2"],["B","ADD",39,41,"1"],["B","ADD",38,41,"2"],["B","ADD",39,40,"1"],["B","ADD",38,40,"1"],["B","ADD",38,39,"-2"],["B","SCALE",39,"256"],["B","ADD",41,39,"-1/128"],["B","ADD",40,39,"1/128"],["B","SCALE",38,"128"],["B","ADD",41,38,"-1/128"],["B","ADD",40,38,"1/64"],["B","ADD",39,38,"1"],["B","LAMBDA",38,-1],["J",1,[1,0,19,20],[39,38,"-1","1/2"]],["A","LAMBDA",19,-1],["A","SCALE",20,"-1"],["A","LAMBDA",0,1],["A","ADD",1,2,"1"],["A","ADD",0,2,"-1"],["A","SCALE",1,"-1"],["A","SWAP",1,2],["A","ADD",2,0,"-1"],["A","SWAP",0,1],["A","LAMBDA",0,-1],["A","ADD",20,21,"1"],["A","ADD",19,21,"-1"],["A","SCALE",20,"-1"],["A","SWAP",20,21],["A","SCALE",19,"-1"],["A","ADD",21,19,"1"],["A","SWAP",19,20],["A","LAMBDA",19,1],["B","LAMBDA",38,1],["B","IDLE_ONE",40,[1]],["B","IDLE_ONE",41,[1]],["B","ADD",42,43,"-2"],["B","ADD",40,43,"-2"],["B","ADD",39,43,"-256"],["B","ADD",38,43,"-128"],["B","ADD",41,42,"1"],["B","ADD",40,42,"-2"],["B","ADD",39,42,"-256"],["B","ADD",39,41,"256"],["B","ADD",38,41,"-128"],["B","ADD",38,40,"-128"],["B","ADD",41,40,"1"],["B","ADD",38,39,"1/2"],["B","SCALE",39,"-1"],["B","ADD",43,39,"-1/128"],["B","ADD",42,39,"1/128"],["B","ADD",41,39,"1/128"],["B","ADD",40,39,"1/128"],["B","SCALE",38,"-1"],["B","ADD",43,38,"1/128"],["B","ADD",41,38,"-1/128"],["B","ADD",40,38,"-1/64"],["B","ADD",39,38,"-1"],["B","LAMBDA",38,-1],["J",2,[1,0,19,20],[39,38,"-1","1/2"]],["A","LAMBDA",19,-1],["A","SCALE",20,"-1"],["A","LAMBDA",0,1],["A","ADD",0,1,"-1"],["A","IDLE_ONE",2,[2,3,4,5,6,7,8,9]],["A","ADD",1,3,"1"],["A","ADD",0,3,"-2"],["A","ADD",0,1,"2"],["A","SCALE",1,"-1"],["A","SCALE",0,"-1"],["A","ADD",1,0,"-1"],["A","SWAP",0,3],["A","LAMBDA",0,-1],["A","ADD",19,20,"-1"],["A","IDLE_ONE",21,[2,3,4,5,6,7,8,9]],["A","ADD",20,22,"1"],["A","ADD",19,22,"-2"],["A","ADD",19,20,"2"],["A","SCALE",19,"-1"],["A","ADD",20,19,"1"],["A","SWAP",19,22],["A","LAMBDA",19,1],["B","LAMBDA",38,1],["B","IDLE_ONE",40,[2,3,4,5,6,7,8,9]],["B","IDLE_ONE",41,[2,3,4,5,6,7,8,9]],["B","IDLE_ONE",42,[2]],["B","IDLE_ONE",43,[2]],["B","ADD",44,45,"-2"],["B","ADD",42,45,"-2"],["B","ADD",39,45,"-256"],["B","ADD",38,45,"-128"],["B","ADD",43,44,"1"],["B","ADD",42,44,"-2"],["B","ADD",39,44,"-256"],["B","ADD",39,43,"256"],["B","ADD",38,43,"-128"],["B","ADD",38,42,"-128"],["B","ADD",43,42,"1"],["B","ADD",38,39,"1/2"],["B","SCALE",39,"-1"],["B","ADD",45,39,"-1/128"],["B","ADD",44,39,"1/128"],["B","ADD",43,39,"1/128"],["B","ADD",42,39,"1/128"],["B","SCALE",38,"-1"],["B","ADD",45,38,"1/128"],["B","ADD",43,38,"-1/128"],["B","ADD",42,38,"-1/64"],["B","ADD",39,38,"-1"],["B","LAMBDA",38,-1],["J",3,[1,0,19,20],[39,38,"-1","1/2"]],["A","LAMBDA",19,-1],["A","SCALE",20,"-1"],["A","LAMBDA",0,1],["A","ADD",0,1,"-1"],["A","IDLE_ONE",3,[3,4,5,6,7,8,9]],["A","ADD",1,4,"1"],["A","ADD",0,4,"-2"],["A","ADD",0,1,"2"],["A","SCALE",1,"-1"],["A","SCALE",0,"-1"],["A","ADD",1,0,"-1"],["A","SWAP",0,4],["A","LAMBDA",0,-1],["A","ADD",19,20,"-1"],["A","IDLE_ONE",22,[3,4,5,6,7,8,9]],["A","ADD",20,23,"1"],["A","ADD",19,23,"-2"],["A","ADD",19,20,"2"],["A","SCALE",19,"-1"],["A","ADD",20,19,"1"],["A","SWAP",19,23],["A","LAMBDA",19,1],["B","LAMBDA",38,1],["B","IDLE_ONE",42,[3,4,5,6,7,8,9]],["B","IDLE_ONE",43,[3,4,5,6,7,8,9]],["B","IDLE_ONE",44,[3]],["B","IDLE_ONE",45,[3]],["B","ADD",46,47,"-2"],["B","ADD",44,47,"-2"],["B","ADD",39,47,"-256"],["B","ADD",38,47,"-128"],["B","ADD",45,46,"1"],["B","ADD",44,46,"-2"],["B","ADD",39,46,"-256"],["B","ADD",39,45,"256"],["B","ADD",38,45,"-128"],["B","ADD",38,44,"-128"],["B","ADD",45,44,"1"],["B","ADD",38,39,"1/2"],["B","SCALE",39,"-1"],["B","ADD",47,39,"-1/128"],["B","ADD",46,39,"1/128"],["B","ADD",45,39,"1/128"],["B","ADD",44,39,"1/128"],["B","SCALE",38,"-1"],["B","ADD",47,38,"1/128"],["B","ADD",45,38,"-1/128"],["B","ADD",44,38,"-1/64"],["B","ADD",39,38,"-1"],["B","LAMBDA",38,-1],["J",4,[1,0,19,20],[39,38,"-1","1/2"]],["A","LAMBDA",19,-1],["A","SCALE",20,"-1"],["A","LAMBDA",0,1],["A","ADD",0,1,"-1"],["A","IDLE_ONE",4,[4,5,6,7,8,9]],["A","ADD",1,5,"1"],["A","ADD",0,5,"-2"],["A","ADD",0,1,"2"],["A","SCALE",1,"-1"],["A","SCALE",0,"-1"],["A","ADD",1,0,"-1"],["A","SWAP",0,5],["A","LAMBDA",0,-1],["A","ADD",19,20,"-1"],["A","IDLE_ONE",23,[4,5,6,7,8,9]],["A","ADD",20,24,"1"],["A","ADD",19,24,"-2"],["A","ADD",19,20,"2"],["A","SCALE",19,"-1"],["A","ADD",20,19,"1"],["A","SWAP",19,24],["A","LAMBDA",19,1],["B","LAMBDA",38,1],["B","IDLE_ONE",44,[4,5,6,7,8,9]],["B","IDLE_ONE",45,[4,5,6,7,8,9]],["B","IDLE_ONE",46,[4]],["B","IDLE_ONE",47,[4]],["B","ADD",48,49,"-2"],["B","ADD",46,49,"-2"],["B","ADD",39,49,"-256"],["B","ADD",38,49,"-128"],["B","ADD",47,48,"1"],["B","ADD",46,48,"-2"],["B","ADD",39,48,"-256"],["B","ADD",39,47,"256"],["B","ADD",38,47,"-128"],["B","ADD",38,46,"-128"],["B","ADD",47,46,"1"],["B","ADD",38,39,"1/2"],["B","SCALE",39,"-1"],["B","ADD",49,39,"-1/128"],["B","ADD",48,39,"1/128"],["B","ADD",47,39,"1/128"],["B","ADD",46,39,"1/128"],["B","SCALE",38,"-1"],["B","ADD",49,38,"1/128"],["B","ADD",47,38,"-1/128"],["B","ADD",46,38,"-1/64"],["B","ADD",39,38,"-1"],["B","LAMBDA",38,-1],["J",5,[1,0,19,20],[39,38,"-1","1/2"]],["A","LAMBDA",19,-1],["A","SCALE",20,"-1"],["A","LAMBDA",0,1],["A","ADD",0,1,"-1"],["A","IDLE_ONE",5,[5,6,7,8,9]],["A","ADD",1,6,"1"],["A","ADD",0,6,"-2"],["A","ADD",0,1,"2"],["A","SCALE",1,"-1"],["A","SCALE",0,"-1"],["A","ADD",1,0,"-1"],["A","SWAP",0,6],["A","LAMBDA",0,-1],["A","ADD",19,20,"-1"],["A","IDLE_ONE",24,[5,6,7,8,9]],["A","ADD",20,25,"1"],["A","ADD",19,25,"-2"],["A","ADD",19,20,"2"],["A","SCALE",19,"-1"],["A","ADD",20,19,"1"],["A","SWAP",19,25],["A","LAMBDA",19,1],["B","LAMBDA",38,1],["B","IDLE_ONE",46,[5,6,7,8,9]],["B","IDLE_ONE",47,[5,6,7,8,9]],["B","IDLE_ONE",48,[5]],["B","IDLE_ONE",49,[5]],["B","ADD",50,51,"-2"],["B","ADD",48,51,"-2"],["B","ADD",39,51,"-256"],["B","ADD",38,51,"-128"],["B","ADD",49,50,"1"],["B","ADD",48,50,"-2"],["B","ADD",39,50,"-256"],["B","ADD",39,49,"256"],["B","ADD",38,49,"-128"],["B","ADD",38,48,"-128"],["B","ADD",49,48,"1"],["B","ADD",38,39,"1/2"],["B","SCALE",39,"-1"],["B","ADD",51,39,"-1/128"],["B","ADD",50,39,"1/128"],["B","ADD",49,39,"1/128"],["B","ADD",48,39,"1/128"],["B","SCALE",38,"-1"],["B","ADD",51,38,"1/128"],["B","ADD",49,38,"-1/128"],["B","ADD",48,38,"-1/64"],["B","ADD",39,38,"-1"],["B","LAMBDA",38,-1],["J",6,[1,0,19,20],[39,38,"-1","1/2"]],["A","LAMBDA",19,-1],["A","SCALE",20,"-1"],["A","LAMBDA",0,1],["A","ADD",0,1,"-1"],["A","IDLE_ONE",6,[6,7,8,9]],["A","ADD",1,7,"1"],["A","ADD",0,7,"-2"],["A","ADD",0,1,"2"],["A","SCALE",1,"-1"],["A","SCALE",0,"-1"],["A","ADD",1,0,"-1"],["A","SWAP",0,7],["A","LAMBDA",0,-1],["A","ADD",19,20,"-1"],["A","IDLE_ONE",25,[6,7,8,9]],["A","ADD",20,26,"1"],["A","ADD",19,26,"-2"],["A","ADD",19,20,"2"],["A","SCALE",19,"-1"],["A","ADD",20,19,"1"],["A","SWAP",19,26],["A","LAMBDA",19,1],["B","LAMBDA",38,1],["B","IDLE_ONE",48,[6,7,8,9]],["B","IDLE_ONE",49,[6,7,8,9]],["B","IDLE_ONE",50,[6]],["B","IDLE_ONE",51,[6]],["B","ADD",52,53,"-2"],["B","ADD",50,53,"-2"],["B","ADD",39,53,"-256"],["B","ADD",38,53,"-128"],["B","ADD",51,52,"1"],["B","ADD",50,52,"-2"],["B","ADD",39,52,"-256"],["B","ADD",39,51,"256"],["B","ADD",38,51,"-128"],["B","ADD",38,50,"-128"],["B","ADD",51,50,"1"],["B","ADD",38,39,"1/2"],["B","SCALE",39,"-1"],["B","ADD",53,39,"-1/128"],["B","ADD",52,39,"1/128"],["B","ADD",51,39,"1/128"],["B","ADD",50,39,"1/128"],["B","SCALE",38,"-1"],["B","ADD",53,38,"1/128"],["B","ADD",51,38,"-1/128"],["B","ADD",50,38,"-1/64"],["B","ADD",39,38,"-1"],["B","LAMBDA",38,-1],["J",7,[1,0,19,20],[39,38,"-1","1/2"]],["A","LAMBDA",19,-1],["A","SCALE",20,"-1"],["A","LAMBDA",0,1],["A","ADD",0,1,"-1"],["A","IDLE_ONE",7,[7,8,9]],["A","ADD",1,8,"1"],["A","ADD",0,8,"-2"],["A","ADD",0,1,"2"],["A","SCALE",1,"-1"],["A","SCALE",0,"-1"],["A","ADD",1,0,"-1"],["A","SWAP",0,8],["A","LAMBDA",0,-1],["A","ADD",19,20,"-1"],["A","IDLE_ONE",26,[7,8,9]],["A","ADD",20,27,"1"],["A","ADD",19,27,"-2"],["A","ADD",19,20,"2"],["A","SCALE",19,"-1"],["A","ADD",20,19,"1"],["A","SWAP",19,27],["A","LAMBDA",19,1],["B","LAMBDA",38,1],["B","IDLE_ONE",50,[7,8,9]],["B","IDLE_ONE",51,[7,8,9]],["B","IDLE_ONE",52,[7]],["B","IDLE_ONE",53,[7]],["B","ADD",54,55,"-2"],["B","ADD",52,55,"-2"],["B","ADD",39,55,"-256"],["B","ADD",38,55,"-128"],["B","ADD",53,54,"1"],["B","ADD",52,54,"-2"],["B","ADD",39,54,"-256"],["B","ADD",39,53,"256"],["B","ADD",38,53,"-128"],["B","ADD",38,52,"-128"],["B","ADD",53,52,"1"],["B","ADD",38,39,"1/2"],["B","SCALE",39,"-1"],["B","ADD",55,39,"-1/128"],["B","ADD",54,39,"1/128"],["B","ADD",53,39,"1/128"],["B","ADD",52,39,"1/128"],["B","SCALE",38,"-1"],["B","ADD",55,38,"1/128"],["B","ADD",53,38,"-1/128"],["B","ADD",52,38,"-1/64"],["B","ADD",39,38,"-1"],["B","LAMBDA",38,-1],["J",8,[1,0,19,20],[39,38,"-1","1/2"]],["A","LAMBDA",19,-1],["A","SCALE",20,"-1"],["A","LAMBDA",0,1],["A","ADD",0,1,"-1"],["A","IDLE_ONE",8,[8,9]],["A","ADD",1,9,"1"],["A","ADD",0,9,"-2"],["A","ADD",0,1,"2"],["A","SCALE",1,"-1"],["A","SCALE",0,"-1"],["A","ADD",1,0,"-1"],["A","SWAP",0,9],["A","LAMBDA",0,-1],["A","ADD",19,20,"-1"],["A","IDLE_ONE",27,[8,9]],["A","ADD",20,28,"1"],["A","ADD",19,28,"-2"],["A","ADD",19,20,"2"],["A","SCALE",19,"-1"],["A","ADD",20,19,"1"],["A","SWAP",19,28],["A","LAMBDA",19,1],["B","LAMBDA",38,1],["B","IDLE_ONE",52,[8,9]],["B","IDLE_ONE",53,[8,9]],["B","IDLE_ONE",54,[8]],["B","IDLE_ONE",55,[8]],["B","ADD",56,57,"-2"],["B","ADD",54,57,"-2"],["B","ADD",39,57,"-256"],["B","ADD",38,57,"-128"],["B","ADD",55,56,"1"],["B","ADD",54,56,"-2"],["B","ADD",39,56,"-256"],["B","ADD",39,55,"256"],["B","ADD",38,55,"-128"],["B","ADD",38,54,"-128"],["B","ADD",55,54,"1"],["B","ADD",38,39,"1/2"],["B","SCALE",39,"-1"],["B","ADD",57,39,"-1/128"],["B","ADD",56,39,"1/128"],["B","ADD",55,39,"1/128"],["B","ADD",54,39,"1/128"],["B","SCALE",38,"-1"],["B","ADD",57,38,"1/128"],["B","ADD",55,38,"-1/128"],["B","ADD",54,38,"-1/64"],["B","ADD",39,38,"-1"],["B","LAMBDA",38,-1],["J",9,[1,0,19,20],[39,38,"-1","1/2"]],["A","LAMBDA",19,-1],["A","SCALE",20,"-1"],["A","LAMBDA",0,1],["A","ADD",0,1,"-1"],["A","IDLE_ONE",9,[9]],["A","SWAP",9,8],["A","SWAP",9,7],["A","SWAP",9,6],["A","SWAP",9,5],["A","SWAP",9,4],["A","SWAP",9,3],["A","SWAP",9,2],["A","ADD",0,1,"1"],["A","SCALE",1,"-1"],["A","SWAP",9,1],["A","ADD",18,0,"1"],["A","ADD",17,0,"1"],["A","ADD",16,0,"1"],["A","ADD",15,0,"1"],["A","ADD",14,0,"1"],["A","ADD",13,0,"1"],["A","ADD",12,0,"1"],["A","ADD",11,0,"1"],["A","ADD",10,0,"1"],["A","ADD",8,0,"1"],["A","ADD",7,0,"1"],["A","ADD",6,0,"1"],["A","ADD",5,0,"1"],["A","ADD",4,0,"1"],["A","ADD",3,0,"1"],["A","ADD",2,0,"1"],["A","ADD",1,0,"1"],["A","LAMBDA",0,1],["A","ADD",19,20,"-1"],["A","IDLE_ONE",28,[9]],["A","SWAP",28,27],["A","SWAP",28,26],["A","SWAP",28,25],["A","SWAP",28,24],["A","SWAP",28,23],["A","SWAP",28,22],["A","SWAP",28,21],["A","ADD",19,20,"1"],["A","SCALE",20,"-1"],["A","SWAP",28,20],["A","ADD",37,19,"1"],["A","ADD",36,19,"1"],["A","ADD",35,19,"1"],["A","ADD",34,19,"1"],["A","ADD",33,19,"1"],["A","ADD",32,19,"1"],["A","ADD",31,19,"1"],["A","ADD",30,19,"1"],["A","ADD",29,19,"1"],["A","ADD",27,19,"1"],["A","ADD",26,19,"1"],["A","ADD",25,19,"1"],["A","ADD",24,19,"1"],["A","ADD",23,19,"1"],["A","ADD",22,19,"1"],["A","ADD",21,19,"1"],["A","ADD",20,19,"1"],["A","LAMBDA",19,1],["A","ADD",2,1,"-1"],["A","ADD",3,1,"-1"],["A","ADD",4,1,"-1"],["A","ADD",5,1,"-1"],["A","ADD",6,1,"-1"],["A","ADD",7,1,"-1"],["A","ADD",8,1,"-1"],["A","ADD",9,1,"-1"],["A","ADD",10,1,"-1"],["A","ADD",11,1,"-1"],["A","ADD",12,1,"-1"],["A","ADD",13,1,"-1"],["A","ADD",14,1,"-1"],["A","ADD",15,1,"-1"],["A","ADD",16,1,"-1"],["A","ADD",17,1,"-1"],["A","ADD",18,1,"-1"],["A","ADD",2,3,"-1"],["A","ADD",2,4,"1"],["A","ADD",2,5,"-1"],["A","ADD",2,6,"1"],["A","ADD",2,7,"-1"],["A","ADD",2,8,"1"],["A","ADD",2,9,"-1"],["A","ADD",2,10,"1"],["A","ADD",2,11,"-1"],["A","ADD",2,12,"1"],["A","ADD",2,13,"-1"],["A","ADD",2,14,"1"],["A","ADD",2,15,"-1"],["A","ADD",2,16,"1"],["A","ADD",2,17,"-1"],["A","ADD",2,18,"1"],["A","LAMBDA",2,1],["A","ADD",0,2,"-1"],["A","SWAP",0,1],["A","SWAP",19,1],["A","ADD",19,2,"1"],["A","LAMBDA",2,1],["A","LAMBDA",2,1],["A","LAMBDA",0,1],["A","LAMBDA",0,1],["A","ADD",1,0,"1"],["A","LAMBDA",0,-1],["A","LAMBDA",0,-1],["A","QUERY",0,19,-1],["A","LAMBDA",0,1],["A","LAMBDA",0,1],["A","ADD",1,0,"-1"],["A","LAMBDA",0,-1],["A","LAMBDA",0,-1],["A","QUERY",19,1,-1],["A","LAMBDA",0,1],["A","LAMBDA",0,1],["A","ADD",1,0,"1"],["A","LAMBDA",0,-1],["A","LAMBDA",0,-1],["A","LAMBDA",19,1],["A","LAMBDA",19,1],["A","ADD",2,19,"-1"],["A","LAMBDA",19,-1],["A","LAMBDA",19,-1],["A","QUERY",1,2,-1],["A","LAMBDA",19,1],["A","LAMBDA",19,1],["A","ADD",2,19,"1"],["A","LAMBDA",19,-1],["A","LAMBDA",19,-1],["A","LAMBDA",1,1],["A","LAMBDA",1,1],["A","ADD",0,1,"-1"],["A","LAMBDA",2,1],["A","LAMBDA",2,1],["A","LAMBDA",2,-1],["A","ADD",2,3,"1"],["A","ADD",2,4,"-1"],["A","ADD",2,5,"1"],["A","ADD",2,6,"-1"],["A","ADD",2,7,"1"],["A","ADD",2,8,"-1"],["A","ADD",2,9,"1"],["A","ADD",2,10,"-1"],["A","ADD",2,11,"1"],["A","ADD",2,12,"-1"],["A","ADD",2,13,"1"],["A","ADD",2,14,"-1"],["A","ADD",2,15,"1"],["A","ADD",2,16,"-1"],["A","ADD",2,17,"1"],["A","ADD",2,18,"-1"],["A","ADD",2,1,"1"],["A","ADD",3,1,"1"],["A","ADD",4,1,"1"],["A","ADD",5,1,"1"],["A","ADD",6,1,"1"],["A","ADD",7,1,"1"],["A","ADD",8,1,"1"],["A","ADD",9,1,"1"],["A","ADD",10,1,"1"],["A","ADD",11,1,"1"],["A","ADD",12,1,"1"],["A","ADD",13,1,"1"],["A","ADD",14,1,"1"],["A","ADD",15,1,"1"],["A","ADD",16,1,"1"],["A","ADD",17,1,"1"],["A","ADD",18,1,"1"],["A","ADD",1,18,"-1"],["A","ADD",1,17,"1"],["A","ADD",1,16,"-1"],["A","ADD",1,15,"1"],["A","ADD",1,14,"-1"],["A","ADD",1,13,"1"],["A","ADD",1,12,"-1"],["A","ADD",1,11,"1"],["A","ADD",1,10,"-1"],["A","ADD",1,9,"1"],["A","ADD",1,8,"-1"],["A","ADD",1,7,"1"],["A","ADD",1,6,"-1"],["A","ADD",1,5,"1"],["A","ADD",1,4,"-1"],["A","ADD",1,3,"1"],["A","ADD",1,2,"-1"],["A","SCALE",1,"-1"],["A","SCALE",0,"-1"],["A","ADD",18,0,"-1"],["A","ADD",17,0,"-1"],["A","ADD",16,0,"-1"],["A","ADD",15,0,"-1"],["A","ADD",14,0,"-1"],["A","ADD",13,0,"-1"],["A","ADD",12,0,"-1"],["A","ADD",11,0,"-1"],["A","ADD",10,0,"-1"],["A","ADD",9,0,"-1"],["A","ADD",8,0,"-1"],["A","ADD",7,0,"-1"],["A","ADD",6,0,"-1"],["A","ADD",5,0,"-1"],["A","ADD",4,0,"-1"],["A","ADD",3,0,"-1"],["A","ADD",2,0,"-1"],["A","LAMBDA",0,-1],["A","LAMBDA",0,1],["A","ADD",1,18,"-1"],["A","ADD",0,18,"-1"],["A","ADD",1,17,"1"],["A","ADD",0,17,"1"],["A","ADD",1,16,"-1"],["A","ADD",0,16,"-1"],["A","ADD",1,15,"1"],["A","ADD",0,15,"1"],["A","ADD",1,14,"-1"],["A","ADD",0,14,"-1"],["A","ADD",1,13,"1"],["A","ADD",0,13,"1"],["A","ADD",1,12,"-1"],["A","ADD",0,12,"-1"],["A","ADD",1,11,"1"],["A","ADD",0,11,"1"],["A","ADD",1,10,"-1"],["A","SCALE",10,"-1"],["A","ADD",1,9,"1"],["A","ADD",0,9,"1"],["A","SWAP",18,9],["A","ADD",1,8,"-1"],["A","ADD",0,8,"-1"],["A","SWAP",17,8],["A","ADD",1,7,"1"],["A","ADD",0,7,"1"],["A","SWAP",16,7],["A","ADD",1,6,"-1"],["A","ADD",0,6,"-1"],["A","SWAP",15,6],["A","ADD",1,5,"1"],["A","ADD",0,5,"1"],["A","SWAP",14,5],["A","ADD",1,4,"-1"],["A","ADD",0,4,"-1"],["A","SWAP",13,4],["A","ADD",1,3,"1"],["A","ADD",0,3,"1"],["A","SWAP",12,3],["A","ADD",1,2,"-1"],["A","ADD",0,2,"-1"],["A","SWAP",11,2],["A","ADD",0,1,"-1"],["A","SCALE",1,"-1"],["A","SWAP",10,1],["A","SWAP",1,0],["A","ADD",0,1,"2"],["A","LAMBDA",0,-1],["A","ADD",20,37,"-1"],["A","ADD",20,36,"1"],["A","ADD",20,35,"-1"],["A","ADD",20,34,"1"],["A","ADD",20,33,"-1"],["A","ADD",20,32,"1"],["A","ADD",20,31,"-1"],["A","ADD",20,30,"1"],["A","ADD",20,29,"-1"],["A","ADD",20,28,"1"],["A","ADD",20,27,"-1"],["A","ADD",20,26,"1"],["A","ADD",20,25,"-1"],["A","ADD",20,24,"1"],["A","ADD",20,23,"-1"],["A","ADD",20,22,"1"],["A","ADD",20,21,"-1"],["A","SCALE",20,"-1"],["A","SCALE",19,"-1"],["A","ADD",37,19,"-1"],["A","ADD",36,19,"-1"],["A","ADD",35,19,"-1"],["A","ADD",34,19,"-1"],["A","ADD",33,19,"-1"],["A","ADD",32,19,"-1"],["A","ADD",31,19,"-1"],["A","ADD",30,19,"-1"],["A","ADD",29,19,"-1"],["A","ADD",28,19,"-1"],["A","ADD",27,19,"-1"],["A","ADD",26,19,"-1"],["A","ADD",25,19,"-1"],["A","ADD",24,19,"-1"],["A","ADD",23,19,"-1"],["A","ADD",22,19,"-1"],["A","ADD",21,19,"-1"],["A","LAMBDA",19,-1],["A","QUERY",19,20,-1],["A","LAMBDA",19,1],["A","ADD",20,37,"-1"],["A","ADD",19,37,"-1"],["A","ADD",20,36,"1"],["A","ADD",19,36,"1"],["A","ADD",20,35,"-1"],["A","ADD",19,35,"-1"],["A","ADD",20,34,"1"],["A","ADD",19,34,"1"],["A","ADD",20,33,"-1"],["A","ADD",19,33,"-1"],["A","ADD",20,32,"1"],["A","ADD",19,32,"1"],["A","ADD",20,31,"-1"],["A","ADD",19,31,"-1"],["A","ADD",20,30,"1"],["A","ADD",19,30,"1"],["A","ADD",20,29,"-1"],["A","SCALE",29,"-1"],["A","ADD",20,28,"1"],["A","ADD",19,28,"1"],["A","SWAP",37,28],["A","ADD",20,27,"-1"],["A","ADD",19,27,"-1"],["A","SWAP",36,27],["A","ADD",20,26,"1"],["A","ADD",19,26,"1"],["A","SWAP",35,26],["A","ADD",20,25,"-1"],["A","ADD",19,25,"-1"],["A","SWAP",34,25],["A","ADD",20,24,"1"],["A","ADD",19,24,"1"],["A","SWAP",33,24],["A","ADD",20,23,"-1"],["A","ADD",19,23,"-1"],["A","SWAP",32,23],["A","ADD",20,22,"1"],["A","ADD",19,22,"1"],["A","SWAP",31,22],["A","ADD",20,21,"-1"],["A","ADD",19,21,"-1"],["A","SWAP",30,21],["A","ADD",19,20,"-1"],["A","SCALE",20,"-1"],["A","SWAP",29,20],["A","SCALE",19,"-1"],["A","SWAP",20,19],["A","ADD",19,20,"-2"],["A","LAMBDA",19,1],["B","LAMBDA",38,1],["B","IDLE_ONE",54,[9]],["B","IDLE_ONE",55,[9]],["B","IDLE_ONE",56,[9]],["B","IDLE_ONE",57,[9]],["B","ADD",56,75,"1"],["B","ADD",55,75,"1"],["B","ADD",53,75,"1"],["B","ADD",51,75,"1"],["B","ADD",49,75,"1"],["B","ADD",47,75,"1"],["B","ADD",45,75,"1"],["B","ADD",43,75,"1"],["B","ADD",41,75,"1"],["B","ADD",39,75,"-128"],["B","ADD",38,75,"64"],["B","ADD",56,73,"-1"],["B","ADD",55,73,"-1"],["B","ADD",53,73,"-1"],["B","ADD",51,73,"-1"],["B","ADD",49,73,"-1"],["B","ADD",47,73,"-1"],["B","ADD",45,73,"-1"],["B","ADD",43,73,"-1"],["B","ADD",41,73,"-1"],["B","ADD",39,73,"128"],["B","ADD",38,73,"-64"],["B","ADD",56,72,"2"],["B","ADD",55,72,"2"],["B","ADD",53,72,"2"],["B","ADD",51,72,"2"],["B","ADD",49,72,"2"],["B","ADD",47,72,"2"],["B","ADD",45,72,"2"],["B","ADD",43,72,"2"],["B","ADD",41,72,"2"],["B","ADD",39,72,"-256"],["B","ADD",38,72,"128"],["B","ADD",56,71,"-1"],["B","ADD",55,71,"-1"],["B","ADD",53,71,"-1"],["B","ADD",51,71,"-1"],["B","ADD",49,71,"-1"],["B","ADD",47,71,"-1"],["B","ADD",45,71,"-1"],["B","ADD",43,71,"-1"],["B","ADD",41,71,"-1"],["B","ADD",39,71,"128"],["B","ADD",38,71,"-64"],["B","ADD",56,69,"1"],["B","ADD",55,69,"1"],["B","ADD",53,69,"1"],["B","ADD",51,69,"1"],["B","ADD",49,69,"1"],["B","ADD",47,69,"1"],["B","ADD",45,69,"1"],["B","ADD",43,69,"1"],["B","ADD",41,69,"1"],["B","ADD",39,69,"-128"],["B","ADD",38,69,"64"],["B","ADD",56,68,"-2"],["B","ADD",55,68,"-2"],["B","ADD",53,68,"-2"],["B","ADD",51,68,"-2"],["B","ADD",49,68,"-2"],["B","ADD",47,68,"-2"],["B","ADD",45,68,"-2"],["B","ADD",43,68,"-2"],["B","ADD",41,68,"-2"],["B","ADD",39,68,"256"],["B","ADD",38,68,"-128"],["B","ADD",56,67,"1"],["B","ADD",55,67,"1"],["B","ADD",53,67,"1"],["B","ADD",51,67,"1"],["B","ADD",49,67,"1"],["B","ADD",47,67,"1"],["B","ADD",45,67,"1"],["B","ADD",43,67,"1"],["B","ADD",41,67,"1"],["B","ADD",39,67,"-128"],["B","ADD",38,67,"64"],["B","ADD",56,65,"-1"],["B","ADD",55,65,"-1"],["B","ADD",53,65,"-1"],["B","ADD",51,65,"-1"],["B","ADD",49,65,"-1"],["B","ADD",47,65,"-1"],["B","ADD",45,65,"-1"],["B","ADD",43,65,"-1"],["B","ADD",41,65,"-1"],["B","ADD",39,65,"128"],["B","ADD",38,65,"-64"],["B","ADD",56,64,"2"],["B","ADD",55,64,"2"],["B","ADD",53,64,"2"],["B","ADD",51,64,"2"],["B","ADD",49,64,"2"],["B","ADD",47,64,"2"],["B","ADD",45,64,"2"],["B","ADD",43,64,"2"],["B","ADD",41,64,"2"],["B","ADD",39,64,"-256"],["B","ADD",38,64,"128"],["B","ADD",56,63,"-1"],["B","ADD",55,63,"-1"],["B","ADD",53,63,"-1"],["B","ADD",51,63,"-1"],["B","ADD",49,63,"-1"],["B","ADD",47,63,"-1"],["B","ADD",45,63,"-1"],["B","ADD",43,63,"-1"],["B","ADD",41,63,"-1"],["B","ADD",39,63,"128"],["B","ADD",38,63,"-64"],["B","ADD",56,61,"1"],["B","ADD",55,61,"1"],["B","ADD",53,61,"1"],["B","ADD",51,61,"1"],["B","ADD",49,61,"1"],["B","ADD",47,61,"1"],["B","ADD",45,61,"1"],["B","ADD",43,61,"1"],["B","ADD",41,61,"1"],["B","ADD",39,61,"-128"],["B","ADD",38,61,"64"],["B","ADD",56,60,"-2"],["B","ADD",55,60,"-2"],["B","ADD",53,60,"-2"],["B","ADD",51,60,"-2"],["B","ADD",49,60,"-2"],["B","ADD",47,60,"-2"],["B","ADD",45,60,"-2"],["B","ADD",43,60,"-2"],["B","ADD",41,60,"-2"],["B","ADD",39,60,"256"],["B","ADD",38,60,"-128"],["B","ADD",56,59,"1"],["B","ADD",55,59,"1"],["B","ADD",53,59,"1"],["B","ADD",51,59,"1"],["B","ADD",49,59,"1"],["B","ADD",47,59,"1"],["B","ADD",45,59,"1"],["B","ADD",43,59,"1"],["B","ADD",41,59,"1"],["B","ADD",39,59,"-128"],["B","ADD",38,59,"64"],["B","ADD",39,57,"256"],["B","ADD",38,57,"-128"],["B","ADD",55,56,"-3/2"],["B","ADD",53,56,"-1"],["B","ADD",51,56,"-1"],["B","ADD",49,56,"-1"],["B","ADD",47,56,"-1"],["B","ADD",45,56,"-1"],["B","ADD",43,56,"-1"],["B","ADD",41,56,"-1"],["B","ADD",39,56,"128"],["B","ADD",38,56,"-64"],["B","SCALE",56,"1/2"],["B","ADD",53,55,"-1"],["B","ADD",51,55,"-1"],["B","ADD",49,55,"-1"],["B","ADD",47,55,"-1"],["B","ADD",45,55,"-1"],["B","ADD",43,55,"-1"],["B","ADD",41,55,"-1"],["B","ADD",39,55,"128"],["B","ADD",38,55,"64"],["B","SCALE",55,"-1"],["B","ADD",57,55,"1"],["B","SWAP",55,56],["B","ADD",53,54,"1/2"],["B","ADD",51,54,"1/2"],["B","ADD",49,54,"1/2"],["B","ADD",47,54,"1/2"],["B","ADD",45,54,"1/2"],["B","ADD",43,54,"1/2"],["B","ADD",41,54,"1/2"],["B","ADD",39,54,"-64"],["B","ADD",38,54,"-32"],["B","ADD",57,54,"1/2"],["B","ADD",56,54,"1/2"],["B","ADD",55,54,"1/2"],["B","ADD",51,52,"-1/2"],["B","ADD",49,52,"-1/2"],["B","ADD",47,52,"-1/2"],["B","ADD",45,52,"-1/2"],["B","ADD",43,52,"-1/2"],["B","ADD",41,52,"-1/2"],["B","ADD",39,52,"64"],["B","ADD",38,52,"32"],["B","ADD",57,52,"-1/2"],["B","ADD",56,52,"-1/2"],["B","ADD",55,52,"-1/2"],["B","ADD",53,52,"-1/2"],["B","ADD",49,51,"-1"],["B","ADD",47,51,"-2"],["B","ADD",45,51,"-1"],["B","ADD",43,51,"-1"],["B","ADD",41,51,"-1"],["B","ADD",39,51,"128"],["B","ADD",38,51,"64"],["B","ADD",57,51,"-1"],["B","ADD",56,51,"-1"],["B","ADD",55,51,"-1"],["B","ADD",53,51,"-1"],["B","ADD",47,50,"1/2"],["B","ADD",51,50,"-1/2"],["B","ADD",47,49,"-1"],["B","ADD",45,49,"-1"],["B","ADD",43,49,"-1"],["B","ADD",41,49,"-1"],["B","ADD",39,49,"128"],["B","ADD",38,49,"64"],["B","SCALE",49,"-1"],["B","ADD",57,49,"1"],["B","ADD",56,49,"1"],["B","ADD",55,49,"1"],["B","ADD",53,49,"1"],["B","SWAP",49,51],["B","ADD",47,48,"-1/2"],["B","ADD",49,48,"1/2"],["B","ADD",45,47,"-1"],["B","ADD",43,47,"-1"],["B","ADD",41,47,"-1"],["B","ADD",39,47,"128"],["B","ADD",38,47,"64"],["B","SCALE",47,"-1"],["B","ADD",57,47,"1"],["B","ADD",56,47,"1"],["B","ADD",55,47,"1"],["B","ADD",53,47,"1"],["B","ADD",51,47,"1"],["B","SWAP",47,49],["B","ADD",45,46,"1/2"],["B","ADD",43,46,"1/2"],["B","ADD",41,46,"1/2"],["B","ADD",39,46,"-64"],["B","ADD",38,46,"-32"],["B","ADD",57,46,"1/2"],["B","ADD",56,46,"1/2"],["B","ADD",55,46,"1/2"],["B","ADD",53,46,"1/2"],["B","ADD",51,46,"1/2"],["B","ADD",49,46,"1/2"],["B","ADD",47,46,"1/2"],["B","ADD",43,44,"-1/2"],["B","ADD",41,44,"-1/2"],["B","ADD",39,44,"64"],["B","ADD",38,44,"32"],["B","ADD",57,44,"-1/2"],["B","ADD",56,44,"-1/2"],["B","ADD",55,44,"-1/2"],["B","ADD",53,44,"-1/2"],["B","ADD",51,44,"-1/2"],["B","ADD",49,44,"-1/2"],["B","ADD",47,44,"-1/2"],["B","ADD",45,44,"-1/2"],["B","ADD",41,43,"-1"],["B","ADD",39,43,"128"],["B","ADD",38,43,"64"],["B","SCALE",43,"2"],["B","ADD",57,43,"-1/2"],["B","ADD",56,43,"-1/2"],["B","ADD",55,43,"-1/2"],["B","ADD",53,43,"-1/2"],["B","ADD",51,43,"-1/2"],["B","ADD",49,43,"-1/2"],["B","ADD",47,43,"-1/2"],["B","ADD",45,43,"-1/2"],["B","ADD",43,42,"-1"],["B","ADD",39,41,"128"],["B","ADD",38,41,"64"],["B","SCALE",41,"-1"],["B","ADD",57,41,"1"],["B","ADD",56,41,"1"],["B","ADD",55,41,"1"],["B","ADD",53,41,"1"],["B","ADD",51,41,"1"],["B","ADD",49,41,"1"],["B","ADD",47,41,"1"],["B","ADD",45,41,"1"],["B","SWAP",41,43],["B","ADD",41,40,"1"],["B","ADD",38,39,"-1/2"],["B","SCALE",39,"1/128"],["B","ADD",57,39,"1"],["B","ADD",56,39,"1"],["B","ADD",55,39,"1"],["B","ADD",53,39,"1"],["B","ADD",51,39,"1"],["B","ADD",49,39,"1"],["B","ADD",47,39,"1"],["B","ADD",45,39,"1"],["B","ADD",43,39,"1"],["B","SWAP",39,41],["B","SCALE",38,"1/128"],["B","ADD",57,38,"2"],["B","ADD",56,38,"2"],["B","ADD",55,38,"1"],["B","ADD",53,38,"1"],["B","ADD",51,38,"1"],["B","ADD",49,38,"1"],["B","ADD",47,38,"1"],["B","ADD",45,38,"1"],["B","ADD",43,38,"1"],["B","ADD",41,38,"1"],["B","ADD",39,38,"1"],["B","LAMBDA",38,-1],["B","QUERY",38,39,-1],["B","LAMBDA",38,1],["B","ADD",38,39,"-1"],["B","ADD",39,75,"-1"],["B","ADD",39,73,"1"],["B","ADD",39,72,"-2"],["B","ADD",39,71,"1"],["B","ADD",39,69,"-1"],["B","ADD",39,68,"2"],["B","ADD",39,67,"-1"],["B","ADD",39,65,"1"],["B","ADD",39,64,"-2"],["B","ADD",39,63,"1"],["B","ADD",39,61,"-1"],["B","ADD",39,60,"2"],["B","ADD",39,59,"-1"],["B","ADD",39,56,"-1"],["B","ADD",39,55,"2"],["B","ADD",39,54,"-1"],["B","ADD",39,52,"1"],["B","ADD",39,51,"-2"],["B","ADD",39,50,"1"],["B","ADD",39,48,"-1"],["B","ADD",39,47,"2"],["B","ADD",39,46,"-1"],["B","ADD",39,44,"1"],["B","ADD",39,43,"-2"],["B","ADD",39,42,"1"],["B","ADD",39,40,"-1"],["B","ADD",38,39,"-1"],["B","ADD",57,39,"-1"],["B","ADD",56,39,"-2"],["B","ADD",55,39,"-1"],["B","ADD",54,39,"-2"],["B","ADD",53,39,"-1"],["B","ADD",52,39,"-2"],["B","ADD",51,39,"-1"],["B","ADD",50,39,"-2"],["B","ADD",49,39,"-1"],["B","ADD",48,39,"-2"],["B","ADD",47,39,"-1"],["B","ADD",46,39,"-2"],["B","ADD",45,39,"-1"],["B","ADD",44,39,"-2"],["B","ADD",43,39,"-1"],["B","ADD",42,39,"-2"],["B","ADD",41,39,"-1"],["B","ADD",40,39,"-2"],["B","SCALE",38,"1/2"],["B","ADD",74,38,"-1"],["B","ADD",72,38,"-1"],["B","ADD",70,38,"-1"],["B","ADD",68,38,"-1"],["B","ADD",66,38,"-1"],["B","ADD",64,38,"-1"],["B","ADD",62,38,"-1"],["B","ADD",60,38,"-1"],["B","ADD",58,38,"-1"],["B","ADD",57,38,"-1"],["B","ADD",56,38,"-2"],["B","ADD",55,38,"-1"],["B","ADD",54,38,"-2"],["B","ADD",53,38,"-1"],["B","ADD",52,38,"-2"],["B","ADD",51,38,"-1"],["B","ADD",50,38,"-2"],["B","ADD",49,38,"-1"],["B","ADD",48,38,"-2"],["B","ADD",47,38,"-1"],["B","ADD",46,38,"-2"],["B","ADD",45,38,"-1"],["B","ADD",44,38,"-2"],["B","ADD",43,38,"-1"],["B","ADD",42,38,"-2"],["B","ADD",41,38,"-1"],["B","ADD",40,38,"-2"],["B","ADD",39,38,"1"],["B","LAMBDA",38,-1],["B","QUERY",38,39,-1],["B","LAMBDA",38,1],["B","ADD",38,39,"-1"],["B","SCALE",38,"2"],["B","ADD",75,38,"-1"],["B","ADD",74,38,"-1/2"],["B","ADD",73,38,"-1"],["B","ADD",72,38,"-1/2"],["B","ADD",71,38,"-1"],["B","ADD",70,38,"-1/2"],["B","ADD",69,38,"-1"],["B","ADD",68,38,"-1/2"],["B","ADD",67,38,"-1"],["B","ADD",66,38,"-1/2"],["B","ADD",65,38,"-1"],["B","ADD",64,38,"-1/2"],["B","ADD",63,38,"-1"],["B","ADD",62,38,"-1/2"],["B","ADD",61,38,"-1"],["B","ADD",60,38,"-1/2"],["B","ADD",59,38,"-1"],["B","ADD",58,38,"-1/2"],["B","ADD",57,38,"-1/2"],["B","ADD",55,38,"-1/2"],["B","ADD",53,38,"-1/2"],["B","ADD",51,38,"-1/2"],["B","ADD",49,38,"-1/2"],["B","ADD",47,38,"-1/2"],["B","ADD",45,38,"-1/2"],["B","ADD",43,38,"-1/2"],["B","ADD",41,38,"-1/2"],["B","ADD",39,38,"1/2"],["B","LAMBDA",38,-1],["B","QUERY",38,39,-1],["B","LAMBDA",38,1],["B","ADD",38,39,"-1"],["B","ADD",74,75,"-1/2"],["B","ADD",73,75,"-1"],["B","ADD",72,75,"-1"],["B","ADD",71,75,"-1"],["B","ADD",70,75,"-1"],["B","ADD",69,75,"-1"],["B","ADD",68,75,"-1"],["B","ADD",67,75,"-1"],["B","ADD",66,75,"-1"],["B","ADD",65,75,"-1"],["B","ADD",64,75,"-1"],["B","ADD",63,75,"-1"],["B","ADD",62,75,"-1"],["B","ADD",61,75,"-1"],["B","ADD",60,75,"-1"],["B","ADD",59,75,"-1"],["B","ADD",58,75,"-1"],["B","ADD",56,75,"1"],["B","ADD",54,75,"1"],["B","ADD",52,75,"1"],["B","ADD",50,75,"1"],["B","ADD",48,75,"1"],["B","ADD",46,75,"1"],["B","ADD",44,75,"1"],["B","ADD",42,75,"1"],["B","ADD",40,75,"1"],["B","ADD",38,75,"1"],["B","SCALE",75,"-1/2"],["B","ADD",73,74,"2"],["B","ADD",72,74,"2"],["B","ADD",71,74,"2"],["B","ADD",70,74,"2"],["B","ADD",69,74,"2"],["B","ADD",68,74,"2"],["B","ADD",67,74,"2"],["B","ADD",66,74,"2"],["B","ADD",65,74,"2"],["B","ADD",64,74,"2"],["B","ADD",63,74,"2"],["B","ADD",62,74,"2"],["B","ADD",61,74,"2"],["B","ADD",60,74,"2"],["B","ADD",59,74,"2"],["B","ADD",58,74,"2"],["B","ADD",56,74,"-2"],["B","ADD",54,74,"-2"],["B","ADD",52,74,"-2"],["B","ADD",50,74,"-2"],["B","ADD",48,74,"-2"],["B","ADD",46,74,"-2"],["B","ADD",44,74,"-2"],["B","ADD",42,74,"-2"],["B","ADD",40,74,"-2"],["B","ADD",38,74,"-2"],["B","SCALE",74,"2"],["B","ADD",75,74,"3/2"],["B","SWAP",74,75],["B","ADD",71,72,"-1/2"],["B","ADD",70,72,"-1"],["B","ADD",69,72,"-1"],["B","ADD",68,72,"-1"],["B","ADD",67,72,"-1"],["B","ADD",66,72,"-1"],["B","ADD",65,72,"-1"],["B","ADD",64,72,"-1"],["B","ADD",63,72,"-1"],["B","ADD",62,72,"-1"],["B","ADD",61,72,"-1"],["B","ADD",60,72,"-1"],["B","ADD",59,72,"-1"],["B","ADD",58,72,"-1"],["B","ADD",56,72,"1"],["B","ADD",54,72,"1"],["B","ADD",52,72,"1"],["B","ADD",50,72,"1"],["B","ADD",48,72,"1"],["B","ADD",46,72,"1"],["B","ADD",44,72,"1"],["B","ADD",42,72,"1"],["B","ADD",40,72,"1"],["B","ADD",38,72,"1"],["B","SCALE",72,"-1/2"],["B","ADD",75,72,"2"],["B","ADD",74,72,"2"],["B","ADD",73,72,"2"],["B","ADD",70,71,"2"],["B","ADD",69,71,"2"],["B","ADD",68,71,"2"],["B","ADD",67,71,"2"],["B","ADD",66,71,"2"],["B","ADD",65,71,"2"],["B","ADD",64,71,"2"],["B","ADD",63,71,"2"],["B","ADD",62,71,"2"],["B","ADD",61,71,"2"],["B","ADD",60,71,"2"],["B","ADD",59,71,"2"],["B","ADD",58,71,"2"],["B","ADD",56,71,"-2"],["B","ADD",54,71,"-2"],["B","ADD",52,71,"-2"],["B","ADD",50,71,"-2"],["B","ADD",48,71,"-2"],["B","ADD",46,71,"-2"],["B","ADD",44,71,"-2"],["B","ADD",42,71,"-2"],["B","ADD",40,71,"-2"],["B","ADD",38,71,"-2"],["B","SCALE",71,"2"],["B","ADD",75,71,"1"],["B","ADD",74,71,"1"],["B","ADD",73,71,"1"],["B","ADD",72,71,"3/2"],["B","SWAP",71,72],["B","ADD",69,70,"-1"],["B","ADD",68,70,"-1/2"],["B","ADD",67,70,"-1"],["B","ADD",66,70,"-1"],["B","ADD",65,70,"-1"],["B","ADD",64,70,"-1"],["B","ADD",63,70,"-1"],["B","ADD",62,70,"-1"],["B","ADD",61,70,"-1"],["B","ADD",60,70,"-1"],["B","ADD",59,70,"-1"],["B","ADD",58,70,"-1"],["B","ADD",56,70,"1"],["B","ADD",54,70,"1"],["B","ADD",52,70,"1"],["B","ADD",50,70,"1"],["B","ADD",48,70,"1"],["B","ADD",46,70,"1"],["B","ADD",44,70,"1"],["B","ADD",42,70,"1"],["B","ADD",40,70,"1"],["B","ADD",38,70,"1"],["B","SCALE",70,"-1/2"],["B","ADD",75,70,"2"],["B","ADD",74,70,"2"],["B","ADD",73,70,"2"],["B","ADD",72,70,"2"],["B","ADD",71,70,"2"],["B","ADD",68,69,"1/2"],["B","ADD",67,69,"-1"],["B","ADD",66,69,"-1"],["B","ADD",65,69,"-1"],["B","ADD",64,69,"-1"],["B","ADD",63,69,"-1"],["B","ADD",62,69,"-1"],["B","ADD",61,69,"-1"],["B","ADD",60,69,"-1"],["B","ADD",59,69,"-1"],["B","ADD",58,69,"-1"],["B","ADD",56,69,"1"],["B","ADD",54,69,"1"],["B","ADD",52,69,"1"],["B","ADD",50,69,"1"],["B","ADD",48,69,"1"],["B","ADD",46,69,"1"],["B","ADD",44,69,"1"],["B","ADD",42,69,"1"],["B","ADD",40,69,"1"],["B","ADD",38,69,"1"],["B","SCALE",69,"-1"],["B","ADD",75,69,"1"],["B","ADD",74,69,"1"],["B","ADD",73,69,"1"],["B","ADD",72,69,"1"],["B","ADD",71,69,"1"],["B","ADD",70,69,"3/2"],["B","SWAP",69,70],["B","ADD",67,68,"2"],["B","ADD",66,68,"2"],["B","ADD",65,68,"2"],["B","ADD",64,68,"2"],["B","ADD",63,68,"2"],["B","ADD",62,68,"2"],["B","ADD",61,68,"2"],["B","ADD",60,68,"2"],["B","ADD",59,68,"2"],["B","ADD",58,68,"2"],["B","ADD",56,68,"-2"],["B","ADD",54,68,"-2"],["B","ADD",52,68,"-2"],["B","ADD",50,68,"-2"],["B","ADD",48,68,"-2"],["B","ADD",46,68,"-2"],["B","ADD",44,68,"-2"],["B","ADD",42,68,"-2"],["B","ADD",40,68,"-2"],["B","ADD",38,68,"-2"],["B","SCALE",68,"2"],["B","ADD",75,68,"1"],["B","ADD",74,68,"1"],["B","ADD",73,68,"1"],["B","ADD",72,68,"1"],["B","ADD",71,68,"1"],["B","ADD",70,68,"1"],["B","ADD",69,68,"3/2"],["B","SWAP",68,69],["B","ADD",66,67,"-1/2"],["B","ADD",65,67,"-1"],["B","ADD",64,67,"-1"],["B","ADD",63,67,"-1"],["B","ADD",62,67,"-1"],["B","ADD",61,67,"-1"],["B","ADD",60,67,"-1"],["B","ADD",59,67,"-1"],["B","ADD",58,67,"-1"],["B","ADD",56,67,"1"],["B","ADD",54,67,"1"],["B","ADD",52,67,"1"],["B","ADD",50,67,"1"],["B","ADD",48,67,"1"],["B","ADD",46,67,"1"],["B","ADD",44,67,"1"],["B","ADD",42,67,"1"],["B","ADD",40,67,"1"],["B","ADD",38,67,"1"],["B","SCALE",67,"-1/2"],["B","ADD",75,67,"2"],["B","ADD",74,67,"2"],["B","ADD",73,67,"2"],["B","ADD",72,67,"2"],["B","ADD",71,67,"2"],["B","ADD",70,67,"2"],["B","ADD",69,67,"2"],["B","ADD",68,67,"2"],["B","ADD",65,66,"2"],["B","ADD",64,66,"2"],["B","ADD",63,66,"2"],["B","ADD",62,66,"2"],["B","ADD",61,66,"2"],["B","ADD",60,66,"2"],["B","ADD",59,66,"2"],["B","ADD",58,66,"2"],["B","ADD",56,66,"-2"],["B","ADD",54,66,"-2"],["B","ADD",52,66,"-2"],["B","ADD",50,66,"-2"],["B","ADD",48,66,"-2"],["B","ADD",46,66,"-2"],["B","ADD",44,66,"-2"],["B","ADD",42,66,"-2"],["B","ADD",40,66,"-2"],["B","ADD",38,66,"-2"],["B","SCALE",66,"2"],["B","ADD",75,66,"1"],["B","ADD",74,66,"1"],["B","ADD",73,66,"1"],["B","ADD",72,66,"1"],["B","ADD",71,66,"1"],["B","ADD",70,66,"1"],["B","ADD",69,66,"1"],["B","ADD",68,66,"1"],["B","ADD",67,66,"3/2"],["B","SWAP",66,67],["B","ADD",63,64,"-1/2"],["B","ADD",62,64,"-1"],["B","ADD",61,64,"-1"],["B","ADD",60,64,"-1"],["B","ADD",59,64,"-1"],["B","ADD",58,64,"-1"],["B","ADD",56,64,"1"],["B","ADD",54,64,"1"],["B","ADD",52,64,"1"],["B","ADD",50,64,"1"],["B","ADD",48,64,"1"],["B","ADD",46,64,"1"],["B","ADD",44,64,"1"],["B","ADD",42,64,"1"],["B","ADD",40,64,"1"],["B","ADD",38,64,"1"],["B","SCALE",64,"-1/2"],["B","ADD",75,64,"2"],["B","ADD",74,64,"2"],["B","ADD",73,64,"2"],["B","ADD",72,64,"2"],["B","ADD",71,64,"2"],["B","ADD",70,64,"2"],["B","ADD",69,64,"2"],["B","ADD",68,64,"2"],["B","ADD",67,64,"2"],["B","ADD",66,64,"2"],["B","ADD",65,64,"2"],["B","ADD",62,63,"2"],["B","ADD",61,63,"2"],["B","ADD",60,63,"2"],["B","ADD",59,63,"2"],["B","ADD",58,63,"2"],["B","ADD",56,63,"-2"],["B","ADD",54,63,"-2"],["B","ADD",52,63,"-2"],["B","ADD",50,63,"-2"],["B","ADD",48,63,"-2"],["B","ADD",46,63,"-2"],["B","ADD",44,63,"-2"],["B","ADD",42,63,"-2"],["B","ADD",40,63,"-2"],["B","ADD",38,63,"-2"],["B","SCALE",63,"2"],["B","ADD",75,63,"1"],["B","ADD",74,63,"1"],["B","ADD",73,63,"1"],["B","ADD",72,63,"1"],["B","ADD",71,63,"1"],["B","ADD",70,63,"1"],["B","ADD",69,63,"1"],["B","ADD",68,63,"1"],["B","ADD",67,63,"1"],["B","ADD",66,63,"1"],["B","ADD",65,63,"1"],["B","ADD",64,63,"3/2"],["B","SWAP",63,64],["B","ADD",61,62,"-1"],["B","ADD",60,62,"-1/2"],["B","ADD",59,62,"-1"],["B","ADD",58,62,"-1"],["B","ADD",56,62,"1"],["B","ADD",54,62,"1"],["B","ADD",52,62,"1"],["B","ADD",50,62,"1"],["B","ADD",48,62,"1"],["B","ADD",46,62,"1"],["B","ADD",44,62,"1"],["B","ADD",42,62,"1"],["B","ADD",40,62,"1"],["B","ADD",38,62,"1"],["B","SCALE",62,"-1/2"],["B","ADD",75,62,"2"],["B","ADD",74,62,"2"],["B","ADD",73,62,"2"],["B","ADD",72,62,"2"],["B","ADD",71,62,"2"],["B","ADD",70,62,"2"],["B","ADD",69,62,"2"],["B","ADD",68,62,"2"],["B","ADD",67,62,"2"],["B","ADD",66,62,"2"],["B","ADD",65,62,"2"],["B","ADD",64,62,"2"],["B","ADD",63,62,"2"],["B","ADD",60,61,"1/2"],["B","ADD",59,61,"-1"],["B","ADD",58,61,"-1"],["B","ADD",56,61,"1"],["B","ADD",54,61,"1"],["B","ADD",52,61,"1"],["B","ADD",50,61,"1"],["B","ADD",48,61,"1"],["B","ADD",46,61,"1"],["B","ADD",44,61,"1"],["B","ADD",42,61,"1"],["B","ADD",40,61,"1"],["B","ADD",38,61,"1"],["B","SCALE",61,"-1"],["B","ADD",75,61,"1"],["B","ADD",74,61,"1"],["B","ADD",73,61,"1"],["B","ADD",72,61,"1"],["B","ADD",71,61,"1"],["B","ADD",70,61,"1"],["B","ADD",69,61,"1"],["B","ADD",68,61,"1"],["B","ADD",67,61,"1"],["B","ADD",66,61,"1"],["B","ADD",65,61,"1"],["B","ADD",64,61,"1"],["B","ADD",63,61,"1"],["B","ADD",62,61,"3/2"],["B","SWAP",61,62],["B","ADD",59,60,"2"],["B","ADD",58,60,"2"],["B","ADD",56,60,"-2"],["B","ADD",54,60,"-2"],["B","ADD",52,60,"-2"],["B","ADD",50,60,"-2"],["B","ADD",48,60,"-2"],["B","ADD",46,60,"-2"],["B","ADD",44,60,"-2"],["B","ADD",42,60,"-2"],["B","ADD",40,60,"-2"],["B","ADD",38,60,"-2"],["B","SCALE",60,"2"],["B","ADD",75,60,"1"],["B","ADD",74,60,"1"],["B","ADD",73,60,"1"],["B","ADD",72,60,"1"],["B","ADD",71,60,"1"],["B","ADD",70,60,"1"],["B","ADD",69,60,"1"],["B","ADD",68,60,"1"],["B","ADD",67,60,"1"],["B","ADD",66,60,"1"],["B","ADD",65,60,"1"],["B","ADD",64,60,"1"],["B","ADD",63,60,"1"],["B","ADD",62,60,"1"],["B","ADD",61,60,"3/2"],["B","SWAP",60,61],["B","ADD",58,59,"-1/2"],["B","ADD",56,59,"1"],["B","ADD",54,59,"1"],["B","ADD",52,59,"1"],["B","ADD",50,59,"1"],["B","ADD",48,59,"1"],["B","ADD",46,59,"1"],["B","ADD",44,59,"1"],["B","ADD",42,59,"1"],["B","ADD",40,59,"1"],["B","ADD",38,59,"1"],["B","SCALE",59,"-1/2"],["B","ADD",75,59,"2"],["B","ADD",74,59,"2"],["B","ADD",73,59,"2"],["B","ADD",72,59,"2"],["B","ADD",71,59,"2"],["B","ADD",70,59,"2"],["B","ADD",69,59,"2"],["B","ADD",68,59,"2"],["B","ADD",67,59,"2"],["B","ADD",66,59,"2"],["B","ADD",65,59,"2"],["B","ADD",64,59,"2"],["B","ADD",63,59,"2"],["B","ADD",62,59,"2"],["B","ADD",61,59,"2"],["B","ADD",60,59,"2"],["B","ADD",56,58,"-2"],["B","ADD",54,58,"-2"],["B","ADD",52,58,"-2"],["B","ADD",50,58,"-2"],["B","ADD",48,58,"-2"],["B","ADD",46,58,"-2"],["B","ADD",44,58,"-2"],["B","ADD",42,58,"-2"],["B","ADD",40,58,"-2"],["B","ADD",38,58,"-2"],["B","SCALE",58,"2"],["B","ADD",75,58,"1"],["B","ADD",74,58,"1"],["B","ADD",73,58,"1"],["B","ADD",72,58,"1"],["B","ADD",71,58,"1"],["B","ADD",70,58,"1"],["B","ADD",69,58,"1"],["B","ADD",68,58,"1"],["B","ADD",67,58,"1"],["B","ADD",66,58,"1"],["B","ADD",65,58,"1"],["B","ADD",64,58,"1"],["B","ADD",63,58,"1"],["B","ADD",62,58,"1"],["B","ADD",61,58,"1"],["B","ADD",60,58,"1"],["B","ADD",59,58,"3/2"],["B","SWAP",58,59],["B","ADD",56,57,"-2"],["B","ADD",54,57,"-2"],["B","ADD",52,57,"-2"],["B","ADD",50,57,"-2"],["B","ADD",48,57,"-2"],["B","ADD",46,57,"-2"],["B","ADD",44,57,"-2"],["B","ADD",42,57,"-2"],["B","ADD",40,57,"-2"],["B","ADD",38,57,"-2"],["B","ADD",75,57,"2"],["B","ADD",74,57,"2"],["B","ADD",73,57,"2"],["B","ADD",72,57,"2"],["B","ADD",71,57,"2"],["B","ADD",70,57,"2"],["B","ADD",69,57,"2"],["B","ADD",68,57,"2"],["B","ADD",67,57,"2"],["B","ADD",66,57,"2"],["B","ADD",65,57,"2"],["B","ADD",64,57,"2"],["B","ADD",63,57,"2"],["B","ADD",62,57,"2"],["B","ADD",61,57,"2"],["B","ADD",60,57,"2"],["B","ADD",59,57,"2"],["B","ADD",58,57,"2"],["B","ADD",54,56,"-2"],["B","ADD",52,56,"-2"],["B","ADD",50,56,"-2"],["B","ADD",48,56,"-2"],["B","ADD",46,56,"-2"],["B","ADD",44,56,"-2"],["B","ADD",42,56,"-2"],["B","ADD",40,56,"-2"],["B","ADD",38,56,"-2"],["B","SCALE",56,"-1"],["B","ADD",75,56,"-2"],["B","ADD",74,56,"-2"],["B","ADD",73,56,"-2"],["B","ADD",72,56,"-2"],["B","ADD",71,56,"-2"],["B","ADD",70,56,"-2"],["B","ADD",69,56,"-2"],["B","ADD",68,56,"-2"],["B","ADD",67,56,"-2"],["B","ADD",66,56,"-2"],["B","ADD",65,56,"-2"],["B","ADD",64,56,"-2"],["B","ADD",63,56,"-2"],["B","ADD",62,56,"-2"],["B","ADD",61,56,"-2"],["B","ADD",60,56,"-2"],["B","ADD",59,56,"-2"],["B","ADD",58,56,"-2"],["B","ADD",54,55,"2"],["B","ADD",52,55,"2"],["B","ADD",50,55,"2"],["B","ADD",48,55,"2"],["B","ADD",46,55,"2"],["B","ADD",44,55,"2"],["B","ADD",42,55,"2"],["B","ADD",40,55,"2"],["B","ADD",38,55,"2"],["B","ADD",75,55,"-2"],["B","ADD",74,55,"-2"],["B","ADD",73,55,"-2"],["B","ADD",72,55,"-2"],["B","ADD",71,55,"-2"],["B","ADD",70,55,"-2"],["B","ADD",69,55,"-2"],["B","ADD",68,55,"-2"],["B","ADD",67,55,"-2"],["B","ADD",66,55,"-2"],["B","ADD",65,55,"-2"],["B","ADD",64,55,"-2"],["B","ADD",63,55,"-2"],["B","ADD",62,55,"-2"],["B","ADD",61,55,"-2"],["B","ADD",60,55,"-2"],["B","ADD",59,55,"-2"],["B","ADD",58,55,"-2"],["B","ADD",56,55,"2"],["B","ADD",52,53,"-2"],["B","ADD",50,53,"-2"],["B","ADD",48,53,"-2"],["B","ADD",46,53,"-2"],["B","ADD",44,53,"-2"],["B","ADD",42,53,"-2"],["B","ADD",40,53,"-2"],["B","ADD",38,53,"-2"],["B","ADD",75,53,"2"],["B","ADD",74,53,"2"],["B","ADD",73,53,"2"],["B","ADD",72,53,"2"],["B","ADD",71,53,"2"],["B","ADD",70,53,"2"],["B","ADD",69,53,"2"],["B","ADD",68,53,"2"],["B","ADD",67,53,"2"],["B","ADD",66,53,"2"],["B","ADD",65,53,"2"],["B","ADD",64,53,"2"],["B","ADD",63,53,"2"],["B","ADD",62,53,"2"],["B","ADD",61,53,"2"],["B","ADD",60,53,"2"],["B","ADD",59,53,"2"],["B","ADD",58,53,"2"],["B","ADD",56,53,"-2"],["B","ADD",54,53,"-2"],["B","ADD",50,52,"-2"],["B","ADD",48,52,"-2"],["B","ADD",46,52,"-2"],["B","ADD",44,52,"-2"],["B","ADD",42,52,"-2"],["B","ADD",40,52,"-2"],["B","ADD",38,52,"-2"],["B","SCALE",52,"-1"],["B","ADD",75,52,"-2"],["B","ADD",74,52,"-2"],["B","ADD",73,52,"-2"],["B","ADD",72,52,"-2"],["B","ADD",71,52,"-2"],["B","ADD",70,52,"-2"],["B","ADD",69,52,"-2"],["B","ADD",68,52,"-2"],["B","ADD",67,52,"-2"],["B","ADD",66,52,"-2"],["B","ADD",65,52,"-2"],["B","ADD",64,52,"-2"],["B","ADD",63,52,"-2"],["B","ADD",62,52,"-2"],["B","ADD",61,52,"-2"],["B","ADD",60,52,"-2"],["B","ADD",59,52,"-2"],["B","ADD",58,52,"-2"],["B","ADD",56,52,"2"],["B","ADD",54,52,"2"],["B","ADD",50,51,"2"],["B","ADD",48,51,"2"],["B","ADD",46,51,"2"],["B","ADD",44,51,"2"],["B","ADD",42,51,"2"],["B","ADD",40,51,"2"],["B","ADD",38,51,"2"],["B","ADD",75,51,"-2"],["B","ADD",74,51,"-2"],["B","ADD",73,51,"-2"],["B","ADD",72,51,"-2"],["B","ADD",71,51,"-2"],["B","ADD",70,51,"-2"],["B","ADD",69,51,"-2"],["B","ADD",68,51,"-2"],["B","ADD",67,51,"-2"],["B","ADD",66,51,"-2"],["B","ADD",65,51,"-2"],["B","ADD",64,51,"-2"],["B","ADD",63,51,"-2"],["B","ADD",62,51,"-2"],["B","ADD",61,51,"-2"],["B","ADD",60,51,"-2"],["B","ADD",59,51,"-2"],["B","ADD",58,51,"-2"],["B","ADD",56,51,"2"],["B","ADD",54,51,"2"],["B","ADD",52,51,"2"],["B","ADD",48,49,"-2"],["B","ADD",46,49,"-2"],["B","ADD",44,49,"-2"],["B","ADD",42,49,"-2"],["B","ADD",40,49,"-2"],["B","ADD",38,49,"-2"],["B","ADD",75,49,"2"],["B","ADD",74,49,"2"],["B","ADD",73,49,"2"],["B","ADD",72,49,"2"],["B","ADD",71,49,"2"],["B","ADD",70,49,"2"],["B","ADD",69,49,"2"],["B","ADD",68,49,"2"],["B","ADD",67,49,"2"],["B","ADD",66,49,"2"],["B","ADD",65,49,"2"],["B","ADD",64,49,"2"],["B","ADD",63,49,"2"],["B","ADD",62,49,"2"],["B","ADD",61,49,"2"],["B","ADD",60,49,"2"],["B","ADD",59,49,"2"],["B","ADD",58,49,"2"],["B","ADD",56,49,"-2"],["B","ADD",54,49,"-2"],["B","ADD",52,49,"-2"],["B","ADD",50,49,"-2"],["B","ADD",46,48,"-2"],["B","ADD",44,48,"-2"],["B","ADD",42,48,"-2"],["B","ADD",40,48,"-2"],["B","ADD",38,48,"-2"],["B","SCALE",48,"-1"],["B","ADD",75,48,"-2"],["B","ADD",74,48,"-2"],["B","ADD",73,48,"-2"],["B","ADD",72,48,"-2"],["B","ADD",71,48,"-2"],["B","ADD",70,48,"-2"],["B","ADD",69,48,"-2"],["B","ADD",68,48,"-2"],["B","ADD",67,48,"-2"],["B","ADD",66,48,"-2"],["B","ADD",65,48,"-2"],["B","ADD",64,48,"-2"],["B","ADD",63,48,"-2"],["B","ADD",62,48,"-2"],["B","ADD",61,48,"-2"],["B","ADD",60,48,"-2"],["B","ADD",59,48,"-2"],["B","ADD",58,48,"-2"],["B","ADD",56,48,"2"],["B","ADD",54,48,"2"],["B","ADD",52,48,"2"],["B","ADD",50,48,"2"],["B","ADD",46,47,"2"],["B","ADD",44,47,"2"],["B","ADD",42,47,"2"],["B","ADD",40,47,"2"],["B","ADD",38,47,"2"],["B","ADD",75,47,"-2"],["B","ADD",74,47,"-2"],["B","ADD",73,47,"-2"],["B","ADD",72,47,"-2"],["B","ADD",71,47,"-2"],["B","ADD",70,47,"-2"],["B","ADD",69,47,"-2"],["B","ADD",68,47,"-2"],["B","ADD",67,47,"-2"],["B","ADD",66,47,"-2"],["B","ADD",65,47,"-2"],["B","ADD",64,47,"-2"],["B","ADD",63,47,"-2"],["B","ADD",62,47,"-2"],["B","ADD",61,47,"-2"],["B","ADD",60,47,"-2"],["B","ADD",59,47,"-2"],["B","ADD",58,47,"-2"],["B","ADD",56,47,"2"],["B","ADD",54,47,"2"],["B","ADD",52,47,"2"],["B","ADD",50,47,"2"],["B","ADD",48,47,"2"],["B","ADD",44,45,"-2"],["B","ADD",42,45,"-2"],["B","ADD",40,45,"-2"],["B","ADD",38,45,"-2"],["B","ADD",75,45,"2"],["B","ADD",74,45,"2"],["B","ADD",73,45,"2"],["B","ADD",72,45,"2"],["B","ADD",71,45,"2"],["B","ADD",70,45,"2"],["B","ADD",69,45,"2"],["B","ADD",68,45,"2"],["B","ADD",67,45,"2"],["B","ADD",66,45,"2"],["B","ADD",65,45,"2"],["B","ADD",64,45,"2"],["B","ADD",63,45,"2"],["B","ADD",62,45,"2"],["B","ADD",61,45,"2"],["B","ADD",60,45,"2"],["B","ADD",59,45,"2"],["B","ADD",58,45,"2"],["B","ADD",56,45,"-2"],["B","ADD",54,45,"-2"],["B","ADD",52,45,"-2"],["B","ADD",50,45,"-2"],["B","ADD",48,45,"-2"],["B","ADD",46,45,"-2"],["B","ADD",42,44,"-2"],["B","ADD",40,44,"-2"],["B","ADD",38,44,"-2"],["B","SCALE",44,"-1"],["B","ADD",75,44,"-2"],["B","ADD",74,44,"-2"],["B","ADD",73,44,"-2"],["B","ADD",72,44,"-2"],["B","ADD",71,44,"-2"],["B","ADD",70,44,"-2"],["B","ADD",69,44,"-2"],["B","ADD",68,44,"-2"],["B","ADD",67,44,"-2"],["B","ADD",66,44,"-2"],["B","ADD",65,44,"-2"],["B","ADD",64,44,"-2"],["B","ADD",63,44,"-2"],["B","ADD",62,44,"-2"],["B","ADD",61,44,"-2"],["B","ADD",60,44,"-2"],["B","ADD",59,44,"-2"],["B","ADD",58,44,"-2"],["B","ADD",56,44,"2"],["B","ADD",54,44,"2"],["B","ADD",52,44,"2"],["B","ADD",50,44,"2"],["B","ADD",48,44,"2"],["B","ADD",46,44,"2"],["B","ADD",42,43,"2"],["B","ADD",40,43,"2"],["B","ADD",38,43,"2"],["B","ADD",75,43,"-2"],["B","ADD",74,43,"-2"],["B","ADD",73,43,"-2"],["B","ADD",72,43,"-2"],["B","ADD",71,43,"-2"],["B","ADD",70,43,"-2"],["B","ADD",69,43,"-2"],["B","ADD",68,43,"-2"],["B","ADD",67,43,"-2"],["B","ADD",66,43,"-2"],["B","ADD",65,43,"-2"],["B","ADD",64,43,"-2"],["B","ADD",63,43,"-2"],["B","ADD",62,43,"-2"],["B","ADD",61,43,"-2"],["B","ADD",60,43,"-2"],["B","ADD",59,43,"-2"],["B","ADD",58,43,"-2"],["B","ADD",56,43,"2"],["B","ADD",54,43,"2"],["B","ADD",52,43,"2"],["B","ADD",50,43,"2"],["B","ADD",48,43,"2"],["B","ADD",46,43,"2"],["B","ADD",44,43,"2"],["B","ADD",40,41,"-2"],["B","ADD",38,41,"-2"],["B","ADD",75,41,"2"],["B","ADD",74,41,"2"],["B","ADD",73,41,"2"],["B","ADD",72,41,"2"],["B","ADD",71,41,"2"],["B","ADD",70,41,"2"],["B","ADD",69,41,"2"],["B","ADD",68,41,"2"],["B","ADD",67,41,"2"],["B","ADD",66,41,"2"],["B","ADD",65,41,"2"],["B","ADD",64,41,"2"],["B","ADD",63,41,"2"],["B","ADD",62,41,"2"],["B","ADD",61,41,"2"],["B","ADD",60,41,"2"],["B","ADD",59,41,"2"],["B","ADD",58,41,"2"],["B","ADD",56,41,"-2"],["B","ADD",54,41,"-2"],["B","ADD",52,41,"-2"],["B","ADD",50,41,"-2"],["B","ADD",48,41,"-2"],["B","ADD",46,41,"-2"],["B","ADD",44,41,"-2"],["B","ADD",42,41,"-2"],["B","ADD",38,40,"-2"],["B","SCALE",40,"-1"],["B","ADD",75,40,"-2"],["B","ADD",74,40,"-2"],["B","ADD",73,40,"-2"],["B","ADD",72,40,"-2"],["B","ADD",71,40,"-2"],["B","ADD",70,40,"-2"],["B","ADD",69,40,"-2"],["B","ADD",68,40,"-2"],["B","ADD",67,40,"-2"],["B","ADD",66,40,"-2"],["B","ADD",65,40,"-2"],["B","ADD",64,40,"-2"],["B","ADD",63,40,"-2"],["B","ADD",62,40,"-2"],["B","ADD",61,40,"-2"],["B","ADD",60,40,"-2"],["B","ADD",59,40,"-2"],["B","ADD",58,40,"-2"],["B","ADD",56,40,"2"],["B","ADD",54,40,"2"],["B","ADD",52,40,"2"],["B","ADD",50,40,"2"],["B","ADD",48,40,"2"],["B","ADD",46,40,"2"],["B","ADD",44,40,"2"],["B","ADD",42,40,"2"],["B","SCALE",39,"-1"],["B","ADD",75,39,"-2"],["B","ADD",74,39,"-2"],["B","ADD",73,39,"-2"],["B","ADD",72,39,"-2"],["B","ADD",71,39,"-2"],["B","ADD",70,39,"-2"],["B","ADD",69,39,"-2"],["B","ADD",68,39,"-2"],["B","ADD",67,39,"-2"],["B","ADD",66,39,"-2"],["B","ADD",65,39,"-2"],["B","ADD",64,39,"-2"],["B","ADD",63,39,"-2"],["B","ADD",62,39,"-2"],["B","ADD",61,39,"-2"],["B","ADD",60,39,"-2"],["B","ADD",59,39,"-2"],["B","ADD",58,39,"-2"],["B","SCALE",38,"1/2"],["B","ADD",75,38,"2"],["B","ADD",74,38,"2"],["B","ADD",73,38,"2"],["B","ADD",72,38,"2"],["B","ADD",71,38,"2"],["B","ADD",70,38,"2"],["B","ADD",69,38,"2"],["B","ADD",68,38,"2"],["B","ADD",67,38,"2"],["B","ADD",66,38,"2"],["B","ADD",65,38,"2"],["B","ADD",64,38,"2"],["B","ADD",63,38,"2"],["B","ADD",62,38,"2"],["B","ADD",61,38,"2"],["B","ADD",60,38,"2"],["B","ADD",59,38,"2"],["B","ADD",58,38,"2"],["B","ADD",56,38,"-2"],["B","ADD",54,38,"-2"],["B","ADD",52,38,"-2"],["B","ADD",50,38,"-2"],["B","ADD",48,38,"-2"],["B","ADD",46,38,"-2"],["B","ADD",44,38,"-2"],["B","ADD",42,38,"-2"],["B","ADD",40,38,"-2"],["B","SWAP",38,39],["B","LAMBDA",38,-1],["B","QUERY",38,39,-1],["B","LAMBDA",38,1],["B","ADD",38,39,"-1"],["B","ADD",39,75,"1"],["B","ADD",72,74,"-1"],["B","ADD",70,74,"-1"],["B","ADD",68,74,"-1"],["B","ADD",66,74,"-1"],["B","ADD",64,74,"-1"],["B","ADD",62,74,"-1"],["B","ADD",58,74,"-1/2"],["B","ADD",39,74,"1"],["B","SWAP",73,75],["B","ADD",39,72,"1"],["B","SWAP",72,74],["B","ADD",39,71,"-1"],["B","ADD",39,70,"1"],["B","ADD",39,68,"-1"],["B","ADD",39,67,"1"],["B","ADD",39,66,"-1"],["B","SWAP",65,69],["B","ADD",39,64,"1"],["B","SWAP",64,68],["B","ADD",39,63,"-1"],["B","SWAP",63,71],["B","ADD",39,62,"1"],["B","SWAP",62,70],["B","SWAP",61,75],["B","ADD",39,60,"-1"],["B","SWAP",60,74],["B","ADD",58,59,"-1"],["B","ADD",38,59,"1"],["B","SCALE",59,"-2"],["B","ADD",75,59,"1"],["B","ADD",74,59,"1"],["B","SWAP",59,73],["B","SCALE",58,"-2"],["B","ADD",72,58,"-1"],["B","ADD",70,58,"1"],["B","ADD",68,58,"1"],["B","ADD",66,58,"1"],["B","ADD",64,58,"1"],["B","ADD",62,58,"1"],["B","ADD",60,58,"1"],["B","ADD",39,57,"-1"],["B","ADD",39,56,"1"],["B","ADD",39,55,"-1"],["B","ADD",39,53,"1"],["B","ADD",39,52,"-1"],["B","ADD",39,51,"1"],["B","ADD",39,49,"-1"],["B","ADD",39,48,"1"],["B","ADD",39,47,"-1"],["B","ADD",39,45,"1"],["B","ADD",39,44,"-1"],["B","ADD",39,43,"1"],["B","ADD",39,41,"-1"],["B","ADD",39,40,"1"],["B","ADD",38,39,"1"],["B","SCALE",39,"-128"],["B","ADD",72,39,"1/64"],["B","ADD",70,39,"-1/64"],["B","ADD",68,39,"-1/64"],["B","ADD",66,39,"-1/64"],["B","ADD",64,39,"-1/64"],["B","ADD",62,39,"-1/64"],["B","ADD",60,39,"-1/64"],["B","ADD",58,39,"-1/64"],["B","SCALE",38,"128"],["B","ADD",75,38,"1/32"],["B","ADD",74,38,"1/64"],["B","ADD",73,38,"1/32"],["B","ADD",72,38,"-1/64"],["B","SWAP",38,39],["B","LAMBDA",38,-1],["J",10,[1,0,19,20],[39,38,"-1","1/2"]],["A","LAMBDA",19,-1],["A","SCALE",20,"-1"],["A","LAMBDA",0,1],["A","ADD",0,1,"-1"],["A","IDLE_ONE",2,[10]],["A","IDLE_ONE",3,[10,11]],["A","IDLE_ONE",4,[10,11,12]],["A","IDLE_ONE",5,[10,11,12,13]],["A","IDLE_ONE",6,[10,11,12,13,14]],["A","IDLE_ONE",7,[10,11,12,13,14,15]],["A","IDLE_ONE",8,[10,11,12,13,14,15,16]],["A","IDLE_ONE",9,[10,11,12,13,14,15,16,17]],["A","SWAP",17,18],["A","SWAP",16,18],["A","SWAP",15,18],["A","SWAP",14,18],["A","SWAP",13,18],["A","SWAP",12,18],["A","SWAP",11,18],["A","SWAP",10,18],["A","SWAP",9,18],["A","SWAP",8,18],["A","SWAP",7,18],["A","SWAP",6,18],["A","SWAP",5,18],["A","SWAP",4,18],["A","SWAP",3,18],["A","ADD",1,2,"-1"],["A","SCALE",2,"-1"],["A","SWAP",2,18],["A","SCALE",1,"-1"],["A","ADD",18,1,"2"],["A","ADD",18,0,"2"],["A","ADD",1,0,"1"],["A","SWAP",0,18],["A","LAMBDA",0,-1],["A","ADD",19,20,"-1"],["A","IDLE_ONE",21,[10]],["A","IDLE_ONE",22,[10,11]],["A","IDLE_ONE",23,[10,11,12]],["A","IDLE_ONE",24,[10,11,12,13]],["A","IDLE_ONE",25,[10,11,12,13,14]],["A","IDLE_ONE",26,[10,11,12,13,14,15]],["A","IDLE_ONE",27,[10,11,12,13,14,15,16]],["A","IDLE_ONE",28,[10,11,12,13,14,15,16,17]],["A","SWAP",36,37],["A","SWAP",35,37],["A","SWAP",34,37],["A","SWAP",33,37],["A","SWAP",32,37],["A","SWAP",31,37],["A","SWAP",30,37],["A","SWAP",29,37],["A","SWAP",28,37],["A","SWAP",27,37],["A","SWAP",26,37],["A","SWAP",25,37],["A","SWAP",24,37],["A","SWAP",23,37],["A","SWAP",22,37],["A","ADD",20,21,"-1"],["A","SCALE",21,"-1"],["A","SWAP",21,37],["A","ADD",37,20,"-2"],["A","ADD",37,19,"2"],["A","ADD",20,19,"-1"],["A","SWAP",19,37],["A","LAMBDA",19,1],["B","LAMBDA",38,1],["B","IDLE_ONE",58,[10,11,12,13,14,15,16,17]],["B","IDLE_ONE",59,[10,11,12,13,14,15,16,17]],["B","IDLE_ONE",60,[10,11,12,13,14,15,16]],["B","IDLE_ONE",61,[10,11,12,13,14,15,16]],["B","IDLE_ONE",62,[10,11,12,13,14,15]],["B","IDLE_ONE",63,[10,11,12,13,14,15]],["B","IDLE_ONE",64,[10,11,12,13,14]],["B","IDLE_ONE",65,[10,11,12,13,14]],["B","IDLE_ONE",66,[10,11,12,13]],["B","IDLE_ONE",67,[10,11,12,13]],["B","IDLE_ONE",68,[10,11,12]],["B","IDLE_ONE",69,[10,11,12]],["B","IDLE_ONE",70,[10,11]],["B","IDLE_ONE",71,[10,11]],["B","IDLE_ONE",72,[10]],["B","IDLE_ONE",73,[10]],["B","IDLE_ONE",74,[10]],["B","IDLE_ONE",75,[10]],["B","ADD",74,75,"-1/2"],["B","ADD",73,75,"-1"],["B","ADD",72,75,"1/2"],["B","ADD",39,75,"-64"],["B","SCALE",75,"1/4"],["B","ADD",72,74,"-2"],["B","SCALE",74,"2"],["B","ADD",75,74,"1/2"],["B","ADD",72,73,"3/2"],["B","ADD",39,73,"64"],["B","ADD",38,73,"64"],["B","SCALE",73,"2"],["B","ADD",75,73,"-5/8"],["B","ADD",74,73,"-3/2"],["B","SWAP",73,75],["B","ADD",38,72,"-64"],["B","ADD",74,72,"2"],["B","ADD",73,72,"3/2"],["B","SWAP",72,73],["B","SWAP",71,73],["B","SWAP",70,72],["B","SWAP",69,71],["B","SWAP",68,70],["B","SWAP",67,69],["B","SWAP",66,68],["B","SWAP",65,67],["B","SWAP",64,66],["B","SWAP",63,65],["B","SWAP",62,64],["B","SWAP",61,63],["B","SWAP",60,62],["B","SWAP",59,61],["B","SWAP",58,60],["B","ADD",38,39,"1/2"],["B","SCALE",39,"-1"],["B","ADD",75,39,"1/32"],["B","ADD",74,39,"-1/64"],["B","ADD",59,39,"1/64"],["B","ADD",58,39,"1/128"],["B","SCALE",38,"-1"],["B","ADD",75,38,"-1/32"],["B","ADD",59,38,"-1/64"],["B","ADD",58,38,"-1/64"],["B","ADD",39,38,"-1"],["B","LAMBDA",38,-1],["J",11,[1,0,19,20],[39,38,"-1","1/2"]],["A","LAMBDA",19,-1],["A","SCALE",20,"-1"],["A","LAMBDA",0,1],["A","SWAP",17,18],["A","SWAP",16,18],["A","SWAP",15,18],["A","SWAP",14,18],["A","SWAP",13,18],["A","SWAP",12,18],["A","SWAP",11,18],["A","SWAP",10,18],["A","SWAP",9,18],["A","SWAP",8,18],["A","SWAP",7,18],["A","SWAP",6,18],["A","SWAP",5,18],["A","SWAP",4,18],["A","SWAP",3,18],["A","ADD",1,2,"-1"],["A","ADD",0,2,"-1"],["A","SCALE",2,"-1"],["A","SWAP",2,18],["A","ADD",0,1,"-1"],["A","SCALE",1,"-1"],["A","ADD",18,1,"2"],["A","ADD",18,0,"2"],["A","ADD",1,0,"1"],["A","SWAP",0,18],["A","LAMBDA",0,-1],["A","SWAP",36,37],["A","SWAP",35,37],["A","SWAP",34,37],["A","SWAP",33,37],["A","SWAP",32,37],["A","SWAP",31,37],["A","SWAP",30,37],["A","SWAP",29,37],["A","SWAP",28,37],["A","SWAP",27,37],["A","SWAP",26,37],["A","SWAP",25,37],["A","SWAP",24,37],["A","SWAP",23,37],["A","SWAP",22,37],["A","ADD",20,21,"-1"],["A","ADD",19,21,"-1"],["A","SCALE",21,"-1"],["A","SWAP",21,37],["A","ADD",19,20,"-1"],["A","ADD",37,20,"-2"],["A","ADD",37,19,"2"],["A","ADD",20,19,"-1"],["A","SWAP",19,37],["A","LAMBDA",19,1],["B","LAMBDA",38,1],["B","IDLE_ONE",74,[11]],["B","IDLE_ONE",75,[11]],["B","ADD",74,75,"1"],["B","ADD",72,75,"-1/4"],["B","ADD",39,75,"-64"],["B","SCALE",75,"-1/2"],["B","ADD",73,74,"1/2"],["B","ADD",72,74,"1/2"],["B","ADD",39,74,"64"],["B","ADD",38,74,"32"],["B","SWAP",74,75],["B","ADD",72,73,"-1/2"],["B","ADD",39,73,"-128"],["B","SCALE",73,"-1"],["B","ADD",75,73,"2"],["B","ADD",74,73,"-1"],["B","ADD",38,72,"128"],["B","SCALE",72,"-2"],["B","ADD",74,72,"1"],["B","ADD",73,72,"1"],["B","SWAP",71,73],["B","SWAP",70,72],["B","SWAP",69,71],["B","SWAP",68,70],["B","SWAP",67,69],["B","SWAP",66,68],["B","SWAP",65,67],["B","SWAP",64,66],["B","SWAP",63,65],["B","SWAP",62,64],["B","SWAP",61,63],["B","SWAP",60,62],["B","ADD",38,39,"1/2"],["B","SCALE",39,"-1"],["B","ADD",75,39,"1/32"],["B","ADD",74,39,"-1/64"],["B","ADD",61,39,"1/64"],["B","ADD",60,39,"1/128"],["B","SCALE",38,"-1"],["B","ADD",75,38,"-1/32"],["B","ADD",61,38,"-1/64"],["B","ADD",60,38,"-1/64"],["B","ADD",39,38,"-1"],["B","LAMBDA",38,-1],["J",12,[1,0,19,20],[39,38,"-1","1/2"]],["A","LAMBDA",19,-1],["A","SCALE",20,"-1"],["A","LAMBDA",0,1],["A","SWAP",17,18],["A","SWAP",16,18],["A","SWAP",15,18],["A","SWAP",14,18],["A","SWAP",13,18],["A","SWAP",12,18],["A","SWAP",11,18],["A","SWAP",10,18],["A","SWAP",9,18],["A","SWAP",8,18],["A","SWAP",7,18],["A","SWAP",6,18],["A","SWAP",5,18],["A","SWAP",4,18],["A","SWAP",3,18],["A","ADD",1,2,"-1"],["A","ADD",0,2,"-1"],["A","SCALE",2,"-1"],["A","SWAP",2,18],["A","ADD",0,1,"-1"],["A","SCALE",1,"-1"],["A","ADD",18,1,"2"],["A","ADD",18,0,"2"],["A","ADD",1,0,"1"],["A","SWAP",0,18],["A","LAMBDA",0,-1],["A","SWAP",36,37],["A","SWAP",35,37],["A","SWAP",34,37],["A","SWAP",33,37],["A","SWAP",32,37],["A","SWAP",31,37],["A","SWAP",30,37],["A","SWAP",29,37],["A","SWAP",28,37],["A","SWAP",27,37],["A","SWAP",26,37],["A","SWAP",25,37],["A","SWAP",24,37],["A","SWAP",23,37],["A","SWAP",22,37],["A","ADD",20,21,"-1"],["A","ADD",19,21,"-1"],["A","SCALE",21,"-1"],["A","SWAP",21,37],["A","ADD",19,20,"-1"],["A","ADD",37,20,"-2"],["A","ADD",37,19,"2"],["A","ADD",20,19,"-1"],["A","SWAP",19,37],["A","LAMBDA",19,1],["B","LAMBDA",38,1],["B","IDLE_ONE",74,[12]],["B","IDLE_ONE",75,[12]],["B","ADD",74,75,"1"],["B","ADD",72,75,"-1/4"],["B","ADD",39,75,"-64"],["B","SCALE",75,"-1/2"],["B","ADD",73,74,"1/2"],["B","ADD",72,74,"1/2"],["B","ADD",39,74,"64"],["B","ADD",38,74,"32"],["B","SWAP",74,75],["B","ADD",72,73,"-1/2"],["B","ADD",39,73,"-128"],["B","SCALE",73,"-1"],["B","ADD",75,73,"2"],["B","ADD",74,73,"-1"],["B","ADD",38,72,"128"],["B","SCALE",72,"-2"],["B","ADD",74,72,"1"],["B","ADD",73,72,"1"],["B","SWAP",71,73],["B","SWAP",70,72],["B","SWAP",69,71],["B","SWAP",68,70],["B","SWAP",67,69],["B","SWAP",66,68],["B","SWAP",65,67],["B","SWAP",64,66],["B","SWAP",63,65],["B","SWAP",62,64],["B","ADD",38,39,"1/2"],["B","SCALE",39,"-1"],["B","ADD",75,39,"1/32"],["B","ADD",74,39,"-1/64"],["B","ADD",63,39,"1/64"],["B","ADD",62,39,"1/128"],["B","SCALE",38,"-1"],["B","ADD",75,38,"-1/32"],["B","ADD",63,38,"-1/64"],["B","ADD",62,38,"-1/64"],["B","ADD",39,38,"-1"],["B","LAMBDA",38,-1],["J",13,[1,0,19,20],[39,38,"-1","1/2"]],["A","LAMBDA",19,-1],["A","SCALE",20,"-1"],["A","LAMBDA",0,1],["A","SWAP",17,18],["A","SWAP",16,18],["A","SWAP",15,18],["A","SWAP",14,18],["A","SWAP",13,18],["A","SWAP",12,18],["A","SWAP",11,18],["A","SWAP",10,18],["A","SWAP",9,18],["A","SWAP",8,18],["A","SWAP",7,18],["A","SWAP",6,18],["A","SWAP",5,18],["A","SWAP",4,18],["A","SWAP",3,18],["A","ADD",1,2,"-1"],["A","ADD",0,2,"-1"],["A","SCALE",2,"-1"],["A","SWAP",2,18],["A","ADD",0,1,"-1"],["A","SCALE",1,"-1"],["A","ADD",18,1,"2"],["A","ADD",18,0,"2"],["A","ADD",1,0,"1"],["A","SWAP",0,18],["A","LAMBDA",0,-1],["A","SWAP",36,37],["A","SWAP",35,37],["A","SWAP",34,37],["A","SWAP",33,37],["A","SWAP",32,37],["A","SWAP",31,37],["A","SWAP",30,37],["A","SWAP",29,37],["A","SWAP",28,37],["A","SWAP",27,37],["A","SWAP",26,37],["A","SWAP",25,37],["A","SWAP",24,37],["A","SWAP",23,37],["A","SWAP",22,37],["A","ADD",20,21,"-1"],["A","ADD",19,21,"-1"],["A","SCALE",21,"-1"],["A","SWAP",21,37],["A","ADD",19,20,"-1"],["A","ADD",37,20,"-2"],["A","ADD",37,19,"2"],["A","ADD",20,19,"-1"],["A","SWAP",19,37],["A","LAMBDA",19,1],["B","LAMBDA",38,1],["B","IDLE_ONE",74,[13]],["B","IDLE_ONE",75,[13]],["B","ADD",74,75,"1"],["B","ADD",72,75,"-1/4"],["B","ADD",39,75,"-64"],["B","SCALE",75,"-1/2"],["B","ADD",73,74,"1/2"],["B","ADD",72,74,"1/2"],["B","ADD",39,74,"64"],["B","ADD",38,74,"32"],["B","SWAP",74,75],["B","ADD",72,73,"-1/2"],["B","ADD",39,73,"-128"],["B","SCALE",73,"-1"],["B","ADD",75,73,"2"],["B","ADD",74,73,"-1"],["B","ADD",38,72,"128"],["B","SCALE",72,"-2"],["B","ADD",74,72,"1"],["B","ADD",73,72,"1"],["B","SWAP",71,73],["B","SWAP",70,72],["B","SWAP",69,71],["B","SWAP",68,70],["B","SWAP",67,69],["B","SWAP",66,68],["B","SWAP",65,67],["B","SWAP",64,66],["B","ADD",38,39,"1/2"],["B","SCALE",39,"-1"],["B","ADD",75,39,"1/32"],["B","ADD",74,39,"-1/64"],["B","ADD",65,39,"1/64"],["B","ADD",64,39,"1/128"],["B","SCALE",38,"-1"],["B","ADD",75,38,"-1/32"],["B","ADD",65,38,"-1/64"],["B","ADD",64,38,"-1/64"],["B","ADD",39,38,"-1"],["B","LAMBDA",38,-1],["J",14,[1,0,19,20],[39,38,"-1","1/2"]],["A","LAMBDA",19,-1],["A","SCALE",20,"-1"],["A","LAMBDA",0,1],["A","SWAP",17,18],["A","SWAP",16,18],["A","SWAP",15,18],["A","SWAP",14,18],["A","SWAP",13,18],["A","SWAP",12,18],["A","SWAP",11,18],["A","SWAP",10,18],["A","SWAP",9,18],["A","SWAP",8,18],["A","SWAP",7,18],["A","SWAP",6,18],["A","SWAP",5,18],["A","SWAP",4,18],["A","SWAP",3,18],["A","ADD",1,2,"-1"],["A","ADD",0,2,"-1"],["A","SCALE",2,"-1"],["A","SWAP",2,18],["A","ADD",0,1,"-1"],["A","SCALE",1,"-1"],["A","ADD",18,1,"2"],["A","ADD",18,0,"2"],["A","ADD",1,0,"1"],["A","SWAP",0,18],["A","LAMBDA",0,-1],["A","SWAP",36,37],["A","SWAP",35,37],["A","SWAP",34,37],["A","SWAP",33,37],["A","SWAP",32,37],["A","SWAP",31,37],["A","SWAP",30,37],["A","SWAP",29,37],["A","SWAP",28,37],["A","SWAP",27,37],["A","SWAP",26,37],["A","SWAP",25,37],["A","SWAP",24,37],["A","SWAP",23,37],["A","SWAP",22,37],["A","ADD",20,21,"-1"],["A","ADD",19,21,"-1"],["A","SCALE",21,"-1"],["A","SWAP",21,37],["A","ADD",19,20,"-1"],["A","ADD",37,20,"-2"],["A","ADD",37,19,"2"],["A","ADD",20,19,"-1"],["A","SWAP",19,37],["A","LAMBDA",19,1],["B","LAMBDA",38,1],["B","IDLE_ONE",74,[14]],["B","IDLE_ONE",75,[14]],["B","ADD",74,75,"1"],["B","ADD",72,75,"-1/4"],["B","ADD",39,75,"-64"],["B","SCALE",75,"-1/2"],["B","ADD",73,74,"1/2"],["B","ADD",72,74,"1/2"],["B","ADD",39,74,"64"],["B","ADD",38,74,"32"],["B","SWAP",74,75],["B","ADD",72,73,"-1/2"],["B","ADD",39,73,"-128"],["B","SCALE",73,"-1"],["B","ADD",75,73,"2"],["B","ADD",74,73,"-1"],["B","ADD",38,72,"128"],["B","SCALE",72,"-2"],["B","ADD",74,72,"1"],["B","ADD",73,72,"1"],["B","SWAP",71,73],["B","SWAP",70,72],["B","SWAP",69,71],["B","SWAP",68,70],["B","SWAP",67,69],["B","SWAP",66,68],["B","ADD",38,39,"1/2"],["B","SCALE",39,"-1"],["B","ADD",75,39,"1/32"],["B","ADD",74,39,"-1/64"],["B","ADD",67,39,"1/64"],["B","ADD",66,39,"1/128"],["B","SCALE",38,"-1"],["B","ADD",75,38,"-1/32"],["B","ADD",67,38,"-1/64"],["B","ADD",66,38,"-1/64"],["B","ADD",39,38,"-1"],["B","LAMBDA",38,-1],["J",15,[1,0,19,20],[39,38,"-1","1/2"]],["A","LAMBDA",19,-1],["A","SCALE",20,"-1"],["A","LAMBDA",0,1],["A","SWAP",17,18],["A","SWAP",16,18],["A","SWAP",15,18],["A","SWAP",14,18],["A","SWAP",13,18],["A","SWAP",12,18],["A","SWAP",11,18],["A","SWAP",10,18],["A","SWAP",9,18],["A","SWAP",8,18],["A","SWAP",7,18],["A","SWAP",6,18],["A","SWAP",5,18],["A","SWAP",4,18],["A","SWAP",3,18],["A","ADD",1,2,"-1"],["A","ADD",0,2,"-1"],["A","SCALE",2,"-1"],["A","SWAP",2,18],["A","ADD",0,1,"-1"],["A","SCALE",1,"-1"],["A","ADD",18,1,"2"],["A","ADD",18,0,"2"],["A","ADD",1,0,"1"],["A","SWAP",0,18],["A","LAMBDA",0,-1],["A","SWAP",36,37],["A","SWAP",35,37],["A","SWAP",34,37],["A","SWAP",33,37],["A","SWAP",32,37],["A","SWAP",31,37],["A","SWAP",30,37],["A","SWAP",29,37],["A","SWAP",28,37],["A","SWAP",27,37],["A","SWAP",26,37],["A","SWAP",25,37],["A","SWAP",24,37],["A","SWAP",23,37],["A","SWAP",22,37],["A","ADD",20,21,"-1"],["A","ADD",19,21,"-1"],["A","SCALE",21,"-1"],["A","SWAP",21,37],["A","ADD",19,20,"-1"],["A","ADD",37,20,"-2"],["A","ADD",37,19,"2"],["A","ADD",20,19,"-1"],["A","SWAP",19,37],["A","LAMBDA",19,1],["B","LAMBDA",38,1],["B","IDLE_ONE",74,[15]],["B","IDLE_ONE",75,[15]],["B","ADD",74,75,"1"],["B","ADD",72,75,"-1/4"],["B","ADD",39,75,"-64"],["B","SCALE",75,"-1/2"],["B","ADD",73,74,"1/2"],["B","ADD",72,74,"1/2"],["B","ADD",39,74,"64"],["B","ADD",38,74,"32"],["B","SWAP",74,75],["B","ADD",72,73,"-1/2"],["B","ADD",39,73,"-128"],["B","SCALE",73,"-1"],["B","ADD",75,73,"2"],["B","ADD",74,73,"-1"],["B","ADD",38,72,"128"],["B","SCALE",72,"-2"],["B","ADD",74,72,"1"],["B","ADD",73,72,"1"],["B","SWAP",71,73],["B","SWAP",70,72],["B","SWAP",69,71],["B","SWAP",68,70],["B","ADD",38,39,"1/2"],["B","SCALE",39,"-1"],["B","ADD",75,39,"1/32"],["B","ADD",74,39,"-1/64"],["B","ADD",69,39,"1/64"],["B","ADD",68,39,"1/128"],["B","SCALE",38,"-1"],["B","ADD",75,38,"-1/32"],["B","ADD",69,38,"-1/64"],["B","ADD",68,38,"-1/64"],["B","ADD",39,38,"-1"],["B","LAMBDA",38,-1],["J",16,[1,0,19,20],[39,38,"-1","1/2"]],["A","LAMBDA",19,-1],["A","SCALE",20,"-1"],["A","LAMBDA",0,1],["A","SWAP",17,18],["A","SWAP",16,18],["A","SWAP",15,18],["A","SWAP",14,18],["A","SWAP",13,18],["A","SWAP",12,18],["A","SWAP",11,18],["A","SWAP",10,18],["A","SWAP",9,18],["A","SWAP",8,18],["A","SWAP",7,18],["A","SWAP",6,18],["A","SWAP",5,18],["A","SWAP",4,18],["A","SWAP",3,18],["A","ADD",1,2,"-1"],["A","ADD",0,2,"-1"],["A","SCALE",2,"-1"],["A","SWAP",2,18],["A","ADD",0,1,"-1"],["A","SCALE",1,"-1"],["A","ADD",18,1,"2"],["A","ADD",18,0,"2"],["A","ADD",1,0,"1"],["A","SWAP",0,18],["A","LAMBDA",0,-1],["A","SWAP",36,37],["A","SWAP",35,37],["A","SWAP",34,37],["A","SWAP",33,37],["A","SWAP",32,37],["A","SWAP",31,37],["A","SWAP",30,37],["A","SWAP",29,37],["A","SWAP",28,37],["A","SWAP",27,37],["A","SWAP",26,37],["A","SWAP",25,37],["A","SWAP",24,37],["A","SWAP",23,37],["A","SWAP",22,37],["A","ADD",20,21,"-1"],["A","ADD",19,21,"-1"],["A","SCALE",21,"-1"],["A","SWAP",21,37],["A","ADD",19,20,"-1"],["A","ADD",37,20,"-2"],["A","ADD",37,19,"2"],["A","ADD",20,19,"-1"],["A","SWAP",19,37],["A","LAMBDA",19,1],["B","LAMBDA",38,1],["B","IDLE_ONE",74,[16]],["B","IDLE_ONE",75,[16]],["B","ADD",74,75,"1"],["B","ADD",72,75,"-1/4"],["B","ADD",39,75,"-64"],["B","SCALE",75,"-1/2"],["B","ADD",73,74,"1/2"],["B","ADD",72,74,"1/2"],["B","ADD",39,74,"64"],["B","ADD",38,74,"32"],["B","SWAP",74,75],["B","ADD",72,73,"-1/2"],["B","ADD",39,73,"-128"],["B","SCALE",73,"-1"],["B","ADD",75,73,"2"],["B","ADD",74,73,"-1"],["B","ADD",38,72,"128"],["B","SCALE",72,"-2"],["B","ADD",74,72,"1"],["B","ADD",73,72,"1"],["B","SWAP",71,73],["B","SWAP",70,72],["B","ADD",38,39,"1/2"],["B","SCALE",39,"-1"],["B","ADD",75,39,"1/32"],["B","ADD",74,39,"-1/64"],["B","ADD",71,39,"1/64"],["B","ADD",70,39,"1/128"],["B","SCALE",38,"-1"],["B","ADD",75,38,"-1/32"],["B","ADD",71,38,"-1/64"],["B","ADD",70,38,"-1/64"],["B","ADD",39,38,"-1"],["B","LAMBDA",38,-1],["J",17,[1,0,19,20],[39,38,"-1","1/2"]],["A","LAMBDA",19,-1],["A","SCALE",20,"-1"],["A","LAMBDA",0,1],["A","SWAP",17,18],["A","SWAP",16,18],["A","SWAP",15,18],["A","SWAP",14,18],["A","SWAP",13,18],["A","SWAP",12,18],["A","SWAP",11,18],["A","SWAP",10,18],["A","SWAP",9,18],["A","SWAP",8,18],["A","SWAP",7,18],["A","SWAP",6,18],["A","SWAP",5,18],["A","SWAP",4,18],["A","SWAP",3,18],["A","ADD",1,2,"-1"],["A","ADD",0,2,"-1"],["A","SCALE",2,"-1"],["A","SWAP",2,18],["A","ADD",0,1,"-1"],["A","SCALE",1,"-1"],["A","ADD",18,1,"2"],["A","ADD",18,0,"2"],["A","ADD",1,0,"1"],["A","SWAP",0,18],["A","LAMBDA",0,-1],["A","SWAP",36,37],["A","SWAP",35,37],["A","SWAP",34,37],["A","SWAP",33,37],["A","SWAP",32,37],["A","SWAP",31,37],["A","SWAP",30,37],["A","SWAP",29,37],["A","SWAP",28,37],["A","SWAP",27,37],["A","SWAP",26,37],["A","SWAP",25,37],["A","SWAP",24,37],["A","SWAP",23,37],["A","SWAP",22,37],["A","ADD",20,21,"-1"],["A","ADD",19,21,"-1"],["A","SCALE",21,"-1"],["A","SWAP",21,37],["A","ADD",19,20,"-1"],["A","ADD",37,20,"-2"],["A","ADD",37,19,"2"],["A","ADD",20,19,"-1"],["A","SWAP",19,37],["A","LAMBDA",19,1],["B","LAMBDA",38,1],["B","IDLE_ONE",74,[17]],["B","IDLE_ONE",75,[17]],["B","ADD",74,75,"1"],["B","ADD",72,75,"-1/4"],["B","ADD",39,75,"-64"],["B","SCALE",75,"-1/4"],["B","ADD",73,74,"1/2"],["B","ADD",72,74,"1/2"],["B","ADD",39,74,"64"],["B","ADD",38,74,"32"],["B","SCALE",74,"1/2"],["B","SWAP",74,75],["B","ADD",72,73,"-1/2"],["B","ADD",39,73,"-128"],["B","SCALE",73,"-1"],["B","ADD",75,73,"1"],["B","ADD",74,73,"-1/2"],["B","ADD",38,72,"128"],["B","SCALE",72,"-2"],["B","ADD",74,72,"1/2"],["B","ADD",73,72,"1"],["B","ADD",38,39,"1/2"],["B","SCALE",39,"-1"],["B","ADD",75,39,"1/64"],["B","ADD",74,39,"-1/128"],["B","ADD",73,39,"1/64"],["B","ADD",72,39,"1/128"],["B","SCALE",38,"-1"],["B","ADD",75,38,"-1/64"],["B","ADD",73,38,"-1/64"],["B","ADD",72,38,"-1/64"],["B","ADD",39,38,"-1"],["B","LAMBDA",38,-1],["J",18,[1,0,19,20],[39,38,"-1","1/2"]],["A","LAMBDA",19,-1],["A","SCALE",20,"-1"],["A","LAMBDA",0,1],["A","SWAP",17,18],["A","SWAP",16,18],["A","SWAP",15,18],["A","SWAP",14,18],["A","SWAP",13,18],["A","SWAP",12,18],["A","SWAP",11,18],["A","SWAP",10,18],["A","SWAP",9,18],["A","SWAP",8,18],["A","SWAP",7,18],["A","SWAP",6,18],["A","SWAP",5,18],["A","SWAP",4,18],["A","SWAP",3,18],["A","SWAP",2,18],["A","ADD",0,1,"-2"],["A","SWAP",1,18],["A","SCALE",0,"-1"],["A","ADD",18,0,"-1"],["A","LAMBDA",0,-1],["A","LAMBDA",1,-1],["A","LAMBDA",2,-1],["A","LAMBDA",3,-1],["A","LAMBDA",4,-1],["A","LAMBDA",5,-1],["A","LAMBDA",6,-1],["A","LAMBDA",7,-1],["A","LAMBDA",8,-1],["A","LAMBDA",9,-1],["A","LAMBDA",10,-1],["A","LAMBDA",11,-1],["A","LAMBDA",12,-1],["A","LAMBDA",13,-1],["A","LAMBDA",14,-1],["A","LAMBDA",15,-1],["A","LAMBDA",16,-1],["A","LAMBDA",17,-1],["A","LAMBDA",18,-1],["A","SWAP",36,37],["A","SWAP",35,37],["A","SWAP",34,37],["A","SWAP",33,37],["A","SWAP",32,37],["A","SWAP",31,37],["A","SWAP",30,37],["A","SWAP",29,37],["A","SWAP",28,37],["A","SWAP",27,37],["A","SWAP",26,37],["A","SWAP",25,37],["A","SWAP",24,37],["A","SWAP",23,37],["A","SWAP",22,37],["A","SWAP",21,37],["A","ADD",19,20,"-2"],["A","SWAP",20,37],["A","SCALE",19,"-1"],["A","ADD",37,19,"-1"],["A","LAMBDA",19,-1],["A","LAMBDA",20,-1],["A","LAMBDA",21,-1],["A","LAMBDA",22,-1],["A","LAMBDA",23,-1],["A","LAMBDA",24,-1],["A","LAMBDA",25,-1],["A","LAMBDA",26,-1],["A","LAMBDA",27,-1],["A","LAMBDA",28,-1],["A","LAMBDA",29,-1],["A","LAMBDA",30,-1],["A","LAMBDA",31,-1],["A","LAMBDA",32,-1],["A","LAMBDA",33,-1],["A","LAMBDA",34,-1],["A","LAMBDA",35,-1],["A","LAMBDA",36,-1],["A","LAMBDA",37,-1],["B","LAMBDA",38,1],["B","IDLE_ONE",74,[18]],["B","IDLE_ONE",75,[18]],["B","ADD",39,75,"-128"],["B","ADD",38,75,"64"],["B","SCALE",75,"-1"],["B","ADD",38,74,"128"],["B","SCALE",74,"-1"],["B","ADD",75,74,"2"],["B","ADD",38,39,"1/2"],["B","SCALE",39,"1/128"],["B","ADD",75,39,"-2"],["B","ADD",74,39,"-1"],["B","SCALE",38,"1/128"],["B","ADD",75,38,"2"],["B","ADD",74,38,"2"],["B","SWAP",38,39],["B","LAMBDA",38,-1],["B","LAMBDA",39,-1],["B","LAMBDA",40,-1],["B","LAMBDA",41,-1],["B","LAMBDA",42,-1],["B","LAMBDA",43,-1],["B","LAMBDA",44,-1],["B","LAMBDA",45,-1],["B","LAMBDA",46,-1],["B","LAMBDA",47,-1],["B","LAMBDA",48,-1],["B","LAMBDA",49,-1],["B","LAMBDA",50,-1],["B","LAMBDA",51,-1],["B","LAMBDA",52,-1],["B","LAMBDA",53,-1],["B","LAMBDA",54,-1],["B","LAMBDA",55,-1],["B","LAMBDA",56,-1],["B","LAMBDA",57,-1],["B","LAMBDA",58,-1],["B","LAMBDA",59,-1],["B","LAMBDA",60,-1],["B","LAMBDA",61,-1],["B","LAMBDA",62,-1],["B","LAMBDA",63,-1],["B","LAMBDA",64,-1],["B","LAMBDA",65,-1],["B","LAMBDA",66,-1],["B","LAMBDA",67,-1],["B","LAMBDA",68,-1],["B","LAMBDA",69,-1],["B","LAMBDA",70,-1],["B","LAMBDA",71,-1],["B","LAMBDA",72,-1],["B","LAMBDA",73,-1],["B","LAMBDA",74,-1],["B","LAMBDA",75,-1]],"ops_note":"QSELF(x, k): R[x] *= q^k, one paid rank-1 job on one register (new op; not in the retained alphabet).; source interval457..575 replaced by a three-QUERY even-basis factorization; no QSELF"} diff --git a/research/literal-tariff-conversion-audit/data/word.json.gz b/research/literal-tariff-conversion-audit/data/word.json.gz new file mode 100644 index 0000000000..d93e67ca76 Binary files /dev/null and b/research/literal-tariff-conversion-audit/data/word.json.gz differ diff --git a/research/literal-tariff-conversion-audit/kernel/compact_tables.py b/research/literal-tariff-conversion-audit/kernel/compact_tables.py new file mode 100644 index 0000000000..b90ecb6052 --- /dev/null +++ b/research/literal-tariff-conversion-audit/kernel/compact_tables.py @@ -0,0 +1,182 @@ +"""Bit-constant numerator and total rounded ADD as literal flat tables. + +Construction-time integers only. Runtime rows are the retained six-opcode ABI. +Prepared for @CubeJerry with substantial OpenAI assistance. Apache-2.0. +""" +from fractions import Fraction +from source_binding import need, vendor +B=vendor('compact_exact_builder','vendor/exact_scalar_tables.py') + + +def compile_compact(coefficient, *, mutant=None): + q=Fraction(coefficient);a,den=q.numerator,q.denominator + L=max(abs(a).bit_length(),den.bit_length());K=L+2 + d,o=0,den + while o%2==0:d+=1;o//=2 + need(o<=125,'fixed current odd-divisor domain, not arbitrary logarithmic divisor') + c=den//2 + if mutant=='tie-down':c=max(0,c-1) + sign=-1 if a<0 else 1 + coeff=[((den>>j)&1,sign*((abs(a)>>j)&1)) for j in range(L-1,-1,-1)] + if mutant=='lost-negative':coeff=[(x,abs(y)) for x,y in coeff] + if mutant=='lost-leading':coeff[0]=(0,0) + b=B.Builder();b.request(('entry',));maxcarry=0 + reject=('reject',) + def go(k):b.goto(k) + def branch(port,cases):b.branch(port,cases,reject) + def move(port,n): + for _ in range(abs(n)):b.emit('move',port,1 if n>0 else -1) + def publics():move(0,1);move(1,1) + def reset(nextkey):go(('reset',K,nextkey)) + def rewind(nextkey):go(('rewind',nextkey)) + def hstep(i,k,sx,sy,x,y,n,remaining,parity): + nonlocal maxcarry + beta,alpha=coeff[i];v=2*n+beta*x+alpha*y+k;z=v&1;kk=v//2 + need(abs(kk)<=4,'closed Horner carry');maxcarry=max(maxcarry,abs(kk)) + b.emit('write',2,z);move(2,1) + if remaining is None: + publics();go(('hscan',i,kk,x,y,parity)) + elif remaining>1:go(('hhigh',i,remaining-1,kk,sx,sy,parity)) + elif kk==2*n+beta*sx+alpha*sy-z: + go(('hfinish',i,parity)) + else:go(reject) + def qdigit(n,k): + v=n+k;z=v&1;kk=(v-o*z)//2 + need(-o<=kk<=0,'closed quotient carry');return z,kk + while b.pending: + key=b.pending.popleft();b.mark(key);tag=key[0] + if tag=='reject':b.emit('reject','compact rounded ADD format/range') + elif tag=='entry':branch(2,{4:('entry-o',)}) + elif tag=='entry-o':branch(3,{4:('begin',)}) + elif tag=='begin': + b.emit('write',2,5);move(2,1);go(('start',0,False)) + elif tag=='start': + _,parity,seen=key;cases={x:('record',parity) for x in (0,1)} + if seen and parity==0:cases[4]=('source-end',) + branch(0,cases) + elif tag=='source-end':branch(1,{4:('global-back',)}) + elif tag=='record': + _,parity=key;b.emit('write',2,6);move(2,1);go(('init',parity)) + elif tag=='init': + _,parity=key;branch(0,{0:('init-y',parity),1:('init-y',parity),2:('init-end',parity)}) + elif tag=='init-y': + _,parity=key;branch(1,{0:('init-zero',parity),1:('init-zero',parity)}) + elif tag=='init-zero': + _,parity=key;b.emit('write',2,0);move(2,1);publics();go(('init',parity)) + elif tag=='init-end': + _,parity=key;branch(1,{2:('init-high',parity)}) + elif tag=='init-high': + _,parity=key + for _ in range(K):b.emit('write',2,0);move(2,1) + b.emit('write',2,2);reset(('hscan',0,0,2,2,parity)) + elif tag=='reset': + _,left,nxt=key + if left:move(2,-1);go(('reset',left-1,nxt)) + else:go(('reset-back',nxt)) + elif tag=='reset-back': + _,nxt=key;move(2,-1);branch(2,{0:('reset-public',nxt),1:('reset-public',nxt),6:('reset-ready',nxt)}) + elif tag=='reset-public': + _,nxt=key;move(0,-1);move(1,-1);go(('reset-back',nxt)) + elif tag=='reset-ready': + _,nxt=key;move(2,1);go(nxt) + elif tag=='hscan': + _,i,k,sx,sy,parity=key;cases={x:('hy',i,k,x,parity) for x in (0,1)} + if sx in (0,1):cases[2]=('hend-y',i,k,sx,sy,parity) + branch(0,cases) + elif tag=='hy': + _,i,k,x,parity=key;branch(1,{y:('hn',i,k,x,y,parity) for y in (0,1)}) + elif tag=='hn': + _,i,k,x,y,parity=key;branch(2,{n:('hdigit',i,k,x,y,n,parity) for n in (0,1)}) + elif tag=='hdigit': + _,i,k,x,y,n,parity=key;hstep(i,k,x,y,x,y,n,None,parity) + elif tag=='hend-y': + _,i,k,sx,sy,parity=key;branch(1,{2:('hhigh',i,K,k,sx,sy,parity)}) + elif tag=='hhigh': + _,i,left,k,sx,sy,parity=key;branch(2,{n:('hhigh-digit',i,left,k,sx,sy,n,parity) for n in (0,1)}) + elif tag=='hhigh-digit': + _,i,left,k,sx,sy,n,parity=key;hstep(i,k,sx,sy,sx,sy,n,left,parity) + elif tag=='hfinish': + _,i,parity=key + nxt=('hscan',i+1,0,2,2,parity) if i+1>j)&1 if j1 else ('drop',d,0,parity) + rewind(nxt) + elif tag=='rewind': + _,nxt=key;move(2,-1);branch(2,{0:key,1:key,6:('rewind-ready',nxt)}) + elif tag=='rewind-ready':_,nxt=key;move(2,1);go(nxt) + elif tag=='residue': + _,rho,power,sn,parity=key + cases={n:('res-digit',(rho+n*power)%o,(2*power)%o,n,parity) for n in (0,1)} + if sn in (0,1): + r=(rho-(0 if mutant=='unsigned-residue' else sn)*power)%o + cases[2]=('res-done',r,parity) + branch(2,cases) + elif tag=='res-digit': + _,rho,power,sn,parity=key;move(2,1);go(('residue',rho,power,sn,parity)) + elif tag=='res-done':_,r,parity=key;rewind(('drop',d,-r,parity)) + elif tag=='drop': + _,left,k,parity=key + if left:branch(2,{n:('drop-digit',left,k,n,parity) for n in (0,1)}) + else:go(('emit',k,2,parity)) + elif tag=='drop-digit': + _,left,k,n,parity=key;z,kk=qdigit(n,k);move(2,1);go(('drop',left-1,kk,parity)) + elif tag=='emit': + _,k,sz,parity=key;cases={x:('emit-y',k,parity) for x in (0,1)} + if sz in (0,1):cases[2]=('emit-end',k,sz,parity) + branch(0,cases) + elif tag=='emit-y': + _,k,parity=key;branch(1,{y:('emit-n',k,parity) for y in (0,1)}) + elif tag=='emit-n': + _,k,parity=key;branch(2,{n:('emit-digit',k,n,parity) for n in (0,1)}) + elif tag=='emit-digit': + _,k,n,parity=key;z,kk=qdigit(n,k);b.emit('write',3,z);move(3,1);move(2,1);publics();go(('emit',kk,z,parity)) + elif tag=='emit-end': + _,k,sz,parity=key;branch(1,{2:('high',K-d,k,sz,parity)}) + elif tag=='high': + _,left,k,sz,parity=key;branch(2,{n:('high-digit',left,k,n,sz,parity) for n in (0,1)}) + elif tag=='high-digit': + _,left,k,n,sz,parity=key;z,kk=qdigit(n,k) + if z!=sz and mutant!='omit-high':go(reject) + else: + move(2,1) + if left>1:go(('high',left-1,kk,sz,parity)) + elif kk==n-o*sz or mutant=='omit-high':go(('quotient-end',parity)) + else:go(reject) + elif tag=='quotient-end': + _,parity=key;branch(2,{2:('next',parity)}) + elif tag=='next': + _,parity=key;b.emit('write',3,2);move(3,1);move(2,1);publics();go(('start',1-parity,True)) + elif tag=='global-back': + move(2,-1);branch(2,{2:('global-delimiter',),5:('install',)}) + elif tag=='global-delimiter': + move(0,-1);move(1,-1);move(3,-1);move(2,-K);go(('global-bits',)) + elif tag=='global-bits': + move(2,-1);branch(2,{0:('global-public',),1:('global-public',),6:('global-back',)}) + elif tag=='global-public': + move(0,-1);move(1,-1);move(3,-1);go(('global-bits',)) + elif tag=='install':branch(3,{s:('install-symbol',s) for s in (0,1,2)}|{4:('install-end',)}) + elif tag=='install-symbol': + _,s=key;b.emit('write',0,s);move(0,1);move(3,1);go(('install',)) + elif tag=='install-end':branch(0,{4:('halt',)}) + elif tag=='halt':b.emit('halt') + else:raise ValueError(('unknown state',key)) + table=b.finish() + receipt=dict(coefficient=str(q),numerator=a,denominator=den,coefficient_bits=L,extra_width=K, + denominator_twos=d,odd_divisor=o,rows=len(table),states=len(b.labels),max_horner_carry=maxcarry, + port_order=['target','source','numerator-work','output-work'],mutant=mutant) + return table,receipt + + +def cost_bound(receipt,extent,records,old_backing=0,contexts=0): + U=1+extent+(receipt['extra_width']+1)*records + return 512*(receipt['coefficient_bits']+8)*U+7*old_backing+16*contexts diff --git a/research/literal-tariff-conversion-audit/kernel/exact_builder.py b/research/literal-tariff-conversion-audit/kernel/exact_builder.py new file mode 100644 index 0000000000..1cc22f75fb --- /dev/null +++ b/research/literal-tariff-conversion-audit/kernel/exact_builder.py @@ -0,0 +1,295 @@ +"""Fixed scalar services compiled to the unchanged lifecycle table ABI. + +All arithmetic here belongs to finite-template construction. The returned +runtime uses only branch/write/unit-move/goto/halt/reject instructions. +Prepared for @CubeJerry with substantial OpenAI assistance. Apache-2.0. +""" +from collections import deque +from fractions import Fraction + + +def need(ok, message): + if not ok: + raise ValueError(message) + + +class Builder: + def __init__(self): + self.rows, self.labels = [], {} + self.pending, self.claimed = deque(), set() + + def request(self, key): + if key not in self.claimed: + self.claimed.add(key) + self.pending.append(key) + return key + + def mark(self, key): + need(key not in self.labels, "unique compiled state") + self.labels[key] = len(self.rows) + + def emit(self, *row): + self.rows.append(row) + + def goto(self, key): + self.emit("goto", self.request(key)) + + def branch(self, port, cases, default): + self.emit("branch", port, + tuple((s, self.request(k)) for s,k in sorted(cases.items())), + self.request(default)) + + def finish(self): + need(not self.pending, "complete finite graph") + out = [] + for row in self.rows: + if row[0] == "goto": + out.append(("goto", self.labels[row[1]])) + elif row[0] == "branch": + out.append(("branch", row[1], tuple((s,self.labels[k]) for s,k in row[2]), + self.labels[row[3]])) + else: + out.append(row) + return tuple(out) + + +def compile_scalar(op, coefficient): + """Build a table for all complete complex records on one common grid. + + SCALE ports: target, output-work, guide-work. + ADD ports: target, source, output-work, guide-work. + Additional supplied work/context ports are untouched. Work is physically + retired by the unchanged Controller.primitive success wrapper. + """ + need(op in ("ADD", "SCALE"), "scalar operation") + q = Fraction(coefficient) + need(q != 0, "nonzero selected scalar") + a, denominator = q.numerator, q.denominator + d, odd = 0, denominator + while odd % 2 == 0: + d += 1 + odd //= 2 + p, r = (denominator,a) if op == "ADD" else (a,0) + count = 2 if op == "ADD" else 1 + output, guide = count, count+1 + bound = abs(p)+abs(r)+odd + b, carry_states = Builder(), set() + b.request(("entry",)) + + def advance_inputs(): + for port in range(count): + b.emit("move", port, 1) + + def guide_one(): + b.emit("write", guide, 1) + b.emit("move", guide, 1) + + def digit(k, carry, last_q, x, y): + need(0 <= k <= d and abs(carry) <= bound, "finite carry invariant") + carry_states.add(carry) + value = p*x+r*y+carry + if k < d: + if value % 2: + return None + return k+1, value//2, last_q + bit = value & 1 + following = (value-odd*bit)//2 + need(abs(following) <= bound, "closed finite carry interval") + b.emit("write", output, bit) + b.emit("move", output, 1) + return d, following, bit + + while b.pending: + key = b.pending.popleft() + b.mark(key) + tag = key[0] + if tag == "entry": + b.branch(output, {4:("guide-entry",)}, ("reject","nonblank output work")) + elif tag == "guide-entry": + b.branch(guide, {4:("begin",)}, ("reject","nonblank guide work")) + elif tag == "begin": + b.emit("write", guide, 5) + b.emit("move", guide, 1) + b.goto(("start",0,False)) + elif tag == "start": + _, parity, seen = key + ending = ("finish-source",) if parity == 0 and seen else ("reject","complete nonempty complex field") + b.branch(0, {0:("read-source",0,0,2,parity,0), + 1:("read-source",0,0,2,parity,1), 4:ending}, + ("reject","positive component width")) + elif tag == "scan": + _, k, carry, sx, sy, sq, parity = key + b.branch(0, {0:("read-source",k,carry,sq,parity,0), + 1:("read-source",k,carry,sq,parity,1), + 2:("component-end",k,carry,sx,sy,sq,parity)}, + ("reject","unterminated signed component")) + elif tag == "read-source": + _, k, carry, sq, parity, x = key + if count == 2: + b.branch(1, {y:("digit",k,carry,sq,parity,x,y) for y in (0,1)}, + ("reject","same complete component shape")) + else: + b.goto(("digit",k,carry,sq,parity,x,0)) + elif tag == "digit": + _, k, carry, sq, parity, x, y = key + following = digit(k,carry,sq,x,y) + if following is None: + b.goto(("reject","inexact low numerator bits")) + else: + k1,c1,q1 = following + guide_one() + advance_inputs() + b.goto(("scan",k1,c1,x,y,q1,parity)) + elif tag == "component-end": + _, k, carry, sx, sy, sq, parity = key + following = ("extend",d,k,carry,sx,sy,sq,parity) + if count == 2: + b.branch(1, {2:following}, ("reject","same complete component shape")) + else: + b.goto(following) + elif tag == "extend": + _, remaining, k, carry, sx, sy, sq, parity = key + if remaining: + following = digit(k,carry,sq,sx,sy) + if following is None: + b.goto(("reject","inexact sign-extension numerator bits")) + else: + k1,c1,q1 = following + b.goto(("extend",remaining-1,k1,c1,sx,sy,q1,parity)) + elif sq not in (0,1) or carry != p*sx+r*sy-odd*sq: + b.goto(("reject","inexact quotient or signed output overflow")) + else: + b.emit("write", output, 2) + b.emit("move", output, 1) + guide_one() + advance_inputs() + b.goto(("start",parity^1,True)) + elif tag == "finish-source": + if count == 2: + b.branch(1, {4:("finish-output",)}, ("reject","same complete field frontier")) + else: + b.goto(("finish-output",)) + elif tag == "finish-output": + b.branch(output, {4:("rewind-step",)}, ("reject","exact staged output frontier")) + elif tag == "rewind-step": + b.emit("move", guide, -1) + b.goto(("rewind-read",)) + elif tag == "rewind-read": + b.branch(guide, {1:("rewind-inputs",),5:("install-start",)}, + ("reject","complete unary rewind guide")) + elif tag == "rewind-inputs": + for port in tuple(range(count))+(output,): + b.emit("move", port, -1) + b.goto(("rewind-step",)) + elif tag == "install-start": + b.emit("move", guide, 1) + b.goto(("install-guide",)) + elif tag == "install-guide": + b.branch(guide, {1:("install-read",),4:("installed-target-end",)}, + ("reject","install guide format")) + elif tag == "install-read": + b.branch(output, {s:("install-symbol",s) for s in (0,1,2)}, + ("reject","complete protected numeric output")) + elif tag == "install-symbol": + b.emit("write", 0, key[1]) + for port in (0,output,guide): + b.emit("move", port, 1) + b.goto(("install-guide",)) + elif tag == "installed-target-end": + b.branch(0, {4:("installed-output-end",)}, ("reject","exact installed target frontier")) + elif tag == "installed-output-end": + b.branch(output, {4:("halt",)}, ("reject","exact consumed protected output")) + elif tag == "halt": + b.emit("halt") + elif tag == "reject": + b.emit("reject", key[1]) + else: + raise ValueError("unknown compiler state") + return b.finish(), dict(operation=op,coefficient=str(q),denominator_twos=d, + odd_denominator=odd,numerator_target=p,numerator_source=r, + carry_bound=bound,carry_states=len(carry_states), + rows=len(b.rows),states=len(b.labels),public_ports=count,work_ports=2) + + +def source_literal(event, word, caller=None): + """Authenticate a source scalar retained by source_ir's nested remappings. + + Fields stay the source lowerer's actual ordered binding. Whole-job native + normalizers and two-output SWAP/SIGNED_SWAP services remain outside scope. + """ + need(event.op == "SERVICE", "only original scalar SERVICE") + token = event.token + wrappers = {'caller-local':4, 'product-left':4, + 'product-right':5, 'unit-fragment':6} + while isinstance(token,(tuple,list)) and token: + if len(token) == 1 and isinstance(token[0],(tuple,list)): + token = token[0] # The source remap API's empty context. + continue + if isinstance(token[0],str) and token[0] in wrappers: + need(len(token)==wrappers[token[0]],'source remap wrapper grammar') + # product-right also retains an issuing PAID token as provenance. + # Only the last member is the instruction currently being remapped. + token = token[-1] + continue + break + need(isinstance(token,(tuple,list)) and token and isinstance(token[0],str) + and token[0] in ('local','boundary-right','boundary-left','outer','query-add'), + 'source scalar origin grammar') + tag = token[0] + if tag == 'local': + need(len(token)==3,'local scalar token grammar') + _,pc,raw = token + need(type(pc) is int and 0 <= pc < len(word['program']), "actual current source event") + need(tuple(raw) == tuple(word['program'][pc]), "exact current scalar source bytes") + q, origin = Fraction(raw[-2]), ('local',pc) + else: + need(caller is not None,'outer scalar requires exact caller source') + if tag in ('boundary-right','boundary-left'): + need(len(token)==3,'boundary scalar token grammar') + _,column,raw = token + rows = caller['boundaries'][tag.split('-')[1]+'_program'] + need(tuple(raw) in tuple(tuple(x) for x in rows),'actual boundary scalar instruction') + origin = (tag,column) + elif tag == 'outer': + need(len(token)==4,'outer scalar token grammar') + _,site,column,raw = token + need(type(site) is int and 0 <= site < len(caller['physical_events']), + 'actual outer source site') + need(tuple(raw)==tuple(caller['physical_events'][site]),'exact outer scalar instruction') + origin = (tag,site,column) + else: + need(len(token)==5 and token[1]=='query','query scalar token grammar') + _,_,site,stage,column = token + need(type(site) is int and 0 <= site < len(caller['physical_events']), + 'actual query source site') + original = caller['physical_events'][site] + need(original[0]=='QUERY_SHEAR' and original[1]==stage and original[3] is False, + 'actual forward source query') + raw = ('ADD',None,None,1) + origin = (tag,site,column) + need(type(column) is int and 0 <= column < 104,'actual source scalar column') + need(raw[0] in ('ADD','SCALE'),'original source arithmetic scalar') + q = Fraction(raw[-1]) + op = raw[0] + need(op in ("ADD","SCALE"), "original scalar kind") + arity = 2 if op == "ADD" else 1 + need(len(event.fields) == arity and len(set(event.fields)) == arity, + "distinct actual scalar field ports") + need(q != 0, "nonzero source coefficient") + return op,q,origin + + +def bind_services(events, word, caller=None): + """Bind precisely the supplied source scalar events to finite tables.""" + cache, services, receipt = {}, {}, [] + for event in events: + op,q,origin = source_literal(event,word,caller) + key = (op,q) + if key not in cache: + cache[key] = compile_scalar(op,q) + table,_ = cache[key] + token = event.token + need(token not in services or services[token] == table, "unambiguous scalar service token") + services[token] = table + receipt.append((origin,op,str(q),tuple(event.fields))) + return services, tuple(cache[key][1] for key in sorted(cache)), tuple(receipt) diff --git a/research/literal-tariff-conversion-audit/kernel/machine.py b/research/literal-tariff-conversion-audit/kernel/machine.py new file mode 100644 index 0000000000..acf475e4fc --- /dev/null +++ b/research/literal-tariff-conversion-audit/kernel/machine.py @@ -0,0 +1,406 @@ +"""Literal lifecycle control on fixed sequential tapes. + +Prepared for @CubeJerry with substantial OpenAI assistance. Apache-2.0. +Stack is the authenticated #5356 implementation supplied by the loader. +Algorithms never read tape addresses, extents, hardware arrays or a host stack. +Instruction and primitive tables are fixed before runtime inputs vary. +""" +from dataclasses import dataclass + +ZERO, ONE, LEFT, SEP, END, BASE, BLANK = range(7) +COMPONENT = 2 + + +def need(condition, message): + if not condition: + raise ValueError(message) + + +def emit(tape, symbol): + tape.write(symbol) + tape.move(1) + + +def origin(tape, marker=LEFT): + tape.move(-1) + while tape.read() != marker: + tape.move(-1) + tape.move(1) + + +def retire(tape, marker=LEFT): + """Erase all coded bytes, including encoded logical blanks.""" + origin(tape, marker) + while (symbol := tape.read()) != BLANK: + need(symbol in (ZERO, ONE), "contiguous binary body") + emit(tape, BLANK) + origin(tape, marker) + + +def transfer(source, target, source_marker=LEFT, target_marker=LEFT): + """Administrative actual-byte copy; never an arithmetic COPY.""" + origin(source, source_marker) + origin(target, target_marker) + need(target.read() == BLANK, "administrative transfer needs empty target") + while (symbol := source.read()) != BLANK: + need(symbol in (ZERO, ONE), "binary transfer") + emit(target, symbol) + source.move(1) + origin(source, source_marker) + origin(target, target_marker) + + +class CodedPort: + """Seven virtual symbols encoded as three nonblank physical bits. + + The physical LEFT before the current body is never exposed as data. + A left step at its local origin rejects. Two-sided routines first use + the standard translation to two one-sided ports. + """ + __slots__ = ("tape",) + + def __init__(self, tape): + self.tape = tape + + def read(self): + t = self.tape + if t.read() == BLANK: + return 4 + value = 0 + for _ in range(3): + bit = t.read() + need(bit in (ZERO, ONE), "whole virtual codeword") + value = 2 * value + bit + t.move(1) + for _ in range(3): + t.move(-1) + need(value < 7, "unused virtual codeword") + return value + + def write(self, value): + need(type(value) is int and 0 <= value < 7, "virtual alphabet") + for shift in (2, 1, 0): + emit(self.tape, (value >> shift) & 1) + for _ in range(3): + self.tape.move(-1) + + def move(self, direction): + need(direction in (-1, 1), "virtual unit move") + t = self.tape + if direction == 1: + if t.read() == BLANK: + self.write(4) + for _ in range(3): + t.move(1) + else: + t.move(-1) + if t.read() == LEFT: + t.move(1) + raise ValueError("native routine crossed its local origin") + t.move(-1) + t.move(-1) + + +class BinaryContextPort: + """Read-only raw binary descriptor, with its own physical alphabet. + + Unlike CodedPort, read returns physical BLANK=6 at the frontier. A table + may inspect that frontier but cannot pass it or the current LEFT marker. + This supplies runtime e/f/K/rho data through counted local operations. + """ + __slots__ = ("tape",) + + def __init__(self, tape): + self.tape = tape + + def read(self): + symbol = self.tape.read() + need(symbol in (ZERO, ONE, BLANK), "binary context alphabet") + return symbol + + def write(self, value): + raise ValueError("native context is read-only") + + def move(self, direction): + need(direction in (-1, 1), "binary context unit move") + t = self.tape + if direction == 1: + need(t.read() in (ZERO, ONE), "context frontier cannot be crossed") + t.move(1) + else: + t.move(-1) + if t.read() == LEFT: + t.move(1) + raise ValueError("native context crossed its local origin") + + +def read_code(tape): + """Consume a numeric-format code; physical frontier returns None.""" + if tape.read() == BLANK: + return None + value = 0 + for _ in range(3): + bit = tape.read() + need(bit in (ZERO, ONE), "numeric codeword") + value = 2 * value + bit + tape.move(1) + need(value < 7, "unused numeric codeword") + return value + + +def write_code(tape, value): + for shift in (2, 1, 0): + emit(tape, (value >> shift) & 1) + + +def initialize(target, shape): + """Dispose of arbitrary old bytes, then zero the complete common format.""" + need(target is not shape, "private initialization cannot destroy its guide") + retire(target) + origin(shape) + in_component = False + while (symbol := read_code(shape)) is not None: + need(symbol in (ZERO, ONE, COMPONENT), "canonical signed components") + if symbol == COMPONENT: + need(in_component, "positive component width") + write_code(target, COMPONENT) + in_component = False + else: + write_code(target, ZERO) + in_component = True + need(not in_component, "component terminator") + origin(shape) + origin(target) + + +def copy_as_add(target, source): + """Signed addition into the actual destination, including any residue. + + Components are little-endian two's complement followed by COMPONENT. + Carries reset at delimiters; equal-sign signed overflow rejects. + No ideal-zero test or exact-value overwrite substitutes for addition. + """ + need(target is not source, "distinct COPY/ADD ports") + origin(source) + origin(target) + carry = 0 + last_a = last_b = last_out = 0 + in_component = False + while True: + a = read_code(source) + b = read_code(target) + need((a is None) == (b is None), "same complete numerical extent") + if a is None: + need(not in_component, "complete signed component") + break + need(a in (ZERO, ONE, COMPONENT) and b in (ZERO, ONE, COMPONENT), + "canonical signed addition operands") + need((a == COMPONENT) == (b == COMPONENT), "same component boundaries") + if a == COMPONENT: + need(in_component, "positive signed component width") + need(last_a != last_b or last_out == last_a, "signed addition overflow") + carry = 0 + in_component = False + continue + value = a + b + carry + last_a, last_b, last_out = a, b, value & 1 + carry = value >> 1 + for _ in range(3): + target.move(-1) + write_code(target, last_out) + in_component = True + origin(source) + origin(target) + + +def execute_table(table, ports, readonly_context=()): + """Run a supplied finite native table with every port confined. + + These tables retain explicit semantics/time/space premises. Fixture + tables are not advertised as Gaussian implementations. + """ + views = (tuple(CodedPort(t) for t in ports) + + tuple(BinaryContextPort(t) for t in readonly_context)) + pc = 0 + while True: + row = table[pc] + op = row[0] + if op == "halt": + break + if op == "reject": + raise ValueError(row[1]) + if op == "goto": + pc = row[1] + continue + view = views[row[1]] + if op == "branch": + pc = dict(row[2]).get(view.read(), row[3]) + continue + if op == "write": + view.write(row[2]) + elif op == "move": + view.move(row[2]) + else: + raise ValueError("native table opcode") + pc += 1 + for tape in tuple(ports)+tuple(readonly_context): + origin(tape) + + +@dataclass(frozen=True) +class Instruction: + op: str + ports: tuple = () + token: tuple = () + + +class Controller: + """Fixed finite controller of a fixed flat compiled template. + + rows implements the separately priced row/shape interface; all its + dynamic state belongs on the supplied tapes. services contains fixed + finite transition tables. Payload ports include metadata and all scratch. + The only runtime continuation is the physical Stack. + """ + def __init__(self, program, public_count, payloads, control, descriptor, + bridge, child_header, rows, services, stack_class, protected_ports=(), + primitive_work=(), primitive_context=()): + self.program = tuple(program) + self.public_count = public_count + self.payloads = tuple(payloads) + self.control = control + self.descriptor = descriptor + self.bridge = bridge + self.child_header = child_header + self.rows = rows + self.services = services + need(len({id(t) for t in self.payloads+(control,descriptor,bridge,child_header)}) + == len(self.payloads)+4, "all physical ports distinct") + self.stack = stack_class(self.payloads, control, descriptor) + self.protected_ports = tuple(protected_ports) + owned = {e.ports[0] for e in self.program if e.op == "INIT"} + need(all(public_count <= i < len(self.payloads) for i in owned), "INIT only private physical slots") + need(owned.isdisjoint(self.protected_ports), "owned fields cannot be borrowed descriptors") + self.root_cleanup = tuple(i for i in range(public_count,len(self.payloads)) + if i not in self.protected_ports) + self.primitive_work = tuple(primitive_work) + self.primitive_context = tuple(primitive_context) + data_ports = {i for e in self.program for i in e.ports} + need(all(0 <= i < len(self.payloads) for i in data_ports), "compiled port range") + need(all(i >= public_count and i < len(self.payloads) and i not in data_ports + and i not in self.protected_ports for i in self.primitive_work), "separate primitive scratch") + need(len(set(self.primitive_work)) == len(self.primitive_work), "distinct primitive work ports") + need(len(set(self.primitive_context)) == len(self.primitive_context) + and all(i in self.protected_ports and 0 <= i < len(self.payloads) + and i not in data_ports for i in self.primitive_context), "borrowed binary context ports") + self.pc_bits = max(1, (len(self.program) - 1).bit_length()) + self.pc_words = tuple(tuple((pc >> j) & 1 for j in range(self.pc_bits)) + for pc in range(len(self.program))) + need(self.program and self.program[-1].op == "RET", "finite completed program") + + def save_pc(self, pc): + need(self.descriptor.read() == BLANK, "empty active PC descriptor") + for bit in self.pc_words[pc]: + emit(self.descriptor, bit) + origin(self.descriptor, BASE) + + def consume_pc(self): + pc = 0 + for shift in range(self.pc_bits): + bit = self.descriptor.read() + need(bit in (ZERO, ONE), "binary return PC") + pc |= bit << shift + emit(self.descriptor, BLANK) + need(self.descriptor.read() == BLANK, "exact fixed return PC width") + origin(self.descriptor, BASE) + need(pc < len(self.program) and pc > 0 and self.program[pc-1].op == "PAID", + "return PC designates a paid continuation") + return pc + + def has_parent(self): + self.control.move(-1) + symbol = self.control.read() + self.control.move(1) + need(symbol in (BASE, END), "complete continuation top") + return symbol == END + + def descend(self, pc): + event = self.program[pc] + source = self.payloads[event.ports[0]] + transfer(source, self.bridge, target_marker=BASE) + self.rows.prepare(event.token, self.child_header) + self.save_pc(pc + 1) + self.stack.push((True,) * len(self.payloads)) + self.rows.install(self.bridge, self.child_header, + self.payloads[:self.public_count]) + retire(self.bridge, BASE) + retire(self.child_header, BASE) + + def primitive(self, token, fields): + for i in self.primitive_work: + retire(self.payloads[i]) + execute_table(self.services[token], + tuple(self.payloads[i] for i in fields+self.primitive_work), + tuple(self.payloads[i] for i in self.primitive_context)) + for i in self.primitive_work: + retire(self.payloads[i]) + + def ascend(self): + self.rows.collect(self.payloads[:self.public_count], self.bridge) + for tape in self.payloads: + retire(tape) + self.stack.pop() # ignore observer sizes and heads + pc = self.consume_pc() + target = self.payloads[self.program[pc-1].ports[0]] + retire(target) + transfer(self.bridge, target, source_marker=BASE) + retire(self.bridge, BASE) + return pc + + def run(self, observe=None): + pc = 0 + while True: + event = self.program[pc] + if observe is not None: + observe("before", pc, event) # checker only; ignores return value + if event.op == "INIT": + initialize(self.payloads[event.ports[0]], self.payloads[0]) + pc += 1 + elif event.op == "CLEAR": + retire(self.payloads[event.ports[0]]) + pc += 1 + elif event.op == "COPY": + copy_as_add(self.payloads[event.ports[0]], self.payloads[event.ports[1]]) + pc += 1 + elif event.op == "SERVICE": + self.primitive(event.token,event.ports) + pc += 1 + elif event.op == "PAID": + if self.rows.is_leaf(event.token): + self.primitive(("leaf",)+event.token,event.ports) + pc += 1 + else: + self.descend(pc) + pc = 0 + elif event.op == "RET": + if not self.has_parent(): + for i in self.root_cleanup: + retire(self.payloads[i]) + break + pc = self.ascend() + else: + raise ValueError("compiled opcode") + if observe is not None: + observe("after", pc, event) + + +def boundary_actions(q, b, parent_total, child_total, input_length, + output_length, staged_header_length): + """Exact descend+ascend actions, excluding the three row-service calls. + + Also excludes caller leaf/top tests. All heads are at local origins. + Includes PC, all retirement, occupied-target replacement and both relays. + """ + return (4 * parent_total + 5 * child_total + 18 * input_length + + 13 * output_length + 5 * staged_header_length + + 38 * q + 27 * b + 103) diff --git a/research/literal-tariff-conversion-audit/reference/02-streams.tex b/research/literal-tariff-conversion-audit/reference/02-streams.tex new file mode 100644 index 0000000000..088fceea18 --- /dev/null +++ b/research/literal-tariff-conversion-audit/reference/02-streams.tex @@ -0,0 +1,208 @@ +\section{The machine model and elementary streams} +\label{sec:streams} + +A machine has one fixed finite alphabet and one fixed finite number of +one-dimensional tapes. A step reads and writes at most one cell on each +tape and moves each head by at most one cell. Fixed tracks and finitely +many work tapes change time by a fixed factor. We distinguish moving one +digit in a fixed radix, which needs a bounded number of scans, from +interchanging fields whose numbers of digits grow. The latter permutation +will be realized in Section~\ref{sec:tape-interchange} by computing XOR +combinations of intermediate data streams. The present section supplies +the elementary scans it uses. Every scan includes its counters and the +return of its tape heads. + +\subsection{Array order and elementary scans} + +For a positive integer $a$ write $[a]=\{0,\ldots,a-1\}$. +An array with address set $[a_1]\times\cdots\times[a_t]$ is stored in +lexicographic order, with the first coordinate most significant. Its +entries are bits unless a record width is specified. A trailing record +of $B$ bits can equivalently be regarded as a final address field $[B]$. +An address is implicit in an entry's position in this ordered stream; it +is not stored beside every data bit. +The \emph{logical volume} $V$ is the number of stored data bits. Work +tapes and duplicate streams are charged in time but do not increase $V$ +in recurrences. All the fields discussed below are nonempty. A call +with an empty array is handled directly. + +An address permutation $f$ moves the entry at $x$ to $f(x)$. Thus its +action on an array $A$ is $(fA)(f(x))=A(x)$. Adjacent fields which are +irrelevant to an operation may be replaced by a single field whose length +is their product. In particular, the elementary procedures below have a +fixed number of formal address fields even when a surrounding algorithm +has a growing list of coordinates. Lengths and positions are supplied in +canonical binary on descriptor tapes; no additional tape head is attached to an +address coordinate. Each elementary call receives a fixed number of +collapsed canonical lengths. Constructing them from a longer surrounding +list is work of the caller; recursive calls below construct their own +collapsed descriptors within their stated bounds. + +When one address field is designated as a row field, collapse the fields +before it to a prefix $[P]$ and those after it to a suffix $[B]$. If the +row field has range $[R]$, a \emph{row} at prefix $p$ and row index $r$ +is the complete consecutive block $\{p\}\times\{r\}\times[B]$. +Every row therefore contains $B$ bits in the same suffix order. + +For headers that concatenate a list of positive integer parameters, we use +the self-delimiting code +\begin{equation} + b_v=\lfloor\log_2v\rfloor+1,\qquad + \Gamma(v)=0^{b_v-1}\operatorname{bin}_{b_v}(v),\qquad + |\Gamma(v)|=2b_v-1\quad(v\ge1). + \label{eq:integer-descriptor-code} +\end{equation} +The initial zeroes specify how many further bits follow the first one, +so concatenated codes can be read in order. We use this code when an +interface specifies a header; elementary calls still receive the fixed +number of canonical binary lengths described above. + +\begin{lemma}[Elementary stream operations] +\label{lem:elementary-streams} +Fix a radix $q\ge2$. Each of the following operations on an array of +volume $V$ takes $O(V)$ steps on a fixed number of one-dimensional tapes: +\begin{enumerate} +\item any fixed permutation of the pair of digit values at two specified +radix-$q$ positions, whether or not the positions are adjacent; +\item moving one specified radix-$q$ digit to another position, preserving +the order of the intervening positions; +\item splitting on a specified radix-$q$ digit, applying a fixed +pointwise map to aligned streams, and merging them back; +\item for positive integers $P,R,B$, within each prefix of an array on +$[P]\times[R]\times[B]$, splitting +whole rows cyclically into a fixed number $W$ of streams, and, when $W$ +divides $R$, merging those streams in any fixed order of the row classes. +\end{enumerate} +The bounds include shape preparation, counter initialization and resets, +and returning or clearing the visited portions of work tapes. Their +constants may depend on the fixed radix, the fixed pointwise map, and the +fixed number of row classes. +\end{lemma} + +\begin{proof} +For the first operation split into $q^2$ streams according to the two +specified digits. With these digits fixed, the order of all remaining +digits is unchanged by the permutation. Enumerate output addresses in +their required order and read the stream prescribed by the two preimage +digits. For a digit move use $q$ streams instead. The same observation +shows that splitting on one digit gives streams with the same remaining +address set in the same order. Scan their aligned entries, apply the +fixed pointwise map, and merge according to the output digit; this proves +the third operation. For the fourth, write $r=Wg+w$, where +$0\le w0,\quad 0<\epsilon<1. +\] +The exponents and comparison constants are fixed, and we impose their +further restrictions in Proposition~\ref{prop:simultaneous-layer}. +Two consequences explain the layout. The polynomial length $r$ grows +faster than every fixed power of $p$, so a scan of a record pays for +polynomial work on its address. Also $K/\log p\to\infty$, which will +make the exceptional set in a packed change of address bits small enough +to repair by sorting. We will obtain cost $O(Vd^{\lambda'})$, with +$\lambda'<1$ and $V$ the logical bit volume, whereas separate butterfly +factors would require $D$ whole-array passes. + +We first construct tensor products of the auxiliary two-point kernel +$C$ from Proposition~\ref{prop:complex-motif-interface}. Its phase +frames express a $C$ tensor product using smaller groups of +selected bits, separated by binary changes of basis. We implement those +changes by moving whole address chunks. Splitting complete rows among +the network's wire roles then reduces the volume of each recursive +call. Finally, we bound the intermediate dyadic values and convert the +completed $C$ layer to the normalized $H_0$ layer. The entire layer is +evaluated exactly before one final truncation. + +\subsection{Phase frames for a simultaneous butterfly layer} +\label{subsec:phase-frames} + +Hold the unselected address bits fixed and regard the stored complex +values on one wire role as a function of the selected bits. The phase +identities below express an edge's residual operator as a product of +two-point kernels on selected directions. + +Put +\[ + H_0=\frac12\begin{pmatrix}1&1\\1&-1\end{pmatrix},\qquad + H=\sqrt2 H_0,\qquad \mathsf S=\operatorname{diag}(1,i),\qquad + Z=\operatorname{diag}(1,-1). +\] +For the bit-flip matrix $X=\bigl(\begin{smallmatrix}0&1\\1&0\end{smallmatrix}\bigr)$, +define +\begin{equation}\label{eq:phase-C} + C=H\mathsf SH=aI+bX,\qquad a=\frac{1+i}{2},\quad b=\frac{1-i}{2}. +\end{equation} +Direct multiplication gives +\begin{equation}\label{eq:phase-basic-identities} + H_0=b\mathsf SC\mathsf S,\qquad C^2=X,\qquad C^4=I,\qquad + C^{-1}=bI+aX=-iZCZ. +\end{equation} +In particular, $C=iZC^{-1}Z$. These identities use only Gaussian dyadic +coefficients. The Hadamard matrices in the definition of +$\mathcal C_U$ are used to prove identities; they need not be executed +by the machine. + +Consider an edge from label $U_-$ to label $U_+$, and choose an +orthonormal basis $v_1,\ldots,v_{\rho_{\rm edge}}$ of its residual. +Proposition~\ref{prop:complex-motif-interface} gives the frame change +\[ + \mathcal C_{U_+}\mathcal C_{U_-}^{-1} + =\prod_{j=1}^{\rho_{\rm edge}}(aI+bX_{v_j})^{\epsilon_j}, + \qquad \epsilon_j\in\{1,-1\}. +\] +Here $(X_vf)(x)=f(x+v)$, and we write $C_v=aI+bX_v$. +The number of directional kernels is precisely +$\rho_{\rm edge}$, including on decreasing edges. The next step puts those directions +into coordinate positions without performing a general transpose. + +\paragraph{Implementing an arbitrary residual basis.} +For $M\in\operatorname{GL}(m,\mathbb F_2)$, let $\mathcal P_M$ be the +address permutation that moves the value at $x$ to $Mx$. Thus +$(\mathcal P_Mf)(x)=f(M^{-1}x)$, and +\begin{equation}\label{eq:phase-conjugation} + \mathcal P_MX_v\mathcal P_M^{-1}=X_{Mv}. +\end{equation} +Extend $v_1,\ldots,v_{\rho_{\rm edge}}$ to a basis of $\mathbb F_2^m$ and take these vectors as +the first $\rho_{\rm edge}$ columns of $M$. The displayed edge identity +then becomes +\begin{equation}\label{eq:phase-edge-coordinate} + \mathcal C_{U_+}\mathcal C_{U_-}^{-1} + =\mathcal P_M\left(\prod_{j=1}^{\rho_{\rm edge}}C_{e_j}^{\epsilon_j}\right) + \mathcal P_M^{-1}, +\end{equation} +where $e_j$ is the $j$th standard basis vector. The matrix $M$ need not +preserve the dot product: equation~\eqref{eq:phase-conjugation} only +uses its invertibility. + +For the array layout used below, take a group of $e=mf$ consecutive +axis chunks and divide it into $m$ consecutive slots of $f$ chunks, +numbered in physical order. +Number the chunks within each slot by $j=0,\ldots,f-1$, starting at +its least significant end. Write $x_{h,j}$ for the selected bit in +chunk $j$ of slot $h$, where $1\le h\le m$. Column $j$ is the vector +$(x_{1,j},\ldots,x_{m,j})$. A frame on this group is the tensor +product of the same phase frame +$\mathcal C_U$ of Proposition~\ref{prop:complex-motif-interface} +on these $f$ columns. + +To implement \eqref{eq:phase-edge-coordinate} on the group, first apply +$\mathcal P_M^{-1}$ separately to each column. For each +$1\le h\le\rho_{\rm edge}$, apply $(C^{\epsilon_h})^{\otimes f}$ to the +$f$ bits $x_{h,0},\ldots,x_{h,f-1}$. This is one child operation +on the $f$ axes in slot $h$. Finally apply $\mathcal P_M$ to every +column. A negative directional kernel still requires only one +forward child, because +\begin{equation}\label{eq:phase-inverse-child} + (C^{-1})^{\otimes f} + =(-i)^f Z^{\otimes f}C^{\otimes f}Z^{\otimes f}. +\end{equation} +The rightmost phase is applied first. All inverse wrappers are address +signs and constant fourth-root phases, so they add no recursive calls. + +Gaussian elimination expresses any $M\in\operatorname{GL}(m,\mathbb F_2)$ +as a product of at most $m(m-1)+3m$ elementary row additions: one clears +at most $m-1$ other entries per pivot, and each row swap is three row +additions. Reversing the elimination gives the required product since +each row addition is an involution. The number is a constant because +$m$ is fixed. Adding row $h'$ to row $h$ in every column applies +$x_{h,j}\leftarrow x_{h,j}\mathbin\oplus x_{h',j}$ for every +$0\le j1$, these segments +are disjoint, and the highest one ends immediately below $j_{f-1}$. +Write their initial values in $y$ and $z$ as +\[ + u_i=2g_i+a_i,\qquad w_i=2h_i+b_i, + \qquad a_i,b_i\in\{0,1\}. +\] +The values $g_i,h_i\in\{0,\ldots,2^{K-1}-1\}$ are the guard values. The +control for this pair of segments is the selected bit $c_i=x_{j_i}$. + +Apply each line of \eqref{eq:eight-packed-additions} simultaneously to all +these segment pairs. Physically, a line updating $y$ by sign $\varepsilon$ +and testing parity $b$ of $z$ is the single cyclic shift +\begin{equation} +\label{eq:packed-cyclic-shift} + y\longleftarrow y+ + \varepsilon\sum_{i=0}^{f-2}2^{j_i} + [\,x_{j_i}=1\,][\,z_{j_i}=b\,] + \pmod{2^L}. +\end{equation} +For a line updating $z$, interchange $y$ and $z$ in this formula. +The shift offset never depends on its target chunk, so each line is a +bijection of the rectangle. Let $S_0$ be their composition. It fixes +the spectator coordinates. + +Let $\mathcal B$ consist of the addresses for which +at least one used guard value, in either $y$ or $z$, fails +\begin{equation} +\label{eq:packed-guard-interval} + 10\le g\le 2^{K-1}-11. +\end{equation} +At an address outside $\mathcal B$, each segment initially lies in +$[20,2^K-21]$. Even displacement eight keeps it inside +$[0,2^K-1]$. Inductively, each packed addition therefore agrees with all +the independent segment additions: no segment carries into or borrows +from the next segment. When $f>1$, the bits below $j_0$ and above the +highest used segment are untouched as well. By +\eqref{eq:eight-packed-result}, $S_0$ +then agrees with the ideal permutation $T_0$ that performs the required +XORs at $j_0,\ldots,j_{f-2}$ and fixes all other address coordinates. + +There are exactly twenty excluded values for each guard in +\eqref{eq:packed-guard-interval}. Since its complete range has +$2^{K-1}$ values, the union bound over the $2(f-1)$ guards gives +\begin{equation} +\label{eq:packed-bad-fraction} + |\mathcal B|\le\delta_{\rm bad}M. +\end{equation} +Indeed, the complete $y,z$ ranges give the same guard distribution at +each choice of spectator coordinates. No record value enters this count. + +The ideal map $T_0$ preserves all guard values and therefore preserves +$\mathcal B$. Both $T_0$ and $S_0$ are bijections, and they agree off +$\mathcal B$. Taking complements in the finite rectangle gives +\[ + S_0(\mathcal B^c)=T_0(\mathcal B^c)=\mathcal B^c, + \qquad S_0(\mathcal B)=\mathcal B. +\] +Thus $T_0S_0^{-1}$ fixes $\mathcal B^c$ and permutes $\mathcal B$. +It remains to implement the rotations and this correction on tapes. + +For one rotation, move its target to the rightmost of the three chunk +positions if necessary. Let $P^{\rm sw}$ be the product of the record +field lengths before the earlier exchanged chunk, let $G^{\rm sw}$ +be the product between the exchanged chunks, and let $B^{\rm sw}$ be +$R$ times the product after the later one. Empty products are one. +The bit array has exactly the shape +\[ + [P^{\rm sw}]\times[2^L]\times[G^{\rm sw}] + \times[2^L]\times[B^{\rm sw}]. +\] +The third chunk lies inside one collapsed spectator interval. +Pass only $L$ and these three positive canonical lengths to +Lemma~\ref{lem:chunk-swap}. Each length is at most $V$, so the local +descriptor has $O(A_{\rm rect})$ bits. The swap costs $O(VL^\tau)$, including +its own padding and cleanup. + +The equal chunk lengths leave the field-length list unchanged by a +completed swap. Keep the permutation of the logical names $x,y,z$ in +finite local state. With the target now after its two controls, collapse +the remaining intervals to obtain +\[ + [\Lambda_0]\times[2^L]_{\rm control\,1}\times[\Lambda_1] + \times[2^L]_{\rm control\,2}\times[\Lambda_2] + \times[2^L]_{\rm target}\times[B_{\rm rot}], +\] +where $B_{\rm rot}$ includes the payload and every displayed spectator +length is positive. Their product with the chunk lengths is $V$. +Together with $K,f,\rho$ and the finite name permutation, these fixed +canonical lengths form an $O(A_{\rm rect})$-bit local descriptor. The offset +routine receives the two current $L$-bit logical control values. A scan +of at most $f\le L$ selected positions evaluates +\eqref{eq:packed-cyclic-shift} in $L^{O(1)}$ time, without reading the +target or spectator values. Lemma~\ref{lem:ordered-affine-streams} +therefore gives an $O(V)$ rotation: its offset work is absorbed by the +$2^L$ nonempty target blocks in each fiber. Undo the swap after the +rotation. The local descriptors and name permutation are updated at +completed swap boundaries; the primitives use their own descriptors +inside padded layouts. +There are at most sixteen swaps and eight rotations in $S_0$. + +To implement the correction, scan the stream with a record-rank counter. +All chunk names are back in their original positions. Dividing the +current rank through the fixed seven field lengths recovers the three +chunk values and their mixed-radix record strides. The strides exclude +the $R$ payload bits. All involved integers have $O(A_{\rm rect})$ bits, so +schoolbook arithmetic, descriptor copying, and resets take at most +$O(A_{\rm rect}^3)$ per record. Test membership in $\mathcal B$ and extract just +those records. For a current exceptional address $q$, compute +$q'=T_0(S_0^{-1}(q))$ by reversing the eight modular additions with +negated offsets, then applying the selected XORs directly. Each reversed +mask uses the current controls of that reversed line. There are at most +$f\le L\le A_{\rm rect}$ selected positions, so this calculation also fits +$O(A_{\rm rect}^3)$ time. + +If $q_h,q'_h$ are the current and destination values of chunk +$h\in\{x,y,z\}$ and $\sigma_h$ is its record stride, the fixed +spectator coordinates give +\[ + \operatorname{rank}(q')=\operatorname{rank}(q)+ + \sum_{h\in\{x,y,z\}}(q'_h-q_h)\sigma_h. +\] +The differences are signed. Attach this destination rank, padded to +$\lceil\log_2M\rceil\le A_{\rm rect}$ bits, to the extracted record, and mark its +hole on a fixed track of the full stream. Hold the full stream untouched +while stable binary radix sorting scans only the extracted records and +keys, least significant key bit first. Since $T_0S_0^{-1}$ permutes +$\mathcal B$, these keys are distinct and are exactly the ranks of the +marked holes. One forward full-stream scan reinserts the sorted records. +This implements $T_0$ everywhere. + +Finally apply the two-bit XOR to $x_{j_{f-1}},y_{j_{f-1}}$ by +Lemma~\ref{lem:elementary-streams}, splitting those chunks at the +selected positions and collapsing the other intervals. Its descriptor +again has a fixed number of positive lengths, each at most $V$. +This costs $O(V)$ and supplies the omitted selected position. When +$f=1$, $S_0,T_0$ are identities, $\mathcal B$ is empty, and this last +step is the entire algorithm. + +The movement costs $O(V(L^\tau+1))$. A fixed number of full record scans +costs $O(MA_{\rm rect}^3+V)$, and the at most $A_{\rm rect}$ radix passes cost +$O(|\mathcal B|A_{\rm rect}(R+A_{\rm rect}))$; skip them when the extracted bank is empty. +The initial descriptor has a fixed number of canonical integers of +$O(A_{\rm rect})$ bits, so its preparation is covered by $O(MA_{\rm rect}^3)$. +All counters, positioning, rewinds, and cleanup are included. +Equation~\eqref{eq:packed-bad-fraction} proves +\eqref{eq:packed-rectangle-time} on a fixed number of tapes. +After division by $V=MR$, its additional terms are bounded by +$A_{\rm rect}^3/R$ and +$80(f-1)2^{-K}A_{\rm rect}(1+A_{\rm rect}/R)$. Under the stated family bounds +the first tends to zero, and the second is +$O(p^2 2^{-K}(1+A_{\rm rect}/R))=o(1)$. This proves the final assertion. +\end{proof} + +\paragraph{Application to a fixed binary change of basis.} +An invertible matrix over $\mathbb F_2$ of fixed order $m\ge3$ is a +product of a fixed number of elementary row additions; a row exchange +is three such additions. In one invocation of the finite network on +$e=mf$ axes, slot $h$ consists of $f$ consecutive $K$-bit axis chunks. +It therefore has address-bit width $L=fK$, and its selected bits +$x_{h,j}$ occupy positions $\rho+jK$ for $0\le j1$. +For these fixed choices +there are a cutoff $p_0$, one fixed finite-alphabet multitape procedure, +and an implicit time constant with the following guarantee. The cutoff +and time constant may depend on the fixed rational parameters +and these constants. For every choice of positive integers $p,d,r$ +with $p\ge p_0$ and +\[ + a_dp^\epsilon\le d\le b_dp^\epsilon,\qquad + 2^{a_rp/d}\le r\le 2^{b_rp/d}, +\] +put $K=\lfloor d^c\rfloor$, and let $1\le D\le d$, $P,S\ge1$, and +$0\le\rho0, and write b=2^d o with o odd. This package +supports o<=125. Let L=max(bitlength(|a|),bitlength(b)) and K=L+2. The +constructor `compile_compact(a/b)` emits a fixed finite flat table, before +runtime numerical inputs are supplied. Its four coded ports are ordered +(target, source, numerator work, staged-output work). It uses only the +unchanged executor's branch, write, unit move, goto, halt and reject rows. + +For every positive even number R of components, every matching sequence of +positive signed widths w_i, every common grid 2^-F, and arbitrary independent +signed integers x_i,y_i in those widths, the service succeeds exactly when + + z_i = x_i + floor((a*y_i + floor(b/2))/b) + +fits the original signed width for every i. On success it installs the z_i, +preserves the complete source and borrowed contexts, restores all local heads, +and erases the current and previously used private bodies. This quantifies +all widths and component/column multiplicities. No condition that a*y_i or +its rounded quotient separately fits the public width is imposed. + +The four data tapes and any context tapes are physically distinct. Public +numeric bodies use canonical three-bit codes for little-endian two's-complement +bits 0/1 and delimiter 2, and end at an actual physical blank. Component +boundaries match. Public heads begin at their local origins. Work heads may +start anywhere from their origins through their contiguous old binary body +frontiers. No hidden old nonblank cells may lie after a blank frontier. +All bodies are behind protected local LEFT markers and ancestor backing. +Contexts are read-only binary bodies with confined starting heads. The +common grid, tape distinctness and canonical physical frontier are admission +premises; this table is not a universal decoder for arbitrary corrupt codes. + +On detected shape, grammar or final-range failure, no public cell has yet +been written. Work and heads may remain dirty or displaced; there is no +failure cleanup or automatic public-head restoration claim. A subsequent +call may retire failed private work after its public heads are re-established. + +The unchanged lifecycle implementation is public commit +`ab239cb6ee884e7a900dd9101c34448077fad0b0`, +`research/compiled-owned-bank-lifecycle/machine.py`. The immutable physical +fixture comes from rounded scalar commit +`6476455a1cf7cd29d6a2a81c3b6f02fd3a3bbf57`. The exact scalar Builder is +`13193a22b1070a74a8580c5d3ea27470443f815a`. `DEPENDENCIES.json` pins every +vendored byte by origin commit/path, Git blob, SHA-256 and length. Only the +Builder is reused from the exact scalar constructor; runtime carries and +passes below are newly emitted. The proof does not assume a host arithmetic +callback for the payload or a modified executor. + +The source witness is DreamingOfClouds' #6936 word at +`03626137d0bd57f09b0bf9597376183ce6fa9683`, Git blob +`d93e67ca7628bf5531ae6e369da4dd7b7907b88f`, SHA-256 +`273e81f176f001684b1fa3eb857992bf58b54748004fcfe806b83adb48d2cc00`. +It has 71,144 events. The coefficient census contains 61,052 ADD events +and one COPY (`COPY,1485,770,1,115`), collectively 4,462 reduced coefficients, L<=24 and o<=125. The three actual constructed +source tokens are `(local, pc, original_event)` for pc 252, 1103, 2798, +with ordered target/source indices retained in `SOURCE.json`. All three +are ADD. The coefficient census does not install COPY or transfer its +caller zero-target contract from a generic ADD theorem. +This is a finite three-occurrence registry, not an installed full recursive +caller or construction of all 4,462 coefficient tables. + +## 2. Widened Horner numerator, with cancellation retained + +Consider one width W component. Put M=W+K, and let A=2^(W-1). The private +numerator begins at zero. Read the fixed coefficients' bits from most +significant to least significant, padding both to L bits. If beta_i is the +bit of b and alpha_i is the bit of |a| multiplied by sign(a), perform + + N <- 2N + beta_i*x + alpha_i*y. + +After j passes, N=B_j*x+A_j*y, where B_j and A_j are the corresponding +binary prefixes. In particular 0<=B_j<=b, |A_j|<=|a|, and the signs of A_j +are consistent with a. Therefore every prefix satisfies + + |N| <= (b+|a|) A < 2^(W+L). + +The final offset c=floor(b/2)<2^(L-1) gives + + |b*x+a*y+c| < 2^(W+L)+2^(L-1) < 2^(W+L+1)=2^(M-1) + +for W>=1. Thus all prefixes and the offset result fit width M. K=L+2 is a +uniform sufficient extra width; the proof does not assert it is minimal. +For a=0 the same construction works. No separate same-width multiplication, +negation of a most-negative public input, or premature product-range guard +appears. This is why large terms that cancel remain admitted. + +Each Horner pass is in place on N and uses a bounded finite carry k. For +old numerator bit n and public bits x_bit,y_bit set + + v = 2n + beta*x_bit + alpha*y_bit + k, + z = v mod 2, k' = floor(v/2). + +The table writes z over n after reading n. The preceding old bits are no +longer needed: the recurrence carries exactly their contribution. Starting +at k=0, [-4,4] is closed because n,x_bit,y_bit are bits, beta in {0,1}, and +alpha in {-1,0,1}. This constant carry range is independent of the numerical +magnitude of a and b. Some constructed source tables use only [-2,2]. + +After W public bits, the public heads stay at their delimiters. Their last +bits sx,sy are retained in finite control and supplied for the K high +numerator positions. This is signed extension, including W=1 and a +most-negative source. Let sn be the old numerator's final bit and sz the +new final bit. Summing the bit recurrence with powers of two shows that +width-M signed arithmetic is exact precisely when + + k_M = 2sn + beta*sx + alpha*sy - sz. + +Indeed, replacing unsigned values by signed values adds their sign times +2^M, and the telescoping carry contributes k_M*2^M. The guard is both +necessary and sufficient. The preceding range proof guarantees it on +admitted inputs at every Horner prefix. It is never a guard on a separate +public-width product. + +A further in-place binary pass adds c. Its fixed coefficient bit index caps +at L, after which all offset bits are zero; M>=L+3. With v=n+c_bit+k and +z=v mod2, k'=floor(v/2), its signed terminal guard is k_M=sn-sz. Its carry +is bounded independently of a. The result is exactly N=b*x+a*y+c. + +## 3. Two banks, markers and all rewinds + +The numerator work tape contains a global logical marker 5, followed for +each component by logical marker 6, its M numerator bits, and delimiter 2. +The output work tape holds just W output bits and delimiter 2. Encoded +logical 6 is three nonblank physical bits and cannot prematurely stop +physical retirement. No third guide bank is allocated. + +Initialization scans the matched public component, creates W zero bits, +then adds K zero high bits while the public heads stay at delimiters. To +return for another Horner pass, the table moves numerator left K times +from its delimiter, then repeatedly moves left across a numerator bit and +moves both public heads left once. Encountering marker 6 ends the rewind; +the numerator head moves right once. Thus all three heads are at their +current first bits, including W=1, and no head crosses its local origin. +K is fixed in the table. Each later Horner pass uses this same rewind. + +The offset and residue passes do not move public heads. Their numerator-only +rewinds move left until marker 6 and then right. Neither this marker nor +any input-dependent length is examined by host code. At the quotient end, +all public heads are at their component delimiters and N at its delimiter; +advancing these heads and the output head starts the next component. +Finite parity/seen flags require a nonempty even component count. + +After every component has passed its range checks, the heads are at the +field frontiers. A reverse numerator scan recognizes each delimiter 2, +moves the two public heads and output head left once over their delimiter, +skips K numerator high bits, and moves the other heads left once for each +of the W remaining bits. It ignores marker 6 and continues to the previous +component. The global marker 5 terminates this procedure exactly at all +public/output origins, leaving the numerator at its origin. This works +without a runtime width counter and permits different matching widths in +different components. + +Only now does the output-to-target copy run. It copies coded bits and +delimiters to the target without changing the source. No branch before +this copy writes the target. Well-formed staged output has exactly the +public extent, so the target physical frontier is reached simultaneously. +The unchanged executor resets all data/context heads, and unchanged +`Controller.primitive` retires both private banks on successful return. + +## 4. Signed residue, exact odd quotient and final admission + +To divide the signed M-bit numerator, first compute its residue r modulo o. +For o>1, a least-significant-bit scan retains rho and power modulo o, +starting at 0 and 1. Each bit n contributes n*power; then power doubles. +At the terminal sign bit s, the unsigned value U differs from N by s*2^M. +The correct residue is therefore + + r = (rho - s*power) mod o = N mod o, 0<=r=1, +Q=(N-r)/o=floor(N/o) already fits signed width M. + +The first d quotient bits are discarded, without moving public or output +heads. The next W bits are staged, advancing the two public heads over +W input positions. The remaining K-d quotient bits must all equal the +last staged sign bit sz, and the final carry must satisfy k_M=s-o*sz. +Since d<=L-1, K-d>=3; these counts remain valid even when W=6 positions. The quotient's ordinary +staged positions use at most 59, while drop/high positions use at most 17. +These counts include reverse traversal and no unmetered data access. + +For `retire`, starting at displacement p<=A, the first origin scan costs +2p+3, the erase scan costs 3A+1, and its return costs 2A+3. Thus entry +retirement costs at most 7A+7 per old bank. After the service, the bodies +are contiguous and current lengths are at most 3U,3S. Origin scans and +exit retirement are covered above. The fixed entry/exit rows and constants +are absorbed because U>=1. A conservative combined bound is + + 512 (L+8) U + 7(A_N+A_O) + 16Q_c. + +This retains all L rereads, every marker, widening, copying, head return, +entry and exit erasure, finite control, and old dirty backing. On detected +failure before installation, execution is a prefix of these passes and +uses no more than the same bound, but omits success cleanup. The bound is +not identified with any earlier one-unit linear primitive tariff. + +If H_N,H_O are already allocated historical private capacities, the new +private physical backing is bounded by + + max(H_N,3U) + max(H_O,3S), + +not merely the currently nonblank bytes. Add the unchanged public/source, +context, ancestor and controller backing. Retirement turns old cells blank; +it does not reclaim or forget their historical capacity. Repeated calls +sum their positive costs and keep the maximum widths/extents of each bank. +No arbitrary workspace is silently restored by destruction: these two +roles are explicitly owned scratch authorized for retirement by the +retained primitive interface. + +## 6. Finite construction size and actual source coverage + +There are O(LK) Horner/high/reset states: carry and signs have constant +ranges, with fixed coefficient index and fixed high-bit count. Offset +states contribute O(L), residue states O(o^2), and quotient/drop/high states +O(Ko), since d0}`, `k_min=min{k:W_k>0}`, and +`r_max=max{r_j}`. Require `r_max g*S`, keeps one +external weight throughout the entire finite circuit, and lowers only its +final rank-one leaves. All rational matchers, role routes and their inverses +are fixed before choosing the odd prime and its exclusions. Every route +uses complete equal-multiplicity cover fibers and the retained, costed row +permutation primitive. This gives the same finite DAG argument in the +rational-cover program category. The BIT binding supplies the actual native +projectors; a rank count alone would not provide this implementation. + +## 2. Proposed conclusion + +Suppose the preceding hypotheses hold and the mixed balance has root +`tau` in `(0,1)`: + +``` +sum_j r_j^tau = sum_k W_k k^tau. +``` + +For every `z` with `tau=2`, a fixed number `B_N` of productive arrays, +and only rank-one paid children, whose number `P_N` satisfies + +``` +P_N < B_N * N^z. +``` + +Every productive output is the full rank-`N` job. The construction may have +an enormous finite scalar word, role inventory and owned-storage requirement. +Those quantities affect constants and the eventual input threshold. They are +not omitted and are not credited as extra output jobs. + +If this uniform supplier is admitted under the retained native, precision and +fixed-tape premises, the existing uniform recursion applies directly. A new +dynamic RAM-to-Turing-machine simulation is not being assumed here. + +## 3. The integer lockstep flow at a fixed rank + +This is the part of Theorem 1G used by the compiler. At one fixed top rank +`N`, its units, source jobs and exit jobs have integer multiplicities. +For a multi-index `a` on the target types define + +``` +c(a) = product_k k^(a_k), +u(a) = multinomial(|a|;a) * product_k W_k^(a_k). +``` + +The exact Pascal identity is + +``` +u(b) = sum_{k:b_k>0} W_k*u(b-e_k). +``` + +Let `G` be the largest `|a|` with `m*c(a)<=N`. A class is indexed by a +sequence of paid rounds `s` of length `d<=G`; its dilation is +`rho_s=product r_j`. It contains `u(a)` units at column `rho_s*c(a)` for +each `a` with `|a|=G-d` and `m*rho_s*c(a)<=N`. + +For one parent paid round, the Pascal bijection matches its job copies to +target roles of the child class, at exactly equal integer ranks. Missing +demands are top sources. Separation ensures every parent job is consumed. +The source ranks lie in `(N/m,N]`; only the deepest classes produce exit +jobs, all strictly smaller than `N` once `N` is outside the finite base range. + +Process a class in word order. At round `j`, suspend every unit of that +class, complete the entire child class fed by that round, and only then +advance the parents to round `j+1`. This forbids a unit from requiring both +an earlier and a later round of the same suspended parent. The resulting +dependency graph is finite and acyclic. Its edges carry complete array jobs, +not individual scalar values copied for free. + +These integer quantities exist before normalizing the sources to total +weight one. Let `S_s` be the number of source jobs of rank `s`, let +`S=sum_s S_s`, and let the ordered exit batches be `(e,t)` with `t` jobs +of rank `e` each. This finite integer flow is the compiler input. + +## 4. Clear every batch denominator constructively + +Induct on the integer top rank `N`. For each smaller rank `e` the compiler +has already constructed a uniform program on `B_e` arbitrary arrays, +computing full rank `e` with `P_e` paid rank-one calls. For a sufficiently +small rank use the ordinary sequential program: `B_e=1`, `P_e=e`. + +For the current flow choose an integer `a` divisible by every `B_e` needed +for an exit and every `B_(N-s)` needed for a nonzero source remainder. +The product of those finitely many positive integers is a valid choice; +their least common multiple is a smaller optional choice. Set + +``` +B_N = a*S. +``` + +Assign `a*S_s` of the input arrays to each source rank `s`. On each of those +arrays, first complete its `N-s` complementary coordinates using the +already-compiled smaller uniform program. All such batches are integral +because `a` is divisible by their program widths. This preliminary action +commutes with the intended `s`-coordinate job and fixes its input coordinates. + +Make `a` copies of the integer lockstep flow. Route its source arrays to +their exact input slots using permitted whole-array adapters. At a deepest +exit batch, `a*t` is divisible by `B_e`; replace that batch by copies of +the smaller uniform rank-`e` program. Restore its role ordering and adapters +before resuming the suspended parent class. Execute the finite DAG in the +lockstep order, and finally restore the original source-array ordering. + +Every array has now received its disjoint complementary job and source job, +hence the full rank-`N` transform. No copied scalar input or blank helper is +treated as another independent output. Every original array occurs exactly +once as a source; interior target slots are jobs on those arrays, not new +productive inputs. + +Induction removes all recursive calls: the only remaining paid children +have rank one. Clearing denominators multiplies productive arrays and paid +operations equally, so it preserves the per-array leaf count. In formulas, + +``` +P_N/B_N = (1/S) * [ + sum_s S_s * (P_(N-s)/B_(N-s)) + + sum_(ordered exit batches e,t) t * (P_e/B_e) +]. +``` + +Zero-rank terms vanish. Any plain rank-one exits are the ordinary base +program. Scalar and routing passes have their own analogous nonnegative +count and must be included in the asymptotic cost used to choose `N`. + +This construction uses full integer batches; it does not assume that +fractional pieces of a physical array can be routed at zero cost. Its exact +replication factors can be impractically large, which is acceptable for a +fixed finite supplier existence statement but must be disclosed. + +## 5. Why some fixed N has the required saving + +The independent audit sharpened this step to a direct count of paid leaves. +It does not require a running-time comparison between a RAM flow and native +tapes. Let `L(n)=P_n/B_n`, let `w_s=S_s/S`, and let `x_e` be the exit counts +normalized by the number S of source arrays. The actual integer compiler +satisfies + +``` +L(n) = sum_s w_s L(n-s) + sum_e x_e L(e), +sum_s w_s = 1, +sum_e x_e e^tau = sum_s w_s s^tau. +``` + +The last equality follows by canceling every internal matched job in the +exact tau-potential balance. The source ranks satisfy `n/m0`, concavity gives + +``` +n^z0 - sum_s w_s (n-s)^z0 >= eta * sum_s w_s s^z0. +``` + +Indeed, for `t=s/n` in `[1/m,1]`, +`1-(1-t)^z0 >= z0*t >= eta*t^z0`. For every sufficiently large n the +exit coefficient is less than `eta/2`. Every complement and exit has +smaller rank than n, so strong induction on the exact recurrence proves +`L(n)<=A*n^z0`, with finite A chosen to cover the smaller ranks. Eventually +`L(N)=2, +one common grid Delta=2^-F, canonical coded real/imaginary components and +actual physical blank frontiers. Its caller descriptor has the retained +23-field binary encoding. Let f,K,H,G be positive, 0<=rho=9; that is why simply +passing its old remainder to a rank-nine monomial would be invalid. This +private view is supplied only to the monomial consumer, not to an ordinary +or general global header producer. + +The exact monomial consumer checks selected_axes=rank*f+remainder, +remainder=2. + +The table rewinds the owned copy's head over its two components using the +real numerator as a width guide: skip its two high positions, move left +once per remaining bit, then repeat for the other component. The original +public head stays at its imaginary delimiter. Both complete input components +have already been read, so overwriting this owned pair cannot affect later +original or translated input pairs. + +For each numerator, add1 with a bit carry, discard the first result bit, +and emit W result bits into its original owned-copy component positions. +The one remaining high bit must equal the emitted sign; the final addition +carry must equal old_sign-new_sign. This is exactly the iff signed-width +criterion for floor((N+1)/2), including negative odd N. No assertion that +upward rounding commutes with negation is made: R_up(-1/2)=0 while +-R_up(1/2)=-1. + +A completed pair leaves both numerator heads at their delimiters. Rewind, +clear their current logical digits/delimiters to encoded logical blanks, +and return to marker5 for reuse. Physical retirement later erases all encoded +blanks and any old longer backing. Equal real/imaginary widths and matching +public/owned shapes are checked while scanning; their canonical initial +format remains a theorem premise, not universal corrupt-input validation. + +## 4. Complete staging, failures and ownership + +The STAGE table writes only the owned copy and the two numerator banks. +It never writes the public field. Earlier completed pairs may have changed +the owned copy when a later pair rejects. Those changes are allowed only +because this is explicitly owned disposable storage. + +On successful STAGE completion, the unchanged executor restores heads and +unchanged `Controller.primitive` retires its two work banks. A separate +literal COMMIT table copies the complete staged owned field to the public +field. All signed checks have already passed, so under the canonical format +premises COMMIT cannot fail its extent check. This separation uses the actual +executor's paid origin return; no free rewind guide for the full field is +assumed. The two numerator banks are reused and charged again by COMMIT's +primitive wrapper, even though its table does not need them. + +`LambdaProvider.run` explicitly retires every owned work role before use, +copies the original field, prepares the private header, executes the real +serial translation, executes STAGE and then COMMIT. Its finally boundary +releases the view, physically retires all private roles including a failed +partial copy, and returns public and context heads to their local origins. +Thus a final signed-range rejection leaves the complete public value intact +and returns clean owned bodies and restored public/context heads. This +property is proved for valid numerical geometry and named arithmetic +rejection. No arbitrary malformed/interrupted native execution or process +termination rollback is claimed. + +All physical tapes are distinct and behind protected local LEFT markers. +The initial public/context heads are at their origins. Old private bodies +must be contiguous binary prefixes and their heads within their local bodies +or frontiers. Hidden dirt after a physical blank is excluded. The fixed +inventory is allocated before runtime; pointer identity checks do not prove +physical segment disjointness. No arbitrary borrowed workspace is erased. + +## 5. Actual-input error and all-column precision contract + +For an admitted input, each real and imaginary output differs from the +exact Lambda_s(Q_f) of that actual input by at most Delta/2. Therefore on +any containing complete X-fibre, + + ||output-Lambda_s(Q_f) input||_X <= 2^((X-1)/2) Delta = eta_X. + +The count is 2^X complex entries, or 2^(X+1) real components. This is the +single rounding contract demanded by the published precision package +`56bc9383594a3efc303148e00bb746851abd1ed5` Sections2/5. It is uniform in +positive column multiplicity and in all spectator fibres. Since the pure +translation is a unitary involution, the ideal global Lambda has eigenvalues +1 and s*i and norm1. That algebraic fact is prior; the new contribution is +its source-specific physical producer and one-rounded arithmetic join. + +A simple sufficient closed admission domain is +||input||_X <= (2^(W-1)-1)Delta, with X containing every translated axis. +Unitary Lambda then has each output component within the same symmetric +bound, so rounding fits width W. More general inputs succeed iff every +rounded component fits. The source precision proof's common-width/radius +substitution may also be used once its actual caller/header and inherited +operator premises are installed. This package does not silently identify +its W,f,selected_axes with a complete caller export or prove all upstream +rounded states satisfy that external guard. + +## 6. Full positive cost, source count and historical backing + +Let V be the complete coded public physical length, E the parent descriptor +length, P the fixed total number of owned private roles, and A_old the sum +of their initially dirty contiguous physical body lengths. All constructor, +source access, fixed-table generation and allocation costs are F_template. +They are positive and separate from variable-input traversal. + +For the new Gaussian stages, let S=sum(W_i+1) over all real components. +Counting every physical tape action and every executed flat row, a safe +bound is 4096(S+1), plus entry/final old-body, context-head and fixed-role +charges. One ordinary position performs at most four coded reads, two writes, +four moves and finite carry-state jumps; its reversals and two high positions +are included. Coded reads cost at most10 physical actions, writes9, moves4, +plus their executed rows. Pair rewinds, encoded-blank clearing, executor +origin returns, the separate full-field COMMIT and successful retirement +are all linear in S. Two-component work reaches at most 3(W+4) physical +bits in each numerator role. A previous larger width remains allocated. + +An entry retirement from displacement p<=A costs 2p+3 for origin, 3A+1 to +erase, and 2A+3 to return: at most7A+7. The outer copy, final owned-bank +retirement, context returns and private view contribute O(V+E+P)+7A_old. +The new header construction/release has O_9(E+1) encoded-symbol work, because +rank9 is fixed. It makes no runtime integer conversion. + +Retain the serial monomial's complete bill. Write g=popcount(q), +C=outer*rows, R1=2Wr*2^(a-z), M1=C*2^z, Vraw=M1*R1, and +A1=2+z+ceil(log2(R1+1)). Its contribution is + + O_9(f*((g+1)*(Vraw+M1*A1^6)+V+(E+1)^4+P)). + +Therefore the whole Lambda invocation costs + + F_template + + O_9(f*((g+1)*(Vraw+M1*A1^6)+V+(E+1)^4+P)) + + 4096(S+1) + O_9(V+E+P) + 7A_old. + +There is no subtraction of inherited ordinary work and no conversion of +this bill to the old 1000-unit LAMBDA allowance. Only with the separately +stated padding absorptions R1>=A1^6 and (E+1)^4+P=O(V) does the variable +term simplify to O_9(fV), plus old history. If those premises fail, the larger +bill stays. All f iterations reuse one provider; no history reset or new +per-column allocation is hidden. + +The one extra full-field bank has current backing V. Each of the two +numerator roles retains max(old_capacity,3(W_max+4)). The header roles +retain maxima O(E+1), and every unchanged serial/monomial role retains its +own full historical maximum from the predecessor space theorem. Add public, +context, ancestor and fixed-controller backing. Erasure does not shrink +these maxima. The unused ordinary object and its tapes remain counted. + +At the caller-source level, there are 14,480 such service occurrences. +Each gains one explicit owned-copy lifetime and its positive bill; the two +primitive work roles and provider inventory must be included in active +stock. There are zero new recursive paid jobs and zero productive helper +credits. Whole-caller sequential reuse, unfinished-context stock and the +sum of all source/setup/runtime bills still require compiler integration. +No full raw cap, accepted exponent or unconditional theorem follows here. + +## 7. Evidence and limitations + +The source census pins every occurrence/sign/port/q. Physical descriptor +checks cover all23 fields with old remainders0,8,152 and several positive f, +including cases where passing the old remainder would violate rank9. +The Gaussian arithmetic has an independent direct integer oracle over all +four arbitrary signed inputs at widths1,2, plus wider signed endpoints. +It runs through unchanged primitive tables, including explicit rejection +cleanup, source protection and a positive tape/control bill. + +Complete reduced-rank composition executes the actual monomial provider, +private header, Gaussian staging and commit for both signs, late overflow +and reuse after failure. An ordinary-runtime entry trap rejects any accidental +child invocation. The source-specific nine-axis recipe/header join is proved, +but the minimum4096-record nine-axis numerical run is not claimed executed: +the16-record reduced run took0.91s and more than5 million physical actions; +a simple record-scaling screen already exceeds230s before the larger recipe's +extra flips, beyond the120s attempt cap. This is a feasibility screen, not +a formal wall-time lower bound or a runtime measurement of the source case. +No nine-axis host vector evaluation is relabelled physical execution. + +Credit the source authors DreamingOfClouds/#6936/#6937, the retained phase +and monomial work (#3087/#4172), CubeJerry's serial/provider/lifecycle and +scalar work, and the published source precision package. Horner/carry, +Gaussian identities, permutation tensoring and nearest-up rounding are +classical. Full source/header exporter installation, admitted caller precision, +all remaining native services, recursive owned history, common physical +tariff and analytic recovery remain open. All five framework assumptions +remain globally conditional. Separate AI review is not human or kernel +acceptance; the finite tests do not substitute for this all-size argument. diff --git a/research/literal-tariff-conversion-audit/reference/LAMBDA-SOURCE.json b/research/literal-tariff-conversion-audit/reference/LAMBDA-SOURCE.json new file mode 100644 index 0000000000..0497a28a6d --- /dev/null +++ b/research/literal-tariff-conversion-audit/reference/LAMBDA-SOURCE.json @@ -0,0 +1,41 @@ +{ + "actual_rank9_owned_ports_by_q_weight": { + "3": 1965, + "7": 1965 + }, + "current_selected_catalogue_used": false, + "directions": 104, + "first_site": { + "port": 0, + "q": 11, + "raw": [ + "A", + "LAMBDA", + 0, + -1 + ], + "role": 0, + "sign": -1, + "site": 2, + "type": "A" + }, + "literal_recipe": "identity9, offset=q, phase=0, linear=quadratic=0", + "nine_axis_numeric_run": false, + "occurrences": 14480, + "old_caller_exporter_installed": false, + "one_column_exact_character_checks": 53248, + "q_weight_histogram": { + "3": 70, + "7": 34 + }, + "signs": { + "-1": 8832, + "1": 5648 + }, + "source_events": 3095, + "source_numeric_screen": "16-record reduced composition took0.91s;4096-record source exceeds230s by simple record scaling before extra flips, exceeding120s cap; no source execution claimed", + "type_occurrences": { + "A": 13824, + "B": 656 + } +} diff --git a/research/literal-tariff-conversion-audit/reference/PRECISION-GUARDS.json b/research/literal-tariff-conversion-audit/reference/PRECISION-GUARDS.json new file mode 100644 index 0000000000..d295e9bb21 --- /dev/null +++ b/research/literal-tariff-conversion-audit/reference/PRECISION-GUARDS.json @@ -0,0 +1,115 @@ +{ + "conditional_path_bounds": { + "Sigma_node_bound": "2**H * (D+3)", + "format": "F=p+D+g; W=p+h+2D+3+g; temporary W+26", + "gain_bits_per_context": 344, + "radius_bits_per_context": 357 + }, + "optimistic_tariff_model": { + "all_native_surcharge": 16940304, + "baseline": 826265904, + "conditional_margin": 156568512, + "conditional_total": 843431488, + "native_call_count": 18, + "outer": { + "lambda_offset_model": 173760, + "scalar_offset_model": 51520 + }, + "per_native_call_surcharge": 941128, + "retained_exact_conversion_charge": 2734992, + "status": "Declared extra-scan model, not a physical tape-cost certificate", + "total_surcharge": 17165584 + }, + "parameters": { + "H": 14161600000000000000, + "H_index": 141616, + "Kstar_bits": 14073, + "LP": 2226, + "ambient": 153, + "scaled_Kstar_bits": 14085, + "v": 1920 + }, + "small_rank_guards": [ + { + "D": 1, + "extra_fractional_bits": 5 + }, + { + "D": 2, + "extra_fractional_bits": 5 + }, + { + "D": 3, + "extra_fractional_bits": 5 + }, + { + "D": 4, + "extra_fractional_bits": 5 + }, + { + "D": 5, + "extra_fractional_bits": 5 + }, + { + "D": 6, + "extra_fractional_bits": 5 + }, + { + "D": 7, + "extra_fractional_bits": 5 + }, + { + "D": 8, + "extra_fractional_bits": 5 + }, + { + "D": 9, + "extra_fractional_bits": 5 + }, + { + "D": 10, + "extra_fractional_bits": 5 + }, + { + "D": 11, + "extra_fractional_bits": 5 + }, + { + "D": 12, + "extra_fractional_bits": 5 + }, + { + "D": 13, + "extra_fractional_bits": 5 + }, + { + "D": 14, + "extra_fractional_bits": 5 + }, + { + "D": 15, + "extra_fractional_bits": 5 + }, + { + "D": 16, + "extra_fractional_bits": 5 + }, + { + "D": 17, + "extra_fractional_bits": 5 + }, + { + "D": 18, + "extra_fractional_bits": 5 + }, + { + "D": 19, + "extra_fractional_bits": 0 + } + ], + "temporary": { + "denominator_bits": 19, + "extra_signed_bits": 26, + "numerator_bits": 24 + } +} diff --git a/research/literal-tariff-conversion-audit/reference/PRECISION-PROOF.md b/research/literal-tariff-conversion-audit/reference/PRECISION-PROOF.md new file mode 100644 index 0000000000..465a5dddd8 --- /dev/null +++ b/research/literal-tariff-conversion-audit/reference/PRECISION-PROOF.md @@ -0,0 +1,514 @@ +# Precision envelope for the actual QUERY-only caller + +Prepared for **@CubeJerry**, with substantial OpenAI assistance. Canonical base: +`7c49fe32c55de02c2c873655c804b16e4c3fef0a`. This is a source-specific +conditional precision lemma and an exact-service boundary audit. **No new +kappa; no physical rounded caller; no unconditional multiplication theorem.** + +## 1. Exact question and predecessor boundary + +The caller is the published 3,095-event QUERY-only source at +[`617903497387a98f7ca929ad0b6928dd32abffec`](https://github.com/CubeJerry/integer-mult-bounds/tree/617903497387a98f7ca929ad0b6928dd32abffec/research/p104-query-only-interval). +It has 76 symbolic A/B main roles, 18 joint native calls, and no QSELF. +Every joint call uses the unchanged 71,144-event word of +[CrocSwap/integer-mult-bounds#6936](https://github.com/CrocSwap/integer-mult-bounds/pull/6936), +head `03626137d0bd57f09b0bf9597376183ce6fa9683`. The helper allocation is +the published caller's: 3,952 actual main inputs and 18 disjoint families of +1,061 arbitrary helper inputs. Helpers are not initialized zero or reused +between stages. The 51 owned labels, 54 lifetimes and peak 43 in each local +word remain unchanged. + +`DEPENDENCIES.json` pins eleven unmodified inputs by original repository, +commit, path, byte count, Git blob and SHA-256. The executable source blobs +are `cf55f4271009a06ad192a070d330a4466b6d44fa` (caller) and +`d93e67ca7628bf5531ae6e369da4dd7b7907b88f` (compressed native word). +The native proof/checker, rounded note and exact-grid proof are authenticated +reference material; this package does not execute their dependency trees. + +There are three different predecessor claims: + +1. [CrocSwap/integer-mult-bounds#6901](https://github.com/CrocSwap/integer-mult-bounds/pull/6901) + proves an exact common-grid implication under its stated ideal recursion, + source and complete-job premises. It explicitly does not allow arbitrary + rounded child returns. Its numerical/source constants belong to #6030. +2. DreamingOfClouds' #6936 and the exact common-odd-grid lineage use an + `S=1125` prefix divisibility certificate with exact completed children. + CubeJerry's published `odd-native-common-grid`, commit + `e45e844303e04947cf6591fb46b43bf8a7bc5356`, makes a related exact-grid + reduction for the preceding word. Those exact statements do not imply + divisibility after an adversarial nonzero child defect. +3. DreamingOfClouds' `ROUNDED-DIVISION.md` in + [CrocSwap/integer-mult-bounds#6937](https://github.com/CrocSwap/integer-mult-bounds/pull/6937), + head `a98df73ddae1d1ea85a62b6bdf2714b28cb7b359`, states a different, + total rounded-division contract and a complete-fibre defect-tree method. + Its displayed word constants refer to #6932's 67,079-event source; the + note explicitly requires later words to recompute them. Its S1--S5 + structural premises and physical implementation obligations remain + premises here. + +The new work is an exact, reproducible envelope for the **actual changed +caller with every current native call expanded at all its source cuts**, +including backward checks of its critical prefix/suffix bounds. It supplies +current format and integer temporary constants, checks the retained large +threshold, and locates a concrete actual-source obstruction to replacing +total rounded division with the existing checked exact table. It neither +reproves the exact endpoint nor treats formal endpoint equivalence as +equivalence of rounded executions. + +## 2. Norm, input domain and primitive contract + +Let `D>=1`, `p,h>=0` be integers, with one common component grid +`Delta=2^-F`. Every real and imaginary component of every arbitrary public +input is on this grid and has absolute value less than `2^h` at the stated +raw/root boundary. Owned INIT produces exact zero. Public inputs include +every helper, independently; no correlation or cancellation is assumed. +For the outer-wrapper extension below, D is the total selected factor +`D=q+R`: the q preprocessed coordinates and the remaining reference factor +R. Establishing the input p,h domain at the chosen external boundary is +separately paid. The q kernels must precede the later R-fibre computation, +as stipulated by the retained wrapper contract; the proof converts once +from the D-fibre norm to the R-fibre norm in the safe direction. + +For a selected set of `X` binary coordinates use the supremum, over complete +`X`-fibres, of the Euclidean norm on that fibre's `2^X` complex entries. +Write this as `||z||_X`. For complete nested factors, `||z||_R<=||z||_D` when +`R` is contained in `D`. If every component has error at most `Delta/2`, +then the error in this norm is at most + + eta_X = 2^((X-1)/2) Delta. + +An input with the component bound above has fibre norm less than + + B_root = 2^(h+(D+1)/2). + +The norm contracts are explicit: + +* Each completed native frame change, Q query and D-mask job is the intended + complete-fibre unitary, with the absolute phases and column multiplicities + required by the inherited source. This is a semantic premise, not a + consequence of the finite frame-span check. +* Q and the D_j commute where the frozen exact endpoint uses that identity, + and `Q^4=I`. Therefore + + Lambda_s = ((1+s i) I + (1-s i) Q^2)/2, s in {-1,+1}, + + is unitary: the unitary involution Q^2 has eigenvalues ±1, and Lambda_s + has eigenvalues 1 and s i. In particular it is not `(I+Q^2)/2`. +* A completed primitive with ideal map T has a **total** contract on every + input in its declared grid/radius domain: it returns a grid value differing + from T of that actual input by at most its declared epsilon. The contract + may be nonlinear and its residual may depend adversarially on the input. + It must cover actual inputs to each recursive child, not just ideal ones. +* Scalar rounding, when invoked, is the total function + + RDiv_(a/b)(m) = floor((a m + floor(b/2))/b), gcd(a,b)=1, b>0. + + Its scalar residual has absolute value at most 1/2. Integer coefficients + are exact. For ADD, round the product and then add the old target exactly; + equivalently add the integer `b*old_target` inside the numerator. Negative + values use mathematical floor. Upward ties mean RDiv is not an odd map. +* Lambda needs its own completed primitive with residual at most eta_X, + for example exact formation of its common denominator-two numerator + followed by one rounding per component, with an exact Q^2 monomial + service. This is an explicit contract; no such physical table is installed + here. An implementation which rounds twice must supply the resulting + larger residual instead. + +For the local estimates take `epsilon>=eta_X`, and bound each completed +child, QUERY, IDLE and Lambda residual by epsilon. Arithmetic and native +operations must run to their completed source cut before another field +reads them. No assertion that partially constructed Clifford outputs are +Clifford vectors is used. Scalar numerator temporaries are handled separately +in section 6; arbitrary internals of a native provider are inherited +obligations, not unnamed source cuts certified by this package. + +**Why this is uniform in column multiplicity.** Tensor products of unitary +complete-fibre maps have norm one. Rational scalar coefficients are applied +once and are not raised to a tensor power. The only dimension factor is the +single conversion `eta_X` at a componentwise rounding site. These facts hold +for every positive column multiplicity under the complete-fibre premise. +Coordinate supremum norms do not have this property: the exact Gaussian row +`((1+i)/2,(1-i)/2)` sends `(1,i)` to `1+i`, of modulus sqrt(2). A phase error +may preserve norm one, so a norm certificate cannot certify native phase +correctness. + +## 3. Native prefix and suffix certificate + +For each live native register r carry two nonnegative rational numbers +`m_r,e_r`. Initially m=1 on every public input and m=0 on owned labels; +e=0 everywhere. At each source event use: + +| Source event | Mass update | Defect update | +|---|---|---| +| MOVE r | m_r unchanged | e_r <- e_r+1 | +| ADD/COPY r,s,q | m_r <- m_r+abs(q)m_s | e_r <- e_r+abs(q)e_s+1_(q noninteger) | +| SCALE r,q | m_r <- abs(q)m_r | e_r <- abs(q)e_r+1_(q noninteger) | +| INIT/CLEAR r | m_r <- 0 | e_r <- 0 | + +COPY in this source is additive COPY into freshly initialized zero. The +checker proves that source precondition. It does not erase an arbitrary +target's earlier residual by fiat. Register frames agree at scalar contacts; +each MOVE starts at its declared current frame and uses the declared public +or owned direction. A separate exact span/lifetime scan checks all of these +syntactic premises and the final public frame list. + +By chronological induction, at every source cut the exact ideal value has +norm at most `m_r B`, and the realized-minus-ideal value has norm at most +`e_r epsilon`, for input norms at most B. MOVE preserves norms by the stated +unitary contract. ADD and SCALE use the triangle inequality. INIT/CLEAR kill +all earlier error channels. Also track the product `abs(q)m_s` and its defect +bound before every ADD/COPY; rounded product residuals are bounded by the +corresponding final target bound, whose other summands are nonnegative. + +This positive propagation deliberately forgets all cancellations. It is a +valid, loose bound rather than a claim that these extrema are attained by a +choice of actual unitary inputs. In particular the large constants below do +not contradict the smaller cancellation-aware exact-grid row estimates. + +The exact rational scan of all 71,144 events gives: + +| Bound | Meaning | Strict bound | +|---|---|---:| +| M_W | all stored fields and pre-ADD products | 2^237 | +| Sigma_W | all-cut propagated unit residual mass | 2^235 | +| Gamma_W | returned public residual mass | 2^235 | + +The maximum prefix is register 1443 after event 71119; the returned defect +maximum is the same register after the whole word. `ENVELOPES.json` records +the exact rational values and witnesses, not floating logarithms. There are +6,323 MOVE sites and 25,923 noninteger scalar sites, including 4,143 odd +scalar divisions. There is no multiplication by the number of public fields +because the contract takes a maximum over fields. + +**Separate critical check.** `native_adjoint` starts a covector at each +reported maximum and runs the transpose recurrence backwards. Reverse ADD +adds `abs(q)*lambda_target` to the source covector; reverse SCALE multiplies +its covector; reverse INIT/CLEAR zeros it. A residual site contributes the +current target covector. The sum on initial public inputs reproduces M_W, +and the sum on residual sites reproduces Sigma_W/Gamma_W. There are 24,507 +nonzero residual-site contributions at the worst witness. This is a +separately coded reverse calculation, not an independent physical execution +or formal proof-kernel check. The forward induction is the mathematical +reason a finite exact source scan proves a statement about all inputs. + +## 4. Full caller and every expanded native cut + +Caller scalar operations use the same positive recurrence. SWAP permutes the +two pairs of bounds. LAMBDA and IDLE leave mass unchanged and add one unit +of residual. QUERY adds the source mass/error to the target and adds one +residual. This uses the complete query contract, including restoration; +it does not treat the query copy/erase lifecycle as free. + +For a J contact, the frozen exact local endpoint on the six symbolic main +roles is, with unitary factors suppressed in the positive bound, + + A: (u,v,x,y) -> (u, v+Q^-1 u, x-Q y, y), then D_j; + B: (s,t) -> (s-Q t, (Q^-1 s+t)/2), then D_j. + +Use the positive endpoint matrix + + (u,v,x,y,s,t) -> (u, v+u, x+y, y, s+t, (s+t)/2) + +on old mass/error values simultaneously, then add Gamma_W to each returned +main's defect coefficient. Helpers return their own unitary-transformed +input plus at most Gamma_W epsilon. Each helper family belongs to exactly +one joint stage, so it starts with mass bound 1 and no prior raw-caller +defect. This does not identify distinct helpers or suppose they vanish. + +At that J entrance let `m_in=max(1, the six main mass bounds)` and +`e_in=max(the six main defect bounds)`. Every internal native cut obeys + + ideal norm <= M_W m_in B; + defect norm <= (M_W e_in + Sigma_W) epsilon. + +These inequalities include prior caller errors arriving at a native call; +restarting the native word with zero error on its mains would be invalid. +They also include all fresh arbitrary helper inputs. The source scan checks +J stages 1 through 18 in order, type-local six-role bindings and 400 actual +main fields/1,061 helper fields at each contact. + +For the actual 3,095-event caller, the results are: + +| Bound | Strict bound | +|---|---:| +| Caller-only mass | 2^121 | +| Caller-only all-cut defect coefficient | 2^342 | +| Largest J entrance mass | 2^119 | +| Largest J entrance defect coefficient | 2^340 | +| **M_ctx**, including native interior products | **2^355** | +| **Sigma_ctx**, including native interior products | **2^576** | +| **Gamma_ctx**, all returned public fields | **2^337** | + +The worst J entrance is stage 18, caller event 2958. The caller-only peak is +role 38 at event 3049; the final defect maximum is role 75. Full exact +fractions, cuts and separate caller-adjoint identities are in the receipt. +The reverse J rule adds `sum(lambda_r)*Gamma_W` and transposes the six-role +positive endpoint matrix. It independently reproduces the caller peak, +entrance and final coefficients, separating J residuals from primitive +residuals. No old 67,079-event or previous-caller constant is reused. + +Thus this concrete expanded raw context has the all-input contract + + output defect <= Gamma_ctx epsilon; + every certified source cut <= M_ctx B + Sigma_ctx epsilon. + +The statement is uniform for all positive columns under section 2's operator +and completion premises. It is not a physical tape execution of the caller. + +## 5. Retained recursive precision guard, explicitly conditional + +This section proves a replacement-constant implication for the structural +organization S1--S5 of the pinned rounded note. It does **not** independently +establish those compiler, whole-job, ownership or normalization premises. +In particular retain the following: at most K_star unfinished raw contexts +per ordinary level; at most ell ordinary levels; at most K_star/v flow +classes; at most m(H+1) two-job frames; complete sequential splitting and +completion on disjoint axes with norm-one suffixes; a rank-e sequential base +with e=1, using `ell<=D/N`. + +The inherited split/completion sizes have `R<=153^v`, `J=11^v`, `L=12^v`. +Exactly, + + (R/J+1)(L/J+2) < 2^(6v). + +For example `(153/11)^v+1<2*16^v` and +`(12/11)^v+2<3*2^v`, and `6*32^v<64^v` for v>=3. The verifier also checks +the integer inequality without logarithms. Since Gamma_ctx<2^337, the +per-context equivalent gain after this charge has logarithm less than 343. +The positive noncontext overhead + + m(H+1)+H+log2(m) <= K_star + +follows from the checked stronger bound with `log2(m)<8v`. Since +`log2(M_ctx+1)<356`, the retained path accounting yields + + X(D) = 2 log2(D+3) + 344 t, + L(D) = 1 + 357 t, + E_root <= 2^((D-1)/2 - F + X(D)), + admitted input radius <= B_root * 2^L(D). + +These are convenient strict upper envelopes, not optimal constants. + +**Admission is not circular.** Keep raw contexts as individual nodes in +the defect tree; do not collapse their all-cut coefficients into a silently +larger unreported Sigma. A split/completion node has unitary prefixes and +at most `m+2` sequential child residuals. A frame has two; a base has fewer +than m; a remainder fewer than N. The wrapper, if grouped, has at most D+3. +Therefore for D>=N a valid coarse bound is + + max Sigma_node <= N (D+3). + +This deliberately retains the wrapper's D dependence. A wrapper cannot in +general be bounded by N merely because the local remainder is below N. +For every node the chronological argument is: if earlier child contracts +held, its local error term is at most `Sigma_node E_root`; if this is at +most 1<=B_root, the next child lies in the advertised enlarged radius. +Its total contract applies, allowing the induction to continue. + +Take g=0 for D>=19 and g=5 for 1<=D<19, and set + + F=p+D+g, J=h+D+2, W=F+J+1=p+h+2D+3+g. + +For D>=N, `344t=16, its left side is less +than `4k+7<=2^(k-3)<=D/8`; the elementary integer induction is recorded. +Hence + + X(D)+H+log2(D+3) < D/4 <= (D-1)/2. + +It follows that `E_root*N*(D+3)<=2^(-p-1)<=1`, closing the admission guard, +and in particular `E_root<=2^(-p-1)`. The radius exponent satisfies + + h+(D+1)/2+L(D) < h+D+2 = J, + +so every certified signed component lies strictly inside the W-bit range +on grid 2^-F. + +If ell=0, the retained structure has no raw contexts or upper ordinary +frames; only the sequential base/wrapper estimate remains. The guard is +equivalent to + + (D+3)^4 <= 2^(D+2g-1). + +The verifier checks D=1,...,19 exactly. It continues for D>=19 because +`((D+4)/(D+3))^4<2` there and decreases. The control g=4 at D=3 fails. +Moreover `(D+3)/2<=2^((D+1)/2)`, so the direct sequential stored bound is +at most `2 B_root`, again strictly inside 2^J. This concludes the conditional +common-grid, error and signed-admission implication for all D>=1. + +The output error is a complex-modulus bound because the fibre norm bounds +each coordinate modulus. It does not preserve a strict unit-disk boundary: +the outer shrink/quantizer and analytic recovery changes discussed in the +rounded note still need their own full source and cost admission. + +## 6. Integer temporaries and complete cost boundary + +The actual native source has maximum numerator 14,729,531, at event 252, +and maximum denominator 393,216, at event 2798. It has 864 coefficients +whose numerators exceed 40,864. Thus the old rounded note's 16-bit numerator +premise is false for this source. The new safe bound is + + abs(a)<2^24, b<2^19, temporary signed width W+26. + +Indeed a signed W-bit input has absolute value at most 2^(W-1), so +`abs(a*m)<2^(W+23)`. The rounding offset is below 2^18. Even forming an +ADD numerator `b*target+a*source+floor(b/2)` has absolute value below +`2^(W+25)`, the signed magnitude limit of W+26 bits, with room for sign +extension/carry. Lambda's denominator-two numerator uses fewer such bits. +An output width check is justified by section 5's source-cut bound, not by +merely enlarging its temporary. Variable power-of-two normalization divisors +can be implemented by a bit drop and carry, but their actual service and +schedule remain inherited contracts. + +This width calculation is not a construction of total RDiv on the retained +machine. The existing exact table has different rejection semantics. +The rounded note outlines multiply/offset, a most-significant-first signed +division pass and possible reversals; a literal table must still account +for all those passes, head resets, full source and target access, staging, +restoration, owned allocation/return and erasure of initially dirty and +historically longer backing. Old parked ancestors and simultaneous children +remain live. None of them is removed by a source norm proof. + +An optimistic positive tariff screen is nevertheless useful. Starting from +the published QUERY-only conditional total 826,265,904, keep its 2,734,992 +exact 1125-conversion charge conservatively even though the unscaled rounded +mode does not use it. Declare the additional arithmetic model + + per noninteger a/b: + 4 (bit_length(b)+1) [1 + 3*1_(oddpart(b)>1)]. + +This prices one offset scan at every noninteger scalar and three extra +scans at an odd divisor, in the prior raw tariff's scan unit. It is a +declared model, not a measured physical guarantee. Use it also for outer +caller scalars and once for each denominator-two Lambda offset. The exact +current census is: + +| Positive item | Charge in this declared model | +|---|---:| +| Native surcharge per call | 941,128 | +| All 18 native calls | 16,940,304 | +| Outer scalar offsets at all actual ports | 51,520 | +| Outer Lambda offsets at all actual ports | 173,760 | +| Total extra | 17,165,584 | +| Baseline plus extra | 843,431,488 | +| Remaining below inherited 10^9 cap | 156,568,512 | + +There is no omitted field-replication factor in this **model census**. QUERY +and IDLE completed-child charges are already in the baseline, and the +18 native words, 416 outer QUERY lifetimes, 54 local owned lifetimes per +call and peak 43 local owned banks remain. Their complete positive costs +must remain in an actual implementation invoice. A finite table/code +construction, authenticated source decoding and any denominator setup are +additional fixed-template work, with positive finite constants; they are +not charged as zero by this package. The complete physical runtime has the +form of those fixed setup costs plus the actual full scans and historical +backing terms, each on width W+26. We do not have their certified coefficient +and therefore do **not** infer the cap, recurrence or a new kappa for the +rounded implementation from this optimistic table. + +## 7. An actual source cut where the exact service cannot implement the contract + +The five consecutive zero-based native events are authenticated literally: + + 37476 MOVE 697 1042 -> 591 public + 37477 MOVE 1334 1042 -> 1046 public + 37478 MOVE 901 565 -> 591 public + 37479 SCALE 1334 1/2 frame1046 + 37480 SCALE 697 -2/3 frame591 + +Start all arbitrary public inputs at zero and every earlier primitive +residual at zero. The ideal execution is zero. At the completed MOVE37476, +allow the child to return one quantum Delta in one real component of field +697; all other components and all subsequent child residuals are zero. +This is an allowed format output under a total child contract with +epsilon>=Delta and adequate radius. Such a contract is allowed by the +eta_X model for X>=1. The three intervening events do not access field697. + +At SCALE37480 its numerator is 1. The exact result would have numerator +`-2/3`, which is not an integer. Therefore **for every common grid precision +F**, the retained checked exact SCALE rejects this permitted input. Making +Delta smaller reduces the absolute defect but never removes the +divisibility obstruction. This is a countermodel to an implication from +the abstract rounded-child contract to exact-service admission. It is +**not evidence that a retained MOVE implementation actually produces this +one-quantum defect**. + +The total RDiv alternative returns numerator -1, whose residual is -1/3 +quantum; that is within its half-quantum contract. An exact child, by +contrast, returns zero here and the checked exact scalar succeeds. Thus +the countermodel does not refute the ideal exact-grid theorem or the +S=1125 prefix proof; it locates the extra interface premise needed to move +between exact and rounded modes. + +`boundary.py` compiles the frozen generic `SCALE(-2/3)` finite table and +executes it through the unchanged lifecycle `execute_table`. On widths +3 through 9 it checks zero, ±3, 1, and a late-component `(3,1)` failure: +35 cases, 21 accepts and 14 rejects, with a separate integer +divisibility/range oracle. Rejections leave every public component +unchanged; success restores all heads and erases initially dirty private +work. Rejected work/head positions may be dirty/unrestored: no rollback or +successful caller continuation is claimed. This bounded physical check +tests the existing generic kernel's semantics, not all current native +MOVEs or an installed #6936 occurrence-token binder. + +## 8. Verification, limits and next obligations + +Run `python3 -I -B research/query-only-precision-envelope/verify.py --suite all`. +Expected output is four `PASS_QUERY_ONLY_PRECISION_*` lines followed by +`AUTHENTICATED_SOURCE_FILES 11`. Registered normal and `-O` suites compare +all deterministic receipts. Source guards reject wrong MOVE source/owner, +a dependent frame basis, a public CLEAR, a changed J order and QSELF +reintroduction. Exact norm controls reject coordinate-sup contraction, +the false projector Lambda and omission of the Q^4 premise. A unitary Q +of `(3+4i)/5` gives Lambda squared norm 49/25, so unitarity of Q alone +does not justify the Lambda step. RDiv tie and residual-erasure controls +test other critical distinctions. + +The independent methods here are induction plus exact positive source +propagation, reverse covector checks, exact integer guard inequalities and +a direct integer oracle against an unchanged physical scalar executor. +All were prepared with AI assistance. They are not independent human review +or kernel-checked proofs. A separately supplied lead review, when present, +is recorded with its actual scope and file hashes in `REVIEW.md`. + +Open next questions: + +* Construct and install a total signed RDiv service with the actual source + token/header binding, W+26 temporaries, full lifecycle and historical + backing costs. Checked exact division is not that service. +* Bind all complete-fibre norm/error contracts, including Lambda's chosen + one-rounding semantics and native absolute phases, to literal all-column + providers. A phase error can escape every norm check here. +* Independently discharge the retained compiler S1--S5 and ownership + interfaces, or replace them with verified source-to-physical composition. +* Complete the actual physical tariff and outer shrink/analytic recovery + changes before using a rounded implementation in a complete bound. + +This package closes a source-specific numerical-envelope calculation and +reduces the precision seam to explicit total-service and inherited compiler +premises. It does not claim those premises are established. diff --git a/research/literal-tariff-conversion-audit/reference/QUERY-PROOF.md b/research/literal-tariff-conversion-audit/reference/QUERY-PROOF.md new file mode 100644 index 0000000000..2f8610ae45 --- /dev/null +++ b/research/literal-tariff-conversion-audit/reference/QUERY-PROOF.md @@ -0,0 +1,287 @@ +# Removing both separated QSELF sites within the existing paid budget + +Prepared for **@CubeJerry**, with substantial OpenAI assistance. Apache-2.0. +**No new kappa. Exact formal caller identity; physical and rounded interfaces remain conditional.** + +## 1. Exact claim, sources and novelty + +Canonical base: `7c49fe32c55de02c2c873655c804b16e4c3fef0a`. +The source is DreamingOfClouds' [#6937](https://github.com/CrocSwap/integer-mult-bounds/pull/6937), +head `a98df73ddae1d1ea85a62b6bdf2714b28cb7b359`, +`research/p104-two-chain-findings/data/caller_efree.json` (Git blob +`5a71ca9f80ced1aeb8a68e97516cab52eb72a52a`). The unchanged local native word +is from [#6936](https://github.com/CrocSwap/integer-mult-bounds/pull/6936), +head `03626137d0bd57f09b0bf9597376183ce6fa9683`. + +The E-free root and caller are entirely DreamingOfClouds' work. Its README +reports a QUERY-only gadget with a projected cost loss, while saying the +whole QUERY-only caller was not built. The preceding public package +`CubeJerry/integer-mult-bounds@4e2fd1b6abed49c202a057fd5c73ead0a460f976`, +`research/p104-qself-owned-lowering`, supplies the reproducible formal caller +certificate and an owned QSELF expansion with an explicitly uninstalled new +token registry. Its single-QSELF determinant obstruction expressly leaves +paired source synthesis open. This package supplies a different result: a +whole actual separated interval replacement with the same paid profile and +only existing caller operations. It does not rerun or extend that obstruction. + +**Theorem.** Let Q,D_1,...,D_18 be commuting operators on any complex vector +space V, with Q^4=I. Interpret the exact pinned caller with its stated scalar, +QUERY, LAMBDA, IDLE_ONE and joint-contact semantics. Replace zero-based events +457 through 575 inclusive by the 223 events emitted by `replacement.py`. +The resulting 3,095-event caller has exactly the same operator on all 76 +independent inputs. It has no QSELF event. The replaced interval uses exactly +three QUERY(-1) events, the same number of rank-one jobs as its former two +QSELF(-1) events and one QUERY(-1). It uses the same public roles and no new +owned role, arbitrary helper, productive credit, or operation type. + +This theorem includes all input columns and absolute coefficients in the +commutative operator model. It does not assert success on the same finite +signed or rounded inputs, install a physical compiler/service binding, or +prove the retained scalar and routing rates. Those are separate obligations. + +## 2. A three-query identity on four arbitrary fields + +Work first in R=Q(i)[q]/(q^4-1). Put x=q^-1 and t=x^2=q^2, so t^2=1 and +x^-1=t*x. The source's actual phase units are + + lambda_s = ((1+s*i)+(1-s*i)*q^2)/2, s in {+1,-1}. + +They satisfy lambda_+*lambda_-=1 and lambda_+^2=lambda_-^2=t. They are +**units, not the projection (1+q^2)/2**. No inverse of a projection or of any +D variable is used anywhere below. + +For four arbitrary independent fields (a,b,c,d), perform the invertible +q-even preprocessing + + (w1,w2,w3,w4) = (c, a+d, b+t*c, t*d). + +Then perform exactly three generalized query shears in this order: + + w1 <- w1 + x*w2; + w2 <- w2 + x*(w3-t*w1); + w3 <- w3 + x*(w4-t*w2). + +Each query is one literal QUERY(-1). Its indicated source is made by an even +ADD into the other existing public field, then restored after the query. +The query destination differs from that source, so restoring the source +does not undo the update. Multiplication by t uses two source LAMBDA(+1) +events. A temporary t scaling is undone by two LAMBDA(-1) events. These +scans and field transformations are charged; they are not a free oracle. + +After these three steps direct substitution gives + + w1 = c+x*(a+d), + w2 = x*b, + w3 = t*c+t*x*d, + w4 = t*d. + +The even postprocessing + + (w1-t*w3, w2, t*w3, t*w4) + +therefore returns exactly + + (x*a, x*b, c+x*d, d). + +The gadget is a genuine four-input map. In particular d is arbitrary and +restored, and c is arbitrary and receives the prescribed shear. No field is +assumed zero. The emitted word uses 38 existing events: three QUERYs, +26 LAMBDAs, seven ADDs and two SWAPs. The inverse even basis exists over the +entire quotient ring, including q=+/-i. The exact local matrix certificate +checks every coefficient, and a separate unit-basis round trip detects loss +of either q^2 sector. + +## 3. Why that gadget replaces the actual separated sites + +Use column-vector convention: later operations multiply on the left. Let +S_0 multiply role0 by x, S_19 multiply role19 by x, and let +U=I+x*e0*e1^T be the actual QUERY at event495. Partition the intervening +even source events exactly as follows: + +| Block | Zero-based source events | Roles | Content | +| --- | --- | --- | --- | +| E1 | 458..494 | 0..18 | Invertible ADD/SCALE/LAMBDA prefix | +| E2 | 496..544 | 0..18 | Invertible ADD/SCALE/SWAP/LAMBDA suffix | +| B | 545..574 | 19..37 | Other chain prefix, including IDLE_ONE(28,[9]) | + +The original complete interval is the matrix S_19 B E2 U E1 S_0. +Every operation in B has support disjoint from every first-chain operation. +Thus B may move to the right of all first-chain factors, and S_19 may move +leftward across first-chain factors. We obtain + + E2 E1 (E1^-1 U E1) S_0 S_19 B. + +**B is never inverted.** Its IDLE_ONE multiplies by the unrestricted formal +D9 and may be noninvertible. It moves only across disjoint role supports. +E1 alone is conjugated, and its scalar factors are units. + +Let + + s = e1+...+e18, + w = sum_{k=1}^{18} (-1)^k e_k^T, + lambda = lambda_+. + +Then w*s=0 and w*e0=w*e19=0. Reading the actual E1 events gives + + E1^-1 e0 = lambda*(-e0+s), e1^T E1 = w. + +For example, E1 sends role0 to -lambda_- times its old value, sends each +rolek for 2<=k<=18 to old rolek+old role0, and sends role1 to w applied to +the old roles. Solving E1 v=e0 gives the displayed inverse column; this does +not infer a source relation from a finite input probe. Hence + + E1^-1 U E1 = I + x*lambda*(s-e0)*w. + +Writing S=S_0 S_19, the three paid source operations reduce to + + (E1^-1 U E1) S + = S (I+x*lambda*s*w) (I-lambda*e0*w). + +All cross terms vanish because w kills s,e0,e19. This is the source-specific +correction missed by treating the two QSELF sites as an adjacent pair. +The original QUERY contributes the nontrivial independent shear along s. + +Now change the first-chain coordinates using only existing even events. +Subtract role1 from each role2..18. Into role2 add (-1)^k times rolek for +k=3..18, then apply LAMBDA(+1) to role2. The new coordinates include + + c = old role1, + d = lambda*w(old roles). + +The other residual roles retain all remaining independent input information. +The inverse first applies LAMBDA(-1) to role2, undoes its signed sum, and +adds the new role1 into roles2..18. Increasing c in these coordinates +increases every original role1..18 by the same amount: its direction is s. + +Call this invertible coordinate map P^-1. Its two emitted directions each +cost 34 events. In coordinates (a,b,c,d)=(role0,role19,role1,role2), the +factor I-lambda*e0*w is simply ADD(0,2,-1). The factor +S(I+x*lambda*s*w) is exactly the four-field map in section2. + +The complete replacement is therefore, chronologically: + + B; P^-1; ADD(0,2,-1); THREE_QUERIES; P; E1; E2. + +Its event count is 30+34+1+38+34+37+49=223. All source events before457 and +after575 remain byte-for-byte equal as parsed records. This construction +replaces the whole separated interval, not merely a same-cut subexpression. + +## 4. Formal certificates and failure detection + +`interval_certificate.py` is a separate exact sparse-matrix implementation. +It starts with 38 independent interval input generators. Coefficients are +Gaussian rationals, q exponents are reduced only modulo4, and D monomials +are sorted tuples with repetitions retained. The complete two interval +matrices agree in all 180 nonzero endpoint entries. The interval uses D9, +but never specializes it or assumes its inverse or idempotence. + +The full generated caller is also replayed by the unchanged public forward +certificate over Q(i)[q,D1,...,D18]/(q^4-1). All 18 D variables remain +formal and all 76 input generators remain independent. It returns the same +76 diagonal monomials as the source. A different unchanged backward-covector +checker uses integer dyadics at q=1,i,-1,-i, with D variables still formal. +Evaluation at all four distinct fourth roots is injective coefficientwise +on this quotient, so these checks are faithful operator certificates, not +sampled D or sampled field-value experiments. + +The newly supplied interval arithmetic imports none of those predecessor +arithmetic routines. The reused forward and backward engines are credited; +replaying either alone would be regression evidence, not a new independent +implementation. The proof above derives the identity without their code. + +Controls change a query orientation, delete one query, omit the source +conjugation correction, break a t scaling/restoration, repeat D9, contaminate +another independent input, replace lambda with a projection, and remove the +q^4 relation by working modulo q^8-1. Each changes the exact interval matrix. +These controls do not prove minimality of three queries or a general lower +bound for another word. + +Induction over the exact source semantics proves that each matrix entry is +the indicated formal coefficient. A homomorphism into the commuting operator +algebra generated by Q,D maps the identity to every V and every collection +of input fields. No dimension bound, sampled numerical values, or rounded +input assumptions enter that exact theorem. + +## 5. Complete recursive profile and positive ordinary invoice + +Each A event occurs at 96 actual ports. The replacement deletes 192 QSELF +instances, adds 192 QUERY instances, and leaves the former QUERY instances +in the total paid count. Across the full caller, the source has 224 QUERYs +plus 192 QSELFs; the new caller has 416 QUERYs and zero QSELFs. All queries +here have exponent -1, so both complete frame conversions and the return +translation have the same inherited charge per job. + +The 18 local native words, their 400 actual main fields per call, and their +1,061 fresh arbitrary helper fields per call are unchanged. The caller still +has 3,952 actual A/B main inputs and 19,098 fresh local helpers. The root +targets are unchanged, with no empty-mask E input restored or credited. +For every rank r, T_new(r)=T_source(r) and P_new(r)=P_source(r). Thus every +signed target/paid moment agrees identically as a function of kappa. The +complete totals remain T=23,050, P=117,846; surplus=1,520; paid rank mass=317,324. + +No public role is newly allocated. The temporary linear sources in section2 +use already live roles and are restored by ordinary invertible operations. +The existing QUERY contract still needs its copied owned bank and completed +query lifecycle. Three serial query jobs can reuse its fixed inventory; there +are 416 outer query lifetimes overall, the same total as QUERY plus owned +QSELF lifetimes in the baseline. No uninitialized or arbitrary helper is +treated as zero, and no productive target is claimed for query scratch. +All private native workspace, historical backing and parked ancestors remain +charged by the inherited QUERY/LAMBDA/scalar interfaces. + +Under the **inherited scalar/routing convention**, the extra 104 A events +cost 104*32*38*96=12,140,544 units. The extra 28 A LAMBDAs receive the +separate conservative charge 28*1,000*96=2,688,000. The eliminated owned +QSELF-specific macro surcharge is 192*128=24,576. Every other term remains. + +| Complete conditional invoice | QSELF baseline | QUERY-only caller | +| --- | ---: | ---: | +| Reviewed raw ordinary upper | 796,934,944 | 809,050,912 | +| Separate LAMBDA reading | 11,792,000 | 14,480,000 | +| Per-call 1125 conversion reading | 2,734,992 | 2,734,992 | +| All displayed readings included | 811,461,936 | 826,265,904 | +| Margin below inherited 10^9 cap | 188,538,064 | 173,734,096 | + +`complete_invoice.py` reconstructs the unchanged local word and both caller +profiles and checks each changed term. These are conditional scalar/pass +counts, not a new proof of the complete bit-tape tariff. Increased arithmetic +length, temporary coefficients and cross-chain intermediate values require +fresh rounding, signed-width, common-grid and source-placement bounds. There +is no claimed improvement to the accepted kappa or unconditional theorem. + +## 6. Remaining obligations and credit + +The substitution removes the need for a new abstract QSELF operation in this +exact proposed caller. It does not prove arbitrary-Q synthesis: the gadget +and actual source phase algebra use Q^4=I. It neither changes the selected +certificate nor discharges all native_all_columns, owned_erasure, compiler, +precision_tape or analytic_recovery premises. + +Before physical supplier use, regenerate the actual compiler records and +bind the new source occurrences to the existing QUERY, LAMBDA and scalar +providers; prove matching formats and all intermediate signed admission; +reprice complete bit-tape work and historical backing; and propagate errors +through the changed order and additional even operations. Existing opcode +semantics alone do not install an exact source-specific service registry. + +DreamingOfClouds receives credit for #6936/#6937, the E-free construction and +prior QUERY-only feasibility suggestion. The public owned-lowering package +receives credit for the prior formal engines, exact semantics/source pins and +full invoice baseline. Its underlying native, caller, compiler and physical +predecessors retain their attribution. The three-query four-input identity, +its exact separated-source reduction, emitted whole caller and new interval +certificate were prepared for @CubeJerry with substantial OpenAI assistance. + +## Open next questions + +1. Can the regenerated caller satisfy the actual common-format and rounded + QUERY/LAMBDA contracts at this interval? Start with its 223 new intermediate + coefficient rows and the actual source compiler; exact operator equality + does not establish headroom or an error budget. +2. Can the 28 added LAMBDA occurrences be reduced without increasing the paid + profile or changing arbitrary-input restoration? Preserve this complete + verified source as the baseline; an isolated two-register identity is + insufficient. This optimization is outside the present bounded task. +3. Can the resulting existing-op caller be admitted with all native/owned + dependencies and a complete bit-tape certificate? The inherited tariff, + literal source registry and universal proof assumptions remain blockers. diff --git a/research/literal-tariff-conversion-audit/reference/ROUNDED-DIVISION-6937.md b/research/literal-tariff-conversion-audit/reference/ROUNDED-DIVISION-6937.md new file mode 100644 index 0000000000..ed609f6a0e --- /dev/null +++ b/research/literal-tariff-conversion-audit/reference/ROUNDED-DIVISION-6937.md @@ -0,0 +1,396 @@ +# Rounded division for a native word: a defect theorem (second version) + +Tags. **[P]** proved or computed here. **[Q]** read in the named source. **[judgement]** judgement. Sections 1 to 7 are written to go into a package note as they stand. Readers so far: the author, one second reading, one numerical run. All are AI sessions of ours. No maintainer has seen this. + +**Result.** Rounded division fits. With no checks and no odd root scale, the word's output differs from its exact action by at most an explicit defect, on any child that meets a norm contract, including nonlinear children. Through the whole recursion the defect stays inside the guard budget of #6901: `F = p+D`, `W = p+h+2D+3` for `D >= 19`, 5 more bits below that. Temporaries are `W+18`. Exactness becomes approximation, so the outer Proposition needs one extra scan and new constants (section 6). Everything from the Lemma of `06-transforms.tex` onward then fits with no change to `p` or any parameter. `kappa`, `T`, `P`, `S` do not move. Rounded mode does need the caller rewrite of #6912 if the conservative raw reading is kept (section 7). + +**Conditional on:** the compiler structure statements S1 to S5, quoted from #6901, FINITE-PRECOMPILATION and p7-TENSOR and not re-derived; the all-`f` native equalities on the per-port word, as for the exact theorem. + +## 1. Definitions + +**Format.** `u = 2^-F`. A stored component is `u` times a signed integer. Format `(F,J)` means every stored component has absolute value below `2^J`. + +**Rounded division.** For an integer numerator `m` and a scalar `a/b` in lowest terms with `b > 0`, + + RDiv_{a/b}(m) = floor( (a*m + floor(b/2)) / b ), + +applied separately to real and imaginary components. For a C pair it is applied to the complete four-term numerators, never to separate summands. Integer `q` needs no division and stays exact. + +**Two fibre norms.** Let `D = q + R` be the selected axes of #6901: `q` individually preprocessed, `R` kept as the one reference factor of all later pieces. For a field `y`, an `X`-fibre (`X` = `D` or `R`) is the set of `2^X` coordinates with every label other than those `X` selected bits fixed (external row, spectators, polynomial index). Then + + ||y||_X = max over X-fibres of ( sum over the fibre of |y_i|^2 )^(1/2). + +An `R`-fibre lies inside a `D`-fibre, so `||y||_R <= ||y||_D`. The site unit is `eta_X = 2^((X-1)/2) * u`, and `eta_R <= eta_D`. When `q = 0` the two coincide. Unmarked `||.||` below means `||.||_R`, the recursion's norm. + +**Word.** Registers carry a field and a chart. Events are: +- MOVE `a -> b` on register `s`: exact operator `D_b D_a^-1`, realized by a child; +- ADD or COPY `t += q s`, with `s` and `t` in a common chart (COPY is an ADD into an owned zero); +- SCALE `t *= q`; +- INIT and CLEAR, which set an owned register to exact zero. + +`R_{r,k}` is the exact row matrix: the ideal output of public row `r` is `T_r x = sum_k R_{r,k} D_{final(r)} D_{init(k)}^-1 x_k`. + +**Suffix coefficients.** `rho^(j)_{r,s}` is the coefficient of register `s`, taken just after event `j`, in final public row `r`, computed by running the scalar word backward from the identity on public rows and zero on owned rows. A CLEAR or INIT zeroes that register's column. + +**Sites.** A site is a MOVE, or an ADD, COPY or SCALE with non-integer `q`. Its register `s_j` is the one it changes. Gains: + + Gamma_W = max_r sum_{sites j} |rho^(j)_{r,s_j}| + M_W = largest l1 mass of a stored row or pre-ADD product, over all prefixes + Sigma_W = largest, over all cuts c and registers x, of sum_{sites j<=c} |segment coefficient of site j in x at c| + +**Child contract `C(eps,B)`.** For every input in format with `||x|| <= B`, the child returns `y` in format with `||y - T x|| <= eps`. No linearity is assumed. Inputs need not be reachable or lie on any coarser grid. + +## 2. Statements + +**Lemma 1 (RDiv) [P].** +- (a) `RDiv` is total: it has no check and no reject. +- (b) `|RDiv_{a/b}(m) - a*m/b| <= 1/2`, and ties go up. So it is the host rule `Q_F(q x)` with upward ties of #6900 and #6891. It is not odd: `RDiv(-m) != -RDiv(m)` at a tie. +- (c) If `b` divides `a*m`, it is the exact quotient. +- (d) Write `b = 2^x * o`, `o` odd. Then `RDiv` is: a least-significant-first pass for `n = a*m + floor(b/2)`; if `o > 1`, one most-significant-first two's-complement long division by `o`, remainder in `[0,o)`, starting at `o-1` for a negative value and `0` otherwise; then `x` low bits dropped. If `o = 1` it is one least-significant-first pass with a carry, and needs no second pass. This holds also for non-constant `b = 2^k`, with the offset placed by a work-tape copy. +- (e) It uses no random bits. +- (f) Its complex residual on one fibre has norm at most `eta_X` for that fibre size. + +**Theorem A (one word) [P].** Suppose every frame is unitary on every `R`-fibre and every ADD has a common chart. Run the word on any input, with any realized site residuals `n_j` (a child's residual against the exact operator applied to its actual input, or a division's rounding residual). Then for every public row `r`, + + ||yhat_r - T_r x|| <= sum_{sites j} |rho^(j)_{r,s_j}| * ||n_j|| <= Gamma_W * max_j ||n_j||. + +Also, at every cut and register `c`, the stored field satisfies `||z_c|| <= M_W * max_k||x_k|| + Sigma_W * max_j||n_j||`. + +**Theorem B (defect tree) [P].** Let a computation be a finite tree whose nodes carry a gain `Gamma_v >= 1` and a mass bound `M_v >= 1` with these two properties. The node's output defect is at most `Gamma_v * max(child defects, eta)`. Every stored field is at most `M_v * B + Sigma_v * E` on input norm `B`. Put `E = eta * max_path prod Gamma_v` and suppose `E * max_v Sigma_v <= 1 <= B_root`. Then, with no circularity: +- every child input has norm at most `B_root * prod_{path}(M_v+1)`; +- the root defect is at most `E`. + +**Theorem C (recursion) [P, given S1 to S5].** Under the structure statements below, let `t = K_star * ell`, `ell = floor(log_N D)`, `N = 2^H`, and + + X(D) = 2*log2(D+3) + ell * K_star * (log2 G + 1), G = the per-context gain of section 5, + L(D) = 1 + ell * K_star * (log2 (M_ctx+1) + 1). + +Replace every division by `RDiv`. Then the root output has `||out - T x||_R <= 2^(X(D) + (D-1)/2 - F)`, and no component exceeds `2^(h + (D+1)/2 + L(D))`. + +**Corollary (the #6901 budget) [P, given S1 to S5 and the constants of section 5].** If `c * K_star < 2^H` with `c = 1100`, then for all `D >= 1` and `p, h >= 0`: + + F = p + D + g, J = h + D + 2, W = F + J + 1 = p + h + 2D + 3 + g, temporaries W + 18, + +with `g = 0` for `D >= 19` and `g = 5` below, suffices: execution never overflows, never rejects, and every output coefficient has complex modulus error at most `2^(-p-1)`. + +**Proposition (relation to the exact theorem) [P].** If children are exact, the word carries the odd root scale with a valid certificate, and the grid is fine enough, every `n_j = 0` by Lemma 1(c). Theorem A then reads as equality. So one circuit serves both modes only with the root-scale step added and that finer grid. Without them the rounded circuit is a different execution and no longer detects a truncated child. + +Structure statements, all **[Q]**, none re-derived here: +- **S1.** A path has at most `K_star = v*m*(H+1)^2` unfinished raw contexts per ordinary node and at most `ell` unfinished ordinary nodes (#6901 eq (4a), and its lines 191-193). Those contexts sit in at most `m*(H+1)^2` flow classes, each with at most `v` contexts. +- **S2.** A path has at most `m*(H+1)` nonbase compiler frames per ordinary node (#6901 lines 176-178). A frame is a complement followed by a flow on the same array (FINITE-PRECOMPILATION sec 4), so it has 2 sequential jobs. +- **S3.** A product runs each paid position of U as a complete run of V on the owners (p7-TENSOR sec 1). After the product, each role of rank `K < L = b^v` receives a completion on `L-K` disjoint axes (sec 2). Then every paid rank `R > J = c^v`, and every completion likewise, is replaced by consecutive jobs on disjoint axes of ranks `J,...,J,r`, kept inside the original whole-job normalizers (sec 3). Route adapters are monomial maps with unit quadratic phases and role permutations (FINITE-PRECOMPILATION sec 1 item 3), so they are exact on the grid and norm-preserving. Normalizers are a separate binding (FINITE sec 7; #6901 line 62, "monomial/positive-job"): see the weaker reading in section 9. +- **S3a.** Below the compiler's base range a rank `e` uses the ordinary sequential program, `P_e = e` (FINITE sec 4). It has no raw context (#6901 line 151), but it is `e` sequential leaves. +- **S4.** Every operator composes to a Gaussian-dyadic Clifford on the same root factor, per external row, with origins moving only among complete fibres (#6901 sec 4, eq (5)). +- **S5.** An ordinary node `e = N f + r` is a rank-`N` program at column `f` plus `r < N` direct stages. The root wrapper adds at most `D+3` sequential kernels, pieces and normalization steps, all of gain at most 1 (#6901 lines 330-378). The `q` kernels run first and their selected bits are disjoint from all later ones (`05-layers.tex` lines 620-627). The base is at most `f` direct C stages. CLEAR and INIT give exact zero, the inherited premise. + +## 3. Proofs + +**Lemma 1.** Write `a m = b Q + rho'` with `0 <= rho' < b`. Then `floor((a m + floor(b/2))/b) = Q + [rho' + floor(b/2) >= b]`. For odd `b` this rounds up exactly when `rho' > b/2`, and no tie exists. For even `b` it rounds up exactly when `rho' >= b/2`. That gives (b) and (c). For (d), multiplication by a constant plus a constant is a carry automaton. Nested floors give `floor(n/b) = floor(floor(n/o)/2^x)`, long division by `o` needs only the remainder as state, and a two's-complement prefix of all ones is the value `-1`, whose floor quotient is `-1` with remainder `o-1`. For (f), each component errs by at most `u/2`, so a complex coordinate errs by at most `u/sqrt2`, and a fibre has `2^X` coordinates: `2^(X/2) * u/sqrt2 = eta_X`. (e) is plain. An exhaustive small-width run of the automaton agrees (section 8). + +**Theorem A.** Let `A_j` be the exact linear map of event `j` on the whole register state, and let `z_j` be the actual state. By definition of the residual, + + z_j = A_j z_(j-1) + n_j, so z_M = A_M...A_1 z_0 + sum_j A_M...A_(j+1) n_j. (1) + +This is an identity about realized values. It holds for nonlinear children and rounders, because each residual is measured on the actual input of its site. No two rounded trajectories are compared, so no Lipschitz claim is used. This is the recurrence of #6891 PROOF sec 3. + +By the common-frame identity of `03-motifs.tex` (lines 168-177), the suffix `A_M...A_(j+1)` started from an arbitrary state in the charts at cut `j` equals `D_out * S_suffix * D_cut^-1`, where `S_suffix` is the scalar suffix and acts pointwise. Its `(r,s)` block is therefore + + rho^(j)_{r,s} * D_final(r) * D_{v_j(s)}^-1. + +Both frames are unitary on root fibres (S4), and the operator preserves the fibre decomposition. So the operator norm of that block in the fibre norm is exactly `|rho^(j)_{r,s}|`. Rounding residuals live in stored coordinates, and the transport is a unitary between stored coordinates, so no other basis enters. Taking norms in (1), with `n_j` supported on `s_j`, gives the first display. The same identity between two cuts, with the scalar segment in place of the suffix, gives the stored bound. INIT and CLEAR write exact zero, so a residual dies there, and that matches the zero column. COPY keeps the target's column, so an inherited residual in the target is not erased. Here that column is zero only because the INIT before it wrote exact zero. + +The theorem needs the `R`-fibre: a `D`-fibre spans several role fields after the split `u = bg + w`, and the register-wise suffix does not apply to it. + +**Theorem B.** Induct along execution order, not along the tree. Suppose every child called so far met its contract. Then every stored field so far obeys the mass bound with defect term at most `Sigma_v * E <= 1 <= B`, so it is at most `(M_v+1) B`. The next child's input is therefore admitted at `(M_v+1) B`, and its contract can be used. The defect bound follows by bottom-up induction: `eps_v <= Gamma_v max(eps_c, eta)`, and a leaf has `eps = eta`, since a rounding site is `eta` by Lemma 1(f). This is the admission argument of #6891 eq (5). + +**Theorem C.** Exact debt resets at a completed job. Defects do not. So sequential multiplicity must be counted as gain, separately from nesting. Assign nodes along a path as follows. +1. *Raw context.* One raw unit is a caller node over a word node. By Theorem A applied to each, with the `J` sites of the caller fed by the word, its gain is at most `g_J * Gamma_W + g_S + g_I` (section 5). +2. *Flow class.* A `v`-fold product has `v` contexts, and by S3 its paid position is the run of the next factor, so gains multiply factor by factor. A path through the class also passes one split paid position, at most `R/J + 1` consecutive disjoint-axis jobs, each followed by a unitary suffix. The completion runs after the entire product, at most `L/J + 1` pieces with gain 1 each. So the class gain is at most `(g_ctx)^v (R/J+1) + (L/J+1)`. The split charge belongs to the class, not the context. Stored fields inside a split are unitary images plus accumulated defect, so `M` does not grow, and `Sigma` of this node is at most `R/J + 1` plus the context value. +3. *Compiler frame.* An array receives a complement job, then a source slot. By S3 the adapters contribute no residual. The suffix after each is a unitary job on that array, so `eps_frame <= eps_complement + eps_flow`, gain 2, `M+1 = 2`. +4. *Class unit.* A unit's paid round is the matching target output of the child class, or a completed exit batch. In both cases the contract applies to the field's actual value. Disjoint simultaneous copies add nothing, since the norm is a supremum over fields, and replication factors do not enter. A correlated owned center is one field with an actual value, and the contract covers it. +5. *Small-rank base.* By S3a, gain `e` and `Sigma <= e`, one per ordinary node on a path. With `e < m` this is `log2 m` bits. If the base range reached any rank below `N` it would be at most `H` bits, and the count below still holds. +6. *Ordinary node.* The remainder is at most `r < N` sequential sites of gain 1, so `H` bits, and `Sigma <= N`. +7. *Wrapper.* First the `q` preprocessed kernels, in `||.||_D` with unit `eta_D`: each is unitary on `D`-fibres, on the unsplit field. Then convert once by `||.||_R <= ||.||_D`. The order matters and is the safe direction, because the kernels come first (S5). All later pieces use Theorem A and B in `||.||_R`, with `eta_R <= eta_D`. Normalization shifts and phases contract. Padded rows end within `E` of zero and are then deleted, and nothing reads them after that. So the `F`, `J` and `E` budgets hold with `d = D`. + +By S1, S2 and items 2, 5, 6, the bits on one path per ordinary node are at most + + K_star * log2 g_ctx + (K_star/v) * log2((R/J+1)(L/J+2)) + m(H+1) + H + log2 m. + +Define `log2 G` as `log2 g_ctx + log2((R/J+1)(L/J+2))/v`. The last three terms are at most `K_star`. This gives `K_star (log2 G + 1)` per node. The base contributes at most `log2 D` and the wrapper at most `log2(D+3)`, which gives `X(D)`. Mass is the same count with `M_v`: frames, base, split and remainder nodes have `M+1 = 2`, one bit each, and the total is inside `L(D)`. Apply Theorem B. The hypothesis `E * Sigma <= 1` is checked in the corollary. + +**Corollary.** Take `log2 G <= 129`, `log2(M_ctx+1) <= 151` and `log2 max_v Sigma_v <= H` (section 5). + +*Case `ell >= 1`, so `D >= N`.* Since `k <= 2^(k-1) <= N^(k-1)`, `ell <= D/N` (#6901 lines 302-304). With `c = 1100`: +- `ell * K_star * 130 <= 130 D/1100 < D/8`, so `X(D) + H <= (D-1)/2`, since `2 log2(D+3) + H` is negligible at `D >= N = 2^H`. This gives `E <= 2^(-p-1-H)`, so `E * Sigma <= 1`. +- `ell * K_star * 152 + 1 <= 152 D/1100 + 1 <= floor(D/2)`, so `h + (D+1)/2 + L(D) < h + D + 2 = J`. + +*Case `ell = 0`.* There are no contexts, no splits and no ordinary node above the base. `X(D) = 2 log2(D+3)`, and `X(D) <= (D-1)/2 + g` with the stated `g`: the largest deficit is 4.17 bits at `D = 3`, and `g = 0` works from `D = 19` on. The stored field is at most `B + (D+3) E <= 2B`, because `(D+3)/2 <= 2^((D+1)/2) <= B_root`. + +In both cases `E <= 2^((D-1)/2 + X(D) - p - D - g) <= 2^(-p-1)`. Coordinate modulus is at most fibre norm, so the error bound holds as a complex modulus, not only per component. + +*Temporaries.* `|a| <= 40,864 < 2^16` on the word and at most 256 in the caller, with a carry and a sign. The offset `floor(b/2)` is at most 20,480 for `b <= 40,960`, which is below `2^(W+15)`, since `W >= 5`. So `W+18` suffices. The wrapper's normalization shift and the outer shrink of section 6 have non-constant `b = 2^k`, and they are bit drops with a carry and need no multiplier width. ∎ + +## 4. Why the fibre norm, not coordinate sup norms [P] + +The selected review (`pr6030-audit/PROOF-REVIEW.md:151-161`) uses sup-norm majorants. A rank-`r` Gaussian has row-norm bound at most `2^(rf)`, and every prefix, suffix and subinterval is controlled. The envelope is `2^(10^9 + 240152 f)`. That is a valid finite-precision proof, and it carries over with the alphabet line changed. But it charges paid rank mass `f` times: `240152 f` is about `1656 d` at `d = 145 f`. It cannot fit `F = p + d`. + +In the fibre norm, frames have norm exactly 1, so `f` leaves the gain entirely. The only `d` term is the one conversion from a component to a fibre, `eta`, paid once at the site. That is what lets the budget survive. Only the triangle inequality and unitarity are used: no independence or correlation assumption, and residuals may be adversarial. + +Clause map to that review text: + +| review line | here | +|---|---| +| dyadic coefficients and SCALE units | alphabet `A = Z[1/2,1/3,1/5]`, `\|q\|+1 < 2^16` kept | +| elementary majorants at least one | suffix coefficients from the word; sup majorants remain a valid weaker fallback | +| monomial routes norm one | unchanged | +| rank-`r` Gaussian row norm | replaced by fibre norm 1 | +| COPY propagates residual as ADD | unchanged, in Theorem A | +| INIT/CLEAR inherited premise | unchanged | +| summing defect propagation | Theorem A, with `Gamma_W` from the word | + +## 5. Constants on the actual word [P] + +Word: 67,079 events. Computed from the word and caller as data. Floats for all rows, with the worst row of each word rechecked in exact fractions. `Gamma_W` was recomputed by a second reader's own loop and a third run's own backward pass: `2^22.685`, worst row 1436 in all three. + +| quantity | word (#6932) | earlier stage word | dyadic parent | +|---|---|---|---| +| MOVE sites | 6,335 | 6,355 | 6,374 | +| non-integer sites | 22,730 | 22,723 | 19,007 | +| of which odd | 3,001 | 2,941 | 0 | +| `log2 Gamma_M` (MOVE sites) | 18.665 | 18.659 | 20.146 | +| `log2 Gamma_R` (rounding sites) | 22.678 | 22.705 | 22.498 | +| `log2 Gamma_odd` (odd sites only) | 16.785 | 16.721 | none | +| `log2 Gamma_W` (all sites) | **22.685** | 22.711 | 22.756 | +| `log2` root-sum-square, MOVE sites | 13.670 | 13.665 | 15.242 | +| `log2` root-sum-square, rounding sites | 20.612 | 20.613 | 18.415 | +| `log2` largest suffix row mass | 21.709 | 21.709 | 20.296 | + +Row 1436 is a helper. Mains reach only `2^12.95`, so `g_J Gamma_W` overstates the mains by about 10 bits. That is not an error, and it is not used. + +Other word constants: `log2 Sigma_W = 34.16`. `log2` of stored prefix mass is 29.172. Including pre-ADD products, `log2 M_W = 29.67` (**[Q]** package: 37.48 minus `log2 225 = 7.81`). + +The clause does not worsen this: the word's all-site gain is below the dyadic parent's. The odd sites alone are 1.7% of the worst gain, about 0.02 bits. + +Caller. No-cancellation majorants, rigorous by submultiplicativity with operator norm 1 for each `LAMBDA`, `IDLE_ONE`, `QUERY` phase and `D`, and real numbers likely well below these [judgement]. Only logarithms enter. Caller helpers are not among the 6 roles in `g_J`. They do not mix with mains, so their defect is at most `18 Gamma_W eps`, far below `G eps`. + +| quantity | log2 | +|---|---| +| prefix mass, including the SWAP transient | 120.341 | +| `g_J`, gain at the 18 contacts | 101.927 | +| `g_S`, rounding at non-integer caller scalars | 110.908 | +| `g_I`, `LAMBDA`, idle and query sites | 109.934 | +| `Sigma_C` | 116.337 | + +Per class and per context. `J = c^v = 11^1920`, `L = b^v = 12^1920`, `R <= 153^1920` (majorant by the carrier). + +| quantity | bits | +|---|---| +| `log2 g_ctx = log2(g_J Gamma_W + g_S + g_I)` | at most 124.62 per context | +| split `log2(R/J + 1)` | at most 7,293 per class | +| completion `log2(L/J + 2)` | at most 242 per class | +| per class, `v = 1920` | at most 246,805 | +| per context equivalent | 128.55, so **`log2 G <= 129`** | +| `(log2 G + 1)/c` at `c = 1100` | 0.1182, below 1/8, so **`c = 1100` stands** | +| `log2 (M_C+1)(M_W+1)` | at most 151; unchanged, since jobs inside a split are unitary | + +`Sigma` by node type: + +| node | `log2 Sigma` | +|---|---| +| word, caller | 34.16, 116.34 | +| split class | about 7,300 | +| small-rank sequential base | at most 13,935 | +| ordinary node remainder, `r < N` | at most `H` | + +So `log2 max_v Sigma_v <= H`. All are harmless at `D >= N`, the only place they occur. + +Against the exact mode, the rounded mode drops the root scale `S^K`, its root conversion, the `7.8 t` width, and the dependence on a dyadic endpoint. + +## 6. The outer layer in rounded mode [P] + +Theorem C gives `y` with `|y - Hz| <= E <= 2^(-p-1)` per coordinate. That breaks the outer Proposition as written (`05-layers.tex` from line 827; disk line 875 onward). Counterexample shape: `Hz = (a-t, b-t)` in the disk, `(a,b)` on the `p`-grid just outside, positive residual above `t`. `Q_p` then returns `(a,b)`, outside the disk, and the error `< sqrt2 2^-p` also fails. The recursive child has no disk contract, so only this outer call is affected (`05-layers.tex` lines 488-494, 690-692, 909-910). + +**Proposition R.** Under the hypotheses of that Proposition, including its bands, with `p >= 3` and `F = p + D + g` as in the corollary, let `y` be the rounded layer output on the `F`-grid and return + + y' = y - RDiv_{2^p}(y), then Q_p(y'). + +Then every returned coefficient lies in the complex unit disk, and + + || Q_p(y') - H z ||_inf < 3 * 2^-p. + +The time bound `O(V d^{lambda'})` and the widths are unchanged: one extra `O(V)` scan and no format change. + +*Proof.* Every row of `H` has absolute row sum one, so `|Hz| <= 1` and `|y| <= 1 + 2^(-p-1)`. By Lemma 1(f), `y' = (1 - 2^-p) y + e` with `|e| <= u/sqrt2`. So + + |y'| <= (1 - 2^-p)(1 + 2^(-p-1)) + u/sqrt2 = 1 - 2^(-p-1) - 2^(-2p-1) + u/sqrt2 < 1, + +since `u/sqrt2 < 2^(-p-1)` for `D + g >= 1`. `Q_p` truncates toward zero, so it does not increase modulus, and the disk holds exactly. For the error, in moduli, + + |Q_p(y') - y'| < sqrt2 * 2^-p + |y' - y| <= 2^-p (1 + 2^(-p-1)) + u/sqrt2 + |y - Hz| <= 2^(-p-1) + +and the sum is `2^-p (sqrt2 + 3/2 + 2^(-p-1) + 2^(-D-g)/sqrt2)`. The constant is 2.9142 in the limit, at most 2.988 at `p = 3`, `D + g = 6`, the worst allowed case, and above 3 at `p = 2`. The `p`-band is `p` large, so `p >= 3` costs nothing. ∎ + +**Lemma (`06-transforms.tex` line 222).** Error `sqrt2 l 2^-p` becomes **`3 l 2^-p`**. The disk output, the cost (eq `synthetic-transform-cost`) and the layout are unchanged. + +*Proof text (lines 405-420).* The identity `J_E Q_p = Q_p J_E` still holds, but "truncating once after the exact contraction round" no longer does, and `RDiv` is not odd, so `J_E` does not commute through `y'` at ties. Use instead the per-round recursion. A round maps `z_i` to `J_E Q_p(y'(z_i))`, and the exact round is a contraction, so `err_(i+1) <= err_i + 3 * 2^-p`. Prefix-slot rounds (lines 356-371) are direct, stay exact before `Q_p`, and add less than `sqrt2 2^-p`, so they are inside the same recursion. The opposite direction has the same form. + +**Convolution (`06-transforms.tex` lines 636-715).** With `delta = 3 l 2^-p` and `eta = sqrt2 2^-p` unchanged (the ring product is direct), the bound `sqrt2 M(3l+1) 2^-p` becomes **`M(9l + sqrt2) 2^-p`**. The proof is otherwise word for word: `2 delta + eta`, then `3 delta + eta`, then the factor `M`. The disk clause reads eq `synthetic-convolution-error`, so it adapts by itself. + +**Later margins: read, and no change to `p` [P on `08-assembly.tex`].** The layer Proposition is cited only in sections 05, 06, 08. The Lemma and the convolution are cited only in 06 and 08. Section 08 line 564 reads: `sqrt2 l 2^-p < L 2^-p`, `L = log2 T`, for all sufficiently large `n`. Every later figure uses only the right side: + +| figure (08-assembly) | depends on | +|---|---| +| transform errors and product truncation below `3L + 2` | `< L` per transform | +| `E_ring = M(3L+2) < 5TL` | above | +| `\|\|h'\|\| < .701`, `6TL`, `8TL` | above | +| `E_s = 9 * 2^gamma * TL`, `.51`, `.501` | above | +| cutoff `b >= 2^24` with all of these below `10^-3` | above | + +The replacement is `3 l 2^-p < L 2^-p`. Here `r = 2^ceil(L/d)` and `l = log2 r` (lines 71-72), so `L > d(l-1)`. For `d >= 6`, `l >= 3` this gives `3l <= d(l-1) < L`, and the bands make `d`, `l` tend to infinity (lines 83-91). So the same "sufficiently large `n`" covers it, and **`E_ring` and every later constant stand unchanged.** No extra bit of `p` is spent. Had the constants been carried through instead, the cost would be about 1.09 bits, so the point is minor either way. `kappa` reads none of it. + +**Lines to reword** (they say "exact"; none changes a bound beyond those above): `05-layers.tex` 42, 176-178, 492, 513, 627 ("padded zero row is again zero" becomes "within `E`, then deleted"), 690, 809, 909, 982; the Proposition's statement "returns `Q_p(Hz)`"; `06-transforms.tex` 222, 405-420, 639, 686, 715; `08-assembly.tex` 7-8, 11-12, 564. + +**In exact mode nothing here changes.** With the root scale and exact children, #6932's outer Proposition holds as written. + +## 7. The new clause and its cost + +**Replaces item 4 of #6932 sec 1, and the execution sentence of its sec 2.** + +> **Clause R (rounded scalars).** A native word may use ADD and COPY coefficients `q = a/b` in `A = Z[1/2,1/3,1/5]` with `|q| + 1 < 2^16`, and SCALE by units of `A`, with frames as before. Conditions (i) and (ii) of the odd clause and the declared `S` are not required. Its exact endpoint remains required over `Q`, with every public output row in `Z[1/2]`. Execution: `t += q s` writes `t + RDiv_{a/b}(s)`, and `t *= q` writes `RDiv_{a/b}(t)`, on the stored numerators, by Lemma 1(d), with no check and no reject state. A C pair is rounded on its complete numerators. Integer `q` is exact. Children meet the contract `C(eps,B)`. Output is the word's exact action within the defect of Theorem C, not equal to it. The outer layer returns `Q_p(y - RDiv_{2^p}(y))`. The clause covers complex native words only. A BIT ring has no rounding. + +`division_pass.py` and #6932's item 4 are least-significant-first with a check, so they are a different operation. `02-streams.tex` lines 198-208 license power-of-two division and charge reversals as linear passes. They do not name fixed odd division, so the clause must: one most-significant-first finite-state pass, charged linear [P as an automaton, Lemma 1(d)]. #6068 does not bind it: it concerns stochastic unbiased rounding, and this is deterministic. + +**Scans per call on the word.** + +| site | count | passes | +|---|---|---| +| dyadic non-integer | 19,729 | 1 least-significant-first, with the offset carried in it | +| odd denominator | 3,001 | 1 least-significant-first, 1 reversal, 1 most-significant-first, 1 reversal, about 4 against about 3 in #6932 | + +All 22,730 sites round if the grid is shared. An earlier sketch said "each of 3,001 divisions becomes one more rounding site", which undercounts: rounding sites are 22.68 bits of gain against 16.79 for the odd ones. + +**Raw, recounted on the word.** Baseline reproduces #6932's figures exactly. The charge unit for the new passes is a model, `4(bits+1)` per scan after #6932's formula [judgement]. Old caller first, then with the #6912 block rewrite (`-159,498,240` in every reading). + +| charge | upper | second LAMBDA count | margin there | with #6912 | margin | +|---|---|---|---|---|---| +| baseline, #6932 as shipped | 985,187,200 | 997,747,200 | +2,252,800 | 838,248,960 | +161.8M | +| offset at each rounding site | 988,702,024 | 1,001,262,024 | **-1,262,024** | 841,763,784 | +158.2M | +| and MSB scan at odd sites | 989,552,416 | 1,002,112,416 | **-2,112,416** | 842,614,176 | +157.4M | +| and MSB scan at every site | 995,789,344 | 1,008,349,344 | **-8,349,344** | 848,851,104 | +151.1M | +| worst: and 2 scans at odd sites | 996,639,736 | 1,009,199,736 | **-9,199,736** | 849,701,496 | +150.3M | + +So: +- "The raw count's bit-length term should cover it" holds for the upper reading and fails for the conservative recharge on the old caller, even for the offset alone. +- Dropping the root scale does not rescue it. The 997,747,200 line carries no per-call scale, so there is nothing to free. The 2,089,440 belongs only to the every-call scale line. +- With #6912's rewrite the margin is at least 150M in every reading tried. **Rounded mode should be declared on the rewritten caller.** + +**Owed, not done:** a charge model taken from text rather than assumed, including where reversals land; a tape-level recount of the most-significant-first pass; reruns for any later word. T, P, S and `kappa` are untouched. + +## 8. Measurement [P for the bound, S for the model] + +One root fibre, 512 coordinates, `d = 9`, generic commuting unitary frames `WH diag WH / 512`, exact integers, no checks. MOVE is the frame numerator rounded, then a child that truncates `g` low bits. Every non-integer site is `RDiv`. Exact reference: the endpoint action on the same input. + +**No measurement exceeded its bound.** 15 natural runs on the #6932 word (21,765 row samples) and 14 on the dyadic word (20,174): 0 rows above either bound, with `g` in {0, 20, 44, 70}, `F` in {16, 24, 40, 80}, floor and toward-zero children, all input kinds. + +| check, #6932 word | prediction | measured | +|---|---|---| +| `S = 225`, `g = 0`, grid input | error exactly 0 (the Proposition) | exactly 0 on all 1,451 rows | +| `S = 1`, `g = 0`, grid input | at most `2^26.7`; model `2^20.8` | `2^23.95`: bound holds, model 3 bits low | +| fibre-norm gain at `g = 20, 44, 70` | at most `2^23.66` | `2^18.2`, slack 5.5 bits | +| coordinate-max gain, same inputs | not bounded by this theorem directly | `2^15.0` | +| worst err over row bound, `g = 0` | at most 1 | 0.601 | +| worst err over row bound, `g >= 20` | at most 1 | 0.983 (floor child), 0.89 (toward zero) | + +**Correction of the earlier section on this.** "Measured `2^14.65` against bound `2^23.66`, slack 9 bits" compared a coordinate maximum with a fibre-norm bound. On those same inputs (`F = 60, g = 44`) the fibre-norm gain is `2^18.18` and the coordinate gain `2^14.98`. The honest slack on the worst row is 5.5 bits, and on some rows a natural truncating child comes within 2% of the row bound. + +**The bound is attained.** An adversarial child inside the contract, adding every MOVE residual in phase at a target row, reaches err over bound 0.99989 (row 1436), 0.9999955 (row 517), never above 1. Dyadic word: 0.9999976, 0.9999960. + +**Controls, all fail as they must.** Planted MOVE bias at 2x contract: ratio 2.000. Planted rounding bias: 7.96 at amplitude 4, 2.00 at amplitude 1. Unaligned +1 bias: 2.25. Constant `2^5` replaced by `2^4`: 1.9996. Rounding constant `2^4` halved: natural `g = 0` runs fail at 1.20. Theorem A with realized residuals held in every control, as an identity-level bound should. A non-unitary frame and a dropped ADD, also planned as controls, are not reported. + +**Nesting.** MOVE slots executed by full rounded runs of the same word, to depth 3 (15 nested calls): top error 0.594 of the composed bound at `g = 0`, 0.885 at `g = 20`, 0 violations. With a +1 rounding bias: 2.243, 68 rows over. + +**Rejection.** The truncating child's rejection at event 26,563 in #6932's run is cured by Lemma 1(a): no run rejected anywhere. That event is not special. + +**Model [judgement].** Median err over root-sum-square: 1.09 at `g = 0`, 0.91 at `g >= 20`, maximum 4.0. + +**Not run:** the caller, so the per-context `2^124.62` is untested; true Clifford gates of `physical.py`; width 2. Nested inner runs are single-input and one row only. The measured level-to-level ratio of about 130 understates a generic gain for that reason. + +## 9. Recheck of K_star, caller mass and #6901's hypotheses [P, Q] + +**An error in the earlier derivation.** It used `v = 2223`, `m = 153^2223` and `H > 17,784`. `2223` is the *logarithm* power (`LP`). The chronological power is `power = 1920` (`check.py:473`). For #6030 the two values coincide at 1024 (`PROOF-REVIEW.md:113,126`), which is how the confusion arises. #6901's `v` is the chronological power: "cutoff `16^v`, productive floor `17^v`, ambient `145^v`" (PROOF lines 19-20). The check is `step*hi_ > 8*power` (`check.py:497`), that is, `H > 15,360`. + +| | earlier | corrected | +|---|---|---| +| `v` | 2223 | **1920** | +| `m` | `153^2223` (16,133 bits) | **`153^1920`** (13,934.2 bits) | +| `H` check | `> 17,784` | **`> 15,360`** | +| actual `H` | not used | **`1,338,590,000,000,000,000`** (`step = 10^13`, `j = 133,859`; minimal, `j-1` fails) | +| `K_star` bits | about 16,173 at `H = 17,784` | **14,065.5** at the written `H`; 13,973 at `H = 15,361` | +| margin | about 1,600 bits | **about `1.34 * 10^18` bits at the written `H`**; 1,377 bits for `1100*K_star` at the smallest `H` the check admits | +| caller mass | "`M <= 2^4000`", no derivation | **`M_C <= 2^120.35`** (majorant, computed) | + +Using carrier 153 over the true `maxT` only enlarges `K_star`, and `s > n/m` survives a larger `m`. The margin absorbs any per-node polynomial miss in `H`, `m`, `v`. + +**The width line in #6932 sec 4 needs its constants replaced.** `82 t < d` used the #6030 caller mass 10 as a placeholder. On this word, per context: height at most `15 + 157 = 172` bits (157 is a path-maximum majorant over all caller prefixes, not an actual height), magnitude at most `37.48 + 120.35 = 157.83` bits. So **`344 t < d`** is the sufficient form for the exact mode. It follows from `345 * K_star < 2^H`, as in #6901 lines 299-304. + +**Hypotheses of #6901 against the per-port root:** + +| hypothesis | verdict | +|---|---| +| `r_max < k_min`, `k_min >= 2`: `11^1920 < 12^1920` after the pass | holds; `check.py:478` tail ratios | +| `m` = max productive rank: carrier 153 = `max(maxT, ambient)` | holds; `check.py:481` | +| sources `s > n/m`; `e/n <= (r_max/m)(r_max/k_min)^G <= rho` | holds; general, `r_max <= m-1` | +| at most `v` contexts per class; one raw unit | holds; A and B are one joint stream with 18 joint contacts, so one raw caller | +| `153 < 2^8`, `H > 8v` | holds | +| complete swaps, not interrupted | holds on reading: SWAP is atomic in the caller and the transient is in the majorant | +| owned center as a paid field | holds; FINITE-PRECOMPILATION sec 6 covers it | +| **Literal constants** `1/16`, 8500, `4t`, `14t`, `W+6`, numerators at most 16 | **fail, and are replaced.** Denominator `2^15 * 225`, word mass `2^29.67`, `\|a\|` up to 40,864. Declared by #6932; the replacements are computed here | +| **Integral local endpoint and integral controller prefixes** (#6900 secs 2 and "endpoint-composition"; used by #6901's relative-prefix input) | **fails literally.** The hosted endpoint has `beta = 1/2`, `1+t = 1/2`, and caller scalars include `1/128`. Debt does not reset at a contact, only at the caller's end. Harmless: it is the 157 above, and the same triangle-inequality argument (#6901 lines 226-230) carries it | +| Credited native equalities at every `f` with spectators; full occurrence maps (#6878) | **Not shown, not failed.** 3,230 chart maps, 7,488 contacts and 18 injective field maps at one column. A faithful width-2 run of the recipes passes on 3,438 maps (1,731,297 executions, phase `i^(pf)`), sampled at high rank; an analog of #6878's full ambient maps is missing | + +So no hypothesis of `(4a)` fails. Two literal inputs fail with computed replacements. Item 1 of #6901's nonprecision interfaces remains unshown on this word. + +## 10. Proved, computed, assumed + +- **Proved [P]:** Lemma 1; Theorems A and B; Theorem C and the corollary given S1 to S5 and section 5; Proposition R and its downstream constants. +- **Computed [P]:** section 5, the bit counts of section 9, the raw table. Float gains over all rows, with exact recheck of the worst row by word. Exhaustive `RDiv` automaton, 285,870 cases. +- **Quoted, not re-derived [Q]:** S1 to S5. Frames unitary on fibres: read from the gate alphabet (`physical.py` lines 32-42 raises on any gate but P, X, D, phase, C, and each is unitary), then tensor power at width `f`. The 1,095 frames were not re-verified one by one. +- **Argued, weaker [judgement]:** adapters and normalizers are monomial. If a normalizer contains C stages with direct rounding, add `log2 D` bits per context. The inequality still holds: `K_star (log2 D)^2 / H <= D/8` for all `D >= N`, because it holds at `D = N` and the left side grows more slowly. Lowering of free adapters (`lower_child`) was not checked. The use of a product's factor gains is a reading of p7-TENSOR, with one second reader. +- **Not shown:** a real recursive run of word plus caller; tape cost of the most-significant-first pass as a recount; the actual `P_r`; physical CLEAR. No new `kappa`. No claim that maintainers would accept this. + +## 11. What the theorem does not give [P/S] + +- **Not equality.** Downstream statements that use exactness now read "within `E`". This includes "the quantizer at any cut is the identity" (#6900 item 4). +- **Detection is lost.** A checked word notices a truncated child, and this one does not. +- **Complex side only.** +- **Word-specific.** Section 5's constants are #6932's word. A later word needs its own `Gamma_W`, `M_W`, `Sigma_W` and raw line. The margin makes the theorem's conclusion likely to survive. A word with a larger `S`, such as `S = 1125`, loses nothing here, since no `S` is used. + +--- + +## Sources and changes (not for a package) + +**the numerical run:** Results of the numerical run are folded in at sections 5, 7, 8. It says "theorem survives" and names the two corrections used above. + +**Source reads.** `pkg-lift` at origin/main 7c49fe32c, read with `git show`, checkout unchanged: `upstream/build/sections/{02-streams,05-layers,06-transforms,08-assembly}.tex`, `research/higher-moment-strictification/vendor/{FINITE-PRECOMPILATION,p7-TENSOR}.md`; branch `fork/research/p104-odd-scalar-native` for `check.py`, `native.py`. ` earlier reading/src/p6901.md`, `p6932.md`, `6932_README.md`. + +**Scripts.** `const.py` (`const.out`) here: every constant in sections 5, 6, 9 that is new. ` numerical run/rawrecount.py`, run read-only by me on ` same table as its RESULT, baseline matches. Earlier: ` earlier reading/{gains,caller_gains,caller2,rdiv}.py`. + +**Changes against ` earlier reading/ROUNDED.md`.** + +| # | change | source | +|---|---|---| +| 1 | Paid-job splitting charged per class, 7,293 + 242 bits; `log2 G <= 129`; `c = 1100` stands | READ change 1; rechecked on p7-TENSOR sec 3 | +| 2 | Small-rank base charged, 13,934 bits per node | READ change 2; FINITE sec 4 | +| 3 | `D`-fibre and `R`-fibre norms, order stated | READ change 3; #6901 lines 330-348 | +| 4 | Outer Proposition repaired; Lemma `3l`, convolution `M(9l + sqrt2)` | READ change 4; recomputed | +| 5 | Clause R and recount | READ change 5 | +| 6 | `b = 2^k` shift, offset bound | READ minor | +| 7 | "One circuit" qualified | READ minor | +| 8 | **New here.** READ's `Sigma` about `2^7300` is the split-class value only. The largest are the small-rank base (`2^13,935`) and the ordinary remainder (`2^H`). Still harmless | this note, sec 3 and 5 | +| 9 | **New here.** READ expected about 1.1 more bits of `p`. Reading 08-assembly: none needed, `3l < L` absorbs it at line 564 | this note, sec 6 | +| 10 | **New here.** Proposition R's constant holds for all `D >= 1` with the stated `g`, not only `D >= 19` | `const.py` | +| 11 | **Reversed.** An earlier reading said removing the root scale frees 2,089,440, so raw "should fit". On the recharge line it frees nothing. It fails by 1.26M to 9.20M on the old caller, and fits with #6912's rewrite | this note sec 7; the numerical run | +| 12 | Slack 9 bits corrected to 5.5; model 3 bits low | the numerical run | +| 13 | S3 split into S3, S3a; the factor 2 per context removed, since the completion is now charged explicitly | READ change 1 | diff --git a/research/literal-tariff-conversion-audit/reference/owned_invoice.py b/research/literal-tariff-conversion-audit/reference/owned_invoice.py new file mode 100644 index 0000000000..a576bd0e00 --- /dev/null +++ b/research/literal-tariff-conversion-audit/reference/owned_invoice.py @@ -0,0 +1,211 @@ +"""Complete source invoice and positive ordinary-cost comparison. + +Local algebra/native correctness is inherited, not inferred from these counts. +Prepared for @CubeJerry with substantial OpenAI assistance. Apache-2.0. +""" +from collections import Counter +from fractions import Fraction + + +def require(test, message): + if not test: + raise ValueError(message) + + +def space(vectors): + span = {0} + for v in vectors: + require(type(v) is int and 0 < v < 512 and v not in span, 'independent nine-axis frame') + span |= {x ^ v for x in span} + return span + + +def local_invoice(word): + n = word['public'] + frames = word['frames'] + spans = [space(f) for f in frames] + ranks = list(map(len, frames)) + hosted = word['hosted'] + require(len(word['live']) == len(set(word['live'])) == 104 and + len(hosted['X2']) == len(hosted['Y2']) == 96, 'exact first/second main list sizes') + main = set(word['live']) | {r+112 for r in word['live']} | set(hosted['X2']) | set(hosted['Y2']) + require(len(main) == 400 and len(hosted['Dports']) == 96, '104 first pairs and 96 second pairs') + require(len(word['ports']) == len(set(word['ports'])) == len(word['live']) == 104, 'literal native port inventory') + require(len(word['initial']) == len(word['final']) == n, 'literal native boundaries') + helpers = Counter() + for r in set(range(n))-main: + a, b = word['initial'][r], word['final'][r] + require(spans[a] < spans[b], 'positive productive helper endpoint') + helpers[ranks[b]-ranks[a]] += 1 + current = word['initial'][:] + [None]*word['owned_fields'] + live = set() + paid = Counter() + lifetimes = peak = rises = rise_mass = 0 + allowance = reviewed_scalar = 0 + for event in word['program']: + op, r = event[:2] + if op == 'INIT': + require(n <= r < len(current) and r not in live and current[r] is None, 'local fresh owned initialization') + live.add(r); current[r] = event[2] + lifetimes += 1; peak = max(peak, len(live)); allowance += 2 + elif op == 'CLEAR': + require(r in live and current[r] == event[2], 'local current owned clearance') + live.remove(r); current[r] = None; allowance += 2 + elif op == 'MOVE': + a, b, owned = event[2:] + require(current[r] == a and ((r in live) == owned), 'actual MOVE ownership and chart') + require(spans[a] < spans[b] or spans[b] < spans[a], 'strict nested MOVE') + rank = abs(ranks[b]-ranks[a]); paid[rank] += 1 + if owned and ranks[b] > ranks[a]: + rises += 1; rise_mass += rank + current[r] = b + elif op in ('ADD', 'COPY', 'SCALE'): + require(current[r] == event[-1] and (r < n or r in live), 'local live scalar destination') + if op != 'SCALE': + src = event[2] + require(src != r and current[src] == current[r] and (src < n or src in live), 'local live scalar source') + f = Fraction(event[-2]); a, d = abs(f.numerator), f.denominator + require(a > 0, 'nonzero local coefficient') + if op == 'SCALE': + allowance += 2*(abs(a.bit_length()-d.bit_length())+int(f < 0)) + reviewed_scalar += 4*(a.bit_length()+d.bit_length()+1) + else: + allowance += 2*(3+a.bit_length()-1+a.bit_count()+d.bit_length()-1) + reviewed_scalar += 4*(a.bit_length()+a.bit_count()+d.bit_length()+1) + else: + raise ValueError('unexpected local opcode') + require(not live and current[:n] == word['final'], 'local complete lifetime/chart return') + routes = 1000*(sum(paid.values())+2*sum(helpers.values())+208+2*96+4*104+4*96+4*lifetimes) + return dict(public=n, helpers=helpers, paid=paid, lifetimes=lifetimes, peak_owned=peak, + owned_labels=word['owned_fields'], owned_rises=rises, owned_rise_mass=rise_mass, + allowance=allowance, reviewed_scalar=reviewed_scalar, routes=routes, + allowance_per_call=allowance+routes, reviewed_per_call=reviewed_scalar+routes) + + +def outer_invoice(caller, local): + targets = Counter({r: 18*n for r, n in local['helpers'].items()}) + paid = Counter({r: 18*n for r, n in local['paid'].items()}) + for ty in ('A', 'B'): + t = caller['types'][ty]; multiplicity = len(t['ports']) + for d in t['diagonal']: + targets[d[0] % 2 + 8*sum(d[2:])] += multiplicity + for e in caller['events']: + if e[0] != ty: + continue + if e[1] in ('QUERY', 'QSELF'): + paid[1] += multiplicity + elif e[1] == 'IDLE_ONE': + paid[8*len(e[3])] += multiplicity + return targets, paid + + +def exchanges(selected): + require(len(set(selected)) == len(selected), 'adapter distinct selected axes') + return len(set(selected)-set(range(len(selected)))) + + +def caller_cost(caller): + out = dict(caller_envelope=0, thin_lifecycle=0, qself_extra_lifecycle=0, + main_normalizers=0, main_maps=0, idle_maps=0, query_maps=0, + lambda_recharge=0) + for ty in ('A', 'B'): + t = caller['types'][ty]; ports = len(t['ports']); roles = t['roles'] + events = [e for e in caller['events'] if e[0] in (ty, 'J')] + out['caller_envelope'] += 32*roles*ports*len(events) + out['main_normalizers'] += 26*roles*ports + for qp, zero, *mask in t['diagonal']: + axes = ([0] if qp else []) + [a for k, yes in enumerate(mask, 1) if yes for a in range(9+8*(k-1), 9+8*k)] + out['main_maps'] += 1000*ports*(2*exchanges(axes)+2*bool(qp)+int(qp == -1)) + for e in events: + if e[0] == 'J': + continue + op = e[1] + if op in ('QUERY', 'QSELF'): + out['thin_lifecycle'] += 16*ports + out['query_maps'] += 1000*ports*(2+int(e[-1] == -1)) + if op == 'QSELF': + # Additional explicit charge: four lifecycle/scalar operations, + # each at the inherited 32-unit ordinary gate envelope. + out['qself_extra_lifecycle'] += 128*ports + elif op == 'IDLE_ONE': + axes = [a for k in e[3] for a in range(9+8*(k-1), 9+8*k)] + out['idle_maps'] += 2000*ports*exchanges(axes) + elif op == 'LAMBDA': + out['lambda_recharge'] += 1000*ports + # The extra LAMBDA reading is deliberately separate and charged twice below. + out['raw_rest'] = sum(v for k, v in out.items() if k != 'lambda_recharge') + return out + + +def verify(old, new, word): + require(old['types']['A']['ports'] == new['types']['A']['ports'] == word['hosted']['Dports'], 'same actual 96 second-plane ports') + require(old['types']['B']['ports'] == new['types']['B']['ports'], 'same remaining eight ports') + require(new['types']['A']['roles'] == new['types']['B']['roles'] == 38, 'E-free main role count') + require(all(sum(d[2:]) > 0 for t in new['types'].values() for d in t['diagonal']), 'no E or other empty-mask main target') + old_j = [e for e in old['events'] if e[0] == 'J'] + new_j = [e for e in new['events'] if e[0] == 'J'] + require([e[1] for e in old_j] == [e[1] for e in new_j] == list(range(1, 19)), 'same 18 complete local calls') + # Bind every concrete local public field at every new source contact. + mains = {(ty, role, port) for ty, t in new['types'].items() + for role in range(t['offset'], t['offset']+t['roles']) for port in t['ports']} + helpers = set() + for e in new_j: + fields = {} + second = dict(zip(word['hosted']['Dports'], zip(word['hosted']['X2'], word['hosted']['Y2']))) + for port in new['types']['A']['ports']: + first = word['live'][port]; x, y = second[port] + for field, role in zip((first, first+112, x, y), e[2]): + fields[field] = ('main', 'A', role, port) + for port in new['types']['B']['ports']: + first = word['live'][port] + for field, role in zip((first, first+112), e[3][:2]): + fields[field] = ('main', 'B', role, port) + require(len(fields) == 400 and len(set(fields.values())) == 400, 'all concrete source mains map injectively') + for field in range(word['public']): + if field not in fields: + target = ('helper', e[1], field) + require(target not in helpers, 'fresh arbitrary helper input for each local invocation') + helpers.add(target); fields[field] = target + require(set(fields) == set(range(word['public'])) and len(set(fields.values())) == word['public'], 'complete concrete local public map') + require(len(mains) == 3952 and len(helpers) == 19098, 'complete distinct main/helper inventory') + # Exact B stream equality after the public-role offset changes by two. + def bstream(c): + off = c['types']['B']['offset']; result = [] + for e in c['events']: + if e[0] != 'B': + continue + z = e[:]; z[2] -= off + if e[1] in ('ADD', 'SWAP', 'QUERY'): + z[3] -= off + result.append(z) + return result + require(bstream(old) == bstream(new), 'whole B stream unchanged after offset relabeling') + require(old['types']['B']['diagonal'] == new['types']['B']['diagonal'], 'B targets unchanged') + local = local_invoice(word) + oldT, oldP = outer_invoice(old, local) + newT, newP = outer_invoice(new, local) + for rank in set(oldT)|set(oldP)|set(newT)|set(newP): + need = 192 if rank == 1 else 0 + require(oldT[rank]-newT[rank] == need and oldP[rank]-newP[rank] == need, 'complete rankwise target/paid delta') + a, b = caller_cost(old), caller_cost(new) + old_upper = 18*local['reviewed_per_call'] + a['raw_rest'] + new_upper = 18*local['reviewed_per_call'] + b['raw_rest'] + scale = 18*word['public']*104 # #6936's explicit per-input 1125 conversion reading + require(old_upper == 832255648, 'exact reconstruction of predecessor reviewed raw count') + require(old_upper+a['lambda_recharge']+scale == 847550640, 'exact predecessor double-charge reading') + require(new_upper+b['lambda_recharge']+scale < 10**9, 'positive complete new conditional ordinary budget') + return {'local_source_counts': local, + 'old_targets': dict(sorted(oldT.items())), 'old_paid': dict(sorted(oldP.items())), + 'new_targets': dict(sorted(newT.items())), 'new_paid': dict(sorted(newP.items())), + 'target_count': sum(newT.values()), 'paid_count': sum(newP.values()), + 'rank_mass_surplus': sum(r*(newT[r]-newP[r]) for r in set(newT)|set(newP)), + 'new_paid_rank_mass': sum(r*n for r,n in newP.items()), + 'old_caller_cost': a, 'new_caller_cost': b, + 'old_reviewed_raw': old_upper, 'new_reviewed_raw': new_upper, + 'per_call_scale_recharge': scale, + 'new_double_recharged_raw': new_upper+b['lambda_recharge']+scale, + 'ordinary_margin': 10**9-new_upper-b['lambda_recharge']-scale, + 'owned_query_bank_count': 1, 'old_outer_query_lifetimes': 608, + 'new_outer_query_lifetimes': 416, 'new_qself_lifetimes': 192, + 'selected_kappa_change': False, + 'status': 'Conditional source invoice; no native, rounded, physical fullcaller or supplier admission follows from counting.'} diff --git a/research/literal-tariff-conversion-audit/reference/physical_review_6936.py b/research/literal-tariff-conversion-audit/reference/physical_review_6936.py new file mode 100644 index 0000000000..f41390e024 --- /dev/null +++ b/research/literal-tariff-conversion-audit/reference/physical_review_6936.py @@ -0,0 +1,568 @@ +#!/usr/bin/env python3 +"""Independent finite physical/invoice audit of exact #6726. + +Jerry Chen (@CubeJerry), with substantial OpenAI assistance. Apache-2.0. +No construction, pricing, scalar, or physical implementation is imported. +""" +from collections import Counter +from copy import deepcopy +from fractions import Fraction +from functools import reduce +from hashlib import sha1, sha256 +from itertools import combinations +from pathlib import Path +import gzip +import json +import sys + +HERE = Path(__file__).resolve().parent + + +def require(test, reason): + if not test: + raise ValueError(reason) + + +def read(name): + raw = (HERE / 'frozen' / name).read_bytes() + return json.loads(gzip.decompress(raw) if name.endswith('.gz') else raw) + + +def authenticate(): + pins = json.loads((HERE / 'SOURCES.json').read_bytes()) + for pin in pins['files']: + if pin['usage'] != 'input': + continue + relative = Path(pin['path']).relative_to('research/p104-fragment-physical-invoice-audit') + raw = (HERE / relative).read_bytes() + require(len(raw) == pin['bytes'], 'source length: ' + pin['path']) + require(sha256(raw).hexdigest() == pin['sha256'], 'source SHA256: ' + pin['path']) + require(sha1(b'blob ' + str(len(raw)).encode() + b'\0' + raw).hexdigest() == pin['git_blob'], 'source Git blob: ' + pin['path']) + return pins + + +def span(vectors): + values = {0} + for value in vectors: + require(isinstance(value, int) and 0 < value < 512, 'native nine-axis vector') + require(value not in values, 'frame axes independent') + values |= {old ^ value for old in values} + return sum(1 << value for value in values) + + +def native_ledger(word, check_rows=True): + """Scan physical charts and scalar rows; MOVE changes chart, not chart coordinates.""" + frames = word['frames'] + spaces = [span(frame) for frame in frames] + ranks = [len(frame) for frame in frames] + public = word['public'] + total = public + word['owned_fields'] + require(len(word['initial']) == len(word['final']) == public, 'public boundaries') + chart = word['initial'][:] + [None] * word['owned_fields'] + rows = [{i: Fraction(1)} for i in range(public)] + [{} for _ in range(word['owned_fields'])] + live_owned = set() + lifetime = peak = 0 + paid = Counter() + operations = Counter() + paid_records = [] + scalar_units = 0 + for index, event in enumerate(word['program']): + op, *args = event + operations[op] += 1 + if op == 'INIT': + field, frame = args + require(public <= field < total and chart[field] is None, 'owned INIT before use') + chart[field] = frame + rows[field] = {} + live_owned.add(field) + lifetime += 1 + peak = max(peak, len(live_owned)) + elif op == 'CLEAR': + field, frame = args + require(field in live_owned and chart[field] == frame, 'owned CLEAR at current frame') + chart[field] = None + rows[field] = {} + live_owned.remove(field) + elif op == 'MOVE': + field, start, end, backward = args + require(chart[field] == start, 'chronological MOVE source frame') + lo, hi = ((end, start) if ranks[end] < ranks[start] else (start, end)) if backward else (start, end) # DECLARED CHANGE (assumption A6): an owned MOVE may be nested in either direction; it is paid |delta dim| either way. Predecessor line: lo, hi = (end, start) if backward else (start, end) + require(spaces[lo] & spaces[hi] == spaces[lo] and ranks[lo] < ranks[hi], 'strict nested paid MOVE') + rank = ranks[hi] - ranks[lo] + paid[rank] += 1 + paid_records.append((index, field, rank)) + chart[field] = end + elif op in ('ADD', 'COPY'): + dst, src, value, frame = args + require(dst != src and chart[dst] == chart[src] == frame, 'scalar common current chart') + value = Fraction(value) + require(value and value.denominator & (value.denominator - 1) == 0, 'nonzero dyadic scalar') + if op == 'COPY': + require(dst in live_owned and not rows[dst], 'COPY requires cleared owned destination') + if check_rows: + for column, coefficient in rows[src].items(): + new = rows[dst].get(column, 0) + value * coefficient + if new: + rows[dst][column] = new + else: + rows[dst].pop(column, None) + scalar_units += 4 * (abs(value.numerator).bit_length() + abs(value.numerator).bit_count() + value.denominator.bit_length() + 1) + elif op == 'SCALE': + field, value, frame = args + value = Fraction(value) + require(chart[field] == frame and value, 'scale at current live chart') + require(abs(value.numerator) & (abs(value.numerator)-1) == 0 and value.denominator & (value.denominator-1) == 0, 'invertible dyadic scale') + if check_rows: + rows[field] = {column: value * coefficient for column, coefficient in rows[field].items()} + scalar_units += 4 * (abs(value.numerator).bit_length() + value.denominator.bit_length() + 1) + else: + raise ValueError('unknown native opcode ' + op) + require(not live_owned and chart[:public] == word['final'], 'complete native return and owned clearance') + ports = word['ports'] + live = word['live'] + require(len(set(ports)) == len(ports) == len(set(live)) == len(live) == 104, '104 distinct retained ports') + main = set(live) | {112 + i for i in live} + require(len(main) == 208, 'disjoint native X/Y pairs') + helpers = Counter() + helper_labels = [] + for field in range(public): + if check_rows: + expected = {field: Fraction(1)} + if field >= 112 and field - 112 in live: + expected[field - 112] = Fraction(1) + require(rows[field] == expected, 'all arbitrary native input row ' + str(field)) + if field not in main: + start, end = word['initial'][field], word['final'][field] + require(spaces[start] & spaces[end] == spaces[start] and ranks[start] < ranks[end], 'productive helper strict nested endpoint') + rank = ranks[end] - ranks[start] + helpers[rank] += 1 + helper_labels.append((field, rank)) + for i, q in zip(live, ports): + require(frames[word['initial'][i]] == [q] and frames[word['initial'][112+i]] == [], 'native incoming Q/I main interface') + require(frames[word['final'][i]] == list(1 << j for j in range(9)), 'native complete nine-axis X endpoint') + require(ranks[word['final'][112+i]] == 8 and all((q & a).bit_count()%2 == 0 for a in frames[word['final'][112+i]]), 'native rank-eight q-orthogonal Y endpoint') + return dict(paid=paid, helpers=helpers, helper_labels=helper_labels, paid_records=paid_records, + public=public, owned=word['owned_fields'], lifetimes=lifetime, peak=peak, + operations=operations, scalar_upper=scalar_units, + scalar_rows=public if check_rows else 0) + + +def terms(entries): + counts = Counter() + for vector, coefficient in entries: + counts[vector] += coefficient + return {vector: coefficient % 4 for vector, coefficient in counts.items() if vector and coefficient % 4} + + +def difference(a, b): + return terms(list(a.items()) + [(v, -c) for v, c in b.items()]) + + +def phase(coefficients, frequency): + return sum(c * ((vector & frequency).bit_count() & 1) for vector, c in coefficients.items()) % 4 + + +def axes_of(mask): + out = [] + while mask: + bit = mask & -mask + out.append(bit) + mask ^= bit + return out + + +def translation_for(delta): + """Parity is degree <=2 modulo four; weight<=2 frequencies determine it.""" + support = axes_of(reduce(int.__or__, delta, 0)) + shift = 0 + single = {} + for bit in support: + single[bit] = phase(delta, bit) + require(single[bit] in (0, 2), 'contact linear phase must be an ordinary translation') + if single[bit] == 2: + shift |= bit + for a, b in combinations(support, 2): + require(phase(delta, a | b) == (single[a] + single[b]) % 4, 'contact residual quadratic phase') + return shift + + +def route_function(q, basis, stage): + fresh = [1 << (9 + 8*(stage-1) + i) for i in range(8)] + old_mask = 511 + fresh_mask = sum(fresh) + require(q.bit_count() % 2 == 1, 'odd central port') + require(len(basis) == 8 and all(0 < v < 512 for v in basis), 'native eight-dimensional basis') + require(all((a & b).bit_count() % 2 == (i == j) for i, a in enumerate([q]+basis) for j, b in enumerate([q]+basis)), 'complete orthonormal native basis') + def route(value): + old = value & old_mask + result = value & ~(old_mask | fresh_mask) + if (old & q).bit_count() % 2: + result ^= q + for native_axis, fresh_axis in zip(basis, fresh): + if value & fresh_axis: + result ^= native_axis + if (old & native_axis).bit_count() % 2: + result ^= fresh_axis + return result + affected = [1 << i for i in range(9)] + fresh + images = [route(v) for v in affected] + require(all(route(image) == axis for axis, image in zip(affected, images)), 'route involution') + require(all((a & b).bit_count() % 2 == (i == j) for i, a in enumerate(images) for j, b in enumerate(images)), 'route orthogonality') + require(route(q) == q, 'route fixes Q') + return route + + +def contact(before, after, route, omit_translation=False): + moved = terms((route(v), c) for v, c in before.items()) + shift = translation_for(difference(after, moved)) + supplied = 0 if omit_translation else shift + require(translation_for(difference(after, terms(list(moved.items()) + [(supplied, 2)]))) == 0, 'full forward absolute phase') + inverse = route(supplied) + require(translation_for(difference(before, terms([(route(v), c) for v, c in after.items()] + [(inverse, 2)]))) == 0, 'full inverse absolute phase') + require(shift.bit_count() <= 17 and inverse.bit_count() <= 17, 'fixed seventeen-axis translation budget') + return {'translation': shift, 'inverse_translation': inverse} + + +def physical(word, native, recipes, omit_translation=False): + stages = word['stages'] + require(word['ambient_rank'] == 9 + 8*stages, 'declared ambient axes') + axes = [1 << i for i in range(word['ambient_rank'])] + full_events = [(i, e) for i, e in enumerate(word['events']) if e[0] == 'LOCAL'] + require([e[1] for _, e in full_events] == list(range(1, stages+1)), 'fresh native stage chronology') + by_port = {r['q']: r for r in recipes['recipes']} + require(set(native['ports']) <= set(by_port), 'every retained port has a phase recipe') + records = [] + for _, (_, stage, src, dst) in full_events: + require(src != dst and 0 <= src < word['roles'] and 0 <= dst < word['roles'], 'distinct valid native caller fields') + before_axes = axes[:9+8*(stage-1)] + after_axes = axes[:9+8*stage] + spectator = axes[9:9+8*stage] + for q in native['ports']: + basis = by_port[q]['idle_children'][0]['orthogonal_axes'][:8] + route = route_function(q, basis, stage) + x0 = terms((a, 1) for a in before_axes) + y0 = terms(list(x0.items()) + [(q, -1)]) + x1 = terms((a, 1) for a in after_axes) + y1 = terms(list(x1.items()) + [(q, -1)]) + native_x0 = terms([(a, 1) for a in spectator] + [(q, 1)]) + native_y0 = terms((a, 1) for a in spectator) + native_x1 = terms((a, 1) for a in spectator + axes[:9]) + native_y1 = terms(list(native_x1.items()) + [(q, -1)]) + maps = [contact(a, b, route, omit_translation) for a, b in ((x0,native_x0),(y0,native_y0),(native_x1,x1),(native_y1,y1))] + body = terms((a, 1) for a in axes[9+8*(stage-1):9+8*stage]) + require(translation_for(difference(difference(x1,x0),body)) == 0 and translation_for(difference(difference(y1,y0),body)) == 0, 'native diagonal is fresh D_stage with absolute phase') + require(translation_for(difference(difference(y1,x0),terms(list(body.items())+[(q,-1)]))) == 0, 'native cross coefficient is D_stage Q^-1') + records.append([stage,q,maps]) + main = Counter() + output_shifts = 0 + for term in word['diagonal']: + qp, zero, *selected = term + require(qp in (-1,0,1) and zero == 0 and len(selected) == stages and set(selected) <= {0,1}, 'literal physical endpoint exponent domain') + for q in native['ports']: + body_axes = [axis for stage, yes in enumerate(selected,1) if yes for axis in axes[9+8*(stage-1):9+8*stage]] + positive = ([q] if qp else []) + body_axes + require(all((a & b).bit_count()%2 == (i == j) for i,a in enumerate(positive) for j,b in enumerate(positive)), 'all positive endpoint axes orthonormal') + actual = terms([(q,qp)] + [(a,1) for a in body_axes]) + target = terms((a,1) for a in positive) + shift = translation_for(difference(target,actual)) + require(shift == (q if qp == -1 else 0), 'exact endpoint translation') + output_shifts += bool(shift) + main[len(positive)] += 1 + idle = Counter() + idle_records = [] + for index,event in enumerate(word['events']): + if event[0] not in ('IDLE','IDLE_ONE'): + continue + owners, selection = (event[1:3], event[3]) if event[0] == 'IDLE' else ([event[1]],event[2]) + require(len(set(owners)) == len(owners) and all(0 <= r < word['roles'] for r in owners), 'distinct valid idle owners') + require(selection and len(set(selection)) == len(selection) and all(1 <= s <= stages for s in selection), 'distinct valid complete idle axes') + positive = [axis for stage in selection for axis in axes[9+8*(stage-1):9+8*stage]] + require(len(set(positive)) == len(positive), 'whole idle independent Gaussian factors') + idle[len(positive)] += len(native['ports']) * len(owners) + idle_records.extend((index,owner,q,len(positive)) for owner in owners for q in native['ports']) + require(len(word['diagonal']) == word['roles'], 'one target for every arbitrary caller input') + return dict(contacts=4*len(records), contact_digest=sha256(json.dumps(records,separators=(',',':')).encode()).hexdigest(), + nonzero_contact_translations=sum(bool(m['translation']) for _,_,maps in records for m in maps), + main=main, idle=idle, idle_records=idle_records, output_translations=output_shifts, + dimension=word['ambient_rank']) + + +def allocation(word, native, ledger, alias=False): + main = {(role,q) for role in range(word['roles']) for q in native['ports']} + names = {('main',role,q) for role,q in main} + helper_jobs = [] + local_number = 0 + for event_index, event in enumerate(word['events']): + if event[0] != 'LOCAL': + continue + _,stage,src,dst = event + public_map = {} + for i,q in zip(native['live'],native['ports']): + public_map[i] = ('main',src,q) + public_map[112+i] = ('main',dst,q) + for field,rank in ledger['helper_labels']: + key = ('helper',0 if alias else local_number,field) + require(key not in names, 'fresh native helper cannot alias an earlier public input') + names.add(key) + public_map[field] = key + helper_jobs.append((event_index,stage,field,rank,key)) + require(len(public_map) == ledger['public'] and len(set(public_map.values())) == ledger['public'], 'injective local public-input allocation') + local_number += 1 + owned = {('owned',i) for i in range(ledger['owned'])} + thin = {('query_scratch',0)} + require(not (names & owned or names & thin or owned & thin), 'owned/query scratch is disjoint and uncredited') + return dict(main_fields=len(main), helper_fields=len(helper_jobs), productive_fields=len(names), + reserved_native_owned=len(owned), reserved_query_owned=len(thin), + peak_native_owned=ledger['peak'], maximum_live_owned=max(ledger['peak'],1), + invocations=local_number, helper_jobs=helper_jobs) + + +def invoice(word, ledger, physics, fields): + paid = Counter() + targets = Counter(physics['main']) + for _,_,_,rank,_ in fields['helper_jobs']: + targets[rank] += 1 + for event in word['events']: + if event[0] == 'LOCAL': + paid.update(ledger['paid']) + elif event[0] == 'QUERY': + require(event[3] in (-1,1), 'legal thin query orientation') + paid[1] += 104 + paid.update(physics['idle']) + require(sum(targets.values()) == fields['productive_fields'], 'productive count equals distinct arbitrary inputs') + return {'targets':targets, 'paid':paid, 'productive_fields':sum(targets.values()), 'paid_calls':sum(paid.values()), + 'target_mass':sum(r*n for r,n in targets.items()), 'paid_mass':sum(r*n for r,n in paid.items())} + + +def compare_invoice(actual, expected): + require(actual['targets'] == Counter({int(k):v for k,v in expected['targets'].items()}), 'complete productive rank histogram') + require(actual['paid'] == Counter({int(k):v for k,v in expected['paid'].items()}), 'complete paid rank histogram') + require(actual['productive_fields'] == expected['productive_fields'] and actual['paid_calls'] == expected['paid_calls'], 'independent count totals') + require(actual['target_mass'] - actual['paid_mass'] == expected['rank_mass_surplus'], 'independent rank-mass surplus') + + +def chronology(word, witnesses): + slots = {'ADD':(1,2),'SCALE':(1,),'SWAP':(1,2),'LOCAL':(2,3),'QUERY':(1,2),'IDLE':(1,2),'IDLE_ONE':(1,),'LAMBDA':(1,),'Q_POWER':(1,)} + actual_handoffs = [] + for number, witness in enumerate(witnesses): + # Witness zero belongs to the intermediate 33-field word. Later input + # bases precede that whole word and shift its earlier cut chronologically. + offset = sum(len(later['input_basis']) for later in witnesses[number+1:]) + handoff = witness['handoff_after'] + offset + pivot,fresh = witness['pivot'], witness['fresh'] + require(all(event[j] != fresh for event in word['events'][:handoff+1] for j in slots[event[0]]), 'fresh handoff input untouched in entire prefix') + cut_basis = witness['cut_basis'] + require(word['events'][handoff-len(cut_basis)+1:handoff+1] == cut_basis, 'complete cut basis at actual chronological handoff') + require(word['events'][handoff-len(cut_basis)] == ['IDLE_ONE',2,witness['prefix_stages']], 'handoff immediately follows the paid fragment') + require(word['diagonal'][pivot] == witness['prefix_target'] and word['diagonal'][fresh] == witness['suffix_target'], 'retirement endpoint credit matches literal witness') + first_fresh = next(i for i,event in enumerate(word['events']) if any(event[j] == fresh for j in slots[event[0]])) + require(first_fresh == handoff+1, 'fresh suffix starts immediately after completed prefix') + require(all(event[j] != pivot for event in word['events'][handoff+1:] for j in slots[event[0]]), 'retired productive output retained untouched through the full suffix') + actual_handoffs.append(handoff) + return {'fresh_inputs': [w['fresh'] for w in witnesses], 'witness_handoffs':[w['handoff_after'] for w in witnesses], 'literal_final_handoffs':actual_handoffs} + + +def central_normalization(): + def mul(a,b): + return (a[0]*b[0]-a[1]*b[1], a[0]*b[1]+a[1]*b[0]) + values = [(1,0),(0,1),(-1,0),(0,-1)] + for j,q in enumerate(values): + lam = (1,0) if j%2 == 0 else (0,1) + inverse = (lam[0],-lam[1]) + require(mul(lam,inverse)==(1,0), 'ordinary lambda and inverse are exact') + central = mul(lam,(q[0],-q[1])) + require(mul(central,central)==(1,0), 'normalized central S is an involution') + # At two odd factor characters Q_total=-1, lambda(Q_total)=+1, + # whereas tensoring the two factor lambdas would incorrectly give -1. + require((1,0) != mul((0,1),(0,1)), 'global lambda must remain outside tensor powers') + return {'central_characters':4,'two_factor_lambda_disagreement':True, + 'rule':'Physical Gaussian maps tensor factorwise; ordinary scalar coefficients and lambda polynomials act on the total Q outside tensor powers.'} + + +def coordinate_swaps(selected, dimension): + """Map a subset of canonical axes to the first r axes by explicit exchanges.""" + require(len(set(selected)) == len(selected), 'adapter axes distinct') + require(all(0 <= axis < dimension for axis in selected), 'adapter axes in ambient carrier') + wanted = set(range(len(selected))) + swaps = list(zip(sorted(set(selected)-wanted), sorted(wanted-set(selected)))) + def move(axis): + for a,b in swaps: + if axis == a: + axis = b + elif axis == b: + axis = a + return axis + require({move(axis) for axis in selected} == wanted, 'explicit Gaussian axis permutation') + require(all(move(move(axis)) == axis for axis in range(dimension)), 'permutation adapter inverse') + require(len(swaps) <= len(selected), 'rank-many two-axis exchanges suffice') + return swaps + + +def adapter_inventory(word, native, recipes): + """Charge complete canonical-job input/output conversions, including full idles.""" + by_port = {r['q']:r for r in recipes['recipes']} + for q in native['ports']: + basis = [q]+by_port[q]['idle_children'][0]['orthogonal_axes'][:8] + # This nine-axis map sends q to coordinate zero, fixes all spectators, + # and sends its orthonormal complement to coordinates one through eight. + def convert(value): + return (value & ~511) | sum(((value & axis).bit_count()%2) << i for i,axis in enumerate(basis)) + require([convert(axis) for axis in basis] == [1 << i for i in range(9)], 'explicit nine-axis q-to-coordinate adapter') + require(all((a&b).bit_count()%2 == (i==j) for i,a in enumerate(basis) for j,b in enumerate(basis)), 'q adapter orthogonal and invertible') + records = {'main':[], 'idle':[], 'query':[]} + for role,(qp,zero,*selection) in enumerate(word['diagonal']): + axes = ([0] if qp else []) + [axis for stage,yes in enumerate(selection,1) if yes for axis in range(9+8*(stage-1),9+8*stage)] + exchanges = coordinate_swaps(axes,word['ambient_rank']) + for q in native['ports']: + # Both whole-job boundaries are charged, even though a target + # interface may permit some of these maps to remain implicit. + records['main'].append([role,q,len(exchanges),2*bool(qp),int(qp==-1)]) + for index,event in enumerate(word['events']): + if event[0] in ('IDLE','IDLE_ONE'): + owners,stages = (event[1:3],event[3]) if event[0]=='IDLE' else ([event[1]],event[2]) + axes = [axis for stage in stages for axis in range(9+8*(stage-1),9+8*stage)] + exchanges = coordinate_swaps(axes,word['ambient_rank']) + records['idle'].extend([index,owner,q,len(exchanges)] for owner in owners for q in native['ports']) + elif event[0]=='QUERY': + _,dst,src,power = event + require(dst != src and all(0<=r 1)) + + +def run(): + caller, word = sources() + # The source strictification uses the gap 10**-14 and LP=2226. + need((H + 1) ** LP < 1 << H_INDEX, "current exact H threshold") + need((H_STEP * (H_INDEX - 1) + 1) ** LP >= 1 << (H_INDEX - 1), "preceding H index fails") + m = 153 ** V + kstar = V * m * (H + 1) ** 2 + need((4096 * kstar).bit_length() <= H, "4096 Kstar < 2**H, by bit length") + need(m * (H + 1) + H + 8 * V <= kstar, "positive noncontext path overhead") + # ((153/11)**v+1)((12/11)**v+2) < 2**(6v), rationally. + left = (153 ** V + 11 ** V) * (12 ** V + 2 * 11 ** V) + right = (1 << (6 * V)) * 11 ** (2 * V) + need(left < right, "split/completion factor < 2**(6v)") + need(344 * 8 < 4096 and 357 * 8 < 4096, "both path exponents below D/8") + need(max(576, (m + 2).bit_length()) < H, "all nonwrapper node Sigma below N") + need(4 * 16 + 7 <= 1 << (16 - 3), "large-D log lemma base") + # The induction step is 4(k+1)+7 <= 2(4k+7) for k>=16. + need(4 * 17 + 7 <= 2 * (4 * 16 + 7), "large-D log lemma step") + small = [] + for d in range(1, 20): + g = 5 if d < 19 else 0 + need((d + 3) ** 4 <= 1 << (d + 2 * g - 1), "small-rank grid guard") + need((d + 3) ** 2 <= 1 << (d + 3), "small-rank radius guard") + small.append(dict(D=d, extra_fractional_bits=g)) + need(23 ** 4 < 2 * 22 ** 4, "large small-rank induction ratio at D=19") + # The function (D+4)/(D+3) decreases, hence the guard continues for all D>=19. + need(6 ** 4 > 1 << (3 + 2 * 4 - 1), "negative control: g=4 fails at D=3") + native = sum(scalar_surcharge(e[2] if e[0] == "SCALE" else e[3]) + for e in word["program"] if e[0] in ("SCALE", "ADD", "COPY")) + outer = Counter() + for e in caller["events"]: + if e[0] == "J": + continue + multiplicity = len(caller["types"][e[0]]["ports"]) + if e[1] in ("ADD", "SCALE"): + outer["scalar_offset_model"] += multiplicity * scalar_surcharge(e[3] if e[1] == "SCALE" else e[4]) + elif e[1] == "LAMBDA": + outer["lambda_offset_model"] += multiplicity * scalar_surcharge(F(1, 2)) + baseline = json.loads((ROOT / "reference/QUERY-RESULT.json").read_bytes())["invoice"]["full_after"] + surcharge = 18 * native + sum(outer.values()) + need(native == 941128 and baseline == 826265904, "current source invoice pins") + need(baseline + surcharge < 10 ** 9, "optimistic declared tariff model only") + nums = [abs(F(e[2] if e[0] == "SCALE" else e[3]).numerator) + for e in word["program"] if e[0] in ("SCALE", "ADD", "COPY")] + dens = [F(e[2] if e[0] == "SCALE" else e[3]).denominator + for e in word["program"] if e[0] in ("SCALE", "ADD", "COPY")] + need(max(nums) < 1 << 24 and max(dens) < 1 << 19, "temporary numerator/denominator limits") + need(max(nums) >= 1 << 16, "negative control: inherited 16-bit numerator premise fails") + return dict(parameters=dict(v=V, ambient=153, LP=LP, H=H, H_index=H_INDEX, + Kstar_bits=kstar.bit_length(), + scaled_Kstar_bits=(4096 * kstar).bit_length()), + conditional_path_bounds=dict(gain_bits_per_context=344, radius_bits_per_context=357, + Sigma_node_bound="2**H * (D+3)", + format="F=p+D+g; W=p+h+2D+3+g; temporary W+26"), + small_rank_guards=small, + temporary=dict(numerator_bits=24, denominator_bits=19, extra_signed_bits=26), + optimistic_tariff_model=dict(baseline=baseline, retained_exact_conversion_charge=2734992, + per_native_call_surcharge=native, native_call_count=18, + all_native_surcharge=18 * native, outer=dict(outer), total_surcharge=surcharge, + conditional_total=baseline + surcharge, + conditional_margin=10 ** 9 - baseline - surcharge, + status="Declared extra-scan model, not a physical tape-cost certificate")) diff --git a/research/literal-tariff-conversion-audit/reference/query_invoice.py b/research/literal-tariff-conversion-audit/reference/query_invoice.py new file mode 100644 index 0000000000..eec03ab88b --- /dev/null +++ b/research/literal-tariff-conversion-audit/reference/query_invoice.py @@ -0,0 +1,75 @@ +"""Complete rank profile and positive inherited ordinary-cost comparison. + +This is source accounting under the declared historical tariff, not a proof +of its physical bit-tape rate. Prepared for @CubeJerry with substantial OpenAI +assistance. Apache-2.0. +""" +from collections import Counter +from source_binding import module,need +from replacement import counts + + +def verify(old,new,root,word): + iv=module('invoice') + need(old['types'] == new['types'] and old['roles'] == new['roles'] == 76, + 'unchanged complete arbitrary main inventory and targets') + need([e for e in old['events'] if e[0] == 'J'] == + [e for e in new['events'] if e[0] == 'J'], 'same 18 exact local native contacts') + masks=[[-1,0]+[int(r in s['mask']) for s in root['stages']] for r in range(root['n'])] + need(masks == old['types']['A']['diagonal'] == new['types']['A']['diagonal'], + 'unchanged exact E-free root target masks') + need(all(sum(d[2:])>0 for t in new['types'].values() for d in t['diagonal']), + 'no empty-mask main target credit') + local=iv.local_invoice(word) + oldT,oldP=iv.outer_invoice(old,local) + newT,newP=iv.outer_invoice(new,local) + need(oldT == newT and oldP == newP, 'complete rankwise moment polynomial unchanged') + a,b=iv.caller_cost(old),iv.caller_cost(new) + oldc,newc=counts(old),counts(new) + def amount(c,op): + return sum(v['physical_instances'].get(op,0) for v in c.values()) + need((amount(oldc,'QUERY'),amount(oldc,'QSELF'),amount(newc,'QUERY'),amount(newc,'QSELF')) + == (224,192,416,0), 'actual complete outer lifetime counts') + need(len(new['events'])-len(old['events']) == 104 + and amount(newc,'LAMBDA')-amount(oldc,'LAMBDA') == 28*96, + 'all additional ordinary work counted') + need(b['caller_envelope']-a['caller_envelope'] == 104*32*38*96, + 'complete changed caller envelope') + need(b['lambda_recharge']-a['lambda_recharge'] == 28*1000*96, + 'positive extra lambda allowance') + need(a['qself_extra_lifecycle'] == 192*128 and b['qself_extra_lifecycle'] == 0, + 'only obsolete QSELF-specific surcharge removed') + for name in ('thin_lifecycle','main_normalizers','main_maps','idle_maps','query_maps'): + need(a[name] == b[name], 'unchanged complete term '+name) + scale=18*word['public']*104 + oldraw=18*local['reviewed_per_call']+a['raw_rest'] + newraw=18*local['reviewed_per_call']+b['raw_rest'] + before=oldraw+a['lambda_recharge']+scale + after=newraw+b['lambda_recharge']+scale + need((oldraw,newraw,before,after) == (796934944,809050912,811461936,826265904), + 'full exact inherited invoice') + need(after < 10**9, 'full inherited ordinary allowance preserved') + # A fourth query would change the full paid profile, even with free metadata. + mutant={**new,'events':new['events']+[['A','QUERY',0,1,-1]]} + mt,mp=iv.outer_invoice(mutant,local) + need(mt == newT and mp[1]-newP[1] == 96 and mp != newP, + 'fourth-query budget negative control') + main=sum(t['roles']*len(t['ports']) for t in new['types'].values()) + helpers=18*sum(local['helpers'].values()) + return dict(targets=dict(sorted(newT.items())),paid=dict(sorted(newP.items())), + target_count=sum(newT.values()),paid_count=sum(newP.values()), + rank_mass_surplus=sum(r*(newT[r]-newP[r]) for r in set(newT)|set(newP)), + paid_rank_mass=sum(r*n for r,n in newP.items()), + all_rankwise_deltas_zero=True,main_arbitrary_inputs=main,fresh_local_helpers=helpers, + old_opcode_counts=oldc,new_opcode_counts=newc, + local_source_lifetimes_per_joint=local['lifetimes'],local_source_peak_owned=local['peak_owned'], + outer_query_or_QSELF_lifetimes_before=416,outer_QUERY_lifetimes_after=416, + additional_public_or_helper_roles=0,additional_owned_bank_inventory=0, + outer_query_peak_bank_inventory=1, + owned_inventory_scope='Relative to the existing completed QUERY contract; no physical binding installed.', + old_caller_cost=a,new_caller_cost=b,old_reviewed_raw=oldraw,new_reviewed_raw=newraw, + per_call_conversion_recharge=scale,full_before=before,full_after=after, + margin_below_inherited_cap=10**9-after, + controls=['fourth_QUERY_adds_96_paid_rank_one_without_target_credit'], + tariff_scope='Inherited scalar/routing convention only; actual common precision and bit-tape tariff remain open.', + selected_kappa_change=False) diff --git a/research/literal-tariff-conversion-audit/review/native/RESULT.json b/research/literal-tariff-conversion-audit/review/native/RESULT.json new file mode 100644 index 0000000000..8afc3efcd6 --- /dev/null +++ b/research/literal-tariff-conversion-audit/review/native/RESULT.json @@ -0,0 +1,229 @@ +{ + "audit_py_imported": false, + "credit": "Native-physical agent; OpenAI-assisted independent pass-count review, shared immutable source", + "derived_vector": { + "L": [ + 22, + 3, + 48, + 13 + ], + "constant": [ + 76, + 18, + 156, + 38 + ], + "delta": [ + 10, + 0, + 18, + 5 + ] + }, + "method": "AST count of literal ordinary paths; universal multiplicities/lifecycle proved separately", + "negative_control": { + "actual_quotient": [ + 16, + 3, + 36, + 9 + ], + "missing_numerator_move": [ + 15, + 3, + 33, + 8 + ] + }, + "numeric_table_execution": false, + "phases": { + "horner_and_rewind": { + "logical": [ + 4, + 1, + 6, + 2 + ], + "physical_and_rows": [ + 22, + 3, + 48, + 13 + ], + "states": [ + "hscan", + "hy", + "hn", + "hdigit", + "reset-back", + "reset-public" + ] + }, + "initialization_and_rewind": { + "logical": [ + 3, + 1, + 6, + 2 + ], + "physical_and_rows": [ + 18, + 3, + 42, + 12 + ], + "states": [ + "init", + "init-y", + "init-zero", + "reset-back", + "reset-public" + ] + }, + "installation": { + "logical": [ + 1, + 1, + 2, + 1 + ], + "physical_and_rows": [ + 6, + 3, + 18, + 5 + ], + "states": [ + "install", + "install-symbol" + ] + }, + "odd_residue_and_rewind": { + "logical": [ + 2, + 0, + 2, + 1 + ], + "physical_and_rows": [ + 10, + 0, + 18, + 5 + ], + "states": [ + "residue", + "res-digit", + "rewind" + ] + }, + "offset_and_rewind": { + "logical": [ + 2, + 1, + 2, + 1 + ], + "physical_and_rows": [ + 10, + 3, + 24, + 6 + ], + "states": [ + "offset", + "offset-digit", + "rewind" + ] + }, + "quotient": { + "logical": [ + 3, + 1, + 4, + 1 + ], + "physical_and_rows": [ + 16, + 3, + 36, + 9 + ], + "states": [ + "emit", + "emit-y", + "emit-n", + "emit-digit" + ] + }, + "two_long_head_returns": { + "physical_and_rows": [ + 6, + 0, + 6, + 0 + ] + }, + "two_private_retirements": { + "physical_and_rows": [ + 12, + 6, + 12, + 0 + ] + }, + "whole_reverse": { + "logical": [ + 1, + 0, + 4, + 1 + ], + "physical_and_rows": [ + 8, + 0, + 18, + 6 + ], + "states": [ + "global-bits", + "global-public" + ] + } + }, + "primitive_physical": { + "move": [ + 1, + 0, + 3 + ], + "read": [ + 4, + 0, + 6 + ], + "write": [ + 0, + 3, + 6 + ] + }, + "raw_plus_rows_sums": { + "L": 86, + "constant": 288, + "delta": 33 + }, + "raw_sums": { + "L": 73, + "constant": 250, + "delta": 28 + }, + "sources": { + "kernel/compact_tables.py": "fe8a28fd523ebb7ec78dce4ba0855b3070a6cbff470602cd62f8d3ff445e0f0a", + "kernel/exact_builder.py": "654e9734ef80a9394807ca508543b1bc164afb5768d23d0e5a88c790d2f13bac", + "kernel/machine.py": "ec597bce13275003ff30e4be481c936401826c1d4af642b55eec0c410774d1df" + }, + "status": "PASS_STATIC_INDEPENDENT_VECTOR", + "whole_word_execution": false +} diff --git a/research/literal-tariff-conversion-audit/review/native/REVIEW.md b/research/literal-tariff-conversion-audit/review/native/REVIEW.md new file mode 100644 index 0000000000..e00c944f52 --- /dev/null +++ b/research/literal-tariff-conversion-audit/review/native/REVIEW.md @@ -0,0 +1,140 @@ +# Independent compact ADD pass-vector review + +**Verdict: PASS; no blocking issue found in the successful-call vector.** + +This is a separate OpenAI-assisted review by the native-physical agent for +@CubeJerry, using shared immutable source. It does not read or import +`audit.py`, run a numerical table, benchmark, or execute the full word. +It is not human or proof-assistant verification. Source census and tariff +unit conversion are separate lead-review obligations. + +## Source pins and replay + +Canonical base: `7c49fe32c55de02c2c873655c804b16e4c3fef0a`. + +| Retained file | Public commit | Original Git blob | +|---|---|---| +| `kernel/compact_tables.py` | `38cd824c60f2bb5c6f2603f848a9487cb3a57965` | `b90ecb6052e270095fdd048f992f9fc786f3f8c7` | +| `kernel/machine.py` | `ab239cb6ee884e7a900dd9101c34448077fad0b0` | `acf475e4fccaff2fb64bd5b0b3f3fc0d246dc592` | +| `kernel/exact_builder.py` | `13193a22b1070a74a8580c5d3ea27470443f815a` | `1cc22f75fbe53d48b84be42782e581c04820cd49` | + +From this review directory: + +```sh +python -I -B independent_vector.py /path/to/research/literal-tariff-conversion-audit --output RESULT.json +``` + +Expected `PASS_STATIC_INDEPENDENT_VECTOR`; executed successfully. The +script authenticates SHA256 pins and counts literal ordinary-state AST +bodies. It does not assume the claimed vector. Its manual premises are +the universal traversal and lifecycle arguments below; it is not a +general Python cost verifier. + +## Literal primitives and emitted paths + +On a valid nonblank codeword, `CodedPort.read` has one initial BLANK-test +read plus three code-bit reads, three forward moves and three return +moves: `(4,0,6)` physical reads/writes/moves. `write` uses three `emit` +calls plus three return moves: `(0,3,6)`. Either successful ordinary +coded move uses one read and three moves: `(1,0,3)`. Right-frontier +materialization adds nonnegative work; left-origin crossing rejects. + +`Builder.emit` appends exactly one row. Its `goto` and `branch` each call +emit once. `finish` appends one resolved row per existing row, without +peephole elimination. Every branch/write/move/goto is thus one fetched +row in the unchanged executor. Leading-zero coefficient passes survive. + +Logical tuple order is `(branches,writes,coded moves,gotos)`; physical +tuple order is `(reads,writes,unit moves,flat rows)`. + +| Phase | Literal tags | Logical tuple | Physical tuple | +|---|---|---|---| +| Initialization + rewind | `init/init-y/init-zero/reset-back/reset-public` | `(3,1,6,2)` | `(18,3,42,12)` | +| Horner + rewind | `hscan/hy/hn/hdigit/reset-back/reset-public` | `(4,1,6,2)` | `(22,3,48,13)` | +| Offset + rewind | `offset/offset-digit/rewind` | `(2,1,2,1)` | `(10,3,24,6)` | +| Odd residue + rewind | `residue/res-digit/rewind` | `(2,0,2,1)` | `(10,0,18,5)` | +| Quotient | `emit/emit-y/emit-n/emit-digit` | `(3,1,4,1)` | `(16,3,36,9)` | +| Whole reverse | `global-bits/global-public` | `(1,0,4,1)` | `(8,0,18,6)` | +| Installation | `install/install-symbol` | `(1,1,2,1)` | `(6,3,18,5)` | + +Let `R` be the positive even component count, `B=sum w_i`, `S=B+R`, +`K=L+2`, and `U=1+S+(K+1)R`. Every successful call visits every public +data bit in all seven phases. Initialization writes one numerator bit +per public bit, then K high bits. Its reset skips K high bits, then does +one `reset-back/reset-public` cycle per public bit. Each Horner pass +does the same; `hfinish` advances i until exactly L passes finish. +Offset and residue scan all `w_i+K` numerator bits, so retaining only +w_i forward and reverse iterations is a lower bound. The residue path +occurs exactly when the odd denominator part exceeds one. The `rewind` +branch jumps directly back, without a separate goto. + +Quotient staging advances output, numerator, target and source: FOUR +moves per public bit. The script's accounting mutation deletes the +numerator move and changes `(16,3,36,9)` to `(15,3,33,8)`. It detects +this change; no numerical execution of the mutant is claimed. Correct +ordinary quotient cost is 55 raw actions, 64 including rows. The prior +illustrative 59 omitted that move; its slack 128U upper bound is unaffected. + +Global reverse uses numerator markers, skips high bits and moves the +other three heads once per public bit. Installation reads every output +bit, writes the target and advances both heads. Delimiters and markers +add work. No whole-field-zero shortcut exists. + +## Head returns, erasure and sum + +Global reverse returns all four heads to their origins. Installation +leaves target and output at physical distance 3S, source and numerator +at origin. `execute_table` then calls `origin` on every port. At distance +D>=0, literal origin costs exactly D+1 reads and D+2 moves. The two long +returns therefore contribute at least `(6B,0,6B,0)`. + +Private numerator and output have contiguous binary bodies 3U and 3S. +Logical symbols 4/5/6 remain three physical binary bits and cannot end +the physical erase. Starting at origin, `retire` of length D makes +exactly `(2D+3,D,2D+4)`: initial origin, erase and frontier read, final +origin. `Controller.primitive` calls it on both work ports after every +successful table return. Since U>=S>=B, the two erasures contribute at +least `(12B,6B,12B,0)`. Entry cleanup and historical larger bodies cannot +subtract from these current-body costs. Historical space and current +erase length remain separate quantities. + +Adding the rows gives exactly + +```text +B * ((76,18,156,38) + L*(22,3,48,13) + delta*(10,0,18,5)). +``` + +Raw action sum is `B*(250+73L+28delta)`; including rows it is +`B*(288+86L+33delta)`. This matches the proposed vector. + +## All-zero success and omitted-cost signs + +For arbitrary positive matching widths and positive even R, all-zero +inputs give zero in every Horner prefix, even for negative coefficients. +The positive widths establish zero input signs before delimiters; all +expanded high bits and carries close. The rounding offset is c=floor(b/2), +with 0<=c short[2], 'fourth-move failure detection') + result = { + 'status': 'PASS_STATIC_INDEPENDENT_VECTOR', + 'method': 'AST count of literal ordinary paths; universal multiplicities/lifecycle proved separately', + 'sources': {k: hashlib.sha256(v).hexdigest() for k, v in source.items()}, + 'primitive_physical': primitive, 'phases': paths, + 'derived_vector': {'constant': base, 'L': horner, 'delta': residue}, + 'raw_sums': {'constant': sum(base[:3]), 'L': sum(horner[:3]), 'delta': sum(residue[:3])}, + 'raw_plus_rows_sums': {'constant': sum(base), 'L': sum(horner), 'delta': sum(residue)}, + 'negative_control': {'missing_numerator_move': short, 'actual_quotient': actual}, + 'audit_py_imported': False, 'numeric_table_execution': False, 'whole_word_execution': False, + 'credit': 'Native-physical agent; OpenAI-assisted independent pass-count review, shared immutable source', + } + payload = json.dumps(result, indent=2, sort_keys=True) + '\n' + if args.output: + args.output.write_text(payload) + print(payload) + + +if __name__ == '__main__': + main() diff --git a/research/literal-tariff-conversion-audit/review/tariff-lead-check.py b/research/literal-tariff-conversion-audit/review/tariff-lead-check.py new file mode 100644 index 0000000000..8f207b101d --- /dev/null +++ b/research/literal-tariff-conversion-audit/review/tariff-lead-check.py @@ -0,0 +1,74 @@ +"""Independent coefficient-histogram and fee-credit arithmetic review. + +This does not infer equal units or a complete-runtime lower bound. +Prepared for @CubeJerry with OpenAI assistance. +""" +import argparse +from collections import Counter +from fractions import Fraction +import gzip +import hashlib +import importlib.util +import json +from pathlib import Path + +p=argparse.ArgumentParser();p.add_argument('package');p.add_argument('--output',required=True) +a=p.parse_args();root=Path(a.package).resolve() +w=json.loads(gzip.decompress((root/'data/word.json.gz').read_bytes())) +c=json.loads((root/'data/caller.json').read_text()) +assert hashlib.sha256((root/'data/word.json.gz').read_bytes()).hexdigest()=='273e81f176f001684b1fa3eb857992bf58b54748004fcfe806b83adb48d2cc00' +assert hashlib.sha256((root/'data/caller.json').read_bytes()).hexdigest()=='3828d53e80ea97e8b866320f081af20b6b93bfebd58b95b56b85a7afe151af5e' +hist=Counter(Fraction(e[-2]) for e in w['program'] if e[0]=='ADD') +N=sum(hist.values());length_sum=odd_count=old_credit=round_credit=0 +for q,n in hist.items(): + numerator,denominator=abs(q.numerator),q.denominator + L=max(numerator.bit_length(),denominator.bit_length()) + odd=denominator >> ((denominator & -denominator).bit_length()-1) + length_sum+=n*L + odd_count+=n*(odd!=1) + old_credit+=n*4*(numerator.bit_length()+sum(map(int,bin(numerator)[2:]))+denominator.bit_length()+1) + if denominator!=1: + round_credit+=n*4*(denominator.bit_length()+1)*(4 if odd!=1 else 1) +assert (N,length_sum,odd_count)==(61052,167955,4079) +assert (old_credit,round_credit)==(1717220,920796) +assert [e[1] for e in c['events'] if e[0]=='J']==list(range(1,19)) +factor=18 +vector=tuple(factor*x for x in (76*N+22*length_sum+10*odd_count, + 18*N+3*length_sum,156*N+48*length_sum+18*odd_count,38*N+13*length_sum+5*odd_count)) +assert vector==(150763536,28850418,317868732,81428148) +raw=sum(vector[:3]);with_rows=sum(vector) + +# Replay the immutable predecessor invoice, not the new audit reconstruction. +spec=importlib.util.spec_from_file_location('root_old_invoice',root/'reference/owned_invoice.py') +iv=importlib.util.module_from_spec(spec);spec.loader.exec_module(iv) +local=iv.local_invoice(w);outer=iv.caller_cost(c) +baseline=factor*local['reviewed_per_call']+outer['raw_rest']+outer['lambda_recharge']+factor*w['public']*104 +assert baseline==826265904 +model=json.loads((root/'reference/PRECISION-GUARDS.json').read_text())['optimistic_tariff_model'] +assert model['baseline']==baseline and model['conditional_total']==843431488 +release=factor*(old_credit+round_credit) +remaining=model['conditional_total']-release +room=10**9-remaining +assert (release,remaining,room)==(47484288,795947200,204052800) +assert Fraction(raw,room)==Fraction(82913781,34008800) +assert Fraction(with_rows,room)==Fraction(96485139,34008800) +assert raw+remaining==1293429886 and with_rows+remaining==1374858034 +assert raw>room and with_rows>room and with_rows<3*room + +# Omission and contamination controls must change the claimed coefficients. +assert sum(vector[:3])//18 != raw +copies=[e for e in w['program'] if e[0]=='COPY'];assert len(copies)==1 +assert N+len(copies)!=N +assert with_rows-vector[3]!=with_rows +assert 10**9-model['conditional_total']!=room +out=dict(status='pass',method='independent Fraction coefficient histogram and closed aggregate sums; immutable predecessor invoice replay', + native_ADD=N,distinct_coefficients=len(hist),length_sum=length_sum,odd_ADD=odd_count, + physical_vector=vector,raw_actions=raw,raw_plus_rows=with_rows, + released_credit=release,retained_other_model=remaining,replacement_headroom=room, + necessary_raw_exchange=str(Fraction(raw,room)),necessary_combined_exchange=str(Fraction(with_rows,room)), + accounting_controls=4,independent_pass_vector_proof='Separate native_physical cross-review required.', + scientific_sha256={n:hashlib.sha256((root/n).read_bytes()).hexdigest() for n in ('PROOF.md','audit.py')}, + limitations=['Equal B and numerical converter are explicit hypothetical premises.', + 'Other retained fees are model/upper charges, not runtime lower bounds.', + 'No complete caller, physical cap failure, or new kappa.']) +Path(a.output).write_text(json.dumps(out,indent=2,sort_keys=True)+'\n');print(json.dumps(out,sort_keys=True)) diff --git a/research/literal-tariff-conversion-audit/review/tariff-lead-review.json b/research/literal-tariff-conversion-audit/review/tariff-lead-review.json new file mode 100644 index 0000000000..231f13039d --- /dev/null +++ b/research/literal-tariff-conversion-audit/review/tariff-lead-review.json @@ -0,0 +1,32 @@ +{ + "accounting_controls": 4, + "distinct_coefficients": 4462, + "independent_pass_vector_proof": "Separate native_physical cross-review required.", + "length_sum": 167955, + "limitations": [ + "Equal B and numerical converter are explicit hypothetical premises.", + "Other retained fees are model/upper charges, not runtime lower bounds.", + "No complete caller, physical cap failure, or new kappa." + ], + "method": "independent Fraction coefficient histogram and closed aggregate sums; immutable predecessor invoice replay", + "native_ADD": 61052, + "necessary_combined_exchange": "96485139/34008800", + "necessary_raw_exchange": "82913781/34008800", + "odd_ADD": 4079, + "physical_vector": [ + 150763536, + 28850418, + 317868732, + 81428148 + ], + "raw_actions": 497482686, + "raw_plus_rows": 578910834, + "released_credit": 47484288, + "replacement_headroom": 204052800, + "retained_other_model": 795947200, + "scientific_sha256": { + "PROOF.md": "3f208fe129569ccce7c226e1562b849412f6b16300e2927d6791c5b7a0276fa4", + "audit.py": "b2e34ac4a60b25d6d964905840547896258d1c706382ddef0541ba1f8c78ce95" + }, + "status": "pass" +} diff --git a/research/literal-tariff-conversion-audit/source_binding.py b/research/literal-tariff-conversion-audit/source_binding.py new file mode 100644 index 0000000000..8047a5796c --- /dev/null +++ b/research/literal-tariff-conversion-audit/source_binding.py @@ -0,0 +1,39 @@ +"""Authenticated frozen inputs for a cost audit, not a new caller registry. + +Prepared for @CubeJerry with substantial OpenAI assistance. Apache-2.0. +""" +from pathlib import Path +import hashlib +import importlib.util +import json +import sys + +ROOT = Path(__file__).resolve().parent + + +def need(ok, message): + if not ok: + raise ValueError(message) + + +def authenticate(): + rows = json.loads((ROOT / 'DEPENDENCIES.json').read_text())['files'] + for row in rows: + raw = (ROOT / row['local_path']).read_bytes() + need(len(raw) == row['bytes'], 'dependency length: ' + row['local_path']) + need(hashlib.sha256(raw).hexdigest() == row['sha256'], 'dependency SHA256: ' + row['local_path']) + blob = hashlib.sha1(b'blob ' + str(len(raw)).encode() + b'\0' + raw).hexdigest() + need(blob == row['git_blob'], 'dependency Git blob: ' + row['local_path']) + return len(rows) + + +def vendor(name, path): + # The unchanged compact constructor imports its original Builder path. + if path == 'vendor/exact_scalar_tables.py': + path = 'kernel/exact_builder.py' + spec = importlib.util.spec_from_file_location(name, ROOT / path) + need(spec is not None and spec.loader is not None, 'module loader') + module = importlib.util.module_from_spec(spec) + sys.modules[name] = module + spec.loader.exec_module(module) + return module diff --git a/research/literal-tariff-conversion-audit/verify.py b/research/literal-tariff-conversion-audit/verify.py new file mode 100644 index 0000000000..ff18f96807 --- /dev/null +++ b/research/literal-tariff-conversion-audit/verify.py @@ -0,0 +1,181 @@ +#!/usr/bin/env python3 +"""Small independent hardware meters and exact frozen-source accounting. + +Not a whole-word execution or a conversion to tariff units. +Prepared for @CubeJerry with substantial OpenAI assistance. Apache-2.0. +""" +from pathlib import Path +import argparse +from collections import Counter +from fractions import Fraction +import json +from types import SimpleNamespace +import sys + +ROOT = Path(__file__).resolve().parent +sys.path.insert(0, str(ROOT)) +from source_binding import authenticate, vendor, need +from audit import inspect_sources, lower_vector, PHASES + + +class Tape: + """Independent instrumented hardware, never exposed as an arithmetic API.""" + def __init__(self, body=()): + self.cells = {-1: 2} | dict(enumerate(body)) + self.head = 0 + self.count = Counter() + + def read(self): + self.count['reads'] += 1 + return self.cells.get(self.head, 6) + + def write(self, value): + need(self.head >= 0, 'protected LEFT marker') + self.count['writes'] += 1 + self.cells[self.head] = value + + def move(self, direction): + need(direction in (-1, 1), 'literal unit movement') + self.count['moves'] += 1 + self.head += direction + need(self.head >= -1, 'local hardware confinement') + + +class Rows: + def __init__(self, table): + self.table, self.count = table, 0 + + def __getitem__(self, index): + self.count += 1 + return self.table[index] + + +def encode_zero(widths): + out = [] + for width in widths: + need(width >= 1, 'positive width') + out.extend([0] * (3 * width)) + out.extend((0, 1, 0)) # numeric delimiter 2 + return out + + +def counts(tapes, rows=0): + return tuple(sum(t.count[key] for t in tapes) for key in ('reads','writes','moves')) + (rows,) + + +def primitive_units(machine): + result = {} + for name in ('read', 'write', 'move_right', 'move_left'): + tape = Tape([0] * 6); port = machine.CodedPort(tape) + if name == 'read': need(port.read() == 0, 'coded zero read') + elif name == 'write': port.write(0) + elif name == 'move_right': port.move(1) + else: tape.head = 3; port.move(-1) + result[name] = counts([tape])[:3] + need(result == {'read': (4,0,6), 'write': (0,3,6), + 'move_right': (1,0,3), 'move_left': (1,0,3)}, + 'exact unchanged coded-port vector') + return result + + +def literal_checks(): + machine = vendor('tariff_machine', 'kernel/machine.py') + tables = vendor('tariff_compact_tables', 'kernel/compact_tables.py') + units = primitive_units(machine) + coefficients = ('1', '-1', '3/8', '-2/3', '-7/10', '1/125', + '-14729531/163840', '-1379/250', '1085645/393216') + cases = [] + for q in coefficients: + table, metadata = tables.compile_compact(q) + for widths in ((1,1), (2,4), (17,1,3,11), (65,65)): + body = encode_zero(widths) + # Independent dirty contiguous bank with a displaced starting head. + tapes = [Tape(body), Tape(body), Tape([1,0,1,1,0,1,0]), Tape([0,1,0,1])] + tapes[2].head = 5; tapes[3].head = 2 + row_meter = Rows(table) + host = SimpleNamespace(payloads=tapes, primitive_work=(2,3), + primitive_context=(), services={'service':row_meter}) + machine.Controller.primitive(host, 'service', (0,1)) + need(all([tapes[i].cells.get(j,6) for j in range(len(body))] == body for i in (0,1)), + 'exact zero output and complete source preservation') + need(all(t.head == 0 for t in tapes), 'success origin restoration') + need(all(all(v == 6 for k,v in t.cells.items() if k >= 0) for t in tapes[2:]), + 'retirement of dirty and current private bodies') + observed = counts(tapes, row_meter.count) + bound = tuple(v * sum(widths) for v in lower_vector(q)) + need(all(x >= y for x,y in zip(observed,bound)), 'universal mandatory-vector lower bound') + cases.append(dict(coefficient=q, widths=list(widths), + observed=list(observed), lower=list(bound), rows_in_table=len(table))) + # With the same two components and same initial dirty bodies, the + # width increment isolates the mandatory ordinary-bit coefficient. + small, wide = cases[-4], cases[-1] + need([wide['observed'][j]-small['observed'][j] for j in range(4)] == + [wide['lower'][j]-small['lower'][j] for j in range(4)], + 'independent width-increment coefficient check') + return dict(cases=len(cases), primitive_units=units, observations=cases, + exact_width_increment_controls=len(coefficients), + scope='Small literal hardware checks supporting the symbolic all-width pass proof; no whole word replay.') + + +def controls(source, literal): + # Controls target real accounting failure modes, not arithmetic mutants + # of a predecessor already tested separately. + detected = [] + def mismatch(name, actual, erroneous): + need(actual != erroneous, 'negative control not discriminating: '+name) + detected.append(name) + mismatch('COPY_must_not_be_included_in_ADD_count', source['native_ADD_count'], + source['native_ADD_count'] + 1) + mismatch('one_native_call_is_not_the_complete_18_call_invoice', source['raw_action_lower'], + source['raw_action_lower'] // 18) + mismatch('remainder_and_reversal_cost_is_not_zero', source['raw_action_lower'], + source['raw_action_lower'] - 18 * 28 * source['odd_ADD_count']) + mismatch('coded_read_is_not_three_raw_reads', sum(literal['primitive_units']['read']), 3) + # Exact rate comparison: at rho=1 the FIXED replacement ledger fails; + # rho=3 is not disproved by this lower bound, but is not an upper certificate. + bound = source['raw_action_lower']; room = source['replacement_headroom'] + need(bound > room and Fraction(bound,3) < room, 'conditional exchange-rate discriminators') + detected.append('upper_cap_inference_from_lower_bound_rejected') + # Algebraic countermodel to a stronger inference, not a claimed algorithm: + # positive actual costs can obey every displayed lower/upper inequality + # while fitting the cap and failing the retained replacement ledger. + hypothetical_other, hypothetical_add = 100000000, 500000000 + need(hypothetical_other <= source['retained_other_invoice'] + and hypothetical_add >= bound + and hypothetical_other + hypothetical_add < 10**9 + and source['retained_other_invoice'] + hypothetical_add > 10**9, + 'model upper charges cannot be used as actual lower bounds') + detected.append('positive_abstract_countermodel_to_full_runtime_obstruction') + need(sum(PHASES['quotient_stage'][:3]) == 55 and sum(PHASES['quotient_stage']) == 64, + 'four moves in quotient staging, not three') + detected.append('quotient_fourth_move_counted') + return dict(detected=detected, + purely_algebraic_countermodel=dict(other_actual=100000000, add_actual=500000000, + scope='Consistency witness for cost inequalities only; no physical algorithm is asserted.'), + invalid_inferences=['An O(V) source lemma specifies rho=1.', + 'A lower estimate under rho=3 proves an upper admission.', + 'A failure of the retained replacement ledger proves all implementations exceed the cap.', + 'Three installed compact source tokens constitute a full caller registry.']) + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('--suite', choices=('source','literal','all'), default='all') + parser.add_argument('--write-receipts', action='store_true') + args = parser.parse_args(); authenticate() + source = inspect_sources() + if args.suite in ('source','all'): + if args.write_receipts: + (ROOT/'SOURCE.json').write_text(json.dumps(source,sort_keys=True,indent=2)+'\n') + print('PASS_LITERAL_TARIFF_SOURCE') + if args.suite in ('literal','all'): + literal = literal_checks(); negative = controls(source,literal) + if args.write_receipts: + (ROOT/'LITERAL.json').write_text(json.dumps(literal,sort_keys=True,indent=2)+'\n') + (ROOT/'CONTROLS.json').write_text(json.dumps(negative,sort_keys=True,indent=2)+'\n') + print('PASS_LITERAL_TARIFF_LOWER_VECTOR') + print('PASS_LITERAL_TARIFF_CONTROLS') + + +if __name__ == '__main__': + main()