diff --git a/research/query-only-precision-envelope/BOUNDARY.json b/research/query-only-precision-envelope/BOUNDARY.json new file mode 100644 index 0000000000..527ff2a480 --- /dev/null +++ b/research/query-only-precision-envelope/BOUNDARY.json @@ -0,0 +1,351 @@ +{ + "caveat": "contract countermodel, not an observed error of a retained MOVE implementation", + "coefficient": "-2/3", + "intervening_events": 3, + "physical": { + "accepted": 21, + "cases": [ + { + "accepted": false, + "actions": 189, + "input": [ + 1, + 0 + ], + "width": 3 + }, + { + "accepted": false, + "actions": 349, + "input": [ + 3, + 1 + ], + "width": 3 + }, + { + "accepted": true, + "actions": 1334, + "input": [ + 0, + 0 + ], + "width": 3 + }, + { + "accepted": true, + "actions": 1334, + "input": [ + 3, + 0 + ], + "width": 3 + }, + { + "accepted": true, + "actions": 1334, + "input": [ + -3, + 0 + ], + "width": 3 + }, + { + "accepted": false, + "actions": 229, + "input": [ + 1, + 0 + ], + "width": 4 + }, + { + "accepted": false, + "actions": 429, + "input": [ + 3, + 1 + ], + "width": 4 + }, + { + "accepted": true, + "actions": 1636, + "input": [ + 0, + 0 + ], + "width": 4 + }, + { + "accepted": true, + "actions": 1636, + "input": [ + 3, + 0 + ], + "width": 4 + }, + { + "accepted": true, + "actions": 1636, + "input": [ + -3, + 0 + ], + "width": 4 + }, + { + "accepted": false, + "actions": 269, + "input": [ + 1, + 0 + ], + "width": 5 + }, + { + "accepted": false, + "actions": 509, + "input": [ + 3, + 1 + ], + "width": 5 + }, + { + "accepted": true, + "actions": 1938, + "input": [ + 0, + 0 + ], + "width": 5 + }, + { + "accepted": true, + "actions": 1938, + "input": [ + 3, + 0 + ], + "width": 5 + }, + { + "accepted": true, + "actions": 1938, + "input": [ + -3, + 0 + ], + "width": 5 + }, + { + "accepted": false, + "actions": 309, + "input": [ + 1, + 0 + ], + "width": 6 + }, + { + "accepted": false, + "actions": 589, + "input": [ + 3, + 1 + ], + "width": 6 + }, + { + "accepted": true, + "actions": 2240, + "input": [ + 0, + 0 + ], + "width": 6 + }, + { + "accepted": true, + "actions": 2240, + "input": [ + 3, + 0 + ], + "width": 6 + }, + { + "accepted": true, + "actions": 2240, + "input": [ + -3, + 0 + ], + "width": 6 + }, + { + "accepted": false, + "actions": 349, + "input": [ + 1, + 0 + ], + "width": 7 + }, + { + "accepted": false, + "actions": 669, + "input": [ + 3, + 1 + ], + "width": 7 + }, + { + "accepted": true, + "actions": 2542, + "input": [ + 0, + 0 + ], + "width": 7 + }, + { + "accepted": true, + "actions": 2542, + "input": [ + 3, + 0 + ], + "width": 7 + }, + { + "accepted": true, + "actions": 2542, + "input": [ + -3, + 0 + ], + "width": 7 + }, + { + "accepted": false, + "actions": 389, + "input": [ + 1, + 0 + ], + "width": 8 + }, + { + "accepted": false, + "actions": 749, + "input": [ + 3, + 1 + ], + "width": 8 + }, + { + "accepted": true, + "actions": 2844, + "input": [ + 0, + 0 + ], + "width": 8 + }, + { + "accepted": true, + "actions": 2844, + "input": [ + 3, + 0 + ], + "width": 8 + }, + { + "accepted": true, + "actions": 2844, + "input": [ + -3, + 0 + ], + "width": 8 + }, + { + "accepted": false, + "actions": 429, + "input": [ + 1, + 0 + ], + "width": 9 + }, + { + "accepted": false, + "actions": 829, + "input": [ + 3, + 1 + ], + "width": 9 + }, + { + "accepted": true, + "actions": 3146, + "input": [ + 0, + 0 + ], + "width": 9 + }, + { + "accepted": true, + "actions": 3146, + "input": [ + 3, + 0 + ], + "width": 9 + }, + { + "accepted": true, + "actions": 3146, + "input": [ + -3, + 0 + ], + "width": 9 + } + ], + "failure_contract": "public unchanged; private work and heads may be unrestored", + "rejected": 14, + "scope": "unchanged generic exact SCALE table/executor; no new source-token binder", + "table_instructions": 364, + "table_receipt": { + "carry_bound": 5, + "carry_states": 5, + "coefficient": "-2/3", + "denominator_twos": 0, + "numerator_source": 0, + "numerator_target": -2, + "odd_denominator": 3, + "operation": "SCALE", + "public_ports": 1, + "rows": 364, + "states": 156, + "work_ports": 2 + } + }, + "register": 697, + "rounded_alternative": { + "output_numerator": -1, + "residual_in_quanta": "-1/3" + }, + "source_move": 37476, + "source_odd_scale": 37480, + "universal_countermodel": "one admitted quantum after MOVE; all other residuals zero" +} diff --git a/research/query-only-precision-envelope/CONTROLS.json b/research/query-only-precision-envelope/CONTROLS.json new file mode 100644 index 0000000000..d9c9a5c54c --- /dev/null +++ b/research/query-only-precision-envelope/CONTROLS.json @@ -0,0 +1,19 @@ +{ + "exact_controls": [ + "noninteger_ADD_residual_channel", + "CLEAR_kills_earlier_residual", + "unitary_is_not_coordinate_sup_contractive", + "Lambda_requires_Q_fourth_power", + "projector_is_not_Lambda", + "RDiv_tie_rule_is_not_sign_symmetric" + ], + "physical_and_precision_controls": "BOUNDARY.json and GUARDS.json include further rejection controls", + "source_mutants_rejected": [ + "wrong_actual_MOVE_source_frame", + "public_MOVE_mislabelled_owned", + "dependent_chart_basis", + "CLEAR_erases_public_field", + "joint_stage_order_changed", + "nonretained_QSELF_reintroduced" + ] +} diff --git a/research/query-only-precision-envelope/DEPENDENCIES.json b/research/query-only-precision-envelope/DEPENDENCIES.json new file mode 100644 index 0000000000..5368bee55f --- /dev/null +++ b/research/query-only-precision-envelope/DEPENDENCIES.json @@ -0,0 +1,104 @@ +{ + "schema_version": 1, + "files": [ + { + "local_path": "data/caller.json", + "repository": "CubeJerry/integer-mult-bounds", + "commit": "617903497387a98f7ca929ad0b6928dd32abffec", + "original_path": "research/p104-query-only-interval/QUERY-ONLY-CALLER.json", + "bytes": 73501, + "git_blob": "cf55f4271009a06ad192a070d330a4466b6d44fa", + "sha256": "3828d53e80ea97e8b866320f081af20b6b93bfebd58b95b56b85a7afe151af5e" + }, + { + "local_path": "reference/QUERY-PROOF.md", + "repository": "CubeJerry/integer-mult-bounds", + "commit": "617903497387a98f7ca929ad0b6928dd32abffec", + "original_path": "research/p104-query-only-interval/PROOF.md", + "bytes": 14599, + "git_blob": "2f8610ae455bb8c6b79161223cc948e136253add", + "sha256": "0cede285a98dd61b78020651202729c6d9cd16fb078ee5fe9a01aa2400df5432" + }, + { + "local_path": "reference/QUERY-RESULT.json", + "repository": "CubeJerry/integer-mult-bounds", + "commit": "617903497387a98f7ca929ad0b6928dd32abffec", + "original_path": "research/p104-query-only-interval/RESULT.json", + "bytes": 6419, + "git_blob": "c35963e24b9178f64e80ce19cf427a198f776c62", + "sha256": "57ff7aa635f45146c12995332761d27b0284b8062188f0d5e6f29f93edfaf507" + }, + { + "local_path": "data/word.json.gz", + "repository": "DreamingOfClouds/integer-mult-bounds", + "commit": "03626137d0bd57f09b0bf9597376183ce6fa9683", + "original_path": "research/p104-main-wire-native/data/word.json.gz", + "bytes": 349022, + "git_blob": "d93e67ca7628bf5531ae6e369da4dd7b7907b88f", + "sha256": "273e81f176f001684b1fa3eb857992bf58b54748004fcfe806b83adb48d2cc00" + }, + { + "local_path": "reference/EXACT-GRID-6901.md", + "repository": "CubeJerry/integer-mult-bounds", + "commit": "4c7a4f00f09665276e145ac2cc1d12f8b8f9a7ac", + "original_path": "research/compiled-root-clifford-precision/PROOF.md", + "bytes": 25733, + "git_blob": "7e0793c4d00efcf337df926ff16fe922134fcef7", + "sha256": "42606a73acf3313f39e6055bf2409974c528c12a3092d13ca09f206bbbd010a1" + }, + { + "local_path": "reference/ROUNDED-DIVISION-6937.md", + "repository": "DreamingOfClouds/integer-mult-bounds", + "commit": "a98df73ddae1d1ea85a62b6bdf2714b28cb7b359", + "original_path": "research/p104-two-chain-findings/ROUNDED-DIVISION.md", + "bytes": 40736, + "git_blob": "ed609f6a0e26dd00d6c55f876b667e15051507ca", + "sha256": "9ecff5835fae5fcdbf416711a5ef0e69d51afb535c55570ab3e1fef6f920f146" + }, + { + "local_path": "reference/NATIVE-PROOF.md", + "repository": "DreamingOfClouds/integer-mult-bounds", + "commit": "03626137d0bd57f09b0bf9597376183ce6fa9683", + "original_path": "research/p104-main-wire-native/PROOF.md", + "bytes": 27432, + "git_blob": "d39690a37b8984cc4e3046b13bae36709196a64a", + "sha256": "139ed82f70e1a543fe0732fb6b5d5f6686035b805888307b9652bd4442702c21" + }, + { + "local_path": "reference/NATIVE-check.py", + "repository": "DreamingOfClouds/integer-mult-bounds", + "commit": "03626137d0bd57f09b0bf9597376183ce6fa9683", + "original_path": "research/p104-main-wire-native/check.py", + "bytes": 66884, + "git_blob": "2adba130f2c6dd2f5fc4bb8ce5d4f34a4d978f12", + "sha256": "170673365591ea853b7ba448d7f9b07e4ff191a36d6a2fe2a9f7d14f94b79f49" + }, + { + "local_path": "reference/ODD-COMMON-GRID.md", + "repository": "CubeJerry/integer-mult-bounds", + "commit": "e45e844303e04947cf6591fb46b43bf8a7bc5356", + "original_path": "research/odd-native-common-grid/PROOF.md", + "bytes": 12720, + "git_blob": "edea8e98a082f4513aedbfb7bd55f32063e32b38", + "sha256": "b710cc953163ebe282fce7cf0a426744c155a0d5acbfb9bf7d67e81195b66a1e" + }, + { + "local_path": "vendor/exact_scalar_tables.py", + "repository": "CubeJerry/integer-mult-bounds", + "commit": "13193a22b1070a74a8580c5d3ea27470443f815a", + "original_path": "research/current-scalar-flat-tables/tables.py", + "bytes": 12650, + "git_blob": "1cc22f75fbe53d48b84be42782e581c04820cd49", + "sha256": "654e9734ef80a9394807ca508543b1bc164afb5768d23d0e5a88c790d2f13bac" + }, + { + "local_path": "vendor/machine.py", + "repository": "CubeJerry/integer-mult-bounds", + "commit": "ab239cb6ee884e7a900dd9101c34448077fad0b0", + "original_path": "research/compiled-owned-bank-lifecycle/machine.py", + "bytes": 14932, + "git_blob": "acf475e4fccaff2fb64bd5b0b3f3fc0d246dc592", + "sha256": "ec597bce13275003ff30e4be481c936401826c1d4af642b55eec0c410774d1df" + } + ] +} diff --git a/research/query-only-precision-envelope/ENVELOPES.json b/research/query-only-precision-envelope/ENVELOPES.json new file mode 100644 index 0000000000..736b272a5f --- /dev/null +++ b/research/query-only-precision-envelope/ENVELOPES.json @@ -0,0 +1,313 @@ +{ + "caller": { + "bounds": { + "E_joint_entrance": { + "exact": "969526412251367590769106875717058297403172188349681350509844078361519491787771520625828573252478138581063344138404323102106955162479351010695021/816024928239874692926668800000000000000000", + "strict_power_of_two": 340, + "witness": { + "cut": 2958, + "event": 2958, + "factor": "1", + "kind": "stored", + "register": 39 + } + }, + "Gamma_context": { + "exact": "45360631584156946008107084900700591555596068986545445167924519783678935472016023281893353990110417257002737696162927795888623945710175818307546371/235015179333083911562880614400000000000000000", + "strict_power_of_two": 337, + "witness": { + "cut": 3095, + "factor": "1", + "kind": "public-return", + "register": 75 + } + }, + "M_caller": { + "exact": "1683307283016999532839217702665847040", + "strict_power_of_two": 121, + "witness": { + "cut": 3050, + "event": 3049, + "factor": "1", + "kind": "stored", + "register": 38 + } + }, + "M_context": { + "exact": "357785576519866955612252350988609186816321980908663407791015039444019290924985824200787570016109744886871115010298639528729086491946504898580913375877/7344224354158872236340019200000000000000000", + "strict_power_of_two": 355, + "witness": { + "cut": 2959, + "event": 2958, + "factor": "1", + "kind": "stored", + "register": null + } + }, + "M_joint_entrance": { + "exact": "363421601940370671219209686545270656", + "strict_power_of_two": 119, + "witness": { + "cut": 2958, + "event": 2958, + "factor": "1", + "kind": "stored", + "register": 39 + } + }, + "Sigma_caller": { + "exact": "24249683165158588639142497524517510083840768803435910943998877033381912912493032678270443234896089359567436955641736673573527663430402846717848021/4406534612495323341804011520000000000000000", + "strict_power_of_two": 342, + "witness": { + "cut": 3050, + "event": 3049, + "factor": "1", + "kind": "stored", + "register": 38 + } + }, + "Sigma_context": { + "exact": "122174819154490445082427684819739905414336025146694722427722381694605919161300683286831966035911005631142503237479783427228779306422001890150069546308831316252840808005908998468836803776043283762391828104962623699024519906877669429777203587879148375307036481871/767112979402244323706750094996122631357005873157242880000000000000000000000000000000000", + "strict_power_of_two": 576, + "witness": { + "cut": 2959, + "event": 2958, + "factor": "1", + "kind": "stored", + "register": null + } + } + }, + "fresh_arbitrary_helpers": 19098, + "helper_allocation_premise": "distinct (stage, helper) public inputs as in frozen caller proof", + "independent_adjoint": { + "E_joint_entrance": { + "entrance_mass": "363421601940370671219209686545270656", + "joint_coefficient": "59336854494143543914675236360327/2", + "primitive_coefficient": "22622085086540611235550148326673690", + "residual_mass": "969526412251367590769106875717058297403172188349681350509844078361519491787771520625828573252478138581063344138404323102106955162479351010695021/816024928239874692926668800000000000000000" + }, + "Gamma_context": { + "entrance_mass": "59038824075417799032780136585499589", + "joint_coefficient": "308461849925427171118076353794753/64", + "primitive_coefficient": "117600608836679351835159084859338679/32", + "residual_mass": "45360631584156946008107084900700591555596068986545445167924519783678935472016023281893353990110417257002737696162927795888623945710175818307546371/235015179333083911562880614400000000000000000" + }, + "M_caller": { + "entrance_mass": "1683307283016999532839217702665847040", + "joint_coefficient": "274838256141142176415070287809505/2", + "primitive_coefficient": "104781665096099932454228246133920343", + "residual_mass": "24249683165158588639142497524517510083840768803435910943998877033381912912493032678270443234896089359567436955641736673573527663430402846717848021/4406534612495323341804011520000000000000000" + }, + "M_joint_entrance": { + "entrance_mass": "363421601940370671219209686545270656", + "joint_coefficient": "59336854494143543914675236360327/2", + "primitive_coefficient": "22622085086540611235550148326673690", + "residual_mass": "969526412251367590769106875717058297403172188349681350509844078361519491787771520625828573252478138581063344138404323102106955162479351010695021/816024928239874692926668800000000000000000" + }, + "Sigma_caller": { + "entrance_mass": "1683307283016999532839217702665847040", + "joint_coefficient": "274838256141142176415070287809505/2", + "primitive_coefficient": "104781665096099932454228246133920343", + "residual_mass": "24249683165158588639142497524517510083840768803435910943998877033381912912493032678270443234896089359567436955641736673573527663430402846717848021/4406534612495323341804011520000000000000000" + } + }, + "joint_entries": [ + { + "entrance_defect": "1", + "entrance_mass": "3328", + "event": 21, + "stage": 1 + }, + { + "entrance_defect": "441162804364201266196265094301115358205479684462795840250279217255213009834204719093092870372574987426328222658121/4406534612495323341804011520000000000000000", + "entrance_mass": "34560", + "event": 66, + "stage": 2 + }, + { + "entrance_defect": "18970000587660654446439399054947960402835626431900221130762006341974156615908254761482024696865386219332113574299203/22032673062476616709020057600000000000000000", + "entrance_mass": "267520", + "event": 117, + "stage": 3 + }, + { + "entrance_defect": "145142562635822216578571216025066952849602816188259831442341862476965054959570815308452865764767092143261985254521809/22032673062476616709020057600000000000000000", + "entrance_mass": "2019072", + "event": 168, + "stage": 4 + }, + { + "entrance_defect": "1095407243236311743965326229149669434424206056521122071341443296444693709632157663801314994620089078739572976860114443/22032673062476616709020057600000000000000000", + "entrance_mass": "15211776", + "event": 219, + "stage": 5 + }, + { + "entrance_defect": "550130017042158978946742572593490851682233166525106412792098183917250525714327723029282217391929987240631293654676887/1468844870831774447268003840000000000000000", + "entrance_mass": "114566912", + "event": 270, + "stage": 6 + }, + { + "entrance_defect": "497190480518454827003190761277357008697575604389570911962064677846624973895876564087008877120898102912671906935702367/176261384499812933672160460800000000000000", + "entrance_mass": "862823680", + "event": 321, + "stage": 7 + }, + { + "entrance_defect": "156017666926204141991575346864683747544726095889952211700351495461523308466734395298495305786593632390628402271267149771/7344224354158872236340019200000000000000000", + "entrance_mass": "6498041600", + "event": 372, + "stage": 8 + }, + { + "entrance_defect": "1174989925003983102978269078305930537236967153240419201351711915283013335482604037416500692304798196516130603930080864553/7344224354158872236340019200000000000000000", + "entrance_mass": "48937594112", + "event": 423, + "stage": 9 + }, + { + "entrance_defect": "103357519533904642635505907189974734484824663171512494245768293139384348202492317668666389293670305926176078397008604365738047920950843/11016336531238308354510028800000000000000000", + "entrance_mass": "2869851357661739006410624", + "event": 2166, + "stage": 10 + }, + { + "entrance_defect": "6337751808668781667672704054195500230237399298806486487547319126852719315020538964831100819363764685738315867303798966689684573731630061/22032673062476616709020057600000000000000000", + "entrance_mass": "87987819921824138957327936", + "event": 2299, + "stage": 11 + }, + { + "entrance_defect": "176259123854458055303812372247211924966990703830134488322591547889339968089992231953423583901545273332847987196102105262155457231206726897/22032673062476616709020057600000000000000000", + "entrance_mass": "2447027986812579413618418560", + "event": 2399, + "stage": 12 + }, + { + "entrance_defect": "4073769935130868847244626047578558179180682955666264068799132867421538030237246320189954542287040881339268012691206395653511156077966329421/22032673062476616709020057600000000000000000", + "entrance_mass": "56556669663990103089614108160", + "event": 2497, + "stage": 13 + }, + { + "entrance_defect": "31222092359718242154312078633286451032716905904176106444925921546798574742857937461242684210270811274226870078817217376879226507797662350453/7344224354158872236340019200000000000000000", + "entrance_mass": "1300380918848168161545814930560", + "event": 2593, + "stage": 14 + }, + { + "entrance_defect": "430723529702213690054823943650922578745471872445670057009737140709693776407341681448641655476113098720036555192409649627233821865449774294797/4406534612495323341804011520000000000000000", + "entrance_mass": "29898949589421721863235314186112", + "event": 2687, + "stage": 15 + }, + { + "entrance_defect": "16505636382732755681359905841004565639749626288528879307909272750874934001561424892297560285417426520263404049932260341583098971491161304881369/7344224354158872236340019200000000000000000", + "entrance_mass": "687449590445880987173716162586496", + "event": 2779, + "stage": 16 + }, + { + "entrance_defect": "1138514243612427520497994965780557539065225412062145752961599130679780128138160261804836875457436061627574220534986727286936796777960863486285421/22032673062476616709020057600000000000000000", + "entrance_mass": "15806139033147704339825284871898752", + "event": 2869, + "stage": 17 + }, + { + "entrance_defect": "969526412251367590769106875717058297403172188349681350509844078361519491787771520625828573252478138581063344138404323102106955162479351010695021/816024928239874692926668800000000000000000", + "entrance_mass": "363421601940370671219209686545270656", + "event": 2958, + "stage": 18 + } + ], + "physical_main_inputs": 3952, + "sites": { + "ADD": 2108, + "IDLE_ONE": 100, + "J": 18, + "LAMBDA": 226, + "QUERY": 8, + "SCALE": 180, + "SWAP": 455, + "noninteger_scalar": 297 + } + }, + "native": { + "bounds": { + "Gamma": { + "exact": "441162804364201266196265094301115358205479684462795840250279217255204531661610278090983239454410507426328222658121/11016336531238308354510028800000000000000000", + "strict_power_of_two": 235, + "witness": { + "cut": 71144, + "factor": "1", + "kind": "public-return", + "register": 1443 + } + }, + "M": { + "exact": "126014946690090142208567585621946014814854001438194317042948706884868886404177493519332313603713876445603579325239851/940060717332335646251522457600000000000000000", + "strict_power_of_two": 237, + "witness": { + "cut": 71120, + "factor": "1", + "kind": "stored", + "register": 1443 + } + }, + "Sigma": { + "exact": "441162804364201266196265094301115358205479684462795840250279217255204531661610278090983239454410507426328222658121/11016336531238308354510028800000000000000000", + "strict_power_of_two": 235, + "witness": { + "cut": 71120, + "factor": "1", + "kind": "stored", + "register": 1443 + } + } + }, + "census": { + "denominator_bits": 19, + "events": 71144, + "lifetimes": 54, + "max_denominator": 393216, + "max_numerator": 14729531, + "numerator_bits": 24, + "opcodes": { + "ADD": 61052, + "CLEAR": 54, + "COPY": 1, + "INIT": 54, + "MOVE": 6323, + "SCALE": 3660 + }, + "owned_labels": 51, + "peak_owned": 43, + "public": 1461, + "scalars": { + "dyadic": 60570, + "integer": 38790, + "noninteger": 25923, + "odd": 4143 + } + }, + "independent_adjoint": { + "Gamma": { + "active_residual_sites": 24507, + "entrance_mass": "126014946690090142208567585621946014814854001438194317042948706884868886404177493519332313603713876445603579325239851/940060717332335646251522457600000000000000000", + "residual_mass": "441162804364201266196265094301115358205479684462795840250279217255204531661610278090983239454410507426328222658121/11016336531238308354510028800000000000000000" + }, + "M": { + "active_residual_sites": 24507, + "entrance_mass": "126014946690090142208567585621946014814854001438194317042948706884868886404177493519332313603713876445603579325239851/940060717332335646251522457600000000000000000", + "residual_mass": "441162804364201266196265094301115358205479684462795840250279217255204531661610278090983239454410507426328222658121/11016336531238308354510028800000000000000000" + }, + "Sigma": { + "active_residual_sites": 24507, + "entrance_mass": "126014946690090142208567585621946014814854001438194317042948706884868886404177493519332313603713876445603579325239851/940060717332335646251522457600000000000000000", + "residual_mass": "441162804364201266196265094301115358205479684462795840250279217255204531661610278090983239454410507426328222658121/11016336531238308354510028800000000000000000" + } + } + } +} diff --git a/research/query-only-precision-envelope/ENVIRONMENT.json b/research/query-only-precision-envelope/ENVIRONMENT.json new file mode 100644 index 0000000000..3766fde773 --- /dev/null +++ b/research/query-only-precision-envelope/ENVIRONMENT.json @@ -0,0 +1,7 @@ +{ + "python": "3.12.14 (main, Aug 25 2026, 14:00:49) [Clang 22.1.3 ]", + "implementation": "CPython", + "platform": "Linux-6.18.57-x86_64-with-glibc2.39", + "dependencies": "Python standard library only; no network, subprocess, Git or external solver in package replay", + "canonical_base": "7c49fe32c55de02c2c873655c804b16e4c3fef0a" +} diff --git a/research/query-only-precision-envelope/GUARDS.json b/research/query-only-precision-envelope/GUARDS.json new file mode 100644 index 0000000000..d295e9bb21 --- /dev/null +++ b/research/query-only-precision-envelope/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/query-only-precision-envelope/PR-DESCRIPTION.md b/research/query-only-precision-envelope/PR-DESCRIPTION.md new file mode 100644 index 0000000000..5c4fcb1fab --- /dev/null +++ b/research/query-only-precision-envelope/PR-DESCRIPTION.md @@ -0,0 +1,77 @@ +## What changed and why + +The published 3,095-event QUERY-only caller removed the proposed QSELF +opcode, but its exact endpoint identity did not establish intermediate +precision or admit rounded child returns. This package supplies a +source-specific prefix/suffix envelope for that caller with every source +cut of its 18 current 71,144-event native calls included. + +Under explicitly retained complete-fibre unitary, total primitive error +and compiler contracts, the exact rational certificate gives +M_ctx<2^355, Sigma_ctx<2^576 and Gamma_ctx<2^337. Current source/threshold +checks imply the conditional format F=p+D, W=p+h+2D+3 for D>=19, five extra +fractional bits below 19, and W+26 temporary bits. Every arbitrary helper +input and incoming native-call defect is included. The proof retains the +wrapper's D-dependent admission cost. + +It also locates an exact-service obstruction in the actual source: +MOVE37476 on register697, followed without another access to that field by +SCALE37480 at -2/3. A permitted one-grid child defect is nondivisible at +every F. This is an abstract contract countermodel, not a claim that the +retained MOVE implementation produces that error. The unchanged exact +scalar table physically rejects the example before public writes. + +## Exact sources and predecessor credit + +Canonical base: `7c49fe32c55de02c2c873655c804b16e4c3fef0a`. +Caller: [published QUERY-only source at 6179034](https://github.com/CubeJerry/integer-mult-bounds/tree/617903497387a98f7ca929ad0b6928dd32abffec/research/p104-query-only-interval). +Native word: DreamingOfClouds' CrocSwap/integer-mult-bounds#6936, +`03626137d0bd57f09b0bf9597376183ce6fa9683`. + +Credit DreamingOfClouds' total RDiv and complete-fibre defect method in +CrocSwap/integer-mult-bounds#6937. Its stated constants belong to the older +#6932 word; this package computes the changed source and keeps its +unproved structural/physical premises explicit. The exact-grid statements +of CrocSwap/integer-mult-bounds#6901, the published odd-native-common-grid +at `e45e844303e04947cf6591fb46b43bf8a7bc5356`, and CubeJerry's checked exact +scalar service at `13193a22b1070a74a8580c5d3ea27470443f815a` are separate +predecessors, not proofs of a total rounded service. Credit also the #104 +odd-grid precedent of icekylinx. All eleven unchanged inputs have exact +commit/path/blob/SHA-256 pins in DEPENDENCIES.json. + +## Reproduction and checks + +```bash +python3 -I -B research/query-only-precision-envelope/verify.py --suite all +python3 -I -O -B research/query-only-precision-envelope/verify.py --suite all +``` + +The four suites reproduce deterministic receipts. Critical bounds are +checked by separately coded backward covectors; guards use exact integer +arithmetic. The literal retained exact-table/executor boundary has 35 small +fixtures, 21 accepts and 14 rejects, including late-component no-public-write +failure. Mutants exercise source frames/owners, lifecycle, stage order, +QSELF reintroduction, coordinate-sup versus fibre norms, Lambda's Q^4 +premise, rounding ties and error erasure. Standard library only; no network +or full repository fetch is required for package replay. + +## Limits, costs and kappa status + +**No new kappa. No unconditional theorem. No physical rounded caller.** +The rounded semantics need a total signed RDiv provider and source binder; +the checked exact provider is insufficient on the displayed permitted +state. Native absolute phases, complete-fibre contracts, S1--S5 compiler +structure, owned/history costs and rounded outer analytic recovery remain +explicit obligations. + +An optimistic positive extra-scan model counts every current port and adds +17,165,584 to 826,265,904, yielding 843,431,488. Its 156,568,512 margin is +model compatibility evidence only; code/setup, literal passes, head resets, +staging and historical backing still need the actual physical tariff. +The old conversion charge is retained conservatively rather than credited +as a saving. No selected certificate or unrelated files are changed. + +Prepared for **@CubeJerry**, with substantial **OpenAI assistance** in +reasoning, source analysis, code and verification. Separate AI review is +recorded with exact scope and hashes in REVIEW.md; it is not independent +human or proof-kernel review. diff --git a/research/query-only-precision-envelope/PROOF.md b/research/query-only-precision-envelope/PROOF.md new file mode 100644 index 0000000000..465a5dddd8 --- /dev/null +++ b/research/query-only-precision-envelope/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/query-only-precision-envelope/README.md b/research/query-only-precision-envelope/README.md new file mode 100644 index 0000000000..fb1ea5732d --- /dev/null +++ b/research/query-only-precision-envelope/README.md @@ -0,0 +1,118 @@ +# QUERY-only caller: uniform precision envelope and exact-service boundary + +**Result:** an exact source-specific prefix/suffix envelope for the published +3,095-event QUERY-only caller, including every source cut of all 18 calls +to the current 71,144-event native word. Under explicit complete-fibre +unitary, total rounded-primitive and retained compiler contracts, the actual +source fits `F=p+D` and `W=p+h+2D+3` for D>=19, with five extra fractional +bits below 19 and `W+26` integer temporaries. **No new kappa and no physical +rounded caller are claimed.** + +The same investigation proves a concrete interface obstruction. Native +MOVE37476 may, under an abstract rounded-child contract, return one grid +quantum on register697. Nothing touches that register before SCALE37480 +by `-2/3`, so the existing checked exact service rejects at every grid +precision. This is a contract countermodel, not an observed error of a +retained MOVE implementation, and does not refute the exact-child theorem. + +## Source and novelty + +Canonical base: `7c49fe32c55de02c2c873655c804b16e4c3fef0a`. + +The caller dependency is [CubeJerry's published QUERY-only package](https://github.com/CubeJerry/integer-mult-bounds/tree/617903497387a98f7ca929ad0b6928dd32abffec/research/p104-query-only-interval). +The native dependency is DreamingOfClouds' +[CrocSwap/integer-mult-bounds#6936](https://github.com/CrocSwap/integer-mult-bounds/pull/6936), +head `03626137d0bd57f09b0bf9597376183ce6fa9683`. Eleven unchanged capsule +files are pinned by commit/path/Git blob/SHA-256 in `DEPENDENCIES.json`. + +The complete-fibre defect method and total RDiv premise originate in +DreamingOfClouds' `ROUNDED-DIVISION.md` in +[CrocSwap/integer-mult-bounds#6937](https://github.com/CrocSwap/integer-mult-bounds/pull/6937). +That note uses older #6932 source constants and explicitly asks later words +to recompute them. This package computes the changed source itself, +including incoming defects at each native call, and verifies the current +large-threshold and temporary-width arithmetic. It does not claim the +generic telescope as a new theorem. The exact common-grid lineage of +[CrocSwap/integer-mult-bounds#6901](https://github.com/CrocSwap/integer-mult-bounds/pull/6901), +the published `odd-native-common-grid` at `e45e844303e04947cf6591fb46b43bf8a7bc5356`, +and the checked scalar service at `13193a22b1070a74a8580c5d3ea27470443f815a` +are credited and kept distinct from a total rounded service. + +## Verified statements + +All bounds below are exact-rational triangle certificates, uniform in the +positive column multiplicity under their complete-fibre operator premises. + +| Quantity | Strict bound | +|---|---:| +| Native all-cut mass M_W | 2^237 | +| Native all-cut/final defect coefficients | 2^235 | +| Expanded caller mass M_ctx | 2^355 | +| Expanded caller all-cut defect Sigma_ctx | 2^576 | +| Expanded caller final defect Gamma_ctx | 2^337 | + +Forward propagation scans every source cut and pre-ADD product. Separate +backward covector calculations check critical prefix/suffix witnesses. All +helpers remain arbitrary, independent public inputs; the proof keeps their +stage-specific allocation and every owned lifetime. + +The current parameters are `v=1920`, ambient153, logarithm power2226 and +`H=14161600000000000000`. Exact integer checks give `4096 K_star<2^H`. +The complete retained path accounting then allows the source constants +above while retaining the wrapper's contribution to admission. The source +has 24-bit scalar numerators, so the old 16-bit premise behind `W+18` +cannot simply be imported. + +The optimistic extra-scan model, with all actual port multiplicities, adds +17,165,584 to the previous conditional invoice 826,265,904. Its model total +is 843,431,488, leaving 156,568,512 under the inherited cap. This is an +explicit tariff model; it does not certify literal rounding passes, +historical backing, code/setup constants or the physical recurrence. + +## Reproduction + +From the repository root: + +```bash +python3 -I -B research/query-only-precision-envelope/verify.py --suite all +python3 -I -O -B research/query-only-precision-envelope/verify.py --suite all +``` + +Expected: `PASS_QUERY_ONLY_PRECISION_ENVELOPES`, `..._GUARDS`, +`..._BOUNDARY`, `..._CONTROLS`, followed by +`AUTHENTICATED_SOURCE_FILES 11`. Standard library only; no Git, network, +subprocess or external solver is used by these commands. `VERIFY.json` +registers bounded normal and optimized suites individually. + +`ENVELOPES.json` contains exact rational values and witnesses; +`GUARDS.json` contains threshold/format/model-cost checks; +`BOUNDARY.json` records 35 bounded unchanged-table/executor fixtures +(21 accepts, 14 rejects), including a late-component rejection with no +public writes; `CONTROLS.json` records source and norm counterchecks. +The universal grid obstruction is proved algebraically, not inferred from +these finite fixtures. `PROOF.md` states all premises and limitations. + +## Open next questions + +1. Install a total signed RDiv primitive with exact current source-token + bindings, actual W+26 storage, staging, restoration and historical + backing costs. The retained exact table rejects the displayed admitted + rounded state and therefore cannot serve as that primitive unchanged. +2. Bind every all-column native/Q/Lambda/IDLE contract to literal providers, + including correct absolute phases. Norm preservation alone cannot detect + phase errors. Lambda's one-rounding contract is explicit here. +3. Discharge the retained compiler S1--S5 and complete-job/ownership + premises. The conditional numerical implication does not prove them. +4. Complete the physical tariff and the rounded outer shrink/analytic + recovery changes before assembling a new accepted multiplication bound. + +## Credit and scope + +Prepared for **@CubeJerry**, with substantial OpenAI assistance in mathematics, +source analysis, implementation and testing. Credit DreamingOfClouds for +the current odd word, E-free caller, total rounded-division proposal and +defect-tree organization; credit CubeJerry's cited common-grid and exact +scalar predecessors and icekylinx's #104 odd-grid precedent. Independent +AI review, when recorded in `REVIEW.md`, is not human review or proof-kernel +verification. No selected certificate, upstream PR or unrelated package is +changed by this contribution. diff --git a/research/query-only-precision-envelope/RESULT.json b/research/query-only-precision-envelope/RESULT.json new file mode 100644 index 0000000000..ea96fe6279 --- /dev/null +++ b/research/query-only-precision-envelope/RESULT.json @@ -0,0 +1,182 @@ +{ + "bounds": { + "caller": { + "E_joint_entrance": 340, + "Gamma_context": 337, + "M_caller": 121, + "M_context": 355, + "M_joint_entrance": 119, + "Sigma_caller": 342, + "Sigma_context": 576 + }, + "native": { + "Gamma": 235, + "M": 237, + "Sigma": 235 + } + }, + "exact_service_boundary": { + "accepts": 21, + "coefficient": "-2/3", + "move": 37476, + "physical_cases": 35, + "register": 697, + "rejects": 14, + "scale": 37480, + "scope": "contract countermodel, not an observed error of a retained MOVE implementation" + }, + "guards": { + "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 + } + }, + "immutable_inputs": 11, + "limits": [ + "Explicit complete-fibre operator and total rounded-primitive contracts.", + "Retained S1--S5/compiler/owned interfaces.", + "No installed total RDiv or new source-token binder.", + "Optimistic declared scan model, not a physical tariff.", + "Rounded outer shrink and analytic recovery remain." + ], + "negative_controls": { + "exact_controls": [ + "noninteger_ADD_residual_channel", + "CLEAR_kills_earlier_residual", + "unitary_is_not_coordinate_sup_contractive", + "Lambda_requires_Q_fourth_power", + "projector_is_not_Lambda", + "RDiv_tie_rule_is_not_sign_symmetric" + ], + "physical_and_precision_controls": "BOUNDARY.json and GUARDS.json include further rejection controls", + "source_mutants_rejected": [ + "wrong_actual_MOVE_source_frame", + "public_MOVE_mislabelled_owned", + "dependent_chart_basis", + "CLEAR_erases_public_field", + "joint_stage_order_changed", + "nonretained_QSELF_reintroduced" + ] + }, + "no_new_kappa": true, + "physical_rounded_caller": false, + "review_status": "Separate lead mathematical review found no issue under explicit premises; lead post-freeze code-assisted check not yet claimed.", + "source": { + "caller_commit": "617903497387a98f7ca929ad0b6928dd32abffec", + "caller_events": 3095, + "native_calls": 18, + "native_commit": "03626137d0bd57f09b0bf9597376183ce6fa9683", + "native_events": 71144 + }, + "status": "proved source-specific conditional implication; actual-source contract obstruction", + "unconditional_multiplication": false +} diff --git a/research/query-only-precision-envelope/REVIEW.md b/research/query-only-precision-envelope/REVIEW.md new file mode 100644 index 0000000000..0be6b27f0f --- /dev/null +++ b/research/query-only-precision-envelope/REVIEW.md @@ -0,0 +1,42 @@ +# Verification and review record + +Prepared for @CubeJerry with substantial OpenAI assistance. + +## Author checks + +The four bounded package suites reproduce exact source envelopes, integer +threshold/format/model-cost guards, physical exact-scalar boundary fixtures +and adverse controls. Separate backward covector code checks the critical +forward prefix/suffix witnesses. No imported predecessor checker performs +the new forward or reverse certificate. The exact table/executor in the +boundary test are authenticated unchanged predecessor code, compared with +a direct integer divisibility/range oracle. + +These methods have different failure modes, but all were prepared with AI +assistance and are not human review or formal kernel acceptance. Native +frame unitarity, full compiler interfaces, total rounded services and a +physical cost certificate are explicit premises or open obligations. + +## Lead cross-review + +The lead separately read the complete proof and the pinned rounded note's +section 3 path accounting. The review found no issue under the stated +complete-fibre, actual-input residual, S1--S5 and unitary/contractive +normalizer premises. It independently checked the small-D fourth-power +guard, the large-D logarithmic inequality, and the all-F -2/3 contract +countermodel. It specifically retained the separate raw nodes, N(D+3) +wrapper admission bound, W+26 temporary distinction and the explicitly +optimistic +17,165,584 tariff. + +This is a separate AI mathematical review, not independent human or +proof-kernel review. At package freeze the lead's planned separate +code-assisted source/threshold check had not yet been reported; none is +claimed here. Any later lead receipt belongs to the publication record. + +Author-recorded snapshot hashes at this review checkpoint: + +- `PROOF.md`: `8ddafd9a4c5b51d4c0e3f9b4a9eba27712335a16de1868ba156557344af86e63` +- `envelopes.py`: `783da6b5b450fc07434946cb9ec86070dfee01df6b5fa1c385cb024def2c9a9f` +- `guards.py`: `004393aea68177dac6378295a60a3f4a9a236068c939c5825eea41c58097fc08` +- `boundary.py`: `ccca25922974b99828533042a37809251c8c4a362c6e737f6336f88e443ac8e8` +- `controls.py`: `83a4fc00db2853a18e8a36297e0fb423f4f0d9bf78c752fdabc120f065a16024` diff --git a/research/query-only-precision-envelope/SOURCES.json b/research/query-only-precision-envelope/SOURCES.json new file mode 100644 index 0000000000..75ea7c3d55 --- /dev/null +++ b/research/query-only-precision-envelope/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/query-only-precision-envelope/TASK.json b/research/query-only-precision-envelope/TASK.json new file mode 100644 index 0000000000..2427decd06 --- /dev/null +++ b/research/query-only-precision-envelope/TASK.json @@ -0,0 +1,93 @@ +{ + "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-assigned wave 6 follows the frozen QUERY-only interval with a distinct precision_tape/caller interface lemma; older rounded constants belong to a different source.", + "actual_scope": "All-cut and returned-error envelopes for the exact 3095-event caller plus all 18 current 71144-event native words; conditional common-grid/signed guard, complete declared scan-model census, and an actual-source checked-exact division obstruction.", + "bottleneck_link": "Reduces a current precision_tape obligation to explicit total-service, complete-fibre and compiler premises; distinguishes exact and rounded child contracts at a real source cut.", + "stop_rule": "Stop after the source-specific precision implication and exact-service boundary; no new endpoint proof, physical full-caller admission, helper search or kappa claim.", + "evidence": "PROOF.md, ENVELOPES.json, GUARDS.json, BOUNDARY.json, CONTROLS.json; independent backward covectors, exact guard comparisons and unchanged-table physical boundary fixtures.", + "author": "@CubeJerry", + "ai_assistance": "Substantial OpenAI assistance in mathematics, source analysis, implementation and verification. Separate AI review is not independent human or proof-kernel acceptance.", + "outcome": "completed", + "open_questions": [ + { + "question": "Construct and install a total RDiv service for the exact current occurrence tokens and common format.", + "why_it_matters": "The unchanged checked exact service rejects a state allowed by a rounded-child error contract.", + "first_step": "Implement signed numerator formation, floor/tie semantics, staging, geometry and full source-token dispatch with W+26 temporaries.", + "blocked_by": "Unfinished physical service, source binding and complete bit-cost proof." + }, + { + "question": "Bind complete-fibre numerical contracts to all-column native and Lambda providers.", + "why_it_matters": "Norm certificates do not establish absolute phases, provider domains or per-primitive rounding counts.", + "first_step": "Prove whole-field return and one-rounding Lambda error contracts for the actual primitive schedules.", + "blocked_by": "native_all_columns, precision_tape and owned/history interfaces." + }, + { + "question": "Discharge retained compiler structure and rounded outer recovery with an actual complete tariff.", + "why_it_matters": "A conditional grid implication and an optimistic scan model do not close a complete multiplication theorem.", + "first_step": "Audit S1--S5, literal wrapper order, old backing and every rounding/setup pass against physical code.", + "blocked_by": "compiler, owned_erasure and analytic_recovery assumptions." + } + ] +} diff --git a/research/query-only-precision-envelope/VERIFY.json b/research/query-only-precision-envelope/VERIFY.json new file mode 100644 index 0000000000..899e6d3dad --- /dev/null +++ b/research/query-only-precision-envelope/VERIFY.json @@ -0,0 +1,121 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/query-only-precision-envelope/data/caller.json", + "research/query-only-precision-envelope/reference/QUERY-PROOF.md", + "research/query-only-precision-envelope/reference/QUERY-RESULT.json", + "research/query-only-precision-envelope/data/word.json.gz", + "research/query-only-precision-envelope/reference/EXACT-GRID-6901.md", + "research/query-only-precision-envelope/reference/ROUNDED-DIVISION-6937.md", + "research/query-only-precision-envelope/reference/NATIVE-PROOF.md", + "research/query-only-precision-envelope/reference/NATIVE-check.py", + "research/query-only-precision-envelope/reference/ODD-COMMON-GRID.md", + "research/query-only-precision-envelope/vendor/exact_scalar_tables.py", + "research/query-only-precision-envelope/vendor/machine.py" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "research/query-only-precision-envelope/verify.py", + "--suite", + "envelopes" + ], + "timeout_seconds": 120, + "checks": "Normal envelopes source-specific conditional precision certificate and controls." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "research/query-only-precision-envelope/verify.py", + "--suite", + "guards" + ], + "timeout_seconds": 120, + "checks": "Normal guards source-specific conditional precision certificate and controls." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "research/query-only-precision-envelope/verify.py", + "--suite", + "boundary" + ], + "timeout_seconds": 120, + "checks": "Normal boundary source-specific conditional precision certificate and controls." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "research/query-only-precision-envelope/verify.py", + "--suite", + "controls" + ], + "timeout_seconds": 120, + "checks": "Normal controls source-specific conditional precision certificate and controls." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "research/query-only-precision-envelope/verify.py", + "--suite", + "envelopes" + ], + "timeout_seconds": 120, + "checks": "Optimized envelopes source-specific conditional precision certificate and controls." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "research/query-only-precision-envelope/verify.py", + "--suite", + "guards" + ], + "timeout_seconds": 120, + "checks": "Optimized guards source-specific conditional precision certificate and controls." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "research/query-only-precision-envelope/verify.py", + "--suite", + "boundary" + ], + "timeout_seconds": 120, + "checks": "Optimized boundary source-specific conditional precision certificate and controls." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "research/query-only-precision-envelope/verify.py", + "--suite", + "controls" + ], + "timeout_seconds": 120, + "checks": "Optimized controls source-specific conditional precision certificate and controls." + } + ] +} diff --git a/research/query-only-precision-envelope/boundary.py b/research/query-only-precision-envelope/boundary.py new file mode 100644 index 0000000000..989db2c363 --- /dev/null +++ b/research/query-only-precision-envelope/boundary.py @@ -0,0 +1,125 @@ +"""Source-cut countermodel and literal retained exact-table boundary controls. + +The one-grid child defect is permitted by an abstract error contract. This +module does not claim an actual retained MOVE implementation produces it. +Prepared for @CubeJerry with substantial OpenAI assistance. Apache-2.0. +""" +from fractions import Fraction as F +from source_binding import need, sources, load_vendor + + +class Tape: + def __init__(self, machine, bits=(), origin=17): + self.machine = machine + self.origin = self.pos = origin + self.cells = {origin - 1: machine.LEFT, origin - 2: 91} + self.cells.update({origin + i: s for i, s in enumerate(bits)}) + self.actions = 0 + + def tick(self): + need(self.pos >= self.origin - 1, "no ancestor access") + self.actions += 1 + + def read(self): + self.tick() + return self.cells.get(self.pos, self.machine.BLANK) + + def write(self, symbol): + self.tick() + need(self.pos >= self.origin and 0 <= symbol < 7, "protected marker/alphabet") + self.cells[self.pos] = symbol + + def move(self, step): + self.tick() + need(step in (-1, 1), "unit physical head move") + self.pos += step + need(self.pos >= self.origin - 1, "no ancestor crossing") + + def body(self): + end = self.origin + while self.cells.get(end, self.machine.BLANK) != self.machine.BLANK: + end += 1 + return tuple(self.cells.get(k, self.machine.BLANK) for k in range(self.origin, end)) + + def sentinel_ok(self): + return self.cells[self.origin - 1] == self.machine.LEFT and self.cells[self.origin - 2] == 91 + + +def encode(values, width): + symbols = [] + for value in values: + need(-(1 << (width - 1)) <= value < (1 << (width - 1)), "signed fixture input") + symbols.extend((value >> j) & 1 for j in range(width)) + symbols.append(2) + return tuple((s >> k) & 1 for s in symbols for k in (2, 1, 0)) + + +def decode(bits, width): + need(len(bits) % 3 == 0, "complete physical codewords") + symbols = [4 * bits[i] + 2 * bits[i + 1] + bits[i + 2] for i in range(0, len(bits), 3)] + need(len(symbols) % (width + 1) == 0, "complete numeric records") + out = [] + for i in range(0, len(symbols), width + 1): + b = symbols[i:i + width] + need(all(z in (0, 1) for z in b) and symbols[i + width] == 2, "signed fixture encoding") + out.append(sum(z << j for j, z in enumerate(b)) - (b[-1] << width)) + return tuple(out) + + +def run(): + _, word = sources() + expected = [["MOVE", 697, 1042, 591, False], + ["MOVE", 1334, 1042, 1046, False], + ["MOVE", 901, 565, 591, False], + ["SCALE", 1334, "1/2", 1046], + ["SCALE", 697, "-2/3", 591]] + need(word["program"][37476:37481] == expected, "exact five-event obstruction cut") + need(all(697 not in e[1:3] for e in expected[1:4]), "no intervening access to the defect field") + q = F(-2, 3) + need(q.denominator != 1 and F(q.numerator, q.denominator).denominator == 3, + "one-grid numerator remains nonintegral for every F") + # Scalar reference: total nearest RDiv is a DIFFERENT operation. + rounded = (q.numerator + q.denominator // 2) // q.denominator + need(rounded == -1 and abs(F(rounded) - q) <= F(1, 2), "RDiv alternative and residual") + machine = load_vendor("precision_boundary_machine", "vendor/machine.py") + tables = load_vendor("precision_boundary_tables", "vendor/exact_scalar_tables.py") + table, receipt = tables.compile_scalar("SCALE", q) + cases = [] + # Distinct origins and initially dirty contiguous private work. Exact failed + # runs are deliberately not advertised as restored/erased. + for width in range(3, 10): + for values in ((1, 0), (3, 1), (0, 0), (3, 0), (-3, 0)): + target = Tape(machine, encode(values, width), 17) + work = [Tape(machine, (1, 0, 1, 1), 41), Tape(machine, (0, 1), 63)] + before = target.body() + failure = None + try: + for t in work: + machine.retire(t) + machine.execute_table(table, (target, *work)) + for t in work: + machine.retire(t) + except ValueError as exc: + failure = str(exc) + ideal = tuple(q * v for v in values) + admissible = all(v.denominator == 1 and -(1 << (width - 1)) <= v < (1 << (width - 1)) for v in ideal) + need((failure is None) == admissible, "independent divisibility/range oracle") + if admissible: + need(decode(target.body(), width) == tuple(map(int, ideal)), "exact physical quotient") + need(all(t.pos == t.origin for t in (target, *work)), "success heads reset") + need(all(not t.body() for t in work), "success work erased") + else: + need(target.body() == before, "rejection before any public component commit") + need(all(t.sentinel_ok() for t in (target, *work)), "ancestor sentinels") + cases.append(dict(width=width, input=list(values), accepted=admissible, + actions=sum(t.actions for t in (target, *work)))) + need(len(cases) == 35 and sum(c["accepted"] for c in cases) == 21, "complete bounded physical coverage") + return dict(source_move=37476, source_odd_scale=37480, register=697, + coefficient="-2/3", intervening_events=3, + universal_countermodel="one admitted quantum after MOVE; all other residuals zero", + caveat="contract countermodel, not an observed error of a retained MOVE implementation", + rounded_alternative=dict(output_numerator=rounded, residual_in_quanta=str(F(rounded) - q)), + physical=dict(cases=cases, accepted=21, rejected=14, table_instructions=len(table), + table_receipt=receipt, + scope="unchanged generic exact SCALE table/executor; no new source-token binder", + failure_contract="public unchanged; private work and heads may be unrestored")) diff --git a/research/query-only-precision-envelope/controls.py b/research/query-only-precision-envelope/controls.py new file mode 100644 index 0000000000..a6b2f1333d --- /dev/null +++ b/research/query-only-precision-envelope/controls.py @@ -0,0 +1,73 @@ +"""Bounded adverse controls for source guards and the numerical contract seam. + +Prepared for @CubeJerry with substantial OpenAI assistance. Apache-2.0. +""" +from copy import deepcopy +from fractions import Fraction as F +from source_binding import need, sources +from envelopes import validate_word, native_envelope, caller_envelope, native_adjoint + + +def run(): + caller, word = sources() + rejected = [] + + def reject(label, f): + try: + f() + except ValueError: + rejected.append(label) + return + raise ValueError("negative control was accepted: " + label) + + mutant = deepcopy(word) + mutant["program"][37476][2] = 3 + reject("wrong_actual_MOVE_source_frame", lambda: validate_word(mutant)) + mutant = deepcopy(word) + mutant["program"][37476][4] = True + reject("public_MOVE_mislabelled_owned", lambda: validate_word(mutant)) + mutant = deepcopy(word) + mutant["frames"][0].append(mutant["frames"][0][0]) + reject("dependent_chart_basis", lambda: validate_word(mutant)) + mutant = deepcopy(word) + cut = next(i for i, e in enumerate(mutant["program"]) if e[0] == "CLEAR") + mutant["program"][cut][1] = 0 + reject("CLEAR_erases_public_field", lambda: validate_word(mutant)) + wp, _ = native_envelope(word) + mutant = deepcopy(caller) + cut = next(i for i, e in enumerate(mutant["events"]) if e[0] == "J") + mutant["events"][cut][1] = 2 + reject("joint_stage_order_changed", lambda: caller_envelope(mutant, wp, word)) + mutant = deepcopy(caller) + cut = next(i for i, e in enumerate(mutant["events"]) if e[1] == "QUERY") + mutant["events"][cut][1] = "QSELF" + reject("nonretained_QSELF_reintroduced", lambda: caller_envelope(mutant, wp, word)) + # Adjoint unit tests expose exactly which operation injects a residual. These + # tiny words do not pretend to satisfy the full frozen-source lifecycle. + tiny = dict(public=2, owned_fields=0, program=[["ADD", 0, 1, "1/2", 0]]) + mass, error, active = native_adjoint(tiny, dict(register=0, factor="1", cut=1)) + need((mass, error, active) == (F(3, 2), F(1), 1), "noninteger ADD site retained") + tiny["program"].append(["CLEAR", 0, 0]) + need(native_adjoint(tiny, dict(register=0, factor="1", cut=2)) == (0, 0, 0), + "zeroing kills every earlier error channel") + # Exact Gaussian arithmetic represented by (real, imaginary) rational pairs. + def add(z, w): return (z[0] + w[0], z[1] + w[1]) + def mul(z, w): return (z[0] * w[0] - z[1] * w[1], z[0] * w[1] + z[1] * w[0]) + def norm2(z): return z[0] ** 2 + z[1] ** 2 + c00, c01 = (F(1, 2), F(1, 2)), (F(1, 2), F(-1, 2)) + need(norm2(add(c00, mul(c01, (0, 1)))) == 2, + "unitary Gaussian can amplify coordinate-sup norm") + need(norm2(c00) + norm2(c01) == 1, "same Gaussian row has Euclidean norm one") + # Q=(3+4i)/5 is unitary but not order four. Lambda need not be unitary. + q = (F(3, 5), F(4, 5)) + lam = add(c00, mul(c01, mul(q, q))) + need(norm2(q) == 1 and norm2(lam) == F(49, 25), "Q^4 premise is necessary for Lambda norm one") + need((F(1) + -1) / 2 == 0, "projector Lambda vanishes in q=i sector") + def rdiv(a, b, m): return (a * m + b // 2) // b + need(rdiv(1, 2, 1) == 1 and rdiv(1, 2, -1) == 0, + "nearest RDiv with upward ties is not odd") + return dict(source_mutants_rejected=rejected, + exact_controls=["noninteger_ADD_residual_channel", "CLEAR_kills_earlier_residual", + "unitary_is_not_coordinate_sup_contractive", "Lambda_requires_Q_fourth_power", + "projector_is_not_Lambda", "RDiv_tie_rule_is_not_sign_symmetric"], + physical_and_precision_controls="BOUNDARY.json and GUARDS.json include further rejection controls") diff --git a/research/query-only-precision-envelope/data/caller.json b/research/query-only-precision-envelope/data/caller.json new file mode 100644 index 0000000000..cf55f42710 --- /dev/null +++ b/research/query-only-precision-envelope/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/query-only-precision-envelope/data/word.json.gz b/research/query-only-precision-envelope/data/word.json.gz new file mode 100644 index 0000000000..d93e67ca76 Binary files /dev/null and b/research/query-only-precision-envelope/data/word.json.gz differ diff --git a/research/query-only-precision-envelope/envelopes.py b/research/query-only-precision-envelope/envelopes.py new file mode 100644 index 0000000000..70c8ca2376 --- /dev/null +++ b/research/query-only-precision-envelope/envelopes.py @@ -0,0 +1,294 @@ +"""Exact positive forward envelopes with independent backward cut checks. + +These are scalar triangle bounds under the stated complete-fibre unitary +contracts. They neither simulate rounding nor establish native provider admission. +Prepared for @CubeJerry with substantial OpenAI assistance. Apache-2.0. +""" +from collections import Counter +from fractions import Fraction as F +from source_binding import need, sources, strict_power, fraction_string, oddpart + + +def frame_span(basis): + s = {0} + for v in basis: + need(isinstance(v, int) and 0 < v < 512 and v not in s, "independent frame basis") + s |= {u ^ v for u in tuple(s)} + return frozenset(s) + + +def validate_word(word): + n, owned_count = word["public"], word["owned_fields"] + need(n == len(word["initial"]) == len(word["final"]), "public frame lists") + spans = list(map(frame_span, word["frames"])) + cur = list(word["initial"]) + [None] * owned_count + owned, zero = set(), set(range(n, n + owned_count)) + life = peak = 0 + counts = Counter() + scalar = Counter() + max_num = max_den = 0 + for i, e in enumerate(word["program"]): + op, r = e[:2] + need(0 <= r < len(cur), "word role at " + str(i)) + counts[op] += 1 + if op == "INIT": + need(len(e) == 3 and r >= n and r not in owned and cur[r] is None, + "fresh owned INIT at " + str(i)) + need(0 <= e[2] < len(spans), "INIT frame") + owned.add(r); zero.add(r); cur[r] = e[2] + life += 1; peak = max(peak, len(owned)) + elif op == "CLEAR": + need(len(e) == 3 and r in owned and cur[r] == e[2], "owned CLEAR") + owned.remove(r); zero.add(r); cur[r] = None + elif op == "MOVE": + _, _, a, b, private = e + need(cur[r] == a and bool(private) == (r in owned), "MOVE source/owner") + need(0 <= b < len(spans), "MOVE destination") + need((spans[a] < spans[b] or spans[b] < spans[a]) if private + else spans[a] < spans[b], "strict source frame nesting") + cur[r] = b + # A rounded child need not preserve exact zero. + zero.discard(r) + else: + need(op in ("ADD", "COPY", "SCALE"), "known native operation") + q = F(e[2] if op == "SCALE" else e[3]) + need(q and abs(q) + 1 < 2 ** 16, "nonzero bounded source coefficient") + need(cur[r] == e[-1] and cur[r] is not None, "scalar live frame") + if op != "SCALE": + s = e[2] + need(0 <= s < len(cur) and s != r and cur[s] == cur[r], "same-frame source") + if op == "COPY": + need(r in owned and r in zero, "COPY into freshly exact zero") + zero.discard(r) + max_num = max(max_num, abs(q.numerator)) + max_den = max(max_den, q.denominator) + scalar["noninteger" if q.denominator > 1 else "integer"] += 1 + scalar["odd" if oddpart(q.denominator) > 1 else "dyadic"] += 1 + need(not owned and cur[:n] == word["final"], "all owned returned; declared final frames") + need((life, peak, owned_count) == (54, 43, 51), "source lifecycle census") + return dict(events=len(word["program"]), public=n, owned_labels=owned_count, + lifetimes=life, peak_owned=peak, opcodes=dict(counts), scalars=dict(scalar), + max_numerator=max_num, numerator_bits=max_num.bit_length(), + max_denominator=max_den, denominator_bits=max_den.bit_length()) + + +def summarize(values): + return {k: {"exact": fraction_string(v[0]), "strict_power_of_two": strict_power(v[0]), + "witness": v[1]} for k, v in values.items()} + + +def native_envelope(word): + census = validate_word(word) + n, size = word["public"], word["public"] + word["owned_fields"] + mass = [F(i < n) for i in range(size)] + error = [F(0) for _ in range(size)] + peaks = {"M": (F(1), {"cut": 0, "register": 0, "factor": "1"}), + "Sigma": (F(0), {"cut": 0, "register": 0, "factor": "1"})} + + def note(name, value, cut, register, factor=F(1), kind="stored"): + if value > peaks[name][0]: + peaks[name] = (value, dict(cut=cut, register=register, + factor=str(factor), kind=kind)) + + for i, e in enumerate(word["program"]): + op, r = e[:2] + if op == "MOVE": + error[r] += 1 + elif op in ("INIT", "CLEAR"): + mass[r] = error[r] = F(0) + else: + q = abs(F(e[2] if op == "SCALE" else e[3])) + if op == "SCALE": + mass[r] *= q; error[r] *= q + else: + s = e[2] + note("M", q * mass[s], i, s, q, "pre-add-product") + note("Sigma", q * error[s], i, s, q, "pre-add-product") + mass[r] += q * mass[s]; error[r] += q * error[s] + if q.denominator > 1: + error[r] += 1 + note("M", mass[r], i + 1, r) + note("Sigma", error[r], i + 1, r) + r = max(range(n), key=error.__getitem__) + peaks["Gamma"] = (error[r], dict(cut=len(word["program"]), register=r, factor="1", kind="public-return")) + checks = {} + for name, (value, witness) in peaks.items(): + m, d, active = native_adjoint(word, witness) + need((m if name == "M" else d) == value, "backward native witness: " + name) + checks[name] = dict(entrance_mass=str(m), residual_mass=str(d), active_residual_sites=active) + return peaks, dict(census=census, bounds=summarize(peaks), independent_adjoint=checks) + + +def native_adjoint(word, witness): + """Transpose recurrence from one cut, not a second forward-state run.""" + size = word["public"] + word["owned_fields"] + lam = [F(0) for _ in range(size)] + lam[witness["register"]] = F(witness["factor"]) + residual, active = F(0), 0 + for e in reversed(word["program"][:witness["cut"]]): + op, r = e[:2] + if op in ("INIT", "CLEAR"): + lam[r] = F(0) + elif op == "MOVE": + residual += lam[r]; active += bool(lam[r]) + else: + q = abs(F(e[2] if op == "SCALE" else e[3])) + if q.denominator > 1: + residual += lam[r]; active += bool(lam[r]) + if op == "SCALE": + lam[r] *= q + else: + lam[e[2]] += q * lam[r] + return sum(lam[:word["public"]]), residual, active + + +def caller_envelope(caller, word_peaks, word): + """Contract J only at its proved exact endpoint; include each native interior.""" + mw, sw, gw = (word_peaks[k][0] for k in ("M", "Sigma", "Gamma")) + size = caller["roles"] + mass, error = [F(1)] * size, [F(0)] * size + peaks = {"M_caller": (F(1), {}), "Sigma_caller": (F(0), {}), + "M_joint_entrance": (F(1), {}), "E_joint_entrance": (F(0), {}), + "M_context": (F(1), {}), "Sigma_context": (F(0), {})} + sites = Counter() + j_order = [] + log = [] + + def note(name, value, i, r=None, *, cut=None, factor=F(1), kind="stored"): + if value > peaks[name][0]: + peaks[name] = (value, dict(event=i, register=r, cut=i + 1 if cut is None else cut, + factor=str(factor), kind=kind)) + + for i, e in enumerate(caller["events"]): + ty = e[0] + if ty == "J": + _, j, ar, br = e + need(len(ar) == 4 and len(br) == 4 and br[2:] == ["-1", "1/2"], "exact J source signature") + u, v, x, y = ar; s, t = br[:2] + regs = (u, v, x, y, s, t) + need(len(set(regs)) == 6 and all(0 <= r < size for r in regs), "six distinct J roles") + need(all(0 <= r < 38 for r in ar) and all(38 <= r < 76 for r in br[:2]), + "current type-local J main binding") + mi, ei = max([F(1)] + [mass[r] for r in regs]), max(error[r] for r in regs) + mr, er = max(regs, key=mass.__getitem__), max(regs, key=error.__getitem__) + note("M_joint_entrance", mi, i, mr, cut=i) + note("E_joint_entrance", ei, i, er, cut=i) + note("M_context", mw * mi, i) + note("Sigma_context", mw * ei + sw, i) + # Each stage's 1,061 arbitrary public helper inputs are distinct raw + # inputs, not zero; their initial bound is 1 and prior defect is 0. + out_m = (mass[u], mass[v] + mass[u], mass[x] + mass[y], mass[y], + mass[s] + mass[t], (mass[s] + mass[t]) / 2) + out_e = (error[u], error[v] + error[u], error[x] + error[y], error[y], + error[s] + error[t], (error[s] + error[t]) / 2) + for r, a, b in zip(regs, out_m, out_e): + mass[r], error[r] = a, b + gw + j_order.append(j); sites["J"] += 1 + log.append(dict(event=i, stage=j, entrance_mass=str(mi), entrance_defect=str(ei))) + else: + need(ty in ("A", "B"), "known caller type") + op, r = e[1:3] + off = caller["types"][ty]["offset"] + count = caller["types"][ty]["roles"] + need(off <= r < off + count, "type-local target") + sites[op] += 1 + if op == "SWAP": + s = e[3] + need(off <= s < off + count and s != r, "type-local SWAP") + mass[r], mass[s] = mass[s], mass[r] + error[r], error[s] = error[s], error[r] + elif op in ("LAMBDA", "IDLE_ONE"): + if op == "LAMBDA": + need(e[3] in (-1, 1), "unit Lambda sign") + else: + need(len(e[3]) == len(set(e[3])) and all(1 <= k <= 18 for k in e[3]), "idle mask") + error[r] += 1 + elif op == "QUERY": + s = e[3] + need(off <= s < off + count and s != r and e[4] == -1, "retained negative query") + mass[r] += mass[s]; error[r] += error[s] + 1 + elif op == "ADD": + s, q = e[3], abs(F(e[4])) + need(off <= s < off + count and r != s and q, "type-local ADD") + note("M_caller", q * mass[s], i, s, cut=i, factor=q, kind="pre-add-product") + note("Sigma_caller", q * error[s], i, s, cut=i, factor=q, kind="pre-add-product") + mass[r] += q * mass[s]; error[r] += q * error[s] + (q.denominator > 1) + sites["noninteger_scalar"] += q.denominator > 1 + elif op == "SCALE": + q = abs(F(e[3])); need(q, "nonzero caller SCALE") + mass[r] *= q; error[r] = q * error[r] + (q.denominator > 1) + sites["noninteger_scalar"] += q.denominator > 1 + else: + raise ValueError("non-retained caller opcode: " + str(op)) + for r in range(size): + note("M_caller", mass[r], i, r) + note("Sigma_caller", error[r], i, r) + need(j_order == list(range(1, 19)), "exact eighteen native calls") + # Completed helper outputs have ideal norm <=1 and defect <=gw; maximum + # over independent helper fields does not multiply by 1,061 or by 18. + peaks["M_context"] = max(peaks["M_context"], peaks["M_caller"], key=lambda a: a[0]) + peaks["Sigma_context"] = max(peaks["Sigma_context"], peaks["Sigma_caller"], key=lambda a: a[0]) + ri = max(range(size), key=error.__getitem__) + need(error[ri] >= gw, "main output dominates helper-return defect in this source") + peaks["Gamma_context"] = (error[ri], dict(register=ri, cut=len(caller["events"]), factor="1", kind="public-return")) + need(len(caller["types"]["A"]["ports"]) == 96 and len(caller["types"]["B"]["ports"]) == 8, + "current physical type multiplicities") + mains = set(word["live"]) | {r + 112 for r in word["live"]} | set(word["hosted"]["X2"]) | set(word["hosted"]["Y2"]) + need(len(mains) == 400 and word["public"] - len(mains) == 1061, "fresh per-stage helper census") + adjoints = {} + for name in ("M_caller", "Sigma_caller", "M_joint_entrance", "E_joint_entrance", "Gamma_context"): + value, witness = peaks[name] + m, d, j_part, primitive_part = caller_adjoint(caller, witness, gw) + need((m if name.startswith("M_") else d) == value, "backward caller witness: " + name) + adjoints[name] = dict(entrance_mass=str(m), residual_mass=str(d), + joint_coefficient=str(j_part), primitive_coefficient=str(primitive_part)) + return peaks, dict(bounds=summarize(peaks), sites=dict(sites), joint_entries=log, + independent_adjoint=adjoints, + physical_main_inputs=3952, fresh_arbitrary_helpers=18 * 1061, + helper_allocation_premise="distinct (stage, helper) public inputs as in frozen caller proof") + + +def caller_adjoint(caller, witness, gamma_word): + lam = [F(0)] * caller["roles"] + lam[witness["register"]] = F(witness["factor"]) + joint, primitive = F(0), F(0) + for e in reversed(caller["events"][:witness["cut"]]): + if e[0] == "J": + u, v, x, y = e[2]; s, t = e[3][:2] + joint += sum(lam[r] for r in (u, v, x, y, s, t)) + a, b = lam[s], lam[t] + lam[u] += lam[v] + lam[y] += lam[x] + lam[s] = lam[t] = a + b / 2 + continue + op, r = e[1:3] + if op == "SWAP": + s = e[3]; lam[r], lam[s] = lam[s], lam[r] + elif op in ("LAMBDA", "IDLE_ONE"): + primitive += lam[r] + elif op == "QUERY": + primitive += lam[r]; lam[e[3]] += lam[r] + else: + q = abs(F(e[3] if op == "SCALE" else e[4])) + if q.denominator > 1: + primitive += lam[r] + if op == "SCALE": + lam[r] *= q + else: + lam[e[3]] += q * lam[r] + return sum(lam), joint * gamma_word + primitive, joint, primitive + + +def run(): + caller, word = sources() + wp, wr = native_envelope(word) + cp, cr = caller_envelope(caller, wp, word) + expected_w = {"M": 237, "Sigma": 235, "Gamma": 235} + expected_c = {"M_caller": 121, "Sigma_caller": 342, "M_joint_entrance": 119, + "E_joint_entrance": 340, "M_context": 355, "Sigma_context": 576, + "Gamma_context": 337} + for k, p in expected_w.items(): + need(strict_power(wp[k][0]) == p, "frozen native bound " + k) + for k, p in expected_c.items(): + need(strict_power(cp[k][0]) == p, "frozen caller bound " + k) + return dict(native=wr, caller=cr) diff --git a/research/query-only-precision-envelope/guards.py b/research/query-only-precision-envelope/guards.py new file mode 100644 index 0000000000..0b0b7f0c0b --- /dev/null +++ b/research/query-only-precision-envelope/guards.py @@ -0,0 +1,87 @@ +"""Exact source constants, threshold comparisons and conditional tariff census. + +No floating point and no construction of 2**H. This does not install RDiv. +Prepared for @CubeJerry with substantial OpenAI assistance. Apache-2.0. +""" +from collections import Counter +from fractions import Fraction as F +import json +from source_binding import ROOT, need, oddpart, sources + +V = 1920 +H_STEP = 10 ** 14 +H_INDEX = 141616 +H = H_STEP * H_INDEX +LP = 2226 + + +def scalar_surcharge(q): + """Declared optimistic model: one offset scan and three extra odd scans.""" + q = F(q) + if q.denominator == 1: + return 0 + return 4 * (q.denominator.bit_length() + 1) * (1 + 3 * (oddpart(q.denominator) > 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/query-only-precision-envelope/reference/EXACT-GRID-6901.md b/research/query-only-precision-envelope/reference/EXACT-GRID-6901.md new file mode 100644 index 0000000000..7e0793c4d0 --- /dev/null +++ b/research/query-only-precision-envelope/reference/EXACT-GRID-6901.md @@ -0,0 +1,457 @@ +# A fixed-root exact grid through the current uniform compiler + +Prepared for @CubeJerry with substantial OpenAI Codex assistance. Apache-2.0. +Written source-bound precision implication; no formal verification, physical +supplier admission, or new multiplication exponent. **No new κ.** + +Main current-source format: fractional bits F=p+d, signed component bits +W=p+h+2d+3, and W+6 numerator bits, after the paid root boundary. The +context bound below proves this explicit corollary without constructing N. + +## 1. Exact object and separated premises + +Canonical base: `7c49fe32c55de02c2c873655c804b16e4c3fef0a`. +`SOURCES.json` pins CrocSwap/integer-mult-bounds#6030's current RESULT, the +chronological tensor product, finite integer compiler, actual lockstep control +source, and ordinary complete-row construction. The raw current 18-local-call +caller has ambient145, paid maximum72 and paid rank mass240152. It is a +mixed-target caller, **not** a uniform rank145 recursive native endpoint. +Its strictification uses chronological power v=1024, cutoff16^v, productive +floor17^v and ambient145^v. Since145<2^8 and H>8192, the chosen N is +larger than that product ambient without constructing either huge integer. The chosen uniform compiler has + + H=65807000000000, N=2^H. + +These are current RESULT fields, not older profile constants. No verifier +constructs N, the expanded word, replication factor or owned-field inventory. +The raw rule has rank1 targets; k_min>=2 below applies only after the pass. + +The raw relative-prefix fact is the published +`selected-caller-quantizer-transparency` theorem at fork commit +`c46339035fccd571effb48434d80f572e20f1092`: its exterior coefficients have +common denominator16 and l1 mass at most8500, including separate pre-ADD +products. Its independent positive Gaussian endpoints and absolute phases +use the published native theorem `e56a5bcf239fa0cd4ee57459af04c0ba7acb2c03`. +`DEPENDENCIES.json` authenticates byte-identical proof/receipt exports. +CrocSwap/integer-mult-bounds#6878, fork commit +`41febf890fbbb852c6059d4c0cc8c593ae9dfa5c`, supplies the full occurrence maps; +its proof is also retained. This verifier authenticates those dependencies; +it does not rerun their native/scalar certificate generation. + +Consider the ideal algebraic source produced by the actual chronological +product, completion/splitting, integer lockstep compiler, and rank-one-leaf +ordinary substitution. Retain precisely these **nonprecision** interfaces: + +1. Credited arbitrary-input native equalities hold with complete spectators. + INIT/CLEAR have their ideal owned-reset semantics. Every field has its + declared owner; a nonzero copied center lent to a child is that same + correlated field, not a new input. Source deficits are distinct actual entrance + fields, carrying their inherited root expansions. A child's private banks remain separate until cleared. +2. Whole-job embeddings and inverse returns retain the full root selected + factor, including ancestor remainder axes. Interpreted operations finish + before another instruction consumes their fields. Ordinary route/XOR tape + interiors are not identified with numerical Clifford prefixes: their + specified encoded return must occur first. +3. The true external ROW factor remains separate. `u=b*g+w` selects only + whole ROW fibers of all root selected coordinates. Row counts may be + non-powers of two. Original input padding is zero. A packed routine's collapsed prefix + can contain ancestor remainder bits and is not thereby the true ROW label. +4. Role permutations may use completed swaps + `x+=y; y-=x; x+=y; y=-y` on distinct fields. No child, further swap or + consuming instruction interrupts such an exchange. Other compiler + adapters are the credited complete monomial/positive-job constructions; + no new scalar division or weighted-copy rule is inserted. C stages + evaluate complete pair numerators before exact division. + +These are ideal semantics, ownership, layout and instruction-cut hypotheses. +They do **not** assume a finite common grid, a word bound, O(p) native code, +a selected tariff, or FINITE-PRECOMPILATION §1 item4's precision/tape closure. +Finiteness follows separately from constructive rank descent and lockstep. + +## 2. Statement and root boundary + +Start the ordinary root **after reserved-axis preprocessing**. Let d>=1 be +all its selected binary coordinates, kept as one fixed factor throughout +recursion even when a descendant calls some of them spectators. Each original +productive real/imaginary component, on every complete external row, is on +the 2^-p grid and has absolute value strictly below2^h, p,h>=0 integers. +Establishing this p,h at the preprocessing boundary is separately paid. + +An ordinary node of width e uses e=Nf+r, 0<=r=2. At rank n>=m the finite +compiler has classes 0,...,G where + + G=max{|a|:m*product(k^a_k)<=n}. + +The minimum type realizes m*k_min^G<=n, so G+1<=1+floor(log2 n). +Every source rank satisfies1<=s<=n. A deepest exit is a product of G+1 paid +ranks and therefore + + e<=r_max^(G+1)n/m, so +n-s=1+m/(m-1)>2. After m descents +rank is less than half. A path has at most m*(1+floor(log2 n)) nonbase +compiler frames, including its root; every frame contributes at most +v*(1+floor(log2 n)) raw contexts. Consequently + + K(n)<=v*m*(1+floor(log2 n))^2. (4a) + +Either (4) or (4a), or their minimum, is valid. With the current +m=145^1024,v=1024,N=2^H, (4a) gives K_star in (1). K_star has exactly7455 +bits and2244 decimal digits, so the coefficient is encoded and checked +without constructing N. It is strictly smaller than (4)'s coefficient: +m<2^8192, H+1<2^46 and8192+46=1,N>=2, +k<=2^(k-1)<=N^(k-1), by induction. Thus for ell=floor(log_N d), +ell<=d/N, also when ell=0. With t=K_star*ell this gives32t=1 and input p-grid components strictly below2^h. For the source's +closed complex unit disk use h=1, not h=0: inputs of component1 are allowed. +The initial S_D diagonal consists of fourth-root phases, preserving p,h. +If the source takes its all-individual branch, the whole completed-prefix +Clifford argument applies directly. Otherwise let q>=1 axes be preprocessed +individually and R=D-q>=1 remain. After preprocessing one may take + + p'=p+ceil(q/2), h'=h+ceil((q+1)/2). + +This follows from the same denominator and unitary-row bounds, on q axes. +Keep all R axes as a **single fixed reference factor across every sequential +piece**, including axes in completed pieces. A completed earlier piece is +another Clifford in (5), not a fresh scalar debt or a smaller reference space. +The ordinary stack in any piece is bounded using R; thus the simple root +format has F<=p'+R<=p+D and J<=h'+R+2<=h+D+2. If q=0, use p'=p,h'=h +instead. If R=0, no recursive interval remains. Preprocessing prefixes are +covered by the same global bounds. Original padded rows may become nonzero +inside the source word but return to zero at its independent completed +linear endpoint before their prescribed removal. + +Consequently the entire selected C^D computation, including sequential +pieces, fits the **one common** format + + F_global=p+D, J_global=h+D+2, + W_global=p+h+2D+3, temporary W_global+6. (10) + +The actual final normalization in05-layers is b^D S_D C^D S_D, +b=(1-i)/2. Put k=floor(D/2); the source prescribes b^D=(-i)^k*2^-k*b^(D mod2). +For even D=2k, C^D has entries in2^-k Z[i], so the k-bit shift is exact +on grid p+D. For odd D=2k+1, every C^D entry is a Gaussian unit times +(1+i)/2^(k+1). Multiplying arbitrary Gaussian p-grid inputs and summing +shows the returned numerators A,B on grid p+k+1 satisfy A=B modulo2. +The S_D phases preserve this congruence. On grid p+D the current integer +numerators have a factor2^k. After the exact k-bit shift the optional b +uses complete numerators (A+B)+i(B-A), both even, before division by2. +It is therefore exact on the same global grid. The phase(-i)^k costs no +precision. Dividing by2 and multiplying by b contract complex magnitude; +all raw sign/sum numerators fit the retained six extra bits. + +This parity argument is required: arbitrary values on the C-grid need not +survive the normalization exactly, and separately rounded summands are not +admitted. The general output H0^D has denominator2^D, now funded by (10). +Retain the actual initial width-lift copy, q individual kernels, row padding +and removal, complete recursive operation/route invoice, both S_D scans, +normalization shift/optional-b scans and final output truncation. No physical +routing, owner-lifecycle, storage or accelerated-cost claim is added. Any +final truncation to the caller's requested p-grid remains the explicit paid +output operation; it is not asserted to be transparent. + +## 6. Discriminators and why the typing matters + +Let P=|0><0| on an active selected bit, and let C have diagonal(1+i)/2. +Then (P C P)^j has (1+i)^j/2^j in its00 entry, of reduced denominator +2^ceil(j/2). At j=3 it exceeds the one-bit Clifford cap2, with no exterior +scalar division. P is an active-coordinate projector, not a complete-row +selector. This exact countercontrol explains why ancestor remainder axes +stay in the root factor and only the true external ROW can be split. + +Nested interrupted ADD-swaps can accumulate their factor2; the admitted +whole swap finishes before recursion. The verifier checks its intermediate +mass and reset and rejects an interrupting schedule. It also checks C4's +actual denominator16 coefficient witness against a proposed three-bit +coefficient certificate, rejects an odd exterior division, distinguishes +disjoint replication from increased nesting, and checks zero padding/origin +preservation. These are discriminators, not a universal finite replay. + +## 7. Complete bill and relation to earlier results + +The source work is unchanged. Retain B_N productive fields, P_N rank-one +paid calls, A_N scalar/adapter records, O_N owned banks and L_N encoded +control as **different fixed compiler constants**. K_star replaces none of +these. A scalar scan of V component records still costs O(V*(W+6)) bit work +and all actual read/write/copy/clear traffic. An exchange costs four scans. +Every W-bit route retains its decoder, descriptors, full field movement, +inverse return and parked contexts. Every native child keeps its complete +inherited invoice; a precision proof does not establish its accelerated rate. + +Either sufficient format may be used, with its own W. An explicit total bill is the sum over all actual scalar scans of +O(records*(W+6)), plus every W-bit native-child/router/preparation invoice, +plus control generation/encoding and allocation. Space includes all live +productive/owned fields times W, numerator buffers at W+6, L_N controls, +serialized ancestors, route buffers and erased-but-visited backing where +charged by the space model. The expansion (5) is proof state, not runtime +computation. No estimate for the enormous A_N,O_N,L_N or template generation +is supplied here; no claimed complete accelerated bill silently absorbs them. + +For fixed N,K_star, ell=O(log d), so this result states + + F=p+ceil(d/2)+O(log d), W=p+h+d+O(log d), + +with explicit but astronomical constants. If **both** d=O(p) and h=O(p), +the component format is O(p). That asymptotic existence was already proved +in #2287/#2390 and #4359's finite-template closure. The new implication is +current source context-depth and one fixed-root Clifford denominator, +not a new O(p) conclusion or a usable small numerical template. + +The bare root theorem excludes unspecified preprocessing and normalization. +The numerical05-layers specialization above funds its particular preprocessing +and final H0 macro. It does not supply the current front/back reservation, +physical dispatcher or arbitrary deferred-phase joins. Final output truncation, +physical native innards, nonzero erasure, owner presentation and outer +recovery/admission retain their explicit obligations. +The selected frontier remains the repository's selected record. + +## 8. Verification and predecessor credit + +`verify.py` snapshots and authenticates canonical/vendored bytes, then consumes +those same immutable bytes with all source-file reopens blocked. It binds current v,H and +raw scalar/geometry constants, exercises unchanged compiler scheduling on +small fully expanded separated rules, independently checks its context +recurrence against event-stack depth, and tests exact algebraic failure +controls. It never constructs N. Finite traces corroborate source scheduling; +§§3–5 are the all-size proof. Dependencies are theorem/receipt authentication, +not an independent rerun of those source certificate generators. + +Credit: DreamingOfClouds' #6030 source; Ross Richardson's Gaussian-dyadic +denominator argument; @CubeJerry's current native/caller certificates; +zxv's chronological product and completion; Jacob Alan Sussman's Theorem1G +integer flow; #5443's lockstep/lifetime audit and #6878's full embeddings. +The prior #2287/#2390/#4359 precision, #4411 rank, #4586 batch and #5026 +stock results keep their scopes and credit. A bounded targeted trace found +no prior current fixed-root/compiler-depth implication; this is not exhaustive +novelty certification. All substantial proof, code and prose used AI assistance. +Separate AI reviews are not independent human or formal-kernel acceptance. diff --git a/research/query-only-precision-envelope/reference/NATIVE-PROOF.md b/research/query-only-precision-envelope/reference/NATIVE-PROOF.md new file mode 100644 index 0000000000..d39690a37b --- /dev/null +++ b/research/query-only-precision-envelope/reference/NATIVE-PROOF.md @@ -0,0 +1,124 @@ +# Common odd grid for a native word: clause change and proof + +Status key. **Proved**: follows from the statements below. **Replayed**: checked by exact rational replay of the one stated word (`check.py`, all 71,144 events), not a proof for other words. **Computed**: an arithmetic or finite computation run by the package. **Quoted**: a number taken from a computation that is not part of this package and not rerun here. **Argued**: reasoning by the author, not machine-checked. **Assumed**: stated hypothesis, not shown here. No maintainer has reviewed this package or the word, and no second human has read it. + +## 1. What changes + +Changed clauses, by name: + +1. The scalar alphabet of the native word. Until now ADD and COPY coefficients, and SCALE units, are dyadic (`local.py` lines 146 and 149, the verifier copies, and `native.py` line 65). They become elements and units of the ring A = Z[1/2, 1/3, 1/5]. The clause covers complex native words only. It does not cover the BIT side: merged #2593 shows where an odd kernel scalar is valid there ("for every odd modulus not divisible by 3"), and this package changes no BIT word. +2. The Gaussian dyadic text of `03-motifs.tex` (lines 57 and 556), for the internal arrays of one parent word only. Completed endpoints, and every public role, stay Gaussian dyadic. +3. The scalar-alphabet constants in the #6900 and #6901 proofs, which are specific to #6030. +4. One added operation in `05-layers.tex` (lines 510-513): multiply by an integer, check divisibility, divide. +5. The clause of the joint check of the dyadic words "the first 8 SCALEs are the 8 hosted-port gauge SCALE 1/2" is **not literally true for this word** and is replaced by: each of the 8 hosted-port mains X has its first SCALE by 1/2 before its first use (before any other event that touches the register). Seven of them are events 5 to 11; the eighth (register 30) is event 29089, directly before the register's first use. `check.py` asserts the replacement. The gauge is in any case covered by the exact endpoint X = x - y, Y = (x + y)/2, and the word's other checks do not read the clause. + +Event bound. This package declares its own event bound: 71,144 events. The retained verifiers of other packages stop at 26,000 events and that cap is not applied here; the retained growth line 416,000 (16 x 26,000) is still reported by `check.py`, and the sum 82,828 of log2(1+|q|) over the ADD coefficients stays below it. + +Against the word of #6934 (data/prior_word_6934.json.gz) this word makes seven changes of one kind, plus two plain splits, and nothing else; `check.py` (step 1c) recomputes each statement. Seven direct main-to-main contacts, each a forward contact and its mirror, are moved onto one new shared public helper wire each, which the F mains and the R mains read through the same register; 56 MOVEs of mains and 14 contact ADDs are removed, and 145 events are added (88 ADD, 49 MOVE, 8 SCALE); 70,999 events are common. The new registers are 1452 to 1460: seven wires and two plain split tails (the wires 1452 and 1455 are each split in two, the tails being 1459 and 1460, with the 4/3 ... 3/4 SCALE pattern that helpers 1440 and 1442 already carry in #6934). The reorder of commuting events that lets the rests overlap is a legal commutation: over the common events every register sees the same ordered sequence of access classes (0 of 1,503 registers differ), so every read sees the value it saw in #6934's word. The 28 registers that are partners of the contacts lose intermediate stops: each MOVE chain is an endpoint-preserving subsequence of the old one with the same total rank change. The frame table (1,095 frames), the 54 owned lifetimes (as a multiset), the 47 owned MOVEs (as a multiset), the 51 owned fields, the 23 owned rises and S = 1520 are unchanged. The public registers are 1,461 against 1,452. T and P change as counted in section 5. The peak of concurrent owned fields is 43 against 40: nine owned INITs are hoisted earlier (a retiming of owned INIT and CLEAR, which are exclusive accesses, so a legal commutation), and nothing else about the owned side changes. + +Unchanged against #6934, and not part of the clause: the type A part of the caller (the constant blocks of #6912, section 5). The corrections that #6934 made to statements of #6932 stand and are not repeated; the statements of #6934 that this package changes are listed in section 9. + +Precedent. The method is the merged one-root-scale odd-denominator grid of #104 by **icekylinx** (`notes/stopped-product-complex.tex`, lines 75-106: the average G = (1/21) sum A_i, a single numerator scale 21^K at the outer boundary, exact division, exact unscaling). That note is pinned in `certificates/selected-result.json` under `proof_supplements` (its SHA-256 on main begins 47380891 and equals the pin). The same method is used on main in `partial-gauge-assembly.tex` lines 39-40 and `three-stage-cover-assembly.tex` lines 64-67 (divisor 21) and `paired-cube-assembly.tex` lines 87-92 (divisor 3). The odd-grid reviews in the merged archives (`A8-ODD-GRID.md` lines 3-8, `ODD-GRID-COMPOSITION.md`, `REVIEW.md`, `CLIQUE-CODE-GRID.md` lines 165-197, which says the code grid "does not require every local coefficient to be dyadic") are contributor notes in merged archives, not maintainer validation. **Limit:** every precedent is a caller-level rational centre with an exact child. No admitted native word uses odd scalars, and this word is not one either until the clause is accepted. The statement here is that grid with divisors 3 and 5 in place of 21, with one scale S applied to the root inputs as in #104. + +Texts a reviewer may raise, none of them a prohibition: `research/p104-integer-error-replay/README.md` line 54 ("nondyadic needs a new representation contract", which this section is), the literal "dyadic scalar alphabet" and a rejected 2^20/3 control in the #6901 verifier, a rejected 1/3 word in the #6900 controls, and `02-streams.tex` lines 198-200, which list only power-of-two division as streaming and so permit rather than forbid the pass of section 5. + +## 2. Replacement clause + +A native word may use ADD and COPY coefficients q in A with |q| + 1 < 2^16 (this bound is kept exactly as before), and SCALE by units of A (numerator and denominator products of 2, 3, 5), with frames as before, provided it declares S = 3^e 5^g such that: + +- (i) for every prefix of the program, S times every row has entries in Z[1/2]; +- (ii) for every ADD or COPY, S times the product q times the source row, formed before the addition, has entries in Z[1/2]; +- (iii) every public output row of the complete word has entries in Z[1/2]. + +Execution. A coefficient a/b with b = 2^x 3^y 5^z is executed as: multiply by a, check divisibility by 3^y 5^z, divide. The inputs are multiplied by S numerator by numerator, and at the exit the division by S is exact. There are two forms, and they are not the same program: + +- **Scale per call.** Every call multiplies its own inputs by S at entry and divides by S at exit, so a factor S is added along the unfinished contexts only. Its conversion is charged on every call (the per-call figures of section 5). +- **One scale at the outer boundary.** Multiply once by S^K, with K bounding the number of unfinished contexts, as #104 writes 21^K, and unscale at the outer return. There is no per-call conversion (the other figures of section 5). + +Rows are formal (the vector of coefficients of the inputs), so (i) to (iii) are finite checks on the word, independent of the inputs and of the tensor width f. `verify_host3_odd.py` checks A-membership, the |q| bound, (i), (ii) and (iii) event by event; `controls.py` runs its rejections (S = 375, 225, 75, 45, 15, 25, 9 and 1; S = 7 x 1125; a coefficient 1/7; a SCALE by 1/7, 7 or 3/2; |q| + 1 >= 2^16; a non-dyadic public row; cancelling pairs of 1/7 and of 65536; and the dyadic #6931 word as the S = 1 control). + +## 3. Theorem and proof + +**Theorem (proved, conditional on exact children).** Suppose the word satisfies (i) to (iii), the root inputs are Gaussian dyadic, and every completed child returns the exact Gaussian-dyadic value of its operator. Then every stored value lies on the dyadic grid, every checked division is exact, and the word's output equals its exact action on every Gaussian-dyadic input, at every f, including dirty and correlated spectators. + +Proof. + +1. Work over R = A[i]. It is commutative and contains Z[i, 1/2]. The frames are matrices over Z[i, 1/2], and scalars from R are central, so the common-frame identity of `03-motifs.tex` (lines 168-175) holds with coefficients in R. The same holds for the Clifford representatives (`general-clifford-frames.tex` line 62). +2. The stored array on register r after any prefix is D_v applied to (S times the sum over inputs k of R_{r,k} x_k), where R_{r,k} are the row entries and D_v is the frame matrix. By (i), S R_{r,k} is in Z[1/2], and D_v has Gaussian dyadic entries, so the stored values are Gaussian dyadic. This is an identity in the formal inputs x. +3. Division by a/b: before the division the stored value is a times S q R_s x with S q R_s in Z[1/2] by (ii). Hence it is divisible componentwise by the odd part of b on the grid (#6901 lines 276-278), and the quotient is again on the grid. +4. By (iii) the exit division by S is exact, and the result is the logical output. +5. Scalars are not raised to tensor powers (FINITE-PRECOMPILATION lines 247-248), so S does not depend on f. +6. Composition. Each unfinished context multiplies numerators by at most S, so debts add along the active chain only. A completed child returns a Gaussian-dyadic row (by the premise), so it adds no odd factor at exit (the active-path argument of `ODD-GRID-COMPOSITION.md` lines 33-48). + +The endpoint of the word is the same kind as the dyadic word's, so the caller, contact, host and controller identities are unchanged, and the word is one atom to its caller. Quantizers act on stored cuts, which lie on the grid; their identities need F and W recomputed, not their form. Magnitude contract: `05-layers.tex` line 875 binds only the outer proposition; the recursive child is in the common guarded format with no disk contract. + +## 4. Width + +The cost is width only, and it is per unfinished context, not per ordinary node. All numbers below are computed by `check.py` unless marked quoted. + +- Live nesting is the number of unfinished raw contexts t = K_star * ell (#6901 PROOF lines 88 and 191), where K_star = v m (H+1)^2 (#6901 eq. (4a)), v = 1920 the chronological power and m = 153^1920 the carrier. +- Per unfinished context, on the stated word: the 2-adic denominator height is **24 bits** (the odd part of any denominator is at most 1,125, 10.1 bits) and the magnitude is **36.54 bits** (log2 of the largest l1 mass of S times a row or product, scale included) [computed]. The scale S itself is 10.1 of the 36.54 bits. #6932's word had 2-adic height 15 bits; the height is a separate per-context debt from the magnitude. +- Temporaries. A multiply-by-a, check-divisibility, divide-by-b step on a stored value x holds the product a x. The ADD coefficient numerators of this word reach **24 bits** (largest numerator 14,729,531, first at event 252; it recurs, for example at event 70779) and their denominators **19 bits** (393,216 = 3 x 2^17), and 864 ADD events have a numerator above 40,864 [computed]. The step therefore needs up to 24 bits above the width of x, where #6932's word needed 16. This is a constant additive term and is not multiplied by t [argued]; whether the numerator or the value governs the temporary needs a maintainer reading. The `W + 6` of #6901 is a #6030 figure and is not reused. +- Sufficiency (argued, following #6901 lines 296-316): W = p + h + 2D + 3 remains sufficient once c t < d. Two forms of c: + - With the #6030 caller mass 10 as a placeholder (the form of #6932): 2 (log2 10 + 36.54) = 79.72 [computed], so **80 t < d** replaces the 82 t < d of #6932. It assumes the caller mass is recomputed. + - With caller majorants. The quoted figures are a caller mass of at most 2^120.35 and a path-maximum height majorant of 157 bits, both computed on #6932's caller by a script that is not part of this package. Per context the height is then at most 24 + 157 = 181 bits and the magnitude at most 36.54 + 120.35 = 156.89 bits, so c = 2 x 181 = **362**, and 362 t < d follows from 363 K_star < 2^H as at #6901 lines 299-304. log2 K_star = 14,072.3 bits at the written H = 14,161,600,000,000,000,000, and the margin is about 1.4 x 10^19 bits [computed from the quoted majorants; `check.py` prints it]. The majorants were not recomputed on this package's caller, whose type A blocks are smaller (section 5); that a smaller block cannot raise a monotone mass measure is argued, not rerun. + - The same computation for #6932's word, whose height was 15 bits, gives 15 + 157 = 172 bits and **344 t < d**, not 82 t < d (as corrected in #6934). + - Status: the arithmetic is computed here; the hypotheses of #6901 at (4a) for the per-port root are not rechecked line by line; nobody has reviewed this. + +## 5. What is priced, and what is not changed + +- **T and P against #6934's word.** T, P and S = 1520 come from the frames, the MOVE blocks and the helpers; the invoice reads each paid job by its rank (per MOVE) and each helper by its credit (rank of its final frame over its initial frame). `check.py` recounts both words through the two roots. Per call, T changes by two more productive fields of rank 1, four more of rank 7, two more of rank 8 and one more of rank 9 (the credits of the nine new registers); P changes by paid jobs of rank 1 (-19), 2 (-10), 3 (+11), 4 (+1), 5 (+5), 6 (+3) and 7 (+2). The rank mass of T and of P rises by the same 55 per call, so S = 1520 stays. The kernel term D falls by 20.1352 per call, 362.43 over the 18 calls (from 422,589.15 to 422,226.72). The gain, kappa over kappa of #6934 minus one, is 0.00087175 (+0.0872%), and it is measured only against #6934. +- **Odd divisions.** The odd divisions are priced separately, as the reviewed text does (`CLIQUE-CODE-GRID.md` lines 9-11, `REVIEW.md` lines 10-11, `ODD-GRID` lines 122-123). The word has 4,143 odd divisions per call (64 SCALE and 4,079 ADD events), that is 8,286 scans per call (one multiply-and-check and one division each). Each is one least-significant-bit-first finite-state pass of 4(w_g + 1) head steps (`CLIQUE-CODE-GRID.md` lines 199-223), fitting the order of `02-streams.tex` lines 202-208; `division_pass.py` tests the pass exhaustively on widths 1 to 12 for the divisors 3, 5, 9, 15, 25, 45, 75, 125, 225, 375 and 1125, all non-divisible inputs flagged. The upper formula's bit-length term covers the scans [argued]. +- **Caller.** The type A part of the joint caller is replaced by the constant blocks of #6912 (CubeJerry): 1,176 type A events instead of 2,474, equal event for event to #6912's `caller-after`. A constant block is a maximal run of ADD, SCALE -1 and SWAP of one type between two nonconstant events or joint contacts; it is left multiplication of the role vector by one matrix of GL_40(Z), and any block with the same matrix gives the same operator. `check_caller_blocks.py` checks, for the 38 changed blocks, the 40 x 40 integer matrices, the whole 78 x 78 caller at eight points modulo a prime, and the type A stream against #6912's pinned source, and it rejects 12 failing controls. The saving is 32 x 40 x 96 x 1,298 = **159,498,240** at 96 A ports in every raw reading. The type B caller (8 ports, SCALE 256 and 1/128, HOST not HOST2) is unchanged and not covered. The premises of #6912 stay as it declares them: exact circuit equality is not rounded-state equality, and nothing here uses a freed allowance for a native change. #6912 is not merged; its blocks are taken as data (`data/caller_6912_before.json`, `data/caller_6912_after.json`, SHA-256 pinned in the script). +- **Raw counts**, recomputed by `check.py` with the new caller: literal 802,809,952; actual per-call work 815,970,652; reviewed upper 832,255,648. With the second LAMBDA count (12,560 jobs at 1,000 each) the upper is 844,815,648 in the form with one scale at the boundary and no per-call conversion. With the per-call conversion (a SCALE by 1,125 in and out, 4 (11 + 1 + 1) x 2 = 104 per input, 104 x 1,461 x 18 = 2,734,992) the upper is 834,990,640 and, with the second LAMBDA count, 847,550,640. All are below 10^9, the least margin being 152,449,360; no reading has a recharge excess. With #6932's caller (the caller of #6934 before the #6912 blocks) the same word is over 10^9 on the recharge readings, so the new caller is still needed. Scaling only the registers that carry an odd coefficient is not used: it is unsound, since inputs outside those registers carry odd coefficients at some prefix. + +## 6. Exactness premise + +Exactness is conditional. The statement "odd debt resets at each word exit" holds only for completed children that return the exact Gaussian-dyadic value. This is a premise the odd word shares with the dyadic words, which also need exact children, and it is **declared**: it is the exact recursion of #6901 lines 92-97 and 290-292 and #6900 PROOF lines 56-58 (no child-return rounding), and the hypothesis named in `ODD-GRID-COMPOSITION.md` lines 55-56 and `REVIEW.md` lines 11-13. + +Truncated children. `physical_exact.py` runs one column with generic commuting frames. At F = 33 fractional bits the word is exact (148,332 divisions, 70,752 by a non-unit, 0 bad of 1,461 public rows); F = 32 and F = 31 fail at event 61461; S = 375 fails at event 36997 and S = 225 at event 1103. A truncation of g = 13 low bits after every MOVE is not noticed at F = 33 (the dropped bits are zero there); g = 14 and g = 24 are rejected by the divisibility check at the first inexact odd division, and so is g = 44 at F = 60. So the check sees a truncated child only once enough bits are dropped, not for every truncation. The dyadic #6931 word under a truncation of g = 44 at F = 60 runs to the end and is wrong on 830 of 1,441 public rows, so neither word is exact on a truncating child. + +A mode in which child returns are rounded, with no divisibility check, is outside this package and nothing here claims it; a separate note may treat it. + +## 7. A6 and tensor width 2 + +`check_a6.py` ports the argument of #6914 (CubeJerry, with OpenAI Codex) to the 23 owned rises of this word, and adds the width-2 phase test of #6930 (unpaidmoon, with Cursor Grok) on the stored recipes. The owned MOVEs of this word equal those of #6934's word (and of #6932's) as a multiset, and the 23 rise chart pairs are those of #6902's word, whose rises #6914 treats. The peak of concurrent owned fields is **43** here (40 in #6934): the 54 lifetimes, the 51 owned fields, the 23 rises, their mass 56 and the 16 owned reads of mains are unchanged, and nine owned INITs are hoisted earlier, which is a retiming of exclusive accesses. The A6 declaration is therefore for 23 rises of mass 56, 51 owned fields and a peak of 43. + +- **Computed.** An exact chronological scan of the owned lifetimes: 54 lifetimes, 53 dirty clears, 23 rises (10 of rank 1, 4 of rank 2, 1 of rank 3, 6 of rank 4, 1 of rank 5, 1 of rank 6), mass 56; the descending-only rule rejects exactly those 23 events. For each distinct rise map, all 512 exact Gaussian columns of T_b T_a^-1 equal right monomial, F_r, left monomial from the stored recipe; the adapter record lists realise the monomials at f = 1 on all addresses and at f = 2 and 3 on sampled addresses with spectators; the records stay under the allowance of 1,000 per rise. Eight failing controls (wrong phase, uncorrected adjoint child, wrong source frame, public and owned alias, omitted CLEAR, rank-zero MOVE, global phase not multiplied by f) are rejected. +- **Width 2.** A global phase i^p at width 1 becomes i^(p f) at width f; the stored phase p is a width-1 residue. The test executes the stored recipes jointly on two columns and compares with the exact product (M|x>) (x) (M|y>). The faithful phase i^(p f) gives 0 bad on every sampled pair of the 23 rise maps (rank 1 to 3: 576 pairs, rank 4 and 5: 64, rank 6: 8) and on 4,096 sampled input pairs of the first rank-1 MOVE of the word. Copying the stored integer p fails on every pair of each map with total stored phase not 0 mod 4 (18 of the 23) and passes the others; an off-by-one phase and a flipped Fourier sign fail on all pairs. At f = 1 the copied integer equals the faithful one, so a width-1 check cannot see the difference. +- **Not covered.** Joint width 3 or more (the records are exercised at f = 3 on sampled addresses only, not the joint run); spectator columns in the joint run; every map that is not an owned rise (a wider sample over all chart maps and main adapters of the word was run outside this package and is not shipped; in it, maps of rank 8 or more get one sampled pair each); the joint caller and any tape-level width-f execution; rounded child returns. Per-column execution with the global phase integer multiplied by f is the contract being assumed, as in #6930. +- **What is adoption, not replay.** That a completed positive rank-r child may take an owned field holding arbitrary contents (FINITE-PRECOMPILATION sections 1 and 6, #4416 review); that the child, adapters and role restoration complete before the parent reads or erases; the fresh finite-template constants; the width-f tariff. The check is not a tape replay, does not prove owned erasure and does not prove admission of the contracts. Three lifetimes read before their first rise and three have scalar contact between rises (census in `check_a6.py`); in such lifetimes the contents may carry odd denominators, and exactness there is the same conditional as everywhere (exact child return, the S certificate). +- The sentence at `native.py:139` ("frame induction at every positive tensor width") is replaced by what is run: width 1 for every listed map, and width 2 only through `check_a6.py`. + +## 8. Proved, replayed, assumed + +Proved: the theorem of section 3 on exact children; the independence of S from f; linearity of each scan. + +Replayed (the one stated word): all stored rows and pre-ADD products, times S = 1125, are dyadic at every one of 71,144 events; S = 1125 = 3^2 5^3 is minimal among its divisors by 3 and by 5 (375 and 225 are rejected, and so are 75, 45, 15, 25, 9 and 1); 0 bad of 1,461 public rows; no odd final row; the 3-adic and 5-adic heights are 2 and 3 with no other prime; the exact integer run on one column with generic commuting frames performs 148,332 divisions (70,752 by a non-unit), all exact at F = 33; the debts of section 4; a second engine mod 2^61 - 1; streams over F_p[i]; every native chart map (3,234); the joint caller; the 12 caller-block controls; mutants: all but seven of the 61,053 ADD doublings and sign flips are caught, and the seven (events 33201, 37661, 39201, 40052, 40053, 40076, 42666) are shown by exact replay, doubled and negated, to leave the endpoint unchanged (six are dead stores into owned registers that are cleared before any read, and event 42666 is a temporary pair that cancels downstream). None of the seven touches a helper wire or any of the 88 added ADDs. + +Moves: the word is #6934's word with the seven contact moves and two splits of section 1; the gain is the sum of those moves and is measured against #6934's word only. No human has reviewed the word or this package; the only second reading is a model replay (an independent model-run check of the word, its diff against #6934's word, its mutants and its chain), not human review. + +Assumed or not shown: exact completed children on every column; all root inputs dyadic; the caller majorants of section 4 on this package's caller; the actual P_r, the physical CLEAR and the LAMBDA pricing, as for dyadic words; a rounded child return. The physical run is one column, not true Clifford frames and not tensor width 2. + +## 9. Statements of #6934 that this package changes + +1. "The word. 71,069 events, 1,452 public registers ... a full rebuild ... One more public helper register": this word has 71,144 events and 1,461 public registers (nine more than #6934: seven wires and two split tails) and is #6934's word plus the moves of section 1, not a rebuild. +2. "The peak of concurrent owned fields is 40": it is 43 here (nine owned INITs hoisted earlier; 54 lifetimes, 51 fields, 23 rises of mass 56 unchanged). +3. "S = 1125, with 375 and 225 rejected at events 36915 and 1101": 36997 and 1103 for this word. Odd divisions: 4,143 (64 SCALE, 4,079 ADD) and 8,286 scans, not 4,125 and 8,250. ADD numerators still reach 24 bits (largest numerator 14,729,531 first at event 252); 864 ADD events have a numerator above 40,864, as in #6934. +4. "The first 8 SCALEs are the 8 hosted-port gauge SCALE 1/2" (the clause of the joint check, asserted literally in #6934): not literally true for this word, replaced by "each hosted-port main X has its first SCALE by 1/2 before its first use". +5. Logarithm power: "minimum 2223, written 2224" becomes minimum 2225 (2224 and 2223 fail), written 2226. The BIT margin is pin minus tested price = 1.397e-4. +6. Raw figures: literal 802,809,952; actual 815,970,652; reviewed upper 832,255,648; 844,815,648 with the second LAMBDA count; 834,990,640 and 847,550,640 with a conversion on every call; all below 10^9. K_star: log2 = 14,072.3 bits at the written H = 14,161,600,000,000,000,000 (14,065.5 for #6934's H). +7. Mutants: 61,053 ADD mutants, seven uncaught (events 33201, 37661, 39201, 40052, 40053, 40076, 42666), all shown equivalent by exact replay; 3,234 native chart maps in place of 3,233; the integer run has 148,332 divisions in place of 148,146. +8. The sentence "The word is a full rebuild ... the gain is not attributed to any single move": here the gain is the sum of seven contact moves and two splits, recomputed move by move in `check.py`, measured against #6934 only. + +All other statements of #6934 are unchanged, including the clause, the corrections of #6932, the quoted caller majorants (not recomputed on this caller) and the exactness premise. + +## 10. Sentences for the PR + +1. Changed: the scalar alphabet of the native word (`local.py` lines 146 and 149, the verifier copies, `native.py` line 65), the Gaussian dyadic text of `03-motifs.tex` (lines 57 and 556) for internal arrays only, and the #6030-specific constants in #6900 and #6901. +2. Replacement: a common odd grid following #104 (`notes/stopped-product-complex.tex` lines 75-106) and the odd-grid notes; rational operations stay local to the parent word; completed endpoints stay Gaussian dyadic on all public roles. +3. Hypotheses: exact completed children on all columns; a prefix certificate S = 3^2 5^3; all inputs dyadic at the root. +4. Penalty: zero in S; T and P change only as counted. Width is +24 denominator bits and +36.54 magnitude bits per unfinished context, absorbed in W = p + h + 2D + 3 by 80 t < d (placeholder caller mass) or 362 t < d (quoted caller majorants); the 8,286 odd scans per call are priced separately. +5. Not shown: a rounded child return, the actual P_r, the physical CLEAR, the LAMBDA pricing (as for dyadic words), the caller majorants on this caller, a width-f run beyond the 23 rises and one MOVE at f = 2. + +Credit: icekylinx (#104) for the odd grid; CubeJerry (#6912) for the type A caller blocks and (#6914) for the owned-rise argument; unpaidmoon (#6930) for the width-2 phase test. diff --git a/research/query-only-precision-envelope/reference/NATIVE-check.py b/research/query-only-precision-envelope/reference/NATIVE-check.py new file mode 100644 index 0000000000..2adba130f2 --- /dev/null +++ b/research/query-only-precision-envelope/reference/NATIVE-check.py @@ -0,0 +1,654 @@ +#!/usr/bin/env python3 +"""The main-wire native word with gate scalars 1/3 and 1/5 (the declared framework change of #6932 and #6934): exact replay of the word over A = Z[1/2, 1/3, 1/5] with the certificate S = 1125, both roots, the joint caller, +the complete invoice and the outer constants. Standard library only (plus the retained interval engines). +python3 -I -B check.py (writes nothing) +Steps: (1) event-by-event exact replay of data/word.json.gz with the endpoint of each port type, the alphabet A, the odd certificate S (every prefix row and every pre-ADD product), heights, scans; the odd verifier and its rejections; +(2) both roots with failing controls; (3) the joint caller (78 roles, block diagonal, one stage value per stage) at the four central characters, with wrong-root, wrong-port-type and swapped-assignment controls; +(4) the invoice recounted from the emitted events and rebuilt from the two roots, with the #6934, #6932, #6931, #6919, #6917 and #6911 words and #6833 as controls; (5) raw bound by three definitions, the LAMBDA recharge, the root-scale and +per-input scale readings, growth; (6) BIT pins, interval engines, strictification, compiler and outer ledger; departures. Prints PASS_P104_MAIN_WIRE_NATIVE. +(physical.py, physical_exact.py, caller_physical.py, native_maps.py, second_engine.py, mutants.py, division_pass.py, controls.py, ordinary.py, check_caller_blocks.py and check_a6.py are the other commands.)""" +import gzip, json, os, sys, subprocess, importlib.util, random, hashlib, math, copy +from collections import Counter +from decimal import Decimal as D, getcontext +from fractions import Fraction as Q +getcontext().prec = 60 +HERE = os.path.dirname(os.path.abspath(__file__)) +def need(ok, msg): + if not ok: raise SystemExit('FAIL ' + msg) + print('PASS', msg, flush=True) +data = lambda n: os.path.join(HERE, 'data', n) +PIN = Q(376669, 100000000) # ordinary BIT saving of the open #6726 two-fragment admission (retained/bit/FRAGMENT-BIT-ADMISSION.json) +def ldmod(path, name): + s = importlib.util.spec_from_file_location(name, path); m = importlib.util.module_from_spec(s); sys.modules[name] = m; s.loader.exec_module(m); return m + +# ---- (1) replay of the word ------------------------------------------------------------------- +W = json.load(gzip.open(data('word.json.gz'), 'rt')) +def span(b): + s = {0} + for v in b: + if not (isinstance(v, int) and 0 < v < 512 and v not in s): raise SystemExit('FAIL dependent basis') + s |= {x ^ v for x in s} + return frozenset(s) +fr = W['frames']; sp = [span(b) for b in fr]; dim = [len(b) for b in fr] +n = len(W['initial']); NO = W['owned_fields']; NR = n + NO +cur = list(W['initial']) + [None] * NO; row = [({r: Q(1)} if r < n else {}) for r in range(NR)] +owned = set(); viol = Counter(); owned_up = Counter(); up_idx = []; paid = Counter(); peak = life = dirty = 0; maxq = Q(0); logq = 0.0; pmax = Q(0); dmaxb = 0; nbits = dbits = 0 +dy = lambda q: q.denominator & (q.denominator - 1) == 0 +def sm(m, ps=(2, 3, 5)): + m = abs(m) + for p_ in ps: + while m % p_ == 0: m //= p_ + return m == 1 +def oddpart(m): + m = abs(m) + while m % 2 == 0: m //= 2 + return m +SC = 1125 # the declared certificate: S = 3^2 * 5^3 +odd_dens = set(); v2max = 0; dmax = 1; mass = Q(0); odd_div = Counter(); odd_events = Counter(); bad_S = Counter() +def note(rw, tag): + global mass, v2max, dmax + m = Q(0) + for v in rw.values(): + d = v.denominator; v2max = max(v2max, (d & -d).bit_length() - 1); dmax = max(dmax, d) + if d & (d - 1): odd_dens.add(oddpart(d)) + if not dy(SC * v): bad_S[tag] += 1 + m += abs(SC * v) + if m > mass: mass = m +for i, e in enumerate(W['program']): + op, r = e[0], e[1] + if op == 'MOVE': + _, r, a, b, pv = e + if cur[r] != a or (r in owned) != bool(pv): viol['transport source or ownership'] += 1 + if pv: + if sp[a] < sp[b]: owned_up[dim[b] - dim[a]] += 1; up_idx.append(i) + elif not sp[b] < sp[a]: viol['owned move not nested'] += 1 + elif not sp[a] < sp[b]: viol['public move not strictly ascending'] += 1 + paid[abs(dim[b] - dim[a])] += 1; cur[r] = b + elif op == 'INIT': + if not (r >= n and r not in owned): viol['INIT'] += 1 + owned.add(r); life += 1; peak = max(peak, len(owned)); cur[r] = e[2]; row[r] = {} + elif op == 'CLEAR': + if not (r in owned and cur[r] == e[2]): viol['CLEAR'] += 1 + dirty += bool(row[r]); owned.discard(r); cur[r] = None; row[r] = {} + else: + q = Q(e[2] if op == 'SCALE' else e[3]); f = e[-1] + if q == 0 or not sm(q.denominator) or not abs(q) + 1 < 2 ** 16: viol['coefficient alphabet'] += 1 + if oddpart(q.denominator) > 1: odd_events[op] += 1 + maxq = max(maxq, abs(q)); nbits = max(nbits, abs(q.numerator).bit_length()); dbits = max(dbits, q.denominator.bit_length()) + if op != 'SCALE': logq += math.log2(1 + float(abs(q))) + if op == 'SCALE': + if cur[r] != f or not sm(q.numerator): viol['SCALE'] += 1 + row[r] = {k: v * q for k, v in row[r].items()}; note(row[r], 'scale row') + for v in row[r].values(): + if abs(v) > pmax: pmax = abs(v) + if v.denominator.bit_length() > dmaxb: dmaxb = v.denominator.bit_length() + else: + s = e[2] + if not (cur[r] == f == cur[s] and s != r): viol['common chart'] += 1 + if op == 'COPY': + if not (r in owned and not row[r]): viol['COPY'] += 1 + row[r] = {} + note({k: q * v for k, v in row[s].items()}, 'pre-ADD product') + for k, v in row[s].items(): + t = row[r].get(k, 0) + q * v + if t: + row[r][k] = t + if abs(t) > pmax: pmax = abs(t) + if t.denominator.bit_length() > dmaxb: dmaxb = t.denominator.bit_length() + else: row[r].pop(k, None) + note(row[r], 'ADD row') +need(not owned and cur[:n] == W['final'], 'owned all cleared; final frames as declared') +need(dict(viol) == {}, 'frame law, common chart, alphabet A = Z[1/2, 1/3, 1/5] with |q|+1 < 2^16, SCALE units of A, public ascent: no violation beyond the declared one') +up_mass = sum(k * v for k, v in owned_up.items()) +need(up_mass == 56 and sum(owned_up.values()) == 23, 'declared OWNED UP: %d events, rank mass %d (convention: owned ascent)' % (sum(owned_up.values()), up_mass)) +def verifier(name): + return subprocess.run([sys.executable, '-I', '-B', os.path.join(HERE, name), data('word.json.gz')], capture_output=True, text=True).stdout +os_, or_ = verifier('verify_strict.py'), verifier('verify_relaxed.py') +rej = [int(x) for x in os_.split('indices')[1].split('\n')[0].split()] +need(os_.strip().endswith('REJECTED_STRICT') and rej == up_idx and "['move nesting']" in os_, 'rejection control: the strict (predecessor) verifier rejects this word at exactly the %d owned-ascent events and nothing else' % len(rej)) +need(or_.strip().endswith('ACCEPTED_RELAXED'), 'relaxed verifier (only the owned-move direction rule changed, paid |delta dim| either way) accepts every event') +# ---- (1b) the odd grid (framework change): certificate, heights, odd divisions, scans, the odd verifier ------- +Smin = 1 +for d_ in odd_dens: Smin = Smin * d_ // math.gcd(Smin, d_) +def val_(m, p_): + c = 0 + while m % p_ == 0: m //= p_; c += 1 + return c +h3 = max([val_(d_, 3) for d_ in odd_dens] or [0]); h5 = max([val_(d_, 5) for d_ in odd_dens] or [0]) +need(Smin == SC == 1125 and not bad_S and all(sm(d_, (3, 5)) for d_ in odd_dens) and (h3, h5) == (2, 3), + 'certificate: S = 1125 = 3^2 5^3 times every prefix row and every pre-ADD product has dyadic entries (0 failures over %d odd denominators); the 3-adic and 5-adic heights are %d and %d and no other prime occurs; S is minimal (the least common multiple of the odd parts of all denominators is %d)' % (len(odd_dens), h3, h5, Smin)) +need(v2max == 24, 'width debt per unfinished context: 2-adic denominator height %d bits (odd part at most 1125, 10.1 bits), largest denominator of any row or product 2^%.2f; the coefficients are given by their own bit lengths below (numerators up to %d bits, denominators up to %d bits)' % (v2max, math.log2(dmax), nbits, dbits)) +need(all(any(s_ % d_ for d_ in odd_dens) for s_ in (375, 225, 75, 45, 15, 25, 9, 1)), 'S = 375 (= 1125/3), 225 (= 1125/5), 75, 45, 15, 25, 9 and 1 are each insufficient (some odd denominator does not divide them)') +oddfinal = sum(1 for r in range(NR) if not all(dy(v) for v in row[r].values())) +need(oddfinal == 0, 'every one of the %d final rows (public and owned) has dyadic entries: no odd denominator survives to an output' % NR) +n_odd = sum(odd_events.values()); scans = 2 * n_odd +need((odd_events['SCALE'], odd_events['ADD'], odd_events['COPY'], n_odd, scans) == (64, 4079, 0, 4143, 8286), + 'odd divisions per call: %d SCALE and %d ADD events have an odd denominator = %d divisions = %d scans (one multiply-and-check, one division, each a least-significant-bit-first pass), listed separately from the reviewed scalar count' % (odd_events['SCALE'], odd_events['ADD'], n_odd, scans)) +need(abs(math.log2(float(mass)) - 36.54) < 0.005 and 2 * (math.log2(10) + math.log2(float(mass))) < 80, 'largest l1 mass of S times a row or product at any prefix: 2^%.2f (the magnitude debt per unfinished context, scale included); 2 (log2 10 + %.2f) = %.2f < 80, so 80 t < d replaces the 82 t < d of the dyadic-caller-mass placeholder form' % (math.log2(float(mass)), math.log2(float(mass)), 2 * (math.log2(10) + math.log2(float(mass))))) +def vodd(*a): + return subprocess.run([sys.executable, '-I', '-B', os.path.join(HERE, 'verify_host3_odd.py'), data('word.json.gz')] + [str(x) for x in a], capture_output=True, text=True) +v1125, v375, v225, v1 = vodd(1125), vodd(375), vodd(225), vodd(1) +need('PASS_HOST3' in v1125.stdout, 'odd verifier (verify_host3_odd.py: A-membership, |q|+1 < 2^16, S certificate on every prefix row and pre-ADD product, public rows dyadic) accepts the word at S = 1125') +need(v375.returncode != 0 and v375.stderr.strip().endswith('AssertionError: 36997') and v225.returncode != 0 and v225.stderr.strip().endswith('AssertionError: 1103') and v1.returncode != 0 and v1.stderr.strip().endswith('AssertionError: 2'), 'odd verifier rejects S = 375 at event 36997 and S = 225 at event 1103 (the two divisors of 1125 by 3 and by 5), and S = 1 at event 2; controls.py runs the other rejections') +H = W['hosted']; al, be = Q(H['alpha']), Q(H['beta']); a2, b2 = Q(H['alpha2']), Q(H['beta2']); DP = H['Dports'] +live = W['live']; X = set(live); Y = {r + 112 for r in live}; X2 = H['X2']; Y2 = H['Y2']; X2s = set(X2); Y2s = set(Y2) +BP = [i for i in range(104) if i not in set(DP)]; dX = {live[i] for i in DP} +need(H['mode'] == 'mix-t0' and (al, be, a2, b2) == (-1, Q(1, 2), -1, 0) and len(DP) == len(set(DP)) == len(X2) == len(Y2) == 96 and len(BP) == 8 and not ((X2s | Y2s) & (X | Y)) and len(X2s | Y2s) == 192 and len(live) == len(W['ports']) == 104, + 'two port types: 96 ports in the two-chain form (second mains, plane 2 alpha2=%s beta2=%s) and 8 ports in the hosted form (pair alpha=%s beta=%s, t = %s, no second mains)' % (a2, b2, al, be, al * be)) +x2of = dict(zip(X2, Y2)); bad = 0 +for r in range(NR): + if r >= n: ex = {} + elif r in X: ex = {r: Q(1)} if r in dX else {r: Q(1), r + 112: al} + elif r in Y: ex = {r - 112: Q(1), r: Q(1)} if r - 112 in dX else {r - 112: be, r: 1 + al * be} + elif r in X2s: ex = {r: Q(1), x2of[r]: a2} + elif r in Y2s: ex = {r: Q(1)} + else: ex = {r: Q(1)} + bad += row[r] != ex +need(bad == 0, 'endpoint exact on all %d public and owned rows: two-chain ports X=x, Y=x+y, X2=x2-y2, Y2=y2; hosted ports X=x-y, Y=(x+y)/2; helpers identity, owned empty' % NR) +for i, (r, q) in enumerate(zip(live, W['ports'])): + if fr[W['initial'][r]] != [q] or dim[W['final'][r]] != 9 or dim[W['initial'][r + 112]] != 0 or sp[W['final'][r + 112]] != frozenset(x for x in range(512) if not (x & q).bit_count() % 2): raise SystemExit('FAIL main frames') +for i, x2, y2 in zip(DP, X2, Y2): + r = live[i] + if W['initial'][x2] != W['initial'][r] or W['final'][x2] != W['final'][r] or W['initial'][y2] != W['initial'][r + 112] or W['final'][y2] != W['final'][r + 112]: raise SystemExit('FAIL second main frames') +need(True, '104 literal central ports; the second mains of the 96 two-chain ports carry the same initial and final frame labels as the first mains (declared: same-label second mains)') +main = X | Y | X2s | Y2s +hel = Counter(dim[W['final'][r]] - dim[W['initial'][r]] for r in range(n) if r not in main) +need(min(hel) > 0 and all(sp[W['initial'][r]] < sp[W['final'][r]] for r in range(n) if r not in main), 'every helper strictly ascends (rank > 0); %d helpers, %d mains, %d public' % (sum(hel.values()), len(main), n)) +print(' events', len(W['program']), 'public', n, 'owned roles', NO, 'peak owned', peak, 'owned lifetimes', life, 'dirty owned erasures', dirty, 'max |coefficient|', maxq) +W19 = json.load(gzip.open(data('prior_word_6919.json.gz'), 'rt')); WB = json.load(gzip.open(data('prior_word_6934.json.gz'), 'rt')); W32 = json.load(gzip.open(data('prior_word_6932.json.gz'), 'rt')); W31 = json.load(gzip.open(data('prior_word_6931.json.gz'), 'rt')) +need(peak == 43 and len(W['program']) == 71144 and n == 1461 and sum(hel.values()) == 1061 and len(WB['program']) == 71069 and len(WB['initial']) == 1452 and n - len(WB['initial']) == 9 and len(W['program']) - len(WB['program']) == 75, 'peak owned fields %d; events %d; public %d; helpers %d (the #6934 word, data/prior_word_6934.json.gz: events %d, public %d, helpers %d; nine public registers added (seven wires and two split tails), 145 events added and 70 removed)' % (peak, len(W['program']), n, sum(hel.values()), len(WB['program']), len(WB['initial']), len(WB['initial']) - 400)) +def lives_of(Wx): + st = {}; lf = Counter(); om = Counter() + for e_ in Wx['program']: + if e_[0] == 'INIT': st[e_[1]] = e_[2] + elif e_[0] == 'CLEAR': lf[(st.pop(e_[1]), e_[2])] += 1 + elif e_[0] == 'MOVE' and e_[4]: om[(e_[2], e_[3])] += 1 + return lf, om +lfn, omn = lives_of(W); lfo, omo = lives_of(WB) +pkWB = 0; lvWB = 0 +for e_ in WB['program']: + if e_[0] == 'INIT': lvWB += 1; pkWB = max(pkWB, lvWB) + elif e_[0] == 'CLEAR': lvWB -= 1 +need(W['frames'] == WB['frames'] and lfn == lfo and omn == omo and sum(lfn.values()) == 54 and W['owned_fields'] == WB['owned_fields'] == 51 and sum(omn.values()) == sum(omo.values()), + 'owned side against the #6934 word: the same frame table (%d frames), the same %d owned lifetimes as a multiset of (initial frame, clear frame), the same multiset of %d owned MOVEs (a, b), the same %d owned fields; only the timing differs, so the peak of concurrent owned fields is %d here and %d there (retiming only)' % (len(W['frames']), sum(lfn.values()), sum(omn.values()), W['owned_fields'], peak, pkWB)) + +# ---- (1c) the move against the #6934 word: seven shared helper wires ------------------------------------------------- +nold = len(WB['initial']); shn = n - nold +def renum(e): + e = list(e); op = e[0]; f = lambda x: x + shn if x >= nold else x + e[1] = f(e[1]) + if op in ('ADD', 'COPY'): e[2] = f(e[2]) + return tuple(e) +PA_ = [renum(e) for e in WB['program']]; PB_ = [tuple(e) for e in W['program']] +ca_, cb_ = Counter(PA_), Counter(PB_); rem_, add_ = ca_ - cb_, cb_ - ca_; com_ = ca_ & cb_ +newh = set(range(nold, n)); dd_ = [len(b_) for b_ in W['frames']] +rA = Counter(e_[0] for e_ in rem_.elements()); aA = Counter(e_[0] for e_ in add_.elements()) +tch = lambda e_: e_[1] in newh or (e_[0] in ('ADD', 'COPY') and e_[2] in newh) +need(all(W[k_] == WB[k_] for k_ in ('frames', 'live', 'hosted', 'ports')) and W['initial'][:nold] == WB['initial'] and W['final'][:nold] == WB['final'] and W['owned_fields'] == WB['owned_fields'], + 'against the #6934 word: frame table, live set, hosted pairs, ports, and the initial and final frame of each of the %d old public registers are identical; the %d owned register numbers move up by %d; %d helper registers are added (the endpoint check above covers their final rows)' % (nold, W['owned_fields'], shn, shn)) +need(sum(rem_.values()) == 70 and dict(rA) == {'MOVE': 56, 'ADD': 14} and sum(add_.values()) == 145 and dict(aA) == {'ADD': 88, 'MOVE': 49, 'SCALE': 8}, + 'multiset difference of the two event lists after renumbering: %d events removed (%d MOVE, %d ADD) and %d added (%d ADD, %d MOVE, %d SCALE); %d events are common' % (sum(rem_.values()), rA['MOVE'], rA['ADD'], sum(add_.values()), aA['ADD'], aA['MOVE'], aA['SCALE'], sum(com_.values()))) +hm_ = Counter(e_[1] for e_ in add_.elements() if e_[0] == 'MOVE' and e_[1] in newh) +nha_ = sum(1 for e_ in add_.elements() if e_[0] == 'ADD' and tch(e_)); nom_ = sum(1 for e_ in add_.elements() if e_[0] == 'MOVE' and e_[1] not in newh) +need(all(tch(e_) for e_ in add_.elements() if e_[0] == 'ADD') and not any(tch(e_) for e_ in rem_.elements()) and sum(hm_.values()) == 21 and sorted(hm_.values()) == [1, 1, 2, 2, 3, 3, 3, 3, 3] and nom_ == 28, + 'every added ADD (%d) reads or writes one of the %d new registers (seven wires and two split tails: 21 MOVEs in all, %d counted, 3 per wire before the two splits); the other %d added MOVEs are chain steps of registers that lose intermediate stops; no removed event touches a new helper' % (nha_, len(newh), sum(hm_.values()), nom_)) +rem_adds = [e_ for e_ in rem_.elements() if e_[0] == 'ADD']; Xs_ = set(W['live']); Ys_ = {r_ + 112 for r_ in W['live']}; X2_ = set(W['hosted']['X2']); Y2_ = set(W['hosted']['Y2']); mn_ = Xs_ | Ys_ | X2_ | Y2_ +need(len(rem_adds) == 14 and all(e_[1] in mn_ and e_[2] in mn_ for e_ in rem_adds) and all(e_[1] in mn_ for e_ in rem_.elements() if e_[0] == 'MOVE'), + 'the %d removed ADDs are direct main-to-main contacts (both registers are mains: seven contacts, one forward and one mirror pair each) and all %d removed MOVEs are MOVEs of mains' % (len(rem_adds), rA['MOVE'])) +cred_ = lambda e_: dd_[W['final'][e_]] - dd_[W['initial'][e_]] +hcr_ = sorted(cred_(h_) for h_ in newh) +spl_ = sorted((a_, b_) for a_ in newh for b_ in newh if a_ != b_ and W['final'][a_] == W['initial'][b_]); tails_ = {b_ for _, b_ in spl_} +mcr_ = sorted(cred_(h_) + sum(cred_(b_) for a_, b_ in spl_ if a_ == h_) for h_ in newh if h_ not in tails_) +partn_ = {h_: set() for h_ in newh} +for e_ in add_.elements(): + if e_[0] == 'ADD': + if e_[1] in newh: partn_[e_[1]].add(e_[2]) + if e_[2] in newh: partn_[e_[2]].add(e_[1]) +grp_ = {h_: {h_} | {b_ for a_, b_ in spl_ if a_ == h_} for h_ in newh if h_ not in tails_} +shared_ = all(set().union(*(partn_[x_] for x_ in g_)) & (Xs_ | Ys_) and set().union(*(partn_[x_] for x_ in g_)) & (X2_ | Y2_) for g_ in grp_.values()) +need(all(sp[W['initial'][h_]] < sp[W['final'][h_]] and h_ not in mn_ for h_ in newh) and hcr_ == [1, 1, 7, 7, 7, 7, 8, 8, 9] and mcr_ == [7, 7, 8, 8, 8, 8, 9] and spl_ == [(1452, 1459), (1455, 1460)] and len(grp_) == 7 and all(cred_(b_) == 1 for b_ in tails_) and shared_ and Counter(e_[1] for e_ in add_.elements() if e_[0] == 'SCALE') == {1452: 2, 1455: 2, 1459: 2, 1460: 2}, + 'the nine new registers are public non-main registers whose frames strictly ascend, credit ranks (dim final - dim initial) %s, rank mass %d; the two split pairs %s are plain splits (the second starts at the frame where the first ends, both credits at least 1, concatenated they cover the unsplit wire; merged credits %s); each of the seven wires is read or written by a first main (X or Y: F) and a second main (X2 or Y2: R): one wire, shared' % (hcr_, sum(hcr_), spl_, mcr_)) +def lab_(P_, c_): + cc_ = Counter(c_); seen_ = Counter(); out_ = [] + for e_ in P_: + if cc_[e_] > 0: cc_[e_] -= 1; seen_[e_] += 1; out_.append((e_, seen_[e_])) + return out_ +def acc_(e_): + op_ = e_[0] + if op_ in ('MOVE', 'INIT', 'CLEAR', 'SCALE'): return [(e_[1], 'M')] + if op_ == 'COPY': return [(e_[1], 'M'), (e_[2], 'R')] + return [(e_[1], 'A'), (e_[2], 'R')] +def runs_(L_): + sq_ = {} + for e_, k_ in L_: + for r_, c_ in acc_(e_): sq_.setdefault(r_, []).append((c_, (e_, k_))) + out_ = {} + for r_, sq in sq_.items(): + rr_ = [] + for c_, x_ in sq: + if rr_ and rr_[-1][0] == c_ and c_ in 'RA': rr_[-1][1].add(x_) + else: rr_.append((c_, {x_})) + out_[r_] = [(c_, frozenset(st_)) for c_, st_ in rr_] + return out_ +RA_, RB_ = runs_(lab_(PA_, com_)), runs_(lab_(PB_, com_)) +need(set(RA_) <= set(RB_) and all(RA_[r_] == RB_[r_] for r_ in RA_) and len(RA_) > 0, + 'reordering is legal: over the %d common events each of %d registers sees the same ordered sequence of access classes (MOVE, SCALE, INIT, CLEAR exclusive; ADD destination and ADD source taken as runs of sets, since adds into one destination commute and reads commute): 0 registers differ, so every read sees the value it saw in the #6934 word' % (sum(com_.values()), len(RA_))) +def mchains_(Wx, sh_): + c_ = {} + for e_ in Wx['program']: + if e_[0] == 'MOVE': + r_ = e_[1] + (sh_ if e_[1] >= nold else 0) + if r_ not in c_: c_[r_] = [e_[2]] + assert c_[r_][-1] == e_[2]; c_[r_].append(e_[3]) + return c_ +cA_, cB_ = mchains_(WB, shn), mchains_(W, 0) +chg_ = [r_ for r_ in set(cA_) | set(cB_) if cA_.get(r_) != cB_.get(r_)] +def issub_(a_, b_): + it_ = iter(a_); return bool(a_ and b_ and a_[0] == b_[0] and a_[-1] == b_[-1] and all(x_ in it_ for x_ in b_)) +mass_ = lambda c_: sum(abs(dd_[y_] - dd_[x_]) for x_, y_ in zip(c_, c_[1:])) +oth_ = [r_ for r_ in chg_ if r_ not in newh] +need(all(issub_(cA_[r_], cB_[r_]) and mass_(cA_[r_]) == mass_(cB_[r_]) for r_ in oth_) and set(chg_) - set(oth_) == newh and len(oth_) == 28, + 'the MOVE chain of each of the %d other registers that changed (the partners of the seven contacts) is an endpoint-preserving subsequence of its chain in the #6934 word with the same total rank change (a serial merge of consecutive ascending MOVEs of the same register); the new helpers are the only registers with a new chain' % len(oth_)) +sc = [e for e in W['program'] if e[0] == 'SCALE'] +hX = {live[i] for i in BP}; gpos = {} +for k_, e in enumerate(W['program']): + if e[0] == 'SCALE' and e[1] in hX and e[1] not in gpos: gpos[e[1]] = (k_, Q(e[2])) +first_use_ = {} +for k_, e in enumerate(W['program']): + for r_ in ([e[1]] if e[0] in ('MOVE', 'INIT', 'CLEAR', 'SCALE') else [e[1], e[2]]): first_use_.setdefault(r_, []).append(k_) +need(len(gpos) == 8 and {v for _, v in gpos.values()} == {Q(1, 2)} and all(first_use_[r_][0] == gpos[r_][0] for r_ in gpos), 'gauge: each of the 8 hosted-port mains X has its first SCALE by 1/2, and that SCALE is the first event that touches it (events %s): the SCALE comes before the first use of the register. The clause of the dyadic words that the first 8 events are the 8 gauge SCALEs is %s for this word (the first %d events: %s); the gauge is in any case covered by the exact endpoint X = x - y, Y = (x + y)/2' % (sorted(k for k, _ in gpos.values()), 'literally true' if sorted(k for k, _ in gpos.values()) == list(range(8)) else 'not literally true, and is replaced by this statement', 8, [e_[0] + ':' + str(e_[1]) for e_ in W['program'][:8]])) + +# ---- (2) the roots ------------------------------------------------------------------------------ +RC = ldmod(os.path.join(HERE, 'root_check.py'), 'rootcheck') +RA = json.load(open(data('root_A.json'))); RB = json.load(open(data('root_B.json'))); RB0 = json.load(open(data('control_root_B_other_gauge.json'))) +need(RC.run(RA) == [], 'type A root (two #6833 chain roots, t = 0): 21/21 units of each chain regenerated, cross Gram 0, SPEC-level identities, each stage variable once and affine') +Rm = copy.deepcopy(RA); Rm['X'][5][3] = str(Q(Rm['X'][5][3]) + 1) +need(RC.blocks(Rm) != [] and RC.run(Rm) != [], 'wrong-root control A: a wrong X entry in the type A root FAILS (%s)' % RC.blocks(Rm)[:1]) +hsrc = open(os.path.join(HERE, 'root_check_hosted.py')).read() +def hosted_run(RR): + """root_check_hosted.py (the checker of the hosted root of #6889) executed on RR; returns its list of failed lines.""" + code = hsrc.replace("R=json.load(open(sys.argv[1] if len(sys.argv)>1 else os.path.join(os.path.dirname(os.path.abspath(__file__)),'data','root.json')))", 'R=_R').replace('sys.exit(1 if bad else 0)', '') + ns = {'_R': RR, 'sys': sys, '__file__': os.path.join(HERE, 'root_check_hosted.py'), 'print': lambda *a, **k: None} + exec(compile(code, 'root_check_hosted.py', 'exec'), ns) + return ns['bad'] +need(hosted_run(RB) == [], 'type B root (the hosted root of #6889, t = -1/2, n = 38, pairs (-1, 1/2)): every line of its checker passes') +Rm = copy.deepcopy(RB); Rm['X'][5][3] = str(Q(Rm['X'][5][3]) + 1) +need(hosted_run(Rm) != [], 'wrong-root control B: a wrong X entry in the hosted root FAILS its checker') +Rm = copy.deepcopy(RA); Rm['X'][7], Rm['X'][9] = Rm['X'][9], Rm['X'][7] +need(RC.run(Rm) != [], 'wrong-root control: two unit rows swapped in the type A root FAIL') + +# ---- (3) the joint caller ----------------------------------------------------------------------- +J = json.load(open(data('caller.json'))) +pM = 2147483629 +IM = next(pow(g, (pM - 1) // 4, pM) for g in range(2, 99) if pow(g, (pM - 1) // 2, pM) == pM - 1); HALF = (pM + 1) // 2 +fm = lambda x: (lambda f: f.numerator % pM * pow(f.denominator, pM - 2, pM) % pM)(Q(x)) +def root_pairs(root): + dot = lambda a_, b_: sum(Q(u) * Q(v) for u, v in zip(a_, b_) if Q(u) and Q(v)); out = {} + for k, s_ in enumerate(root['stages']): + u, v = s_['units']; out[k + 1] = (dot(root['Y'][u], root['X'][v]), dot(root['Y'][v], root['X'][u])) + return out +mask_inc = lambda root, c: [int(c in set(s['mask'])) for s in root['stages']] +PB = root_pairs(RB); TA, TB = J['types']['A'], J['types']['B'] +need(set(PB.values()) == {(al, be)} and len(PB) == 18, 'every one of the 18 hosted stages of root B has the word\'s pair (alpha,beta)=(%s,%s), read from the root' % (al, be)) +need(all(TA['diagonal'][c][2:] == mask_inc(RA, c) for c in range(40)) and all(TB['diagonal'][c][2:] == mask_inc(RB, c) for c in range(38)), 'caller target exponents equal the mask incidence of the root of their type, field by field and stage by stage (type A 40 roles, type B 38 roles)') +need(Q(TA['alpha2']) == a2 and Q(TA['beta2']) == b2 and all(str(e[3][2]) == str(al) and str(e[3][3]) == str(be) for e in J['events'] if e[0] == 'J'), 'type A plane-2 parameters and every joint contact\'s hosted pair equal the word\'s') +need(J['roles'] == 78 and J['stages'] == 18 and sum(e[0] == 'J' for e in J['events']) == 18, 'joint caller: 78 roles (type A 0-39, type B 40-77), 18 joint contacts (one per stage; HOST2 at the two-chain ports and HOST at the hosted ports in one event)') +need(sorted(TA['ports']) == sorted(DP) and sorted(TB['ports']) == BP and len(TA['ports']) == 96 and len(TB['ports']) == 8, 'port types of the caller equal the word\'s: type A = the 96 two-chain ports, type B = the 8 hosted ports') +Jp = copy.deepcopy(J); Jp['types']['A']['ports'][0], Jp['types']['B']['ports'][0] = Jp['types']['B']['ports'][0], Jp['types']['A']['ports'][0] +need(sorted(Jp['types']['A']['ports']) != sorted(DP) or sorted(Jp['types']['B']['ports']) != BP, 'swapped-assignment control: exchanging the types of one two-chain port and one hosted port in the caller breaks the match with the word') +NRr = J['roles'] +def target(Jc, role, qv, Dv): + t, off = (Jc['types']['A'], 0) if role < 40 else (Jc['types']['B'], 40); dg = t['diagonal'][role - off] + c = pow(qv, dg[0] % 4, pM) + for k, bit in enumerate(dg[2:]): + if bit: c = c * Dv[k + 1] % pM + return c +def replay(Jc, qv, Dv, a2_=a2, pairs=PB, types='AB'): + Rm_ = [[int(i == j) for j in range(NRr)] for i in range(NRr)]; qi = pow(qv, pM - 2, pM); seen = [] + for e in Jc['events']: + tag = e[0] + if tag == 'J': + st = e[1]; seen.append(st); d = Dv[st] + if 'A' in types: + src, dst, x2, y2 = e[2] + Rm_[dst] = [(a_ + qi * b_) % pM for a_, b_ in zip(Rm_[dst], Rm_[src])] + Rm_[x2] = [(a_ + fm(a2_) * qv % pM * b_) % pM for a_, b_ in zip(Rm_[x2], Rm_[y2])] + for r_ in (src, dst, x2, y2): Rm_[r_] = [a_ * d % pM for a_ in Rm_[r_]] + if 'B' in types: + src, dst = e[3][0], e[3][1]; a_, b_ = fm(pairs[st][0]), fm(pairs[st][1]); tt_ = a_ * b_ % pM + ns = [(x + a_ * qv % pM * y) % pM * d % pM for x, y in zip(Rm_[src], Rm_[dst])] + nd = [(b_ * qi % pM * x + (1 + tt_) * y) % pM * d % pM for x, y in zip(Rm_[src], Rm_[dst])] + Rm_[src], Rm_[dst] = ns, nd + continue + if tag not in types: continue + op = e[1] + if op == 'ADD': Rm_[e[2]] = [(a_ + fm(e[4]) * b_) % pM for a_, b_ in zip(Rm_[e[2]], Rm_[e[3]])] + elif op == 'SCALE': c = fm(e[3]); Rm_[e[2]] = [a_ * c % pM for a_ in Rm_[e[2]]] + elif op == 'SWAP': Rm_[e[2]], Rm_[e[3]] = Rm_[e[3]], Rm_[e[2]] + elif op == 'QUERY': c = pow(qv, e[4] % 4, pM); Rm_[e[2]] = [(a_ + c * b_) % pM for a_, b_ in zip(Rm_[e[2]], Rm_[e[3]])] + elif op == 'LAMBDA': + s_ = e[3]; c = ((1 + s_ * IM) * HALF + (1 - s_ * IM) * HALF * qv * qv) % pM; Rm_[e[2]] = [a_ * c % pM for a_ in Rm_[e[2]]] + elif op == 'IDLE_ONE': + c = 1 + for k in e[3]: c = c * Dv[k] % pM + Rm_[e[2]] = [a_ * c % pM for a_ in Rm_[e[2]]] + else: raise SystemExit('FAIL unknown caller event ' + op) + if seen != list(range(1, 19)): return 10 ** 6 + roles = [r for r in range(NRr) if ('A' in types and r < 40) or ('B' in types and r >= 40)] + return sum(Rm_[i][j] != (target(Jc, i, qv, Dv) if i == j else 0) for i in roles for j in range(NRr)) +rnd = random.Random(11); tot = cnt = 0 +for qv in (1, IM, pM - 1, pM - IM): + for _ in range(3): + Dv = {s_: rnd.randrange(2, pM) for s_ in range(1, 19)}; tot += replay(J, qv, Dv); cnt += 1 +need(tot == 0, 'composition: the ONE joint stream (78 roles, one stage value per stage common to both types) replays to the block-diagonal target at all four central characters (%d evaluations, 0 bad of %d entries each; all cross-type blocks are 0)' % (cnt, NRr * NRr)) +for ty in 'AB': + t2 = sum(replay(J, qv, {s_: rnd.randrange(2, pM) for s_ in range(1, 19)}, types=ty) for qv in (1, IM, pM - 1, pM - IM)) + need(t2 == 0, 'type %s alone replays to its own target at the four characters' % ty) +Dv = {s_: rnd.randrange(2, pM) for s_ in range(1, 19)} +def rej(Jc=J, **kw): return replay(Jc, IM, Dv, **kw) +def mut(f): + Jm = copy.deepcopy(J); f(Jm); return Jm +idx = lambda Jc, pred: next(i for i, e in enumerate(Jc['events']) if pred(e)) +first = lambda tag, op: (lambda e: e[0] == tag and e[1] == op) +ctr = [('type A wrong alpha2', rej(a2_=Q(1)))] +for nm, fn in (('type B alpha sign', lambda x: x.__setitem__(0, -x[0])), ('type B beta sign', lambda x: x.__setitem__(1, -x[1])), ('type B pair swapped', lambda x: x.reverse())): + pm = {k: list(v) for k, v in PB.items()}; fn(pm[13]); ctr.append((nm + ' at stage 13', rej(pairs=pm))) +ctr.append(('type B root in the other gauge', rej(pairs=root_pairs(RB0)))) +for ty in 'AB': + ctr.append(('type %s deleted idle' % ty, rej(mut(lambda Jm: Jm['events'].pop(idx(Jm, first(ty, 'IDLE_ONE'))))))) + ctr.append(('type %s deleted query' % ty, rej(mut(lambda Jm: Jm['events'].pop(idx(Jm, first(ty, 'QUERY'))))))) + def flip(Jm): + j0 = idx(Jm, lambda e: e[0] == 'J'); k = max(i for i in range(j0) if Jm['events'][i][0] == ty and Jm['events'][i][1] == 'LAMBDA'); Jm['events'][k][3] *= -1 + ctr.append(('type %s flipped LAMBDA before the first contact' % ty, rej(mut(flip)))) +for nm, b in ctr: print(' control %-52s -> %d bad' % (nm, b)) +need(all(b > 0 for _, b in ctr), 'controls: wrong alpha2, a wrong or other-gauge hosted pair, a deleted idle, a deleted query, a flipped LAMBDA at a contact, in each type: all rejected by the replay') +for ty, role in (('A', 3), ('B', 3)): + Jm = mut(lambda x: x['types'][ty]['diagonal'][role].__setitem__(2 + 4, x['types'][ty]['diagonal'][role][2 + 4] ^ 1)) + need(rej(Jm) > 0 and Jm['types'][ty]['diagonal'][role][2:] != (mask_inc(RA, role) if ty == 'A' else mask_inc(RB, role)), 'mask control, type %s: a wrong mask bit in the caller target fails the replay and the mask comparison' % ty) +need(rej(mut(lambda x: x['events'].insert(idx(x, lambda e: e[0] == 'J'), ['A', 'ADD', 5, 45, '1']))) > 0 and rej(mut(lambda x: x['events'].insert(idx(x, lambda e: e[0] == 'J'), ['B', 'ADD', 45, 5, '1']))) > 0, 'cross-type controls: one ADD from a type A role into a type B role, and the other way, are rejected: the types do not interact') +def swapst(x): + js = [e for e in x['events'] if e[0] == 'J']; js[0][1], js[1][1] = js[1][1], js[0][1] +def rot(x): + e = x['events'][idx(x, lambda e: e[0] == 'J')]; a = e[2]; e[2] = [a[0], a[1], a[3], a[2]] +need(rej(mut(swapst)) > 0 and rej(mut(rot)) > 0, 'controls: two joint contacts with exchanged stages, and exchanged second-plane roles in a contact, are rejected') +print(' note: the composition reads each root only through its masks and pairs; wrong X or Y entries are caught by the root checkers above') + +# ---- (4) invoice --------------------------------------------------------------------------------- +def kappa(T, P): + rs = sorted(set(T) | set(P)); ln = {r: D(r).ln() for r in rs} + e = lambda k: sum((D(T.get(r, 0)) - D(P.get(r, 0))) * (ln[r] * (1 - k)).exp() for r in rs) + lo, hi = D('1e-6'), D('0.05') + for _ in range(220): + m = (lo + hi) / 2 + if e(m) > 0: lo = m + else: hi = m + return lo +def root_fields(RR): + S_ = RR['stages']; Xr = RR['X']; Yr = RR['Y']; F = [] + for c in range(RR['n']): + ms = [k for k, s_ in enumerate(S_) if c in set(s_['mask'])] + F.append((ms, [k for k in ms if any(Q(Yr[u][c]) != 0 for u in S_[k]['units'])])) + dot = lambda a_, b_: sum(Q(u) * Q(v) for u, v in zip(a_, b_) if Q(u) and Q(v)); planes = [] + for s_ in S_: + u, v = s_['units']; planes.append(2 if dot(Yr[u], Xr[v]) == 0 and dot(Yr[v], Xr[u]) == 0 else 1) + return F, planes, RR['N'] - sum(len(s_['units']) for s_ in S_) +def outer(F, planes, thin, ports, nst=18): + T = Counter(); P = Counter(); hc = Counter() + for ms, host in F: + T[8 * len(ms) + 1] += ports + for k in host: hc[k] += 1 + run = 0; prev = None + for k in ms: + if k in host: + if run: P[8 * run] += ports + run = 0; prev = None; continue + if prev is not None and k == prev + 1: run += 1 + else: + if run: P[8 * run] += ports + run = 1 + prev = k + if run: P[8 * run] += ports + for k in range(nst): + if hc[k] > 2 * planes[k]: P[8] += ports * (hc[k] - 2 * planes[k]) + P[1] += ports * thin + return T, P +def census(Wx): + nx = len(Wx['initial']); lx = set(Wx['live']); mx = lx | {r_ + 112 for r_ in lx} + if Wx.get('hosted', {}).get('X2'): mx |= set(Wx['hosted']['X2']) | set(Wx['hosted']['Y2']) + dx = [len(b_) for b_ in Wx['frames']] + return (Counter(dx[Wx['final'][r_]] - dx[Wx['initial'][r_]] for r_ in range(nx) if r_ not in mx), Counter(abs(dx[e_[3]] - dx[e_[2]]) for e_ in Wx['program'] if e_[0] == 'MOVE')) +def invoice_roots(hel_, paid_, roots): + T = Counter(); P = Counter() + for RR, ports in roots: + F, pl, th = root_fields(RR); t_, p_ = outer(F, pl, th, ports); T.update(t_); P.update(p_) + for r, k in hel_.items(): T[r] += 18 * k + for r, k in paid_.items(): P[r] += 18 * k + return T, P +bi = json.load(open(data('base_invoice.json'))) +T0 = Counter({int(k): v for k, v in bi['targets'].items()}); P0 = Counter({int(k): v for k, v in bi['paid'].items()}) +chain = [(list(range(18)), list(range(18)))] + [(list(range(i, 9)), [i]) for i in range(9)] + [(list(range(9, 10 + m)), [9 + m]) for m in range(9)] + [([], [])] +Tc_, Pc_ = outer(chain, [1] * 18, 3, 104) +Tb, Pb = Counter(Tc_), Counter(Pc_) +for r_, k_ in bi['helpers'].items(): Tb[int(r_)] += 18 * k_ +for r_, k_ in bi['local_paid'].items(): Pb[int(r_)] += 18 * k_ +need(+Tb == T0 and +Pb == P0, 'control: the same code rebuilds the #6833 invoice term for term') +kb = kappa(T0, P0) +need(abs(kb - D(bi['kappa_literal'])) < D('1e-17'), 'control: #6833 kappa %s' % str(kb)[:20]) +nA, nB = len(TA['ports']), len(TB['ports']); cnt_ty = {'A': nA, 'B': nB} +T = Counter(); P = Counter(); nj = 0 +for e in J['events']: + if e[0] == 'J': nj += 1; T.update(hel); P.update(paid) + elif e[1] == 'QUERY': P[1] += cnt_ty[e[0]] + elif e[1] == 'IDLE_ONE': P[8 * len(e[3])] += cnt_ty[e[0]] +for ty, t in (('A', TA), ('B', TB)): + for dg in t['diagonal']: T[int(dg[0] % 2) + 8 * sum(dg[2:])] += cnt_ty[ty] +T2, P2 = invoice_roots(hel, paid, ((RA, nA), (RB, nB))) +need(nj == 18 and +T == +T2 and +P == +P2, 'the invoice recounted from the emitted joint events equals the invoice rebuilt from the TWO ROOTS (per type, per port count) plus the word, term for term (18 native calls, helpers and paid jobs once per call)') +kn = kappa(T, P); Tn, Pn = T, P +need(abs(kn - D('0.00362701882959514439757905558830')) < D('1e-25'), 'new kappa %s' % str(kn)[:26]) +S = sum(r * (Tn.get(r, 0) - Pn.get(r, 0)) for r in set(Tn) | set(Pn)) +need(S == 1520, 'rank-mass surplus S = %d (104*34 - 36*56, net of the 56 owned-ascent mass per call)' % S) +Wp = json.load(gzip.open(data('prior_word_6911.json.gz'), 'rt')); hp, pp = census(Wp) +Tp, Pp = invoice_roots(hp, pp, ((RA, nA), (RB, nB))); kp = kappa(Tp, Pp) +need(abs(kp - D('0.0035194870841667550646')) < D('1e-17'), 'control: the #6911 word through the two roots (96 + 8 ports) and the same code gives %s (its crossing)' % str(kp)[:26]) +W17 = json.load(gzip.open(data('prior_word_6917.json.gz'), 'rt')); h17, p17 = census(W17) +T17, P17 = invoice_roots(h17, p17, ((RA, nA), (RB, nB))); k17 = kappa(T17, P17) +need(abs(k17 - D('0.0035301044238995680260')) < D('1e-17'), 'control: the #6917 word through the two roots (96 + 8 ports) and the same code gives %s (its crossing)' % str(k17)[:26]) +h19, p19 = census(W19); T19, P19 = invoice_roots(h19, p19, ((RA, nA), (RB, nB))); k19 = kappa(T19, P19) +need(abs(k19 - D('0.0035952826938257874494')) < D('1e-17'), 'control: the #6919 word (data/prior_word_6919.json.gz) through the two roots (96 + 8 ports) and the same code gives %s (the crossing of #6919)' % str(k19)[:26]) +h31, p31 = census(W31); T31, P31 = invoice_roots(h31, p31, ((RA, nA), (RB, nB))); k31 = kappa(T31, P31) +need(abs(k31 - D('0.0036041048151080063894')) < D('1e-17'), 'control: the #6931 word (data/prior_word_6931.json.gz) through the two roots (96 + 8 ports) and the same code gives %s' % str(k31)[:26]) +h32, p32 = census(W32); T32_, P32_ = invoice_roots(h32, p32, ((RA, nA), (RB, nB))); k32_ = kappa(T32_, P32_) +need(abs(k32_ - D('0.0036210586137481460837')) < D('1e-17'), 'control: the #6932 word (data/prior_word_6932.json.gz) through the two roots (96 + 8 ports) and the same code gives %s' % str(k32_)[:26]) +h34, p34 = census(WB); Tb0, Pb0 = invoice_roots(h34, p34, ((RA, nA), (RB, nB))); kbase = kappa(Tb0, Pb0) +need(abs(kbase - D('0.0036238597350766513')) < D('1e-17'), 'control: the #6934 word (data/prior_word_6934.json.gz, the word this one is compared with) through the two roots (96 + 8 ports) and the same code gives %s' % str(kbase)[:26]) +need(sum(r * (Tb0.get(r, 0) - Pb0.get(r, 0)) for r in set(Tb0) | set(Pb0)) == 1520, 'the #6934 word has rank-mass surplus S = 1520 as well') +def no_E(T_): + T2_ = Counter(T_); T2_[1] -= 192; return T2_ +kE_ = kappa(no_E(Tn), Pn); kEb_ = kappa(no_E(Tb0), Pb0) +print(' E CREDIT (declared premise, see README): rank-1 productive fields T[1] = %d over the 18 calls here (%d in the #6934 word); with the 192 rank-1 targets removed and paid unchanged, kappa = %s here (%s with them, %.2f%%) and %s for the #6934 word (%s with them, %.2f%%)' % (Tn[1], Tb0[1], str(kE_)[:10], str(kn)[:10], 100 * float(kE_ / kn - 1), str(kEb_)[:10], str(kbase)[:10], 100 * float(kEb_ / kbase - 1))) +e_roles = [i_ for i_, dg_ in enumerate(TA['diagonal']) if int(dg_[0] % 2) + 8 * sum(dg_[2:]) == 1]; e_roles_b = [i_ for i_, dg_ in enumerate(TB['diagonal']) if int(dg_[0] % 2) + 8 * sum(dg_[2:]) == 1] +nE_ = len(e_roles) * nA + len(e_roles_b) * nB +need(e_roles == [19, 39] and e_roles_b == [] and nE_ == 192 == 2 * nA, 'E count from the invoice: the type A root has %d empty-mask fields (roles %s), credited by the rule rank 1 + 8 |mask| = 1, over %d two-chain ports = %d productive rank-1 targets; the hosted type B root has %d; the credit removed below is exactly this count' % (len(e_roles), e_roles, nA, nE_, len(e_roles_b))) +need(Tn[1] >= 192 and Tb0[1] >= 192 and str(kEb_)[:9] == '0.0031631' and kE_ < kn, 'E credit control: removing 192 rank-1 targets from T, paid unchanged, gives %s for the #6934 word (about .0031631, the earlier reading) and %s for this word' % (str(kEb_)[:10], str(kE_)[:10])) +print(' gain over the #6934 word: %.5f%% (exactly kappa_new / kappa_6934 - 1 = %s)' % (100 * float(kn / kbase - 1), str(kn / kbase - 1)[:12])) +need(str(100 * (kn / kbase - 1))[:5] == '0.087', 'the gain over the #6934 word (crossing %s) is +0.087%% (ratio - 1 = %s); no other comparison is made' % (str(kbase)[:22], str(kn / kbase - 1)[:12])) +dT = {r: Tn[r] - Tb0[r] for r in sorted(set(Tn) | set(Tb0)) if Tn[r] != Tb0[r]}; dPp = {r: Pn[r] - Pb0[r] for r in sorted(set(Pn) | set(Pb0)) if Pn[r] != Pb0[r]} +print(' T change against the #6934 word (all 18 calls):', dT); print(' P change against the #6934 word (all 18 calls):', dPp) +need(dT == {1: 36, 7: 72, 8: 36, 9: 18} and dPp == {1: -342, 2: -180, 3: 198, 4: 18, 5: 90, 6: 54, 7: 36} and sorted(r_ for r_ in hcr_ for _ in range(18)) == sorted(r_ for r_, c_ in dT.items() for _ in range(c_)) and sum(r * c for r, c in dT.items()) == sum(r * c for r, c in dPp.items()), + 'T and P change against the #6934 word, per call (all 18 calls divided by 18): T %s (productive fields by rank: the credits of the nine new registers), P %s (paid jobs by rank: per MOVE, the merged main MOVEs and the new helper MOVEs); the rank mass of T and of P changes by the same amount (%d), so S stays %d' % ({r: c // 18 for r, c in dT.items()}, {r: c // 18 for r, c in dPp.items()}, sum(r * c for r, c in dT.items()) // 18, S)) +dDT = sum(c * r * D(r).ln() for r, c in dT.items()) / 18; dDP = -sum(c * r * D(r).ln() for r, c in dPp.items()) / 18 +need(dDT + dDP < 0, 'the whole gain is in the kernel term D = sum (T - P) r ln r, per call: the T change moves it by %s and the P change by %s (net %s; the rank mass S stays %d). The word differs from the #6934 word by the seven moves counted in step (1c), so this is the net effect of those seven moves and two splits' % (str(dDT)[:8], str(dDP)[:8], str(dDT + dDP)[:8], S)) +nlA = sum(1 for e in J['events'] if e[0] == 'A' and e[1] == 'LAMBDA'); nlB = sum(1 for e in J['events'] if e[0] == 'B' and e[1] == 'LAMBDA') +lam_cost = nA * nlA + nB * nlB +need((nlA, nlB) == (124, 82) and S - lam_cost < 0, 'review question, stated plainly: type A callers have %d LAMBDA events and type B callers %d; if each LAMBDA had to be paid as a rank-1 job per port, the cost is %d*%d + %d*%d = %d and S = %d - %d = %d < 0, so no crossing exists; kappa rests on pricing LAMBDA as ordinary work, as in every caller of this line' % (nlA, nlB, nA, nlA, nB, nlB, lam_cost, S, lam_cost, S - lam_cost)) + +# ---- (5) raw bound, growth, alphabet -------------------------------------------------------------- +def swaps(sel): + wanted = set(range(len(sel))); return len(list(zip(sorted(set(sel) - wanted), sorted(wanted - set(sel))))) +def shim(ty): + t = J['types'][ty]; off = t['offset']; ev = [] + for e in J['events']: + if e[0] == 'J': ev.append(['HOST', e[1]]) + elif e[0] == ty: + e = list(e[1:]) + if e[0] in ('ADD', 'SWAP', 'QUERY'): e[1] -= off; e[2] -= off + else: e[1] -= off + ev.append(e) + return dict(events=ev, roles=t['roles'], ambient_rank=J['ambient_rank'], diagonal=t['diagonal']) +def rest_of(C, ports): + ev = C['events']; roles = C['roles']; amb = C['ambient_rank']; mx = mn = mp = 0 + for role, (qp, zero, *sel) in enumerate(C['diagonal']): + axes = ([0] if qp else []) + [a for st, y in enumerate(sel, 1) if y for a in range(9 + 8 * (st - 1), 9 + 8 * st)] + k = swaps(axes); mx += 2 * k * ports; mn += 2 * bool(qp) * ports; mp += int(qp == -1) * ports + ie = 0; qn = qph = 0 + for e in ev: + if e[0] == 'IDLE_ONE': ie += 2 * swaps([a for st in e[2] for a in range(9 + 8 * (st - 1), 9 + 8 * st)]) * ports + elif e[0] == 'QUERY': qn += 2 * ports; qph += int(e[3] == -1) * ports + return 32 * roles * ports * len(ev) + sum(e[0] == 'QUERY' for e in ev) * 16 * ports + roles * ports * 26 + (mx + mn + mp) * 1000 + ie * 1000 + (qn + qph) * 1000 +rest = rest_of(shim('A'), nA) + rest_of(shim('B'), nB) +allow = upper = 0 +for e in W['program']: + if e[0] in ('INIT', 'CLEAR'): allow += 2 + elif e[0] == 'SCALE': + q = Q(e[2]); a_, d_ = abs(q.numerator), q.denominator + allow += 2 * (abs(a_.bit_length() - d_.bit_length()) + int(q < 0)); upper += 4 * (a_.bit_length() + d_.bit_length() + 1) + elif e[0] in ('ADD', 'COPY'): + q = Q(e[3]); a_, d_ = abs(q.numerator), q.denominator + allow += 2 * (3 + a_.bit_length() - 1 + bin(a_).count('1') + d_.bit_length() - 1); upper += 4 * (a_.bit_length() + bin(a_).count('1') + d_.bit_length() + 1) +routes = (sum(paid.values()) + 2 * sum(hel.values()) + 208 + 2 * nA + 4 * 104 + 4 * nA + 4 * life) * 1000 # boundary terms of the second planes only at the two-chain ports +per_call = allow + routes; per_up = upper + routes +raw_lit, raw_act, raw_rev = 18 * 10 ** 7 + rest, 18 * per_call + rest, 18 * per_up + rest +print(' raw pieces: per-port terms = %d; per call (word scalar + routes) = %d (allowance) or %d (reviewed upper) against the displayed 10^7' % (rest, per_call, per_up)) +need((raw_lit, raw_act, raw_rev) == (802809952, 815970652, 832255648) and max(raw_lit, raw_act, raw_rev) < 10 ** 9, 'raw bound, all three definitions below 10^9: literal %d, actual per-call work %d, reviewed scalar upper %d (margins %d, %d, %d); the %d odd divisions are inside these bit-length terms (argued) and are also listed as %d scans per call' % (raw_lit, raw_act, raw_rev, 10 ** 9 - raw_lit, 10 ** 9 - raw_act, 10 ** 9 - raw_rev, n_odd, scans)) +debit = 1000 * lam_cost +need(raw_rev + debit == 844815648 and raw_rev + debit < 10 ** 9, 'conservative recharge: the reviewed upper count %d already contains every LAMBDA event of the caller (through the envelope 32 * roles * ports * len(events); rest_of: the events of each type include its LAMBDA events); the second check of #6913 counts the LAMBDA translations a second time, %d LAMBDA jobs at 1,000 each = %d for this mix, on top of the whole reviewed bound; with the scale applied once at the boundary (no per-call charge) the total is %d, below 10^9 (margin %d), so no reading of the raw count exceeds 10^9 with this caller; no term of the outer ledger reads either count' % (raw_rev, lam_cost, debit, raw_rev + debit, 10 ** 9 - raw_rev - debit)) +sc_cost = 4 * (SC.bit_length() + 1 + 1) + 4 * (1 + SC.bit_length() + 1) # one SCALE by S = 1125 at entry and one by 1/1125 at exit, at the reviewed upper rate 4 * (bits(a) + bits(d) + 1) +per_in = 18 * n * sc_cost +need(sc_cost == 104 and raw_rev + per_in == 834990640 and raw_rev + per_in + debit == 847550640 and raw_rev + per_in + debit < 10 ** 9, 'per-input scale reading (every one of the %d public registers scaled by 1125 at entry and unscaled at exit on each of the 18 calls, %d x %d x 18 = %d, an upper reading): upper %d; with the second LAMBDA count %d, below 10^9 (margin %d)' % (n, sc_cost, n, per_in, raw_rev + per_in, raw_rev + per_in + debit, 10 ** 9 - raw_rev - per_in - debit)) +Rm_paid = sum(r_ * v_ for r_, v_ in Pn.items()) +print(' CONSTANT SUBSTITUTION (FINITE-PRECOMPILATION.md:278-283): events %d; scalar allowance %d; reviewed scalar upper %d; routes %d; per call %d or %d; raw upper %d (allowance) or %d (reviewed upper); paid rank mass R = %d; growth bound 2^(raw + R f) = 2^(%d + %d f) on the conservative count' % (len(W['program']), allow, upper, routes, per_call, per_up, raw_act, raw_rev, Rm_paid, raw_rev, Rm_paid)) +src_ep = open(os.path.join(HERE, 'retained', 'runtime', 'endpoint.py')).read() +need(not any(t_ in src_ep for t_ in ('10**9', '10 ** 9', '10**7', '10 ** 7', '1e9')), 'the outer ledger source contains no scalar-work or 10^9 term') +def logsum(Wx): return sum(math.log2(1 + float(abs(Q(e_[3])))) for e_ in Wx['program'] if e_[0] in ('ADD', 'COPY')) +l02 = logsum(WB) +print(' GROWTH: events %d (#6934 word %d); sum of log2(1+|q|) over the ADD coefficients %d (#6934 word %d) against 416000; peak |row entry| on any prefix 2^%.2f; peak row denominator 2^%d; coefficient bits numerator <= %d, denominator <= %d; largest |q| %s' % (len(W['program']), len(WB['program']), round(logq), round(l02), math.log2(float(pmax)), dmaxb - 1, nbits, dbits, maxq)) +big_ = sum(1 for e_ in W['program'] if e_[0] in ('ADD', 'COPY') and abs(Q(e_[3])) >= 2 ** 12) +need(round(logq) == 82828 and round(l02) == 82770 and maxq == Q(227445, 8) and (nbits, dbits) == (24, 19) and big_ == 10 and maxq + 1 < 2 ** 16, 'sum of log2(1+|q|) %d (below 416000; the #6934 word %d); largest |q| %s = %.1f with |q| + 1 < 2^16; coefficient bits %d / %d (the #6934 word: largest |q| %s, same widths); %d ADD events here have |q| >= 2^12' % (round(logq), round(l02), maxq, float(maxq), nbits, dbits, max(abs(Q(e_[3])) for e_ in WB['program'] if e_[0] in ('ADD', 'COPY')), big_)) +cf_ = [(abs(Q(e_[3])).numerator, Q(e_[3]).denominator, i_) for i_, e_ in enumerate(W['program']) if e_[0] in ('ADD', 'COPY')] +num_max = max(cf_, key=lambda t_: (t_[0], -t_[2])); den_max = max(cf_, key=lambda t_: (t_[1], -t_[2])); n40k = sum(1 for t_ in cf_ if t_[0] > 40864) +need(num_max[0].bit_length() == nbits == 24 and den_max[1].bit_length() == dbits == 19 and (num_max[2], den_max[2], n40k) == (252, 2798, 864), 'temporaries: the coefficient numerators of the ADD events reach %d bits (largest numerator %d, first at event %d) and their denominators %d bits (largest denominator %d, at event %d); %d ADD events have a numerator above 40864 (the #6934 word: the same 24 / 19 bits). A multiply-by-a, check-divisibility, divide-by-b temporary holds a times a stored value, so its coefficient factor is %d bits wide, not 16' % (num_max[0].bit_length(), num_max[0], num_max[2], den_max[1].bit_length(), den_max[1], den_max[2], n40k, nbits)) +cb = max(abs(Q(e_[4] if e_[1] == 'ADD' else e_[3])).numerator.bit_length() for e_ in J['events'] if e_[1] in ('ADD', 'SCALE')); cd = max(Q(e_[4] if e_[1] == 'ADD' else e_[3]).denominator.bit_length() for e_ in J['events'] if e_[1] in ('ADD', 'SCALE')) +need((cb, cd) == (9, 8) and round(math.log2(float(pmax)), 2) == 23.55 and dmaxb - 1 == 27, 'coefficients: caller coefficient bits %d / %d (SCALE 256 and the gauge 1/128, in the type B caller, unchanged; the type A caller now uses only +-1, +-2, SCALE -1 and SWAP); word: largest |q| %s, peak |row entry| 2^%.2f, peak row denominator 2^%d (odd part at most 1125)' % (cb, cd, maxq, math.log2(float(pmax)), dmaxb - 1)) +nid = Counter(e_[0] for e_ in J['events'] if e_[1] == 'IDLE_ONE') +need(nid == Counter({'A': 32, 'B': 68}), 'IDLE_ONE events: %d in the type A caller, %d in the type B caller (one-site idles priced as whole H8 jobs; declared, inherited)' % (nid['A'], nid['B'])) +Y2set = set(Y2) +oy = [i_ for i_, e_ in enumerate(W['program']) if e_[0] == 'ADD' and e_[1] >= n and e_[2] in Y2set] +ox = [i_ for i_, e_ in enumerate(W['program']) if e_[0] == 'ADD' and e_[1] >= n and e_[2] in X] +ox2 = [i_ for i_, e_ in enumerate(W['program']) if e_[0] == 'ADD' and e_[1] >= n and e_[2] in X2s] +oyY = [i_ for i_, e_ in enumerate(W['program']) if e_[0] == 'ADD' and e_[1] >= n and e_[2] in Y] +def owned_reads(Wx): + nx = len(Wx['initial']); Hx = Wx['hosted']; lx = Wx['live']; Xs = set(lx); Ys = {r_ + 112 for r_ in lx}; X2x = set(Hx['X2']); Y2x = set(Hx['Y2']) + return tuple(sum(1 for e_ in Wx['program'] if e_[0] == 'ADD' and e_[1] >= nx and e_[2] in grp) for grp in (Y2x, Xs, X2x, Ys)) +ob = owned_reads(WB) +def peak_owned(Wx): + live_, pk_ = 0, 0 + for e_ in Wx['program']: + if e_[0] == 'INIT': live_ += 1; pk_ = max(pk_, live_) + elif e_[0] == 'CLEAR': live_ -= 1 + return pk_ +peakb = peak_owned(WB) +need(peakb == 40 == pkWB and peak_owned(W) == peak == 43, 'peak owned fields: %d in the #6934 word, %d in this word (same number of owned lifetimes %d against %d)' % (peakb, peak, life, sum(e_[0] == 'INIT' for e_ in WB['program']))) +need((len(oy), len(ox), len(ox2), len(oyY)) == (8, 7, 1, 0) and ob == (8, 7, 1, 0), 'owned registers reading a main register: %d events read Y2 %s, %d read X %s, %d read X2 %s, none reads Y: %d events in all (the #6934 word: %d, %d, %d, %d for Y2, X, X2, Y, %d in all); unchanged by the new registers; declared with A6; peak owned fields %d' % (len(oy), oy, len(ox), ox, len(ox2), ox2, len(oy) + len(ox) + len(ox2), ob[0], ob[1], ob[2], ob[3], sum(ob), peak)) + + +# ---- (6) outer conditions ---------------------------------------------------------------------- +E, SE, OUT = ldmod(os.path.join(HERE, 'retained', 'runtime', 'intervals.py'), 'intervals'), ldmod(os.path.join(HERE, 'retained', 'runtime', 'second_intervals.py'), 'second_intervals'), ldmod(os.path.join(HERE, 'retained', 'runtime', 'endpoint.py'), 'endpoint') +BITF = json.load(open(os.path.join(HERE, 'retained', 'bit', 'FRAGMENT-BIT-ADMISSION.json'))) +need(hashlib.sha256(open(os.path.join(HERE, 'retained', 'bit', 'FRAGMENT-BIT-ADMISSION.json'), 'rb').read()).hexdigest() == '86955dcd74bc3fa1a940419474d45054fa7b0366b71b242568680366923d9311' and BITF['status'] == 'PASS_TWO_FRAGMENTS_BIT_ORDINARY_00376669' and Q(BITF['ordinary_admitted']) == PIN, 'BIT pin %s = ordinary_admitted of the pinned #6726 admission file (status %s); not re-derived here' % (float(PIN), BITF['status'])) +KAPPA, TESTED = Q('.00362701882'), Q('.00362701882007') +LOW, UP = Q('.003627018829595'), Q('.003627018829596') +Tq = Counter({r: v for r, v in Tn.items() if v}); Pq = Counter({r: v for r, v in Pn.items() if v}) +need(KAPPA < TESTED < LOW < UP and TESTED < PIN and Q(BITF['raw_crossing'][0]) > Q(BITF['raw_tested']) > PIN, 'claim %s, tested %s, both strictly below the raw crossing %s; BIT side: raw crossing > raw tested saving > pin > tested price' % (float(KAPPA), float(TESTED), str(kn)[:19])) +print(' BIT margins: pin - tested complex price = %.3e; raw BIT tested saving - pin = %.1e; raw BIT crossing lower bound - raw BIT tested saving = %.3e' % (float(PIN - TESTED), float(Q(BITF['raw_tested']) - PIN), float(Q(BITF['raw_crossing'][0]) - Q(BITF['raw_tested'])))) +for name, k, pos in (('lower', LOW, 1), ('upper', UP, -1), ('tested', TESTED, 1)): + a, b = E.moment(Tq, 1 - k), E.moment(Pq, 1 - k); first = (a[0] - b[1], a[1] - b[0]) + tl, th = SE.moment(Tq, k); pl, ph = SE.moment(Pq, k); second = (tl - ph, th - pl) + need((first[0] > 0 and second[0] > 0) if pos > 0 else (first[1] < 0 and second[1] < 0), 'both interval engines (rational interval arithmetic, no Decimal): sign of the margin at the %s price endpoint' % name) +signed = Counter(Tq); signed.subtract(Pq); d = Q(0) +for r, c in signed.items(): + lg = E.log_bounds(r); d -= c * (E.mul(E.power(r, 1 - PIN), lg)[0] if c >= 0 else r * lg[1]) +need(d < 0, 'unique raw crossing through the BIT pin (derivative upper bound negative at the pin)') +cutoff, floor, power, offset = 11, 12, 1920, Q(1, 7); LPMIN, LP = 2225, 2226 +tt_ = 1 - TESTED; target, paidm = E.moment(Tq, tt_), E.moment(Pq, tt_) +alpha = E.divide(paidm, target); gamma = E.divide(E.moment(Pq, tt_ + offset), E.mul(E.power(cutoff, offset), target)) +delta = E.divide((Q(sum(Tq.values()) * floor),) * 2, E.mul(E.power(cutoff, TESTED), target)) +reserve, decay = Q(1, 10 ** 27), Q(31, 32) +need(alpha[1] < 1 - reserve and gamma[1] < decay and delta[1] < decay, 'tail ratios (interval engine): alpha %.12f gamma %.4f delta %.4f (cutoff 11, floor 12, offset 1/7, power 1920)' % (float(alpha[1]), float(gamma[1]), float(delta[1]))) +normalized = 1 / (1 + power * reserve) + 4 * decay ** power +need(normalized < 1, 'composite bound (predecessor pricing.py:211): 1/(1+power*reserve) + 4*decay^power < 1 at power 1920 (excess over the first term %.2e)' % float(4 * decay ** power)) +maxT = max(Tq); carrier = max(maxT, int(J['ambient_rank'])) # the compiler fit m*c <= N (FP:111-114) is on the literal carrier, 9 base rows + 8 per stage = 153 +quarter = E.power(carrier, Q(power, 4) * TESTED); factor = E.mul(E.mul(quarter, quarter), E.mul(quarter, quarter)) +eta = E.scale(E.divide((Q(1), Q(1)), factor), tt_) +need(eta[0] > Q(63, 64) ** LP and factor[1] < 2 ** LP and cutoff ** 64 < floor ** 63 and 2 * (cutoff ** power) ** 64 <= (carrier ** power) ** 63, 'compiler complement capacity and shifted exits at logarithm power %d on the literal carrier %d (the largest target rank is %d)' % (LP, carrier, maxT)) +lp_ = LPMIN + 40 +while eta[0] > Q(63, 64) ** (lp_ - 1): lp_ -= 1 +need(lp_ == LPMIN and Q(63, 64) ** (LPMIN - 1) > eta[0], 'logarithm power: on the literal carrier 153 the smallest admissible value at this price is %d (%d fails), written as %d (it is a free parameter, LOG-MAJORANT.md:110-122); the written value %d is the one the compiler and outer ledger lines above use' % (lp_, LPMIN - 1, LP, LP)) +gap = (TESTED - KAPPA) / 7; need(gap.numerator == 1, 'compiler grid: (tested-kappa)/7 = %s' % gap) +step = gap.denominator +wins = lambda j: (step * j + 1) ** LP < 2 ** j +lo_, hi_ = 1, 2 +while not wins(hi_): lo_, hi_ = hi_, 2 * hi_ +while hi_ - lo_ > 1: + m = (lo_ + hi_) // 2 + if wins(m): hi_ = m + else: lo_ = m +need(step * hi_ > 8 * power and wins(hi_) and not wins(hi_ - 1), 'explicit uniform threshold H=%d (logarithm power %d)' % (step * hi_, LP)) +Hw = step * hi_; Kbits = math.log2(power) + power * math.log2(carrier) + 2 * math.log2(Hw + 1) # K_star = v m (H+1)^2, v = the chronological power 1920, m = carrier^v (#6901 eq. (4a)) +CALLER_MASS_BITS, PATH_HEIGHT_BITS = 120.35, 157 # QUOTED, not recomputed here: majorants of the #6932 caller, computed by a script that is not part of this package +c_exact = 2 * max(v2max + PATH_HEIGHT_BITS, math.log2(float(mass)) + CALLER_MASS_BITS) +need(c_exact == 362 and abs(Kbits - 14072.3) < 0.1 and math.log2(c_exact + 1) + Kbits < Hw, 'K_star = v m (H+1)^2 with v = %d, m = %d^%d: log2 K_star = %.1f bits at the written H (computed here); with the QUOTED caller majorants (mass <= 2^%.2f, path-maximum height 157 bits; computed on the #6932 caller, not recomputed on this package\'s caller) the per-context bound is height <= %d + 157 = %d bits and magnitude <= %.2f + %.2f = %.2f bits, so c = %d and %d K_star < 2^H holds with %.3e bits to spare; status: argued from #6901 eq. (4a) and lines 299-304, computed, not reviewed' % (power, carrier, power, Kbits, CALLER_MASS_BITS, v2max, v2max + PATH_HEIGHT_BITS, math.log2(float(mass)), CALLER_MASS_BITS, math.log2(float(mass)) + CALLER_MASS_BITS, c_exact, c_exact + 1, Hw - math.log2(c_exact + 1) - Kbits)) +params = {'kappa': KAPPA, 'tested_saving': TESTED, 'complex_uniform_saving': KAPPA + 6 * gap, 'b': KAPPA + 5 * gap, 'a': KAPPA + 4 * gap, 'q': KAPPA + 3 * gap, 'bit_saving': PIN, + 'epsilon': 1 - gap, 'beta': 1 - 3 * gap, 'r0': gap / 10, 'stop': gap, 'layout': gap, 'd': gap} +led = OUT.ledger(params); led['functional_checks']['actual_new_BIT_stock_sublinear'] = params['beta'] * (1 - Q(1, 250)) +need(len(led['strict_checks']) == 54 and len(led['functional_checks']) == 4 and all(v > 0 for k in ('strict_checks', 'functional_checks') for v in led[k].values()), 'outer inventory: 54 strict and 4 functional inequalities all positive at the pin') +PINS = [('main admitted', Q('.0034'), False), ('.00343', Q('.00343'), False), ('main ordinary stock', Q('.0034363538396'), False), ('#5421', Q('.00344412'), False), + ('#4760', Q('.0034597'), False), ('#4814', Q('.003475458'), False), ('#5512', Q('.003483969976'), False), ('#6726 (the pin used)', PIN, True)] +for lab_, pin_, want_ in PINS: # the ledger needs bit_saving > kappa + 4 gap = .00351406004 + L_ = OUT.ledger(dict(params, bit_saving=pin_)); L_['functional_checks']['actual_new_BIT_stock_sublinear'] = params['beta'] * (1 - Q(1, 250)) + ok_ = TESTED < pin_ and all(v > 0 for kk in ('strict_checks', 'functional_checks') for v in L_[kk].values()) + need(ok_ == want_, 'ledger at the BIT saving %s (%s): %s%s' % (float(pin_), lab_, 'all 54 + 4 positive' if ok_ else 'fails', ', margin over the tested price %.3e' % float(pin_ - TESTED) if ok_ else '')) +need(any(v <= 0 for kk in ('strict_checks', 'functional_checks') for v in OUT.ledger(dict(params, bit_saving=params['a'] - Q(1, 10 ** 12)))[kk].values()), 'control: a BIT saving just below kappa + 4 gap (%s) is rejected' % float(params['a'])) +plus = [(7, 1), (3, 1), (5, 1)]; minus = [(9, 1), (4, 1), (1, 2)] +def dlog(terms): + lo = hi = Q(0) + for x, c in terms: + a_ = E.mul((Q(x), Q(x)), E.log_bounds(x)); lo += c * a_[0]; hi += c * a_[1] + return lo, hi +def d2log(terms): + hi = Q(0) + for x, c in terms: + a_ = E.mul(E.mul((Q(x), Q(x)), E.log_bounds(x)), E.log_bounds(x)); hi += c * a_[1] + return hi +dpl, dmi = dlog(plus), dlog(minus); d1 = (dpl[0] - dmi[1], dpl[1] - dmi[0]); Mq = d2log(plus) + d2log(minus) +need(d1[1] + PIN * Mq < 0, 'input-lift saving lemma of #6833 (pricing.py:128-156), cap moved to the pin: g prime negative on 1-pin..1 (its crude bound holds to about .0037765)') +for nm, k_ in (('claim', KAPPA), ('tested', TESTED)): + tl_ = 1 - k_; gl = sum(c * E.power(x, tl_)[0] for x, c in plus) - sum(c * E.power(x, tl_)[1] for x, c in minus) + need(gl > 0 and k_ * (-d1[1]) - k_ * k_ * Mq / 2 > 0, 'input-lift saving positive at the %s price' % nm) + +# ---- declared departures ----------------------------------------------------------------------- +print('DEPARTURES (class; exact count here):') +for cls, what in ( + ('FRAMEWORK CHANGE (this package): odd gate scalars', 'the scalar alphabet of the native word. Dyadic coefficients and SCALE units (local.py:146,149, the verifier copies, native.py:65) become elements and units of A = Z[1/2, 1/3, 1/5], with |q|+1 < 2^16 kept, a declared certificate S = 3^e 5^g (here 1125 = 3^2 5^3) for which S times every prefix row and every pre-ADD product is dyadic, and dyadic public output rows; execution multiplies every root input by S, divides by the odd part of each denominator after a checked divisibility, and divides by S at the exit. The word has %d odd divisions (%d SCALE, %d ADD), %d scans per call. Maintainers must accept this clause; it is not a result of this package. PROOF.md names the changed clauses, the replacement and the penalty; exactness is conditional on exact child returns.' % (n_odd, odd_events['SCALE'], odd_events['ADD'], scans)), + ('new form: per-port root', 'unchanged from the #6934 word: type A (96 ports) is the two-chain root of #6902 (two #6833 roots, t = 0, n = 40), type B (8 ports) is the hosted root of #6889 (t = -1/2, n = 38); the caller is block diagonal over 78 roles, with one stage variable per stage common to both types and 18 joint contacts, each one native event serving both types (HOST2 at the type A ports, HOST at the type B ports). Type A fails the same three family lines as #6902 (t != 0, alpha and beta dyadic units, strongly connected); type B passes every line of its checker. No new failing line.'), + ('new form', 'unchanged: the 8 hosted ports keep the hosted form with no second mains (their X and Y are single planes); the 96 other ports have second mains with the same frame labels as the first mains; 400 mains in total (96 x 4 + 8 x 2). The gauge SCALE 1/2 of the hosted mains is informational here (the endpoint X = x - y, Y = (x + y)/2 covers it).'), + ('new form: type A caller blocks', 'the constant blocks of the type A caller (maximal runs of ADD, SCALE -1 and SWAP between two nonconstant events or joint contacts) are the blocks of #6912 (CubeJerry); check_caller_blocks.py proves each changed block has the same 40 x 40 integer matrix and the joint caller the same 78 x 78 matrix at eight points; the type B caller is unchanged and not covered by that rewrite.'), + ('convention (A6, load-bearing)', 'owned ascent: 23 owned rises (rank mass 56) against native.py:55 / local.py:126; peak owned %d; owned registers read mains: Y2 %d events, X %d events, X2 %d events (%d events in all; %d in the #6934 word). check_a6.py runs the rises as in #6914 and the width-2 phase test of #6930. No ascent, no word.' % (peak, len(oy), len(ox), len(ox2), len(oy) + len(ox) + len(ox2), sum(ob))), + ('new form: seven main contacts moved onto shared helper wires', 'against the #6934 word (data/prior_word_6934.json.gz, replayed exactly here): public %d against %d registers (%d new registers: seven wires, each read by F and R mains through one register, and two plain split tails); %d events removed (%d main MOVEs, %d direct contact ADDs) and %d added; the frame table, the 54 owned lifetimes (as multisets) and the 51 owned fields are unchanged, the peak of concurrent owned fields is %d against %d (a retiming of owned INIT and CLEAR, commutations only); T and P differ as printed above (the rank mass of both changes by the same amount per call, S = 1520); the reorder of commuting events is checked register by register in step (1c).' % (n, nold, len(newh), sum(rem_.values()), rA['MOVE'], rA['ADD'], sum(add_.values()), peak, pkWB)), + ('verifier', 'endpoint literal native.py:75-77 / local.py:168: the target is X=x, Y=x+y, X2=x2-y2, Y2=y2 at 96 ports and X=x-y, Y=(x+y)/2 at 8 ports; verify_host3_odd.py replaces the dyadic clauses as above (diff against verify_host3_dyadic.py: the helper lines, the SCALE clause, the ADD and COPY clause with the S certificate, the public-row clause).'), + ('verifier', 'events %d, public %d, owned roles %d, lifetimes %d, peak owned %d against local.py:52,54,103 and pricing.py:84-87 literals; per-call scalar work %d against the displayed 10^7 (pricing.py:93); coefficient bits %d/%d against 8/7 (pricing.py:96-97); the event count is declared as this package\'s own bound (the retained 26,000 cap of other packages is not used).' % (len(W['program']), n, NO, life, peak, per_call, nbits, dbits)), + ('convention', 'LAMBDA (%d + %d = 206 events by type), IDLE_ONE (32 + 68 events) as in the #6934 word; not on main; the price of LAMBDA is a review question (above).' % (nlA, nlB)), + ('assumption', 'dirty owned erasure (%d erasures): the owned_erasure assumption, unchanged.' % dirty)): + print(' [%s] %s' % (cls, what)) +need(True, 'departures listed') +print('PASS_P104_MAIN_WIRE_NATIVE') diff --git a/research/query-only-precision-envelope/reference/ODD-COMMON-GRID.md b/research/query-only-precision-envelope/reference/ODD-COMMON-GRID.md new file mode 100644 index 0000000000..edea8e98a0 --- /dev/null +++ b/research/query-only-precision-envelope/reference/ODD-COMMON-GRID.md @@ -0,0 +1,241 @@ +# Common exact precision for the current odd-scalar caller + +Prepared for @CubeJerry with substantial OpenAI assistance. Apache-2.0. +**Source-bound precision implication. No new kappa or supplier admission.** + +## 1. Exact claim, sources and inherited interfaces + +The frozen candidate is DreamingOfClouds' [#6934](https://github.com/CrocSwap/integer-mult-bounds/pull/6934), +head `4e13b7acdbea1c9f12aa88126435360eecea7401`: its 71,069-event native word +and actual 3,221-event joint caller. Its proof leaves the caller majorants +quoted from an earlier caller and the compiler-precision specialization +unreviewed. This package supplies an independently computed full prefix +envelope and its all-size numerical implication. + +Use its **per-call scale-1125** implementation, then inline the retained +chronological compiler and ordinary recursion. Under the nonprecision +interfaces below, one common format suffices: +F=p+D fractional bits, W=p+h+2D+3 signed bits per real/imaginary component, +and W+26 temporary bits. Odd divisors require neither an odd-denominator +numeric field nor a numerical precision reset at child returns. + +Odd-denominator clearing and depth-powered boundary scaling are credited to +icekylinx's [#104](https://github.com/CrocSwap/integer-mult-bounds/pull/104) and +its successors. The fixed-root Clifford bound and context recurrence belong +to [#6901](https://github.com/CrocSwap/integer-mult-bounds/pull/6901), with its +#4586/#5443/#6878 lineage. The candidate word, scale1125 and per-call wrapper +are #6934's, following #6932. None of these methods or endpoint identities is +claimed anew. + +Retain precisely these interfaces: + +1. Native and whole-job adapters have their stated arbitrary-input, + absolute-phase Gaussian-dyadic Clifford actions with complete spectators. Owned INIT/CLEAR + have ideal semantics. Distinct productive entrances are actual owners; + copied correlated fields earn no new target credit. +2. Every occurrence and inverse return preserves the same complete D-bit + selected root factor. Descendant remainder bits stay in that factor; + only the true external ROW factor is split or selected. +3. Scalar/C operations and adapter returns finish before another operation + consumes a partially written field. The four-instruction scalar SWAP is + not interrupted by another swap, child or consumer. +4. Completed raw callers have the candidate's independent positive Gaussian + endpoints and restored owners. Chronological product, completion, + splitting and integer compiler use the retained scheduling, with the + parameters in section5. Spectral strictification, complete native/caller + admission and physical tariffs remain separate. + +These interfaces do not assume a common grid, a numerical exact-child oracle +or physical precision closure. Define the finite ideal recursion by rank +descent, prove its invariant, then implement its arithmetic on that grid. +An ideal endpoint premise is not a claim that a rounded service already +returns that endpoint. + +Start after a separately paid root boundary. Each original real/imaginary +component belongs to 2^-p Z and has absolute value strictly below2^h, with +p,h>=0 and D>=1. Finite external row counts, dirty public inputs, correlations +and spectators are arbitrary. Root preprocessing must supply p,h and layouts. + +## 2. Exact finite source envelopes + +The independent rational row interpreter treats MOVE as a chart change, +INIT as owned zero, CLEAR as lifetime completion, and ADD/COPY/SCALE as +literal row operations. It checks common-frame use and completed frames. +All stored rows and separate pre-ADD products, multiplied by S=1125, are +dyadic; completed public rows themselves are dyadic. The full scan visits +14,060,742 coefficients and obtains: + +| Local property | Exact bound | +|---|---:| +| Dyadic denominator height after scaling | 24 | +| Maximum scaled row/product l1 mass | 1636447290138225/16384 <2^37 | +| Scalar numerator bit length | 24 | + +Input scaling is included because S<2^37. These are finite source +certificates, not an independent native-map or all-size proof. + +A separate caller recurrence majorizes expansions in **products of Clifford +operators**, without commuting the products or substituting numerical +characters. For ADD, use M_t+|q|M_s and +max(H_t,H_s+v2(den(q))). SCALE, SWAP and QUERY use their literal rules. +IDLE is a Clifford product. LAMBDA is expanded as +((1+s i)I+(1-s i)Q^2)/2 for s=+-1. With Gaussian coefficient mass +|Re|+|Im|, its safe update is M<-2M and H<-H+1. + +At a joint event use the two actual type-A shear endpoints and type-B +(x-Qy,(Q^-1 x+y)/2), followed by the relevant Clifford. Their roles are +disjoint; both old B bounds are read before either is updated. The complete +current caller gives: + +| Cut | Dyadic height | Coefficient mass | +|---|---:|---:| +| Any completed caller event | <=163 | <=16246698892210214036146399419475929893435/256 <2^126 | +| Entrance of any joint call | <=154 | <=2^124 | + +Fresh productive helpers have mass1 and height0 relative to the current +raw-call entrance. A nested helper retains its actual entrance expansion and +all inherited debt relative to the original root inputs. During a local +call, composition with its scaled word adds the local bounds. Therefore, +including both caller-only and local-interior cuts, the raw caller has + +A=max(163,154+24)=178 exterior denominator bits, +B=max(126,124+37)=161 coefficient-mass bits, per unfinished context. + +A separate whole-stream product bound gives caller height1240 and mass +below2^4362. It cross-checks the eventwise numerical result using a different, +coarser aggregation. The written induction on these source operations is the +proof; endpoint norms alone would be insufficient. + +## 3. Per-call odd clearing and recursive reset + +For formal input row R and current chart D_v, the scaled local word holds +D_v(S R x). The source certificate makes its exterior coefficients dyadic. +The same certificate covers a pre-ADD product. Thus the odd part of each +divisor divides the stored integer numerator on every sufficiently fine +binary grid. At completion the unscaled endpoint is dyadic, so final +division by S is exact too. + +Each nested invocation scales its own actual entrances, runs the word and +unscales its completed outputs. Unfinished contexts accumulate mass and +binary denominator debt. A completed positive Gaussian endpoint resets the +**extra exterior debt relative to its entrance**, retaining all debt already +present at that entrance. Its Gaussian action joins the Clifford factor. +No numerical grid is reset. + +One S is charged per unfinished local context. Completed siblings add no +persistent debt. Scaling once by S at the outer boundary is a different +program and cannot replace arbitrary nesting: the boundary-only program +needs S raised to a proved depth bound, as #104 prescribes. The verifier +includes a nested exact-division countercontrol to this mistaken shortcut. + +This is a formal linear expansion in original complete root inputs, so no +independence of their values is needed. The expansion is proof state, not a +runtime data structure. Exterior scalars stay outside tensor powers. + +## 4. Current compiler depth and the integer threshold + +The candidate parameters are v=1920, carrier153, separated paid ceiling11^v, +productive floor12^v and m=153^v. In particular r_max=2. +These apply to the separated rule, not the unpowered raw rank-one targets. + +The retained compiler has complement n-s<(1-1/m)n and deepest-exit ratio +at most (r_max/m)(r_max/k_min)^G <=1-1/m. Its path has at most +m(1+floor(log2 n)) nonbase frames, each carrying at most +v(1+floor(log2 n)) raw contexts. Thus the credited recurrence specializes to + +K(n) <= v m (1+floor(log2 n))^2. + +Independently regenerate the written threshold from the source's exact +candidate/tested rationals and logarithm power2224: +H=1,339,210,000,000,000,000, N=2^H, and +K_star=1920*153^1920*(H+1)^2. +K_star has14066 bits; 357K_star has14075 bits, so 357K_star<2^H. +The threshold search has one crossing: with L=2224 and step=10^13, +(step*j+1)^L>2^j for j<=2L. For j>=2L the ratio of successive +((step*j+1)^L/2^j) values is strictly below +(1+1/j)^L/2 < 1/(2(1-L/j)) <=1. Thus checking the adjacent +integer indices justifies the regenerated threshold. +No floating logarithm or construction of N is used. Also153<2^8 and +8*1920=1, N ell<=N^ell<=D; for ell=0, t=0. Therefore 356t= 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/query-only-precision-envelope/source_binding.py b/research/query-only-precision-envelope/source_binding.py new file mode 100644 index 0000000000..9f0e0a8cba --- /dev/null +++ b/research/query-only-precision-envelope/source_binding.py @@ -0,0 +1,85 @@ +"""Authenticate the frozen source capsule; no network or Git is required. + +Prepared for @CubeJerry with substantial OpenAI assistance. Apache-2.0. +""" +from fractions import Fraction +import gzip +import hashlib +import json +from pathlib import Path +import sys +import types + +ROOT = Path(__file__).resolve().parent + + +def need(ok, message): + if not ok: + raise ValueError(message) + + +def digest(data): + return hashlib.sha256(data).hexdigest() + + +def blob(data): + return hashlib.sha1(b"blob " + str(len(data)).encode() + b"\0" + data).hexdigest() + + +def check_dependencies(): + items = json.loads((ROOT / "DEPENDENCIES.json").read_bytes())["files"] + need(len(items) == 11, "exact eleven-file immutable capsule") + seen = set() + for row in items: + name = row["local_path"] + path = ROOT / name + need(name not in seen and path.resolve().is_relative_to(ROOT), "capsule path") + seen.add(name) + data = path.read_bytes() + need(len(data) == row["bytes"], "source length: " + name) + need(digest(data) == row["sha256"], "source SHA-256: " + name) + need(blob(data) == row["git_blob"], "source Git blob: " + name) + return len(items) + + +def sources(): + check_dependencies() + caller = json.loads((ROOT / "data/caller.json").read_bytes()) + word = json.loads(gzip.decompress((ROOT / "data/word.json.gz").read_bytes())) + need(len(caller["events"]) == 3095 and caller["roles"] == 76, "frozen caller shape") + need(len(word["program"]) == 71144 and word["public"] == 1461, "frozen local word") + return caller, word + + +def load_vendor(name, relative): + """Compile authenticated bytes directly, never a cached .pyc.""" + check_dependencies() + path = ROOT / relative + module = types.ModuleType(name) + module.__file__ = str(path) + sys.modules[name] = module + exec(compile(path.read_bytes(), str(path), "exec"), module.__dict__) + return module + + +def fraction_string(x): + return str(Fraction(x)) + + +def strict_power(x): + """Smallest nonnegative k for which the exact nonnegative x is < 2**k.""" + x = Fraction(x) + need(x >= 0, "positive majorant") + k = max(0, x.numerator.bit_length() - x.denominator.bit_length()) + while x >= 1 << k: + k += 1 + while k and x < 1 << (k - 1): + k -= 1 + return k + + +def oddpart(n): + need(n > 0, "positive denominator") + while n % 2 == 0: + n //= 2 + return n diff --git a/research/query-only-precision-envelope/vendor/exact_scalar_tables.py b/research/query-only-precision-envelope/vendor/exact_scalar_tables.py new file mode 100644 index 0000000000..1cc22f75fb --- /dev/null +++ b/research/query-only-precision-envelope/vendor/exact_scalar_tables.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/query-only-precision-envelope/vendor/machine.py b/research/query-only-precision-envelope/vendor/machine.py new file mode 100644 index 0000000000..acf475e4fc --- /dev/null +++ b/research/query-only-precision-envelope/vendor/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/query-only-precision-envelope/verify.py b/research/query-only-precision-envelope/verify.py new file mode 100644 index 0000000000..1460bea58a --- /dev/null +++ b/research/query-only-precision-envelope/verify.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python3 +"""Replay only the explicitly requested bounded source/countermodel certificate. + +Prepared for @CubeJerry with substantial OpenAI assistance. Apache-2.0. +""" +import argparse +import json +from pathlib import Path +import sys + +ROOT = Path(__file__).resolve().parent +sys.path.insert(0, str(ROOT)) +from source_binding import check_dependencies, need +import envelopes +import guards +import boundary +import controls + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("--suite", choices=("envelopes", "guards", "boundary", "controls", "all"), default="all") + parser.add_argument("--write", action="store_true", help="write the deterministic local receipt before freeze") + args = parser.parse_args() + files = check_dependencies() + modules = dict(envelopes=envelopes, guards=guards, boundary=boundary, controls=controls) + for name, module in modules.items(): + if args.suite not in (name, "all"): + continue + result = module.run() + path = ROOT / (name.upper() + ".json") + if args.write: + path.write_text(json.dumps(result, indent=2, sort_keys=True) + "\n") + else: + need(result == json.loads(path.read_bytes()), "frozen receipt agrees: " + name) + print("PASS_QUERY_ONLY_PRECISION_" + name.upper(), flush=True) + print("AUTHENTICATED_SOURCE_FILES", files) + + +if __name__ == "__main__": + main()